Commit: 4b7500353ac0a8b8991b8d91b06e97eb52ab1d43
Author: Lukas Tönne
Date:   Thu Feb 26 13:42:24 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB4b7500353ac0a8b8991b8d91b06e97eb52ab1d43

Fix for cache modifier linking and handling of the default case (no
cachd modifier).

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

M       source/blender/blenkernel/intern/DerivedMesh.c
M       source/blender/blenloader/intern/readfile.c

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

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index d36cc3f..3be32ca 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1560,13 +1560,17 @@ static void mesh_calc_modifiers(Scene *scene, Object 
*ob, float (*inputVertexCos
        
        if (BKE_cache_read_derived_mesh(G.main, scene, scene->r.cfra, ob, 
&cachedm)) {
                CacheModifierData *cmd = (CacheModifierData 
*)mesh_find_cache_modifier(scene, ob, required_mode);
-               firstmd = &cmd->modifier;
-               
-               /* use the cache result as output of the modifier
-                * rather than as the final dm
-                */
-               cmd->output_dm = cachedm;
-               cachedm = NULL;
+               if (cmd) {
+                       firstmd = &cmd->modifier;
+                       
+                       /* use the cache result as output of the modifier
+                        * rather than as the final dm
+                        */
+                       cmd->output_dm = cachedm;
+                       cachedm = NULL;
+               }
+               else
+                       firstmd = NULL;
        }
        else {
                firstmd = mesh_find_start_modifier(scene, ob, 
&virtualModifierData, required_mode, useDeform);
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 1ca66ff..a80f56d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4928,6 +4928,12 @@ static void direct_link_modifiers(FileData *fd, ListBase 
*lb)
                        }
                        lmd->cache_system = NULL;
                }
+               else if (md->type == eModifierType_Cache) {
+                       CacheModifierData *cmd = (CacheModifierData *)md;
+                       
+                       cmd->output_dm = NULL;
+                       cmd->flag &= ~MOD_CACHE_USE_OUTPUT;
+               }
        }
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to