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_correctivesmooth.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_correctivesmooth.c')
-rw-r--r--source/blender/modifiers/intern/MOD_correctivesmooth.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index ac1c0d46d7b..d9e6ed78070 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -45,6 +45,9 @@
#include "BLI_strict_flags.h"
+#include "DEG_depsgraph_query.h"
+
+
// #define DEBUG_TIME
#include "PIL_time.h"
@@ -558,7 +561,7 @@ static void calc_deltas(
static void correctivesmooth_modifier_do(
- ModifierData *md, Object *ob, Mesh *mesh,
+ ModifierData *md, Depsgraph *depsgraph, Object *ob, Mesh *mesh,
float (*vertexCos)[3], unsigned int numVerts,
struct BMEditMesh *em)
{
@@ -580,10 +583,20 @@ static void correctivesmooth_modifier_do(
/* signal to recalculate, whoever sets MUST also free bind coords */
(csmd->bind_coords_num == (unsigned int)-1))
{
- BLI_assert(csmd->bind_coords == NULL);
- csmd->bind_coords = MEM_dupallocN(vertexCos);
- csmd->bind_coords_num = numVerts;
- BLI_assert(csmd->bind_coords != NULL);
+ if (DEG_is_active(depsgraph)) {
+ BLI_assert(csmd->bind_coords == NULL);
+ csmd->bind_coords = MEM_dupallocN(vertexCos);
+ csmd->bind_coords_num = numVerts;
+ BLI_assert(csmd->bind_coords != NULL);
+ /* Copy bound data to the original modifier. */
+ CorrectiveSmoothModifierData *csmd_orig =
+ (CorrectiveSmoothModifierData *)modifier_get_original(&csmd->modifier);
+ csmd_orig->bind_coords = MEM_dupallocN(csmd->bind_coords);
+ csmd_orig->bind_coords_num = csmd->bind_coords_num;
+ }
+ else {
+ modifier_setError(md, "Attempt to bind from inactive dependency graph");
+ }
}
if (UNLIKELY(use_only_smooth)) {
@@ -711,7 +724,7 @@ static void deformVerts(
{
Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false);
- correctivesmooth_modifier_do(md, ctx->object, mesh_src, vertexCos, (unsigned int)numVerts, NULL);
+ correctivesmooth_modifier_do(md, ctx->depsgraph, ctx->object, mesh_src, vertexCos, (unsigned int)numVerts, NULL);
if (mesh_src != mesh) {
BKE_id_free(NULL, mesh_src);
@@ -725,7 +738,7 @@ static void deformVertsEM(
{
Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false);
- correctivesmooth_modifier_do(md, ctx->object, mesh_src, vertexCos, (unsigned int)numVerts, editData);
+ correctivesmooth_modifier_do(md, ctx->depsgraph, ctx->object, mesh_src, vertexCos, (unsigned int)numVerts, editData);
if (mesh_src != mesh) {
BKE_id_free(NULL, mesh_src);