diff options
author | Hans Goudey <h.goudey@me.com> | 2021-06-29 05:46:12 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-06-29 05:46:12 +0300 |
commit | a3a7e19f078432f9a139815a165ed090d8f56140 (patch) | |
tree | ce0212a1d5b34e2dfb0ff3098f6d69f54a515a59 /source/blender/blenkernel/intern/displist.cc | |
parent | 3471ff1a5caa3451beba2605c8e45202257f4832 (diff) |
Cleanup: Avoid freeing curve evaluation data twice
The curve bevel list was freed, and then freed again in a call to the
function that recalulates it. The curve "anim path" data was freed
only to be freed again in its calculation function as well. Also move
the anim_path calculation directly after the bevel list creation to
make its requirements more explicit.
Diffstat (limited to 'source/blender/blenkernel/intern/displist.cc')
-rw-r--r-- | source/blender/blenkernel/intern/displist.cc | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc index 3048795ba45..8821da29dde 100644 --- a/source/blender/blenkernel/intern/displist.cc +++ b/source/blender/blenkernel/intern/displist.cc @@ -1410,13 +1410,6 @@ static void evaluate_curve_type_object(Depsgraph *depsgraph, ListBase nubase = {nullptr, nullptr}; - BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev); - - if (ob->runtime.curve_cache->anim_path_accum_length) { - MEM_freeN((void *)ob->runtime.curve_cache->anim_path_accum_length); - } - ob->runtime.curve_cache->anim_path_accum_length = nullptr; - if (ob->type == OB_FONT) { BKE_vfont_to_curve_nubase(ob, FO_EDIT, &nubase); } @@ -1429,6 +1422,11 @@ static void evaluate_curve_type_object(Depsgraph *depsgraph, BKE_curve_bevelList_make(ob, &nubase, for_render); + if ((cu->flag & CU_PATH) || + DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) { + BKE_anim_path_calc_data(ob); + } + /* If curve has no bevel will return nothing */ ListBase dlbev = BKE_curve_bevel_make(cu); @@ -1439,8 +1437,8 @@ static void evaluate_curve_type_object(Depsgraph *depsgraph, else { const float widfac = cu->width - 1.0f; - BevList *bl = (BevList *)ob->runtime.curve_cache->bev.first; - Nurb *nu = (Nurb *)nubase.first; + const BevList *bl = (BevList *)ob->runtime.curve_cache->bev.first; + const Nurb *nu = (Nurb *)nubase.first; for (; bl && nu; bl = bl->next, nu = nu->next) { float *data; @@ -1605,18 +1603,14 @@ static void evaluate_curve_type_object(Depsgraph *depsgraph, } } } - BKE_displist_free(&dlbev); } + BKE_displist_free(&dlbev); + if (!(cu->flag & CU_DEFORM_FILL)) { curve_to_filledpoly(cu, r_dispbase); } - if ((cu->flag & CU_PATH) || - DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) { - BKE_anim_path_calc_data(ob); - } - BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase); curve_calc_modifiers_post( depsgraph, scene, ob, r_dispbase, for_render, force_mesh_conversion, r_final); |