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:
authorTon Roosendaal <ton@blender.org>2005-05-02 17:28:13 +0400
committerTon Roosendaal <ton@blender.org>2005-05-02 17:28:13 +0400
commit42126cb5fcceda5485d02af7efbfe996b4aae160 (patch)
tree12dfc4c41f600ca481a50be691e9fe0058d741fc
parent2606a5c5d37e6460066dae78e88d47fde6552c65 (diff)
Added baking for softbodies.
Works as follows; - press the 'show bake settings' button (no space left... :) - define start/end frame for bake, and an interval step. The baked result interpolates nicely (Bspline, 4 keys) so in general a step size of 2 or 3 still gives OK results. - Press "BAKE". This will do a full animation + playback. Press ESC if it you don't want it. Once Baked, the BAKE button becomes a FREE BAKE. As reminder the softbody buttons get blocked with error() menu. This saves OK in a file. Renders any frame, including fields and moblur. You can also set a "Timeoffs" for the softbody. And yes, this should be in the NLA once... :) NOTE! With this commit, files saved with the old (first commit) version by Jens Ole won't read the settings back... he stored all sofbody variables in Object, which was moved to a new struct when I did my first commit on SB (over a month ago) Also note that I moved particle deflecting & softbody to a new include.
-rw-r--r--source/blender/blenkernel/intern/deform.c1
-rw-r--r--source/blender/blenkernel/intern/displist.c1
-rw-r--r--source/blender/blenkernel/intern/effect.c1
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/object.c1
-rw-r--r--source/blender/blenkernel/intern/softbody.c143
-rw-r--r--source/blender/blenloader/intern/readfile.c93
-rw-r--r--source/blender/blenloader/intern/writefile.c61
-rw-r--r--source/blender/include/butspace.h6
-rw-r--r--source/blender/makesdna/DNA_object_force.h126
-rw-r--r--source/blender/makesdna/DNA_object_types.h89
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
-rw-r--r--source/blender/python/api2_2x/Object.c5
-rw-r--r--source/blender/renderconverter/intern/convertBlenderScene.c15
-rw-r--r--source/blender/src/buttons_editing.c1
-rw-r--r--source/blender/src/buttons_object.c164
-rw-r--r--source/blender/src/drawobject.c1
-rw-r--r--source/blender/src/editobject.c1
-rw-r--r--source/blender/src/interface.c14
-rw-r--r--source/blender/src/space.c2
-rw-r--r--source/blender/src/vpaint.c1
21 files changed, 517 insertions, 213 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 61eb514292b..226a1d602b7 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -46,6 +46,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_scene_types.h"
#include "BKE_curve.h"
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 54fffdac28f..26b05381e1b 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -52,6 +52,7 @@
#include "DNA_listBase.h"
#include "DNA_lamp_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 137feb88046..ac28caec12b 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -39,6 +39,7 @@
#include "DNA_listBase.h"
#include "DNA_effect_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 63db6820085..e8043692950 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -52,10 +52,12 @@
#include "DNA_texture_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_mesh_types.h"
#include "DNA_curve_types.h"
#include "DNA_ipo_types.h"
#include "DNA_action_types.h"
+
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 8f0fe797183..69f21018562 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -56,6 +56,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_oops_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 0b78ead13c8..ec60e341c33 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -60,6 +60,8 @@ variables on the UI for now
/* types */
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h" /* here is the softbody struct */
+#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_lattice_types.h"
@@ -71,6 +73,7 @@ variables on the UI for now
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_global.h"
+#include "BKE_key.h"
#include "BKE_object.h"
#include "BKE_softbody.h"
#include "BKE_utildefines.h"
@@ -261,6 +264,22 @@ static void renew_softbody(Object *ob, int totpoint, int totspring)
}
}
+static void free_softbody_baked(SoftBody *sb)
+{
+ SBVertex *key;
+ int k;
+
+ for(k=0; k<sb->totkey; k++) {
+ key= *(sb->keys + k);
+ if(key) MEM_freeN(key);
+ }
+ if(sb->keys) MEM_freeN(sb->keys);
+
+ sb->keys= NULL;
+ sb->totkey= 0;
+
+}
+
/* only frees internal data */
static void free_softbody_intern(SoftBody *sb)
{
@@ -283,6 +302,8 @@ static void free_softbody_intern(SoftBody *sb)
sb->totpoint= sb->totspring= 0;
sb->bpoint= NULL;
sb->bspring= NULL;
+
+ free_softbody_baked(sb);
}
}
@@ -752,7 +773,7 @@ static void mesh_update_softbody(Object *ob)
int a;
/* possible after a file read... */
- if(ob->soft->totpoint!=me->totvert) sbObjectToSoftbody(ob);
+ if(ob->soft->bpoint==NULL) sbObjectToSoftbody(ob);
if(me->totvert) {
@@ -951,7 +972,7 @@ static void lattice_update_softbody(Object *ob)
totvert= lt->pntsu*lt->pntsv*lt->pntsw;
/* possible after a file read... */
- if(ob->soft->totpoint!=totvert) sbObjectToSoftbody(ob);
+ if(ob->soft->bpoint==NULL) sbObjectToSoftbody(ob);
for(a= totvert, bp= lt->def, bop= ob->soft->bpoint; a>0; a--, bp++, bop++) {
VECCOPY(bop->origS, bop->origE);
@@ -999,7 +1020,110 @@ static void object_update_softbody(Object *ob)
}
+/* return 1 if succesfully baked and applied step */
+static int softbody_baked_step(Object *ob, float framenr)
+{
+ SoftBody *sb= ob->soft;
+ SBVertex *key0, *key1, *key2, *key3;
+ BodyPoint *bp;
+ float data[4], sfra, efra, cfra, dfra, fac; // start, end, current, delta
+ int ofs1, a;
+
+ /* precondition check */
+ if(sb==NULL || sb->keys==NULL || sb->totkey==0) return 0;
+ /* so we got keys, but no bodypoints... even without simul we need it for the bake */
+ if(sb->bpoint==NULL) sb->bpoint= MEM_callocN( sb->totpoint*sizeof(BodyPoint), "bodypoint");
+
+ /* convert cfra time to system time */
+ sfra= (float)sb->sfra;
+ cfra= bsystem_time(ob, NULL, framenr, 0.0);
+ efra= (float)sb->efra;
+ dfra= (float)sb->interval;
+ /* offset in keys array */
+ ofs1= floor( (cfra-sfra)/dfra );
+
+ if(ofs1 < 0) {
+ key0=key1=key2=key3= *sb->keys;
+ }
+ else if(ofs1 >= sb->totkey-1) {
+ key0=key1=key2=key3= *(sb->keys+sb->totkey-1);
+ }
+ else {
+ key1= *(sb->keys+ofs1);
+ key2= *(sb->keys+ofs1+1);
+
+ if(ofs1>0) key0= *(sb->keys+ofs1-1);
+ else key0= key1;
+ if(ofs1<sb->totkey-1) key3= *(sb->keys+ofs1+1);
+ else key3= key2;
+ }
+
+ sb->ctime= cfra; // needed?
+
+ /* timing */
+ fac= ((cfra-sfra)/dfra) - (float)ofs1;
+ CLAMP(fac, 0.0, 1.0);
+ set_four_ipo(fac, data, KEY_BSPLINE);
+
+ for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++, key0++, key1++, key2++, key3++) {
+ bp->pos[0]= data[0]*key0->vec[0] + data[1]*key1->vec[0] + data[2]*key2->vec[0] + data[3]*key3->vec[0];
+ bp->pos[1]= data[0]*key0->vec[1] + data[1]*key1->vec[1] + data[2]*key2->vec[1] + data[3]*key3->vec[1];
+ bp->pos[2]= data[0]*key0->vec[2] + data[1]*key1->vec[2] + data[2]*key2->vec[2] + data[3]*key3->vec[2];
+ }
+
+ softbody_to_object(ob);
+
+ return 1;
+}
+
+/* only gets called after succesfully doing softbody_step */
+/* already checked for OB_SB_BAKE flag */
+static void softbody_baked_add(Object *ob, float framenr)
+{
+ SoftBody *sb= ob->soft;
+ SBVertex *key;
+ BodyPoint *bp;
+ float sfra, efra, cfra, dfra, fac1; // start, end, current, delta
+ int ofs1, a;
+
+ /* convert cfra time to system time */
+ sfra= (float)sb->sfra;
+ cfra= bsystem_time(ob, NULL, framenr, 0.0);
+ efra= (float)sb->efra;
+ dfra= (float)sb->interval;
+
+ if(sb->totkey==0) {
+ if(sb->sfra >= sb->efra) return; // safety, UI or py setting allows
+ if(sb->interval<1) sb->interval= 1; // just be sure
+
+ sb->totkey= 1 + (int)(ceil( (efra-sfra)/dfra ) );
+ sb->keys= MEM_callocN( sizeof(void *)*sb->totkey, "sb keys");
+ }
+
+ /* now find out if we have to store a key */
+
+ /* offset in keys array */
+ if(cfra==efra) {
+ ofs1= sb->totkey-1;
+ fac1= 0.0;
+ }
+ else {
+ ofs1= floor( (cfra-sfra)/dfra );
+ fac1= ((cfra-sfra)/dfra) - (float)ofs1;
+ }
+ if( fac1 < 1.0/dfra ) {
+
+ key= *(sb->keys+ofs1);
+ if(key == NULL) {
+ *(sb->keys+ofs1)= key= MEM_mallocN(sb->totpoint*sizeof(SBVertex), "softbody key");
+
+ for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++, key++) {
+ VECCOPY(key->vec, bp->pos);
+ }
+ }
+ }
+}
/* ************ Object level, exported functions *************** */
@@ -1025,6 +1149,10 @@ SoftBody *sbNew(void)
sb->inspring= 0.5;
sb->infrict= 0.5;
+ sb->interval= 10;
+ sb->sfra= G.scene->r.sfra;
+ sb->efra= G.scene->r.efra;
+
return sb;
}
@@ -1098,10 +1226,14 @@ void sbObjectStep(Object *ob, float framenr)
vertices in lattice (ton) */
if(G.moving) return;
+ /* baking works with global time */
+ if(!(ob->softflag & OB_SB_BAKEDO) )
+ if(softbody_baked_step(ob, framenr) ) return;
+
/* remake softbody if: */
if( (ob->softflag & OB_SB_REDO) || // signal after weightpainting
(ob->soft==NULL) || // just to be nice we allow full init
- (ob->soft->totpoint==0) ) // after reading new file, or acceptable as signal to refresh
+ (ob->soft->bpoint==NULL) ) // after reading new file, or acceptable as signal to refresh
sbObjectToSoftbody(ob);
sb= ob->soft;
@@ -1113,12 +1245,12 @@ void sbObjectStep(Object *ob, float framenr)
for(base= G.scene->base.first; base; base= base->next) {
base->object->sumohandle= NULL;
}
-
+
/* checking time: */
ctime= bsystem_time(ob, NULL, framenr, 0.0);
dtime= ctime - sb->ctime;
// bail out for negative or for large steps
- if(dtime<0.0 || dtime >= 9.9*G.scene->r.framelen) { // note: what is G.scene->r.framelen for ? (BM)
+ if(dtime<0.0 || dtime >= 9.9*G.scene->r.framelen) { // G.scene->r.framelen corrects for frame-mapping, so this is actually 10 frames for UI
sbObjectReset(ob);
return;
}
@@ -1246,5 +1378,6 @@ void sbObjectStep(Object *ob, float framenr)
}
}
+ if(ob->softflag & OB_SB_BAKEDO) softbody_baked_add(ob, framenr);
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a3d9e0e1202..32bd71c9c9f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -59,45 +59,47 @@
#include "nla.h"
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
#include "DNA_ID.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_property_types.h"
#include "DNA_actuator_types.h"
+#include "DNA_camera_types.h"
#include "DNA_controller_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_sdna_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_sequence_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_effect_types.h"
+#include "DNA_fileglobal_types.h"
+#include "DNA_group_types.h"
+#include "DNA_ipo_types.h"
#include "DNA_ika_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_texture_types.h"
+#include "DNA_image_types.h"
#include "DNA_key_types.h"
-#include "DNA_meta_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_lamp_types.h"
-#include "DNA_object_types.h"
-#include "DNA_world_types.h"
-#include "DNA_ipo_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
-#include "DNA_image_types.h"
-#include "DNA_material_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_effect_types.h"
+#include "DNA_nla_types.h"
+#include "DNA_object_types.h"
+#include "DNA_object_force.h"
+#include "DNA_oops_types.h"
+#include "DNA_object_force.h"
+#include "DNA_packedFile_types.h"
+#include "DNA_property_types.h"
#include "DNA_text_types.h"
#include "DNA_view3d_types.h"
#include "DNA_screen_types.h"
+#include "DNA_sensor_types.h"
+#include "DNA_sdna_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_sequence_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_group_types.h"
+#include "DNA_texture_types.h"
#include "DNA_userdef_types.h"
-#include "DNA_fileglobal_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_nla_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_world_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
@@ -2289,8 +2291,9 @@ static void direct_link_object(FileData *fd, Object *ob)
bController *cont;
bActuator *act;
ObHook *hook;
+ int a;
- ob->disp.first=ob->disp.last= 0;
+ ob->disp.first=ob->disp.last= NULL;
ob->pose= newdataadr(fd, ob->pose);
direct_link_pose(fd, ob->pose);
@@ -2320,10 +2323,18 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->pd= newdataadr(fd, ob->pd);
ob->soft= newdataadr(fd, ob->soft);
if(ob->soft) {
- SoftBody *sb= ob->soft; // init all stuff so it gets rebuilt nicely
- sb->totpoint= sb->totspring= 0;
- sb->bpoint= NULL;
+ SoftBody *sb= ob->soft;
+
+ sb->bpoint= NULL; // init pointers so it gets rebuilt nicely
sb->bspring= NULL;
+
+ sb->keys= newdataadr(fd, sb->keys);
+ test_pointer_array(fd, (void **)&sb->keys);
+ if(sb->keys) {
+ for(a=0; a<sb->totkey; a++) {
+ sb->keys[a]= newdataadr(fd, sb->keys[a]);
+ }
+ }
}
link_list(fd, &ob->prop);
@@ -4689,27 +4700,17 @@ static void do_versions(Main *main)
}
}
- /* temporal copy */
+ /* softbody init new vars */
for(ob= main->object.first; ob; ob= ob->id.next) {
- if(ob->softflag && ob->soft==NULL) {
- SoftBody *sb;
- ob->soft=sb= sbNew();
-
- sb->goalspring= ob->sb_goalspring;
- sb->goalfrict= ob->sb_goalfrict;
- sb->inspring= ob->sb_inspring;
- sb->infrict= ob->sb_infrict;
- sb->nodemass= ob->sb_nodemass;
- sb->grav= ob->sb_grav;
- sb->mingoal= ob->sb_mingoal;
- sb->maxgoal= ob->sb_maxgoal;
- sb->mediafrict= ob->sb_mediafrict;
- sb->rklimit= ob->softtime;
- 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->interval==0) {
+ ob->soft->interval= 2;
+ ob->soft->sfra= 1;
+ ob->soft->efra= 100;
+ }
}
if(ob->soft && ob->soft->vertgroup==0) {
bDeformGroup *locGroup = get_named_vertexgroup(ob, "SOFTGOAL");
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 00b29f32127..419897706fd 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -100,44 +100,45 @@ Important to know is that 'streaming' has been added to files, for Blender Publi
#include "nla.h" // __NLA is defined
-#include "DNA_packedFile_types.h"
-#include "DNA_sdna_types.h"
-#include "DNA_property_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_controller_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_action_types.h"
#include "DNA_actuator_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_object_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_ipo_types.h"
+#include "DNA_controller_types.h"
#include "DNA_curve_types.h"
+#include "DNA_constraint_types.h"
#include "DNA_camera_types.h"
+#include "DNA_effect_types.h"
+#include "DNA_group_types.h"
+#include "DNA_image_types.h"
+#include "DNA_ika_types.h"
+#include "DNA_ipo_types.h"
+#include "DNA_fileglobal_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_listBase.h" /* for Listbase, the type of samples, ...*/
+#include "DNA_lamp_types.h"
#include "DNA_meta_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_ika_types.h"
-#include "DNA_group_types.h"
+#include "DNA_nla_types.h"
+#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_oops_types.h"
+#include "DNA_packedFile_types.h"
+#include "DNA_property_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_sdna_types.h"
+#include "DNA_sequence_types.h"
+#include "DNA_sensor_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_fileglobal_types.h"
#include "DNA_sound_types.h"
#include "DNA_texture_types.h"
#include "DNA_text_types.h"
-#include "DNA_image_types.h"
-#include "DNA_key_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_listBase.h" /* for Listbase, the type of samples, ...*/
-#include "DNA_action_types.h"
-#include "DNA_nla_types.h"
+#include "DNA_view3d_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_userdef_types.h"
#include "MEM_guardedalloc.h" // MEM_freeN
#include "BLI_blenlib.h"
@@ -661,6 +662,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
{
Object *ob;
ObHook *hook;
+ int a;
ob= idbase->first;
while(ob) {
@@ -684,6 +686,15 @@ static void write_objects(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
writestruct(wd, DATA, "SoftBody", 1, ob->soft);
+ if(ob->soft) {
+ SoftBody *sb= ob->soft;
+ if(sb->keys) {
+ writedata(wd, DATA, sizeof(void *)*sb->totkey, sb->keys);
+ for(a=0; a<sb->totkey; a++) {
+ writestruct(wd, DATA, "SBVertex", sb->totpoint, sb->keys[a]);
+ }
+ }
+ }
for(hook= ob->hooks.first; hook; hook= hook->next) {
writestruct(wd, DATA, "ObHook", 1, hook);
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index 755b5c127fa..443b97430fa 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -221,8 +221,10 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_RELKEY 1415
#define B_CURVECHECK 1416
-#define B_SOFTBODY_CHANGE 1420
-#define B_SOFTBODY_DEL_VG 1421
+#define B_SOFTBODY_CHANGE 1420
+#define B_SOFTBODY_DEL_VG 1421
+#define B_SOFTBODY_BAKE 1422
+#define B_SOFTBODY_BAKE_FREE 1423
/* this has MAX_EFFECT settings! Next free define is 1450... */
#define B_SELEFFECT 1430
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
new file mode 100644
index 00000000000..59ea0cd6a3f
--- /dev/null
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -0,0 +1,126 @@
+/**
+ *
+ * $Id:
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2004-2005 by Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef DNA_OBJECT_FORCE_H
+#define DNA_OBJECT_FORCE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct PartDeflect {
+ short deflect; /* Deflection flag - does mesh deflect particles*/
+ short forcefield; /* Force field type, do the vertices attract / repel particles ? */
+ short flag; /* general settings flag */
+ short pad;
+
+ float pdef_damp; /* Damping factor for particle deflection */
+ float pdef_rdamp; /* Random element of damping for deflection */
+ float pdef_perm; /* Chance of particle passing through mesh */
+
+ float f_strength; /* The strength of the force (+ or - ) */
+ float f_power; /* The power law - real gravitation is 2 (square) */
+ float maxdist; /* if indicated, use this maximum */
+
+ float pdef_sbdamp; /* Damping factor for softbody deflection */
+ float pdef_sbift; /* inner face thickness for softbody deflection */
+ float pdef_sboft; /* outer face thickness for softbody deflection */
+} PartDeflect;
+
+
+typedef struct SBVertex {
+ float vec[4];
+} SBVertex;
+
+typedef struct SoftBody {
+ /* dynamic data */
+ int totpoint, totspring;
+ struct BodyPoint *bpoint; /* not saved in file */
+ struct BodySpring *bspring; /* not saved in file */
+ float ctime; /* last time calculated */
+
+ /* part of UI: */
+
+ /* general options */
+ float nodemass; /* softbody mass of *vertex* */
+ 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 */
+
+ /* goal */
+ float goalspring; /* softbody goal springs */
+ float goalfrict; /* softbody goal springs friction */
+ float mingoal; /* quick limits for goal */
+ float maxgoal;
+ float defgoal; /* default goal for vertices without vgroup */
+ short vertgroup; /* index starting at 1 */
+ short pad1;
+
+ /* springs */
+ float inspring; /* softbody inner springs */
+ float infrict; /* softbody inner springs friction */
+
+ /* baking */
+ short sfra, efra;
+ short interval, pad2;
+
+ SBVertex **keys; /* array of size totpointkey */
+ int totpointkey, totkey; /* if totpointkey != totpoint or totkey!- (efra-sfra)/interval -> free keys */
+
+} SoftBody;
+
+/* pd->forcefield: Effector Fields types */
+#define PFIELD_FORCE 1
+#define PFIELD_VORTEX 2
+#define PFIELD_MAGNET 3
+#define PFIELD_WIND 4
+
+/* pd->flag: various settings */
+#define PFIELD_USEMAX 1
+
+/* ob->softflag */
+#define OB_SB_ENABLE 1
+#define OB_SB_GOAL 2
+#define OB_SB_EDGES 4
+#define OB_SB_QUADS 8
+#define OB_SB_POSTDEF 16
+#define OB_SB_REDO 32
+#define OB_SB_BAKESET 64
+#define OB_SB_BAKEDO 128
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index d04e342de21..ea49d73cd04 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -51,8 +51,8 @@ struct BoundBox;
struct Path;
struct Material;
struct bConstraintChannel;
-struct BodyPoint;
-struct BodySpring;
+struct PartDeflect;
+struct SoftBody;
typedef struct bDeformGroup {
struct bDeformGroup *next, *prev;
@@ -79,62 +79,6 @@ typedef struct LBuf {
struct Object **ob;
} LBuf;
-typedef struct PartDeflect {
- short deflect; /* Deflection flag - does mesh deflect particles*/
- short forcefield; /* Force field type, do the vertices attract / repel particles ? */
- short flag; /* general settings flag */
- short pad;
-
- float pdef_damp; /* Damping factor for particle deflection */
- float pdef_rdamp; /* Random element of damping for deflection */
- float pdef_perm; /* Chance of particle passing through mesh */
-
- float f_strength; /* The strength of the force (+ or - ) */
- float f_power; /* The power law - real gravitation is 2 (square) */
- float maxdist; /* if indicated, use this maximum */
-
- float pdef_sbdamp; /* Damping factor for softbody deflection */
- float pdef_sbift; /* inner face thickness for softbody deflection */
- float pdef_sboft; /* outer face thickness for softbody deflection */
-} PartDeflect;
-
-/* pd->forcefield: Effector Fields types */
-#define PFIELD_FORCE 1
-#define PFIELD_VORTEX 2
-#define PFIELD_MAGNET 3
-#define PFIELD_WIND 4
-
-/* pd->flag: various settings */
-#define PFIELD_USEMAX 1
-
-
-typedef struct SoftBody {
- /* dynamic data */
- int totpoint, totspring;
- struct BodyPoint *bpoint; /* not saved in file */
- struct BodySpring *bspring; /* not saved in file */
- float ctime; /* last time calculated */
-
- /* part of UI: */
- float nodemass; /* softbody mass of *vertex* */
- 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;
-
- float inspring; /* softbody inner springs */
- float infrict; /* softbody inner springs friction */
-
- float defgoal; /* default goal for vertices without vgroup */
-
-} SoftBody;
typedef struct Object {
ID id;
@@ -239,28 +183,15 @@ typedef struct Object {
ListBase nlastrips;
ListBase hooks;
- PartDeflect *pd; /* particle deflector/attractor/collision data */
- struct SoftBody *soft; /* if exists, saved in file */
+ struct PartDeflect *pd; /* particle deflector/attractor/collision data */
+ struct SoftBody *soft; /* if exists, saved in file */
struct Life *life;
LBuf lbuf;
LBuf port;
-
+
float toonedge, smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */
-/* this stuff MUST NOT be here
- is here for softbody devel purpose
-*/
- float sb_goalspring; /* softbody goal springs */
- float sb_goalfrict; /* softbody goal springs friction */
- float sb_inspring; /* softbody inner springs */
- float sb_infrict; /* softbody inner springs friction */
- float sb_nodemass; /* softbody mass of *vertex* */
- float sb_grav; /* softbody amount of gravitaion to apply */
- float sb_mingoal; /* quick limits for goal */
- float sb_maxgoal;
- float sb_mediafrict; /* friction to env */
- float sb_pad1; /* free */
-
+
} Object;
typedef struct ObHook {
@@ -433,13 +364,7 @@ extern Object workob;
#define OB_ADDACT 1024
#define OB_SHOWCONT 2048
-/* ob->softflag */
-#define OB_SB_ENABLE 1
-#define OB_SB_GOAL 2
-#define OB_SB_EDGES 4
-#define OB_SB_QUADS 8
-#define OB_SB_POSTDEF 16
-#define OB_SB_REDO 32
+/* ob->softflag in DNA_object_force.h */
#ifdef __cplusplus
}
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 14ccba59e98..b550d18bdb2 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -95,6 +95,7 @@ char *includefiles[] = {
"DNA_meshdata_types.h",
"DNA_lattice_types.h",
"DNA_object_types.h",
+ "DNA_object_force.h",
"DNA_world_types.h",
"DNA_radio_types.h",
"DNA_scene_types.h",
@@ -1109,6 +1110,7 @@ int main(int argc, char ** argv)
#include "DNA_meshdata_types.h"
#include "DNA_lattice_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_world_types.h"
#include "DNA_radio_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 63f97f88249..d07633a5185 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -39,15 +39,20 @@
#include "NLA.h"
#include "logic.h"
#include <blendef.h>
+
#include <DNA_scene_types.h>
#include <DNA_mesh_types.h>
#include <DNA_curve_types.h>
+#include "DNA_object_force.h"
#include <DNA_property_types.h>
+
#include <BSE_edit.h>
+
#include <BKE_property.h>
#include <BKE_mball.h>
#include <BKE_font.h>
#include <BKE_softbody.h>
+
#include <BIF_editview.h>
#include <BSE_editipo.h>
diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c
index c3db05c1698..744b568aaac 100644
--- a/source/blender/renderconverter/intern/convertBlenderScene.c
+++ b/source/blender/renderconverter/intern/convertBlenderScene.c
@@ -53,21 +53,22 @@
#include "BLI_rand.h"
#include "BLI_memarena.h"
-#include "DNA_scene_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_material_types.h"
#include "DNA_curve_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_lattice_types.h"
#include "DNA_effect_types.h"
#include "DNA_ika_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_object_types.h"
-#include "DNA_view3d_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
+#include "DNA_object_types.h"
+#include "DNA_object_force.h"
+#include "DNA_scene_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_view3d_types.h"
#include "BKE_anim.h"
#include "BKE_armature.h"
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index c55574d9791..d48d933f99b 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -67,6 +67,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_radio_types.h"
#include "DNA_screen_types.h"
#include "DNA_texture_types.h"
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index cdc947da383..13383864f11 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -40,6 +40,7 @@
#endif
#include "MEM_guardedalloc.h"
+
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
@@ -53,6 +54,7 @@
#include "BLI_arithb.h"
#include "BSE_filesel.h"
+#include "BSE_headerbuttons.h"
#include "BIF_gl.h"
#include "BIF_graphics.h"
@@ -94,6 +96,7 @@
#include "DNA_meta_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_radio_types.h"
#include "DNA_screen_types.h"
#include "DNA_sound_types.h"
@@ -1101,6 +1104,51 @@ void object_panel_hooks(Object *ob)
uiDefBut(block, BUT, B_CLR_HOOK, "Clear offset", 160,80,150,19, NULL, 0.0, 0.0, 0, 0, "Recalculate and clear offset (transform) of hook");
}
+static void softbody_bake(Object *ob)
+{
+ SoftBody *sb= ob->soft;
+ ScrArea *sa;
+ int cfrao= CFRA;
+ unsigned short event=0;
+ short val;
+
+ CFRA= sb->sfra;
+ sbObjectToSoftbody(ob);
+ ob->softflag |= OB_SB_BAKEDO;
+
+ curarea->win_swap= WIN_BACK_OK; // clean swapbuffers
+
+ for(; CFRA <= sb->efra; CFRA++) {
+ set_timecursor(CFRA);
+
+ update_for_newframe_muted();
+
+ for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
+ if(sa->spacetype == SPACE_VIEW3D) {
+ scrarea_do_windraw(sa);
+ }
+ }
+ screen_swapbuffers();
+
+ while(qtest()) {
+
+ event= extern_qread(&val);
+ if(event==ESCKEY) break;
+ }
+ if(event==ESCKEY) break;
+ }
+
+ if(event==ESCKEY) sbObjectToSoftbody(ob); // clears all
+
+ /* restore */
+ waitcursor(0);
+ ob->softflag &= ~OB_SB_BAKEDO;
+ CFRA= cfrao;
+ update_for_newframe_muted();
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSOBJECT, 0);
+}
+
void do_object_panels(unsigned short event)
{
@@ -1207,6 +1255,16 @@ void do_object_panels(unsigned short event)
allqueue(REDRAWVIEW3D, 0);
}
break;
+ case B_SOFTBODY_BAKE:
+ ob= OBACT;
+ if(ob && ob->soft) softbody_bake(ob);
+ break;
+ case B_SOFTBODY_BAKE_FREE:
+ ob= OBACT;
+ if(ob && ob->soft) sbObjectToSoftbody(ob);
+ allqueue(REDRAWBUTSOBJECT, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
default:
if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
@@ -1480,6 +1538,7 @@ static void object_panel_deflectors(Object *ob)
}
}
+
/* Panel for softbodies */
static void object_softbodies(Object *ob)
@@ -1508,52 +1567,75 @@ static void object_softbodies(Object *ob)
}
}
- /* GENERAL STUFF */
- 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,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);
-
- /* GOAL STUFF */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_SB_GOAL, B_DIFF, "Use Goal", 10,100,130,20, &ob->softflag, 0, 0, 0, 0, "Define forces for vertices to stick to animated position");
+ uiDefButBitS(block, TOG, OB_SB_BAKESET, REDRAWBUTSOBJECT, "Bake settings", 180,200,130,20, &ob->softflag, 0, 0, 0, 0, "To convert simulation into baked (cached) result");
- menustr= get_vertexgroup_menustr(ob);
- defCount=BLI_countlist(&ob->defbase);
- if(defCount==0) sb->vertgroup= 0;
- uiDefButS(block, MENU, B_SOFTBODY_CHANGE, menustr, 140,100,20,20, &sb->vertgroup, 0, defCount, 0, 0, "Browses available vertex groups");
+ if(sb->keys) uiSetButLock(1, "SoftBody is baked, free it first");
- if(sb->vertgroup) {
- bDeformGroup *defGroup = BLI_findlink(&ob->defbase, sb->vertgroup-1);
- if(defGroup)
- uiDefBut(block, BUT, B_DIFF, defGroup->name, 160,100,130,20, NULL, 0.0, 0.0, 0, 0, "Name of current vertex group");
- else
- uiDefBut(block, BUT, B_DIFF, "(no group)", 160,100,130,20, NULL, 0.0, 0.0, 0, 0, "Vertex Group doesn't exist anymore");
- uiDefIconBut(block, BUT, B_SOFTBODY_DEL_VG, ICON_X, 290,100,20,20, 0, 0, 0, 0, 0, "Disable use of vertex group");
+ if(ob->softflag & OB_SB_BAKESET) {
+ uiBlockBeginAlign(block);
+ uiDefButS(block, NUM, B_DIFF, "Start:", 10, 170,100,20, &sb->sfra, 1.0, 10000.0, 10, 0, "Start frame for baking");
+ uiDefButS(block, NUM, B_DIFF, "End:", 110, 170,100,20, &sb->efra, 1.0, 10000.0, 10, 0, "End frame for baking");
+ uiDefButS(block, NUM, B_DIFF, "Interval:", 210, 170,100,20, &sb->interval, 1.0, 10.0, 10, 0, "Interval in frames between baked keys");
+
+ uiClearButLock();
+
+ uiBlockBeginAlign(block);
+ if(sb->keys) {
+ char str[128];
+ uiDefIconTextBut(block, BUT, B_SOFTBODY_BAKE_FREE, ICON_X, "FREE BAKE", 10, 120,300,20, NULL, 0.0, 0.0, 0, 0, "Free baked result");
+ sprintf(str, "Stored %d vertices %d keys %.3f MB", sb->totpoint, sb->totkey, ((float)16*sb->totpoint*sb->totkey)/(1024.0*1024.0));
+ uiDefBut(block, LABEL, 0, str, 10, 100,300,20, NULL, 0.0, 0.0, 00, 0, "");
+ }
+ else
+ uiDefBut(block, BUT, B_SOFTBODY_BAKE, "BAKE", 10, 120,300,20, NULL, 0.0, 0.0, 10, 0, "Start baking. Press ESC to exit without baking");
}
else {
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Goal:", 160,100,150,20, &sb->defgoal, 0.0, 1.0, 10, 0, "Default Goal (vertex target position) value, when no Vertex Group used");
- }
- MEM_freeN (menustr);
-
- uiDefButF(block, NUM, B_DIFF, "GSpring:", 10,80,150,20, &sb->goalspring, 0.0, 0.999, 10, 0, "Goal (vertex target position) Spring Constant");
- uiDefButF(block, NUM, B_DIFF, "GFrict:", 160,80,150,20, &sb->goalfrict , 0.0, 10.0, 10, 0, "Goal (vertex target position) Friction Constant");
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "GMin:", 10,60,150,20, &sb->mingoal, 0.0, 1.0, 10, 0, "Min Goal bound");
- uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "GMax:", 160,60,150,20, &sb->maxgoal, 0.0, 1.0, 10, 0, "Max Goal bound");
- uiBlockEndAlign(block);
-
- /* EDGE SPRING STUFF */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_SB_EDGES, B_SOFTBODY_CHANGE, "Use Edges", 10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Use Robust 2nd order solver");
- uiDefButBitS(block, TOG, OB_SB_QUADS, B_SOFTBODY_CHANGE, "Stiff Quads", 160,30,150,20, &ob->softflag, 0, 0, 0, 0, "Sets object to have diagonal springs on 4-gons");
- uiDefButF(block, NUM, B_DIFF, "ESpring:", 10,10,150,20, &sb->inspring, 0.0, 0.999, 10, 0, "Edge Spring Constant");
- uiDefButF(block, NUM, B_DIFF, "EFrict:", 160,10,150,20, &sb->infrict, 0.0, 10.0, 10, 0, "Edge Friction Constant");
- uiBlockEndAlign(block);
+ /* GENERAL STUFF */
+ 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,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);
+
+ /* GOAL STUFF */
+ uiBlockBeginAlign(block);
+ uiDefButBitS(block, TOG, OB_SB_GOAL, B_DIFF, "Use Goal", 10,100,130,20, &ob->softflag, 0, 0, 0, 0, "Define forces for vertices to stick to animated position");
+
+ menustr= get_vertexgroup_menustr(ob);
+ defCount=BLI_countlist(&ob->defbase);
+ if(defCount==0) sb->vertgroup= 0;
+ uiDefButS(block, MENU, B_SOFTBODY_CHANGE, menustr, 140,100,20,20, &sb->vertgroup, 0, defCount, 0, 0, "Browses available vertex groups");
+
+ if(sb->vertgroup) {
+ bDeformGroup *defGroup = BLI_findlink(&ob->defbase, sb->vertgroup-1);
+ if(defGroup)
+ uiDefBut(block, BUT, B_DIFF, defGroup->name, 160,100,130,20, NULL, 0.0, 0.0, 0, 0, "Name of current vertex group");
+ else
+ uiDefBut(block, BUT, B_DIFF, "(no group)", 160,100,130,20, NULL, 0.0, 0.0, 0, 0, "Vertex Group doesn't exist anymore");
+ uiDefIconBut(block, BUT, B_SOFTBODY_DEL_VG, ICON_X, 290,100,20,20, 0, 0, 0, 0, 0, "Disable use of vertex group");
+ }
+ else {
+ uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Goal:", 160,100,150,20, &sb->defgoal, 0.0, 1.0, 10, 0, "Default Goal (vertex target position) value, when no Vertex Group used");
+ }
+ MEM_freeN (menustr);
+ uiDefButF(block, NUM, B_DIFF, "GSpring:", 10,80,150,20, &sb->goalspring, 0.0, 0.999, 10, 0, "Goal (vertex target position) Spring Constant");
+ uiDefButF(block, NUM, B_DIFF, "GFrict:", 160,80,150,20, &sb->goalfrict , 0.0, 10.0, 10, 0, "Goal (vertex target position) Friction Constant");
+ uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "GMin:", 10,60,150,20, &sb->mingoal, 0.0, 1.0, 10, 0, "Min Goal bound");
+ uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "GMax:", 160,60,150,20, &sb->maxgoal, 0.0, 1.0, 10, 0, "Max Goal bound");
+ uiBlockEndAlign(block);
+
+ /* EDGE SPRING STUFF */
+ uiBlockBeginAlign(block);
+ uiDefButBitS(block, TOG, OB_SB_EDGES, B_SOFTBODY_CHANGE, "Use Edges", 10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Use Robust 2nd order solver");
+ uiDefButBitS(block, TOG, OB_SB_QUADS, B_SOFTBODY_CHANGE, "Stiff Quads", 160,30,150,20, &ob->softflag, 0, 0, 0, 0, "Sets object to have diagonal springs on 4-gons");
+ uiDefButF(block, NUM, B_DIFF, "ESpring:", 10,10,150,20, &sb->inspring, 0.0, 0.999, 10, 0, "Edge Spring Constant");
+ uiDefButF(block, NUM, B_DIFF, "EFrict:", 160,10,150,20, &sb->infrict, 0.0, 10.0, 10, 0, "Edge Friction Constant");
+ uiBlockEndAlign(block);
+ }
}
uiBlockEndAlign(block);
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 957d4e988d2..2debd4aee67 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -58,6 +58,7 @@
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 89f21c471c5..9af2580c26b 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -73,6 +73,7 @@
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_texture_types.h"
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index d206b3bd860..734361a47e3 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -542,6 +542,7 @@ void uiTextBoundsBlock(uiBlock *block, int addval)
void uiBoundsBlock(uiBlock *block, int addval)
{
uiBut *bt;
+ int xof;
if(block->buttons.first==NULL) {
if(block->panel) {
@@ -571,10 +572,15 @@ void uiBoundsBlock(uiBlock *block, int addval)
block->maxy += addval;
}
- block->safety.xmin= block->minx-40;
- block->safety.ymin= block->miny-40;
- block->safety.xmax= block->maxx+40;
- block->safety.ymax= block->maxy+40;
+ /* hardcoded exception... but that one is annoying with larger safety */
+ bt= block->buttons.first;
+ if(bt && strncmp(bt->str, "ERROR", 5)==0) xof= 10;
+ else xof= 40;
+
+ block->safety.xmin= block->minx-xof;
+ block->safety.ymin= block->miny-xof;
+ block->safety.xmax= block->maxx+xof;
+ block->safety.ymax= block->maxy+xof;
}
static void ui_positionblock(uiBlock *block, uiBut *but)
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 813ec2d749e..dadfbf0f0b2 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -4487,7 +4487,7 @@ void allqueue(unsigned short event, short val)
/* dependency check.maybe not final pos */
if (sa->spacetype==SPACE_VIEW3D) {
if (G.scene->dagisvalid == 0) {
- fprintf(stderr,"building dag \n");
+// fprintf(stderr,"building dag \n");
G.scene->theDag = build_dag(G.scene, DAG_RL_ALL_BUT_DATA_MASK);
G.scene->dagisvalid = 1;
}
diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c
index 35704851d74..8d711054a51 100644
--- a/source/blender/src/vpaint.c
+++ b/source/blender/src/vpaint.c
@@ -54,6 +54,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_screen_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"