diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-04-10 12:59:23 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-04-10 13:00:10 +0300 |
commit | 6962119e7f9152d99dac60a5bea76d7c6829d6c9 (patch) | |
tree | c21fd2fdecac15db849ef24a8baa91dd7c2908ab /source/blender/depsgraph/intern | |
parent | a74e782f5b3e1df763274e3c8f803562dbbd9a89 (diff) | |
parent | 5c3857b3051ff9f40e606ae2fc59f68a1747f1d7 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/depsgraph/intern')
4 files changed, 103 insertions, 81 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 88c62182466..06d7f2cd880 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -115,51 +115,6 @@ extern "C" { namespace DEG { -namespace { - -struct BuilderWalkUserData { - DepsgraphRelationBuilder *builder; -}; - -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); - 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); - } - } -} - -} /* namespace */ - /* ***************** */ /* Relations Builder */ @@ -2118,4 +2073,43 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node } } +/* **** ID traversal callbacks functions **** */ + +void DepsgraphRelationBuilder::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); + break; + case ID_TE: + data->builder->build_texture((Tex *)id); + break; + default: + /* pass */ + break; + } +} + +void DepsgraphRelationBuilder::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); + } + } +} + } // namespace DEG diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 1720f19eb22..d0b5b48fafe 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -334,6 +334,20 @@ protected: const KeyTo& key_to); private: + struct BuilderWalkUserData { + DepsgraphRelationBuilder *builder; + }; + + static void modifier_walk(void *user_data, + struct Object *object, + struct ID **idpoin, + int cb_flag); + + static void constraint_walk(bConstraint *con, + ID **idpoin, + bool is_reference, + void *user_data); + /* State which never changes, same for the whole builder time. */ Main *bmain_; Depsgraph *graph_; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index 2147ffce7b8..c80e0d568f3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -51,6 +51,7 @@ extern "C" { #include "BKE_action.h" #include "BKE_armature.h" +#include "BKE_constraint.h" } /* extern "C" */ #include "DEG_depsgraph.h" @@ -406,6 +407,11 @@ void DepsgraphRelationBuilder::build_rig(Object *object) } /* Buil constraints. */ if (pchan->constraints.first != NULL) { + /* Build relations for indirectly linked objects. */ + BuilderWalkUserData data; + data.builder = this; + BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); + /* constraints stack and constraint dependencies */ build_constraints(&object->id, DEG_NODE_TYPE_BONE, pchan->name, &pchan->constraints, &root_map); diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index a2e6993e442..3500f38467d 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -590,12 +590,14 @@ void DEG_debug_print_eval(const char *function_name, if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { return; } - printf("%s on %s %s(%p)%s\n", - function_name, - object_name, - DEG::deg_color_for_pointer(object_address).c_str(), - object_address, - DEG::deg_color_end().c_str()); + fprintf(stdout, + "%s on %s %s(%p)%s\n", + function_name, + object_name, + DEG::deg_color_for_pointer(object_address).c_str(), + object_address, + DEG::deg_color_end().c_str()); + fflush(stdout); } void DEG_debug_print_eval_subdata(const char *function_name, @@ -608,17 +610,19 @@ void DEG_debug_print_eval_subdata(const char *function_name, if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { return; } - printf("%s on %s %s(%p)%s %s %s %s(%p)%s\n", - function_name, - object_name, - DEG::deg_color_for_pointer(object_address).c_str(), - object_address, - DEG::deg_color_end().c_str(), - subdata_comment, - subdata_name, - DEG::deg_color_for_pointer(subdata_address).c_str(), - subdata_address, - DEG::deg_color_end().c_str()); + fprintf(stdout, + "%s on %s %s(%p)%s %s %s %s(%p)%s\n", + function_name, + object_name, + DEG::deg_color_for_pointer(object_address).c_str(), + object_address, + DEG::deg_color_end().c_str(), + subdata_comment, + subdata_name, + DEG::deg_color_for_pointer(subdata_address).c_str(), + subdata_address, + DEG::deg_color_end().c_str()); + fflush(stdout); } void DEG_debug_print_eval_subdata_index(const char *function_name, @@ -632,18 +636,20 @@ void DEG_debug_print_eval_subdata_index(const char *function_name, if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { return; } - printf("%s on %s %s(%p)^%s %s %s[%d] %s(%p)%s\n", - function_name, - object_name, - DEG::deg_color_for_pointer(object_address).c_str(), - object_address, - DEG::deg_color_end().c_str(), - subdata_comment, - subdata_name, - subdata_index, - DEG::deg_color_for_pointer(subdata_address).c_str(), - subdata_address, - DEG::deg_color_end().c_str()); + fprintf(stdout, + "%s on %s %s(%p)^%s %s %s[%d] %s(%p)%s\n", + function_name, + object_name, + DEG::deg_color_for_pointer(object_address).c_str(), + object_address, + DEG::deg_color_end().c_str(), + subdata_comment, + subdata_name, + subdata_index, + DEG::deg_color_for_pointer(subdata_address).c_str(), + subdata_address, + DEG::deg_color_end().c_str()); + fflush(stdout); } void DEG_debug_print_eval_time(const char *function_name, @@ -654,11 +660,13 @@ void DEG_debug_print_eval_time(const char *function_name, if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { return; } - printf("%s on %s %s(%p)%s at time %f\n", - function_name, - object_name, - DEG::deg_color_for_pointer(object_address).c_str(), - object_address, - DEG::deg_color_end().c_str(), - time); + fprintf(stdout, + "%s on %s %s(%p)%s at time %f\n", + function_name, + object_name, + DEG::deg_color_for_pointer(object_address).c_str(), + object_address, + DEG::deg_color_end().c_str(), + time); + fflush(stdout); } |