Added more dependencies to softbody, for correct recalc
authorTon Roosendaal <ton@blender.org>
Sun, 3 Apr 2005 16:57:16 +0000 (16:57 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 3 Apr 2005 16:57:16 +0000 (16:57 +0000)
For example; subsurfed softbody after play anim (ALT+A) didn't get
cleared correctly. Darn where_is_object stuff!

source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/softbody.c
source/blender/src/drawview.c

index ba7d49af293ea49d873b4f233266a9b80e1b8b7e..61eb514292b36688da9089611e4dae720195c4c7 100644 (file)
@@ -241,7 +241,7 @@ int mesh_modifier(Object *ob, char mode)
        else if(ob->effect.first);      // weak... particles too
        else if(ob->parent && ob->parent->type==OB_LATTICE);
        else if(ob->parent && ob->partype==PARSKEL); 
-       else if(ob->softflag & 0x01);
+       else if(ob->softflag & OB_SB_ENABLE);
        else return 0;
        
        if(me->totvert==0) return 0;
index faff4d81712a071c79deb4b035cb3f696f82e90a..7602bcb48e66c5a03d6ffcc93734dba1bc91ee30 100644 (file)
@@ -2373,6 +2373,8 @@ void test_all_displists(void)
                                        freedisp= 1;
                                else if ((ob->parent->type==OB_ARMATURE) && (ob->partype == PARSKEL))
                                        makedisp= 1;
+                               else if(ob->softflag & OB_SB_ENABLE)
+                                       makedisp= 1;
                                else if ((ob->parent->type==OB_CURVE) && (ob->partype == PARSKEL))
                                        freedisp= 1;
                                else if(ob->partype==PARVERT1 || ob->partype==PARVERT3) {
index 4342e5b3c8dcc8736964a9c01462d787f59802f1..23ec5c5b08db5a8eb1273a513db3d5b37cc3ee65 100644 (file)
@@ -1277,7 +1277,7 @@ void where_is_object_time(Object *ob, float ctime)
        
        /* new version: correct parent+vertexparent and track+parent */
        /* this one only calculates direct attached parent and track */
-       /* hij is sneller, maar moet wel de timeoffs in de gaten houden */
+       /* is faster, but should keep track of timeoffs */
        
        if(ob==0) return;
 
index e8051db4c3378279f361f8078247a7cc3915e934..4086de11aef78eec85c0a6510f7a67997fa6d8a9 100644 (file)
@@ -653,7 +653,7 @@ static void mesh_update_softbody(Object *ob)
                        if(ob->soft->bspring==NULL) 
                                if(object_has_edges(ob)) sbObjectToSoftbody(ob);
                
-                       /* hrms .. do springs alter their lenght ?
+                       /* hrms .. do springs alter their lenght ? (yes, mesh keys would (ton))
                        if(medge) {
                                bs= ob->soft->bspring;
                                bp= ob->soft->bpoint;
@@ -966,8 +966,14 @@ void sbObjectReset(Object *ob)
                // origS is previous timestep
                VECCOPY(bp->origS, bp->origE);
                VECCOPY(bp->pos, bp->origE);
+               VECCOPY(bp->origT, bp->origE);
                bp->vec[0]= bp->vec[1]= bp->vec[2]= 0.0f;
+
                // no idea about the Heun stuff! (ton)
+               VECCOPY(bp->prevpos, bp->vec);
+               VECCOPY(bp->prevvec, bp->vec);
+               VECCOPY(bp->prevdx, bp->vec);
+               VECCOPY(bp->prevdv, bp->vec);
        }
 }
 
index 742ff09d72f567e2409e0903fa19d1566a2ecc1d..2b6e3ea397b21bdde4c9839c1e51eb680d5afad2 100644 (file)
@@ -2348,6 +2348,7 @@ void inner_play_anim_loop(int init, int mode)
  * - 3: all view3d and seq areas, no replay */
 int play_anim(int mode)
 {
+       Base *base;
        ScrArea *sa, *oldsa;
        int cfraont;
        unsigned short event=0;
@@ -2410,7 +2411,13 @@ int play_anim(int mode)
        do_all_ipos();
        do_all_keys();
        do_all_actions();
-       do_all_ikas();
+
+       /* set all objects on current frame... test_all_displists() needs it */
+       base= G.scene->base.first;
+       while(base) {
+               if(G.vd->lay & base->lay) where_is_object(base->object);
+               base= base->next;
+       }
        test_all_displists();
        
        audiostream_stop();