Fix T49405: Crash when baking with adaptive subdivision
authorMai Lavelle <mai.lavelle@gmail.com>
Wed, 25 Jan 2017 05:35:20 +0000 (00:35 -0500)
committerMai Lavelle <mai.lavelle@gmail.com>
Wed, 25 Jan 2017 05:40:45 +0000 (00:40 -0500)
Blenders baking system currently doesn't support the topology used by
adaptive subdivision and primitive ids will be wrong or out of range
leading to crashes. Updating the baking system to support other
topologies would be a bit involved, so for now we simply disable
subdivision while baking to avoid crashes.

intern/cycles/blender/blender_mesh.cpp

index 66893d4d6680fdeec6139e29211a63b33b7312c7..85117cfff7bb412db6c0cdca6c55afc8137e5d4b 100644 (file)
@@ -927,6 +927,13 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob,
 
                mesh->subdivision_type = object_subdivision_type(b_ob, preview, experimental);
 
+               /* Disable adaptive subdivision while baking as the baking system
+                * currently doesnt support the topology and will crash.
+                */
+               if(scene->bake_manager->get_baking()) {
+                       mesh->subdivision_type = Mesh::SUBDIVISION_NONE;
+               }
+
                BL::Mesh b_mesh = object_to_mesh(b_data,
                                                 b_ob,
                                                 b_scene,