[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19766] branches/blender2.5/blender/source /blender/editors: 2.5 Animation UI Tweaks:

Joshua Leung aligorith at gmail.com
Fri Apr 17 04:13:39 CEST 2009


Revision: 19766
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19766
Author:   aligorith
Date:     2009-04-17 04:13:35 +0200 (Fri, 17 Apr 2009)

Log Message:
-----------
2.5 Animation UI Tweaks:

* Added back backgrounds behind buttons for modifiers and driver targets
* 'Protect' toggle doesn't draw for F-Curves with no keyframes to prevent editing on anymore
* Inserting keyframes on objects using builtin keyingsets now use the right names

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
    branches/blender2.5/blender/source/blender/editors/animation/keyingsets.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c	2009-04-16 21:58:06 UTC (rev 19765)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c	2009-04-17 02:13:35 UTC (rev 19766)
@@ -1494,8 +1494,9 @@
 				offset = 0;
 			
 			if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) {
-				/* toggle protection */
-				fcu->flag ^= FCURVE_PROTECTED;
+				/* toggle protection (only if there's a toggle there) */
+				if (fcu->bezt)
+					fcu->flag ^= FCURVE_PROTECTED;
 			}
 			else if (x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) {
 				/* toggle mute */

Modified: branches/blender2.5/blender/source/blender/editors/animation/keyingsets.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/keyingsets.c	2009-04-16 21:58:06 UTC (rev 19765)
+++ branches/blender2.5/blender/source/blender/editors/animation/keyingsets.c	2009-04-17 02:13:35 UTC (rev 19766)
@@ -1077,7 +1077,7 @@
 				int arraylen, i;
 				
 				/* set initial group name */
-				groupname= (cks->id) ? cks->id->name : NULL;
+				groupname= (cks->id) ? cks->id->name+2 : NULL;
 				
 				/* construct the path */
 				// FIXME: this currently only works with a few hardcoded cases

Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c	2009-04-16 21:58:06 UTC (rev 19765)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c	2009-04-17 02:13:35 UTC (rev 19766)
@@ -680,10 +680,14 @@
 					else	
 						mute = ICON_MUTE_IPO_OFF;
 						
-					if (EDITABLE_FCU(fcu))
-						protect = ICON_UNLOCKED;
+					if (fcu->bezt) {
+						if (EDITABLE_FCU(fcu))
+							protect = ICON_UNLOCKED;
+						else
+							protect = ICON_LOCKED;
+					}
 					else
-						protect = ICON_LOCKED;
+						protect = ICON_ZOOMOUT; // XXX editability is irrelevant here, but this icon is temp...
 					
 					sel = SEL_FCU(fcu);
 					

Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_header.c	2009-04-16 21:58:06 UTC (rev 19765)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_header.c	2009-04-17 02:13:35 UTC (rev 19766)
@@ -1558,31 +1558,45 @@
 {
 	SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
 	Object *obact= CTX_data_active_object(C);
-	// AnimData *adt= BKE_id_add_animdata((ID *)obact);
-
+	
+	printf("actedit do id: \n");
+	
 	switch (event) {
 		case UI_ID_BROWSE:
+			printf("browse \n");
 		case UI_ID_DELETE:
+			printf("browse or delete \n");
 			saction->action= (bAction*)id;
+			
 			/* we must set this action to be the one used by active object (if not pinned) */
-			if (saction->pin == 0)
-				obact->adt->action= saction->action;
+			if (saction->pin == 0) {
+				AnimData *adt= BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
+				
+				/* set action */
+				printf("\tset action \n");
+				adt->action= saction->action;
+			}
 			
 			ED_area_tag_redraw(CTX_wm_area(C));
 			ED_undo_push(C, "Assign Action");
 			break;
 		case UI_ID_RENAME:
+			printf("actedit rename \n");
 			break;
 		case UI_ID_ADD_NEW:
+			printf("actedit addnew \n");
 			/* XXX not implemented */
 			break;
 		case UI_ID_OPEN:
+			printf("actedit open \n");
 			/* XXX not implemented */
 			break;
 		case UI_ID_ALONE:
+			printf("actedit alone \n");
 			/* XXX not implemented */
 			break;
 		case UI_ID_PIN:
+			printf("actedit pin \n");
 			break;
 	}
 }
@@ -1689,7 +1703,7 @@
 			/* NAME ETC */
 			//uiClearButLock();
 			
-			/* NAME ETC (it is assumed that */
+			/* NAME ETC  */
 			xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID*)saction->action, ID_AC, &saction->pin, xco, yco,
 				saction_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_DELETE|UI_ID_FAKE_USER|UI_ID_ALONE|UI_ID_PIN);
 			

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c	2009-04-16 21:58:06 UTC (rev 19765)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c	2009-04-17 02:13:35 UTC (rev 19766)
@@ -154,7 +154,7 @@
 	}
 	
 	/* default for now */
