Fix for setting uv_layer name for modifiers
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 7 Mar 2012 20:56:25 +0000 (20:56 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 7 Mar 2012 20:56:25 +0000 (20:56 +0000)
Issue was caused by missing fdata for meshes which doesn't have tessellated
faces yet. Real fix would be to use loop's MLOOPUV layer, but currently interface
is using mtex layer names for UV lists so use poly's mtex layer to check if
layer name is indeed correct.
Should work fine until we'll separate setting textures and UV coordinates.

source/blender/makesrna/intern/rna_object.c

index a1e288f61072fe8181d20bffa95b81c199540e28..088d4870143b701867298bb55e2e841d16805070 100644 (file)
@@ -558,10 +558,10 @@ void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *resul
        if (ob->type == OB_MESH && ob->data) {
                me = (Mesh*)ob->data;
 
-               for (a = 0; a<me->fdata.totlayer; a++) {
-                       layer = &me->fdata.layers[a];
+               for (a = 0; a<me->pdata.totlayer; a++) {
+                       layer = &me->pdata.layers[a];
 
-                       if (layer->type == CD_MTFACE && strcmp(layer->name, value) == 0) {
+                       if (layer->type == CD_MTEXPOLY && strcmp(layer->name, value) == 0) {
                                BLI_strncpy(result, value, maxlen);
                                return;
                        }