[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13589] trunk/blender/source/blender: Bugfixes:

Joshua Leung aligorith at gmail.com
Wed Feb 6 12:10:34 CET 2008


Revision: 13589
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13589
Author:   aligorith
Date:     2008-02-06 12:10:34 +0100 (Wed, 06 Feb 2008)

Log Message:
-----------
Bugfixes:

* Action Editor "Open/Close Level" now works with Action Groups. Groups have priority over Action Channels for collapsing/expanding.

* Custom bone shapes using the new 'wire' option, were drawing with the wrong wireframe colour at times (i.e.  when out of posemode, this happened quite often). 

* Fixed/added a few comments in various places

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_armature_types.h
    trunk/blender/source/blender/src/drawaction.c
    trunk/blender/source/blender/src/drawarmature.c
    trunk/blender/source/blender/src/editaction.c

Modified: trunk/blender/source/blender/makesdna/DNA_armature_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_armature_types.h	2008-02-06 05:27:23 UTC (rev 13588)
+++ trunk/blender/source/blender/makesdna/DNA_armature_types.h	2008-02-06 11:10:34 UTC (rev 13589)
@@ -100,7 +100,7 @@
 	ARM_MIRROR_EDIT		= (1<<8),
 	ARM_AUTO_IK			= (1<<9),
 	ARM_NO_CUSTOM		= (1<<10), 	/* made option negative, for backwards compat */
-	ARM_COL_CUSTOM		= (1<<11),	/* draw custom colours - not yet used... */
+	ARM_COL_CUSTOM		= (1<<11),	/* draw custom colours  */
 	ARM_GHOST_ONLYSEL 	= (1<<12)	/* when ghosting, only show selected bones (this should belong to ghostflag instead) */
 } eArmature_Flag;
 

Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c	2008-02-06 05:27:23 UTC (rev 13588)
+++ trunk/blender/source/blender/src/drawaction.c	2008-02-06 11:10:34 UTC (rev 13589)
@@ -1118,6 +1118,7 @@
 	/* get beztriples */
 	beztn= (icu->bezt + index);
 	
