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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-26 13:46:34 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-26 15:51:08 +0300
commite4284d06ada4f3eeac9c19f987e8b2d8eff47e62 (patch)
tree4b235693675738f24f196f4cf8530579e570c751 /source
parentdc316f72b376d49a921cce0fcc718ec0feaa3feb (diff)
Fix T56899: mesh deform bind does not work.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/object/object_modifier.c32
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c8
2 files changed, 17 insertions, 23 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 43fb3e43e55..4b155642b0e 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -56,6 +56,7 @@
#include "BKE_context.h"
#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
+#include "BKE_editmesh.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_key.h"
@@ -72,8 +73,8 @@
#include "BKE_ocean.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
+#include "BKE_scene.h"
#include "BKE_softbody.h"
-#include "BKE_editmesh.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
@@ -1922,9 +1923,9 @@ static bool meshdeform_poll(bContext *C)
static int meshdeform_bind_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
- Object *ob = ED_object_active_context(C);
+ Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Object *ob = ED_object_active_context(C);
MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_MeshDeform);
if (!mmd)
@@ -1951,36 +1952,23 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
mmd->totvert = 0;
mmd->totcagevert = 0;
mmd->totinfluence = 0;
-
- DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
}
else {
- DerivedMesh *dm;
int mode = mmd->modifier.mode;
-
- /* force modifier to run, it will call binding routine */
mmd->bindfunc = ED_mesh_deform_bind_callback;
mmd->modifier.mode |= eModifierMode_Realtime;
- if (ob->type == OB_MESH) {
- dm = mesh_create_derived_view(depsgraph, scene, ob, 0);
- dm->release(dm);
- }
- else if (ob->type == OB_LATTICE) {
- BKE_lattice_modifiers_calc(depsgraph, scene, ob);
- }
- else if (ob->type == OB_MBALL) {
- BKE_displist_make_mball(depsgraph, scene, ob);
- }
- else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- BKE_displist_make_curveTypes(depsgraph, scene, ob, 0);
- }
+ /* Force depsgraph update, this will do binding. */
+ DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ BKE_scene_graph_update_tagged(depsgraph, bmain);
mmd->bindfunc = NULL;
mmd->modifier.mode = mode;
}
+ DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index 9bfbbc4e44e..aac191bc511 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -325,11 +325,17 @@ static void meshdeformModifier_do(
/* progress bar redraw can make this recursive .. */
if (!recursive) {
+ /* Write binding data to original modifier. */
Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
+ Object *ob_orig = DEG_get_original_object(ob);
+ MeshDeformModifierData *mmd_orig = (MeshDeformModifierData*)modifiers_findByName(ob_orig, mmd->modifier.name);
+
recursive = 1;
- mmd->bindfunc(scene, mmd, cagemesh, (float *)vertexCos, numVerts, cagemat);
+ mmd->bindfunc(scene, mmd_orig, cagemesh, (float *)vertexCos, numVerts, cagemat);
recursive = 0;
}
+
+ return;
}
/* verify we have compatible weights */