diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-12-07 17:45:53 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-12-07 20:55:08 +0300 |
commit | de491abf996281785391b18b3547d1bff305355f (patch) | |
tree | 9f6f13c1a48658353f2c4a5ea4885f324daf1b95 /source/blender/modifiers/intern/MOD_warp.c | |
parent | 38ef3d6b91e128c93557991cb8cb9911c9b21f90 (diff) |
Fix modifiers evaluation outside of depsgraph/CoW context.
Fix T58237: Exporters: Curve Modifier not applied when "apply modifiers" are selected.
Fix T58856: Python: "to_mesh" broken in 2.8.
...And many other cases... ;)
Thing is, we need target IDs to always be evaluated ones (at least I
cannot see any case where having orig ones is desired effect here).
Depsgraph/Cow system ensures us that when modifiers are evaluated by it,
but they can also be called outside of this context, e.g. when doing
binding, or object conversion...
So we need to ensure in modifiers code that we actually are always
working with eval data for those targets.
Note that I did not touch to physics modifiers, those are a bit touchy
and rather not 'fix' something there until proven broken!
Diffstat (limited to 'source/blender/modifiers/intern/MOD_warp.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_warp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 3befe0a94d7..cf59c81dcf4 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -160,7 +160,6 @@ static void warpModifier_do( Mesh *mesh, float (*vertexCos)[3], int numVerts) { Object *ob = ctx->object; - Depsgraph *depsgraph = ctx->depsgraph; float obinv[4][4]; float mat_from[4][4]; float mat_from_inv[4][4]; @@ -196,8 +195,8 @@ static void warpModifier_do( invert_m4_m4(obinv, ob->obmat); - mul_m4_m4m4(mat_from, obinv, wmd->object_from->obmat); - mul_m4_m4m4(mat_to, obinv, wmd->object_to->obmat); + mul_m4_m4m4(mat_from, obinv, DEG_get_evaluated_object(ctx->depsgraph, wmd->object_from)->obmat); + mul_m4_m4m4(mat_to, obinv, DEG_get_evaluated_object(ctx->depsgraph, wmd->object_to)->obmat); invert_m4_m4(tmat, mat_from); // swap? mul_m4_m4m4(mat_final, tmat, mat_to); @@ -218,11 +217,12 @@ static void warpModifier_do( } weight = strength; - if (mesh != NULL && wmd->texture) { + Tex *tex_target = (Tex *)DEG_get_evaluated_id(ctx->depsgraph, &wmd->texture->id); + if (mesh != NULL && tex_target != NULL) { tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "warpModifier_do tex_co"); - MOD_get_texture_coords((MappingInfoModifierData *)wmd, ob, mesh, vertexCos, tex_co); + MOD_get_texture_coords((MappingInfoModifierData *)wmd, ctx, ob, mesh, vertexCos, tex_co); - MOD_init_texture(depsgraph, wmd->texture); + MOD_init_texture((MappingInfoModifierData *)wmd, ctx); } for (i = 0; i < numVerts; i++) { @@ -279,7 +279,7 @@ static void warpModifier_do( struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); TexResult texres; texres.nor = NULL; - BKE_texture_get_value(scene, wmd->texture, tex_co[i], &texres, false); + BKE_texture_get_value(scene, tex_target, tex_co[i], &texres, false); fac *= texres.tin; } |