diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 29 |
2 files changed, 12 insertions, 21 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index c4507e2101e..42efdcf4171 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2570,8 +2570,6 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): mesh = context.active_object.data - layout.prop(mesh, "show_weight") - split = layout.split() col = split.column() @@ -2582,6 +2580,8 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): if with_freestyle: col.prop(mesh, "show_edge_seams", text="Seams") + layout.prop(mesh, "show_weight") + col = split.column() col.label() if not with_freestyle: diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index dfd96de1e2b..e188a7b403b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1239,6 +1239,8 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag, /* editmesh draw function checks spesifically for this */ } else { + const int dm_totpoly = dm->getNumPolys(dm); + const int dm_totloop = dm->getNumLoops(dm); unsigned char(*wtcol_l)[4] = CustomData_get_layer(dm->getLoopDataLayout(dm), CD_PREVIEW_MLOOPCOL); MLoop *mloop = dm->getLoopArray(dm), *ml; MPoly *mp = dm->getPolyArray(dm); @@ -1248,28 +1250,17 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag, /* now add to loops, so the data can be passed through the modifier stack */ /* If no CD_PREVIEW_MLOOPCOL existed yet, we have to add a new one! */ if (!wtcol_l) { - BLI_array_declare(wtcol_l); - totloop = 0; - for (i = 0; i < dm->numPolyData; i++, mp++) { - ml = mloop + mp->loopstart; - - BLI_array_grow_items(wtcol_l, mp->totloop); - for (j = 0; j < mp->totloop; j++, ml++, totloop++) { - copy_v4_v4_char((char *)&wtcol_l[totloop], - (char *)&wtcol_v[ml->v]); - } - } + wtcol_l = MEM_mallocN(sizeof(*wtcol_l) * dm_totloop, __func__); CustomData_add_layer(&dm->loopData, CD_PREVIEW_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop); } - else { - totloop = 0; - for (i = 0; i < dm->numPolyData; i++, mp++) { - ml = mloop + mp->loopstart; - for (j = 0; j < mp->totloop; j++, ml++, totloop++) { - copy_v4_v4_char((char *)&wtcol_l[totloop], - (char *)&wtcol_v[ml->v]); - } + totloop = 0; + for (i = 0; i < dm_totpoly; i++, mp++) { + ml = mloop + mp->loopstart; + + for (j = 0; j < mp->totloop; j++, ml++, totloop++) { + copy_v4_v4_char((char *)&wtcol_l[totloop], + (char *)&wtcol_v[ml->v]); } } MEM_freeN(wtcol_v); |