[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12195] trunk/blender/source/blender/src: == Armature Layer/Move Bone to Layer Popups ==

Joshua Leung aligorith at gmail.com
Wed Oct 3 02:05:35 CEST 2007


Revision: 12195
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12195
Author:   aligorith
Date:     2007-10-03 02:05:34 +0200 (Wed, 03 Oct 2007)

Log Message:
-----------
== Armature Layer/Move Bone to Layer Popups ==

This commit adds a few quick tools for riggers. In Editmode for Armatures, I've added the popups that show up in PoseMode when Shift-MKEY and MKEY are used. This should speed up the workflow a bit, by requiring less trips between the 3d-view and the buttons panel, as well as providing a 'batch' move-bones-to-layer functionality.

Usage Notes:
* MKEY - move selected bones to layer(s)
* SHIFT-MKEY - change the currently visible armature layers
* CTRL-MKEY - mirror selected bones 

Modified Paths:
--------------
    trunk/blender/source/blender/src/poseobject.c
    trunk/blender/source/blender/src/space.c

Modified: trunk/blender/source/blender/src/poseobject.c
===================================================================
--- trunk/blender/source/blender/src/poseobject.c	2007-10-02 16:55:10 UTC (rev 12194)
+++ trunk/blender/source/blender/src/poseobject.c	2007-10-03 00:05:34 UTC (rev 12195)
@@ -872,7 +872,9 @@
 	}
 }
 
-
+/* This function pops up the move-to-layer popup widgets when the user
+ * presses either SHIFT-MKEY or MKEY in PoseMode OR EditMode (for Armatures)
+ */
 void pose_movetolayer(void)
 {
 	Object *ob= OBACT;
@@ -882,10 +884,11 @@
 	if(ob==NULL) return;
 	arm= ob->data;
 	
-	if(G.qual & LR_SHIFTKEY) {
+	if (G.qual & LR_SHIFTKEY) {
+		/* armature layers */
 		lay= arm->layer;
-		if( movetolayer_short_buts(&lay, "Armature Layers")==0 ) return;
-		if(lay==0) return;
+		if ( movetolayer_short_buts(&lay, "Armature Layers")==0 ) return;
+		if (lay==0) return;
 		arm->layer= lay;
 		if(ob->pose)
 			ob->pose->proxy_layer= lay;
@@ -893,28 +896,28 @@
 		allqueue(REDRAWVIEW3D, 0);
 		allqueue(REDRAWACTION, 0);
 		allqueue(REDRAWBUTSEDIT, 0);
-		
 	}
-	else if(ob->flag & OB_POSEMODE) {
+	else if (ob->flag & OB_POSEMODE) {
+		/* pose-channel layers */
 		bPoseChannel *pchan;
 		
-		if(pose_has_protected_selected(ob, 0))
+		if (pose_has_protected_selected(ob, 0))
 			return;
 		
-		for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-			if(arm->layer & pchan->bone->layer) {
-				if(pchan->bone->flag & BONE_SELECTED)
+		for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+			if (arm->layer & pchan->bone->layer) {
+				if (pchan->bone->flag & BONE_SELECTED)
 					lay |= pchan->bone->layer;
 			}
 		}
-		if(lay==0) return;
+		if (lay==0) return;
 		
-		if( movetolayer_short_buts(&lay, "Bone Layers")==0 ) return;
-		if(lay==0) return;
-
-		for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-			if(arm->layer & pchan->bone->layer) {
-				if(pchan->bone->flag & BONE_SELECTED)
+		if ( movetolayer_short_buts(&lay, "Bone Layers")==0 ) return;
+		if (lay==0) return;
+		
+		for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+			if (arm->layer & pchan->bone->layer) {
+				if (pchan->bone->flag & BONE_SELECTED)
 					pchan->bone->layer= lay;
 			}
 		}
@@ -924,4 +927,30 @@
 		allqueue(REDRAWACTION, 0);
 		allqueue(REDRAWBUTSEDIT, 0);
 	}
+	else if (G.obedit) {
+		/* must be editbone layers then */
+		EditBone *ebo;
+		
+		for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
+			if (arm->layer & ebo->layer) {
+				if (ebo->flag & BONE_SELECTED)
+					lay |= ebo->layer;
+			}
+		}
+		if (lay==0) return;
+		
+		if ( movetolayer_short_buts(&lay, "Bone Layers")==0 ) return;
+		if (lay==0) return;
+		
+		for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
+			if (arm->layer & ebo->layer) {
+				if (ebo->flag & BONE_SELECTED)
+					ebo->layer= lay;
+			}
+		}
+		
+		BIF_undo_push("Move Bone layer");
+		allqueue(REDRAWVIEW3D, 0);
+		allqueue(REDRAWBUTSEDIT, 0);
+	}
 }

Modified: trunk/blender/source/blender/src/space.c
===================================================================
--- trunk/blender/source/blender/src/space.c	2007-10-02 16:55:10 UTC (rev 12194)
+++ trunk/blender/source/blender/src/space.c	2007-10-03 00:05:34 UTC (rev 12195)
@@ -2086,16 +2086,19 @@
 				break;
  			case MKEY:
 				if(G.obedit){
-					if(G.qual==LR_ALTKEY) {
+					if (ELEM(G.qual, 0, LR_SHIFTKEY) && (G.obedit->type==OB_ARMATURE)) {
+						pose_movetolayer();
+					}
+					else if (G.qual==LR_ALTKEY) {
 						if(G.obedit->type==OB_MESH) {
 							mergemenu();
 							DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
 						}
 					}
-					else if((G.qual==0) || (G.qual==LR_CTRLKEY)) {
+					else if ((G.qual==0) || (G.qual==LR_CTRLKEY)) {
 						mirrormenu();
 					}
-					if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
+					else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
 						if(G.obedit->type==OB_MESH) select_non_manifold();
 					}
 				}





More information about the Bf-blender-cvs mailing list