[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34639] trunk/blender/source/blender/ editors/armature/poseobject.c: Quick Animation Feature: Paste Pose " Selection Mask" option

Joshua Leung aligorith at gmail.com
Fri Feb 4 12:43:31 CET 2011


Revision: 34639
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34639
Author:   aligorith
Date:     2011-02-04 11:43:30 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
Quick Animation Feature: Paste Pose "Selection Mask" option

After discussions with ZanQdo, it was agreed that the current workflow
for making a pose symmetrical was a bit too cumbersome, especially
when auto-keying was enabled, requiring pasting the flipped pose on
another frame so that the changes could be merged back in without
overwriting the "good" half of the rig.

This option for the Paste Pose operator makes things easier, by adding
an option which will make the pose only get pasted on to selected
bones instead of overriding the entire pose. By default this option is
turned off, but can be easily enabled either from the toolbar
(operator properties) or through the F6 popup.

The intended workflow with this option for making a rig symmetrical is
now:
1) Copy pose
2) Select "bad" bones
3) Paste Flipped
4) Enable "On Selected Only" for the operator

If there is sufficient interest, this option can even be enabled by
default. But, we'll see about that later

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/poseobject.c

Modified: trunk/blender/source/blender/editors/armature/poseobject.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseobject.c	2011-02-04 09:41:59 UTC (rev 34638)
+++ trunk/blender/source/blender/editors/armature/poseobject.c	2011-02-04 11:43:30 UTC (rev 34639)
@@ -932,6 +932,7 @@
 	Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
 	bPoseChannel *chan, *pchan;
 	int flip= RNA_boolean_get(op->ptr, "flipped");
+	int selOnly= RNA_boolean_get(op->ptr, "selected_mask");
 	
 	/* sanity checks */
 	if ELEM(NULL, ob, ob->pose)
@@ -945,17 +946,28 @@
 	/* Safely merge all of the channels in the buffer pose into any existing pose */
 	for (chan= g_posebuf->chanbase.first; chan; chan=chan->next) {
 		if (chan->flag & POSE_KEY) {
+			char name[32];
+			short paste_ok;
+			
 			/* get the name - if flipping, we must flip this first */
-			char name[32];
 			if (flip)
 				flip_side_name(name, chan->name, 0);		/* 0 = don't strip off number extensions */
 			else
 				BLI_strncpy(name, chan->name, sizeof(name));
 			
-			/* only copy when channel exists, poses are not meant to add random channels to anymore */
+			/* only copy when:
+			 * 	1) channel exists - poses are not meant to add random channels to anymore
+			 * 	2) if selection-masking is on, channel is selected - only selected bones get pasted on, allowing making both sides symmetrical
+			 */
 			pchan= get_pose_channel(ob->pose, name);
 			
-			if (pchan) {
+			if (selOnly)
+				paste_ok= ((pchan) && (pchan->bone->flag & BONE_SELECTED));
+			else
+				paste_ok= ((pchan != NULL));
+			
+			/* continue? */
+			if (paste_ok) {
 				/* only loc rot size 
 				 *	- only copies transform info for the pose 
 				 */
@@ -1098,6 +1110,7 @@
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "flipped", 0, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose");
+	RNA_def_boolean(ot->srna, "selected_mask", 0, "On Selected Only", "Only paste the stored post on to selected bones in the current pose");
 }
 
 /* ********************************************** */




More information about the Bf-blender-cvs mailing list