"Fix" for [#30704] Action Constraint mapping bug
Feature request rather than a real bug: allow constrained bone to use "object" part of the linked action, in addition to "same-named bone" part.
This commit is contained in:
parent
ac5a735e3f
commit
2127e62c9b
@ -444,6 +444,7 @@ class ConstraintButtonsPanel():
|
||||
col = split.column()
|
||||
col.label(text="To Action:")
|
||||
col.prop(con, "action", text="")
|
||||
col.prop(con, "use_bone_object_action")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
@ -2159,7 +2159,15 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
|
||||
printf("do Action Constraint %s - Ob %s Pchan %s\n", con->name, cob->ob->id.name + 2, (cob->pchan) ? cob->pchan->name : NULL);
|
||||
|
||||
/* Get the appropriate information from the action */
|
||||
if (cob->type == CONSTRAINT_OBTYPE_BONE) {
|
||||
if (cob->type == CONSTRAINT_OBTYPE_OBJECT || (data->flag & BONE_USE_OBJECT_ACTION)) {
|
||||
Object workob;
|
||||
|
||||
/* evaluate using workob */
|
||||
// FIXME: we don't have any consistent standards on limiting effects on object...
|
||||
what_does_obaction(cob->ob, &workob, NULL, data->act, NULL, t);
|
||||
BKE_object_to_mat4(&workob, ct->matrix);
|
||||
}
|
||||
else if (cob->type == CONSTRAINT_OBTYPE_BONE) {
|
||||
Object workob;
|
||||
bPose *pose;
|
||||
bPoseChannel *pchan, *tchan;
|
||||
@ -2185,14 +2193,6 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
|
||||
/* Clean up */
|
||||
BKE_pose_free(pose);
|
||||
}
|
||||
else if (cob->type == CONSTRAINT_OBTYPE_OBJECT) {
|
||||
Object workob;
|
||||
|
||||
/* evaluate using workob */
|
||||
// FIXME: we don't have any consistent standards on limiting effects on object...
|
||||
what_does_obaction(cob->ob, &workob, NULL, data->act, NULL, t);
|
||||
BKE_object_to_mat4(&workob, ct->matrix);
|
||||
}
|
||||
else {
|
||||
/* behavior undefined... */
|
||||
puts("Error: unknown owner type for Action Constraint");
|
||||
|
@ -247,7 +247,7 @@ typedef struct bActionConstraint {
|
||||
int end;
|
||||
float min;
|
||||
float max;
|
||||
int pad;
|
||||
int flag;
|
||||
struct bAction *act;
|
||||
char subtarget[64]; /* MAX_ID_NAME-2 */
|
||||
} bActionConstraint;
|
||||
@ -561,6 +561,12 @@ typedef enum eSameVolume_Modes {
|
||||
SAMEVOL_Z
|
||||
} eSameVolume_Modes;
|
||||
|
||||
/* bActionConstraint.flag
|
||||
* WARNING: bitwise! */
|
||||
typedef enum eAction_flags {
|
||||
BONE_USE_OBJECT_ACTION = 1 << 0, /* Bones use "object" part of target action, instead of "same bone name" part. */
|
||||
} eAction_flags;
|
||||
|
||||
/* Locked-Axis Values (Locked Track) */
|
||||
typedef enum eLockAxis_Modes {
|
||||
LOCK_X = 0,
|
||||
|
@ -1111,6 +1111,13 @@ static void rna_def_constraint_action(BlenderRNA *brna)
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_bone_object_action", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_USE_OBJECT_ACTION);
|
||||
RNA_def_property_ui_text(prop, "Object Action",
|
||||
"Bones only: apply the object's transformation channels of the action "
|
||||
"to the constrained bone, instead of bone's channels");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
|
||||
|
||||
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
|
||||
RNA_def_property_int_sdna(prop, NULL, "start");
|
||||
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
|
||||
|
Loading…
Reference in New Issue
Block a user