[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24049] trunk/blender/source/blender/ editors: Animation Editors: Menu Tweaks

Joshua Leung aligorith at gmail.com
Thu Oct 22 11:07:19 CEST 2009


Revision: 24049
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24049
Author:   aligorith
Date:     2009-10-22 11:07:19 +0200 (Thu, 22 Oct 2009)

Log Message:
-----------
Animation Editors: Menu Tweaks

* Submenus displaying the options available for certain operators now will now show the hotkey for the operator on the menu entries. 

* Added an option for mirroring keyframes in the Graph Editor which makes use of the new cursor

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_filter.c
    trunk/blender/source/blender/editors/animation/keyframes_edit.c
    trunk/blender/source/blender/editors/include/ED_keyframes_edit.h
    trunk/blender/source/blender/editors/space_action/action_header.c
    trunk/blender/source/blender/editors/space_graph/graph_draw.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c
    trunk/blender/source/blender/editors/space_graph/graph_header.c
    trunk/blender/source/blender/editors/space_graph/graph_intern.h
    trunk/blender/source/blender/editors/space_nla/nla_header.c

Modified: trunk/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_filter.c	2009-10-22 06:09:43 UTC (rev 24048)
+++ trunk/blender/source/blender/editors/animation/anim_filter.c	2009-10-22 09:07:19 UTC (rev 24049)
@@ -373,9 +373,18 @@
  *
  * 	- id: ID block which should have an AnimData pointer following it immediately, to use
  *	- adtOk: line or block of code to execute for AnimData-blocks case (usually ANIMDATA_ADD_ANIMDATA)
- *	- nlaOk: line or block of code to execute for NLA case
+ *	- nlaOk: line or block of code to execute for NLA tracks+strips case
  *	- driversOk: line or block of code to execute for Drivers case
  *	- keysOk: line or block of code for Keyframes case
+ *
+ * The checks for the various cases are as follows:
+ *	0) top level: checks for animdata and also that all the F-Curves for the block will be visible
+ *	1) animdata check: for filtering animdata blocks only
+ *	2A) nla tracks: include animdata block's data as there are NLA tracks+strips there
+ *	2B) actions to convert to nla: include animdata block's data as there is an action that can be 
+ *		converted to a new NLA strip, and the filtering options allow this
+ *	3) drivers: include drivers from animdata block (for Drivers mode in Graph Editor)
+ *	4) normal keyframes: only when there is an active action
  */
 #define ANIMDATA_FILTER_CASES(id, adtOk, nlaOk, driversOk, keysOk) \
 	{\

Modified: trunk/blender/source/blender/editors/animation/keyframes_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_edit.c	2009-10-22 06:09:43 UTC (rev 24048)
+++ trunk/blender/source/blender/editors/animation/keyframes_edit.c	2009-10-22 09:07:19 UTC (rev 24049)
@@ -669,6 +669,19 @@
 	return 0;
 }
 
+static short mirror_bezier_value(BeztEditData *bed, BezTriple *bezt)
+{
+	float diff;
+	
+	/* value to mirror over is stored in the custom data -> first float value slot */
+	if (bezt->f2 & SELECT) {
+		diff= (bed->f1 - bezt->vec[1][1]);
+		bezt->vec[1][1]= (bed->f1 + diff);
+	}
+	
+	return 0;
+}
+
 /* Note: for markers case, need to set global vars (eww...) */
 // calchandles_fcurve
 BeztEditFunc ANIM_editkeyframes_mirror(short type)
@@ -682,6 +695,8 @@
 			return mirror_bezier_xaxis;
 		case MIRROR_KEYS_MARKER: /* mirror over marker */
 			return mirror_bezier_marker; 
+		case MIRROR_KEYS_VALUE: /* mirror over given value */
+			return mirror_bezier_value;
 		default: /* just in case */
 			return mirror_bezier_yaxis;
 			break;

Modified: trunk/blender/source/blender/editors/include/ED_keyframes_edit.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_keyframes_edit.h	2009-10-22 06:09:43 UTC (rev 24048)
+++ trunk/blender/source/blender/editors/include/ED_keyframes_edit.h	2009-10-22 09:07:19 UTC (rev 24049)
@@ -82,6 +82,7 @@
 	MIRROR_KEYS_YAXIS,
 	MIRROR_KEYS_XAXIS,
 	MIRROR_KEYS_MARKER,
+	MIRROR_KEYS_VALUE,
 } eEditKeyframes_Mirror;
 
 /* ************************************************ */

Modified: trunk/blender/source/blender/editors/space_action/action_header.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/action_header.c	2009-10-22 06:09:43 UTC (rev 24048)
+++ trunk/blender/source/blender/editors/space_action/action_header.c	2009-10-22 09:07:19 UTC (rev 24049)
@@ -167,62 +167,11 @@
 	uiItemEnumO(layout, "Scale", 0, "TFM_OT_transform", "mode", TFM_TIME_SCALE);
 }
 
