From da1140f75e08ac5228474e5cdbb995ec7c0df579 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 28 Feb 2020 12:59:18 +0100 Subject: Revert "Objects: make evaluated data runtime storage usable for types other than mesh" This reverts commit f2b95b9eae2ee913c99cff7595527b18d8b49d0a. Fix T74283: modifier display lost when moving object in edit mode. The cause is not immediately obvious so better to revert and look at this carefully. --- source/blender/blenkernel/intern/mesh_convert.c | 32 +++++++++++++++---------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/intern/mesh_convert.c') diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index f0bab4c0aa2..014ccdb913e 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -582,7 +582,7 @@ void BKE_mesh_from_nurbs_displist( Main *bmain, Object *ob, ListBase *dispbase, const char *obdata_name, bool temporary) { Object *ob1; - Mesh *me_eval = (Mesh *)ob->runtime.data_eval; + Mesh *me_eval = ob->runtime.mesh_eval; Mesh *me; Curve *cu; MVert *allvert = NULL; @@ -644,7 +644,7 @@ void BKE_mesh_from_nurbs_displist( me = BKE_id_new_nomain(ID_ME, obdata_name); } - ob->runtime.data_eval = NULL; + ob->runtime.mesh_eval = NULL; BKE_mesh_nomain_to_mesh(me_eval, me, ob, &CD_MASK_MESH, true); } @@ -929,9 +929,11 @@ static Object *object_for_curve_to_mesh_create(Object *object) BKE_displist_copy(&temp_object->runtime.curve_cache->disp, &object->runtime.curve_cache->disp); } /* Constructive modifiers will use mesh to store result. */ - if (object->runtime.data_eval != NULL) { - BKE_id_copy_ex( - NULL, object->runtime.data_eval, &temp_object->runtime.data_eval, LIB_ID_COPY_LOCALIZE); + if (object->runtime.mesh_eval != NULL) { + BKE_id_copy_ex(NULL, + &object->runtime.mesh_eval->id, + (ID **)&temp_object->runtime.mesh_eval, + LIB_ID_COPY_LOCALIZE); } /* Need to create copy of curve itself as well, it will be freed by underlying conversion @@ -992,15 +994,19 @@ static void curve_to_mesh_eval_ensure(Object *object) * bit of internal functions (BKE_mesh_from_nurbs_displist, BKE_mesh_nomain_to_mesh) and also * Mesh From Curve operator. * Brecht says hold off with that. */ - Mesh *mesh_eval = NULL; - BKE_displist_make_curveTypes_forRender( - NULL, NULL, &remapped_object, &remapped_object.runtime.curve_cache->disp, &mesh_eval, false); + BKE_displist_make_curveTypes_forRender(NULL, + NULL, + &remapped_object, + &remapped_object.runtime.curve_cache->disp, + &remapped_object.runtime.mesh_eval, + false); /* Note: this is to be consistent with `BKE_displist_make_curveTypes()`, however that is not a * real issue currently, code here is broken in more than one way, fix(es) will be done * separately. */ - if (mesh_eval != NULL) { - BKE_object_eval_assign_data(&remapped_object, &mesh_eval->id, true); + if (remapped_object.runtime.mesh_eval != NULL) { + remapped_object.runtime.mesh_eval->id.tag |= LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT; + remapped_object.runtime.is_mesh_eval_owned = true; } BKE_object_free_curve_cache(&bevel_object); @@ -1098,8 +1104,8 @@ static Mesh *mesh_new_from_mesh_object_with_layers(Depsgraph *depsgraph, Object } Object object_for_eval = *object; - if (object_for_eval.runtime.data_orig != NULL) { - object_for_eval.data = object_for_eval.runtime.data_orig; + if (object_for_eval.runtime.mesh_orig != NULL) { + object_for_eval.data = object_for_eval.runtime.mesh_orig; } Scene *scene = DEG_get_evaluated_scene(depsgraph); @@ -1300,7 +1306,7 @@ Mesh *BKE_mesh_create_derived_for_modifier(struct Depsgraph *depsgraph, ModifierData *md_eval, int build_shapekey_layers) { - Mesh *me = ob_eval->runtime.data_orig ? ob_eval->runtime.data_orig : ob_eval->data; + Mesh *me = ob_eval->runtime.mesh_orig ? ob_eval->runtime.mesh_orig : ob_eval->data; const ModifierTypeInfo *mti = modifierType_getInfo(md_eval->type); Mesh *result; KeyBlock *kb; -- cgit v1.2.3