[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61227] trunk/blender/source/blender/ blenkernel/intern/mesh.c: Fix [#37394] UV Map cannot be renamed.

Bastien Montagne montagne29 at wanadoo.fr
Sun Nov 10 21:32:28 CET 2013


Revision: 61227
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61227
Author:   mont29
Date:     2013-11-10 20:32:27 +0000 (Sun, 10 Nov 2013)
Log Message:
-----------
Fix [#37394] UV Map cannot be renamed.

Own epic failure! CustomData_get_named_layer() returns a relative index, not an absolute one. :(

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/mesh.c

Modified: trunk/blender/source/blender/blenkernel/intern/mesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mesh.c	2013-11-10 20:04:47 UTC (rev 61226)
+++ trunk/blender/source/blender/blenkernel/intern/mesh.c	2013-11-10 20:32:27 UTC (rev 61227)
@@ -633,6 +633,8 @@
 	const int step = do_tessface ? 3 : 2;
 	int i;
 
+	printf("%s: %d, %d, %d\n", __func__, poly_index, loop_index, face_index);
+
 	if (me->edit_btmesh) {
 		pdata = &me->edit_btmesh->bm->pdata;
 		ldata = &me->edit_btmesh->bm->ldata;
@@ -708,26 +710,32 @@
 					return false;
 				}
 				else {
-					lidx = lidx_start + (fidx - fidx_start);
+					lidx = fidx;
 				}
 			}
-			pidx = pidx_start + (lidx - lidx_start);
+			pidx = lidx;
 		}
 		else {
 			if (lidx == -1) {
-				lidx = lidx_start + (pidx - pidx_start);
+				lidx = pidx;
 			}
 			if (fidx == -1 && do_tessface) {
-				fidx = fidx_start + (pidx - pidx_start);
+				fidx = pidx;
 			}
 		}
 #if 0
 		/* For now, we do not consider mismatch in indices (i.e. same name leading to (relative) different indices). */
-		else if ((pidx - pidx_start) != (lidx - lidx_start)) {
-			lidx = lidx_start + (pidx - pidx_start);
+		else if (pidx != lidx) {
+			lidx = pidx;
 		}
 #endif
 
+		/* Go back to absolute indices! */
+		pidx += pidx_start;
+		lidx += lidx_start;
+		if (fidx != -1)
+			fidx += fidx_start;
+
 		return BKE_mesh_uv_cdlayer_rename_index(me, pidx, lidx, fidx, new_name, do_tessface);
 	}
 }




More information about the Bf-blender-cvs mailing list