Fix T56906: Mesh from Curve not working on curves beveled by curves.

Not exactly sure why we did not have cached displist for bevel object
here... But anyway, that conversion operation should really happen
outside of depsgraph evaluation area, so makes sense to do it as when
generating geometry for rendering, imho. Also solves issues like loosing
hidden parts of the curve/surface, etc. Still using viewport resolution
for curves, though.
This commit is contained in:
Bastien Montagne 2018-11-28 18:14:40 +01:00
parent 6d2da3950e
commit 98ecab1af0
Notes: blender-bot 2023-02-14 05:22:18 +01:00
Referenced by issue #56906, Mesh from Curve not working on curves beveled by curves
8 changed files with 16 additions and 11 deletions

View File

@ -91,7 +91,8 @@ void BKE_displist_make_surf(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase,
struct Mesh **r_final, const bool for_render, const bool for_orco, const bool use_render_resolution);
void BKE_displist_make_curveTypes(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const bool for_orco);
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob,
const bool for_render, const bool for_orco);
void BKE_displist_make_curveTypes_forRender(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase,
struct Mesh **r_final, const bool for_orco, const bool use_render_resolution);

View File

@ -694,7 +694,7 @@ static float displist_calc_taper(Depsgraph *depsgraph, Scene *scene, Object *tap
dl = taperobj->runtime.curve_cache ? taperobj->runtime.curve_cache->disp.first : NULL;
if (dl == NULL) {
BKE_displist_make_curveTypes(depsgraph, scene, taperobj, 0);
BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false, false);
dl = taperobj->runtime.curve_cache->disp.first;
}
if (dl) {
@ -1578,7 +1578,7 @@ static void do_makeDispListCurveTypes(
if (!for_orco)
curve_calc_modifiers_pre(depsgraph, scene, ob, &nubase, for_render, use_render_resolution);
BKE_curve_bevelList_make(ob, &nubase, for_render != false);
BKE_curve_bevelList_make(ob, &nubase, use_render_resolution);
/* If curve has no bevel will return nothing */
BKE_curve_bevel_make(depsgraph, scene, ob, &dlbev, for_render, use_render_resolution);
@ -1788,7 +1788,8 @@ static void do_makeDispListCurveTypes(
}
}
void BKE_displist_make_curveTypes(Depsgraph *depsgraph, Scene *scene, Object *ob, const bool for_orco)
void BKE_displist_make_curveTypes(
Depsgraph *depsgraph, Scene *scene, Object *ob, const bool for_render, const bool for_orco)
{
ListBase *dispbase;
@ -1806,7 +1807,7 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph, Scene *scene, Object *ob
dispbase = &(ob->runtime.curve_cache->disp);
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, &ob->runtime.mesh_eval, 0, for_orco, 0);
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, &ob->runtime.mesh_eval, for_render, for_orco, false);
boundbox_displist_object(ob);
}

View File

@ -168,7 +168,7 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
Curve *cu = eff->ob->data;
if (cu->flag & CU_PATH) {
if (eff->ob->runtime.curve_cache == NULL || eff->ob->runtime.curve_cache->path == NULL || eff->ob->runtime.curve_cache->path->data == NULL)
BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, 0);
BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, false, false);
if (eff->ob->runtime.curve_cache->path && eff->ob->runtime.curve_cache->path->data) {
where_on_path(eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL);

View File

@ -225,7 +225,7 @@ void BKE_object_handle_data_update(
case OB_CURVE:
case OB_SURF:
case OB_FONT:
BKE_displist_make_curveTypes(depsgraph, scene, ob, 0);
BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false);
break;
case OB_LATTICE:

View File

@ -6658,7 +6658,7 @@ static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op))
int a;
if (object->runtime.curve_cache == NULL) {
BKE_displist_make_curveTypes(depsgraph, scene, object, false);
BKE_displist_make_curveTypes(depsgraph, scene, object, false, false);
}
INIT_MINMAX(min, max);

View File

@ -1723,9 +1723,12 @@ static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Objec
if (ob->runtime.curve_cache == NULL) {
/* Force creation. This is normally not needed but on operator
* redo we might end up with an object which isn't evaluated yet.
* Also happens in case we are working on a copy of the object (all its caches have been nuked then).
*/
if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) {
BKE_displist_make_curveTypes(depsgraph, scene, ob, false);
/* We need 'for render' ON here, to enable computing bevel dipslist if needed.
* Also makes sense anyway, we would not want e.g. to loose hidden parts etc. */
BKE_displist_make_curveTypes(depsgraph, scene, ob, true, false);
}
else if (ob->type == OB_MBALL) {
BKE_displist_make_mball(depsgraph, scene, ob);

View File

@ -112,7 +112,7 @@ static void object_force_modifier_update_for_bind(Depsgraph *depsgraph, Scene *s
BKE_displist_make_mball(depsgraph, scene, ob);
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
BKE_displist_make_curveTypes(depsgraph, scene, ob, 0);
BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false);
}
}

View File

@ -631,7 +631,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
if ((cu->flag & CU_PATH) == 0) {
cu->flag |= CU_PATH | CU_FOLLOW;
BKE_displist_make_curveTypes(depsgraph, scene, par, 0); /* force creation of path data */
BKE_displist_make_curveTypes(depsgraph, scene, par, false, false); /* force creation of path data */
}
else {
cu->flag |= CU_FOLLOW;