From 3198ff876b835fd9f933b670cb4e6377b1f860b1 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 29 Sep 2009 02:19:27 +0000 Subject: Bugfix #19490: Adding UV texture, adds Vertex color instead Seems to have been a copy+paste error (code for Vertex Color adding was pasted in place of texture paint). Restored the code from an earlier revision (from another file). --- source/blender/editors/mesh/mesh_data.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 4d2e5d357f1..43e1dd417a6 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -159,36 +159,30 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me) { EditMesh *em; - MCol *mcol; int layernum; if(me->edit_mesh) { em= me->edit_mesh; - layernum= CustomData_number_of_layers(&em->fdata, CD_MCOL); - if(layernum >= MAX_MCOL) - return 0; + layernum= CustomData_number_of_layers(&em->fdata, CD_MTFACE); + if(layernum >= MAX_MTFACE) + return OPERATOR_CANCELLED; - EM_add_data_layer(em, &em->fdata, CD_MCOL); - CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum); + EM_add_data_layer(em, &em->fdata, CD_MTFACE); + CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum); } else { - layernum= CustomData_number_of_layers(&me->fdata, CD_MCOL); - if(layernum >= MAX_MCOL) - return 0; + layernum= CustomData_number_of_layers(&me->fdata, CD_MTFACE); + if(layernum >= MAX_MTFACE) + return OPERATOR_CANCELLED; - mcol= me->mcol; - - if(me->mcol) - CustomData_add_layer(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface); + if(me->mtface) + CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface); else - CustomData_add_layer(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface); + CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface); - CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum); + CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum); mesh_update_customdata_pointers(me); - - if(!mcol && ob) - shadeMeshMCol(scene, ob, me); } DAG_id_flush_update(&me->id, OB_RECALC_DATA); -- cgit v1.2.3