Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-04-04 15:42:33 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-04-04 16:49:30 +0300
commit59f6371a85824b4785db8e2b526c1101a5e30ca7 (patch)
treef8e512d18b21ed8b58e0dc111e8e807e1bb01c4f /source/blender/modifiers/intern/MOD_surfacedeform.c
parentc81eca3d986115ae8f3c542e9b00b89795233864 (diff)
Fix T63252: Bind in Mesh Deform Modifier fails
A regression since 64c8d72ef1ad. The solution is to force modifier evaluation for an evaluated object, and let it to copy binding data back to original when is being evaluated for binding. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D4642
Diffstat (limited to 'source/blender/modifiers/intern/MOD_surfacedeform.c')
-rw-r--r--source/blender/modifiers/intern/MOD_surfacedeform.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index 44307b4271e..46f4f9c78e9 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -1124,7 +1124,7 @@ static void deformVert(
static void surfacedeformModifier_do(
ModifierData *md,
- const ModifierEvalContext *UNUSED(ctx),
+ const ModifierEvalContext *ctx,
float (*vertexCos)[3], unsigned int numverts, Object *ob)
{
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
@@ -1133,30 +1133,19 @@ static void surfacedeformModifier_do(
/* Exit function if bind flag is not set (free bind data if any). */
if (!(smd->flags & MOD_SDEF_BIND)) {
- /* Note: with new CoW system, we expect unbinding to be done by a special call from main thread,
- * outside of depsgraph evaluation (see object_force_modifier_update_for_bind() in object_modifier.c). */
if (smd->verts != NULL) {
- if (ob != DEG_get_original_object(ob)) {
- BLI_assert(!"Trying to unbind inside of depsgraph evaluation");
- modifier_setError(md, "Trying to unbind inside of depsgraph evaluation");
- }
- else {
- freeData(md);
+ if (!DEG_is_active(ctx->depsgraph)) {
+ modifier_setError(md, "Attempt to bind from inactive dependency graph");
+ return;
}
+ ModifierData *md_orig = modifier_get_original(md);
+ freeData(md_orig);
}
return;
}
Object *ob_target = smd->target;
target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
-#if 0 /* Should not be needed anymore since we always get that mesh from eval object ? */
- if (target == NULL && smd->verts == 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. */
- target = mesh_create_eval_final_view(ctx->depsgraph, DEG_get_input_scene(ctx->depsgraph), smd->target, CD_MASK_BAREMESH);
- free_target = target != NULL;
- }
-#endif
if (!target) {
modifier_setError(md, "No valid target mesh");
return;
@@ -1166,20 +1155,19 @@ static void surfacedeformModifier_do(
tnumpoly = target->totpoly;
/* If not bound, execute bind. */
- /* Note: with new CoW system, we expect binding to be done by a special call from main thread,
- * outside of depsgraph evaluation (see object_force_modifier_update_for_bind() in object_modifier.c). */
if (smd->verts == NULL) {
- if (ob != DEG_get_original_object(ob)) {
- BLI_assert(!"Trying to bind inside of depsgraph evaluation");
- modifier_setError(md, "Trying to bind inside of depsgraph evaluation");
+ if (!DEG_is_active(ctx->depsgraph)) {
+ modifier_setError(md, "Attempt to unbind from inactive dependency graph");
return;
}
+
+ SurfaceDeformModifierData *smd_orig = (SurfaceDeformModifierData *)modifier_get_original(md);
float tmp_mat[4][4];
invert_m4_m4(tmp_mat, ob->obmat);
- mul_m4_m4m4(smd->mat, tmp_mat, ob_target->obmat);
+ mul_m4_m4m4(smd_orig->mat, tmp_mat, ob_target->obmat);
- if (!surfacedeformBind(smd, vertexCos, numverts, tnumpoly, tnumverts, target)) {
+ if (!surfacedeformBind(smd_orig, vertexCos, numverts, tnumpoly, tnumverts, target)) {
smd->flags &= ~MOD_SDEF_BIND;
}
/* Early abort, this is binding 'call', no need to perform whole evaluation. */