Bullet-proofing mesh vertex group RNA wrapping, after double checking

on whether vertexgroup weight animation worked
This commit is contained in:
Joshua Leung 2011-01-26 22:31:14 +00:00
parent e46895811e
commit 5270280a65

@ -961,10 +961,29 @@ static char *rna_VertexGroupElement_path(PointerRNA *ptr)
MDeformVert *dvert;
int a, b;
for(a=0, dvert=me->dvert; a<me->totvert; a++, dvert++)
for(b=0; b<dvert->totweight; b++)
/* sanity check: make sure that mesh pointer is valid */
if (me == NULL)
return NULL;
else if (GS(me->id.name) != ID_ME) {
/* if object pointer, try to resolve the object's data to mesh pointer */
if (GS(me->id.name) == ID_OB) {
Object *ob = (Object *)me;
if (ob->type == OB_MESH)
me = (Mesh *)ob->data;
else
return NULL; /* nothing can be done */
}
else
return NULL; /* nothing can be done */
}
for(a=0, dvert=me->dvert; a<me->totvert; a++, dvert++) {
for(b=0; b<dvert->totweight; b++) {
if(dw == &dvert->dw[b])
return BLI_sprintfN("vertices[%d].groups[%d]", a, b);
}
}
return NULL;
}