Fix T58679: Missing modifiers update on changes to texture
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 5 Dec 2018 16:35:13 +0000 (17:35 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 5 Dec 2018 16:35:48 +0000 (17:35 +0100)
source/blender/depsgraph/DEG_depsgraph_build.h
source/blender/depsgraph/intern/depsgraph_build.cc
source/blender/modifiers/intern/MOD_displace.c
source/blender/modifiers/intern/MOD_warp.c
source/blender/modifiers/intern/MOD_wave.c

index 14468b33822360241d9a9a9660b07967572ae226..a81dd4c88527b2e7887ac5cbd4ac8a720c7c57c1 100644 (file)
@@ -43,6 +43,7 @@ struct Depsgraph;
 struct CacheFile;
 struct EffectorWeights;
 struct Collection;
+struct ID;
 struct Main;
 struct ModifierData;
 struct Object;
@@ -148,6 +149,11 @@ void DEG_add_object_cache_relation(struct DepsNodeHandle *handle,
                                    struct CacheFile *cache_file,
                                    eDepsObjectComponentType component,
                                    const char *description);
+/* Adds relation from DEG_OPCODE_GENERIC_DATABLOCK_UPDATE of a given ID.
+ * Is used for such entities as textures and images. */
+void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
+                                 struct ID *id,
+                                 const char *description);
 
 /* Adds relations from the given component of a given object to the given node
  * handle AND the component to the point cache component of the node's ID.
index 408c6abb0c9214a957ac689e5269e185e18ae390..5ff504bc8c683bbd112cae7a35e51ed821021e38 100644 (file)
@@ -185,6 +185,20 @@ void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
        }
 }
 
+void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
+                                 struct ID *id,
+                                 const char *description)
+{
+       DEG::OperationKey operation_key(
+               id,
+               DEG::DEG_NODE_TYPE_GENERIC_DATABLOCK,
+               DEG::DEG_OPCODE_GENERIC_DATABLOCK_UPDATE);
+       DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
+       deg_node_handle->builder->add_node_handle_relation(operation_key,
+                                                          deg_node_handle,
+                                                          description);
+}
+
 void DEG_add_special_eval_flag(struct DepsNodeHandle *node_handle,
                                ID *id,
                                uint32_t flag)
index a477191357eedc5ab4dc9a1ee0518a03ad1263bf..1da1897bfceffacf528d9bcc611184da34e728c0 100644 (file)
@@ -157,6 +157,9 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
        {
                DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
        }
+       if (dmd->texture != NULL) {
+               DEG_add_generic_id_relation(ctx->node, &dmd->texture->id, "Displace Modifier");
+       }
 }
 
 typedef struct DisplaceUserdata {
index aea530e7b6e60b21c86f929df16b3a9228d6dacb..3befe0a94d73424aa65aa79f357926f8f4ff8bea 100644 (file)
@@ -150,6 +150,9 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
        if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
                DEG_add_object_relation(ctx->node, wmd->map_object, DEG_OB_COMP_TRANSFORM, "Warp Modifier map");
        }
+       if (wmd->texture != NULL) {
+               DEG_add_generic_id_relation(ctx->node, &wmd->texture->id, "Warp Modifier");
+       }
 }
 
 static void warpModifier_do(
index a517f753791b8b989b1f510874e31ffdbaf12846..f6192d645e9cedee6eb2e81d76f2f69974b87998 100644 (file)
@@ -126,6 +126,9 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
        if (wmd->objectcenter != NULL || wmd->map_object != NULL) {
                DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
        }
+       if (wmd->texture != NULL) {
+               DEG_add_generic_id_relation(ctx->node, &wmd->texture->id, "Wave Modifier");
+       }
 }
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)