Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-03-11 22:32:30 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-03-11 22:45:39 +0300
commite6d0a438ab951f188f4fc7e2678a0f867b9b350f (patch)
tree0d26552884befeeca6d4ada047e2156a0d0164ed /intern/cycles/blender
parent6cf4861c3ac09fd65a765e8f8e3584713cc5303b (diff)
Fix T73626: crash scrubbing timeline with Cycles viewport and smoke/fire
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/blender_volume.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/intern/cycles/blender/blender_volume.cpp b/intern/cycles/blender/blender_volume.cpp
index 60ef4c5ed87..237c5d061e8 100644
--- a/intern/cycles/blender/blender_volume.cpp
+++ b/intern/cycles/blender/blender_volume.cpp
@@ -216,9 +216,22 @@ static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Mesh *mesh, float
}
}
+/* If the voxel attributes change, we need to rebuild the bounding mesh. */
+static vector<int> get_voxel_image_slots(Mesh *mesh)
+{
+ vector<int> slots;
+ for (const Attribute &attr : mesh->attributes.attributes) {
+ if (attr.element == ATTR_ELEMENT_VOXEL) {
+ slots.push_back(attr.data_voxel().svm_slot());
+ }
+ }
+
+ return slots;
+}
+
void BlenderSync::sync_volume(BL::Object &b_ob, Mesh *mesh, const vector<Shader *> &used_shaders)
{
- bool old_has_voxel_attributes = mesh->has_voxel_attributes();
+ vector<int> old_voxel_slots = get_voxel_image_slots(mesh);
mesh->clear();
mesh->used_shaders = used_shaders;
@@ -229,7 +242,7 @@ void BlenderSync::sync_volume(BL::Object &b_ob, Mesh *mesh, const vector<Shader
}
/* Tag update. */
- bool rebuild = (old_has_voxel_attributes != mesh->has_voxel_attributes());
+ bool rebuild = (old_voxel_slots != get_voxel_image_slots(mesh));
mesh->tag_update(scene, rebuild);
}