-	//WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
+	WM_event_add_notifier(C, NC_SCENE, scene);
 }
 
 #if 0 // XXX replace this for RNA
@@ -272,8 +272,11 @@
 	
 	/* loop over targets, drawing them */
 	for (dtar= driver->targets.first; dtar; dtar= dtar->next) {
-		short height = 60;
+		short height = (dtar->id) ? 80 : 60;
 		
+		/* panel behind buttons */
+		uiDefBut(block, ROUNDBOX, B_REDR, "", 5, yco-height+25, 310, height, NULL, 5.0, 0.0, 12.0, 0, "");
+		
 		/* variable name */
 		uiDefButC(block, TEX, B_REDR, "Name: ", 10,yco,280,20, dtar->name, 0, 63, 0, 0, "Name of target variable (No spaces or dots are allowed. Also, must not start with a symbol or digit).");
 		
@@ -288,9 +291,6 @@
 		
 		// XXX should we hide these technical details?
 		if (dtar->id) {
-			/* increase height by one row */
-			height += 20;
-			
 			uiBlockBeginAlign(block);
 				/* RNA Path */
 				RNA_pointer_create(ale->id, &RNA_DriverTarget, dtar, &rna_ptr);
@@ -331,10 +331,7 @@
 // XXX for now, roundbox has it's callback func set to NULL to not intercept events
 #define DRAW_BACKDROP(height) \
 	{ \
-		if (active) uiBlockSetCol(block, TH_BUT_ACTION); \
-			but= uiDefBut(block, ROUNDBOX, B_REDR, "", 10-8, *yco-height, width, height-1, NULL, 5.0, 0.0, 12.0, (float)rb_col, ""); \
-			uiButSetFunc(but, NULL, NULL, NULL); \
-		if (active) uiBlockSetCol(block, TH_AUTO); \
+		uiDefBut(block, ROUNDBOX, B_REDR, "", -3, *yco-height, width+3, height-1, NULL, 5.0, 0.0, 12.0, (float)rb_col, ""); \
 	}
 
 /* callback to verify modifier data */
@@ -383,13 +380,13 @@
 	(*height) = 90;
 	switch (data->mode) {
 		case FCM_GENERATOR_POLYNOMIAL: /* polynomial expression */
-			(*height) += 20*(data->poly_order+1) + 35;
+			(*height) += 20*(data->poly_order+1) + 20;
 			break;
 		case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* factorised polynomial */
-			(*height) += 20 * data->poly_order;
+			(*height) += 20 * data->poly_order + 15;
 			break;
 		case FCM_GENERATOR_FUNCTION: /* builtin function */
-			(*height) += 50; // xxx
+			(*height) += 55; // xxx
 			break;
 		case FCM_GENERATOR_EXPRESSION: /* py-expression */
 			// xxx nothing to draw 
@@ -397,7 +394,7 @@
 	}
 	
 	/* basic settings (backdrop + mode selector + some padding) */
-	//DRAW_BACKDROP((*height)); // XXX buggy...
+	DRAW_BACKDROP((*height));
 	uiBlockBeginAlign(block);
 		but= uiDefButS(block, MENU, B_FMODIFIER_REDRAW, gen_mode, 10,cy,width-30,19, &data->mode, 0, 0, 0, 0, "Selects type of generator algorithm.");
 		uiButSetFunc(but, validate_fmodifier_cb, fcu, fcm);
@@ -505,7 +502,7 @@
 				char func_name[32];
 				
 				/* coefficient outside bracket */
-				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, cy, 80, 20, cp, -FLT_MAX, FLT_MAX, 10, 3, "Coefficient (A) for function");
+				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 5, cy, 80, 20, cp, -FLT_MAX, FLT_MAX, 10, 3, "Coefficient (A) for function");
 				
 				/* opening bracket */
 				switch (data->func_type)
