[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40628] branches/soc-2011-onion-uv-tools/ source/blender: *Now stitch redoing by altering the settings can operate based on selection during modal operation .

Antony Riakiotakis kalast at gmail.com
Tue Sep 27 20:29:19 CEST 2011


Revision: 40628
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40628
Author:   psy-fi
Date:     2011-09-27 18:29:19 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
*Now stitch redoing by altering the settings can operate based on selection during modal operation. There is danger when redoing last though because the uv topology is altered and stored indices may very well exceed the stored UvElements. Maybe a better way is to store EditFace+index combination. To be checked next.

Modified Paths:
--------------
    branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c
    branches/soc-2011-onion-uv-tools/source/blender/makesrna/intern/rna_scene.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	2011-09-27 17:47:41 UTC (rev 40627)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c	2011-09-27 18:29:19 UTC (rev 40628)
@@ -2565,6 +2565,17 @@
 	stitch_state->selection_size = 0;
 
 	/* Fill selection stack */
+	if(RNA_property_is_set(op->ptr, "selection")){
+		int uniqueIndex;
+		RNA_BEGIN(op->ptr, itemptr, "selection") {
+			uniqueIndex = stitch_state->map[RNA_int_get(&itemptr, "index")];
+			if(!(stitch_state->uvs[uniqueIndex]->flag & STITCH_SELECTED)){
+				stitch_state->selection_stack[stitch_state->selection_size++] = stitch_state->uvs[uniqueIndex];
+				stitch_state->uvs[uniqueIndex]->flag |= STITCH_SELECTED;
+			}
+		}
+		RNA_END;
+	} else {
 	for(efa = stitch_state->em->faces.first ; efa; efa = efa->next){
 		int numOfVerts;
 		MTFace *mt;
@@ -2584,6 +2595,7 @@
 			}
 		}
 	}
+	}
 
 	if(!stitch_process_data(stitch_state, scene, 0, 1)){
 		stitch_state_delete(stitch_state);
@@ -2622,11 +2634,19 @@
 	stitch_state = (StitchState *)op->customdata;
 
 	if(finished){
+		int i;
+
 		RNA_float_set(op->ptr, "limit", stitch_state->limitDist);
 		RNA_boolean_set(op->ptr, "use_limit", stitch_state->use_limit);
 		RNA_boolean_set(op->ptr, "snap_islands", stitch_state->snapIslands);
 		RNA_int_set(op->ptr, "static_island", stitch_state->static_island);
 		RNA_enum_set(op->ptr, "mode", stitch_state->mode);
+		/* Store selection for re-execution of stitch */
+		for(i = 0; i < stitch_state->selection_size; i++){
+			PointerRNA itemptr;
+			RNA_collection_add(op->ptr, "selection", &itemptr);
+			RNA_int_set(&itemptr, "index", (UvElement *)stitch_state->selection_stack[i] - stitch_state->elementMap->buf);
+		}
 
 		uvedit_live_unwrap_update(sima, scene, obedit);
 	}
@@ -2956,6 +2976,7 @@
 	RNA_def_enum(ot->srna, "mode", mode, VERT_STITCH, "Mode", "Vertex or edge stitching mode. In Edge stitching, both uv's must be stitchable to stitch");
 	RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, FLT_MAX, "Limit", "Limit distance in normalized coordinates", 0.0, FLT_MAX);
 	RNA_def_int(ot->srna, "static_island", 0, 0, INT_MAX, "Static Island",  "Island that stays in place when stitching islands", 0, INT_MAX);
+	RNA_def_collection_runtime(ot->srna, "selection", &RNA_SelectedUvElement, "Selection", "");
 }
 
 /* ******************** (de)select all operator **************** */

Modified: branches/soc-2011-onion-uv-tools/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/makesrna/intern/rna_scene.c	2011-09-27 17:47:41 UTC (rev 40627)
+++ branches/soc-2011-onion-uv-tools/source/blender/makesrna/intern/rna_scene.c	2011-09-27 18:29:19 UTC (rev 40628)
@@ -3809,6 +3809,7 @@
 	rna_def_scene_game_data(brna);
 	rna_def_scene_render_layer(brna);
 	rna_def_transform_orientation(brna);
+	rna_def_selected_uv_element(brna);
 	
 	/* Scene API */
 	RNA_api_scene(srna);




More information about the Bf-blender-cvs mailing list