diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index ab5e50d9440..42e2145fcdf 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -115,7 +115,6 @@ static float sb_fric_force_scale(Object *ob) static float sb_time_scale(Object *ob) // defining the frames to *real* time relation { -/* SoftBody *sb= ob->soft; // is supposed to be there if (sb){ return(sb->physics_speed); //hrms .. this could be IPO as well :) @@ -123,13 +122,12 @@ static float sb_time_scale(Object *ob) // 1 approx = a unit 1 pendulum at g = 9.8 [earth conditions] has period 65 frames // theory would give a 50 frames period .. so there must be something inaccurate .. looking for that (BM) } -*/ return (1.0f); -/* -this would be frames/sec independant timing assuming 25 fps is default -but does not work very well with NLA - return (25.0f/G.scene->r.frs_sec) -*/ + /* + this would be frames/sec independant timing assuming 25 fps is default + but does not work very well with NLA + return (25.0f/G.scene->r.frs_sec) + */ } /*--- frame based timing ---*/ @@ -1024,6 +1022,7 @@ SoftBody *sbNew(void) sb->mediafrict= 0.5; sb->nodemass= 1.0; sb->grav= 0.0; + sb->physics_speed= 1.0; sb->goalspring= 0.5; sb->goalfrict= 0.0; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f2db3d25621..38b88d0ccf4 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4223,8 +4223,6 @@ static void do_versions(Main *main) ma->param[1]= 0.1; ma->param[2]= 0.1; ma->param[3]= 0.05; - ma->rms=0.1; - ma->darkness=1.0; } // patch for old wrong max view2d settings, allows zooming out more for (sc= main->screen.first; sc; sc= sc->id.next) { @@ -4687,10 +4685,12 @@ static void do_versions(Main *main) sb->maxgoal= ob->sb_maxgoal; sb->mediafrict= ob->sb_mediafrict; sb->rklimit= ob->softtime; - sb->defgoal= 0.7; - ob->softflag |= OB_SB_GOAL|OB_SB_EDGES; } + if(ob->soft) { + if(ob->soft->defgoal==0.0) ob->soft->defgoal= 0.7; + if(ob->soft->physics_speed==0.0) ob->soft->physics_speed= 1.0; + } if(ob->soft && ob->soft->vertgroup==0) { bDeformGroup *locGroup = get_named_vertexgroup(ob, "SOFTGOAL"); if(locGroup){ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 2998e1f9d68..d04e342de21 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -120,13 +120,14 @@ typedef struct SoftBody { float grav; /* softbody amount of gravitaion to apply */ float mediafrict; /* friction to env */ float rklimit; /* error limit for ODE solver */ + float physics_speed;/* user control over simulation speed */ float goalspring; /* softbody goal springs */ float goalfrict; /* softbody goal springs friction */ float mingoal; /* quick limits for goal */ float maxgoal; - short vertgroup; /* index starting at 1 */ - short pad1, pad2, pad3; + short vertgroup; /* index starting at 1 */ + short pad1; float inspring; /* softbody inner springs */ float infrict; /* softbody inner springs friction */ diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index ceaeff9221b..ed4b1337ab4 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -1509,8 +1509,9 @@ static void object_softbodies(Object *ob) uiBlockBeginAlign(block); uiDefButF(block, NUM, B_DIFF, "Friction:", 10, 170,150,20, &sb->mediafrict, 0.0, 10.0, 10, 0, "General Friction for point movements"); uiDefButF(block, NUM, B_DIFF, "Mass:", 160, 170,150,20, &sb->nodemass , 0.001, 50.0, 10, 0, "Point Mass, the heavier the slower"); - uiDefButF(block, NUM, B_DIFF, "Grav:", 10,150,150,20, &sb->grav , 0.0, 10.0, 10, 0, "Apply gravitation to point movement"); - uiDefButF(block, NUM, B_DIFF, "RKL:", 160,150,150,20, &sb->rklimit , 0.01, 1.0, 10, 0, "Runge-Kutta ODE solver error limit"); + uiDefButF(block, NUM, B_DIFF, "Grav:", 10,150,100,20, &sb->grav , 0.0, 10.0, 10, 0, "Apply gravitation to point movement"); + uiDefButF(block, NUM, B_DIFF, "RKL:", 110,150,100,20, &sb->rklimit , 0.01, 1.0, 10, 0, "Runge-Kutta ODE solver error limit"); + uiDefButF(block, NUM, B_DIFF, "Time:", 210,150,100,20, &sb->physics_speed , 0.01, 100.0, 10, 0, "Tweak timing for physics to control frequency and speed"); uiDefButBitS(block, TOG, OB_SB_POSTDEF, B_DIFF, "PostDef", 10,130,300,20, &ob->softflag, 0, 0, 0, 0, "Apply Soft AFTER Deform"); uiBlockEndAlign(block); diff --git a/source/blender/src/editmesh_add.c b/source/blender/src/editmesh_add.c index e37382a3d38..b61f02a5032 100644 --- a/source/blender/src/editmesh_add.c +++ b/source/blender/src/editmesh_add.c @@ -829,20 +829,19 @@ void add_primitiveMesh(int type) MEM_freeN(tv); /* and now do imat */ - eve= em->verts.first; - while(eve) { + for(eve= em->verts.first; eve; eve= eve->next) { if(eve->f & SELECT) { VecAddf(eve->co,eve->co,cent); Mat3MulVecfl(imat,eve->co); } - eve= eve->next; } + recalc_editnormals(); } // simple selection flush OK, based on fact it's a single model EM_select_flush(); // flushes vertex -> edge -> face selection - if(type!=0 && type!=10) righthandfaces(1); + if(type!=0 && type!=10 && type!=13) righthandfaces(1); // otherwise monkey has eyes in wrong direction... countall(); allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */