Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 5 Apr 2018 16:25:05 +0000 (18:25 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 5 Apr 2018 16:25:05 +0000 (18:25 +0200)
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_nodes.h
source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc

index 565218d8be009dececbfede8c18c3ee01045b934..eff6b34fee6f88deb540da20fafdf75539b34630 100644 (file)
@@ -118,51 +118,6 @@ namespace DEG {
 
 namespace {
 
-struct BuilderWalkUserData {
-       DepsgraphNodeBuilder *builder;
-};
-
-static void modifier_walk(void *user_data,
-                          struct Object * /*object*/,
-                          struct ID **idpoin,
-                          int /*cb_flag*/)
-{
-       BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
-       ID *id = *idpoin;
-       if (id == NULL) {
-               return;
-       }
-       switch (GS(id->name)) {
-               case ID_OB:
-                       data->builder->build_object(NULL,
-                                                   (Object *)id,
-                                                   DEG_ID_LINKED_INDIRECTLY);
-                       break;
-               case ID_TE:
-                       data->builder->build_texture((Tex *)id);
-                       break;
-               default:
-                       /* pass */
-                       break;
-       }
-}
-
-void constraint_walk(bConstraint * /*con*/,
-                     ID **idpoin,
-                     bool /*is_reference*/,
-                     void *user_data)
-{
-       BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
-       if (*idpoin) {
-               ID *id = *idpoin;
-               if (GS(id->name) == ID_OB) {
-                       data->builder->build_object(NULL,
-                                                   (Object *)id,
-                                                   DEG_ID_LINKED_INDIRECTLY);
-               }
-       }
-}
-
 void free_copy_on_write_datablock(void *id_v)
 {
        ID *id = (ID *)id_v;
@@ -1436,4 +1391,53 @@ void DepsgraphNodeBuilder::build_lightprobe(Object *object)
        build_animdata(&probe->id);
 }
 
+/* **** ID traversal callbacks functions **** */
+
+void DepsgraphNodeBuilder::modifier_walk(void *user_data,
+                                         struct Object * /*object*/,
+                                         struct ID **idpoin,
+                                         int /*cb_flag*/)
+{
+       BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
+       ID *id = *idpoin;
+       if (id == NULL) {
+               return;
+       }
+       switch (GS(id->name)) {
+               case ID_OB:
+                       data->builder->build_object(NULL,
+                                                   (Object *)id,
+                                                   DEG_ID_LINKED_INDIRECTLY);
+                       break;
+               case ID_TE:
+                       data->builder->build_texture((Tex *)id);
+                       break;
+               default:
+                       /* pass */
+                       break;
+       }
+}
+
+void DepsgraphNodeBuilder::constraint_walk(bConstraint * /*con*/,
+                                           ID **idpoin,
+                                           bool /*is_reference*/,
+                                           void *user_data)
+{
+       BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
+       ID *id = *idpoin;
+       if (id == NULL) {
+               return;
+       }
+       switch (GS(id->name)) {
+               case ID_OB:
+                       data->builder->build_object(NULL,
+                                                   (Object *)id,
+                                                   DEG_ID_LINKED_INDIRECTLY);
+                       break;
+               default:
+                       /* pass */
+                       break;
+       }
+}
+
 }  // namespace DEG
index 8dfbc4fa37ca04a0ead0a18687b07f0cd328a63e..fd72ae527b84a027d913dd70863ebb16b46f174c 100644 (file)
@@ -233,6 +233,20 @@ protected:
        };
        vector<SavedEntryTag> saved_entry_tags_;
 
+       struct BuilderWalkUserData {
+               DepsgraphNodeBuilder *builder;
+       };
+
+       static void modifier_walk(void *user_data,
+                                 struct Object *object,
+                                 struct ID **idpoin,
+                                 int cb_flag);
+
+       static void constraint_walk(bConstraint *constraint,
+                                   ID **idpoin,
+                                   bool is_reference,
+                                   void *user_data);
+
        /* State which never changes, same for the whole builder time. */
        Main *bmain_;
        Depsgraph *graph_;
index 4600bfedf28c7ed3bf764b1aa15f3044b838a310..5ac49f540b109dfa7efe33b4be4d4bf5ee0e62a6 100644 (file)
@@ -50,6 +50,7 @@ extern "C" {
 
 #include "BKE_action.h"
 #include "BKE_armature.h"
+#include "BKE_constraint.h"
 } /* extern "C" */
 
 #include "DEG_depsgraph.h"
@@ -70,7 +71,11 @@ void DepsgraphNodeBuilder::build_pose_constraints(Object *object,
                                                   bPoseChannel *pchan,
                                                   int pchan_index)
 {
-       /* create node for constraint stack */
+       /* Pull indirect dependencies via constraints. */
+       BuilderWalkUserData data;
+       data.builder = this;
+       BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data);
+       /* Create node for constraint stack. */
        add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
                           function_bind(BKE_pose_constraints_evaluate,
                                         _1,