[Bf-blender-cvs] [39e21b2] soc-2016-uv_tools: Make unwrap ops reveal hidden UVs since they're taken into account anyway

Phil Gosch noreply at git.blender.org
Wed Jun 15 10:42:34 CEST 2016


Commit: 39e21b2a98d85a3bd6ffc85fe8800ed6a81e2713
Author: Phil Gosch
Date:   Wed Jun 15 10:41:56 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB39e21b2a98d85a3bd6ffc85fe8800ed6a81e2713

Make unwrap ops reveal hidden UVs since they're taken into account anyway

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

M	source/blender/editors/include/ED_uvedit.h
M	source/blender/editors/uvedit/uvedit_intern.h
M	source/blender/editors/uvedit/uvedit_ops.c
M	source/blender/editors/uvedit/uvedit_unwrap_ops.c

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

diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 119e23d..c5a1e66 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -59,6 +59,8 @@ void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int ma
 
 bool ED_uvedit_test(struct Object *obedit);
 
+void ED_uvedit_reveal(struct BMEditMesh *em);
+
 /* visibility and selection */
 bool uvedit_face_visible_test(struct Scene *scene, struct Image *ima, struct BMFace *efa, struct MTexPoly *tf);
 bool uvedit_face_select_test(struct Scene *scene, struct BMFace *efa,
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index b16f94a..47003bd 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -89,5 +89,6 @@ void UV_OT_reset(struct wmOperatorType *ot);
 void UV_OT_sphere_project(struct wmOperatorType *ot);
 void UV_OT_unwrap(struct wmOperatorType *ot);
 void UV_OT_stitch(struct wmOperatorType *ot);
+void UV_OT_reveal(struct wmOperatorType *ot);
 
 #endif /* __UVEDIT_INTERN_H__ */
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index af48a73..062d9b1 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -3979,7 +3979,7 @@ static void UV_OT_hide(wmOperatorType *ot)
 	
 	/* api callbacks */
 	ot->exec = uv_hide_exec;
-	ot->poll = ED_operator_uvedit;
+	ot->poll = ED_operator_uvmap;
 
 	/* props */
 	RNA_def_boolean(ot->srna, "unselected", 0, "Hide Unselected", "Hide unselected rather than selected");
@@ -3987,40 +3987,44 @@ static void UV_OT_hide(wmOperatorType *ot)
 
 /****************** reveal operator ******************/
 
-static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+void ED_uvedit_reveal(BMEditMesh *em) 
 {
-	SpaceImage *sima = CTX_wm_space_image(C);
-	Object *obedit = CTX_data_edit_object(C);
-	Scene *scene = CTX_data_scene(C);
-	ToolSettings *ts = scene->toolsettings;
-	BMEditMesh *em = BKE_editmesh_from_object(obedit);
 	BMFace *efa;
 	BMLoop *l;
 	BMIter iter, liter;
 	MLoopUV *luv;
 
-	const int cd_loop_uv_offset  = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
-
-	/* call the mesh function if we are in mesh sync sel */
-	if (ts->uv_flag & UV_SYNC_SELECTION) {
-		EDBM_mesh_reveal(em);
-		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+	const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
 
-		return OPERATOR_FINISHED;
-	}
+	BM_ITER_MESH(efa, &iter, em->bm, BM_FACES_OF_MESH) {
 
-	
-	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
-			
 		if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
-			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			BM_ITER_ELEM(l, &liter, efa, BM_LOOPS_OF_FACE) {
 				luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
 				luv->flag &= ~MLOOPUV_HIDDEN;
 			}
 		}
+	}	
+}
+
+static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	Object *obedit = CTX_data_edit_object(C);
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *ts = scene->toolsettings;
+	BMEditMesh *em = BKE_editmesh_from_object(obedit);	
+
+	/* call the mesh function if we are in mesh sync sel */
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		EDBM_mesh_reveal(em);
+		WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
+
+		return OPERATOR_FINISHED;
 	}
 
-	WM_event_add_notifier(C, NC_GEOM | ND_SELECT | ND_DATA, obedit->data);
+	ED_uvedit_reveal(em);
+
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
 	return OPERATOR_FINISHED;
 }
@@ -4035,7 +4039,7 @@ static void UV_OT_reveal(wmOperatorType *ot)
 	
 	/* api callbacks */
 	ot->exec = uv_reveal_exec;
-	ot->poll = ED_operator_uvedit;
+	ot->poll = ED_operator_uvmap;
 }
 
 /******************** set 3d cursor operator ********************/
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 1131f7c..e99b2b5 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1250,6 +1250,9 @@ static int unwrap_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
+	/* Reveal hidden UVs since they're taken into account*/
+	ED_uvedit_reveal(em);
+
 	mat4_to_size(obsize, obedit->obmat);
 	if (!(fabsf(obsize[0] - obsize[1]) < 1e-4f && fabsf(obsize[1] - obsize[2]) < 1e-4f))
 		BKE_report(op->reports, RPT_INFO,
@@ -1369,6 +1372,9 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
+	/* Reveal hidden UVs since they're taken into account*/
+	ED_uvedit_reveal(em);
+
 	cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
 
 	if (RNA_boolean_get(op->ptr, "orthographic")) {
@@ -1471,6 +1477,9 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
 		return OPERATOR_CANCELLED;
 	}
 
+	/* Reveal hidden UVs since they're taken into account*/
+	ED_uvedit_reveal(me->edit_btmesh);
+
 	ED_mesh_uv_loop_reset(C, me);
 
 	DAG_id_tag_update(obedit->data, 0);
@@ -1557,6 +1566,9 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
+	/* Reveal hidden UVs since they're taken into account*/
+	ED_uvedit_reveal(em);
+
 	cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
 
 	uv_map_transform(C, op, center, rotmat);
@@ -1636,6 +1648,9 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
+	/* Reveal hidden UVs since they're taken into account*/
+	ED_uvedit_reveal(em);
+
 	cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
 
 	uv_map_transform(C, op, center, rotmat);
@@ -1742,6 +1757,9 @@ static int cube_project_exec(bContext *C, wmOperator *op)
 	if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
 		return OPERATOR_CANCELLED;
 	}
+	
+	/* Reveal hidden UVs since they're taken into account*/
+	ED_uvedit_reveal(em);
 
 	ED_uvedit_unwrap_cube_project(obedit, em->bm, cube_size, true);
 	uv_map_clip_correct(scene, obedit, em, op);




More information about the Bf-blender-cvs mailing list