[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40273] branches/soc-2011-onion-uv-tools/ source/blender/editors/uvedit/uvedit_ops.c: Cleanup: remove scene from stitch_process_data since no selection data on MTFaces is checked anymore .
Antony Riakiotakis
kalast at gmail.com
Fri Sep 16 21:51:58 CEST 2011
Revision: 40273
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40273
Author: psy-fi
Date: 2011-09-16 19:51:58 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
Cleanup: remove scene from stitch_process_data since no selection data on MTFaces is checked anymore. A few comments.
Modified Paths:
--------------
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.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-16 19:21:25 UTC (rev 40272)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c 2011-09-16 19:51:58 UTC (rev 40273)
@@ -2249,7 +2249,7 @@
}
/* Main processing function. It calculates preview and final positions. */
-static int stitch_process_data(StitchState *state, int final, Scene *scene, int doIndexInit)
+static int stitch_process_data(StitchState *state, int final, int doIndexInit)
{
int i;
StitchPreviewer *preview = uv_get_stitch_previewer();
@@ -2262,7 +2262,7 @@
stitch_preview_delete();
preview = stitch_preview_init();
if(preview == NULL)
- return OPERATOR_CANCELLED;
+ return 0;
preview->enabled = preview_enabled;
preview->mode = VERT_STITCH;
/* each face holds its position in the preview buffer in tmp. -1 is uninitialized */
@@ -2272,6 +2272,9 @@
if(state->snapIslands){
island_stitch_data = MEM_callocN(sizeof(*island_stitch_data)*state->elementMap->totalIslands, "stitch_island_data");
+ if(!island_stitch_data){
+ return 0;
+ }
}
/* Store Indices to editVerts. This is not always needed according to current code so using a flag.
@@ -2297,10 +2300,9 @@
}
}
- /*********************************************************
- * And final display, here we either update the preview *
- * or flush the result to the MTFace structures *
- *********************************************************/
+ /*********************************************************************
+ * Setup the preview buffers and fill them with the appropriate data *
+ *********************************************************************/
if(!final){
int stitchBufferIndex = 0, unstitchBufferIndex = 0;
/* Initialize the preview buffers */
@@ -2387,9 +2389,10 @@
uv_sum[0] /= count;
uv_sum[1] /= count;
- /* Second pass, delegate changes to stitchable uvs */
+ /* Second pass, propagate changes to stitchable uvs */
element_iter = state->elementMap->vert[(*(&element->face->v1 + element->tfindex))->tmp.l];
for(;element_iter; element_iter = element_iter->next){
+ /* determine if uv stitchable */
if(element_iter->separate){
if(element_iter->flag & STITCH_STITCHABLE){
stitchable = 1;
@@ -2397,9 +2400,10 @@
stitchable = 0;
}
}
-
+ /* propagate to coincident uvs */
if(stitchable){
efa = element_iter->face;
+ /* Either flush to preview or to the MTFace, if final */
if(final){
MTFace *mt;
mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
@@ -2519,7 +2523,7 @@
}
}
- stitch_process_data(stitch_state, 0, scene, 1);
+ stitch_process_data(stitch_state, 0, 1);
stitch_update_header(stitch_state, C);
return 1;
@@ -2574,12 +2578,10 @@
static int stitch_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
-
int returnValue;
if(!stitch_init(C, op))
return OPERATOR_CANCELLED;
- returnValue = stitch_process_data((StitchState *)op->customdata, 1, scene, 1);
+ returnValue = stitch_process_data((StitchState *)op->customdata, 1, 1);
stitch_exit(C, op);
return returnValue;
}
@@ -2589,7 +2591,6 @@
StitchState *stitch_state;
Object *obedit;
StitchPreviewer *preview;
- Scene *scene = CTX_data_scene(C);
obedit= CTX_data_edit_object(C);
preview = uv_get_stitch_previewer();
@@ -2609,7 +2610,7 @@
case PADENTER:
case RETKEY:{
int returnValue;
- returnValue = stitch_process_data(stitch_state, 1, scene, 1);
+ returnValue = stitch_process_data(stitch_state, 1, 1);
stitch_exit(C, op);
if(returnValue){
return OPERATOR_FINISHED;
@@ -2623,7 +2624,7 @@
case WHEELUPMOUSE:
if(event->ctrl){
stitch_state->limitDist += 0.01;
- stitch_process_data(stitch_state, 0, scene, 1);
+ stitch_process_data(stitch_state, 0, 1);
break;
}
else{
@@ -2635,7 +2636,7 @@
if(event->ctrl){
stitch_state->limitDist -= 0.01;
stitch_state->limitDist = MAX2(0.01, stitch_state->limitDist);
- stitch_process_data(stitch_state, 0, scene, 1);
+ stitch_process_data(stitch_state, 0, 1);
break;
}else{
return OPERATOR_PASS_THROUGH;
@@ -2645,7 +2646,7 @@
case LKEY:
if(event->val == KM_PRESS){
stitch_state->use_limit = !stitch_state->use_limit;
- stitch_process_data(stitch_state, 0, scene, 1);
+ stitch_process_data(stitch_state, 0, 1);
break;
}
return OPERATOR_RUNNING_MODAL;
@@ -2658,7 +2659,7 @@
else
stitch_state->mode = EDGE_STITCH;
- stitch_process_data(stitch_state, 0, scene, 1);
+ stitch_process_data(stitch_state, 0, 1);
break;
}
return OPERATOR_RUNNING_MODAL;
@@ -2795,7 +2796,7 @@
}
}
}
- stitch_process_data(stitch_state, 0, scene, 0);
+ stitch_process_data(stitch_state, 0, 0);
break;
}
return OPERATOR_RUNNING_MODAL;
@@ -2813,7 +2814,7 @@
case SKEY:
if(event->val == KM_PRESS){
stitch_state->snapIslands = !stitch_state->snapIslands;
- stitch_process_data(stitch_state, 0, scene, 1);
+ stitch_process_data(stitch_state, 0, 1);
break;
} else
return OPERATOR_RUNNING_MODAL;
More information about the Bf-blender-cvs
mailing list