+	/* we need to go through all beztriples, as they may not be in order (i.e. during transform) */
 	for (v=0, bezt=icu->bezt; v<icu->totvert; v++, bezt++) {
 		/* skip if beztriple is current */
 		if (v != index) {
@@ -1270,7 +1271,7 @@
 			/* get co-ordinate to draw at */
 			gla2DDrawTranslatePt(di, ak->cfra, ypos, &sc_x, &sc_y);
 			
-			/* draw using icons - slower */
+			/* draw using icons - old way which is slower but more proven */
 			//if(ak->sel & 1) BIF_icon_draw_aspect(sc_x-7, sc_y-6, ICON_SPACE2, 1.0f);
 			//else BIF_icon_draw_aspect(sc_x-7, sc_y-6, ICON_SPACE3, 1.0f);
 			

Modified: trunk/blender/source/blender/src/drawarmature.c
===================================================================
--- trunk/blender/source/blender/src/drawarmature.c	2008-02-06 05:27:23 UTC (rev 13588)
+++ trunk/blender/source/blender/src/drawarmature.c	2008-02-06 11:10:34 UTC (rev 13589)
@@ -1589,9 +1589,15 @@
 					set_pchan_colorset(ob, pchan);
 					
 					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
-						/* BONE_DRAWWIRE case is here too, as sometimes wire overlay won't be done */
-						if (pchan->bone->flag & BONE_DRAWWIRE) 
-							draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
+						/* BONE_DRAWWIRE case is here too, as wire overlay won't be done when in Object Mode
+						 * It's a bit of a hack, and we make sure TH_WIRE is used (just in case).
+						 */
+						if (pchan->bone->flag & BONE_DRAWWIRE) {
+							if ((arm->flag & ARM_POSEMODE) == 0) {
+								BIF_ThemeColor(TH_WIRE);
+								draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
+							}
+						}
 						else
 							draw_custom_bone(pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length);
 					}
@@ -1695,8 +1701,9 @@
 					set_pchan_colorset(ob, pchan);
 
 					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
-						if ((dt < OB_SOLID) || (pchan->bone->flag & BONE_DRAWWIRE))
+						if ((dt < OB_SOLID) || (pchan->bone->flag & BONE_DRAWWIRE)) {
 							draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
+						}
 					}
 					else if (arm->drawtype==ARM_ENVELOPE) {
 						if (dt < OB_SOLID)

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2008-02-06 05:27:23 UTC (rev 13588)
+++ trunk/blender/source/blender/src/editaction.c	2008-02-06 11:10:34 UTC (rev 13589)
@@ -3675,15 +3675,19 @@
 /* Expand all channels to show full hierachy */
 void expand_all_action (void)
 {
+	void *data;
+	short datatype;
+	
 	bAction *act;
 	bActionChannel *achan;
 	bActionGroup *agrp;
 	short mode= 1;
 	
 	/* Get the selected action, exit if none are selected */
-	// TODO: really this should be done with the "action editor api" stuff, but this will suffice for now 
-	act = G.saction->action;
-	if (act == NULL) return;
+	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 (agrp= act->groups.first; agrp; agrp= agrp->next) {
@@ -3729,40 +3733,57 @@
 /* For visible channels, expand/collapse one level */
 void openclose_level_action (short mode)
 {
+	void *data;
+	short datatype;
+	
 	bAction *act;
 	bActionChannel *achan;
+	bActionGroup *agrp;
 	
 	/* Get the selected action, exit if none are selected */
-	// TODO: really this should be done with the "action editor api" stuff, but this will suffice for now 
-	act = G.saction->action;
-	if (act == NULL) return;
+	data = get_action_context(&datatype);
+	if (data == NULL) return;
+	if (datatype != ACTCONT_ACTION) return;
+	act= (bAction *)data;
 	
 	/* Abort if no operation required */
 	if (mode == 0) return;
 	
 	/* Only affect selected channels */
-	// FIXME: check for action-groups
 	for (achan= act->chanbase.first; achan; achan= achan->next) {
-		if (VISIBLE_ACHAN(achan) && SEL_ACHAN(achan)) {
-			if (EXPANDED_ACHAN(achan)) {
-				if (FILTER_IPO_ACHAN(achan) || FILTER_CON_ACHAN(achan)) {
-					if (mode < 0)
-						achan->flag &= ~(ACHAN_SHOWIPO|ACHAN_SHOWCONS);
+		/* make sure if there is a group, it isn't about to be collapsed and is open */
+		if ( (achan->grp==NULL) || (EXPANDED_AGRP(achan->grp) && SEL_AGRP(achan->grp)==0) ) {
+			if (VISIBLE_ACHAN(achan) && SEL_ACHAN(achan)) {
+				if (EXPANDED_ACHAN(achan)) {
+					if (FILTER_IPO_ACHAN(achan) || FILTER_CON_ACHAN(achan)) {
+						if (mode < 0)
+							achan->flag &= ~(ACHAN_SHOWIPO|ACHAN_SHOWCONS);
+					}
+					else {
+						if (mode > 0)
+							achan->flag |= (ACHAN_SHOWIPO|ACHAN_SHOWCONS);
+						else
+							achan->flag &= ~ACHAN_EXPANDED;
+					}					
 				}
 				else {
 					if (mode > 0)
-						achan->flag |= (ACHAN_SHOWIPO|ACHAN_SHOWCONS);
-					else
-						achan->flag &= ~ACHAN_EXPANDED;
-				}					
+						achan->flag |= ACHAN_EXPANDED;
+				}
 			}
-			else {
-				if (mode > 0)
-					achan->flag |= ACHAN_EXPANDED;
-			}
 		}
 	}
 	
+	/* Expand/collapse selected groups */
+	for (agrp= act->groups.first; agrp; agrp= agrp->next) {
+		if (SEL_AGRP(agrp)) {
+			if (mode < 0)
+				agrp->flag &= ~AGRP_EXPANDED;
+			else
+				agrp->flag |= AGRP_EXPANDED;
+		}
+	}
+	
 	/* Cleanup and do redraws */
 	BIF_undo_push("Expand/Collapse Action Level");
 	allqueue(REDRAWACTION, 0);





More information about the Bf-blender-cvs mailing list