diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-18 13:54:56 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-18 13:54:56 +0300 |
commit | 4c1ee477070083f12bf802e551b14179e0c4579a (patch) | |
tree | d4b34ab42495a5ba76804c940cc9876cbaca8b44 /source/blender/depsgraph/intern | |
parent | 9068c0743e0840cea5bbf07cd1bad7d662ab5a07 (diff) | |
parent | c622533fa01a9f478d5116ca68ad299081ae22b4 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_flush.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index 4cd316678a8..676df7d6335 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -55,6 +55,12 @@ extern "C" { namespace DEG { +enum { + COMPONENT_STATE_NONE = 0, + COMPONENT_STATE_SCHEDULED = 1, + COMPONENT_STATE_DONE = 2, +}; + typedef std::deque<OperationDepsNode *> FlushQueue; static void flush_init_func(void *data_v, int i) @@ -67,7 +73,7 @@ static void flush_init_func(void *data_v, int i) ComponentDepsNode *comp_node = node->owner; IDDepsNode *id_node = comp_node->owner; id_node->done = 0; - comp_node->done = 0; + comp_node->done = COMPONENT_STATE_NONE; node->scheduled = false; } @@ -139,7 +145,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph) lib_id_recalc_data_tag(bmain, id_orig); } - if (comp_node->done == 0) { + if (comp_node->done == COMPONENT_STATE_DONE) { #ifdef WITH_COPY_ON_WRITE /* Currently this is needed to get ob->mesh to be replaced with * original mesh (rather than being evaluated_mesh). @@ -210,9 +216,21 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph) /* TODO : replace with more granular flags */ object->deg_update_flag |= DEG_RUNTIME_DATA_UPDATE; } + /* When some target changes bone, we might need to re-run the + * whole IK solver, otherwise result might be unpredictable. + */ + if (comp_node->type == DEG_NODE_TYPE_BONE) { + ComponentDepsNode *pose_comp = + id_node->find_component(DEG_NODE_TYPE_EVAL_POSE); + BLI_assert(pose_comp != NULL); + if (pose_comp->done == COMPONENT_STATE_NONE) { + queue.push_front(pose_comp->get_entry_operation()); + pose_comp->done = COMPONENT_STATE_SCHEDULED; + } + } } - id_node->done = 1; + id_node->done = COMPONENT_STATE_DONE; comp_node->done = 1; /* Flush to nodes along links... */ |