diff options
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 87 |
1 files changed, 56 insertions, 31 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index ba6a4756313..f1e7278ffdb 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -657,20 +657,8 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) build_particle_systems(object); } /* Proxy object to copy from. */ - if (object->proxy_from != NULL) { - /* Object is linked here (comes from the library). */ - build_object(NULL, object->proxy_from); - ComponentKey ob_transform_key(&object->proxy_from->id, NodeType::TRANSFORM); - ComponentKey proxy_transform_key(&object->id, NodeType::TRANSFORM); - add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform"); - } - if (object->proxy_group != NULL && object->proxy_group != object->proxy) { - /* Object is local here (local in .blend file, users interacts with it). */ - build_object(NULL, object->proxy_group); - OperationKey proxy_group_eval_key( - &object->proxy_group->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); - add_relation(proxy_group_eval_key, transform_eval_key, "Proxy Group Transform"); - } + build_object_proxy_from(object); + build_object_proxy_group(object); /* Object dupligroup. */ if (object->instance_collection != NULL) { build_collection(NULL, object, object->instance_collection); @@ -685,6 +673,31 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) build_parameters(&object->id); } +void DepsgraphRelationBuilder::build_object_proxy_from(Object *object) +{ + if (object->proxy_from == NULL) { + return; + } + /* Object is linked here (comes from the library). */ + build_object(NULL, object->proxy_from); + ComponentKey ob_transform_key(&object->proxy_from->id, NodeType::TRANSFORM); + ComponentKey proxy_transform_key(&object->id, NodeType::TRANSFORM); + add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform"); +} + +void DepsgraphRelationBuilder::build_object_proxy_group(Object *object) +{ + if (object->proxy_group == NULL || object->proxy_group == object->proxy) { + return; + } + /* Object is local here (local in .blend file, users interacts with it). */ + build_object(NULL, object->proxy_group); + OperationKey proxy_group_eval_key( + &object->proxy_group->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); + OperationKey transform_eval_key(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); + add_relation(proxy_group_eval_key, transform_eval_key, "Proxy Group Transform"); +} + void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object) { if (base == NULL) { @@ -807,13 +820,25 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) { Object *parent = object->parent; ID *parent_id = &object->parent->id; - ComponentKey ob_key(&object->id, NodeType::TRANSFORM); - /* Type-specific links/ */ + ComponentKey object_transform_key(&object->id, NodeType::TRANSFORM); + /* Type-specific links. */ switch (object->partype) { /* Armature Deform (Virtual Modifier) */ case PARSKEL: { - ComponentKey parent_key(parent_id, NodeType::TRANSFORM); - add_relation(parent_key, ob_key, "Armature Deform Parent"); + ComponentKey parent_transform_key(parent_id, NodeType::TRANSFORM); + add_relation(parent_transform_key, object_transform_key, "Parent Armature Transform"); + + if (parent->type == OB_ARMATURE) { + ComponentKey object_geometry_key(&object->id, NodeType::GEOMETRY); + ComponentKey parent_pose_key(parent_id, NodeType::EVAL_POSE); + add_relation( + parent_transform_key, object_geometry_key, "Parent Armature Transform -> Geometry"); + add_relation(parent_pose_key, object_geometry_key, "Parent Armature Pose -> Geometry"); + + add_depends_on_transform_relation( + &object->id, object_geometry_key, "Virtual Armature Modifier"); + } + break; } @@ -821,7 +846,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) case PARVERT1: case PARVERT3: { ComponentKey parent_key(parent_id, NodeType::GEOMETRY); - add_relation(parent_key, ob_key, "Vertex Parent"); + add_relation(parent_key, object_transform_key, "Vertex Parent"); /* Original index is used for optimizations of lookups for subdiv * only meshes. * TODO(sergey): This optimization got lost at 2.8, so either verify @@ -833,7 +858,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) DEGCustomDataMeshMasks::MaskFace(CD_MASK_ORIGINDEX) | DEGCustomDataMeshMasks::MaskPoly(CD_MASK_ORIGINDEX)); ComponentKey transform_key(parent_id, NodeType::TRANSFORM); - add_relation(transform_key, ob_key, "Vertex Parent TFM"); + add_relation(transform_key, object_transform_key, "Vertex Parent TFM"); break; } @@ -842,8 +867,8 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) ComponentKey parent_bone_key(parent_id, NodeType::BONE, object->parsubstr); OperationKey parent_transform_key( parent_id, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL); - add_relation(parent_bone_key, ob_key, "Bone Parent"); - add_relation(parent_transform_key, ob_key, "Armature Parent"); + add_relation(parent_bone_key, object_transform_key, "Bone Parent"); + add_relation(parent_transform_key, object_transform_key, "Armature Parent"); break; } @@ -852,8 +877,8 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) /* Lattice Deform Parent - Virtual Modifier. */ ComponentKey parent_key(parent_id, NodeType::TRANSFORM); ComponentKey geom_key(parent_id, NodeType::GEOMETRY); - add_relation(parent_key, ob_key, "Lattice Deform Parent"); - add_relation(geom_key, ob_key, "Lattice Deform Parent Geom"); + add_relation(parent_key, object_transform_key, "Lattice Deform Parent"); + add_relation(geom_key, object_transform_key, "Lattice Deform Parent Geom"); } else if (object->parent->type == OB_CURVE) { Curve *cu = (Curve *)object->parent->data; @@ -861,20 +886,20 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) if (cu->flag & CU_PATH) { /* Follow Path. */ ComponentKey parent_key(parent_id, NodeType::GEOMETRY); - add_relation(parent_key, ob_key, "Curve Follow Parent"); + add_relation(parent_key, object_transform_key, "Curve Follow Parent"); ComponentKey transform_key(parent_id, NodeType::TRANSFORM); - add_relation(transform_key, ob_key, "Curve Follow TFM"); + add_relation(transform_key, object_transform_key, "Curve Follow TFM"); } else { /* Standard Parent. */ ComponentKey parent_key(parent_id, NodeType::TRANSFORM); - add_relation(parent_key, ob_key, "Curve Parent"); + add_relation(parent_key, object_transform_key, "Curve Parent"); } } else { /* Standard Parent. */ ComponentKey parent_key(parent_id, NodeType::TRANSFORM); - add_relation(parent_key, ob_key, "Parent"); + add_relation(parent_key, object_transform_key, "Parent"); } break; } @@ -887,7 +912,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) ComponentKey parent_geometry_key(parent_id, NodeType::GEOMETRY); /* NOTE: Metaballs are evaluating geometry only after their transform, * so we only hook up to transform channel here. */ - add_relation(parent_geometry_key, ob_key, "Parent"); + add_relation(parent_geometry_key, object_transform_key, "Parent"); } /* Dupliverts uses original vertex index. */ @@ -1797,7 +1822,7 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part) particle_settings_init_key, particle_settings_eval_key, "Particle Settings Init Order"); add_relation(particle_settings_reset_key, particle_settings_eval_key, "Particle Settings Reset"); /* Texture slots. */ - for (int mtex_index = 0; mtex_index < MAX_MTEX; ++mtex_index) { + for (int mtex_index = 0; mtex_index < MAX_MTEX; mtex_index++) { MTex *mtex = part->mtex[mtex_index]; if (mtex == NULL || mtex->tex == NULL) { continue; @@ -2246,7 +2271,7 @@ void DepsgraphRelationBuilder::build_material(Material *material) void DepsgraphRelationBuilder::build_materials(Material **materials, int num_materials) { - for (int i = 0; i < num_materials; ++i) { + for (int i = 0; i < num_materials; i++) { if (materials[i] == NULL) { continue; } |