[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43377] trunk/blender: replace operator to toggle handles with generic wm operator

Campbell Barton ideasman42 at gmail.com
Sat Jan 14 17:26:19 CET 2012


Revision: 43377
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43377
Author:   campbellbarton
Date:     2012-01-14 16:26:08 +0000 (Sat, 14 Jan 2012)
Log Message:
-----------
replace operator to toggle handles with generic wm operator

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_graph.py
    trunk/blender/source/blender/editors/space_graph/graph_ops.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_graph.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_graph.py	2012-01-14 14:17:12 UTC (rev 43376)
+++ trunk/blender/release/scripts/startup/bl_ui/space_graph.py	2012-01-14 16:26:08 UTC (rev 43377)
@@ -81,10 +81,9 @@
         layout.prop(st, "use_beauty_drawing")
 
         layout.separator()
-        if st.show_handles:
-            layout.operator("graph.handles_view_toggle", icon='CHECKBOX_HLT', text="Show All Handles")
-        else:
-            layout.operator("graph.handles_view_toggle", icon='CHECKBOX_DEHLT', text="Show All Handles")
+
+        layout.prop(st, "show_handles")
+
         layout.prop(st, "use_only_selected_curves_handles")
         layout.prop(st, "use_only_selected_keyframe_handles")
 

Modified: trunk/blender/source/blender/editors/space_graph/graph_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_ops.c	2012-01-14 14:17:12 UTC (rev 43376)
+++ trunk/blender/source/blender/editors/space_graph/graph_ops.c	2012-01-14 16:26:08 UTC (rev 43377)
@@ -182,43 +182,11 @@
 	RNA_def_float(ot->srna, "value", 0, FLT_MIN, FLT_MAX, "Value", "", -100.0f, 100.0f);
 }
 
-/* Toggle Handles ----------------------------------------------------------------- */
-
-static int view_toggle_handles_exec (bContext *C, wmOperator *UNUSED(op))
-{
-	SpaceIpo *sipo= CTX_wm_space_graph(C);
-	ARegion *ar= CTX_wm_region(C);
-	
-	if (sipo == NULL)
-		return OPERATOR_CANCELLED;
-	
-	/* toggle flag to hide handles */
-	sipo->flag ^= SIPO_NOHANDLES;
-	
-	/* request refresh of keys area */
-	ED_region_tag_redraw(ar);
-	
-	return OPERATOR_FINISHED;
-}
-
-static void GRAPH_OT_view_togglehandles (wmOperatorType *ot)
-{
-	/* identification */
-	ot->name= "Show/Hide All Handles";
-	ot->idname= "GRAPH_OT_handles_view_toggle";
-	ot->description= "Toggle whether handles are drawn on all keyframes that need them";
-	
-	/* callbacks */
-	ot->exec= view_toggle_handles_exec;
-	ot->poll= ED_operator_graphedit_active;
-}
-
 /* ************************** registration - operator types **********************************/
 
 void graphedit_operatortypes(void)
 {
 	/* view */
-	WM_operatortype_append(GRAPH_OT_view_togglehandles);
 	WM_operatortype_append(GRAPH_OT_cursor_set);
 	
 	WM_operatortype_append(GRAPH_OT_previewrange_set);
@@ -290,7 +258,9 @@
 	wmKeyMapItem *kmi;
 	
 	/* view */
-	WM_keymap_add_item(keymap, "GRAPH_OT_handles_view_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_string_set(kmi->ptr, "data_path", "space_data.show_handles");
+
 		/* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons
 		 * This keymap is supposed to override ANIM_OT_change_frame, which does the same except it doesn't do y-values
 		 */



More information about the Bf-blender-cvs mailing list