Cleanup/Refactor: Move CurveCache runtime data into Object.runtime struct.
Also, fix missing cleanup of Object.runtime when copying Object datablocks!
This commit is contained in:
parent
6d6deeb700
commit
a3b6ae9fb9
|
@ -52,7 +52,7 @@ AbcMBallWriter::AbcMBallWriter(
|
|||
m_is_animated = isAnimated();
|
||||
|
||||
m_mesh_ob = BKE_object_copy(bmain, ob);
|
||||
m_mesh_ob->curve_cache = (CurveCache *)MEM_callocN(
|
||||
m_mesh_ob->runtime.curve_cache = (CurveCache *)MEM_callocN(
|
||||
sizeof(CurveCache),
|
||||
"CurveCache for AbcMBallWriter");
|
||||
|
||||
|
|
|
@ -130,8 +130,8 @@ void AbcNurbsWriter::do_write()
|
|||
Curve *curve = static_cast<Curve *>(m_object->data);
|
||||
ListBase *nulb;
|
||||
|
||||
if (m_object->curve_cache->deformed_nurbs.first != NULL) {
|
||||
nulb = &m_object->curve_cache->deformed_nurbs;
|
||||
if (m_object->runtime.curve_cache->deformed_nurbs.first != NULL) {
|
||||
nulb = &m_object->runtime.curve_cache->deformed_nurbs;
|
||||
}
|
||||
else {
|
||||
nulb = BKE_curve_nurbs_get(curve);
|
||||
|
|
|
@ -537,18 +537,18 @@ void calc_curvepath(Object *ob, ListBase *nurbs)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ob->curve_cache->path) free_path(ob->curve_cache->path);
|
||||
ob->curve_cache->path = NULL;
|
||||
if (ob->runtime.curve_cache->path) free_path(ob->runtime.curve_cache->path);
|
||||
ob->runtime.curve_cache->path = NULL;
|
||||
|
||||
/* weak! can only use first curve */
|
||||
bl = ob->curve_cache->bev.first;
|
||||
bl = ob->runtime.curve_cache->bev.first;
|
||||
if (bl == NULL || !bl->nr) {
|
||||
return;
|
||||
}
|
||||
|
||||
nu = nurbs->first;
|
||||
|
||||
ob->curve_cache->path = path = MEM_callocN(sizeof(Path), "calc_curvepath");
|
||||
ob->runtime.curve_cache->path = path = MEM_callocN(sizeof(Path), "calc_curvepath");
|
||||
|
||||
/* if POLY: last vertice != first vertice */
|
||||
cycl = (bl->poly != -1);
|
||||
|
@ -665,15 +665,15 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
|
|||
|
||||
if (ob == NULL || ob->type != OB_CURVE) return 0;
|
||||
cu = ob->data;
|
||||
if (ob->curve_cache == NULL || ob->curve_cache->path == NULL || ob->curve_cache->path->data == NULL) {
|
||||
if (ob->runtime.curve_cache == NULL || ob->runtime.curve_cache->path == NULL || ob->runtime.curve_cache->path->data == NULL) {
|
||||
printf("no path!\n");
|
||||
return 0;
|
||||
}
|
||||
path = ob->curve_cache->path;
|
||||
path = ob->runtime.curve_cache->path;
|
||||
pp = path->data;
|
||||
|
||||
/* test for cyclic */
|
||||
bl = ob->curve_cache->bev.first;
|
||||
bl = ob->runtime.curve_cache->bev.first;
|
||||
if (!bl) return 0;
|
||||
if (!bl->nr) return 0;
|
||||
if (bl->poly > -1) cycl = 1;
|
||||
|
|
|
@ -201,7 +201,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
|
|||
|
||||
/* get the current length of the curve */
|
||||
/* NOTE: this is assumed to be correct even after the curve was resized */
|
||||
splineLen = ikData->tar->curve_cache->path->totdist;
|
||||
splineLen = ikData->tar->runtime.curve_cache->path->totdist;
|
||||
|
||||
/* calculate the scale factor to multiply all the path values by so that the
|
||||
* bone chain retains its current length, such that
|
||||
|
|
|
@ -655,8 +655,8 @@ DerivedMesh *CDDM_from_curve(Object *ob)
|
|||
{
|
||||
ListBase disp = {NULL, NULL};
|
||||
|
||||
if (ob->curve_cache) {
|
||||
disp = ob->curve_cache->disp;
|
||||
if (ob->runtime.curve_cache) {
|
||||
disp = ob->runtime.curve_cache->disp;
|
||||
}
|
||||
|
||||
return CDDM_from_curve_displist(ob, &disp);
|
||||
|
|
|
@ -496,7 +496,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
|
|||
{
|
||||
Lattice *lt = (Lattice *)ob->data;
|
||||
|
||||
DispList *dl = ob->curve_cache ? BKE_displist_find(&ob->curve_cache->disp, DL_VERTS) : NULL;
|
||||
DispList *dl = ob->runtime.curve_cache ? BKE_displist_find(&ob->runtime.curve_cache->disp, DL_VERTS) : NULL;
|
||||
const float *co = dl ? dl->verts : NULL;
|
||||
BPoint *bp = lt->def;
|
||||
|
||||
|
@ -1266,7 +1266,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
|
|||
* currently for paths to work it needs to go through the bevlist/displist system (ton)
|
||||
*/
|
||||
|
||||
if (ct->tar->curve_cache && ct->tar->curve_cache->path && ct->tar->curve_cache->path->data) {
|
||||
if (ct->tar->runtime.curve_cache && ct->tar->runtime.curve_cache->path && ct->tar->runtime.curve_cache->path->data) {
|
||||
float quat[4];
|
||||
if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
|
||||
/* animated position along curve depending on time */
|
||||
|
@ -2037,7 +2037,7 @@ static void pycon_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
|
|||
#endif
|
||||
|
||||
if (VALID_CONS_TARGET(ct)) {
|
||||
if (ct->tar->type == OB_CURVE && ct->tar->curve_cache == NULL) {
|
||||
if (ct->tar->type == OB_CURVE && ct->tar->runtime.curve_cache == NULL) {
|
||||
unit_m4(ct->matrix);
|
||||
return;
|
||||
}
|
||||
|
@ -3104,7 +3104,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
|
|||
BKE_object_minmax(ct->tar, curveMin, curveMax, true);
|
||||
|
||||
/* get targetmatrix */
|
||||
if (data->tar->curve_cache && data->tar->curve_cache->path && data->tar->curve_cache->path->data) {
|
||||
if (data->tar->runtime.curve_cache && data->tar->runtime.curve_cache->path && data->tar->runtime.curve_cache->path->data) {
|
||||
float vec[4], dir[3], totmat[4][4];
|
||||
float curvetime;
|
||||
short clamp_axis;
|
||||
|
|
|
@ -1752,11 +1752,11 @@ void BKE_curve_bevel_make(
|
|||
BKE_displist_make_curveTypes_forRender(depsgraph, scene, cu->bevobj, &bevdisp, NULL, false, use_render_resolution);
|
||||
dl = bevdisp.first;
|
||||
}
|
||||
else if (cu->bevobj->curve_cache) {
|
||||
dl = cu->bevobj->curve_cache->disp.first;
|
||||
else if (cu->bevobj->runtime.curve_cache) {
|
||||
dl = cu->bevobj->runtime.curve_cache->disp.first;
|
||||
}
|
||||
else {
|
||||
BLI_assert(cu->bevobj->curve_cache != NULL);
|
||||
BLI_assert(cu->bevobj->runtime.curve_cache != NULL);
|
||||
dl = NULL;
|
||||
}
|
||||
|
||||
|
@ -2669,14 +2669,14 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
|
|||
ELEM(cu->bevfac2_mapping, CU_BEVFAC_MAP_SEGMENT, CU_BEVFAC_MAP_SPLINE);
|
||||
|
||||
|
||||
bev = &ob->curve_cache->bev;
|
||||
bev = &ob->runtime.curve_cache->bev;
|
||||
|
||||
/* do we need to calculate the radius for each point? */
|
||||
/* do_radius = (cu->bevobj || cu->taperobj || (cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) ? 0 : 1; */
|
||||
|
||||
/* STEP 1: MAKE POLYS */
|
||||
|
||||
BKE_curve_bevelList_free(&ob->curve_cache->bev);
|
||||
BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev);
|
||||
nu = nurbs->first;
|
||||
if (cu->editnurb && ob->type != OB_FONT) {
|
||||
is_editmode = 1;
|
||||
|
|
|
@ -692,10 +692,10 @@ static float displist_calc_taper(Depsgraph *depsgraph, Scene *scene, Object *tap
|
|||
if (taperobj == NULL || taperobj->type != OB_CURVE)
|
||||
return 1.0;
|
||||
|
||||
dl = taperobj->curve_cache ? taperobj->curve_cache->disp.first : NULL;
|
||||
dl = taperobj->runtime.curve_cache ? taperobj->runtime.curve_cache->disp.first : NULL;
|
||||
if (dl == NULL) {
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, taperobj, 0);
|
||||
dl = taperobj->curve_cache->disp.first;
|
||||
dl = taperobj->runtime.curve_cache->disp.first;
|
||||
}
|
||||
if (dl) {
|
||||
float minx, dx, *fp;
|
||||
|
@ -738,17 +738,17 @@ void BKE_displist_make_mball(Depsgraph *depsgraph, Scene *scene, Object *ob)
|
|||
return;
|
||||
|
||||
if (ob == BKE_mball_basis_find(scene, ob)) {
|
||||
if (ob->curve_cache) {
|
||||
BKE_displist_free(&(ob->curve_cache->disp));
|
||||
if (ob->runtime.curve_cache) {
|
||||
BKE_displist_free(&(ob->runtime.curve_cache->disp));
|
||||
}
|
||||
else {
|
||||
ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for MBall");
|
||||
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for MBall");
|
||||
}
|
||||
|
||||
BKE_mball_polygonize(depsgraph, scene, ob, &ob->curve_cache->disp);
|
||||
BKE_mball_polygonize(depsgraph, scene, ob, &ob->runtime.curve_cache->disp);
|
||||
BKE_mball_texspace_calc(ob);
|
||||
|
||||
object_deform_mball(ob, &ob->curve_cache->disp);
|
||||
object_deform_mball(ob, &ob->runtime.curve_cache->disp);
|
||||
|
||||
/* NOP for MBALLs anyway... */
|
||||
boundbox_displist_object(ob);
|
||||
|
@ -1314,7 +1314,7 @@ void BKE_displist_make_surf(
|
|||
}
|
||||
|
||||
if (!for_orco) {
|
||||
BKE_nurbList_duplicate(&ob->curve_cache->deformed_nurbs, &nubase);
|
||||
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
|
||||
curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_dm_final,
|
||||
for_render, use_render_resolution);
|
||||
}
|
||||
|
@ -1558,15 +1558,15 @@ static void do_makeDispListCurveTypes(
|
|||
ListBase dlbev;
|
||||
ListBase nubase = {NULL, NULL};
|
||||
|
||||
BKE_curve_bevelList_free(&ob->curve_cache->bev);
|
||||
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->curve_cache->path) free_path(ob->curve_cache->path);
|
||||
ob->curve_cache->path = NULL;
|
||||
if (ob->runtime.curve_cache->path) free_path(ob->runtime.curve_cache->path);
|
||||
ob->runtime.curve_cache->path = NULL;
|
||||
}
|
||||
|
||||
if (ob->type == OB_FONT) {
|
||||
|
@ -1590,7 +1590,7 @@ static void do_makeDispListCurveTypes(
|
|||
}
|
||||
else {
|
||||
float widfac = cu->width - 1.0f;
|
||||
BevList *bl = ob->curve_cache->bev.first;
|
||||
BevList *bl = ob->runtime.curve_cache->bev.first;
|
||||
Nurb *nu = nubase.first;
|
||||
|
||||
for (; bl && nu; bl = bl->next, nu = nu->next) {
|
||||
|
@ -1777,7 +1777,7 @@ static void do_makeDispListCurveTypes(
|
|||
}
|
||||
|
||||
if (!for_orco) {
|
||||
BKE_nurbList_duplicate(&ob->curve_cache->deformed_nurbs, &nubase);
|
||||
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
|
||||
curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_dm_final, for_render, use_render_resolution);
|
||||
}
|
||||
|
||||
|
@ -1801,11 +1801,11 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph, Scene *scene, Object *ob
|
|||
|
||||
BKE_object_free_derived_caches(ob);
|
||||
|
||||
if (!ob->curve_cache) {
|
||||
ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for curve types");
|
||||
if (!ob->runtime.curve_cache) {
|
||||
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for curve types");
|
||||
}
|
||||
|
||||
dispbase = &(ob->curve_cache->disp);
|
||||
dispbase = &(ob->runtime.curve_cache->disp);
|
||||
|
||||
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, &ob->derivedFinal, 0, for_orco, 0);
|
||||
|
||||
|
@ -1817,8 +1817,8 @@ void BKE_displist_make_curveTypes_forRender(
|
|||
DerivedMesh **r_dm_final, const bool for_orco,
|
||||
const bool use_render_resolution)
|
||||
{
|
||||
if (ob->curve_cache == NULL) {
|
||||
ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
|
||||
if (ob->runtime.curve_cache == NULL) {
|
||||
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
|
||||
}
|
||||
|
||||
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, r_dm_final, true, for_orco, use_render_resolution);
|
||||
|
@ -1827,8 +1827,8 @@ void BKE_displist_make_curveTypes_forRender(
|
|||
void BKE_displist_make_curveTypes_forOrco(
|
||||
Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase)
|
||||
{
|
||||
if (ob->curve_cache == NULL) {
|
||||
ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
|
||||
if (ob->runtime.curve_cache == NULL) {
|
||||
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
|
||||
}
|
||||
|
||||
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, NULL, 1, 1, 1);
|
||||
|
@ -1903,7 +1903,7 @@ static void boundbox_displist_object(Object *ob)
|
|||
float min[3], max[3];
|
||||
|
||||
INIT_MINMAX(min, max);
|
||||
BKE_displist_minmax(&ob->curve_cache->disp, min, max);
|
||||
BKE_displist_minmax(&ob->runtime.curve_cache->disp, min, max);
|
||||
BKE_boundbox_init_from_minmax(ob->bb, min, max);
|
||||
|
||||
ob->bb->flag &= ~BOUNDBOX_DIRTY;
|
||||
|
|
|
@ -163,10 +163,10 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
|
|||
if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
|
||||
Curve *cu= eff->ob->data;
|
||||
if (cu->flag & CU_PATH) {
|
||||
if (eff->ob->curve_cache == NULL || eff->ob->curve_cache->path==NULL || eff->ob->curve_cache->path->data==NULL)
|
||||
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);
|
||||
|
||||
if (eff->ob->curve_cache->path && eff->ob->curve_cache->path->data) {
|
||||
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);
|
||||
mul_m4_v3(eff->ob->obmat, eff->guide_loc);
|
||||
mul_mat3_m4_v3(eff->ob->obmat, eff->guide_dir);
|
||||
|
|
|
@ -1075,8 +1075,8 @@ makebreak:
|
|||
/* TEXT ON CURVE */
|
||||
/* Note: Only OB_CURVE objects could have a path */
|
||||
if (cu->textoncurve && cu->textoncurve->type == OB_CURVE) {
|
||||
BLI_assert(cu->textoncurve->curve_cache != NULL);
|
||||
if (cu->textoncurve->curve_cache->path) {
|
||||
BLI_assert(cu->textoncurve->runtime.curve_cache != NULL);
|
||||
if (cu->textoncurve->runtime.curve_cache->path) {
|
||||
float distfac, imat[4][4], imat3[3][3], cmat[3][3];
|
||||
float minx, maxx, miny, maxy;
|
||||
float timeofs, sizefac;
|
||||
|
@ -1106,7 +1106,7 @@ makebreak:
|
|||
/* we put the x-coordinaat exact at the curve, the y is rotated */
|
||||
|
||||
/* length correction */
|
||||
distfac = sizefac * cu->textoncurve->curve_cache->path->totdist / (maxx - minx);
|
||||
distfac = sizefac * cu->textoncurve->runtime.curve_cache->path->totdist / (maxx - minx);
|
||||
timeofs = 0.0f;
|
||||
|
||||
if (distfac > 1.0f) {
|
||||
|
|
|
@ -211,9 +211,9 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
|
|||
/* works best if we force to linear type (endpoints match) */
|
||||
lt->typeu = lt->typev = lt->typew = KEY_LINEAR;
|
||||
|
||||
if (ltOb->curve_cache) {
|
||||
if (ltOb->runtime.curve_cache) {
|
||||
/* prevent using deformed locations */
|
||||
BKE_displist_free(<Ob->curve_cache->disp);
|
||||
BKE_displist_free(<Ob->runtime.curve_cache->disp);
|
||||
}
|
||||
|
||||
copy_m4_m4(mat, ltOb->obmat);
|
||||
|
@ -349,7 +349,7 @@ LatticeDeformData *init_latt_deform(Object *oblatt, Object *ob)
|
|||
/* we make an array with all differences */
|
||||
Lattice *lt = oblatt->data;
|
||||
BPoint *bp;
|
||||
DispList *dl = oblatt->curve_cache ? BKE_displist_find(&oblatt->curve_cache->disp, DL_VERTS) : NULL;
|
||||
DispList *dl = oblatt->runtime.curve_cache ? BKE_displist_find(&oblatt->runtime.curve_cache->disp, DL_VERTS) : NULL;
|
||||
const float *co = dl ? dl->verts : NULL;
|
||||
float *fp, imat[4][4];
|
||||
float fu, fv, fw;
|
||||
|
@ -558,7 +558,7 @@ static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float di
|
|||
int cycl = 0;
|
||||
|
||||
/* test for cyclic */
|
||||
bl = ob->curve_cache->bev.first;
|
||||
bl = ob->runtime.curve_cache->bev.first;
|
||||
if (!bl->nr) return false;
|
||||
if (bl->poly > -1) cycl = 1;
|
||||
|
||||
|
@ -573,7 +573,7 @@ static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float di
|
|||
if (where_on_path(ob, ctime1, vec, dir, quat, radius, NULL)) {
|
||||
|
||||
if (cycl == 0) {
|
||||
Path *path = ob->curve_cache->path;
|
||||
Path *path = ob->runtime.curve_cache->path;
|
||||
float dvec[3];
|
||||
|
||||
if (ctime < 0.0f) {
|
||||
|
@ -610,12 +610,12 @@ static bool calc_curve_deform(Object *par, float co[3],
|
|||
short index;
|
||||
const bool is_neg_axis = (axis > 2);
|
||||
|
||||
if (par->curve_cache == NULL) {
|
||||
if (par->runtime.curve_cache == NULL) {
|
||||
/* Happens with a cyclic dependencies. */
|
||||
return false;
|
||||
}
|
||||
|
||||
if (par->curve_cache->path == NULL) {
|
||||
if (par->runtime.curve_cache->path == NULL) {
|
||||
return false; /* happens on append, cyclic dependencies and empty curves */
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ static bool calc_curve_deform(Object *par, float co[3],
|
|||
if (cu->flag & CU_STRETCH)
|
||||
fac = (-co[index] - cd->dmax[index]) / (cd->dmax[index] - cd->dmin[index]);
|
||||
else
|
||||
fac = -(co[index] - cd->dmax[index]) / (par->curve_cache->path->totdist);
|
||||
fac = -(co[index] - cd->dmax[index]) / (par->runtime.curve_cache->path->totdist);
|
||||
}
|
||||
else {
|
||||
index = axis;
|
||||
|
@ -633,8 +633,8 @@ static bool calc_curve_deform(Object *par, float co[3],
|
|||
fac = (co[index] - cd->dmin[index]) / (cd->dmax[index] - cd->dmin[index]);
|
||||
}
|
||||
else {
|
||||
if (LIKELY(par->curve_cache->path->totdist > FLT_EPSILON)) {
|
||||
fac = +(co[index] - cd->dmin[index]) / (par->curve_cache->path->totdist);
|
||||
if (LIKELY(par->runtime.curve_cache->path->totdist > FLT_EPSILON)) {
|
||||
fac = +(co[index] - cd->dmin[index]) / (par->runtime.curve_cache->path->totdist);
|
||||
}
|
||||
else {
|
||||
fac = 0.0f;
|
||||
|
@ -1035,11 +1035,11 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
|
|||
int numVerts, editmode = (lt->editlatt != NULL);
|
||||
const ModifierEvalContext mectx = {depsgraph, ob, 0};
|
||||
|
||||
if (ob->curve_cache) {
|
||||
BKE_displist_free(&ob->curve_cache->disp);
|
||||
if (ob->runtime.curve_cache) {
|
||||
BKE_displist_free(&ob->runtime.curve_cache->disp);
|
||||
}
|
||||
else {
|
||||
ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for lattice");
|
||||
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for lattice");
|
||||
}
|
||||
|
||||
for (; md; md = md->next) {
|
||||
|
@ -1071,7 +1071,7 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
|
|||
dl->nr = numVerts;
|
||||
dl->verts = (float *) vertexCos;
|
||||
|
||||
BLI_addtail(&ob->curve_cache->disp, dl);
|
||||
BLI_addtail(&ob->runtime.curve_cache->disp, dl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ BoundBox *BKE_lattice_boundbox_get(Object *ob)
|
|||
|
||||
void BKE_lattice_minmax_dl(Object *ob, Lattice *lt, float min[3], float max[3])
|
||||
{
|
||||
DispList *dl = ob->curve_cache ? BKE_displist_find(&ob->curve_cache->disp, DL_VERTS) : NULL;
|
||||
DispList *dl = ob->runtime.curve_cache ? BKE_displist_find(&ob->runtime.curve_cache->disp, DL_VERTS) : NULL;
|
||||
|
||||
if (!dl) {
|
||||
BKE_lattice_minmax(lt, min, max);
|
||||
|
|
|
@ -926,8 +926,8 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
|
|||
/* check indices from mesh */
|
||||
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) {
|
||||
material_data_index_remove_id((ID *)ob->data, actcol - 1);
|
||||
if (ob->curve_cache) {
|
||||
BKE_displist_free(&ob->curve_cache->disp);
|
||||
if (ob->runtime.curve_cache) {
|
||||
BKE_displist_free(&ob->runtime.curve_cache->disp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ void BKE_mball_texspace_calc(Object *ob)
|
|||
(min)[0] = (min)[1] = (min)[2] = 1.0e30f;
|
||||
(max)[0] = (max)[1] = (max)[2] = -1.0e30f;
|
||||
|
||||
dl = ob->curve_cache->disp.first;
|
||||
dl = ob->runtime.curve_cache->disp.first;
|
||||
while (dl) {
|
||||
tot = dl->nr;
|
||||
if (tot) do_it = true;
|
||||
|
|
|
@ -217,8 +217,8 @@ int BKE_mesh_nurbs_to_mdata(
|
|||
{
|
||||
ListBase disp = {NULL, NULL};
|
||||
|
||||
if (ob->curve_cache) {
|
||||
disp = ob->curve_cache->disp;
|
||||
if (ob->runtime.curve_cache) {
|
||||
disp = ob->runtime.curve_cache->disp;
|
||||
}
|
||||
|
||||
return BKE_mesh_nurbs_displist_to_mdata(
|
||||
|
@ -537,8 +537,8 @@ Mesh *BKE_mesh_new_nomain_from_curve(Object *ob)
|
|||
{
|
||||
ListBase disp = {NULL, NULL};
|
||||
|
||||
if (ob->curve_cache) {
|
||||
disp = ob->curve_cache->disp;
|
||||
if (ob->runtime.curve_cache) {
|
||||
disp = ob->runtime.curve_cache->disp;
|
||||
}
|
||||
|
||||
return BKE_mesh_new_nomain_from_curve_displist(ob, &disp);
|
||||
|
@ -650,8 +650,8 @@ void BKE_mesh_from_nurbs(Main *bmain, Object *ob)
|
|||
bool use_orco_uv = (cu->flag & CU_UV_ORCO) != 0;
|
||||
ListBase disp = {NULL, NULL};
|
||||
|
||||
if (ob->curve_cache) {
|
||||
disp = ob->curve_cache->disp;
|
||||
if (ob->runtime.curve_cache) {
|
||||
disp = ob->runtime.curve_cache->disp;
|
||||
}
|
||||
|
||||
BKE_mesh_from_nurbs_displist(bmain, ob, &disp, use_orco_uv, cu->id.name, false);
|
||||
|
@ -871,11 +871,11 @@ Mesh *BKE_mesh_new_from_object(
|
|||
*
|
||||
* TODO(sergey): Look into more proper solution.
|
||||
*/
|
||||
if (ob->curve_cache != NULL) {
|
||||
if (tmpobj->curve_cache == NULL) {
|
||||
tmpobj->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for curve types");
|
||||
if (ob->runtime.curve_cache != NULL) {
|
||||
if (tmpobj->runtime.curve_cache == NULL) {
|
||||
tmpobj->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for curve types");
|
||||
}
|
||||
BKE_displist_copy(&tmpobj->curve_cache->disp, &ob->curve_cache->disp);
|
||||
BKE_displist_copy(&tmpobj->runtime.curve_cache->disp, &ob->runtime.curve_cache->disp);
|
||||
}
|
||||
|
||||
/* if getting the original caged mesh, delete object modifiers */
|
||||
|
@ -953,8 +953,8 @@ Mesh *BKE_mesh_new_from_object(
|
|||
}
|
||||
else {
|
||||
ListBase disp = {NULL, NULL};
|
||||
if (ob->curve_cache) {
|
||||
disp = ob->curve_cache->disp;
|
||||
if (ob->runtime.curve_cache) {
|
||||
disp = ob->runtime.curve_cache->disp;
|
||||
}
|
||||
BKE_mesh_from_metaball(&disp, tmpmesh);
|
||||
}
|
||||
|
|
|
@ -170,15 +170,15 @@ void BKE_object_free_softbody(Object *ob)
|
|||
|
||||
void BKE_object_free_curve_cache(Object *ob)
|
||||
{
|
||||
if (ob->curve_cache) {
|
||||
BKE_displist_free(&ob->curve_cache->disp);
|
||||
BKE_curve_bevelList_free(&ob->curve_cache->bev);
|
||||
if (ob->curve_cache->path) {
|
||||
free_path(ob->curve_cache->path);
|
||||
if (ob->runtime.curve_cache) {
|
||||
BKE_displist_free(&ob->runtime.curve_cache->disp);
|
||||
BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev);
|
||||
if (ob->runtime.curve_cache->path) {
|
||||
free_path(ob->runtime.curve_cache->path);
|
||||
}
|
||||
BKE_nurbList_free(&ob->curve_cache->deformed_nurbs);
|
||||
MEM_freeN(ob->curve_cache);
|
||||
ob->curve_cache = NULL;
|
||||
BKE_nurbList_free(&ob->runtime.curve_cache->deformed_nurbs);
|
||||
MEM_freeN(ob->runtime.curve_cache);
|
||||
ob->runtime.curve_cache = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,12 +460,12 @@ void BKE_object_free(Object *ob)
|
|||
BLI_freelistN(&ob->lodlevels);
|
||||
|
||||
/* Free runtime curves data. */
|
||||
if (ob->curve_cache) {
|
||||
BKE_curve_bevelList_free(&ob->curve_cache->bev);
|
||||
if (ob->curve_cache->path)
|
||||
free_path(ob->curve_cache->path);
|
||||
MEM_freeN(ob->curve_cache);
|
||||
ob->curve_cache = NULL;
|
||||
if (ob->runtime.curve_cache) {
|
||||
BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev);
|
||||
if (ob->runtime.curve_cache->path)
|
||||
free_path(ob->runtime.curve_cache->path);
|
||||
MEM_freeN(ob->runtime.curve_cache);
|
||||
ob->runtime.curve_cache = NULL;
|
||||
}
|
||||
|
||||
BKE_previewimg_free(&ob->preview);
|
||||
|
@ -1154,6 +1154,9 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con
|
|||
{
|
||||
ModifierData *md;
|
||||
|
||||
/* Do not copy runtime data. */
|
||||
BKE_object_runtime_reset(ob_dst);
|
||||
|
||||
/* We never handle usercount here for own data. */
|
||||
const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
|
||||
|
||||
|
@ -1212,9 +1215,6 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con
|
|||
|
||||
copy_object_lod(ob_dst, ob_src, flag_subdata);
|
||||
|
||||
/* Do not copy runtime curve data. */
|
||||
ob_dst->curve_cache = NULL;
|
||||
|
||||
/* Do not copy object's preview (mostly due to the fact renderers create temp copy of objects). */
|
||||
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0 && false) { /* XXX TODO temp hack */
|
||||
BKE_previewimg_id_copy(&ob_dst->id, &ob_src->id);
|
||||
|
@ -1725,7 +1725,7 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (par->curve_cache->path == NULL) {
|
||||
if (par->runtime.curve_cache->path == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1944,10 +1944,10 @@ static void give_parvert(Object *par, int nr, float vec[3])
|
|||
ListBase *nurb;
|
||||
|
||||
/* Unless there's some weird depsgraph failure the cache should exist. */
|
||||
BLI_assert(par->curve_cache != NULL);
|
||||
BLI_assert(par->runtime.curve_cache != NULL);
|
||||
|
||||
if (par->curve_cache->deformed_nurbs.first != NULL) {
|
||||
nurb = &par->curve_cache->deformed_nurbs;
|
||||
if (par->runtime.curve_cache->deformed_nurbs.first != NULL) {
|
||||
nurb = &par->runtime.curve_cache->deformed_nurbs;
|
||||
}
|
||||
else {
|
||||
Curve *cu = par->data;
|
||||
|
@ -1958,7 +1958,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
|
|||
}
|
||||
else if (par->type == OB_LATTICE) {
|
||||
Lattice *latt = par->data;
|
||||
DispList *dl = par->curve_cache ? BKE_displist_find(&par->curve_cache->disp, DL_VERTS) : NULL;
|
||||
DispList *dl = par->runtime.curve_cache ? BKE_displist_find(&par->runtime.curve_cache->disp, DL_VERTS) : NULL;
|
||||
float (*co)[3] = dl ? (float (*)[3])dl->verts : NULL;
|
||||
int tot;
|
||||
|
||||
|
@ -2539,10 +2539,10 @@ void BKE_object_foreach_display_point(
|
|||
func_cb(co, user_data);
|
||||
}
|
||||
}
|
||||
else if (ob->curve_cache && ob->curve_cache->disp.first) {
|
||||
else if (ob->runtime.curve_cache && ob->runtime.curve_cache->disp.first) {
|
||||
DispList *dl;
|
||||
|
||||
for (dl = ob->curve_cache->disp.first; dl; dl = dl->next) {
|
||||
for (dl = ob->runtime.curve_cache->disp.first; dl; dl = dl->next) {
|
||||
const float *v3 = dl->verts;
|
||||
int totvert = dl->nr;
|
||||
int i;
|
||||
|
|
|
@ -5547,9 +5547,6 @@ static void direct_link_object(FileData *fd, Object *ob)
|
|||
BKE_object_runtime_reset(ob);
|
||||
link_list(fd, &ob->pc_ids);
|
||||
|
||||
/* Runtime curve data */
|
||||
ob->curve_cache = NULL;
|
||||
|
||||
/* in case this value changes in future, clamp else we get undefined behavior */
|
||||
CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
|
||||
|
||||
|
|
|
@ -732,7 +732,7 @@ static void deg_backup_object_runtime(
|
|||
Object *object,
|
||||
ObjectRuntimeBackup *object_runtime_backup)
|
||||
{
|
||||
/* Store evaluated mesh, and make sure we don't free it. */
|
||||
/* Store evaluated mesh and curve_cache, and make sure we don't free it. */
|
||||
Mesh *mesh_eval = object->runtime.mesh_eval;
|
||||
object_runtime_backup->runtime = object->runtime;
|
||||
BKE_object_runtime_reset(object);
|
||||
|
@ -743,9 +743,6 @@ static void deg_backup_object_runtime(
|
|||
if (mesh_eval != NULL && object->data == mesh_eval) {
|
||||
object->data = object->runtime.mesh_orig;
|
||||
}
|
||||
/* Store curve cache and make sure we don't free it. */
|
||||
object_runtime_backup->curve_cache = object->curve_cache;
|
||||
object->curve_cache = NULL;
|
||||
/* Make a backup of base flags. */
|
||||
object_runtime_backup->base_flag = object->base_flag;
|
||||
}
|
||||
|
@ -783,9 +780,6 @@ static void deg_restore_object_runtime(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (object_runtime_backup->curve_cache != NULL) {
|
||||
object->curve_cache = object_runtime_backup->curve_cache;
|
||||
}
|
||||
object->base_flag = object_runtime_backup->base_flag;
|
||||
}
|
||||
|
||||
|
|
|
@ -2954,7 +2954,7 @@ GPUBatch *DRW_cache_curve_edge_wire_get(Object *ob)
|
|||
BLI_assert(ob->type == OB_CURVE);
|
||||
|
||||
struct Curve *cu = ob->data;
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu, ob->runtime.curve_cache);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
|
||||
|
@ -2962,7 +2962,7 @@ GPUBatch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
|
|||
BLI_assert(ob->type == OB_CURVE);
|
||||
|
||||
struct Curve *cu = ob->data;
|
||||
return DRW_curve_batch_cache_get_normal_edge(cu, ob->curve_cache, normal_size);
|
||||
return DRW_curve_batch_cache_get_normal_edge(cu, ob->runtime.curve_cache, normal_size);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_curve_edge_overlay_get(Object *ob)
|
||||
|
@ -2986,7 +2986,7 @@ GPUBatch *DRW_cache_curve_surface_get(Object *ob)
|
|||
BLI_assert(ob->type == OB_CURVE);
|
||||
|
||||
struct Curve *cu = ob->data;
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->runtime.curve_cache);
|
||||
}
|
||||
|
||||
/* Return list of batches */
|
||||
|
@ -2996,7 +2996,7 @@ GPUBatch **DRW_cache_curve_surface_shaded_get(
|
|||
BLI_assert(ob->type == OB_CURVE);
|
||||
|
||||
struct Curve *cu = ob->data;
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, ob->curve_cache, gpumat_array, gpumat_array_len);
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, ob->runtime.curve_cache, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -3032,7 +3032,7 @@ GPUBatch *DRW_cache_text_edge_wire_get(Object *ob)
|
|||
BLI_assert(ob->type == OB_FONT);
|
||||
|
||||
struct Curve *cu = ob->data;
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu, ob->runtime.curve_cache);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_text_surface_get(Object *ob)
|
||||
|
@ -3042,7 +3042,7 @@ GPUBatch *DRW_cache_text_surface_get(Object *ob)
|
|||
if (cu->editfont && (cu->flag & CU_FAST)) {
|
||||
return NULL;
|
||||
}
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->runtime.curve_cache);
|
||||
}
|
||||
|
||||
GPUBatch **DRW_cache_text_surface_shaded_get(
|
||||
|
@ -3053,7 +3053,7 @@ GPUBatch **DRW_cache_text_surface_shaded_get(
|
|||
if (cu->editfont && (cu->flag & CU_FAST)) {
|
||||
return NULL;
|
||||
}
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, ob->curve_cache, gpumat_array, gpumat_array_len);
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, ob->runtime.curve_cache, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_text_cursor_overlay_get(Object *ob)
|
||||
|
@ -3082,7 +3082,7 @@ GPUBatch *DRW_cache_surf_surface_get(Object *ob)
|
|||
BLI_assert(ob->type == OB_SURF);
|
||||
|
||||
struct Curve *cu = ob->data;
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->runtime.curve_cache);
|
||||
}
|
||||
|
||||
/* Return list of batches */
|
||||
|
@ -3092,7 +3092,7 @@ GPUBatch **DRW_cache_surf_surface_shaded_get(
|
|||
BLI_assert(ob->type == OB_SURF);
|
||||
|
||||
struct Curve *cu = ob->data;
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, ob->curve_cache, gpumat_array, gpumat_array_len);
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, ob->runtime.curve_cache, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -140,7 +140,7 @@ GPUBatch *DRW_metaball_batch_cache_get_triangles_with_normals(Object *ob)
|
|||
MetaBallBatchCache *cache = metaball_batch_cache_get(mb);
|
||||
|
||||
if (cache->batch == NULL) {
|
||||
ListBase *lb = &ob->curve_cache->disp;
|
||||
ListBase *lb = &ob->runtime.curve_cache->disp;
|
||||
cache->batch = GPU_batch_create_ex(
|
||||
GPU_PRIM_TRIS,
|
||||
DRW_displist_vertbuf_calc_pos_with_normals(lb),
|
||||
|
|
|
@ -1663,7 +1663,7 @@ static void DRW_shgroup_forcefield(OBJECT_StorageList *stl, Object *ob, ViewLaye
|
|||
}
|
||||
break;
|
||||
case PFIELD_GUIDE:
|
||||
if (cu && (cu->flag & CU_PATH) && ob->curve_cache->path && ob->curve_cache->path->data) {
|
||||
if (cu && (cu->flag & CU_PATH) && ob->runtime.curve_cache->path && ob->runtime.curve_cache->path->data) {
|
||||
where_on_path(ob, 0.0f, pd->drawvec1, tmp, NULL, NULL, NULL);
|
||||
where_on_path(ob, 1.0f, pd->drawvec2, tmp, NULL, NULL, NULL);
|
||||
}
|
||||
|
@ -1704,7 +1704,7 @@ static void DRW_shgroup_forcefield(OBJECT_StorageList *stl, Object *ob, ViewLaye
|
|||
DRW_shgroup_call_dynamic_add(stl->g_data->field_vortex, color, &pd->drawvec1, ob->obmat);
|
||||
break;
|
||||
case PFIELD_GUIDE:
|
||||
if (cu && (cu->flag & CU_PATH) && ob->curve_cache->path && ob->curve_cache->path->data) {
|
||||
if (cu && (cu->flag & CU_PATH) && ob->runtime.curve_cache->path && ob->runtime.curve_cache->path->data) {
|
||||
DRW_shgroup_call_dynamic_add(stl->g_data->field_curve_sta, color, &pd->f_strength, ob->obmat);
|
||||
DRW_shgroup_call_dynamic_add(stl->g_data->field_curve_end, color, &pd->f_strength, ob->obmat);
|
||||
}
|
||||
|
|
|
@ -6260,12 +6260,12 @@ static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
float min[3], max[3], size[3], loc[3];
|
||||
int a;
|
||||
|
||||
if (object->curve_cache == NULL) {
|
||||
if (object->runtime.curve_cache == NULL) {
|
||||
BKE_displist_make_curveTypes(depsgraph, scene, object, false);
|
||||
}
|
||||
|
||||
INIT_MINMAX(min, max);
|
||||
BKE_displist_minmax(&object->curve_cache->disp, min, max);
|
||||
BKE_displist_minmax(&object->runtime.curve_cache->disp, min, max);
|
||||
|
||||
mid_v3_v3v3(loc, min, max);
|
||||
|
||||
|
|
|
@ -1479,7 +1479,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
|
|||
|
||||
ob_dst->parent = NULL;
|
||||
BKE_constraints_free(&ob_dst->constraints);
|
||||
ob_dst->curve_cache = NULL;
|
||||
ob_dst->runtime.curve_cache = NULL;
|
||||
ob_dst->transflag &= ~OB_DUPLI;
|
||||
|
||||
copy_m4_m4(ob_dst->obmat, dob->mat);
|
||||
|
@ -1638,7 +1638,7 @@ static const EnumPropertyItem convert_target_items[] = {
|
|||
|
||||
static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Object *ob)
|
||||
{
|
||||
if (ob->curve_cache == NULL) {
|
||||
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.
|
||||
*/
|
||||
|
@ -1966,7 +1966,7 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
convert_ensure_curve_cache(depsgraph, scene, baseob);
|
||||
BKE_mesh_from_metaball(&baseob->curve_cache->disp, newob->data);
|
||||
BKE_mesh_from_metaball(&baseob->runtime.curve_cache->disp, newob->data);
|
||||
|
||||
if (obact->type == OB_MBALL) {
|
||||
basact = basen;
|
||||
|
|
|
@ -716,7 +716,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
|
|||
if (md) {
|
||||
((CurveModifierData *)md)->object = par;
|
||||
}
|
||||
if (par->curve_cache && par->curve_cache->path == NULL) {
|
||||
if (par->runtime.curve_cache && par->runtime.curve_cache->path == NULL) {
|
||||
DEG_id_tag_update(&par->id, OB_RECALC_DATA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,8 +127,8 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
|
|||
{
|
||||
int totv = 0, totf = 0, tottri = 0;
|
||||
|
||||
if (ob->curve_cache && ob->curve_cache->disp.first)
|
||||
BKE_displist_count(&ob->curve_cache->disp, &totv, &totf, &tottri);
|
||||
if (ob->runtime.curve_cache && ob->runtime.curve_cache->disp.first)
|
||||
BKE_displist_count(&ob->runtime.curve_cache->disp, &totv, &totf, &tottri);
|
||||
|
||||
totv *= totob;
|
||||
totf *= totob;
|
||||
|
|
|
@ -380,7 +380,7 @@ void lattice_foreachScreenVert(
|
|||
Object *obedit = vc->obedit;
|
||||
Lattice *lt = obedit->data;
|
||||
BPoint *bp = lt->editlatt->latt->def;
|
||||
DispList *dl = obedit->curve_cache ? BKE_displist_find(&obedit->curve_cache->disp, DL_VERTS) : NULL;
|
||||
DispList *dl = obedit->runtime.curve_cache ? BKE_displist_find(&obedit->runtime.curve_cache->disp, DL_VERTS) : NULL;
|
||||
const float *co = dl ? dl->verts : NULL;
|
||||
int i, N = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
|
||||
|
||||
|
|
|
@ -142,6 +142,10 @@ typedef struct Object_Runtime {
|
|||
* It has deforemation only modifiers applied on it.
|
||||
*/
|
||||
struct Mesh *mesh_deform_eval;
|
||||
|
||||
|
||||
/* Runtime evaluated curve-specific data, not stored in the file. */
|
||||
struct CurveCache *curve_cache;
|
||||
} Object_Runtime;
|
||||
|
||||
typedef struct Object {
|
||||
|
@ -280,9 +284,6 @@ typedef struct Object {
|
|||
uint64_t lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
|
||||
uint64_t customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
|
||||
|
||||
/* Runtime valuated curve-specific data, not stored in the file */
|
||||
struct CurveCache *curve_cache;
|
||||
|
||||
ListBase pc_ids;
|
||||
|
||||
struct RigidBodyOb *rigidbody_object; /* settings for Bullet rigid body */
|
||||
|
|
|
@ -456,9 +456,10 @@ static Mesh *arrayModifier_doArray(
|
|||
if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) {
|
||||
Curve *cu = amd->curve_ob->data;
|
||||
if (cu) {
|
||||
if (amd->curve_ob->curve_cache && amd->curve_ob->curve_cache->path) {
|
||||
CurveCache *curve_cache = amd->curve_ob->runtime.curve_cache;
|
||||
if (curve_cache != NULL && curve_cache->path != NULL) {
|
||||
float scale_fac = mat4_to_scale(amd->curve_ob->obmat);
|
||||
length = scale_fac * amd->curve_ob->curve_cache->path->totdist;
|
||||
length = scale_fac * curve_cache->path->totdist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue