Cleanup: Remove unused "for_orco" argument to curve evaluation
`BKE_displist_make_curveTypes` had a `for_orco` argument that was always false in calls to the function. Removing it allows the curve displist and modifier evaluation code to become simpler. There are some related cleanups in rBdf4299465279 and rB93aecd2b8107.
This commit is contained in:
parent
a0c45a2d54
commit
d2e473a2dd
|
@ -87,13 +87,11 @@ bool BKE_displist_has_faces(const struct ListBase *lb);
|
|||
void BKE_displist_make_curveTypes(struct Depsgraph *depsgraph,
|
||||
const struct Scene *scene,
|
||||
struct Object *ob,
|
||||
const bool for_render,
|
||||
const bool for_orco);
|
||||
const bool for_render);
|
||||
void BKE_displist_make_curveTypes_forRender(struct Depsgraph *depsgraph,
|
||||
const struct Scene *scene,
|
||||
struct Object *ob,
|
||||
struct ListBase *dispbase,
|
||||
const bool for_orco,
|
||||
struct Mesh **r_final);
|
||||
void BKE_displist_make_mball(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
|
||||
void BKE_displist_make_mball_forRender(struct Depsgraph *depsgraph,
|
||||
|
|
|
@ -630,7 +630,7 @@ static float displist_calc_taper(Depsgraph *depsgraph,
|
|||
(DispList *)taperobj->runtime.curve_cache->disp.first :
|
||||
nullptr;
|
||||
if (dl == nullptr) {
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false, false);
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false);
|
||||
dl = (DispList *)taperobj->runtime.curve_cache->disp.first;
|
||||
}
|
||||
if (dl) {
|
||||
|
@ -1097,8 +1097,7 @@ static void displist_make_surf(Depsgraph *depsgraph,
|
|||
Object *ob,
|
||||
ListBase *dispbase,
|
||||
Mesh **r_final,
|
||||
const bool for_render,
|
||||
const bool for_orco)
|
||||
const bool for_render)
|
||||
{
|
||||
ListBase nubase = {nullptr, nullptr};
|
||||
const Curve *cu = (const Curve *)ob->data;
|
||||
|
@ -1110,11 +1109,8 @@ static void displist_make_surf(Depsgraph *depsgraph,
|
|||
BKE_nurbList_duplicate(&nubase, &cu->nurb);
|
||||
}
|
||||
|
||||
bool force_mesh_conversion = false;
|
||||
if (!for_orco) {
|
||||
force_mesh_conversion = BKE_curve_calc_modifiers_pre(
|
||||
depsgraph, scene, ob, &nubase, &nubase, for_render);
|
||||
}
|
||||
bool force_mesh_conversion = BKE_curve_calc_modifiers_pre(
|
||||
depsgraph, scene, ob, &nubase, &nubase, for_render);
|
||||
|
||||
LISTBASE_FOREACH (Nurb *, nu, &nubase) {
|
||||
if (!(for_render || nu->hide == 0) || !BKE_nurb_check_valid_uv(nu)) {
|
||||
|
@ -1177,11 +1173,9 @@ static void displist_make_surf(Depsgraph *depsgraph,
|
|||
}
|
||||
}
|
||||
|
||||
if (!for_orco) {
|
||||
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
|
||||
curve_calc_modifiers_post(
|
||||
depsgraph, scene, ob, dispbase, for_render, force_mesh_conversion, r_final);
|
||||
}
|
||||
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
|
||||
curve_calc_modifiers_post(
|
||||
depsgraph, scene, ob, dispbase, for_render, force_mesh_conversion, r_final);
|
||||
|
||||
BKE_nurbList_free(&nubase);
|
||||
}
|
||||
|
@ -1408,7 +1402,6 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
|
|||
Object *ob,
|
||||
ListBase *dispbase,
|
||||
const bool for_render,
|
||||
const bool for_orco,
|
||||
Mesh **r_final)
|
||||
{
|
||||
const Curve *cu = (const Curve *)ob->data;
|
||||
|
@ -1419,24 +1412,18 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
if (ob->type == OB_SURF) {
|
||||
displist_make_surf(depsgraph, scene, ob, dispbase, r_final, for_render, for_orco);
|
||||
displist_make_surf(depsgraph, scene, ob, dispbase, r_final, for_render);
|
||||
return;
|
||||
}
|
||||
|
||||
ListBase nubase = {nullptr, nullptr};
|
||||
bool force_mesh_conversion = false;
|
||||
|
||||
BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev);
|
||||
|
||||
/* We only re-evaluate path if evaluation is not happening for orco.
|
||||
* If the calculation happens for orco, we should never free data which
|
||||
* was needed before and only not needed for orco calculation. */
|
||||
if (!for_orco) {
|
||||
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->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);
|
||||
|
@ -1445,10 +1432,8 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
|
|||
BKE_nurbList_duplicate(&nubase, BKE_curve_nurbs_get(const_cast<Curve *>(cu)));
|
||||
}
|
||||
|
||||
if (!for_orco) {
|
||||
force_mesh_conversion = BKE_curve_calc_modifiers_pre(
|
||||
depsgraph, scene, ob, &nubase, &nubase, for_render);
|
||||
}
|
||||
bool force_mesh_conversion = BKE_curve_calc_modifiers_pre(
|
||||
depsgraph, scene, ob, &nubase, &nubase, for_render);
|
||||
|
||||
BKE_curve_bevelList_make(ob, &nubase, for_render);
|
||||
|
||||
|
@ -1635,17 +1620,15 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
|
|||
curve_to_filledpoly(cu, dispbase);
|
||||
}
|
||||
|
||||
if (!for_orco) {
|
||||
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, dispbase, for_render, force_mesh_conversion, r_final);
|
||||
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, dispbase, for_render, force_mesh_conversion, r_final);
|
||||
|
||||
if (cu->flag & CU_DEFORM_FILL && !ob->runtime.data_eval) {
|
||||
curve_to_filledpoly(cu, dispbase);
|
||||
}
|
||||
|
@ -1656,8 +1639,7 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
|
|||
void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
|
||||
const Scene *scene,
|
||||
Object *ob,
|
||||
const bool for_render,
|
||||
const bool for_orco)
|
||||
const bool for_render)
|
||||
{
|
||||
/* The same check for duplis as in do_makeDispListCurveTypes.
|
||||
* Happens when curve used for constraint/bevel was converted to mesh.
|
||||
|
@ -1676,7 +1658,7 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
|
|||
ListBase *dispbase = &(ob->runtime.curve_cache->disp);
|
||||
|
||||
Mesh *mesh_eval = nullptr;
|
||||
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, for_render, for_orco, &mesh_eval);
|
||||
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, for_render, &mesh_eval);
|
||||
|
||||
if (mesh_eval != nullptr) {
|
||||
BKE_object_eval_assign_data(ob, &mesh_eval->id, true);
|
||||
|
@ -1685,19 +1667,15 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
|
|||
boundbox_displist_object(ob);
|
||||
}
|
||||
|
||||
void BKE_displist_make_curveTypes_forRender(Depsgraph *depsgraph,
|
||||
const Scene *scene,
|
||||
Object *ob,
|
||||
ListBase *dispbase,
|
||||
const bool for_orco,
|
||||
Mesh **r_final)
|
||||
void BKE_displist_make_curveTypes_forRender(
|
||||
Depsgraph *depsgraph, const Scene *scene, Object *ob, ListBase *dispbase, Mesh **r_final)
|
||||
{
|
||||
if (ob->runtime.curve_cache == nullptr) {
|
||||
ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache),
|
||||
"CurveCache for Curve");
|
||||
}
|
||||
|
||||
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, true, for_orco, r_final);
|
||||
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, true, r_final);
|
||||
}
|
||||
|
||||
void BKE_displist_minmax(const ListBase *dispbase, float min[3], float max[3])
|
||||
|
|
|
@ -163,7 +163,7 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
|
|||
if (cu->flag & CU_PATH) {
|
||||
if (eff->ob->runtime.curve_cache == NULL ||
|
||||
eff->ob->runtime.curve_cache->anim_path_accum_length == NULL) {
|
||||
BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, false, false);
|
||||
BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, false);
|
||||
}
|
||||
|
||||
if (eff->ob->runtime.curve_cache->anim_path_accum_length) {
|
||||
|
|
|
@ -1107,7 +1107,7 @@ static void curve_to_mesh_eval_ensure(Object *object)
|
|||
* 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, false, &mesh_eval);
|
||||
NULL, NULL, &remapped_object, &remapped_object.runtime.curve_cache->disp, &mesh_eval);
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -224,7 +224,7 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
|
|||
case OB_SURF:
|
||||
case OB_FONT: {
|
||||
bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, ob, for_render, false);
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, ob, for_render);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -2575,7 +2575,7 @@ static void object_data_convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *
|
|||
if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) {
|
||||
/* We need 'for render' ON here, to enable computing bevel dipslist if needed.
|
||||
* Also makes sense anyway, we would not want e.g. to lose hidden parts etc. */
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, ob, true, false);
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, ob, true);
|
||||
}
|
||||
else if (ob->type == OB_MBALL) {
|
||||
BKE_displist_make_mball(depsgraph, scene, ob);
|
||||
|
|
|
@ -125,7 +125,7 @@ static void object_force_modifier_update_for_bind(Depsgraph *depsgraph, Object *
|
|||
BKE_displist_make_mball(depsgraph, scene_eval, ob_eval);
|
||||
}
|
||||
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
|
||||
BKE_displist_make_curveTypes(depsgraph, scene_eval, ob_eval, false, false);
|
||||
BKE_displist_make_curveTypes(depsgraph, scene_eval, ob_eval, false);
|
||||
}
|
||||
else if (ob->type == OB_GPENCIL) {
|
||||
BKE_gpencil_modifiers_calc(depsgraph, scene_eval, ob_eval);
|
||||
|
@ -1923,8 +1923,8 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
const eMultiresSubdivideModeType subdivide_mode = (eMultiresSubdivideModeType)(
|
||||
RNA_enum_get(op->ptr, "mode"));
|
||||
const eMultiresSubdivideModeType subdivide_mode = (eMultiresSubdivideModeType)(RNA_enum_get(
|
||||
op->ptr, "mode"));
|
||||
multiresModifier_subdivide(object, mmd, subdivide_mode);
|
||||
|
||||
ED_object_iter_other(
|
||||
|
|
|
@ -715,7 +715,7 @@ bool ED_object_parent_set(ReportList *reports,
|
|||
cu->flag |= CU_PATH | CU_FOLLOW;
|
||||
cu_eval->flag |= CU_PATH | CU_FOLLOW;
|
||||
/* force creation of path data */
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, par, false, false);
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, par, false);
|
||||
}
|
||||
else {
|
||||
cu->flag |= CU_FOLLOW;
|
||||
|
|
Loading…
Reference in New Issue