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:
authorBastien Montagne <montagne29@wanadoo.fr>2018-12-07 17:45:53 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-12-07 20:55:08 +0300
commitde491abf996281785391b18b3547d1bff305355f (patch)
tree9f6f13c1a48658353f2c4a5ea4885f324daf1b95 /source/blender/modifiers/intern/MOD_cast.c
parent38ef3d6b91e128c93557991cb8cb9911c9b21f90 (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_cast.c')
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index e79cceb118c..59ffe11d614 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -48,6 +48,8 @@
#include "BKE_mesh.h"
#include "BKE_modifier.h"
+#include "DEG_depsgraph_query.h"
+
#include "MOD_util.h"
static void initData(ModifierData *md)
@@ -105,7 +107,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
static void sphere_do(
- CastModifierData *cmd, Object *ob, Mesh *mesh,
+ CastModifierData *cmd, const ModifierEvalContext *ctx,
+ Object *ob, Mesh *mesh,
float (*vertexCos)[3], int numVerts)
{
MDeformVert *dvert = NULL;
@@ -128,7 +131,7 @@ static void sphere_do(
if (type == MOD_CAST_TYPE_CYLINDER)
flag &= ~MOD_CAST_Z;
- ctrl_ob = cmd->object;
+ ctrl_ob = DEG_get_evaluated_object(ctx->depsgraph, cmd->object);
/* spherify's center is {0, 0, 0} (the ob's own center in its local
* space), by default, but if the user defined a control object,
@@ -226,7 +229,8 @@ static void sphere_do(
}
static void cuboid_do(
- CastModifierData *cmd, Object *ob, Mesh *mesh,
+ CastModifierData *cmd, const ModifierEvalContext *ctx,
+ Object *ob, Mesh *mesh,
float (*vertexCos)[3], int numVerts)
{
MDeformVert *dvert = NULL;
@@ -244,7 +248,7 @@ static void cuboid_do(
flag = cmd->flag;
- ctrl_ob = cmd->object;
+ ctrl_ob = DEG_get_evaluated_object(ctx->depsgraph, cmd->object);
/* now we check which options the user wants */
@@ -437,10 +441,10 @@ static void deformVerts(
}
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
- cuboid_do(cmd, ctx->object, mesh_src, vertexCos, numVerts);
+ cuboid_do(cmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
}
else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
- sphere_do(cmd, ctx->object, mesh_src, vertexCos, numVerts);
+ sphere_do(cmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
}
if (!ELEM(mesh_src, NULL, mesh)) {
@@ -459,10 +463,10 @@ static void deformVertsEM(
BLI_assert(mesh_src->totvert == numVerts);
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
- cuboid_do(cmd, ctx->object, mesh_src, vertexCos, numVerts);
+ cuboid_do(cmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
}
else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
- sphere_do(cmd, ctx->object, mesh_src, vertexCos, numVerts);
+ sphere_do(cmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
}
if (mesh_src != mesh) {