[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51833] trunk/blender/source/blender/ editors: Bugfix (own collection)
Ton Roosendaal
ton at blender.org
Sat Nov 3 15:31:30 CET 2012
Revision: 51833
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51833
Author: ton
Date: 2012-11-03 14:31:28 +0000 (Sat, 03 Nov 2012)
Log Message:
-----------
Bugfix (own collection)
Adding new image texture to Meshes didn't initialize UVs to 0-1 default.
This makes initial display of textures on meshes not work.
This fixes my favorite demo case: Open Blender, drop image from desktop on cube.
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/ED_mesh.h
trunk/blender/source/blender/editors/mesh/mesh_data.c
trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h 2012-11-03 10:58:28 UTC (rev 51832)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h 2012-11-03 14:31:28 UTC (rev 51833)
@@ -250,7 +250,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_uv_loop_reset_ex(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-11-03 10:58:28 UTC (rev 51832)
+++ trunk/blender/source/blender/editors/mesh/mesh_data.c 2012-11-03 14:31:28 UTC (rev 51833)
@@ -235,7 +235,8 @@
}
}
-int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int layernum)
+/* without bContext, called in uvedit */
+int ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum)
{
BMEditMesh *em = me->edit_btmesh;
MLoopUV *luv;
@@ -338,7 +339,6 @@
BLI_array_free(polylengths);
DAG_id_tag_update(&me->id, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
return 1;
}
@@ -348,7 +348,11 @@
/* 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 retval = ED_mesh_uv_loop_reset_ex(me, layernum);
+
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+
+ return retval;
}
/* note: keep in sync with ED_mesh_color_add */
@@ -419,7 +423,7 @@
/* don't overwrite our copied coords */
if (is_init == FALSE) {
- ED_mesh_uv_loop_reset_ex(C, me, layernum_dst);
+ ED_mesh_uv_loop_reset_ex(me, layernum_dst);
}
DAG_id_tag_update(&me->id, 0);
Modified: trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_ops.c 2012-11-03 10:58:28 UTC (rev 51832)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_ops.c 2012-11-03 14:31:28 UTC (rev 51833)
@@ -215,6 +215,8 @@
if (!CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) {
BM_data_layer_add(em->bm, &em->bm->pdata, CD_MTEXPOLY);
BM_data_layer_add(em->bm, &em->bm->ldata, CD_MLOOPUV);
+ /* make UVs all nice 0-1 */
+ ED_mesh_uv_loop_reset_ex(obedit->data, CustomData_get_active_layer_index(&em->bm->pdata, CD_MTEXPOLY));
update = 1;
}
More information about the Bf-blender-cvs
mailing list