[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43253] branches/soc-2011-onion-uv-tools/ source/blender/editors: modify key binding for uv sculpting to reuse existing WM_OT_context_toggle operator .

Antony Riakiotakis kalast at gmail.com
Tue Jan 10 03:21:07 CET 2012


Revision: 43253
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43253
Author:   psy-fi
Date:     2012-01-10 02:20:58 +0000 (Tue, 10 Jan 2012)
Log Message:
-----------
modify key binding for uv sculpting to reuse existing WM_OT_context_toggle operator. Thanks to Campbell for the suggestion

Modified Paths:
--------------
    branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c	2012-01-10 00:39:36 UTC (rev 43252)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c	2012-01-10 02:20:58 UTC (rev 43253)
@@ -694,7 +694,8 @@
 	keymap= WM_keymap_find(keyconf, "UV Sculpt", 0, 0);
 	keymap->poll= uv_sculpt_poll;
 
-	WM_keymap_add_item(keymap, "UV_OT_toggle_uv_sculpt", QKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0);
+	RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_uv_sculpt");
 
 	WM_keymap_add_item(keymap, "SCULPT_OT_uv_sculpt_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "SCULPT_OT_uv_sculpt_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "invert", 1);

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c	2012-01-10 00:39:36 UTC (rev 43252)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c	2012-01-10 02:20:58 UTC (rev 43253)
@@ -3298,30 +3298,6 @@
 }
 
 
-static int toggle_uv_sculpt_exec(bContext *C, wmOperator *UNUSED(op)){
-	ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
-	toolsettings->use_uv_sculpt = !toolsettings->use_uv_sculpt;
-
-	ED_space_image_uv_sculpt_update(CTX_data_main(C)->wm.first, toolsettings);
-	ED_region_tag_redraw(CTX_wm_region(C));
-	return OPERATOR_FINISHED;
-}
-
-static void UV_OT_toggle_uv_sculpt(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name = "Toggle Uv Sculpt";
-	ot->description = "Turn Uv Svulpting On and Off";
-	ot->idname = "UV_OT_toggle_uv_sculpt";
-
-	/* flags */
-	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/* api callbacks */
-	ot->exec = toggle_uv_sculpt_exec;
-	ot->poll = ED_operator_uvedit;
-}
-
 /* ************************** registration **********************************/
 
 void ED_operatortypes_uvedit(void)
@@ -3361,8 +3337,6 @@
 
 	WM_operatortype_append(UV_OT_cursor_set);
 	WM_operatortype_append(UV_OT_tile_set);
-
-	WM_operatortype_append(UV_OT_toggle_uv_sculpt);
 }
 
 void ED_keymap_uvedit(wmKeyConfig *keyconf)
@@ -3374,7 +3348,8 @@
 	keymap->poll= ED_operator_uvedit_can_uv_sculpt;
 
 	/* Uv sculpt toggle */
-	WM_keymap_add_item(keymap, "UV_OT_toggle_uv_sculpt", QKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0);
+	RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_uv_sculpt");
 
 	/* Mark edge seam */
 	WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", EKEY, KM_PRESS, KM_CTRL, 0);



More information about the Bf-blender-cvs mailing list