[Bf-blender-cvs] [a3b6ae9fb9d] blender2.8: Cleanup/Refactor: Move CurveCache runtime data into Object.runtime struct.
Bastien Montagne
noreply at git.blender.org
Mon Jul 30 16:59:05 CEST 2018
Commit: a3b6ae9fb9dd76538ec04b9fa6953490d321dd32
Author: Bastien Montagne
Date: Mon Jul 30 16:54:40 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa3b6ae9fb9dd76538ec04b9fa6953490d321dd32
Cleanup/Refactor: Move CurveCache runtime data into Object.runtime struct.
Also, fix missing cleanup of Object.runtime when copying Object
datablocks!
===================================================================
M source/blender/alembic/intern/abc_mball.cc
M source/blender/alembic/intern/abc_nurbs.cc
M source/blender/blenkernel/intern/anim.c
M source/blender/blenkernel/intern/armature_update.c
M source/blender/blenkernel/intern/cdderivedmesh.c
M source/blender/blenkernel/intern/constraint.c
M source/blender/blenkernel/intern/curve.c
M source/blender/blenkernel/intern/displist.c
M source/blender/blenkernel/intern/effect.c
M source/blender/blenkernel/intern/font.c
M source/blender/blenkernel/intern/lattice.c
M source/blender/blenkernel/intern/material.c
M source/blender/blenkernel/intern/mball.c
M source/blender/blenkernel/intern/mesh_convert.c
M source/blender/blenkernel/intern/object.c
M source/blender/blenloader/intern/readfile.c
M source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M source/blender/draw/intern/draw_cache.c
M source/blender/draw/intern/draw_cache_impl_metaball.c
M source/blender/draw/modes/object_mode.c
M source/blender/editors/curve/editcurve.c
M source/blender/editors/object/object_add.c
M source/blender/editors/object/object_relations.c
M source/blender/editors/space_info/info_stats.c
M source/blender/editors/space_view3d/view3d_iterators.c
M source/blender/makesdna/DNA_object_types.h
M source/blender/modifiers/intern/MOD_array.c
===================================================================
diff --git a/source/blender/alembic/intern/abc_mball.cc b/source/blender/alembic/intern/abc_mball.cc
index d6e54407922..62ab561274a 100644
--- a/source/blender/alembic/intern/abc_mball.cc
+++ b/source/blender/alembic/intern/abc_mball.cc
@@ -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");
diff --git a/source/blender/alembic/intern/abc_nurbs.cc b/source/blender/alembic/intern/abc_nurbs.cc
index 95d06fc5efe..bf41b44e418 100644
--- a/source/blender/alembic/intern/abc_nurbs.cc
+++ b/source/blender/alembic/intern/abc_nurbs.cc
@@ -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);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index a867accfe44..7df889d22b2 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index 628f92c7803..26fbd22c67e 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -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
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 72a1f941c26..3f50321b4d5 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 5aa192d527a..ef412f0006e 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 33a24f77937..39b28540205 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 34fd32b2908..562e2257ea0 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -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->curv
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list