remove re-allocations while building weight paint color array, move button to show weightpaint below other overlay buttons in the 'Mesh Display' panel.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user