Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_util.c
| Context not available. | |||||
| return mesh; | return mesh; | ||||
| } | } | ||||
| static void MOD_get_dvert(struct Mesh *mesh, MDeformVert **dvert, bool with_mdef) | |||||
| { | |||||
| /* Get number of verts. */ | |||||
| const int numVerts = mesh->totvert; | |||||
| /* | |||||
| * Must have verts and therefore verts assigned to vgroups to do anything useful! | |||||
| */ | |||||
| if ((numVerts == 0)) { | |||||
| return; | |||||
| } | |||||
| const bool has_mdef = CustomData_has_layer(&mesh->vdata, CD_MDEFORMVERT); | |||||
| /* If no vertices were ever added to an object's vgroup, dvert might be NULL. */ | |||||
| if (!has_mdef) { | |||||
| /* If not affecting all vertices, just return. */ | |||||
| if (with_mdef) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| if (has_mdef) { | |||||
| *dvert = CustomData_duplicate_referenced_layer(&mesh->vdata, CD_MDEFORMVERT, numVerts); | |||||
| } | |||||
| else { | |||||
| /* Add a valid data layer! */ | |||||
| *dvert = CustomData_add_layer(&mesh->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, numVerts); | |||||
| } | |||||
| /* Ultimate security check. */ | |||||
| if (!*dvert) { | |||||
| return; | |||||
| } | |||||
| mesh->dvert = *dvert; | |||||
| } | |||||
| void MOD_get_vgroup( | void MOD_get_vgroup( | ||||
| Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index) | Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index) | ||||
| { | { | ||||
| Context not available. | |||||
| } | } | ||||
| else if (mesh) { | else if (mesh) { | ||||
| *dvert = mesh->dvert; | *dvert = mesh->dvert; | ||||
| if (!*dvert) { | |||||
| MOD_get_dvert(mesh, dvert, false); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||