@@ -529,14 +526,14 @@
 						sprintf(func_name, "<fn?>(");
 						break;
 				}
-				uiDefBut(block, LABEL, 1, func_name, 80, cy, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
+				uiDefBut(block, LABEL, 1, func_name, 85, cy, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
 				
 				/* coefficients inside bracket */
-				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 115, cy, 75, 20, cp+1, -FLT_MAX, FLT_MAX, 10, 3, "Coefficient (B) of x");
+				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 120, cy, 75, 20, cp+1, -FLT_MAX, FLT_MAX, 10, 3, "Coefficient (B) of x");
 				
-				uiDefBut(block, LABEL, 1, "x+", 190, cy, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
+				uiDefBut(block, LABEL, 1, "x+", 195, cy, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
 				
-				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 220, cy, 80, 20, cp+2, -FLT_MAX, FLT_MAX, 10, 3, "Coefficient (C) of function");
+				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 225, cy, 80, 20, cp+2, -FLT_MAX, FLT_MAX, 10, 3, "Coefficient (C) of function");
 				
 				/* closing bracket */
 					uiDefBut(block, LABEL, 1, ")", 300, cy, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
@@ -561,23 +558,23 @@
 	int cy= (*yco - 30), cy1= (*yco - 50), cy2= (*yco - 70);
 	
 	/* set the height */
-	(*height) = 90;
+	(*height) = 80;
 	
 	/* basic settings (backdrop + some padding) */
-	//DRAW_BACKDROP((*height)); // XXX buggy...
+	DRAW_BACKDROP((*height));
 	
 	/* 'before' range */
-	uiDefBut(block, LABEL, 1, "Before:", 10, cy, 80, 20, NULL, 0.0, 0.0, 0, 0, "Settings for cycling before first keyframe");
+	uiDefBut(block, LABEL, 1, "Before:", 5, cy, 80, 20, NULL, 0.0, 0.0, 0, 0, "Settings for cycling before first keyframe");
 	uiBlockBeginAlign(block);
-		uiDefButS(block, MENU, B_FMODIFIER_REDRAW, cyc_mode, 10,cy1,150,20, &data->before_mode, 0, 0, 0, 0, "Cycling mode to use before first keyframe");
-		uiDefButS(block, NUM, B_FMODIFIER_REDRAW, "Max Cycles:", 10, cy2, 150, 20, &data->before_cycles, 0, 10000, 10, 3, "Maximum number of cycles to allow (0 = infinite)");
+		uiDefButS(block, MENU, B_FMODIFIER_REDRAW, cyc_mode, 5,cy1,150,20, &data->before_mode, 0, 0, 0, 0, "Cycling mode to use before first keyframe");
+		uiDefButS(block, NUM, B_FMODIFIER_REDRAW, "Max Cycles:", 5, cy2, 150, 20, &data->before_cycles, 0, 10000, 10, 3, "Maximum number of cycles to allow (0 = infinite)");
 	uiBlockEndAlign(block);
 	
 	/* 'after' range */
-	uiDefBut(block, LABEL, 1, "After:", 160, cy, 80, 20, NULL, 0.0, 0.0, 0, 0, "Settings for cycling after last keyframe");
+	uiDefBut(block, LABEL, 1, "After:", 155, cy, 80, 20, NULL, 0.0, 0.0, 0, 0, "Settings for cycling after last keyframe");
 	uiBlockBeginAlign(block);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list