Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-24 15:02:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-24 15:02:28 +0400
commit6378606d644dc40aa33323c77a5dd1ad38bbc6af (patch)
tree40e673d8e533895d033ac441a36766a4c9b7088a /source/blender/editors/mesh/mesh_data.c
parentd7b9127e5fa2f83ba11ad483ca4438a67b1c48c1 (diff)
fix for error adding vertex colors in editmode.
also correct delete_customdata_layer having invalid 'tot' in editmode, seems harmless for now but better assign correct value.
Diffstat (limited to 'source/blender/editors/mesh/mesh_data.c')
-rw-r--r--source/blender/editors/mesh/mesh_data.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 985924c5a5e..770fd68079a 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -83,14 +83,26 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
int type= layer->type;
int index;
int i, actindex, rndindex, cloneindex, stencilindex, tot;
-
+
if (layer->type == CD_MLOOPCOL || layer->type == CD_MLOOPUV) {
- data = (me->edit_btmesh)? &me->edit_btmesh->bm->ldata: &me->ldata;
- tot = me->totloop;
+ if (me->edit_btmesh) {
+ data = &me->edit_btmesh->bm->ldata;
+ tot = me->edit_btmesh->bm->totloop;
+ }
+ else {
+ data = &me->ldata;
+ tot = me->totloop;
+ }
}
else {
- data = (me->edit_btmesh)? &me->edit_btmesh->bm->pdata: &me->pdata;
- tot = me->totpoly;
+ if (me->edit_btmesh) {
+ data = &me->edit_btmesh->bm->pdata;
+ tot = me->edit_btmesh->bm->totface;
+ }
+ else {
+ data = &me->pdata;
+ tot = me->totpoly;
+ }
}
index = CustomData_get_layer_index(data, type);
@@ -405,12 +417,12 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
return -1;
}
- BM_data_layer_add(em->bm, &em->bm->pdata, CD_MLOOPCOL);
+ BM_data_layer_add(em->bm, &em->bm->ldata, CD_MLOOPCOL);
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
/* copy data from active vertex color layer */
if (layernum) {
- copy_editface_active_customdata(em, CD_MCOL, layernum);
+ copy_editface_active_customdata(em, CD_MLOOPCOL, layernum);
}
if (active_set || layernum == 0) {