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.

Differential Revision: https://developer.blender.org/D6695
This commit is contained in:
Brecht Van Lommel
2020-02-27 11:23:15 +01:00
committed by Brecht Van Lommel
parent 57b7833d1e
commit f2b95b9eae
28 changed files with 219 additions and 215 deletions

View File

@@ -1772,7 +1772,7 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_final, for_render);
}
if (cu->flag & CU_DEFORM_FILL && !ob->runtime.mesh_eval) {
if (cu->flag & CU_DEFORM_FILL && !ob->runtime.data_eval) {
curve_to_filledpoly(cu, &nubase, dispbase);
}
@@ -1800,12 +1800,11 @@ void BKE_displist_make_curveTypes(
dispbase = &(ob->runtime.curve_cache->disp);
do_makeDispListCurveTypes(
depsgraph, scene, ob, dispbase, for_render, for_orco, &ob->runtime.mesh_eval);
Mesh *mesh_eval = NULL;
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, for_render, for_orco, &mesh_eval);
if (ob->runtime.mesh_eval != NULL) {
ob->runtime.mesh_eval->id.tag |= LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT;
ob->runtime.is_mesh_eval_owned = true;
if (mesh_eval != NULL) {
BKE_object_eval_assign_data(ob, &mesh_eval->id, true);
}
boundbox_displist_object(ob);
@@ -1861,8 +1860,9 @@ static void boundbox_displist_object(Object *ob)
ob->runtime.bb = MEM_callocN(sizeof(BoundBox), "boundbox");
}
if (ob->runtime.mesh_eval) {
BKE_object_boundbox_calc_from_mesh(ob, ob->runtime.mesh_eval);
Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
if (mesh_eval) {
BKE_object_boundbox_calc_from_mesh(ob, mesh_eval);
}
else {
float min[3], max[3];