summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd/storage_rd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-01 07:31:42 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-01 07:31:42 +0100
commit0ba7e5a40aeb6ca890266ca3962d8cc64f3a9161 (patch)
treea4b02827b5d0e6dd81b63ec2d41e01dddb49f005 /servers/rendering/renderer_rd/storage_rd
parentdf68909da4364cc429d2feda990ba9982fef5831 (diff)
parentcdc6c00b5fe758a5246709a68bdb8e18b8613e53 (diff)
Merge pull request #72464 from clayjohn/RD-skeleton-crash
Check if Skeleton exists before reading when calculating blend shapes
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd')
-rw-r--r--servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
index 9124886764..f65676185c 100644
--- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
@@ -986,7 +986,10 @@ void MeshStorage::update_mesh_instances() {
push_constant.skin_stride = (mi->mesh->surfaces[i]->skin_buffer_size / mi->mesh->surfaces[i]->vertex_count) / 4;
push_constant.skin_weight_offset = (mi->mesh->surfaces[i]->format & RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 4 : 2;
- Transform2D transform = mi->canvas_item_transform_2d.affine_inverse() * sk->base_transform_2d;
+ Transform2D transform = Transform2D();
+ if (sk && sk->use_2d) {
+ transform = mi->canvas_item_transform_2d.affine_inverse() * sk->base_transform_2d;
+ }
push_constant.skeleton_transform_x[0] = transform.columns[0][0];
push_constant.skeleton_transform_x[1] = transform.columns[0][1];
push_constant.skeleton_transform_y[0] = transform.columns[1][0];