[Bf-blender-cvs] [e6d0a438ab9] master: Fix T73626: crash scrubbing timeline with Cycles viewport and smoke/fire

Brecht Van Lommel noreply at git.blender.org
Wed Mar 11 20:48:42 CET 2020


Commit: e6d0a438ab951f188f4fc7e2678a0f867b9b350f
Author: Brecht Van Lommel
Date:   Wed Mar 11 20:32:30 2020 +0100
Branches: master
https://developer.blender.org/rBe6d0a438ab951f188f4fc7e2678a0f867b9b350f

Fix T73626: crash scrubbing timeline with Cycles viewport and smoke/fire

===================================================================

M	intern/cycles/blender/blender_volume.cpp

===================================================================

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);
 }



More information about the Bf-blender-cvs mailing list