[Bf-blender-cvs] [091d7336e6c] master: Cleanup: remove unused baking struct members from soft-body

Campbell Barton noreply at git.blender.org
Tue May 11 08:02:38 CEST 2021


Commit: 091d7336e6c0d6d2ed65c632f09fc1455caf5d15
Author: Campbell Barton
Date:   Tue May 11 15:59:55 2021 +1000
Branches: master
https://developer.blender.org/rB091d7336e6c0d6d2ed65c632f09fc1455caf5d15

Cleanup: remove unused baking struct members from soft-body

===================================================================

M	source/blender/blenkernel/BKE_softbody.h
M	source/blender/blenkernel/intern/softbody.c
M	source/blender/blenloader/intern/versioning_legacy.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/makesdna/DNA_object_force_types.h

===================================================================

diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h
index 4f8b21141b6..58dc90f62dc 100644
--- a/source/blender/blenkernel/BKE_softbody.h
+++ b/source/blender/blenkernel/BKE_softbody.h
@@ -47,7 +47,7 @@ typedef struct BodyPoint {
 } BodyPoint;
 
 /* 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 */
 extern void sbFree(struct Object *ob);
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 3b1230ce3b6..fcc1afbc59b 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -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 */
-static void renew_softbody(Scene *scene, Object *ob, int totpoint, int totspring)
+static void renew_softbody(Object *ob, int totpoint, int totspring)
 {
   SoftBody *sb;
   int i;
   short softflag;
   if (ob->soft == NULL) {
-    ob->soft = sbNew(scene);
+    ob->soft = sbNew();
   }
   else {
     free_softbody_intern(ob->soft);
@@ -2679,7 +2679,7 @@ static void springs_from_mesh(Object *ob)
 }
 
 /* makes totally fresh start situation */
-static void mesh_to_softbody(Scene *scene, Object *ob)
+static void mesh_to_softbody(Object *ob)
 {
   SoftBody *sb;
   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_softbody(scene, ob, me->totvert, totedge);
+  renew_softbody(ob, me->totvert, totedge);
 
   /* we always make body points */
   sb = ob->soft;
@@ -2909,7 +2909,7 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff, Object
 }
 
 /* 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;
   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_softbody(scene, ob, totvert, totspring);
+  renew_softbody(ob, totvert, totspring);
   sb = ob->soft; /* can be created in renew_softbody() */
   bp = sb->bpoint;
 
@@ -2972,7 +2972,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
 }
 
 /* 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;
   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_softbody(scene, ob, totvert, totspring);
+  renew_softbody(ob, totvert, totspring);
   sb = ob->soft; /* can be created in renew_softbody() */
 
   /* set vars now */
@@ -3117,7 +3117,7 @@ static void sb_new_scratch(SoftBody *sb)
 /* ************ Object level, exported functions *************** */
 
 /* allocates and initializes general main data */
-SoftBody *sbNew(Scene *scene)
+SoftBody *sbNew(void)
 {
   SoftBody *sb;
 
@@ -3140,12 +3140,6 @@ SoftBody *sbNew(Scene *scene)
   /*todo backward file compat should copy inspring to inpush while reading old files*/
   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->balldamp = 0.50f;
   sb->ballstiff = 1.0f;
@@ -3577,17 +3571,17 @@ void sbObjectStep(struct Depsgraph *depsgraph,
 
     switch (ob->type) {
       case OB_MESH:
-        mesh_to_softbody(scene, ob);
+        mesh_to_softbody(ob);
         break;
       case OB_LATTICE:
-        lattice_to_softbody(scene, ob);
+        lattice_to_softbody(ob);
         break;
       case OB_CURVE:
       case OB_SURF:
-        curve_surf_to_softbody(scene, ob);
+        curve_surf_to_softbody(ob);
         break;
       default:
-        renew_softbody(scene, ob, numVerts, 0);
+        renew_softbody(ob, numVerts, 0);
         break;
     }
 
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index f2e73e161ca..56b2f18f8a6 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -1278,12 +1278,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
         if (ob->soft->physics_speed == 0.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) {
         bDeformGroup *locGroup = BKE_object_defgroup_find_name(ob, "SOFTGOAL");
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 0d896f14888..e71b66b1a72 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -210,7 +210,7 @@ ModifierData *ED_object_modifier_add(
     /* special cases */
     if (type == eModifierType_Softbody) {
       if (!ob->soft) {
-        ob->soft = sbNew(scene);
+        ob->soft = sbNew();
         ob->softflag |= OB_SB_GOAL | OB_SB_EDGES;
       }
     }
diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h
index 37013f5b4d6..4673e61126b 100644
--- a/source/blender/makesdna/DNA_object_force_types.h
+++ b/source/blender/makesdna/DNA_object_force_types.h
@@ -267,10 +267,9 @@ typedef struct SoftBody {
   char namedVG_Spring_K[64];
 
   /* baking */
-  int sfra, efra;
-  int interval;
+  char _pad1[6];
   /** Local==1: use local coords for baking. */
-  short local, solverflags;
+  char local, solverflags;
 
   /* -- these must be kept for backwards compatibility -- */
   /** Array of size totpointkey. */



More information about the Bf-blender-cvs mailing list