Fix cycles mesh synchronization being too slow with vector blur and duplis.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 17 Oct 2013 16:05:57 +0000 (16:05 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 17 Oct 2013 16:05:57 +0000 (16:05 +0000)
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_object.cpp
intern/cycles/blender/blender_sync.h

index 940a923e5afda8226c1462890f9342baee05f17b..f6c7319e2101edce4e1a836ce5be1d07b34792a3 100644 (file)
@@ -539,6 +539,12 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
        if(!size || !ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview))
                return;
 
+       /* ensure we only sync instanced meshes once */
+       if(mesh_motion_synced.find(mesh) != mesh_motion_synced.end())
+               return;
+
+       mesh_motion_synced.insert(mesh);
+
        /* get derived mesh */
        BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, false);
 
index 461e897efe17e00e52044b447d92110d958b7ae8..ba584e172dcb3c7d1e7cf28b1bd5fe9d30367e14 100644 (file)
@@ -405,6 +405,9 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
                mesh_synced.clear();
                particle_system_map.pre_sync();
        }
+       else {
+               mesh_motion_synced.clear();
+       }
 
        /* object loop */
        BL::Scene::objects_iterator b_ob;
@@ -492,6 +495,9 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
                        scene->particle_system_manager->tag_update(scene);
                mesh_synced.clear();
        }
+
+       if(motion)
+               mesh_motion_synced.clear();
 }
 
 void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override)
index f6e1922957889a8e57e4d124b298e85583b07b1b..295b1fcee5c5096235eedd8abdfd11bf14dc7478 100644 (file)
@@ -108,6 +108,7 @@ private:
        id_map<ObjectKey, Light> light_map;
        id_map<ParticleSystemKey, ParticleSystem> particle_system_map;
        set<Mesh*> mesh_synced;
+       set<Mesh*> mesh_motion_synced;
        void *world_map;
        bool world_recalc;