diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-14 14:01:28 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-14 14:01:40 +0300 |
commit | 5c27c76ed3a9683c5d54745add6713eb562996e8 (patch) | |
tree | d6e3726fd08ce8cc8298c54fa8f2e9ccf559c041 /source | |
parent | 43ee433dceccf13868da683ec781b30f17185a2b (diff) |
Depsgraph: fix relations for drivers on bone weight in Armature constraint.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_constraint.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 10 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.cc | 20 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 2 |
5 files changed, 32 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index e7672001a15..bfcdcb68c4a 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -138,7 +138,7 @@ struct bConstraint *BKE_constraints_active_get(struct ListBase *list); void BKE_constraints_active_set(ListBase *list, struct bConstraint *con); struct bConstraint *BKE_constraints_find_name(struct ListBase *list, const char *name); -struct bConstraint *BKE_constraint_find_from_target(struct Object *ob, struct bConstraintTarget *tgt); +struct bConstraint *BKE_constraint_find_from_target(struct Object *ob, struct bConstraintTarget *tgt, struct bPoseChannel **r_pchan); struct bConstraint *BKE_constraint_add_for_object(struct Object *ob, const char *name, short type); struct bConstraint *BKE_constraint_add_for_pose(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index e16117745c9..8dfb50cd159 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -5058,8 +5058,12 @@ static bConstraint *constraint_list_find_from_target(ListBase *constraints, bCon } /* Finds the constraint that owns the given target within the object. */ -bConstraint *BKE_constraint_find_from_target(Object *ob, bConstraintTarget *tgt) +bConstraint *BKE_constraint_find_from_target(Object *ob, bConstraintTarget *tgt, bPoseChannel **r_pchan) { + if (r_pchan != NULL) { + *r_pchan = NULL; + } + bConstraint *result = constraint_list_find_from_target(&ob->constraints, tgt); if (result != NULL) { @@ -5071,6 +5075,10 @@ bConstraint *BKE_constraint_find_from_target(Object *ob, bConstraintTarget *tgt) result = constraint_list_find_from_target(&pchan->constraints, tgt); if (result != NULL) { + if (r_pchan != NULL) { + *r_pchan = pchan; + } + return result; } } diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index d3c9560bcb1..7f47dce9f47 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -51,6 +51,7 @@ extern "C" { #include "RNA_access.h" #include "BKE_scene.h" +#include "BKE_constraint.h" } #include <algorithm> @@ -183,6 +184,25 @@ static bool pointer_to_component_node_criteria( } } } + else if (ELEM(ptr->type, &RNA_ConstraintTarget, &RNA_ConstraintTargetBone)) { + Object *object = (Object *)ptr->id.data; + bConstraintTarget *tgt = (bConstraintTarget *)ptr->data; + /* Check whether is object or bone constraint. */ + bPoseChannel *pchan = NULL; + bConstraint *con = BKE_constraint_find_from_target(object, tgt, &pchan); + if (con != NULL) { + if (pchan != NULL) { + *type = DEG_NODE_TYPE_BONE; + *operation_code = DEG_OPCODE_BONE_LOCAL; + *subdata = pchan->name; + } + else { + *type = DEG_NODE_TYPE_TRANSFORM; + *operation_code = DEG_OPCODE_TRANSFORM_LOCAL; + } + return true; + } + } else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) { *type = DEG_NODE_TYPE_GEOMETRY; return true; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 2f4d999c4fb..a74479e193c 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -198,6 +198,7 @@ extern StructRNA RNA_CompositorNodeZcombine; extern StructRNA RNA_ConsoleLine; extern StructRNA RNA_Constraint; extern StructRNA RNA_ConstraintTarget; +extern StructRNA RNA_ConstraintTargetBone; extern StructRNA RNA_Context; extern StructRNA RNA_ControlFluidSettings; extern StructRNA RNA_Controller; diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index d7fd0aae917..898852739eb 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -314,7 +314,7 @@ static bConstraint *rna_constraint_from_target(PointerRNA *ptr) Object *ob = ptr->id.data; bConstraintTarget *tgt = ptr->data; - return BKE_constraint_find_from_target(ob, tgt); + return BKE_constraint_find_from_target(ob, tgt, NULL); } static char *rna_ConstraintTarget_path(PointerRNA *ptr) |