Page MenuHome
Paste P1068

T68359 snippet
ActivePublic

Authored by Philipp Oeser (lichtwerk) on Aug 7 2019, 1:52 PM.
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index c672bc9f3e2..ae789aaa47c 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -1002,6 +1002,14 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph &b_depsgraph,
oldcurve_keys.steal_data(mesh->curve_keys);
oldcurve_radius.steal_data(mesh->curve_radius);
+ /* ensure bvh rebuild if smoke type changed from flow to domain, not sure why... */
+ bool oldhas_voxel_attributes = false;
+ foreach (Attribute &attr, mesh->attributes.attributes) {
+ if (attr.element == ATTR_ELEMENT_VOXEL) {
+ oldhas_voxel_attributes = true;
+ }
+ }
+
mesh->clear();
mesh->used_shaders = used_shaders;
mesh->name = ustring(b_ob_data.name().c_str());
@@ -1048,9 +1056,17 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph &b_depsgraph,
sync_mesh_fluid_motion(b_ob, scene, mesh);
/* tag update */
+ bool has_voxel_attributes = false;
+ foreach (Attribute &attr, mesh->attributes.attributes) {
+ if (attr.element == ATTR_ELEMENT_VOXEL) {
+ has_voxel_attributes = true;
+ }
+ }
+
bool rebuild = (oldtriangles != mesh->triangles) || (oldsubd_faces != mesh->subd_faces) ||
(oldsubd_face_corners != mesh->subd_face_corners) ||
- (oldcurve_keys != mesh->curve_keys) || (oldcurve_radius != mesh->curve_radius);
+ (oldcurve_keys != mesh->curve_keys) || (oldcurve_radius != mesh->curve_radius) ||
+ (oldhas_voxel_attributes != has_voxel_attributes);
mesh->tag_update(scene, rebuild);