Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-11-16 18:11:24 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-11-16 18:29:46 +0300
commit33ac6c25b9942f40a33382aeb57c73482cd07b27 (patch)
treea91323be26669a6ed2aa23452e8ffd1e0e769ac8 /source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
parent91aa81b61dd0df29c23ca05fc4104c0f4117e8a6 (diff)
Fix T56673: Tara.blend from Blender cloud crashes on load
The issue was caused by dependency cycle solver killing relation which was guaranteed various things: i.e. copy-on-write component orders and pose evaluation order (which must first run pose init function). Now it is possible to prevent such relations from being ignored. This is not a complete fix, but is enough to make this specific rig to work. Ideally, we also need to run copy-on-write operation prior to anything else.
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_cycle.cc')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_cycle.cc35
1 files changed, 32 insertions, 3 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
index 0d28344ef95..a8768c899ad 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
@@ -148,6 +148,35 @@ bool schedule_non_checked_node(CyclesSolverState *state)
return false;
}
+bool check_relation_can_murder(DepsRelation *relation)
+{
+ if (relation->flag & DEPSREL_FLAG_GODMODE) {
+ return false;
+ }
+ return true;
+}
+
+DepsRelation *select_relation_to_murder(DepsRelation *relation,
+ StackEntry *cycle_start_entry)
+{
+ /* More or less russian roulette solver, which will make sure only
+ * specially marked relations are kept alive.
+ *
+ * TODO(sergey): There might be better strategies here. */
+ if (check_relation_can_murder(relation)) {
+ return relation;
+ }
+ StackEntry *current = cycle_start_entry;
+ OperationDepsNode *to_node = (OperationDepsNode *)relation->to;
+ while (current->node != to_node) {
+ if (check_relation_can_murder(current->via_relation)) {
+ return current->via_relation;
+ }
+ current = current->from;
+ }
+ return relation;
+}
+
/* Solve cycles with all nodes which are scheduled for traversal. */
void solve_cycles(CyclesSolverState *state)
{
@@ -168,7 +197,6 @@ void solve_cycles(CyclesSolverState *state)
to->full_identifier().c_str(),
node->full_identifier().c_str(),
rel->name);
-
StackEntry *current = entry;
while (current->node != to) {
BLI_assert(current != NULL);
@@ -178,8 +206,9 @@ void solve_cycles(CyclesSolverState *state)
current->via_relation->name);
current = current->from;
}
- /* TODO(sergey): So called russian roulette cycle solver. */
- rel->flag |= DEPSREL_FLAG_CYCLIC;
+ DepsRelation *sacrificial_relation =
+ select_relation_to_murder(rel, entry);
+ sacrificial_relation->flag |= DEPSREL_FLAG_CYCLIC;
++state->num_cycles;
}
else if (to_state == NODE_NOT_VISITED) {