[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45151] trunk/blender: fix [#30657] New UV layers created with Mesh.uv_textures.new reset previous ones.
Campbell Barton
ideasman42 at gmail.com
Mon Mar 26 04:39:11 CEST 2012
Revision: 45151
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45151
Author: campbellbarton
Date: 2012-03-26 02:39:05 +0000 (Mon, 26 Mar 2012)
Log Message:
-----------
fix [#30657] New UV layers created with Mesh.uv_textures.new reset previous ones.
adding UV's from python was resetting the active UV layer but not setting the new layer to active, resetting existing UV's.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/rna_xml.py
trunk/blender/source/blender/editors/include/ED_mesh.h
trunk/blender/source/blender/editors/mesh/mesh_data.c
Modified: trunk/blender/release/scripts/modules/rna_xml.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_xml.py 2012-03-26 00:42:21 UTC (rev 45150)
+++ trunk/blender/release/scripts/modules/rna_xml.py 2012-03-26 02:39:05 UTC (rev 45151)
@@ -346,7 +346,7 @@
value = _get_context_val(context, rna_path)
if value is not Ellipsis and value is not None:
- print(" loading XML: %r" % rna_path)
+ print(" loading XML: %r -> %r" % (filepath, rna_path))
xml2rna(xml_node, root_rna=value)
Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h 2012-03-26 00:42:21 UTC (rev 45150)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h 2012-03-26 02:39:05 UTC (rev 45151)
@@ -287,6 +287,7 @@
int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set);
int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me);
+int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int layernum);
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
int ED_mesh_color_remove_named(struct bContext *C, struct Object *ob, struct Mesh *me, const char *name);
Modified: trunk/blender/source/blender/editors/mesh/mesh_data.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_data.c 2012-03-26 00:42:21 UTC (rev 45150)
+++ trunk/blender/source/blender/editors/mesh/mesh_data.c 2012-03-26 02:39:05 UTC (rev 45151)
@@ -206,7 +206,7 @@
#endif
}
-int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
+int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int layernum)
{
BMEditMesh *em= me->edit_btmesh;
MLoopUV *luv;
@@ -232,7 +232,7 @@
i = 0;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
- luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+ luv = CustomData_bmesh_get_n(&em->bm->ldata, l->head.data, CD_MLOOPUV, layernum);
BLI_array_append(uvs, luv->uv);
i++;
}
@@ -244,14 +244,16 @@
/* Collect Mesh UVs */
MPoly *mp;
+ MLoopUV *mloouv;
BLI_assert(CustomData_has_layer(&me->ldata, CD_MLOOPUV));
+ mloouv = CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, layernum);
for (j = 0; j < me->totpoly; j++) {
mp = &me->mpoly[j];
for (i = 0; i < mp->totloop; i++) {
- luv = &me->mloopuv[mp->loopstart + i];
+ luv = &mloouv[mp->loopstart + i];
BLI_array_append(uvs, luv->uv);
}
@@ -303,8 +305,6 @@
fuvs += len;
}
- /* BMESH_TODO: Copy poly UVs onto CD_MTFACE layer for tessellated faces */
-
BLI_array_free(uvs);
BLI_array_free(polylengths);
@@ -314,6 +314,14 @@
return 1;
}
+int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
+{
+ /* could be ldata or pdata */
+ CustomData *pdata = GET_CD_DATA(me, pdata);
+ const int layernum = CustomData_get_active_layer_index(pdata, CD_MTEXPOLY);
+ return ED_mesh_uv_loop_reset_ex(C, me, layernum);
+}
+
int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set)
{
BMEditMesh *em;
@@ -372,7 +380,7 @@
mesh_update_customdata_pointers(me, TRUE);
}
- ED_mesh_uv_loop_reset(C, me);
+ ED_mesh_uv_loop_reset_ex(C, me, layernum);
DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
More information about the Bf-blender-cvs
mailing list