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:
authorBrecht Van Lommel <brecht>2020-02-27 13:23:15 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-02-28 15:49:35 +0300
commit318112379d6d251334b8f3d2a20b935210446b4f (patch)
tree5fc125ebf73805d209ca071d4118fcede4920c2b /source/blender/blenkernel/intern/mesh_convert.c
parentc60be37f3ebf20ab9b4563d03c0acb97ecf047cc (diff)
Objects: make evaluated data runtime storage usable for types other than mesh
This is in preparation of new object types. This only changes mesh_eval, we may do the same for mesh_deform_eval and other areas in the future if there is a need for it. This previously caused a bug in T74283, that should be fixed now. Differential Revision: https://developer.blender.org/D6695
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_convert.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 014ccdb913e..f0bab4c0aa2 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 = ob->runtime.mesh_eval;
+ Mesh *me_eval = (Mesh *)ob->runtime.data_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.mesh_eval = NULL;
+ ob->runtime.data_eval = NULL;
BKE_mesh_nomain_to_mesh(me_eval, me, ob, &CD_MASK_MESH, true);
}
@@ -929,11 +929,9 @@ 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.mesh_eval != NULL) {
- BKE_id_copy_ex(NULL,
- &object->runtime.mesh_eval->id,
- (ID **)&temp_object->runtime.mesh_eval,
- LIB_ID_COPY_LOCALIZE);
+ if (object->runtime.data_eval != NULL) {
+ BKE_id_copy_ex(
+ NULL, object->runtime.data_eval, &temp_object->runtime.data_eval, LIB_ID_COPY_LOCALIZE);
}
/* Need to create copy of curve itself as well, it will be freed by underlying conversion
@@ -994,19 +992,15 @@ 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. */
- BKE_displist_make_curveTypes_forRender(NULL,
- NULL,
- &remapped_object,
- &remapped_object.runtime.curve_cache->disp,
- &remapped_object.runtime.mesh_eval,
- false);
+ Mesh *mesh_eval = NULL;
+ BKE_displist_make_curveTypes_forRender(
+ NULL, NULL, &remapped_object, &remapped_object.runtime.curve_cache->disp, &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 (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;
+ if (mesh_eval != NULL) {
+ BKE_object_eval_assign_data(&remapped_object, &mesh_eval->id, true);
}
BKE_object_free_curve_cache(&bevel_object);
@@ -1104,8 +1098,8 @@ static Mesh *mesh_new_from_mesh_object_with_layers(Depsgraph *depsgraph, Object
}
Object object_for_eval = *object;
- if (object_for_eval.runtime.mesh_orig != NULL) {
- object_for_eval.data = object_for_eval.runtime.mesh_orig;
+ if (object_for_eval.runtime.data_orig != NULL) {
+ object_for_eval.data = object_for_eval.runtime.data_orig;
}
Scene *scene = DEG_get_evaluated_scene(depsgraph);
@@ -1306,7 +1300,7 @@ Mesh *BKE_mesh_create_derived_for_modifier(struct Depsgraph *depsgraph,
ModifierData *md_eval,
int build_shapekey_layers)
{
- Mesh *me = ob_eval->runtime.mesh_orig ? ob_eval->runtime.mesh_orig : ob_eval->data;
+ Mesh *me = ob_eval->runtime.data_orig ? ob_eval->runtime.data_orig : ob_eval->data;
const ModifierTypeInfo *mti = modifierType_getInfo(md_eval->type);
Mesh *result;
KeyBlock *kb;