Depsgraph: fix relations for drivers on bone weight in Armature constraint.

This commit is contained in:
Alexander Gavrilov 2018-11-14 14:01:28 +03:00
parent 43ee433dce
commit 5c27c76ed3
5 changed files with 32 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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

View File

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