fix [#26682] Accessing weight sometimes crashes blender
also replace object type check from vgroup_edit_lattice() with an assert since all callers check for lattice type.
This commit is contained in:
@@ -1031,13 +1031,8 @@ void lattice_calc_modifiers(Scene *scene, Object *ob)
|
||||
|
||||
struct MDeformVert* lattice_get_deform_verts(struct Object *oblatt)
|
||||
{
|
||||
if(oblatt->type == OB_LATTICE)
|
||||
{
|
||||
Lattice *lt = (Lattice*)oblatt->data;
|
||||
if(lt->editlatt) lt= lt->editlatt->latt;
|
||||
return lt->dvert;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
Lattice *lt = (Lattice*)oblatt->data;
|
||||
BLI_assert(oblatt->type == OB_LATTICE);
|
||||
if(lt->editlatt) lt= lt->editlatt->latt;
|
||||
return lt->dvert;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,12 +80,9 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg);
|
||||
|
||||
static Lattice *vgroup_edit_lattice(Object *ob)
|
||||
{
|
||||
if(ob->type==OB_LATTICE) {
|
||||
Lattice *lt= ob->data;
|
||||
return (lt->editlatt)? lt->editlatt->latt: lt;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
Lattice *lt= ob->data;
|
||||
BLI_assert(ob->type==OB_LATTICE);
|
||||
return (lt->editlatt)? lt->editlatt->latt: lt;
|
||||
}
|
||||
|
||||
int ED_vgroup_object_is_edit_mode(Object *ob)
|
||||
@@ -511,7 +508,7 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
|
||||
|
||||
static float get_vert_def_nr(Object *ob, int def_nr, int vertnum)
|
||||
{
|
||||
MDeformVert *dvert= NULL;
|
||||
MDeformVert *dvert;
|
||||
EditVert *eve;
|
||||
Mesh *me;
|
||||
int i;
|
||||
@@ -526,14 +523,22 @@ static float get_vert_def_nr(Object *ob, int def_nr, int vertnum)
|
||||
dvert= CustomData_em_get(&me->edit_mesh->vdata, eve->data, CD_MDEFORMVERT);
|
||||
vertnum= 0;
|
||||
}
|
||||
else
|
||||
else {
|
||||
if(vertnum >= me->totvert) {
|
||||
return 0.0f;
|
||||
}
|
||||
dvert = me->dvert;
|
||||
}
|
||||
}
|
||||
else if(ob->type==OB_LATTICE) {
|
||||
Lattice *lt= vgroup_edit_lattice(ob);
|
||||
|
||||
if(lt->dvert)
|
||||
|
||||
if(lt->dvert) {
|
||||
if(vertnum >= lt->pntsu*lt->pntsv*lt->pntsw) {
|
||||
return 0.0f;
|
||||
}
|
||||
dvert = lt->dvert;
|
||||
}
|
||||
}
|
||||
|
||||
if(dvert==NULL)
|
||||
|
||||
Reference in New Issue
Block a user