Fix for [#17421] Issue with Displace modifier not updating with
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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user