[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47225] branches/soc-2012-bratwurst/source /blender/editors/transform: UV transform correction tool

Antony Riakiotakis kalast at gmail.com
Wed May 30 16:24:33 CEST 2012


Revision: 47225
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47225
Author:   psy-fi
Date:     2012-05-30 14:24:33 +0000 (Wed, 30 May 2012)
Log Message:
-----------
UV transform correction tool
============================
*Fixed crashers due to wrong indices (been there, done that) and enabled
tool.
*Uvs get modified but result is wrong. Investigating.

Modified Paths:
--------------
    branches/soc-2012-bratwurst/source/blender/editors/transform/transform.c
    branches/soc-2012-bratwurst/source/blender/editors/transform/transform_conversions.c
    branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c

Modified: branches/soc-2012-bratwurst/source/blender/editors/transform/transform.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/transform/transform.c	2012-05-30 13:46:44 UTC (rev 47224)
+++ branches/soc-2012-bratwurst/source/blender/editors/transform/transform.c	2012-05-30 14:24:33 UTC (rev 47225)
@@ -1821,7 +1821,7 @@
 	if(t->flag & T_IMAGE_PRESERVE_CALC) {
 		/* can be invalidated if for instance we change the radius of proportional editing */
 		//if(!t->uvtc->init)
-			//calculateUVTransformCorrection(t);
+			calculateUVTransformCorrection(t);
 	}
 
 	/* If auto confirm is on, break after one pass */

Modified: branches/soc-2012-bratwurst/source/blender/editors/transform/transform_conversions.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/transform/transform_conversions.c	2012-05-30 13:46:44 UTC (rev 47224)
+++ branches/soc-2012-bratwurst/source/blender/editors/transform/transform_conversions.c	2012-05-30 14:24:33 UTC (rev 47225)
@@ -2046,17 +2046,12 @@
 
 	/* now we need to allocate store for affected verts if we do maintain image */
 	if(t->flag & T_IMAGE_PRESERVE_CALC) {
-		int duck;
 		uvtc = t->uvtc = MEM_callocN(sizeof(*t->uvtc), "UVTransformCorrect");
 		uvtc->affected_verts = affected_verts = MEM_mallocN(t->total * sizeof(*t->uvtc->affected_verts), "uvtc_verts");
 		uvtc->initial_uvs = initial_uvs = MEM_mallocN(bm->totvert * sizeof(*t->uvtc->initial_uvs), "uvtc_inituvs");
 		uvtc->vert_indices = MEM_mallocN(bm->totvert * sizeof(*t->uvtc->vert_indices), "uvtc_indices");
 		uvtc->total_verts = bm->totvert;
-		duck = bm->totvert * sizeof(*t->uvtc->initial_uvs);
 		BM_mesh_elem_index_ensure(bm, BM_VERT);
-
-		if(!uvtc->initial_uvs || !uvtc->vert_indices)
-			printf("skata sta moutra sou");
 	}
 
 	tob= t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Mesh EditMode)");

Modified: branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c	2012-05-30 13:46:44 UTC (rev 47224)
+++ branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c	2012-05-30 14:24:33 UTC (rev 47225)
@@ -1687,10 +1687,10 @@
 				if(index_other == -1) {
 					/* get BMvert coords since the vertex hasn't changed */
 					sub_v3_v3v3(edge_vec_init, l_other->v->co, td[i].iloc);
-					sub_v2_v2v2(edge_uv_init, luv_other->uv, uvtc->initial_uvs[index]->init_uv);
+					sub_v2_v2v2(edge_uv_init, luv_other->uv, uvtc->initial_uvs[BM_elem_index_get(v)]->init_uv);
 				} else {
 					sub_v3_v3v3(edge_vec_init, td[index_other].iloc, td[i].iloc);
-					sub_v2_v2v2(edge_uv_init, uvtc->initial_uvs[index_other]->init_uv, uvtc->initial_uvs[index]->init_uv);
+					sub_v2_v2v2(edge_uv_init, uvtc->initial_uvs[BM_elem_index_get(l_other->v)]->init_uv, uvtc->initial_uvs[BM_elem_index_get(v)]->init_uv);
 				}
 				sub_v3_v3v3(edge_vec_final, l_other->v->co, v->co);
 
@@ -1708,7 +1708,7 @@
 
 			}
 			mul_v2_fl(uv_tot, 1.0/uv_counter);
-			copy_v2_v2(uvtc->initial_uvs[index]->uv, uv_tot);
+			copy_v2_v2(uvtc->initial_uvs[BM_elem_index_get(v)]->uv, uv_tot);
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list