Page MenuHome
Paste P909

T61391 fail
ActivePublic

Authored by Philipp Oeser (lichtwerk) on Feb 11 2019, 1:17 PM.
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index dcc55fa2445..072d4660c13 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -426,6 +426,6 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated(
struct DerivedMesh *dm);
struct Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(
- struct Object *ob_eval, bool *r_free_mesh);
+ struct Depsgraph *depsgraph, struct Object *ob_eval, bool *r_free_mesh);
#endif
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 511f5d01461..01ed6f5ed5b 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -54,6 +54,7 @@
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_mesh.h"
+#include "BKE_mesh_runtime.h"
#include "BKE_multires.h"
#include "BKE_object.h"
#include "BKE_DerivedMesh.h"
@@ -900,18 +901,13 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated(
* e.g. second operand for boolean modifier.
* Note that modifiers in stack always get fully evaluated COW ID pointers, never original ones. Makes things simpler.
*/
-Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval, bool *r_free_mesh)
+Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Depsgraph *depsgraph, Object *ob_eval, bool *r_free_mesh)
{
Mesh *me = NULL;
if ((ob_eval->type == OB_MESH) && (ob_eval->mode & OB_MODE_EDIT)) {
- /* Note: currently we have no equivalent to derived cagemesh or even final dm in BMEditMesh...
- * This is TODO in core depsgraph/modifier stack code still. */
- BMEditMesh *em = BKE_editmesh_from_object(ob_eval);
- if (em != NULL) { /* em might not exist yet in some cases, just after loading a .blend file, see T57878. */
- me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0);
- *r_free_mesh = true;
- }
+ me = mesh_create_eval_final_view(depsgraph, DEG_get_input_scene(depsgraph), ob_eval, 0);
+ *r_free_mesh = true;
}
if (me == NULL) {
me = ob_eval->runtime.mesh_eval;
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index e2a4dc6f852..b468043e617 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -654,7 +654,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
}
if (calc->aux_target) {
- auxMesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(calc->aux_target, &auxMesh_free);
+ auxMesh = NULL;//BKE_modifier_get_evaluated_mesh_from_evaluated_object(calc->aux_target, &auxMesh_free);
if (!auxMesh)
return;
BLI_SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->aux_target);
@@ -1303,7 +1303,7 @@ void shrinkwrapModifier_deform(
if (smd->target != NULL) {
Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, smd->target);
- calc.target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, &target_free);
+ calc.target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ctx->depsgraph, ob_target, &target_free);
/* TODO there might be several "bugs" on non-uniform scales matrixs
* because it will no longer be nearest surface, not sphere projection
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 5fdfe1ef7cf..1e9c5b93d3f 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -378,7 +378,8 @@ static Mesh *arrayModifier_doArray(
vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(
start_cap_ob, ctx->object, &vgroup_start_cap_remap_len);
- start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob, &start_cap_mesh_free);
+ start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ctx->depsgraph,
+ start_cap_ob, &start_cap_mesh_free);
if (start_cap_mesh) {
start_cap_nverts = start_cap_mesh->totvert;
start_cap_nedges = start_cap_mesh->totedge;
@@ -391,7 +392,8 @@ static Mesh *arrayModifier_doArray(
vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(
end_cap_ob, ctx->object, &vgroup_end_cap_remap_len);
- end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(end_cap_ob, &end_cap_mesh_free);
+ end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ctx->depsgraph,
+ end_cap_ob, &end_cap_mesh_free);
if (end_cap_mesh) {
end_cap_nverts = end_cap_mesh->totvert;
end_cap_nedges = end_cap_mesh->totedge;
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index d26aaf622a3..451965af514 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -164,7 +164,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
}
Object *other = DEG_get_evaluated_object(ctx->depsgraph, bmd->object);
- mesh_other = BKE_modifier_get_evaluated_mesh_from_evaluated_object(other, &mesh_other_free);
+ mesh_other = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ctx->depsgraph, other, &mesh_other_free);
if (mesh_other) {
Object *object = ctx->object;
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index d789f964b6e..d21edb70fd4 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -119,8 +119,10 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
MeshDeformModifierData *mmd = (MeshDeformModifierData *)md;
if (mmd->object != NULL) {
/* TODO(sergey): Do we need transform component here? */
+ DEG_add_object_relation(ctx->node, mmd->object, DEG_OB_COMP_TRANSFORM, "Mesh Deform Modifier");
DEG_add_object_relation(ctx->node, mmd->object, DEG_OB_COMP_GEOMETRY, "Mesh Deform Modifier");
}
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Mesh Deform Modifier");
}
static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3], float vec[3])
@@ -297,7 +299,7 @@ static void meshdeformModifier_do(
* We'll support this case once granular dependency graph is landed.
*/
Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, mmd->object);
- cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, &free_cagemesh);
+ cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ctx->depsgraph, ob_target, &free_cagemesh);
#if 0 /* This shall not be needed if we always get evaluated target object... */
if (cagemesh == NULL && mmd->bindcagecos == NULL && ob == DEG_get_original_object(ob)) {
/* Special case, binding happens outside of depsgraph evaluation, so we can build our own
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index cb04d7fc307..8edb41c46cc 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -1145,7 +1145,7 @@ static void surfacedeformModifier_do(
}
Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, smd->target);
- target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, &free_target);
+ target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ctx->depsgraph, ob_target, &free_target);
#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
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 7f710967ec1..1afb9a1ef9d 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -485,7 +485,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
if (use_trgt_verts || use_trgt_edges || use_trgt_faces) {
bool target_mesh_free;
- Mesh *target_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(obr, &target_mesh_free);
+ Mesh *target_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ctx->depsgraph,
+ obr, &target_mesh_free);
/* We must check that we do have a valid target_mesh! */
if (target_mesh != NULL) {