[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43161] branches/soc-2011-onion-uv-tools/ source/blender/editors: Modified mark seams to not only work on uv synch select mode and only act on selection , not hover.

Antony Riakiotakis kalast at gmail.com
Thu Jan 5 12:17:02 CET 2012


Revision: 43161
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43161
Author:   psy-fi
Date:     2012-01-05 11:17:00 +0000 (Thu, 05 Jan 2012)
Log Message:
-----------
Modified mark seams to not only work on uv synch select mode and only act on selection, not hover. Kept Ctrl+Y as shortcut as opposed to just Y to avoid the user to easily cause seams accidentally.

Modified Paths:
--------------
    branches/soc-2011-onion-uv-tools/source/blender/editors/screen/screen_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/screen/screen_ops.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/screen/screen_ops.c	2012-01-05 11:02:27 UTC (rev 43160)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/screen/screen_ops.c	2012-01-05 11:17:00 UTC (rev 43161)
@@ -404,14 +404,6 @@
 	return 0;
 }
 
-int	ED_operator_uv_seam_tag_check_active(struct bContext *C)
-{
-	Scene *scene = CTX_data_scene(C);
-	return ed_spacetype_test(C, SPACE_IMAGE) && (scene->toolsettings->uv_flag & UV_SYNC_SELECTION);
-}
-
-
-
 int ED_operator_editsurfcurve(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);

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-05 11:02:27 UTC (rev 43160)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c	2012-01-05 11:17:00 UTC (rev 43161)
@@ -3242,44 +3242,22 @@
 	ot->poll= ED_operator_uvedit;
 }
 
-
-static int mark_seam_uv_intern(bContext *C, wmOperator *op, wmEvent *event){
+static int mark_seam_uv_exec(bContext *C, wmOperator *op)
+{
+	EditFace *efa;
 	Object *ob = CTX_data_edit_object(C);
 	Scene *scene = CTX_data_scene(C);
 	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)ob->data);
 
-	char selection = RNA_boolean_get(op->ptr, "selection");
-
-	if(selection){
-		EditFace *efa;
-
-		for(efa = em->faces.first; efa; efa = efa->next){
-			MTFace *mt = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			int nverts = efa->v4? 4 : 3;
-			int i;
-			for(i = 0; i < nverts; i++){
-				if(uvedit_edge_selected(scene, efa, mt, i)){
-					(*(&efa->e1 + i))->seam = 1;
-				}
+	for(efa = em->faces.first; efa; efa = efa->next){
+		MTFace *mt = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+		int nverts = efa->v4? 4 : 3;
+		int i;
+		for(i = 0; i < nverts; i++){
+			if(uvedit_edge_selected(scene, efa, mt, i)){
+				(*(&efa->e1 + i))->seam = 1;
 			}
 		}
-	}else{
-		float co[2];
-		NearestHit hit;
-		Image *ima= CTX_data_edit_image(C);
-
-		if(event){
-			ARegion *ar= CTX_wm_region(C);
-
-			UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
-			RNA_float_set_array(op->ptr, "location", co);
-		}else{
-			RNA_float_get_array(op->ptr, "location", co);
-		}
-		find_nearest_uv_edge(scene, ima, em, co, &hit);
-		if(hit.efa){
-			(*(&hit.efa->e1 + hit.edge))->seam = 1;
-		}
 	}
 
 	if((scene->toolsettings->edge_mode_live_unwrap) && (CustomData_has_layer(&em->fdata, CD_MTFACE))){
@@ -3294,17 +3272,6 @@
 	return OPERATOR_FINISHED;
 }
 
-static int mark_seam_uv_exec(bContext *C, wmOperator *op)
-{
-	return mark_seam_uv_intern(C, op, NULL);
-}
-
-static int mark_seam_uv_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-	return mark_seam_uv_intern(C, op, event);
-}
-
-
 static void UV_OT_mark_seam_uv(wmOperatorType *ot)
 {
 	/* identifiers */
@@ -3316,13 +3283,8 @@
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* api callbacks */
-	ot->invoke= mark_seam_uv_invoke;
 	ot->exec= mark_seam_uv_exec;
-	ot->poll= ED_operator_uv_seam_tag_check_active;
-
-	RNA_def_boolean(ot->srna, "selection", 0, "Selection", "Mark edge seams for selection");
-	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
-		"Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f);
+	ot->poll= ED_operator_uvedit;
 }
 
 /* ************************** registration **********************************/
@@ -3375,8 +3337,7 @@
 	keymap->poll= ED_operator_uvedit_can_uv_sculpt;
 
 	/* 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);
+	WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", YKEY, KM_PRESS, KM_CTRL, 0);
 	
 	/* pick selection */
 	WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);



More information about the Bf-blender-cvs mailing list