Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Ole Wund <bjornmose@gmx.net>2010-03-10 02:30:32 +0300
committerJens Ole Wund <bjornmose@gmx.net>2010-03-10 02:30:32 +0300
commit2df08632cd05f081d3673dd6bc433e4f0c3a7b08 (patch)
tree1aa3d6a7563c00e566a022c62c926017b988ecea /source/blender/blenkernel/intern/softbody.c
parenta999e24a14bb9cd474feb1a1a0a85bd056d29d95 (diff)
softbody.c / preparing 2.5 / animate all ..
still not happy with it loads of issues .. anyone like to join Ulysses?
Diffstat (limited to 'source/blender/blenkernel/intern/softbody.c')
-rw-r--r--source/blender/blenkernel/intern/softbody.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 343d11a2f34..09f7f32bc12 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3223,6 +3223,39 @@ static void springs_from_mesh(Object *ob)
}
+
+/* helper functions for everything is animateble jow_go_for2_5 +++++++*/
+/* introducing them here, because i know: steps in properties ( at frame timing )
+ will cause unwanted responses of the softbody system (which does inter frame calculations )
+ so first 'cure' would be: interpolate linear in time ..
+ Q: why do i write this?
+ A: because it happend once, that some eger coder 'streamlined' code to fail.
+ We DO linear interpolation for goals .. and i think we should do on animated properties as well
+*/
+static float _goalfac(SoftBody *sb)/*jow_go_for2_5 */
+{
+ if (sb){
+ return ABS(sb->maxgoal - sb->mingoal);
+ }
+ printf("_goalfac failed! sb==NULL \n" );
+ return -9999.99f; /*using crude but spot able values some times helps debuggin */
+}
+
+
+static float _final_goal(SoftBody *sb,BodyPoint *bp)/*jow_go_for2_5 */
+{
+ float f = -1999.99f;
+ if (sb && bp){
+ if (bp->goal < 0.0f) return (0.0f);
+ f = pow(_goalfac(sb), 4.0f);
+ return (bp->goal *f);
+ }
+ printf("_final_goal failed! sb or bp ==NULL \n" );
+ return f; /*using crude but spot able values some times helps debuggin */
+}
+/* helper functions for everything is animateble jow_go_for2_5 ------*/
+
+
/* makes totally fresh start situation */
static void mesh_to_softbody(Scene *scene, Object *ob)
{
@@ -3242,8 +3275,8 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
/* we always make body points */
sb= ob->soft;
bp= sb->bpoint;
- /* should go to sb->scratch so we can pick it up at frame level thanks_a_TON*/
- goalfac= ABS(sb->maxgoal - sb->mingoal);
+ /*pick it from _goalfac jow_go_for2_5*/
+ goalfac= _goalfac(sb);
for(a=0; a<me->totvert; a++, bp++) {
/* get scalar values needed *per vertex* from vertex group functions,
@@ -3257,14 +3290,13 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
get_scalar_from_vertexgroup(ob, a,(short) (sb->vertgroup-1), &bp->goal);
/* do this always, regardless successfull read from vertex group */
- /* this is where '2.5 every thing is animateable' goes wrong in the first place thanks_a_TON */
- /* don't ask me for evidence .. i might track to the very commit */
+ /* this is where '2.5 every thing is animateable' goes wrong in the first place jow_go_for2_5 */
/* 1st coding action to take : move this to frame level */
/* reads: leave the bp->goal as it was read from vertex group / or default .. we will need it at per frame call */
- bp->goal= sb->mingoal + bp->goal*goalfac; /* do not do here thanks_a_TON */
+ bp->goal= sb->mingoal + bp->goal*goalfac; /* do not do here jow_go_for2_5 */
}
/* a little ad hoc changing the goal control to be less *sharp* */
- bp->goal = (float)pow(bp->goal, 4.0f);/* do not do here thanks_a_TON */
+ bp->goal = (float)pow(bp->goal, 4.0f);/* do not do here jow_go_for2_5 */
/* to proove the concept
this would enable per vertex *mass painting*