[Bf-blender-cvs] [057a8c6] master: Add clear seams to uv editor

Antony Riakiotakis noreply at git.blender.org
Thu May 14 12:50:45 CEST 2015


Commit: 057a8c625038ba9b22b01ebbd7bce9940479c034
Author: Antony Riakiotakis
Date:   Thu May 14 12:48:47 2015 +0200
Branches: master
https://developer.blender.org/rB057a8c625038ba9b22b01ebbd7bce9940479c034

Add clear seams to uv editor

===================================================================

M	release/scripts/startup/bl_ui/space_image.py
M	source/blender/editors/uvedit/uvedit_ops.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index bd48116..40da82d 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -336,7 +336,8 @@ class IMAGE_MT_uvs(Menu):
         layout.operator("uv.average_islands_scale")
         layout.operator("uv.minimize_stretch")
         layout.operator("uv.stitch")
-        layout.operator("uv.mark_seam")
+        layout.operator("uv.mark_seam").clear = False
+        layout.operator("uv.mark_seam", text="Clear Seam").clear = True
         layout.operator("uv.seams_from_islands")
         layout.operator("mesh.faces_mirror_uv")
 
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 37070a3..a5c5a01 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -4142,7 +4142,7 @@ static void UV_OT_seams_from_islands(wmOperatorType *ot)
 	RNA_def_boolean(ot->srna, "mark_sharp", 0, "Mark Sharp", "Mark boundary edges as sharp");
 }
 
-static int uv_mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
+static int uv_mark_seam_exec(bContext *C, wmOperator *op)
 {
 	Object *ob = CTX_data_edit_object(C);
 	Scene *scene = CTX_data_scene(C);
@@ -4152,13 +4152,17 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
 	BMFace *efa;
 	BMLoop *loop;
 	BMIter iter, liter;
+	bool clear = RNA_boolean_get(op->ptr, "clear");
 
 	const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
 
 	BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
 		BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
 			if (uvedit_edge_select_test(scene, loop, cd_loop_uv_offset)) {
-				BM_elem_flag_enable(loop->e, BM_ELEM_SEAM);
+				if (clear)
+					BM_elem_flag_disable(loop->e, BM_ELEM_SEAM);
+				else
+					BM_elem_flag_enable(loop->e, BM_ELEM_SEAM);
 			}
 		}
 	}
@@ -4177,7 +4181,7 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
 static void UV_OT_mark_seam(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Mark Seams";
+	ot->name = "Mark Seam";
 	ot->description = "Mark selected UV edges as seams";
 	ot->idname = "UV_OT_mark_seam";
 
@@ -4187,6 +4191,8 @@ static void UV_OT_mark_seam(wmOperatorType *ot)
 	/* api callbacks */
 	ot->exec = uv_mark_seam_exec;
 	ot->poll = ED_operator_uvedit;
+
+	RNA_def_boolean(ot->srna, "clear", false, "Clear Seams", "Clear instead of marking seams");
 }




More information about the Bf-blender-cvs mailing list