Cleanup: remove unused baking struct members from soft-body

This commit is contained in:
2021-05-11 15:59:55 +10:00
parent 4226f19a03
commit 091d7336e6
5 changed files with 17 additions and 30 deletions

View File

@@ -47,7 +47,7 @@ typedef struct BodyPoint {
} BodyPoint; } BodyPoint;
/* allocates and initializes general main data */ /* allocates and initializes general main data */
extern struct SoftBody *sbNew(struct Scene *scene); extern struct SoftBody *sbNew(void);
/* frees internal data and soft-body itself */ /* frees internal data and soft-body itself */
extern void sbFree(struct Object *ob); extern void sbFree(struct Object *ob);

View File

@@ -829,13 +829,13 @@ static void calculate_collision_balls(Object *ob)
} }
/* creates new softbody if didn't exist yet, makes new points and springs arrays */ /* creates new softbody if didn't exist yet, makes new points and springs arrays */
static void renew_softbody(Scene *scene, Object *ob, int totpoint, int totspring) static void renew_softbody(Object *ob, int totpoint, int totspring)
{ {
SoftBody *sb; SoftBody *sb;
int i; int i;
short softflag; short softflag;
if (ob->soft == NULL) { if (ob->soft == NULL) {
ob->soft = sbNew(scene); ob->soft = sbNew();
} }
else { else {
free_softbody_intern(ob->soft); free_softbody_intern(ob->soft);
@@ -2679,7 +2679,7 @@ static void springs_from_mesh(Object *ob)
} }
/* makes totally fresh start situation */ /* makes totally fresh start situation */
static void mesh_to_softbody(Scene *scene, Object *ob) static void mesh_to_softbody(Object *ob)
{ {
SoftBody *sb; SoftBody *sb;
Mesh *me = ob->data; Mesh *me = ob->data;
@@ -2697,7 +2697,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
} }
/* renew ends with ob->soft with points and edges, also checks & makes ob->soft */ /* renew ends with ob->soft with points and edges, also checks & makes ob->soft */
renew_softbody(scene, ob, me->totvert, totedge); renew_softbody(ob, me->totvert, totedge);
/* we always make body points */ /* we always make body points */
sb = ob->soft; sb = ob->soft;
@@ -2909,7 +2909,7 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff, Object
} }
/* makes totally fresh start situation */ /* makes totally fresh start situation */
static void lattice_to_softbody(Scene *scene, Object *ob) static void lattice_to_softbody(Object *ob)
{ {
Lattice *lt = ob->data; Lattice *lt = ob->data;
SoftBody *sb; SoftBody *sb;
@@ -2929,7 +2929,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
} }
/* renew ends with ob->soft with points and edges, also checks & makes ob->soft */ /* renew ends with ob->soft with points and edges, also checks & makes ob->soft */
renew_softbody(scene, ob, totvert, totspring); renew_softbody(ob, totvert, totspring);
sb = ob->soft; /* can be created in renew_softbody() */ sb = ob->soft; /* can be created in renew_softbody() */
bp = sb->bpoint; bp = sb->bpoint;
@@ -2972,7 +2972,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
} }
/* makes totally fresh start situation */ /* makes totally fresh start situation */
static void curve_surf_to_softbody(Scene *scene, Object *ob) static void curve_surf_to_softbody(Object *ob)
{ {
Curve *cu = ob->data; Curve *cu = ob->data;
SoftBody *sb; SoftBody *sb;
@@ -2993,7 +2993,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
} }
/* renew ends with ob->soft with points and edges, also checks & makes ob->soft */ /* renew ends with ob->soft with points and edges, also checks & makes ob->soft */
renew_softbody(scene, ob, totvert, totspring); renew_softbody(ob, totvert, totspring);
sb = ob->soft; /* can be created in renew_softbody() */ sb = ob->soft; /* can be created in renew_softbody() */
/* set vars now */ /* set vars now */
@@ -3117,7 +3117,7 @@ static void sb_new_scratch(SoftBody *sb)
/* ************ Object level, exported functions *************** */ /* ************ Object level, exported functions *************** */
/* allocates and initializes general main data */ /* allocates and initializes general main data */
SoftBody *sbNew(Scene *scene) SoftBody *sbNew(void)
{ {
SoftBody *sb; SoftBody *sb;
@@ -3140,12 +3140,6 @@ SoftBody *sbNew(Scene *scene)
/*todo backward file compat should copy inspring to inpush while reading old files*/ /*todo backward file compat should copy inspring to inpush while reading old files*/
sb->inpush = 0.5f; sb->inpush = 0.5f;
sb->interval = 10;
if (scene != NULL) {
sb->sfra = scene->r.sfra;
sb->efra = scene->r.efra;
}
sb->colball = 0.49f; sb->colball = 0.49f;
sb->balldamp = 0.50f; sb->balldamp = 0.50f;
sb->ballstiff = 1.0f; sb->ballstiff = 1.0f;
@@ -3577,17 +3571,17 @@ void sbObjectStep(struct Depsgraph *depsgraph,
switch (ob->type) { switch (ob->type) {
case OB_MESH: case OB_MESH:
mesh_to_softbody(scene, ob); mesh_to_softbody(ob);
break; break;
case OB_LATTICE: case OB_LATTICE:
lattice_to_softbody(scene, ob); lattice_to_softbody(ob);
break; break;
case OB_CURVE: case OB_CURVE:
case OB_SURF: case OB_SURF:
curve_surf_to_softbody(scene, ob); curve_surf_to_softbody(ob);
break; break;
default: default:
renew_softbody(scene, ob, numVerts, 0); renew_softbody(ob, numVerts, 0);
break; break;
} }

View File

@@ -1278,12 +1278,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (ob->soft->physics_speed == 0.0f) { if (ob->soft->physics_speed == 0.0f) {
ob->soft->physics_speed = 1.0f; ob->soft->physics_speed = 1.0f;
} }
if (ob->soft->interval == 0) {
ob->soft->interval = 2;
ob->soft->sfra = 1;
ob->soft->efra = 100;
}
} }
if (ob->soft && ob->soft->vertgroup == 0) { if (ob->soft && ob->soft->vertgroup == 0) {
bDeformGroup *locGroup = BKE_object_defgroup_find_name(ob, "SOFTGOAL"); bDeformGroup *locGroup = BKE_object_defgroup_find_name(ob, "SOFTGOAL");

View File

@@ -210,7 +210,7 @@ ModifierData *ED_object_modifier_add(
/* special cases */ /* special cases */
if (type == eModifierType_Softbody) { if (type == eModifierType_Softbody) {
if (!ob->soft) { if (!ob->soft) {
ob->soft = sbNew(scene); ob->soft = sbNew();
ob->softflag |= OB_SB_GOAL | OB_SB_EDGES; ob->softflag |= OB_SB_GOAL | OB_SB_EDGES;
} }
} }

View File

@@ -267,10 +267,9 @@ typedef struct SoftBody {
char namedVG_Spring_K[64]; char namedVG_Spring_K[64];
/* baking */ /* baking */
int sfra, efra; char _pad1[6];
int interval;
/** Local==1: use local coords for baking. */ /** Local==1: use local coords for baking. */
short local, solverflags; char local, solverflags;
/* -- these must be kept for backwards compatibility -- */ /* -- these must be kept for backwards compatibility -- */
/** Array of size totpointkey. */ /** Array of size totpointkey. */