minor edits to DM_update_weight_mcol(), skip getting vars when in editmode, also remove old/invalid comment.

This commit is contained in:
Campbell Barton 2013-04-15 08:43:17 +00:00
parent d1f90abfa9
commit f294b3b082
2 changed files with 13 additions and 15 deletions

@ -1200,12 +1200,8 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
{
BMEditMesh *em = (dm->type == DM_TYPE_EDITBMESH) ? BMEdit_FromObject(ob) : NULL;
unsigned char (*wtcol_v)[4];
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);
int numVerts = dm->getNumVerts(dm);
int totloop;
int i, j;
int i;
if (em) {
if (em->derivedVertColor && em->derivedVertColorLen == numVerts) {
@ -1248,6 +1244,12 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
/* editmesh draw function checks spesifically for this */
}
else {
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);
int totloop;
int j;
/* 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) {

@ -53,8 +53,6 @@
/* ********* add primitive operators ************* */
/* BMESH_TODO: 'state' is not a good name, should be flipped and called 'was_editmode',
* or at least something more descriptive */
static Object *make_prim_init(bContext *C, const char *idname,
float *dia, float mat[4][4],
bool *was_editmode, const float loc[3], const float rot[3], const unsigned int layer)
@ -246,12 +244,11 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
BMEditMesh *em;
float loc[3], rot[3], mat[4][4], dia;
bool enter_editmode;
int cap_end, cap_tri;
unsigned int layer;
bool was_editmode;
cap_end = RNA_enum_get(op->ptr, "end_fill_type");
cap_tri = (cap_end == 2);
const int end_fill_type = RNA_enum_get(op->ptr, "end_fill_type");
const bool cap_end = (end_fill_type != 0);
const bool cap_tri = (end_fill_type == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cylinder"), &dia, mat, &was_editmode, loc, rot, layer);
@ -308,12 +305,11 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
BMEditMesh *em;
float loc[3], rot[3], mat[4][4], dia;
bool enter_editmode;
int cap_end, cap_tri;
unsigned int layer;
bool was_editmode;
cap_end = RNA_enum_get(op->ptr, "end_fill_type");
cap_tri = (cap_end == 2);
const int end_fill_type = RNA_enum_get(op->ptr, "end_fill_type");
const bool cap_end = (end_fill_type != 0);
const bool cap_tri = (end_fill_type == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cone"), &dia, mat, &was_editmode, loc, rot, layer);