diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-04 17:14:47 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-04 17:15:23 +0300 |
commit | 3b3e6127520de14e2cf92f371281f66ebcec3756 (patch) | |
tree | bfc72e8dda651f793545d01ae206ec14567eaff5 /source/blender/depsgraph | |
parent | 6a6aeaac7d32245aa17ba8c0f2a3886c329cb111 (diff) | |
parent | 0f8228a890c3b0906d88e34ac75d0246a65dfe55 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/depsgraph')
5 files changed, 80 insertions, 111 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index c4542660c8b..dfe97d02ec6 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -248,9 +248,9 @@ void DepsgraphNodeBuilder::build_rig(Object *object) /* bones */ LINKLIST_FOREACH (bPoseChannel *, pchan, &object_cow->pose->chanbase) { - /* node for bone eval */ - op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, - pchan->name, NULL, DEG_OPCODE_BONE_LOCAL); + /* Node for bone evaluation. */ + op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, NULL, + DEG_OPCODE_BONE_LOCAL); op_node->set_as_entry(); add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, @@ -269,6 +269,14 @@ void DepsgraphNodeBuilder::build_rig(Object *object) function_bind(BKE_pose_bone_done, _1, pchan), DEG_OPCODE_BONE_DONE); op_node->set_as_exit(); + /* Custom properties. */ + if (pchan->prop != NULL) { + add_operation_node(&object->id, + DEG_NODE_TYPE_PARAMETERS, + NULL, + DEG_OPCODE_PARAMETERS_EVAL, + pchan->name); + } /* Build constraints. */ if (pchan->constraints.first != NULL) { build_pose_constraints(object, pchan); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 1b9f27932f5..aeb9f9ab937 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -203,20 +203,6 @@ static bool object_particles_depends_on_time(Object *object) /* **** General purpose functions **** */ -RNAPathKey::RNAPathKey(ID *id, const char *path) : - id(id) -{ - /* create ID pointer for root of path lookup */ - PointerRNA id_ptr; - RNA_id_pointer_create(id, &id_ptr); - /* try to resolve path... */ - int index; - if (!RNA_path_resolve_full(&id_ptr, path, &this->ptr, &this->prop, &index)) { - this->ptr = PointerRNA_NULL; - this->prop = NULL; - } -} - DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain, Depsgraph *graph) : bmain_(bmain), @@ -463,7 +449,7 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) /* Local -> parent. */ add_relation(local_transform_key, parent_transform_key, - "[ObLocal -> ObParent]"); + "ObLocal -> ObParent"); } /* Modifiers. */ if (object->modifiers.first != NULL) { @@ -489,8 +475,8 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) &object->constraints, NULL); /* operation order */ - add_relation(base_op_key, constraint_key, "[ObBase-> Constraint Stack]"); - add_relation(constraint_key, final_transform_key, "[ObConstraints -> Done]"); + add_relation(base_op_key, constraint_key, "ObBase-> Constraint Stack"); + add_relation(constraint_key, final_transform_key, "ObConstraints -> Done"); // XXX add_relation(constraint_key, ob_ubereval_key, "Temp Ubereval"); add_relation(ob_ubereval_key, final_transform_key, "Temp Ubereval"); @@ -753,14 +739,14 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, * Constraint dependency chain. */ TimeSourceKey time_src_key; - add_relation(time_src_key, constraint_op_key, "[TimeSrc -> Animation]"); + add_relation(time_src_key, constraint_op_key, "TimeSrc -> Animation"); } else if (cti->type == CONSTRAINT_TYPE_TRANSFORM_CACHE) { /* TODO(kevin): This is more a TimeSource -> CacheFile -> Constraint * dependency chain. */ TimeSourceKey time_src_key; - add_relation(time_src_key, constraint_op_key, "[TimeSrc -> Animation]"); + add_relation(time_src_key, constraint_op_key, "TimeSrc -> Animation"); bTransformCacheConstraint *data = (bTransformCacheConstraint *)con->data; if (data->cache_file) { ComponentKey cache_key(&data->cache_file->id, DEG_NODE_TYPE_CACHE); @@ -925,7 +911,7 @@ void DepsgraphRelationBuilder::build_animdata(ID *id) if (adt->action || adt->nla_tracks.first) { /* wire up dependency to time source */ TimeSourceKey time_src_key; - add_relation(time_src_key, adt_key, "[TimeSrc -> Animation]"); + add_relation(time_src_key, adt_key, "TimeSrc -> Animation"); // XXX: Hook up specific update callbacks for special properties which may need it... @@ -985,13 +971,13 @@ void DepsgraphRelationBuilder::build_animdata(ID *id) DEG_OPCODE_DRIVER, fcu->rna_path ? fcu->rna_path : "", fcu->array_index); - add_relation(prev_driver_key, driver_key, "[Driver Order]"); + add_relation(prev_driver_key, driver_key, "Driver Order"); } } /* prevent driver from occurring before own animation... */ if (adt->action || adt->nla_tracks.first) { - add_relation(adt_key, driver_key, "[AnimData Before Drivers]"); + add_relation(adt_key, driver_key, "AnimData Before Drivers"); } } } @@ -1011,7 +997,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) /* Create dependency between driver and data affected by it. */ /* - direct property relationship... */ //RNAPathKey affected_key(id, fcu->rna_path); - //add_relation(driver_key, affected_key, "[Driver -> Data] DepsRel"); + //add_relation(driver_key, affected_key, "Driver -> Data"); /* Driver -> data components (for interleaved evaluation * bones/constraints/modifiers). @@ -1034,7 +1020,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL); - add_relation(driver_key, bone_key, "[Driver -> Bone]"); + add_relation(driver_key, bone_key, "Driver -> Bone"); } else { fprintf(stderr, @@ -1067,7 +1053,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) DEG_OPCODE_BONE_LOCAL); add_relation(driver_key, bone_key, - "[Arm Bone -> Driver -> Bone]"); + "Arm Bone -> Driver -> Bone"); } } } @@ -1086,7 +1072,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) DEG_NODE_TYPE_GEOMETRY, DEG_OPCODE_GEOMETRY_UBEREVAL); if (has_node(modifier_key)) { - add_relation(driver_key, modifier_key, "[Driver -> Modifier]"); + add_relation(driver_key, modifier_key, "Driver -> Modifier"); } else { printf("Unexisting driver RNA path: %s\n", rna_path); @@ -1097,43 +1083,27 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) // XXX: double check where this points Key *shape_key = (Key *)id; ComponentKey geometry_key(shape_key->from, DEG_NODE_TYPE_GEOMETRY); - add_relation(driver_key, geometry_key, "[Driver -> ShapeKey Geom]"); + add_relation(driver_key, geometry_key, "Driver -> ShapeKey Geom"); } else if (strstr(rna_path, "key_blocks[")) { ComponentKey geometry_key(id, DEG_NODE_TYPE_GEOMETRY); - add_relation(driver_key, geometry_key, "[Driver -> ShapeKey Geom]"); + add_relation(driver_key, geometry_key, "Driver -> ShapeKey Geom"); } else { - switch (id_type) { - case ID_OB: - { - /* Assume that driver affects a transform. */ - OperationKey local_transform_key(id, - DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_LOCAL); - add_relation(driver_key, - local_transform_key, - "[Driver -> Transform]"); - break; - } - case ID_KE: - { - ComponentKey geometry_key(id, DEG_NODE_TYPE_GEOMETRY); - add_relation(driver_key, - geometry_key, - "[Driver -> Shapekey Geometry]"); - break; - } - case ID_NT: - { - ComponentKey ntree_key(id, DEG_NODE_TYPE_SHADING); - add_relation(driver_key, - ntree_key, - "[Driver -> NTree Shading Update]"); - break; - } - default: - break; + if (GS(id->name) == ID_OB) { + /* assume that driver affects a transform... */ + OperationKey local_transform_key(id, + DEG_NODE_TYPE_TRANSFORM, + DEG_OPCODE_TRANSFORM_LOCAL); + add_relation(driver_key, + local_transform_key, + "Driver -> Transform"); + } + else if (GS(id->name) == ID_KE) { + ComponentKey geometry_key(id, DEG_NODE_TYPE_GEOMETRY); + add_relation(driver_key, + geometry_key, + "Driver -> Shapekey Geometry"); } } /* Ensure that affected prop's update callbacks will be triggered once @@ -1177,7 +1147,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) DEG_OPCODE_BONE_DONE); add_relation(target_key, driver_key, - "[Bone Target -> Driver]"); + "Bone Target -> Driver"); } } else if (dtar->flag & DTAR_FLAG_STRUCT_REF) { @@ -1192,7 +1162,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) OperationKey target_key(dtar->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_FINAL); - add_relation(target_key, driver_key, "[Target -> Driver]"); + add_relation(target_key, driver_key, "Target -> Driver"); } else if (dtar->rna_path && strstr(dtar->rna_path, "pose.bones[")) { /* Workaround for ensuring that local bone transforms don't end @@ -1218,7 +1188,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) DEG_NODE_TYPE_BONE, target_pchan->name, DEG_OPCODE_BONE_LOCAL); - add_relation(bone_key, driver_key, "[RNA Bone -> Driver]"); + add_relation(bone_key, driver_key, "RNA Bone -> Driver"); } } else { @@ -1232,7 +1202,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) /* Resolve path to get node. */ RNAPathKey target_key(dtar->id, dtar->rna_path ? dtar->rna_path : ""); - add_relation(target_key, driver_key, "[RNA Target -> Driver]"); + add_relation(target_key, driver_key, "RNA Target -> Driver"); } } DRIVER_TARGETS_LOOPER_END @@ -1245,7 +1215,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu) python_driver_depends_on_time(driver)) { TimeSourceKey time_src_key; - add_relation(time_src_key, driver_key, "[TimeSrc -> Driver]"); + add_relation(time_src_key, driver_key, "TimeSrc -> Driver"); } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc index 9d6ab3358a7..f6845aa697c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc @@ -193,6 +193,20 @@ RNAPathKey::RNAPathKey(ID *id, const PointerRNA &ptr, PropertyRNA *prop) { } +RNAPathKey::RNAPathKey(ID *id, const char *path) + : id(id) +{ + /* create ID pointer for root of path lookup */ + PointerRNA id_ptr; + RNA_id_pointer_create(id, &id_ptr); + /* try to resolve path... */ + int index; + if (!RNA_path_resolve_full(&id_ptr, path, &this->ptr, &this->prop, &index)) { + this->ptr = PointerRNA_NULL; + this->prop = NULL; + } +} + string RNAPathKey::identifier() const { const char *id_name = (id) ? id->name : "<No ID>"; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index ce63d6455cc..2a2108e8480 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -258,7 +258,7 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object, // TODO: the bigggest point here is that we need the curve PATH and not just the general geometry... ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_GEOMETRY); ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE); - add_relation(target_key, pose_key, "[Curve.Path -> Spline IK] DepsRel"); + add_relation(target_key, pose_key, "Curve.Path -> Spline IK"); } pchan->flag |= POSE_DONE; @@ -410,7 +410,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object) } OperationKey parent_key(&object->id, DEG_NODE_TYPE_BONE, pchan->parent->name, parent_key_opcode); - add_relation(parent_key, bone_pose_key, "[Parent Bone -> Child Bone]"); + add_relation(parent_key, bone_pose_key, "Parent Bone -> Child Bone"); } /* Buil constraints. */ if (pchan->constraints.first != NULL) { diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 936fe58b1f2..e30e00e61b5 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -107,16 +107,15 @@ static bool pointer_to_id_node_criteria(const PointerRNA *ptr, const PropertyRNA *prop, ID **id) { - if (!ptr->type) + if (ptr->type == NULL) { return false; - - if (!prop) { + } + if (prop != NULL) { if (RNA_struct_is_ID(ptr->type)) { *id = (ID *)ptr->data; return true; } } - return false; } @@ -126,49 +125,40 @@ static bool pointer_to_component_node_criteria(const PointerRNA *ptr, eDepsNode_Type *type, const char **subdata) { - if (!ptr->type) + if (ptr->type == NULL) { return false; - + } /* Set default values for returns. */ *id = (ID *)ptr->id.data; /* For obvious reasons... */ *subdata = ""; /* Default to no subdata (e.g. bone) name * lookup in most cases. */ - - /* Handling of commonly known scenarios... */ + /* Handling of commonly known scenarios. */ if (ptr->type == &RNA_PoseBone) { bPoseChannel *pchan = (bPoseChannel *)ptr->data; - - /* Bone - generally, we just want the bone component... */ + /* Bone - generally, we just want the bone component. */ *type = DEG_NODE_TYPE_BONE; *subdata = pchan->name; - return true; } else if (ptr->type == &RNA_Bone) { Bone *bone = (Bone *)ptr->data; - /* armature-level bone, but it ends up going to bone component anyway */ - // TODO: the ID in thise case will end up being bArmature, not Object as needed! + // NOTE: the ID in thise case will end up being bArmature. *type = DEG_NODE_TYPE_BONE; *subdata = bone->name; - //*id = ... - return true; } else if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) { Object *object = (Object *)ptr->id.data; bConstraint *con = (bConstraint *)ptr->data; - - /* object or bone? */ + /* Check whether is object or bone constraint. */ if (BLI_findindex(&object->constraints, con) != -1) { - /* object transform */ - // XXX: for now, we can't address the specific constraint or the constraint stack... + /* Constraint is defining object transform. */ *type = DEG_NODE_TYPE_TRANSFORM; return true; } - else if (object->pose) { - bPoseChannel *pchan; - for (pchan = (bPoseChannel *)object->pose->chanbase.first; pchan; pchan = pchan->next) { + else if (object->pose != NULL) { + LINKLIST_FOREACH(bPoseChannel *, pchan, &object->pose->chanbase) { if (BLI_findindex(&pchan->constraints, con) != -1) { /* bone transforms */ *type = DEG_NODE_TYPE_BONE; @@ -179,23 +169,12 @@ static bool pointer_to_component_node_criteria(const PointerRNA *ptr, } } else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) { - //ModifierData *md = (ModifierData *)ptr->data; - - /* Modifier */ - /* NOTE: subdata is not the same as "operation name", - * so although we have unique ops for modifiers, - * we can't lump them together - */ - *type = DEG_NODE_TYPE_BONE; - //*subdata = md->name; - + *type = DEG_NODE_TYPE_GEOMETRY; return true; } else if (ptr->type == &RNA_Object) { - //Object *object = (Object *)ptr->data; - /* Transforms props? */ - if (prop) { + if (prop != NULL) { const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); /* TODO(sergey): How to optimize this? */ if (strstr(prop_identifier, "location") || @@ -217,11 +196,11 @@ static bool pointer_to_component_node_criteria(const PointerRNA *ptr, } else if (ptr->type == &RNA_ShapeKey) { Key *key = (Key *)ptr->id.data; - - /* ShapeKeys are currently handled as geometry on the geometry that owns it */ - *id = key->from; // XXX + /* ShapeKeys are currently handled as geometry on the geometry that + * owns it. + */ + *id = key->from; *type = DEG_NODE_TYPE_PARAMETERS; - return true; } else if (RNA_struct_is_a(ptr->type, &RNA_Sequence)) { @@ -231,13 +210,11 @@ static bool pointer_to_component_node_criteria(const PointerRNA *ptr, *subdata = seq->name; // xxx? return true; } - - if (prop) { - /* All unknown data effectively falls under "parameter evaluation" */ + if (prop != NULL) { + /* All unknown data effectively falls under "parameter evaluation". */ *type = DEG_NODE_TYPE_PARAMETERS; return true; } - return false; } |