diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-16 17:27:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-16 17:35:21 +0300 |
commit | 0434053f1329384c312fd07812bce48ec9c28f50 (patch) | |
tree | c9e73e4dad7c41a844dfa9adf869f2becb087f25 /source/blender/depsgraph | |
parent | 68e58f19912de679919584d295147dba541d57ba (diff) |
Depsgraph: Fixed crash with curve bevel indirect dupligroups
Need to expand all object's dupli-groups, not only the dupli-groups
of objects directly linked to the scene.
Diffstat (limited to 'source/blender/depsgraph')
4 files changed, 80 insertions, 54 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 0a06689da90..7bcaee61fe0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -432,7 +432,7 @@ void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob) } /* Object data. */ - if (ob->data) { + if (ob->data != NULL) { /* type-specific data... */ switch (ob->type) { case OB_MESH: /* Geometry */ @@ -490,14 +490,25 @@ void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob) build_animdata(&ob->id); /* particle systems */ - if (ob->particlesystem.first) { + if (ob->particlesystem.first != NULL) { build_particles(scene, ob); } - /* grease pencil */ - if (ob->gpd) { + /* Grease pencil. */ + if (ob->gpd != NULL) { build_gpencil(ob->gpd); } + + /* Object that this is a proxy for. */ + if (ob->proxy) { + ob->proxy->proxy_from = ob; + build_object(scene, base, ob->proxy); + } + + /* Object dupligroup. */ + if (ob->dup_group != NULL) { + build_group(scene, base, ob->dup_group); + } } void DepsgraphNodeBuilder::build_object_transform(Scene *scene, Object *ob) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc index 99e61692231..7dd694cb570 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -81,21 +81,7 @@ void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene) /* scene objects */ LINKLIST_FOREACH (Base *, base, &scene->base) { Object *ob = base->object; - - /* object itself */ build_object(scene, base, ob); - - /* object that this is a proxy for */ - // XXX: the way that proxies work needs to be completely reviewed! - if (ob->proxy) { - ob->proxy->proxy_from = ob; - build_object(scene, base, ob->proxy); - } - - /* Object dupligroup. */ - if (ob->dup_group) { - build_group(scene, base, ob->dup_group); - } } /* rigidbody */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index c4e20dbecec..7f2c6d8d9a1 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -396,30 +396,52 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o OperationKey ob_ubereval_key(&ob->id, DEPSNODE_TYPE_TRANSFORM, DEG_OPCODE_OBJECT_UBEREVAL); /* parenting */ - if (ob->parent) { + if (ob->parent != NULL) { /* parent relationship */ build_object_parent(ob); /* local -> parent */ - add_relation(local_transform_key, parent_transform_key, DEPSREL_TYPE_COMPONENT_ORDER, "[ObLocal -> ObParent]"); + add_relation(local_transform_key, + parent_transform_key, + DEPSREL_TYPE_COMPONENT_ORDER, + "[ObLocal -> ObParent]"); } /* object constraints */ - if (ob->constraints.first) { - OperationKey constraint_key(&ob->id, DEPSNODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_CONSTRAINTS); + if (ob->constraints.first != NULL) { + OperationKey constraint_key(&ob->id, + DEPSNODE_TYPE_TRANSFORM, + DEG_OPCODE_TRANSFORM_CONSTRAINTS); /* constraint relations */ // TODO: provide base op // XXX: this is broken - build_constraints(scene, &ob->id, DEPSNODE_TYPE_TRANSFORM, "", &ob->constraints, NULL); + build_constraints(scene, + &ob->id, + DEPSNODE_TYPE_TRANSFORM, + "", + &ob->constraints, + NULL); /* operation order */ - add_relation(base_op_key, constraint_key, DEPSREL_TYPE_COMPONENT_ORDER, "[ObBase-> Constraint Stack]"); - add_relation(constraint_key, final_transform_key, DEPSREL_TYPE_COMPONENT_ORDER, "[ObConstraints -> Done]"); + add_relation(base_op_key, + constraint_key, + DEPSREL_TYPE_COMPONENT_ORDER, + "[ObBase-> Constraint Stack]"); + add_relation(constraint_key, + final_transform_key, + DEPSREL_TYPE_COMPONENT_ORDER, + "[ObConstraints -> Done]"); // XXX - add_relation(constraint_key, ob_ubereval_key, DEPSREL_TYPE_COMPONENT_ORDER, "Temp Ubereval"); - add_relation(ob_ubereval_key, final_transform_key, DEPSREL_TYPE_COMPONENT_ORDER, "Temp Ubereval"); + add_relation(constraint_key, + ob_ubereval_key, + DEPSREL_TYPE_COMPONENT_ORDER, + "Temp Ubereval"); + add_relation(ob_ubereval_key, + final_transform_key, + DEPSREL_TYPE_COMPONENT_ORDER, + "Temp Ubereval"); } else { /* NOTE: Keep an eye here, we skip some relations here to "streamline" @@ -448,7 +470,10 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o // XXX: This should be hooked up by the build_animdata code if (needs_animdata_node(&ob->id)) { ComponentKey adt_key(&ob->id, DEPSNODE_TYPE_ANIMATION); - add_relation(adt_key, local_transform_key, DEPSREL_TYPE_OPERATION, "Object Animation"); + add_relation(adt_key, + local_transform_key, + DEPSREL_TYPE_OPERATION, + "Object Animation"); } @@ -494,25 +519,48 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o if (key != NULL) { ComponentKey geometry_key((ID *)ob->data, DEPSNODE_TYPE_GEOMETRY); ComponentKey key_key(&key->id, DEPSNODE_TYPE_GEOMETRY); - add_relation(key_key, geometry_key, DEPSREL_TYPE_GEOMETRY_EVAL, "Shapekeys"); + add_relation(key_key, + geometry_key, + DEPSREL_TYPE_GEOMETRY_EVAL, + "Shapekeys"); } } - /* particle systems */ - if (ob->particlesystem.first) { + /* Particle systems. */ + if (ob->particlesystem.first != NULL) { build_particles(scene, ob); } - /* grease pencil */ - if (ob->gpd) { + /* Grease pencil. */ + if (ob->gpd != NULL) { build_gpencil(ob->gpd); } + + /* Object that this is a proxy for. */ + if (ob->proxy != NULL) { + ob->proxy->proxy_from = ob; + build_object(bmain, scene, ob->proxy); + /* TODO(sergey): This is an inverted relation, matches old depsgraph + * behavior and need to be investigated if it still need to be inverted. + */ + ComponentKey ob_pose_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE); + ComponentKey proxy_pose_key(&ob->proxy->id, DEPSNODE_TYPE_EVAL_POSE); + add_relation(ob_pose_key, proxy_pose_key, DEPSREL_TYPE_TRANSFORM, "Proxy"); + } + + /* Object dupligroup. */ + if (ob->dup_group != NULL) { + build_group(bmain, scene, ob, ob->dup_group); + } } void DepsgraphRelationBuilder::build_object_parent(Object *ob) { - /* XXX: for now, need to use the component key (not just direct to the parent op), or else the matrix doesn't get reset */ - // XXX: @sergey - it would be good if we got that backwards flushing working when tagging for updates + /* XXX: for now, need to use the component key (not just direct to the parent op), + * or else the matrix doesn't get reset/ + */ + // XXX: @sergey - it would be good if we got that backwards flushing working + // when tagging for updates. //OperationKey ob_key(&ob->id, DEPSNODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_PARENT); ComponentKey ob_key(&ob->id, DEPSNODE_TYPE_TRANSFORM); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc index 8a3476cff45..3bf435c37e0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc @@ -76,26 +76,7 @@ void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene) /* scene objects */ LINKLIST_FOREACH (Base *, base, &scene->base) { Object *ob = base->object; - - /* object itself */ build_object(bmain, scene, ob); - - /* object that this is a proxy for */ - if (ob->proxy) { - ob->proxy->proxy_from = ob; - build_object(bmain, scene, ob->proxy); - /* TODO(sergey): This is an inverted relation, matches old depsgraph - * behavior and need to be investigated if it still need to be inverted. - */ - ComponentKey ob_pose_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE); - ComponentKey proxy_pose_key(&ob->proxy->id, DEPSNODE_TYPE_EVAL_POSE); - add_relation(ob_pose_key, proxy_pose_key, DEPSREL_TYPE_TRANSFORM, "Proxy"); - } - - /* Object dupligroup. */ - if (ob->dup_group) { - build_group(bmain, scene, ob, ob->dup_group); - } } /* rigidbody */ |