[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47771] trunk/blender: "Fix" for [#30704] Action Constraint mapping bug

Bastien Montagne montagne29 at wanadoo.fr
Tue Jun 12 08:22:39 CEST 2012


Revision: 47771
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47771
Author:   mont29
Date:     2012-06-12 06:22:23 +0000 (Tue, 12 Jun 2012)
Log Message:
-----------
"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.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py
    trunk/blender/source/blender/blenkernel/intern/constraint.c
    trunk/blender/source/blender/makesdna/DNA_constraint_types.h
    trunk/blender/source/blender/makesrna/intern/rna_constraint.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py	2012-06-12 04:23:21 UTC (rev 47770)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py	2012-06-12 06:22:23 UTC (rev 47771)
@@ -444,6 +444,7 @@
         col = split.column()
         col.label(text="To Action:")
         col.prop(con, "action", text="")
+        col.prop(con, "use_bone_object_action")
 
         split = layout.split()
 

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2012-06-12 04:23:21 UTC (rev 47770)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2012-06-12 06:22:23 UTC (rev 47771)
@@ -2159,8 +2159,16 @@
 			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 @@
 			/* 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");

Modified: trunk/blender/source/blender/makesdna/DNA_constraint_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_constraint_types.h	2012-06-12 04:23:21 UTC (rev 47770)
+++ trunk/blender/source/blender/makesdna/DNA_constraint_types.h	2012-06-12 06:22:23 UTC (rev 47771)
@@ -247,7 +247,7 @@
 	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 @@
 	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,

Modified: trunk/blender/source/blender/makesrna/intern/rna_constraint.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_constraint.c	2012-06-12 04:23:21 UTC (rev 47770)
+++ trunk/blender/source/blender/makesrna/intern/rna_constraint.c	2012-06-12 06:22:23 UTC (rev 47771)
@@ -1111,6 +1111,13 @@
 	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);




More information about the Bf-blender-cvs mailing list