[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38798] branches/soc-2011-onion: tag seams in UV editor operator:

Antony Riakiotakis kalast at gmail.com
Thu Jul 28 21:52:18 CEST 2011


Revision: 38798
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38798
Author:   psy-fi
Date:     2011-07-28 19:52:17 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
tag seams in UV editor operator:
-placeholder code and GUI, shortcut is Y

Modified Paths:
--------------
    branches/soc-2011-onion/release/scripts/startup/bl_ui/space_image.py
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c

Modified: branches/soc-2011-onion/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- branches/soc-2011-onion/release/scripts/startup/bl_ui/space_image.py	2011-07-28 18:51:09 UTC (rev 38797)
+++ branches/soc-2011-onion/release/scripts/startup/bl_ui/space_image.py	2011-07-28 19:52:17 UTC (rev 38798)
@@ -268,6 +268,7 @@
         layout.operator("uv.average_islands_scale")
         layout.operator("uv.minimize_stretch")
         layout.operator("uv.stitch")
+        layout.operator("uv.mark_seam_uv")
         layout.operator("uv.seams_from_islands")
         layout.operator("mesh.faces_mirror_uv")
 
@@ -288,6 +289,7 @@
         layout.menu("IMAGE_MT_uvs_showhide")
         layout.separator()
         layout.prop(sima, "use_smooth_brush")
+        layout.separator()
 
 
 class IMAGE_MT_uvs_select_mode(bpy.types.Menu):

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c	2011-07-28 18:51:09 UTC (rev 38797)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c	2011-07-28 19:52:17 UTC (rev 38798)
@@ -4349,9 +4349,45 @@
 
 	/* api callbacks */
 	ot->exec= seams_from_islands_exec;
-	ot->poll= ED_operator_uvmap;
+	ot->poll= ED_operator_uvedit;
 }
 
+
+static int mark_seam_uv_exec(bContext *C, wmOperator *op)
+{
+	Object *ob = CTX_data_edit_object(C);
+	Scene *scene = CTX_data_scene(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+
+	char selection = RNA_boolean_get(op->ptr, "selection");
+
+
+
+	uvedit_live_unwrap_update(sima, scene, ob);
+	DAG_id_tag_update(ob->data, 0);
+	WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+
+	return OPERATOR_FINISHED;
+}
+
+
+static void UV_OT_mark_seam_uv(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Mark Seams UVs";
+	ot->description= "Mark mesh seams from uvs";
+	ot->idname= "UV_OT_mark_seam_uv";
+
+	/* flags */
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	/* api callbacks */
+	ot->exec= mark_seam_uv_exec;
+	ot->poll= ED_operator_uvedit;
+
+	RNA_def_boolean(ot->srna, "selection", 0, "Selection", "Mark edge seams for selection");
+}
+
 /* ************************** registration **********************************/
 
 void ED_operatortypes_uvedit(void)
@@ -4372,6 +4408,7 @@
 	WM_operatortype_append(UV_OT_align);
 	WM_operatortype_append(UV_OT_stitch);
 	WM_operatortype_append(UV_OT_seams_from_islands);
+	WM_operatortype_append(UV_OT_mark_seam_uv);
 	WM_operatortype_append(UV_OT_weld);
 	WM_operatortype_append(UV_OT_pin);
 
@@ -4399,6 +4436,10 @@
 	
 	keymap= WM_keymap_find(keyconf, "UV Editor", 0, 0);
 	keymap->poll= ED_operator_uvedit;
+
+	/* Mark edge seam */
+	WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", YKEY, KM_PRESS, 0, 0);
+	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", YKEY, KM_PRESS, KM_CTRL, 0)->ptr, "selection", 1);
 	
 	/* pick selection */
 	WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);




More information about the Bf-blender-cvs mailing list