Merging revisions 14838-14945 of https://svn.blender.org/svnroot/bf-blender/trunk...
authorDaniel Genrich <daniel.genrich@gmx.net>
Fri, 23 May 2008 20:36:05 +0000 (20:36 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Fri, 23 May 2008 20:36:05 +0000 (20:36 +0000)
1  2 
source/blender/blenkernel/intern/modifier.c
source/blender/blenloader/intern/readfile.c
source/blender/include/butspace.h
source/blender/src/buttons_editing.c
source/blender/src/buttons_object.c
source/blender/src/drawobject.c

index b481055ff16d55857822d6395155e550cc4e4b2e,b867b8d22bbb1252ceb41de5b7a57f76375e3da8..fa54b0458d5b42dbb357035f84f6d08b6d53cfbe
@@@ -58,7 -58,6 +58,7 @@@
  #include "DNA_material_types.h"
  #include "DNA_mesh_types.h"
  #include "DNA_meshdata_types.h"
 +#include "DNA_sph_types.h"
  #include "DNA_modifier_types.h"
  #include "DNA_object_types.h"
  #include "DNA_object_force.h"
@@@ -91,7 -90,6 +91,7 @@@
  #include "BKE_object.h"
  #include "BKE_mesh.h"
  #include "BKE_softbody.h"
 +#include "BKE_sph.h"
  #include "BKE_cloth.h"
  #include "BKE_material.h"
  #include "BKE_particle.h"
@@@ -1250,7 -1248,8 +1250,8 @@@ static DerivedMesh *arrayModifier_apply
  
        result = arrayModifier_doArray(amd, ob, derivedData, 0);
  
-       CDDM_calc_normals(result);
+       if(result != derivedData)
+               CDDM_calc_normals(result);
  
        return result;
  }
@@@ -2676,7 -2675,8 +2677,8 @@@ static DerivedMesh *edgesplitModifier_a
  
        result = edgesplitModifier_do(emd, ob, derivedData);
  
-       CDDM_calc_normals(result);
+       if(result != derivedData)
+               CDDM_calc_normals(result);
  
        return result;
  }
@@@ -5180,89 -5180,6 +5182,89 @@@ static void clothModifier_freeData(Modi
        }
  }
  
 +/* Smooth Particly Hydrodynamics */
 +
 +static void sphModifier_initData(ModifierData *md) 
 +{
 +      SphModifierData *sphmd = (SphModifierData*) md;
 +      
 +      sphmd->sim_parms = MEM_callocN(sizeof(SphSimSettings), "SPH sim parms");
 +      sphmd->coll_parms = MEM_callocN(sizeof(SphCollSettings), "SPH coll parms");
 +      
 +      /* check for alloc failing */
 +      if(!sphmd->sim_parms || !sphmd->coll_parms)
 +              return;
 +      
 +      sph_init(sphmd);
 +}
 +
 +static DerivedMesh *sphModifier_applyModifier(ModifierData *md, Object *ob,
 +                                            DerivedMesh *derivedData, int useRenderParams, int isFinalCalc)
 +{
 +      SphModifierData *sphmd = (SphModifierData*) md;
 +      DerivedMesh *result=NULL;
 +      
 +      /* check for alloc failing */
 +      if(!sphmd->sim_parms || !sphmd->coll_parms)
 +              return derivedData;
 +
 +      result = sphModifier_do(sphmd, ob, derivedData, useRenderParams, isFinalCalc);
 +
 +      if(result)
 +      {
 +              CDDM_calc_normals(result);
 +              return result;
 +      }
 +      
 +      return derivedData;
 +}
 +
 +static void sphModifier_updateDepgraph(
 +                                     ModifierData *md, DagForest *forest, Object *ob,
 +         DagNode *obNode)
 +{
 +      SphModifierData *sphmd = (SphModifierData*) md;
 +      
 +      Base *base;
 +      
 +}
 +
 +CustomDataMask sphModifier_requiredDataMask(ModifierData *md)
 +{
 +      CustomDataMask dataMask = 0;
 +
 +      /* ask for vertexgroups if we need them */
 +      dataMask |= (1 << CD_MDEFORMVERT);
 +
 +      return dataMask;
 +}
 +
 +static void sphModifier_copyData(ModifierData *md, ModifierData *target)
 +{
 +      
 +}
 +
 +
 +static int sphModifier_dependsOnTime(ModifierData *md)
 +{
 +      return 1;
 +}
 +
 +static void sphModifier_freeData(ModifierData *md)
 +{
 +      SphModifierData *sphmd = (SphModifierData*) md;
 +      
 +      if (sphmd) 
 +      {       
 +              sph_free_modifier(sphmd);
 +              
 +              if(sphmd->sim_parms)
 +                      MEM_freeN(sphmd->sim_parms);
 +              if(sphmd->coll_parms)
 +                      MEM_freeN(sphmd->coll_parms);
 +      }
 +}
 +
  /* Collision */
  
  static void collisionModifier_initData(ModifierData *md) 
        collmd->current_v = NULL;
        collmd->time = -1;
        collmd->numverts = 0;
 -      collmd->bvh = NULL;
 +      collmd->bvhtree = NULL;
  }
  
  static void collisionModifier_freeData(ModifierData *md)
        
        if (collmd) 
        {
 -              if(collmd->bvh)
 -                      bvh_free(collmd->bvh);
 +              if(collmd->bvhtree)
 +                      BLI_bvhtree_free(collmd->bvhtree);
                if(collmd->x)
                        MEM_freeN(collmd->x);
                if(collmd->xnew)
                        MEM_freeN(collmd->current_xnew);
                if(collmd->current_v)
                        MEM_freeN(collmd->current_v);
 -              
                if(collmd->mfaces)
                        MEM_freeN(collmd->mfaces);
                
                collmd->current_v = NULL;
                collmd->time = -1;
                collmd->numverts = 0;
 -              collmd->bvh = NULL;
 +              collmd->bvhtree = NULL;
                collmd->mfaces = NULL;
        }
  }
