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.
This commit is contained in:
Sergey Sharybin 2017-03-16 15:27:03 +01:00
parent 68e58f1991
commit 0434053f13
4 changed files with 80 additions and 54 deletions

View File

@ -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)

View File

@ -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 */

View File

@ -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);

View File

@ -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 */