Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_meshdeform.c
| Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | static void meshdeformModifier_do( | ||||
| * This is because editbmesh_get_mesh_cage_and_final() might easily | * This is because editbmesh_get_mesh_cage_and_final() might easily | ||||
| * conflict with the thread which evaluates object which is in the edit | * conflict with the thread which evaluates object which is in the edit | ||||
| * mode for this mesh. | * mode for this mesh. | ||||
| * | * | ||||
| * 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 = mmd->object; | Object *ob_target = 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 (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 | |||||
| * target mesh if needed. */ | |||||
| cagemesh = mesh_create_eval_final_view(ctx->depsgraph, DEG_get_input_scene(ctx->depsgraph), mmd->object, &CD_MASK_BAREMESH); | |||||
| free_cagemesh = cagemesh != NULL; | |||||
| } | |||||
| #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; | ||||
| } | } | ||||
| /* compute matrices to go in and out of cage object space */ | /* compute matrices to go in and out of cage object space */ | ||||
| invert_m4_m4(imat, ob_target->obmat); | invert_m4_m4(imat, ob_target->obmat); | ||||
| mul_m4_m4m4(cagemat, imat, ob->obmat); | mul_m4_m4m4(cagemat, imat, ob->obmat); | ||||
| mul_m4_m4m4(cmat, mmd->bindmat, cagemat); | mul_m4_m4m4(cmat, mmd->bindmat, cagemat); | ||||
| invert_m4_m4(iobmat, cmat); | invert_m4_m4(iobmat, cmat); | ||||
| copy_m3_m4(icagemat, iobmat); | copy_m3_m4(icagemat, iobmat); | ||||
| /* bind weights if needed */ | /* bind weights if needed */ | ||||
| if (!mmd->bindcagecos) { | if (!mmd->bindcagecos) { | ||||
| /* progress bar redraw can make this recursive .. */ | /* progress bar redraw can make this recursive .. */ | ||||
| if (!recursive_bind_sentinel) { | if (!DEG_is_active(ctx->depsgraph)) { | ||||
| if (ob != DEG_get_original_object(ob)) { | modifier_setError(md, "Attempt to bind from inactive dependency graph"); | ||||
| BLI_assert(!"Trying to bind inside of depsgraph evaluation"); | |||||
| modifier_setError(md, "Trying to bind inside of depsgraph evaluation"); | |||||
| goto finally; | goto finally; | ||||
| } | } | ||||
| if (!recursive_bind_sentinel) { | |||||
| recursive_bind_sentinel = 1; | recursive_bind_sentinel = 1; | ||||
| mmd->bindfunc(mmd, cagemesh, (float *)vertexCos, numVerts, cagemat); | mmd->bindfunc(mmd, cagemesh, (float *)vertexCos, numVerts, cagemat); | ||||
| recursive_bind_sentinel = 0; | recursive_bind_sentinel = 0; | ||||
| } | } | ||||
| goto finally; | goto finally; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines | |||||