-static void act_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
-	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); 
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_CFRA);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_NEAREST_FRAME);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_NEAREST_SECOND);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_NEAREST_MARKER);
-}
-
-static void act_edit_mirrormenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
-	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_CFRA);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_YAXIS);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_XAXIS);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_MARKER);
-}
-
-static void act_edit_keytypesmenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
-	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_keyframe_type", "type", BEZT_KEYTYPE_KEYFRAME);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_keyframe_type", "type", BEZT_KEYTYPE_BREAKDOWN);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_keyframe_type", "type", BEZT_KEYTYPE_EXTREME);
-}
-
-static void act_edit_handlesmenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
-	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_FREE);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_AUTO);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_VECT);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_ALIGN);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_AUTO_ANIM); // xxx?
-}
-
-static void act_edit_ipomenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
-	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_CONST);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_LIN);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_BEZ);
-}
-
-static void act_edit_expomenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
-	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_extrapolation_type", "type", FCURVE_EXTRAPOLATE_CONSTANT);
-	uiItemEnumO(layout, NULL, 0, "ACT_OT_extrapolation_type", "type", FCURVE_EXTRAPOLATE_LINEAR);
-}
-
 static void act_editmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
 	uiItemMenuF(layout, "Transform", 0, act_edit_transformmenu, NULL);
-	uiItemMenuF(layout, "Snap", 0, act_edit_snapmenu, NULL);
-	uiItemMenuF(layout, "Mirror", 0, act_edit_mirrormenu, NULL);
+	uiItemMenuEnumO(layout, "Snap", 0, "ACT_OT_snap", "type");
+	uiItemMenuEnumO(layout, "Mirror", 0, "ACT_OT_mirror", "type");
 	
 	uiItemS(layout);
 	
@@ -235,10 +184,10 @@
 	
 	uiItemS(layout);
 	
-	uiItemMenuF(layout, "Keyframe Type", 0, act_edit_keytypesmenu, NULL);
-	uiItemMenuF(layout, "Handle Type", 0, act_edit_handlesmenu, NULL);
-	uiItemMenuF(layout, "Interpolation Mode", 0, act_edit_ipomenu, NULL);
-	uiItemMenuF(layout, "Extrapolation Mode", 0, act_edit_expomenu, NULL);
+	uiItemMenuEnumO(layout, "Keyframe Type", 0, "ACT_OT_keyframe_type", "type");
+	uiItemMenuEnumO(layout, "Handle Type", 0, "ACT_OT_handle_type", "type");
+	uiItemMenuEnumO(layout, "Interpolation Type", 0, "ACT_OT_interpolation_type", "type");
+	uiItemMenuEnumO(layout, "Extrapolation Type", 0, "ACT_OT_extrapolation_type", "type");
 	
 	uiItemS(layout);
 	

Modified: trunk/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_draw.c	2009-10-22 06:09:43 UTC (rev 24048)
+++ trunk/blender/source/blender/editors/space_graph/graph_draw.c	2009-10-22 09:07:19 UTC (rev 24049)
@@ -87,9 +87,6 @@
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
-/* XXX */
-extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
-
 /* *************************** */
 /* Utility Drawing Defines */
 
@@ -881,7 +878,7 @@
 					draw_fcurve_vertices(sipo, ar, fcu);
 				}
 				else {
-					/* samples: should we only draw two indicators at either end as indicators? */
+					/* samples: only draw two indicators at either end as indicators */
 					draw_fcurve_samples(sipo, ar, fcu);
 				}
 			}

Modified: trunk/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_edit.c	2009-10-22 06:09:43 UTC (rev 24048)
+++ trunk/blender/source/blender/editors/space_graph/graph_edit.c	2009-10-22 09:07:19 UTC (rev 24049)
@@ -1551,7 +1551,8 @@
 
 /* defines for mirror keyframes tool */
 EnumPropertyItem prop_graphkeys_mirror_types[] = {
-	{GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current frame", ""},
+	{GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current Frame", ""},
+	{GRAPHKEYS_MIRROR_VALUE, "VALUE", 0, "By Values over Cursor Value", ""},
 	{GRAPHKEYS_MIRROR_YAXIS, "YAXIS", 0, "By Times over Time=0", ""},
 	{GRAPHKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", ""},
 	{GRAPHKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", ""},
@@ -1594,6 +1595,10 @@
 		else
 			return;
 	}
+	else if (mode == GRAPHKEYS_MIRROR_VALUE) {
+		SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
+		bed.f1= (sipo) ? sipo->cursorVal : 0.0f;
+	}
 	
 	/* filter data */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);

Modified: trunk/blender/source/blender/editors/space_graph/graph_header.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_header.c	2009-10-22 06:09:43 UTC (rev 24048)
+++ trunk/blender/source/blender/editors/space_graph/graph_header.c	2009-10-22 09:07:19 UTC (rev 24049)
@@ -159,55 +159,11 @@
 	uiItemEnumO(layout, "Scale", 0, "TFM_OT_transform", "mode", TFM_TIME_SCALE);
 }
 
-static void graph_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
-	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-	uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_CFRA);
-	uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_VALUE);
-	uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_NEAREST_FRAME);
-	uiItemEnumO(layout, NULL, 0, "GRAPH_OT_snap", "type", GRAPHKEYS_SNAP_NEAREST_SECOND);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list