@@@ -5375,8 -5293,9 +5377,8 @@@ static void collisionModifier_deformVer
                                collmd->mfaces = dm->dupFaceArray(dm);
                                collmd->numfaces = dm->getNumFaces(dm);
                                
 -                              // TODO: epsilon
                                // create bounding box hierarchy
 -                              collmd->bvh = bvh_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->x, numverts, ob->pd->pdef_sboft);
 +                              collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->x, numverts, ob->pd->pdef_sboft);
                                
                                collmd->time = current_time;
                        }
                                memcpy(collmd->current_x, collmd->x, numverts*sizeof(MVert));
                                
                                /* check if GUI setting has changed for bvh */
 -                              if(collmd->bvh)
 +                              if(collmd->bvhtree) 
                                {
 -                                      if(ob->pd->pdef_sboft != collmd->bvh->epsilon)
 +                                      if(ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree))
                                        {
 -                                              bvh_free(collmd->bvh);
 -                                              collmd->bvh = bvh_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft);
 +                                              BLI_bvhtree_free(collmd->bvhtree);
 +                                              collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft);
                                        }
                        
                                }
                                
 -                              /* happens on file load (ONLY when i decomment changes in readfile.c */
 -                              if(!collmd->bvh)
 +                              /* happens on file load (ONLY when i decomment changes in readfile.c) */
 +                              if(!collmd->bvhtree)
                                {
 -                                      collmd->bvh = bvh_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft);
 +                                      collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft);
                                }
                                else
                                {
                                        // recalc static bounding boxes
 -                                      bvh_update_from_mvert(collmd->bvh, collmd->current_x, numverts, NULL, 0);
 +                                      bvhtree_update_from_mvert ( collmd->bvhtree, collmd->mfaces, collmd->numfaces, collmd->current_x, collmd->current_xnew, collmd->numverts, 1 );
                                }
                                
                                collmd->time = current_time;
@@@ -6931,8 -6850,16 +6933,16 @@@ static void meshdeformModifier_do
        Mat3CpyMat4(icagemat, iobmat);
  
        /* bind weights if needed */
-       if(!mmd->bindcos)
-               harmonic_coordinates_bind(mmd, vertexCos, numVerts, cagemat);
+       if(!mmd->bindcos) {
+               static int recursive = 0;
+               /* progress bar redraw can make this recursive .. */
+               if(!recursive) {
+                       recursive = 1;
+                       harmonic_coordinates_bind(mmd, vertexCos, numVerts, cagemat);
+                       recursive = 0;
+               }
+       }
  
        /* verify we have compatible weights */
        totvert= numVerts;
