Fix for [#17421] Issue with Displace modifier not updating with
authorBen Batt <benbatt@gmail.com>
Tue, 5 Aug 2008 14:42:04 +0000 (14:42 +0000)
committerBen Batt <benbatt@gmail.com>
Tue, 5 Aug 2008 14:42:04 +0000 (14:42 +0000)
                 animated textures

I have added a dependsOnTime function for the Displace modifier which checks
if the displacement texture has IPOs, is a plugin, or uses an animated image.

source/blender/blenkernel/BKE_texture.h
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/texture.c

index fade0f8cbaa4a1b1555b7c85894c2658e076a859..c162a04e0557a7859302a0d69ec7e16890049ab5 100644 (file)
@@ -73,6 +73,7 @@ void    BKE_free_envmap(struct EnvMap *env);
 struct EnvMap *BKE_add_envmap(void);
 struct EnvMap *BKE_copy_envmap(struct EnvMap *env);
 
+int     BKE_texture_dependsOnTime(const struct Tex *texture);
 
 #endif
 
index 503654717aed1f8026bd1e9a570fb8365f75d3ac..2cb64896d87731340d7c4397e44feb7f9443f436 100644 (file)
@@ -2999,6 +2999,20 @@ CustomDataMask displaceModifier_requiredDataMask(ModifierData *md)
        return dataMask;
 }
 
+static int displaceModifier_dependsOnTime(ModifierData *md)
+{
+       DisplaceModifierData *dmd = (DisplaceModifierData *)md;
+
+       if(dmd->texture)
+       {
+               return BKE_texture_dependsOnTime(dmd->texture);
+       }
+       else
+       {
+               return 0;
+       }
+}
+
 static void displaceModifier_foreachObjectLink(ModifierData *md, Object *ob,
                                               ObjectWalkFunc walk, void *userData)
 {
@@ -7354,6 +7368,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                mti->initData = displaceModifier_initData;
                mti->copyData = displaceModifier_copyData;
                mti->requiredDataMask = displaceModifier_requiredDataMask;
+               mti->dependsOnTime = displaceModifier_dependsOnTime;
                mti->foreachObjectLink = displaceModifier_foreachObjectLink;
                mti->foreachIDLink = displaceModifier_foreachIDLink;
                mti->updateDepgraph = displaceModifier_updateDepgraph;
index ad139220785679c33887bf8f297e34c7a4c9f8be..44342c026768739371c9d679380d7a66d67790bf 100644 (file)
@@ -845,3 +845,31 @@ void BKE_free_envmap(EnvMap *env)
 }
 
 /* ------------------------------------------------------------------------- */
+int BKE_texture_dependsOnTime(const struct Tex *texture)
+{
+       if(texture->plugin)
+       {
+               // assume all plugins depend on time
+               return 1;
+       }
+       else if(texture->ima)
+       {
+               if(texture->ima->source == IMA_SRC_SEQUENCE ||
+                  texture->ima->source == IMA_SRC_MOVIE ||
+                  texture->ima->source == IMA_SRC_GENERATED)
+               {
+                       return 1;
+               }
+       }
+       else if(texture->ipo)
+       {
+               // assume any ipo means the texture is animated
+               return 1;
+       }
+       else
+       {
+               return 0;
+       }
+}
+
+/* ------------------------------------------------------------------------- */