Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_meshdeform.c
| Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | static void copyData(const ModifierData *md, ModifierData *target, const int flag) | ||||
| if (mmd->bindcagecos) tmmd->bindcagecos = MEM_dupallocN(mmd->bindcagecos); | if (mmd->bindcagecos) tmmd->bindcagecos = MEM_dupallocN(mmd->bindcagecos); | ||||
| if (mmd->dyngrid) tmmd->dyngrid = MEM_dupallocN(mmd->dyngrid); | if (mmd->dyngrid) tmmd->dyngrid = MEM_dupallocN(mmd->dyngrid); | ||||
| if (mmd->dyninfluences) tmmd->dyninfluences = MEM_dupallocN(mmd->dyninfluences); | if (mmd->dyninfluences) tmmd->dyninfluences = MEM_dupallocN(mmd->dyninfluences); | ||||
| if (mmd->dynverts) tmmd->dynverts = MEM_dupallocN(mmd->dynverts); | if (mmd->dynverts) tmmd->dynverts = MEM_dupallocN(mmd->dynverts); | ||||
| if (mmd->bindweights) tmmd->bindweights = MEM_dupallocN(mmd->bindweights); /* deprecated */ | if (mmd->bindweights) tmmd->bindweights = MEM_dupallocN(mmd->bindweights); /* deprecated */ | ||||
| if (mmd->bindcos) tmmd->bindcos = MEM_dupallocN(mmd->bindcos); /* deprecated */ | if (mmd->bindcos) tmmd->bindcos = MEM_dupallocN(mmd->bindcos); /* deprecated */ | ||||
| } | } | ||||
| static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) | static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks) | ||||
| { | { | ||||
| MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; | MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; | ||||
| CustomDataMask dataMask = 0; | |||||
| /* ask for vertexgroups if we need them */ | /* ask for vertexgroups if we need them */ | ||||
| if (mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; | if (mmd->defgrp_name[0] != '\0') { | ||||
| r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT; | |||||
| return dataMask; | } | ||||
| } | } | ||||
| static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams)) | static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams)) | ||||
| { | { | ||||
| MeshDeformModifierData *mmd = (MeshDeformModifierData *) md; | MeshDeformModifierData *mmd = (MeshDeformModifierData *) md; | ||||
| return !mmd->object; | return !mmd->object; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | static void meshdeformModifier_do( | ||||
| * We'll support this case once granular dependency graph is landed. | * We'll support this case once granular dependency graph is landed. | ||||
| */ | */ | ||||
| Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, mmd->object); | Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, mmd->object); | ||||
| cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false); | cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false); | ||||
| #if 0 /* This shall not be needed if we always get evaluated target object... */ | #if 0 /* This shall not be needed if we always get evaluated target object... */ | ||||
| if (cagemesh == NULL && mmd->bindcagecos == NULL && ob == DEG_get_original_object(ob)) { | if (cagemesh == NULL && mmd->bindcagecos == NULL && ob == DEG_get_original_object(ob)) { | ||||
| /* Special case, binding happens outside of depsgraph evaluation, so we can build our own | /* Special case, binding happens outside of depsgraph evaluation, so we can build our own | ||||
| * target mesh if needed. */ | * target mesh if needed. */ | ||||
| cagemesh = mesh_create_eval_final_view(ctx->depsgraph, DEG_get_input_scene(ctx->depsgraph), mmd->object, 0); | cagemesh = mesh_create_eval_final_view(ctx->depsgraph, DEG_get_input_scene(ctx->depsgraph), mmd->object, &CD_MASK_BAREMESH); | ||||
| free_cagemesh = cagemesh != NULL; | free_cagemesh = cagemesh != NULL; | ||||
| } | } | ||||
| #endif | #endif | ||||
| if (cagemesh == NULL) { | if (cagemesh == NULL) { | ||||
| modifier_setError(md, "Cannot get mesh from cage object"); | modifier_setError(md, "Cannot get mesh from cage object"); | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines | |||||