@@@ -7201,18 -7128,6 +7211,18 @@@ ModifierTypeInfo *modifierType_getInfo(
                mti->requiredDataMask = bevelModifier_requiredDataMask;
                mti->applyModifier = bevelModifier_applyModifier;
                mti->applyModifierEM = bevelModifier_applyModifierEM;
 +              
 +              mti = INIT_TYPE(Sph);
 +              mti->type = eModifierTypeType_Nonconstructive;
 +              mti->flags = eModifierTypeFlag_AcceptsMesh
 +                              | eModifierTypeFlag_UsesPointCache;
 +              mti->initData = sphModifier_initData;
 +              mti->copyData = sphModifier_copyData;
 +              mti->requiredDataMask = sphModifier_requiredDataMask;
 +              mti->applyModifier = sphModifier_applyModifier;
 +              mti->dependsOnTime = sphModifier_dependsOnTime;
 +              mti->freeData = sphModifier_freeData; 
 +              mti->updateDepgraph = sphModifier_updateDepgraph;
  
                mti = INIT_TYPE(Displace);
                mti->type = eModifierTypeType_OnlyDeform;
index 2f98a305f1c5129c57d8f9390545bdd796246bd2,1cb8b10b0873d502589a7841bb6675657ea01aa3..629de5953456b31821a9b9ed8313ccc5f9c70752
@@@ -3075,7 -3075,6 +3075,7 @@@ static void direct_link_modifiers(FileD
                        
                        clmd->sim_parms= newdataadr(fd, clmd->sim_parms);
                        clmd->coll_parms= newdataadr(fd, clmd->coll_parms);
 +
                        clmd->point_cache= newdataadr(fd, clmd->point_cache);
  
                        if(clmd->point_cache)
                                if(clmd->sim_parms->presets > 10)
                                        clmd->sim_parms->presets = 0;
                        }
 +                      else
 +                      {
 +                              /* Collision modifier without parameters?? */
 +                              
 +                      }
                        
                }
                else if (md->type==eModifierType_Collision) {
                        
                        CollisionModifierData *collmd = (CollisionModifierData*) md;
 -                      /*
 -                      // TODO: CollisionModifier should use pointcache 
 -                      // + have proper reset events before enabling this
 -                      collmd->x = newdataadr(fd, collmd->x);
 -                      collmd->xnew = newdataadr(fd, collmd->xnew);
 -                      collmd->mfaces = newdataadr(fd, collmd->mfaces);
 -                      
 -                      collmd->current_x = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_x");
 -                      collmd->current_xnew = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_xnew");
 -                      collmd->current_v = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_v");
 -                      */
                        
                        collmd->x = NULL;
                        collmd->xnew = NULL;
                        collmd->current_v = NULL;
                        collmd->time = -1;
                        collmd->numverts = 0;
 -                      collmd->bvh = NULL;
 +                      collmd->bvhtree = NULL;
                        collmd->mfaces = NULL;
 -                      
                }
                else if (md->type==eModifierType_Hook) {
                        HookModifierData *hmd = (HookModifierData*) md;
@@@ -7380,6 -7386,7 +7380,7 @@@ static void do_versions(FileData *fd, L
                                
                                /* needed for proper libdata lookup */
                                oldnewmap_insert(fd->libmap, psys->part, psys->part, 0);
+                               part->id.lib= ob->id.lib;
  
                                part->id.us--;
                                part->id.flag |= (ob->id.flag & LIB_NEEDLINK);
index c6482290c86aea9461a729f5ee81e237b371dce4,7571d64be91a1fe798d0a86e0b639b0c87dd0283..058e4243b960c6216c20c767f1b4d7157bd171f3
@@@ -297,10 -297,6 +297,10 @@@ void curvemap_buttons(struct uiBlock *b
  /* Cloth sim button defines */
  #define B_CLOTH_CHANGEPREROLL 1480
  
 +/* SPH sim button defines */
 +#define B_SPH_BAKE            1490
 +
 +
  /* *********************** */
  #define B_WORLDBUTS           1600
  
  #define B_SET_ZBLUR                   1644
  #define B_ADD_RENDERLAYER     1645
  #define B_SET_PASS                    1646
+ #define B_ADD_FFMPEG_VIDEO_OPTION     1647
+ #define B_ADD_FFMPEG_AUDIO_OPTION     1648
  
  #define B_SEQ_BUT_PLUGIN      1691
  #define B_SEQ_BUT_RELOAD      1692
index 39e98c92c39a62e14b357a0dc3dd5c0383609498,592a8c1b7aa43b3f05ffbb9b41e9f0609f0c5b26..bcd373ddbc3dac75563766ed1d76e252e696019f
@@@ -985,7 -985,7 +985,7 @@@ static uiBlock *modifiers_add_menu(voi
                /* Only allow adding through appropriate other interfaces */
                if(ELEM3(i, eModifierType_Softbody, eModifierType_Hook, eModifierType_ParticleSystem)) continue;
                
 -              if(ELEM(i, eModifierType_Cloth, eModifierType_Collision)) continue;
 +              if(ELEM3(i, eModifierType_Cloth, eModifierType_Collision, eModifierType_Sph)) continue;
  
                if((mti->flags&eModifierTypeFlag_AcceptsCVs) ||
                   (ob->type==OB_MESH && (mti->flags&eModifierTypeFlag_AcceptsMesh))) {
@@@ -1813,8 -1813,6 +1813,8 @@@ static void draw_modifier(uiBlock *bloc
                        height = 31;
                } else if (md->type==eModifierType_Collision) {
                        height = 31;
 +              } else if (md->type==eModifierType_Sph) {
 +                      height = 31;
                } else if (md->type==eModifierType_Boolean) {
                        height = 48;
                } else if (md->type==eModifierType_Array) {
                                uiButSetFunc(but, modifiers_applyModifier, ob, md);
                        }
                        
 -                      if (md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem && (md->type!=eModifierType_Cloth)) {
 +                      if (md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem && (md->type!=eModifierType_Cloth) && (md->type!=eModifierType_Sph)) {
                                but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Copy",   lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Duplicate the current modifier at the same position in the stack");
                                uiButSetFunc(but, modifiers_copyModifier, ob, md);
                        }
                        uiDefBut(block, LABEL, 1, "See Soft Body panel.",       lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
                } else if (md->type==eModifierType_Cloth) {
                        uiDefBut(block, LABEL, 1, "See Cloth panel.",   lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
 +              } else if (md->type==eModifierType_Sph) {
 +                      uiDefBut(block, LABEL, 1, "See Sph panel.",     lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
                } else if (md->type==eModifierType_Collision) {
                        uiDefBut(block, LABEL, 1, "See Collision panel.",       lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
                } else if (md->type==eModifierType_Boolean) {
@@@ -3314,7 -3310,7 +3314,7 @@@ static void editing_panel_curve_tools(O
  
        if(ob==G.obedit) {
                nu= lastnu;
-               if(nu==NULL) nu= editNurb.first;
+               if(nu==NULL) nu= lastnu= editNurb.first;
                if(nu) {
                        if (ob->type==OB_CURVE) {
                                uiDefBut(block, LABEL, 0, "Tilt",
@@@ -5085,8 -5081,6 +5085,6 @@@ static void editing_panel_mesh_tools1(O
        
        uiBlockEndAlign(block);
        
-       uiDefButBitS(block, TOG, B_MESH_X_MIRROR, B_DIFF, "X-axis mirror",1125,0,150,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "While using transforms, mirrors the transformation");
-       
        uiDefButC(block, MENU, REDRAWBUTSEDIT, "Edge Alt-Select Mode%t|Loop Select%x0|Tag Edges (Seam)%x1|Tag Edges (Sharp)%x2|Tag Edges (Crease)%x3|Tag Edges (Bevel)%x4",1125,88,150,19, &G.scene->toolsettings->edge_mode, 0, 0, 0, 0, "Operation to use when Alt+RMB on edges, Use Alt+Shift+RMB to tag the shortest path from the active edge");
        
        uiBlockBeginAlign(block);
@@@ -5536,7 -5530,7 +5534,7 @@@ void sculptmode_draw_interface_tools(ui
                uiDefButC(block,ROW,B_NOP,"Sub",cx+89,cy,89,19,&sculptmode_brush()->dir,15.0,2.0,0, 0,"Subtract depth from model [Shift]");
        }
        if(sd->brush_type!=GRAB_BRUSH)
-               uiDefButBitC(block, TOG, SCULPT_BRUSH_AIRBRUSH, 0, "Airbrush", cx+178,cy,89,19, &sculptmode_brush()->flag,0,0,0,0, "Brush makes changes without waiting for the mouse to move");
+               uiDefButBitC(block, TOG, SCULPT_BRUSH_AIRBRUSH, B_NOP, "Airbrush", cx+178,cy,89,19, &sculptmode_brush()->flag,0,0,0,0, "Brush makes changes without waiting for the mouse to move");
        cy-= 20;
        uiDefButS(block,NUMSLI,B_NOP,"Size: ",cx,cy,268,19,&sculptmode_brush()->size,1.0,200.0,0,0,"Set brush radius in pixels");
        cy-= 20;
        uiDefBut( block,LABEL,B_NOP,"Symmetry",cx,cy,90,19,NULL,0,0,0,0,"");
        cy-= 20;
        uiBlockBeginAlign(block);
-       uiDefButBitC(block, TOG, SYMM_X, 0, "X", cx,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across X axis");
-       uiDefButBitC(block, TOG, SYMM_Y, 0, "Y", cx+40,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across Y axis");
-       uiDefButBitC(block, TOG, SYMM_Z, 0, "Z", cx+80,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across Z axis");
+       uiDefButBitC(block, TOG, SYMM_X, B_NOP, "X", cx,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across X axis");
+       uiDefButBitC(block, TOG, SYMM_Y, B_NOP, "Y", cx+40,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across Y axis");
+       uiDefButBitC(block, TOG, SYMM_Z, B_NOP, "Z", cx+80,cy,40,19, &sd->symm, 0,0,0,0, "Mirror brush across Z axis");
        uiBlockEndAlign(block);
  
        
        uiDefBut( block,LABEL,B_NOP,"LockAxis",cx+140,cy,90,19,NULL,0,0,0,0,"");
        cy-= 20;
        uiBlockBeginAlign(block);
-       uiDefButBitC(block, TOG, AXISLOCK_X, 0, "X", cx+140,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain X axis");
-       uiDefButBitC(block, TOG, AXISLOCK_Y, 0, "Y", cx+180,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain Y axis");
-       uiDefButBitC(block, TOG, AXISLOCK_Z, 0, "Z", cx+220,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain Z axis");
+       uiDefButBitC(block, TOG, AXISLOCK_X, B_NOP, "X", cx+140,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain X axis");
+       uiDefButBitC(block, TOG, AXISLOCK_Y, B_NOP, "Y", cx+180,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain Y axis");
+       uiDefButBitC(block, TOG, AXISLOCK_Z, B_NOP, "Z", cx+220,cy,40,19, &sd->axislock, 0,0,0,0, "Constrain Z axis");
        uiBlockEndAlign(block);
        
        
@@@ -5599,7 -5593,7 +5597,7 @@@ void sculptmode_draw_interface_brush(ui
        if(sd->brush_type == DRAW_BRUSH)
                uiDefButC(block,NUM,B_NOP, "View", cx,cy,80,19, &sculptmode_brush()->view, 0,10,20,0,"Pulls brush direction towards view");
        cy-= 20;
-       uiDefButBitC(block, TOG, SCULPT_BRUSH_ANCHORED, 0, "Anchored", cx,cy,80,19, &sculptmode_brush()->flag, 0,0,0,0, "Keep the brush center anchored to the initial location");
+       uiDefButBitC(block, TOG, SCULPT_BRUSH_ANCHORED, B_NOP, "Anchored", cx,cy,80,19, &sculptmode_brush()->flag, 0,0,0,0, "Keep the brush center anchored to the initial location");
        uiBlockEndAlign(block);
  
        /* Draw curve */
index 99fe798a58fc4572aedf3dcfb49ae8470ad0b775,fb36d1036561b82cd6797d92f9e46a09fcd9deef..93e5603e97a0efe47c81fa9f196c36987c02eaaa
@@@ -52,8 -52,6 +52,8 @@@
  #include "BKE_utildefines.h"
  #include "BKE_particle.h"
  #include "BKE_pointcache.h"
 +#include "BKE_sph.h"
 +
  
  #include "BLI_blenlib.h"
  #include "BLI_arithb.h"
  #include "DNA_particle_types.h"
  #include "DNA_radio_types.h"
  #include "DNA_screen_types.h"
 +#include "DNA_sph_types.h"
  #include "DNA_sound_types.h"
  #include "DNA_texture_types.h"
  #include "DNA_userdef_types.h"
  #include "BKE_object.h"
  #include "BKE_particle.h"
  #include "BKE_sound.h"
 +#include "BKE_sph.h"
  #include "BKE_texture.h"
  #include "BKE_utildefines.h"
  #include "BKE_DerivedMesh.h"
@@@ -982,7 -978,7 +982,7 @@@ static void draw_constraint (uiBlock *b
                                uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, ""); 
                                
                                /* IK Target */
-                               uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
+                               uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco, *yco-24, 80, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
                                
                                /* Draw target parameters */
                                uiBlockBeginAlign(block);
@@@ -2480,27 -2476,6 +2480,27 @@@ void do_object_panels(unsigned short ev
                allqueue(REDRAWVIEW3D, 0);
        }
        break;
 +      case B_SPH_BAKE:
 +      {
 +              SphModifierData *sphmd = (SphModifierData *)modifiers_findByType(ob, eModifierType_Sph);
 +              int i = 0;
 +              
 +              if(sphmd && sphmd->sim_parms)
 +              {
 +                      sphmd->sim_parms->flags |= SPH_SIMSETTINGS_FLAG_BAKING;
 +                      
 +                      // call baking function
 +                      for(i = 0; i < 1; i++)
 +                      {
 +                              CFRA++;
 +                              update_for_newframe();
 +                      }
 +                      
 +                      sphmd->sim_parms->flags &= ~SPH_SIMSETTINGS_FLAG_BAKING;
 +                      
 +              }
 +      }
 +      break;
        }
  
  }
@@@ -4172,8 -4147,9 +4172,9 @@@ static void object_panel_particle_child
                uiDefButF(block, NUM, B_PART_REDRAW, "Rand:",           butx+butw/2,buty,butw/2,buth, &part->childrandsize, 0.0, 1.0, 10, 1, "Random variation to the size of the child particles");
        }
        if(part->childtype == PART_CHILD_FACES) {
-               uiDefButF(block, NUM, B_PART_REDRAW, "Spread:",butx,(buty-=buth),butw/2,buth, &part->childspread, -1.0, 1.0, 10, 1, "Spread children from the faces");
-               uiDefButBitI(block, TOG, PART_CHILD_SEAMS, B_PART_DISTR_CHILD, "Use Seams",      butx+butw/2,buty,butw/2,buth, &part->flag, 0, 0, 0, 0, "Use seams to determine parents");
+               /* only works if children could be emitted from volume, but that option isn't available now */
+               /*uiDefButF(block, NUM, B_PART_REDRAW, "Spread:",butx,(buty-=buth),butw/2,buth, &part->childspread, -1.0, 1.0, 10, 1, "Spread children from the faces");*/
+               uiDefButBitI(block, TOG, PART_CHILD_SEAMS, B_PART_DISTR_CHILD, "Use Seams",     butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Use seams to determine parents");
        }
        uiBlockEndAlign(block);
  
@@@ -5701,116 -5677,6 +5702,116 @@@ static void object_panel_cloth_III(Obje
        
  }
  
 +static void object_sph__enabletoggle(void *ob_v, void *arg2)
 +{
 +      Object *ob = ob_v;
 +      ModifierData *md = modifiers_findByType(ob, eModifierType_Sph);
 +
 +      if (!md) {
 +              // create particle modifier
 +              ParticleSettings *part = psys_new_settings("PSys", G.main);
 +              ParticleSystem *psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
 +              ParticleSystemModifierData *psmd;
 +              
 +              md = modifier_new(eModifierType_Sph);
 +              BLI_addtail(&ob->modifiers, md);
 +
 +              part->type = PART_FLUID;
 +              psys->part = part;
 +              psys->pointcache = BKE_ptcache_add();
 +              psys->flag |= PSYS_ENABLED;
 +              BLI_addtail(&ob->particlesystem,psys);
 +              md= modifier_new(eModifierType_ParticleSystem);
 +              sprintf(md->name, "SphParticleSystem" );
 +              psmd= (ParticleSystemModifierData*) md;
 +              psmd->psys=psys;
 +              BLI_addtail(&ob->modifiers, md);
 +              
 +              DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
 +              allqueue(REDRAWBUTSEDIT, 0);
 +              allqueue(REDRAWVIEW3D, 0);
 +      }
 +      else {
 +              Object *ob = ob_v;
 +              ModifierData *md = modifiers_findByType(ob, eModifierType_Sph);
 +      
 +              if (!md)
 +                      return;
 +
 +              BLI_remlink(&ob->modifiers, md);
 +
 +              modifier_free(md);
 +
 +              BIF_undo_push("Del modifier");
 +              
 +              // ob->softflag |= OB_SB_RESET;
 +              allqueue(REDRAWBUTSEDIT, 0);
 +              allqueue(REDRAWVIEW3D, 0);
 +              allqueue(REDRAWIMAGE, 0);
 +              allqueue(REDRAWOOPS, 0);
 +              DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
 +              object_handle_update(ob);
 +              countall();
 +      }
 +}
 +
 +static void object_panel_sph(Object *ob)
 +{
 +      uiBlock *block=NULL;
 +      uiBut *but=NULL;
 +      static int val;
 +      SphModifierData *sphmd = (SphModifierData *)modifiers_findByType(ob, eModifierType_Sph);
 +      
 +      block= uiNewBlock(&curarea->uiblocks, "object_sph", UI_EMBOSS, UI_HELV, curarea->win);
 +      if(uiNewPanel(curarea, block, "Sph ", "Physics", 640, 0, 318, 204)==0) return;
 +      uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 +      
 +      val = (sphmd ? 1:0);
 +      
 +
 +      but = uiDefButI(block, TOG, REDRAWBUTSOBJECT, "Sph",    10,200,130,20, &val, 0, 0, 0, 0, "Sets object to become Sph");
 +      uiButSetFunc(but, object_sph__enabletoggle, ob, NULL);
 +
 +
 +      uiDefBut(block, LABEL, 0, "",10,10,300,0, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
 +      
 +      if(sphmd)
 +      {
 +              if(sphmd->sim_parms && (sphmd->sim_parms->flags & SPH_SIMSETTINGS_FLAG_DOMAIN))
 +              {
 +                      uiDefBut(block, BUT, B_SPH_BAKE, "BAKE",10, 180,300,20, NULL, 0.0, 0.0, 10, 0, "Perform simulation and output and surface&preview meshes for each frame.");
 +              }
 +              
 +              uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Domain", 10, 160, 100, 20, (short *)&sphmd->sim_parms->flags, 15.0, SPH_SIMSETTINGS_FLAG_DOMAIN,   0.0, 0.0, " ");
 +              uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Fluid", 110, 160, 100, 20, (short *)&sphmd->sim_parms->flags, 15.0, SPH_SIMSETTINGS_FLAG_FLUID,   0.0, 0.0, " ");
 +              uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Obstacle", 210, 160, 100, 20, (short *)&sphmd->sim_parms->flags, 15.0, SPH_SIMSETTINGS_FLAG_OBSTACLE,   0.0, 0.0, " ");
 +              
 +              if(sphmd->sim_parms && (sphmd->sim_parms->flags & SPH_SIMSETTINGS_FLAG_DOMAIN))
 +              {
 +                      uiDefButBitI(block, TOG, SPH_SIMSETTINGS_FLAG_GHOSTS, REDRAWBUTSOBJECT, "Ghosts",10,140,100,20, &sphmd->sim_parms->flags, 0, 0, 0, 0, " ");
 +                      uiDefButBitI(block, TOG, SPH_SIMSETTINGS_FLAG_MULTIRES, REDRAWBUTSOBJECT, "Multires",110,140,100,20, &sphmd->sim_parms->flags, 0, 0, 0, 0, " ");
 +                      uiDefButBitI(block, TOG, SPH_SIMSETTINGS_FLAG_VORTICITY, REDRAWBUTSOBJECT, "Vorticity",210,140,100,20, &sphmd->sim_parms->flags, 0, 0, 0, 0, " ");
 +                      
 +                      // timestep
 +                      uiDefButF(block, NUM, REDRAWBUTSOBJECT, "Timestep:",10,120,100,20, &sphmd->sim_parms->timestep, 0.0, 1.0, 0.0001f, 0, " ");
 +                      // totaltime
 +                      uiDefButF(block, NUM, REDRAWBUTSOBJECT, "Totaltime:",110,120,100,20, &sphmd->sim_parms->totaltime, 0.0, 10000.0, 0.001f, 0, " ");
 +                      uiDefButF(block, NUM, REDRAWBUTSOBJECT, "Sampling distance:",210,120,100,20, &sphmd->sim_parms->samplingdistance, 0.0, 1.0, 0.0001f, 0, " ");
 +                      uiDefButF(block, NUM, REDRAWBUTSOBJECT, "Smoothing Length:",10,100,100,20, &sphmd->sim_parms->smoothinglength, 0.0, 10.0, 0.1f, 0, " ");
 +                      
 +                      uiDefButI(block, NUM, REDRAWBUTSOBJECT, "Surface:",110,100,100,20, &sphmd->sim_parms->computesurfaceevery, 0.0, 1000.0, 1.0, 0, " ");
 +                      uiDefButI(block, NUM, REDRAWBUTSOBJECT, "Fast Marching:",210,100,100,20, &sphmd->sim_parms->fastmarchingevery, 0.0, 1000.0, 1.0, 0, " ");
 +              }
 +              else if(sphmd->sim_parms && (sphmd->sim_parms->flags & SPH_SIMSETTINGS_FLAG_FLUID))
 +              {
 +                      uiDefButI(block, NUM, REDRAWBUTSOBJECT, "Resolution:",10,120,100,20, &sphmd->sim_parms->resolution, 1.0, 1000.0, 1.0f, 0, " ");
 +              }
 +      }
 +      
 +      
 +      uiBlockEndAlign(block);
 +}
 +
  void object_panels()
  {
        Object *ob;
@@@ -5843,7 -5709,6 +5844,7 @@@ void physics_panels(
                object_panel_cloth(ob);
                object_panel_cloth_II(ob);
                object_panel_cloth_III(ob);
 +              object_panel_sph(ob);
                object_panel_fluidsim(ob);
        }
  }
index 17b51249ac2fa11c9a76be79fb27a8c957de4ddc,045b98bb7844216120ad6bc87f9d5bd54366ff3a..d5b1f023d7039b42ef97f062a58a31e1c265a93a
@@@ -1883,13 -1883,11 +1883,13 @@@ static void draw_em_measure_stats(Objec
  {
        EditEdge *eed;
        EditFace *efa;
 +      EditVert *eve;
        float v1[3], v2[3], v3[3], v4[3];
        float fvec[3];
        char val[32]; /* Stores the measurement display text here */
        char conv_float[5]; /* Use a float conversion matching the grid size */
        float area, col[3]; /* area of the face,  color of the text to draw */
 +      int i = 0;
        
        /* make the precission of the pronted value proportionate to the gridsize */
        if ((G.vd->grid) < 0.01)
                if(col[1]> 0.5) {col[0]*=0.7; col[2]*= 0.7;}
                else col[1]= col[1]*0.7 + 0.3;
                glColor3fv(col);
 -              
 +              /*
                for(efa= em->faces.first; efa; efa= efa->next) {
                        if((efa->f & SELECT) || (G.moving && faceselectedOR(efa, SELECT)) ) {
                                VECCOPY(v1, efa->v1->co);
                                glRasterPos3fv(efa->cent);
                                BMF_DrawString( G.fonts, val);
                        }
 +              }*/
 +              
 +              /* draw IDs of mesh vertexes */
 +              for(eve = em->verts.first; eve; eve = eve->next) {
 +                      char val[32];
 +                      float fvec[3];
 +                      VecLerpf(fvec, ob->loc, eve->co, 1.1);
 +                      glRasterPos3f(fvec[0], fvec[1], fvec[2]);
 +
 +                      sprintf(val, "%d", eve->keyindex);
 +                      BMF_DrawString(G.fonts, val);
 +              }
 +              for(efa= em->faces.first; efa; efa= efa->next) {
 +                      char val[32];
 +                      sprintf(val, "%d", i);
 +                      glRasterPos3fv(efa->cent);
 +                      BMF_DrawString( G.fonts, val);
 +                      i++;
                }
        }
  
@@@ -4253,6 -4233,7 +4253,7 @@@ static void draw_forcefield(Object *ob
                drawcircball(GL_LINE_LOOP, vec, size, tmat);
                vec[2]= 1.5*force_val;
                drawcircball(GL_LINE_LOOP, vec, size, tmat);
+               vec[2] = 0; /* reset vec for max dist circle */
                
        }
        else if (pd->forcefield == PFIELD_FORCE) {