diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-15 09:40:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-15 09:40:33 +0400 |
commit | b40386a3e304f6e649bbe93194e1b7b999931688 (patch) | |
tree | f37b7e1b6b143a7fef7787a5fe17877847f0f262 /source/blender/editors/mesh/mesh_data.c | |
parent | 7081abf51f071877c5015c830af64bcfaa1becc7 (diff) |
fixes for vertex color (found when brining X3D import back)
- tessface vertex color had the wrong sized array passing to rna_iterator_array_begin
- re-calculating tessface's would clear them if they were already created (own mistake)
- ED_mesh_color_add initialized tessface vertex colors from the loop color array
also made rna's mesh.tessface_vertex_colors.new() work like tessface_uv_textures.new()
where layers can be added as long as polygons are not present.
Diffstat (limited to 'source/blender/editors/mesh/mesh_data.c')
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 428406ee3ee..bb000b2f8f5 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -421,7 +421,7 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes if(me->mloopcol) { CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name); - CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mloopcol, me->totface, name); + CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface, name); } else { CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name); @@ -757,12 +757,13 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface) { int *polyindex = NULL; float (*face_nors)[3]; + int tessface_input = FALSE; if(mesh->totface > 0 && mesh->totpoly == 0) { convert_mfaces_to_mpolys(mesh); /* would only be converting back again, dont bother */ - calc_tessface = FALSE; + tessface_input = TRUE; /* it also happens that converting the faces calculates edges, skip this */ calc_edges = FALSE; @@ -772,7 +773,9 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface) BKE_mesh_calc_edges(mesh, calc_edges); if (calc_tessface) { - BKE_mesh_tessface_calc(mesh); + if (tessface_input == FALSE) { + BKE_mesh_tessface_calc(mesh); + } } else { /* default state is not to have tessface's so make sure this is the case */ |