[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13966] trunk/blender/source/blender: Action Editor - malefico feature request:

Joshua Leung aligorith at gmail.com
Tue Mar 4 12:29:32 CET 2008


Revision: 13966
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13966
Author:   aligorith
Date:     2008-03-04 12:29:32 +0100 (Tue, 04 Mar 2008)

Log Message:
-----------
Action Editor - malefico feature request:

Show Selected Action-Channels hidden in groups. Use the hotkey Shift ~  to do so. The name of this feature needs reviewing...

Modified Paths:
--------------
    trunk/blender/source/blender/include/BIF_editaction.h
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/header_action.c

Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h	2008-03-04 02:43:51 UTC (rev 13965)
+++ trunk/blender/source/blender/include/BIF_editaction.h	2008-03-04 11:29:32 UTC (rev 13966)
@@ -152,6 +152,7 @@
 void rearrange_action_channels(short mode);
 
 void expand_all_action(void);
+void expand_obscuregroups_action(void);
 void openclose_level_action(short mode);
 void setflag_action_channels(short mode);
 

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2008-03-04 02:43:51 UTC (rev 13965)
+++ trunk/blender/source/blender/src/editaction.c	2008-03-04 11:29:32 UTC (rev 13966)
@@ -2440,28 +2440,28 @@
 	}
 }
 
+/* Syncs selection of channels with selection of object elements in posemode */
 /* messy call... */
-static void select_poseelement_by_name(char *name, int select)
+static void select_poseelement_by_name (char *name, int select)
 {
-	/* Syncs selection of channels with selection of object elements in posemode */
 	Object *ob= OBACT;
 	bPoseChannel *pchan;
 	
-	if (!ob || ob->type!=OB_ARMATURE)
+	if ((ob==NULL) || (ob->type!=OB_ARMATURE))
 		return;
 	
-	if(select==2) {
-		for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next)
+	if (select == 2) {
+		for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next)
 			pchan->bone->flag &= ~(BONE_ACTIVE);
 	}
 	
 	pchan= get_pose_channel(ob->pose, name);
-	if(pchan) {
-		if(select)
+	if (pchan) {
+		if (select)
 			pchan->bone->flag |= (BONE_SELECTED);
 		else 
 			pchan->bone->flag &= ~(BONE_SELECTED);
-		if(select==2)
+		if (select == 2)
 			pchan->bone->flag |= (BONE_ACTIVE);
 	}
 }
@@ -2472,9 +2472,9 @@
 {
 	bActionChannel *achan;
 
-	if (!act)
+	if (act == NULL)
 		return;
-
+	
 	for (achan = act->chanbase.first; achan; achan= achan->next) {
 		if (!strcmp(achan->name, name)) {
 			if (select) {
@@ -3911,6 +3911,35 @@
 	allqueue(REDRAWACTION, 0);
 }
 
+/* Expands those groups which are hiding a selected actionchannel */
+void expand_obscuregroups_action (void)
+{
+	void *data;
+	short datatype;
+	
+	bAction *act;
+	bActionChannel *achan;
+	short mode= 1;
+	
+	/* Get the selected action, exit if none are selected */
+	data = get_action_context(&datatype);
+	if (data == NULL) return;
+	if (datatype != ACTCONT_ACTION) return;
+	act= (bAction *)data;
+	
+	/* check if expand all, or close all */
+	for (achan= act->chanbase.first; achan; achan= achan->next) {
+		if (VISIBLE_ACHAN(achan) && SEL_ACHAN(achan)) {
+			if (achan->grp)
+				achan->grp->flag |= AGRP_EXPANDED;
+		}
+	}
+	
+	/* Cleanup and do redraws */
+	BIF_undo_push("Show Group-Hidden Channels");
+	allqueue(REDRAWACTION, 0);
+}
+
 /* For visible channels, expand/collapse one level */
 void openclose_level_action (short mode)
 {
@@ -4543,8 +4572,12 @@
 			break;
 		
 		case ACCENTGRAVEKEY:
-			if (datatype == ACTCONT_ACTION)
-				expand_all_action();
+			if (datatype == ACTCONT_ACTION) {
+				if (G.qual == LR_SHIFTKEY)
+					expand_obscuregroups_action();
+				else
+					expand_all_action();
+			}
 			break;
 		
 		case PADPLUSKEY:

Modified: trunk/blender/source/blender/src/header_action.c
===================================================================
--- trunk/blender/source/blender/src/header_action.c	2008-03-04 02:43:51 UTC (rev 13965)
+++ trunk/blender/source/blender/src/header_action.c	2008-03-04 11:29:32 UTC (rev 13966)
@@ -124,6 +124,7 @@
 	ACTMENU_CHANNELS_OPENLEVELS = 0,
 	ACTMENU_CHANNELS_CLOSELEVELS,
 	ACTMENU_CHANNELS_EXPANDALL,
+	ACTMENU_CHANNELS_SHOWACHANS,
 	ACTMENU_CHANNELS_DELETE
 };
 
@@ -844,6 +845,9 @@
 		case ACTMENU_CHANNELS_EXPANDALL: /* Expands all channels */
 			expand_all_action();
 			break;
+		case ACTMENU_CHANNELS_SHOWACHANS: /* Unfold groups that are hiding selected achans */
+			expand_obscuregroups_action();
+			break;
 		case ACTMENU_CHANNELS_DELETE: /* Deletes selected channels */
 			delete_action_channels();
 			break;
@@ -886,6 +890,10 @@
 			menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_EXPANDALL, "");
 			
 	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
+			"Show Group-Hidden Channels|Shift ~", 0, yco-=20,
+			menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_SHOWACHANS, "");
+			
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
 			"Expand One Level|Ctrl NumPad+", 0, yco-=20,
 			menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_OPENLEVELS, "");
 			





More information about the Bf-blender-cvs mailing list