Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-06-12 10:22:23 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-06-12 10:22:23 +0400
commit2127e62c9b2d05351013ceb5996cddc38925b457 (patch)
treeb9de0f36991c7a1588188fa27ee0d055559ae2c5
parentac5a735e3fe9fe29e38e3a20c20da87b27feb112 (diff)
"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.
-rw-r--r--release/scripts/startup/bl_ui/properties_object_constraint.py1
-rw-r--r--source/blender/blenkernel/intern/constraint.c18
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h8
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c7
4 files changed, 24 insertions, 10 deletions
diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py
index bfa2b4f60ef..e4da581ab83 100644
--- a/release/scripts/startup/bl_ui/properties_object_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_object_constraint.py
@@ -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()
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 9d36a66843b..62fb791df3a 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -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");
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 59d8e81de39..aae167d05c6 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -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,
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 8e29e5c2e79..f02df6c30ed 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -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);