[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15188] branches/apricot/source/blender/ src: fix for some errors with UV mirror when the face/ vertex connection map could not be generated.
Campbell Barton
ideasman42 at gmail.com
Tue Jun 10 12:32:36 CEST 2008
Revision: 15188
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15188
Author: campbellbarton
Date: 2008-06-10 12:32:16 +0200 (Tue, 10 Jun 2008)
Log Message:
-----------
fix for some errors with UV mirror when the face/vertex connection map could not be generated.
Modified Paths:
--------------
branches/apricot/source/blender/src/editmesh_lib.c
branches/apricot/source/blender/src/transform_conversions.c
Modified: branches/apricot/source/blender/src/editmesh_lib.c
===================================================================
--- branches/apricot/source/blender/src/editmesh_lib.c 2008-06-10 10:26:13 UTC (rev 15187)
+++ branches/apricot/source/blender/src/editmesh_lib.c 2008-06-10 10:32:16 UTC (rev 15188)
@@ -2199,18 +2199,25 @@
if(!selected || ((!efa->h) && (efa->f & SELECT)))
totuv += (efa->v4)? 4: 3;
- if(totuv==0)
+ if(totuv==0) {
+ if (do_face_idx_array)
+ EM_free_index_arrays();
return NULL;
-
+ }
vmap= (UvVertMap*)MEM_callocN(sizeof(*vmap), "UvVertMap");
- if (!vmap)
+ if (!vmap) {
+ if (do_face_idx_array)
+ EM_free_index_arrays();
return NULL;
+ }
vmap->vert= (UvMapVert**)MEM_callocN(sizeof(*vmap->vert)*totverts, "UvMapVert*");
buf= vmap->buf= (UvMapVert*)MEM_callocN(sizeof(*vmap->buf)*totuv, "UvMapVert");
if (!vmap->vert || !vmap->buf) {
free_uv_vert_map(vmap);
+ if (do_face_idx_array)
+ EM_free_index_arrays();
return NULL;
}
Modified: branches/apricot/source/blender/src/transform_conversions.c
===================================================================
--- branches/apricot/source/blender/src/transform_conversions.c 2008-06-10 10:26:13 UTC (rev 15187)
+++ branches/apricot/source/blender/src/transform_conversions.c 2008-06-10 10:32:16 UTC (rev 15188)
@@ -2234,7 +2234,8 @@
{
EditMesh *em = G.editMesh;
EditFace *efa;
-
+ MTFace *tf;
+
int change, a, i, nverts;
UvVertMap *vmap=NULL;
@@ -2249,7 +2250,22 @@
get_connected_limit_tface_uv(limit);
vmap= make_uv_vert_map_EM(1, 1, limit);
+ if (vmap==NULL) {
+ /* We expect these to be generated from this function */
+ for (efa= em->faces.first, a=0; efa; efa= efa->next, a++) {
+ tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ if (simaFaceDraw_Check(efa, tf)) {
+ efa->tmp.p = tf;
+ } else {
+ efa->tmp.p = NULL;
+ }
+ }
+ *island_index = *island_boundbox = *island_center = NULL;
+ *totisland = 0;
+ return;
+ }
+
faceIsleIndex = MEM_callocN(totface*sizeof(int), "uvisland");
for (a=0; a<totface; a++) {
@@ -2332,7 +2348,7 @@
for (efa= em->faces.first, a=0; efa; efa= efa->next, a++) {
- MTFace *tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (simaFaceDraw_Check(efa, tf)) {
efa->tmp.p = tf;
} else {
@@ -2408,12 +2424,20 @@
if (mirror || t->around==V3D_LOCAL) {
calcUVIslands(&totisland, &faceIsleIndex, &uvIsleBounds, &uvIsleCenters);
- if (uvIsleBounds) MEM_freeN(uvIsleBounds);
- uvIsleBounds = NULL;
- /* calcUVIslands sets the 'efa->tmp.p = tf' */
- uvIsleMirrSide = MEM_mallocN(totisland * sizeof(char), "mirror sides");
- memset(uvIsleMirrSide, 1, sizeof(char)*totisland);
+ if (totisland) {
+ if (uvIsleBounds) MEM_freeN(uvIsleBounds);
+ uvIsleBounds = NULL;
+
+ /* calcUVIslands sets the 'efa->tmp.p = tf' */
+ uvIsleMirrSide = MEM_mallocN(totisland * sizeof(char), "mirror sides");
+ memset(uvIsleMirrSide, 1, sizeof(char)*totisland);
+ } else {
+ if (t->around==V3D_LOCAL) {
+ t->around = V3D_CENTROID;
+ }
+ mirror = 0;
+ }
} else {
for (efa= em->faces.first, a=0; efa; efa= efa->next, a++) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -2537,7 +2561,7 @@
/* Mirror? */
/*
- if (mirror) {
+ if (totisland && (mirror || t->around==V3D_LOCAL)) {
uvMirrSide = uvIsleMirrSide[faceIsleIndex[a]];
if( (uvMirrSide>0 && td->iloc[mirr_axis] > td->center[mirr_axis]) ||
More information about the Bf-blender-cvs
mailing list