Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/crazyspace.c
| Show First 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | |||||
| int BKE_crazyspace_get_first_deform_matrices_editbmesh(struct Depsgraph *depsgraph, | int BKE_crazyspace_get_first_deform_matrices_editbmesh(struct Depsgraph *depsgraph, | ||||
| Scene *scene, | Scene *scene, | ||||
| Object *ob, | Object *ob, | ||||
| BMEditMesh *em, | BMEditMesh *em, | ||||
| float (**deformmats)[3][3], | float (**deformmats)[3][3], | ||||
| float (**deformcos)[3]) | float (**deformcos)[3]) | ||||
| { | { | ||||
| ModifierData *md; | ModifierData *md; | ||||
| Mesh *me; | Mesh *me_input = ob->data; | ||||
| Mesh *me = NULL; | |||||
| int i, a, numleft = 0, numVerts = 0; | int i, a, numleft = 0, numVerts = 0; | ||||
| int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1); | int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1); | ||||
| float(*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL; | float(*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL; | ||||
| VirtualModifierData virtualModifierData; | VirtualModifierData virtualModifierData; | ||||
| ModifierEvalContext mectx = {depsgraph, ob, 0}; | ModifierEvalContext mectx = {depsgraph, ob, 0}; | ||||
| modifiers_clearErrors(ob); | modifiers_clearErrors(ob); | ||||
| me = NULL; | |||||
| md = modifiers_getVirtualModifierList(ob, &virtualModifierData); | md = modifiers_getVirtualModifierList(ob, &virtualModifierData); | ||||
| /* compute the deformation matrices and coordinates for the first | /* compute the deformation matrices and coordinates for the first | ||||
| * modifiers with on cage editing that are enabled and support computing | * modifiers with on cage editing that are enabled and support computing | ||||
| * deform matrices */ | * deform matrices */ | ||||
| for (i = 0; md && i <= cageIndex; i++, md = md->next) { | for (i = 0; md && i <= cageIndex; i++, md = md->next) { | ||||
| const ModifierTypeInfo *mti = modifierType_getInfo(md->type); | const ModifierTypeInfo *mti = modifierType_getInfo(md->type); | ||||
| if (!editbmesh_modifier_is_enabled(scene, md, me != NULL)) { | if (!editbmesh_modifier_is_enabled(scene, md, me != NULL)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (mti->type == eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { | if (mti->type == eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { | ||||
| if (!defmats) { | if (!defmats) { | ||||
| const int required_mode = eModifierMode_Realtime | eModifierMode_Editmode; | const int required_mode = eModifierMode_Realtime | eModifierMode_Editmode; | ||||
| CustomData_MeshMasks data_mask = CD_MASK_BAREMESH; | CustomData_MeshMasks data_mask = CD_MASK_BAREMESH; | ||||
| CDMaskLink *datamasks = modifiers_calcDataMasks( | CDMaskLink *datamasks = modifiers_calcDataMasks( | ||||
| scene, ob, md, &data_mask, required_mode, NULL, NULL); | scene, ob, md, &data_mask, required_mode, NULL, NULL); | ||||
| data_mask = datamasks->mask; | data_mask = datamasks->mask; | ||||
| BLI_linklist_free((LinkNode *)datamasks, NULL); | BLI_linklist_free((LinkNode *)datamasks, NULL); | ||||
| me = BKE_mesh_from_editmesh_with_coords_thin_wrap(em, &data_mask, NULL); | me = BKE_mesh_from_editmesh_with_coords_thin_wrap(em, &data_mask, NULL, me_input); | ||||
| deformedVerts = editbmesh_vert_coords_alloc(em, &numVerts); | deformedVerts = editbmesh_vert_coords_alloc(em, &numVerts); | ||||
| defmats = MEM_mallocN(sizeof(*defmats) * numVerts, "defmats"); | defmats = MEM_mallocN(sizeof(*defmats) * numVerts, "defmats"); | ||||
| for (a = 0; a < numVerts; a++) { | for (a = 0; a < numVerts; a++) { | ||||
| unit_m3(defmats[a]); | unit_m3(defmats[a]); | ||||
| } | } | ||||
| } | } | ||||
| mti->deformMatricesEM(md, &mectx, em, me, deformedVerts, defmats, numVerts); | mti->deformMatricesEM(md, &mectx, em, me, deformedVerts, defmats, numVerts); | ||||
| ▲ Show 20 Lines • Show All 192 Lines • Show Last 20 Lines | |||||