- modified patch #4681, for scons compiling
authorNils Thuerey <nils@thuerey.de>
Tue, 22 Aug 2006 11:18:00 +0000 (11:18 +0000)
committerNils Thuerey <nils@thuerey.de>
Tue, 22 Aug 2006 11:18:00 +0000 (11:18 +0000)
  of the fluidsim can now be disabled with the
flag: BF_NO_ELBEEM='true', e.g. for irix systems.
(The number of ifdefs from the original
patch was reduced, and the defines are now
only necessary when elbeem is switched off.)
- particle generation option is available again

SConstruct
intern/SConscript
intern/elbeem/extern/elbeem.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/object.c
source/blender/src/buttons_object.c
source/blender/src/fluidsim.c
tools/btools.py

index 24f723d9f1b094d5040ef3a1270915d394254182..bc1dd8e47aac81c75a9da429135803911be51221 100644 (file)
@@ -159,6 +159,12 @@ else:
 opts = btools.read_opts(optfiles, B.arguments)
 opts.Update(env)
 
+# disable elbeem (fluidsim) compilation?
+if env['BF_NO_ELBEEM'] == 'true':
+       env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
+       env['CXXFLAGS'].append('-DDISABLE_ELBEEM')
+       env['CCFLAGS'].append('-DDISABLE_ELBEEM')
+
 #check for additional debug libnames
 
 if env.has_key('BF_DEBUG_LIBS'):
@@ -375,7 +381,6 @@ if not env['WITH_BF_GAMEENGINE']:
     blendernogame = env.Alias('blendernogame', B.program_list)
     Depends(blendernogame,installtarget)
 
-
 Default(B.program_list)
 Default(installtarget)
 
index 606a81ae923de8b29cc75d28e18116bbd18e0581..ecb7f29fab6b9ea22bdbd5d76bc5c7a9ca5d7a6b 100644 (file)
@@ -1,4 +1,6 @@
 #!/usr/bin/python
+Import ('env')
+
 SConscript(['SoundSystem/SConscript',
             'string/SConscript',
             'ghost/SConscript',
@@ -10,7 +12,6 @@ SConscript(['SoundSystem/SConscript',
             'decimation/SConscript',
             'iksolver/SConscript',
             'boolop/SConscript',
-            'elbeem/SConscript',
             'opennl/SConscript'])
 
 # NEW_CSG was intended for intern/csg, but
@@ -19,6 +20,9 @@ SConscript(['SoundSystem/SConscript',
 # perhaps get rid of intern/csg?
 NEW_CSG='false'
 
+if env['BF_NO_ELBEEM'] == 'false':
+       SConscript(['elbeem/SConscript'])
+
 if NEW_CSG=='false':
        SConscript(['bsp/SConscript'])
 else:
index 8eb8a5433b195cc6643a97f14f0c267a6d44cc5a..ea21e807a6f9b45936642eaa5bc9bc33a99fcfef 100644 (file)
@@ -78,6 +78,7 @@ typedef struct elbeemSimulationSettings {
        short generateVertexVectors;
        /* strength of surface smoothing */
        float surfaceSmoothing;
+       // TODO add surf gen flags
 
        /* global transformation to apply to fluidsim mesh */
        float surfaceTrafo[4*4];
index 94e4dabeda4acc7e312d4b718200d9c670e02be5..4187e5c03201a2305e88f867107921f15ebcefa2 100644 (file)
@@ -2023,7 +2023,7 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3], DerivedM
                        }
                }
        }
-
+       
        if (useDeform) {
                if(do_ob_key(ob))       /* shape key makes deform verts */
                        deformedVerts = mesh_getVertexCos(me, &numVerts);
@@ -2585,13 +2585,14 @@ float *mesh_get_mapped_verts_nors(Object *ob)
 
 /* ************************* fluidsim bobj file handling **************************** */
 
+#ifndef DISABLE_ELBEEM
+
 #ifdef WIN32
 #ifndef snprintf
 #define snprintf _snprintf
 #endif
 #endif
 
-
 /* write .bobj.gz file for a mesh object */
 void writeBobjgz(char *filename, struct Object *ob, int useGlobalCoords, int append, float time) 
 {
@@ -3144,4 +3145,11 @@ void fluidsimGetAxisAlignedBB(struct Mesh *mesh, float obmat[][4],
        }
 }
 
+#else // DISABLE_ELBEEM
+
+/* dummy for mesh_calc_modifiers */
+void loadFluidsimMesh(Object *srcob, int useRenderParams) {
+}
+
+#endif // DISABLE_ELBEEM
 
index d18620283e4431042b29da83691fd4e624035375..abadc799e92c4970898420506aa45634f2f3bdd7 100644 (file)
 #include "DNA_object_force.h"
 #include "DNA_texture_types.h"
 #include "DNA_scene_types.h"
-// FSPARTICLE
-#include "DNA_object_fluidsim.h"
-#include "LBM_fluidsim.h"
-#include <zlib.h>
-#include <string.h>
 
 #include "BLI_arithb.h"
 #include "BLI_blenlib.h"
 #include "BKE_utildefines.h"
 
 #include "PIL_time.h"
-#include "elbeem.h"
 #include "RE_render_ext.h"
 
+/* fluid sim particle import */
+#ifndef DISABLE_ELBEEM
+#include "DNA_object_fluidsim.h"
+#include "LBM_fluidsim.h"
+#include "elbeem.h"
+#include <zlib.h>
+#include <string.h>
+#endif // DISABLE_ELBEEM
+
 /* temporal struct, used for reading return of mesh_get_mapped_verts_nors() */
 typedef struct VeNoCo {
        float co[3], no[3];
@@ -1682,7 +1685,8 @@ void build_particle_system(Object *ob)
        
        printf("build particles\n");
        
-       // FSPARTICLE all own created...
+       /* fluid sim particle import handling, actual loading */
+       #ifndef DISABLE_ELBEEM
        if( (1) && (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && 
            (ob->fluidsimSettings) && 
                  (ob->fluidsimSettings->type == OB_FLUIDSIM_PARTICLE)) {
@@ -1775,8 +1779,8 @@ void build_particle_system(Object *ob)
                snprintf(debugStrBuffer,256,"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d  \n", paf->totpart,activeParts,fileParts,readMask);
                elbeemDebugOut(debugStrBuffer);
                return;
-       }
-       
+       } // fluid sim particles done
+       #endif // DISABLE_ELBEEM
        
        if(paf->end < paf->sta) return;
        
index 5ce83c19033285ef484d0a7714ae18286a8a5173..cb5df5ef2be4f8f0dba4901d7789566928dd7bbb 100644 (file)
@@ -904,7 +904,10 @@ Object *copy_object(Object *ob)
        /* NT copy fluid sim setting memory */
        if(obn->fluidsimSettings) {
                obn->fluidsimSettings = fluidsimSettingsCopy(ob->fluidsimSettings);
-               obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
+               /* copying might fail... */
+               if(obn->fluidsimSettings) {
+                       obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
+               }
        }
        
        obn->derivedDeform = NULL;
index cedd631f7e2faf85ce05d9d399c94d9ad75f6dc8..339d0affd784ebfe701a456bbe81b0b93e66480b 100644 (file)
@@ -1461,8 +1461,7 @@ void softbody_bake(Object *ob)
        allqueue(REDRAWBUTSOBJECT, 0);
 }
 
-
-// NT store processed path & file prefix for fluidsim bake directory
+// store processed path & file prefix for fluidsim bake directory
 void fluidsimFilesel(char *selection)
 {
        Object *ob = OBACT;
@@ -1471,7 +1470,6 @@ void fluidsimFilesel(char *selection)
        char *srch, *srchSub, *srchExt, *lastFound;
        int isElbeemSurf = 0;
 
-       // check cfg?
        // make prefix
        strcpy(srcDir, selection);
        BLI_splitdirstring(srcDir, srcFile);
@@ -1506,7 +1504,6 @@ void fluidsimFilesel(char *selection)
        }
 
        if(ob->fluidsimSettings) {
-               //strcpy(ob->fluidsimSettings->surfdataPath, selection);
                strcpy(ob->fluidsimSettings->surfdataPath, srcDir);
                //not necessary? strcat(ob->fluidsimSettings->surfdataPath, "/");
                strcat(ob->fluidsimSettings->surfdataPath, prefix);
@@ -1599,7 +1596,6 @@ void do_object_panels(unsigned short event)
                allqueue(REDRAWBUTSOBJECT, 0);
                allqueue(REDRAWVIEW3D, 0);
                break;
-
        case B_FLUIDSIM_BAKE:
                ob= OBACT;
                /* write config files (currently no simulation) */
@@ -2521,6 +2517,7 @@ static void object_panel_particles(Object *ob)
 /* NT - Panel for fluidsim settings */
 static void object_panel_fluidsim(Object *ob)
 {
+#ifndef DISABLE_ELBEEM
        uiBlock *block;
        int yline = 160;
        const int lineHeight = 20;
@@ -2567,7 +2564,6 @@ static void object_panel_fluidsim(Object *ob)
                                elbeemEstimateMemreq(fss->resolutionxyz, 
                                                ob->fluidsimSettings->bbSize[0],ob->fluidsimSettings->bbSize[1],ob->fluidsimSettings->bbSize[2], fss->maxRefine, memString);
                                
-                               //uiDefButBitS(block, TOG, 1, REDRAWBUTSOBJECT, "Advanced>>",    0,yline, 75,objHeight, &fss->show_advancedoptions, 0, 0, 0, 0, "Show advanced domain options.");
                                uiBlockBeginAlign(block);
                                uiDefButS(block, ROW, REDRAWBUTSOBJECT, "Std",   0,yline, 25,objHeight, &fss->show_advancedoptions, 16.0, 0, 20.0, 0, "Show standard domain options.");
                                uiDefButS(block, ROW, REDRAWBUTSOBJECT, "Adv",  25,yline, 25,objHeight, &fss->show_advancedoptions, 16.0, 1, 20.0, 1, "Show advanced domain options.");
@@ -2676,6 +2672,9 @@ static void object_panel_fluidsim(Object *ob)
                                        uiDefBut(block, LABEL, 0, "Tracer Particles:",          0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
                                        uiDefButI(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->generateTracers, 0.0, 10000.0, 10,0, "Number of tracer particles to generate.");
                                        yline -= lineHeight;
+                                       uiDefBut(block, LABEL, 0, "Generate Particles:",                0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
+                                       uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->generateParticles, 0.0, 10.0, 10,0, "Amount of particles to generate (0=off, 1=normal, >1=more).");
+                                       yline -= lineHeight;
 
                                        uiDefBut(block, LABEL, 0, "Surface Smoothing:",         0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
                                        uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->surfaceSmoothing, 0.0, 5.0, 10,0, "Amount of surface smoothing (0=off, 1=normal, >1=stronger smoothing).");
@@ -2798,6 +2797,7 @@ static void object_panel_fluidsim(Object *ob)
                uiDefBut(block, LABEL, 0, "Only Mesh Objects can participate", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
                yline -= lineHeight;
        }
+#endif // DISABLE_ELBEEM
 }
 
 void object_panels()
index f88a6615143a1dd22b23af6a5e69424b3d1f686d..c555aea654eb5886d4e97d490c082d6d0995cc5f 100644 (file)
@@ -71,7 +71,7 @@
 #include "BKE_DerivedMesh.h"
 #include "BKE_ipo.h"
 #include "LBM_fluidsim.h"
-// TODO FIXME double elbeem.h in intern/extern...
+// warning - double elbeem.h in intern/extern...
 #include "elbeem.h"
 
 #include "BLI_editVert.h"
@@ -140,6 +140,11 @@ typedef struct {
 } fluidsimDerivedMesh;
 
 
+
+/* enable/disable overall compilation */
+#ifndef DISABLE_ELBEEM
+
+
 /* ********************** fluid sim settings struct functions ********************** */
 
 /* allocates and initializes general main data */
@@ -1399,3 +1404,24 @@ void fluidsimBake(struct Object *ob)
 }
 
 
+#else /* DISABLE_ELBEEM */
+
+/* compile dummy functions for disabled fluid sim */
+
+FluidsimSettings *fluidsimSettingsNew(struct Object *srcob) {
+       return NULL;
+}
+
+void fluidsimSettingsFree(FluidsimSettings *fss) {
+}
+
+FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) {
+       return NULL;
+}
+
+/* only compile dummy functions */
+void fluidsimBake(struct Object *ob) {
+}
+
+#endif /* DISABLE_ELBEEM */
+
index 6f3c8537c688622c8f690590d0d91dd0b94fcf83..b3bb097a24019f1ac0ceef66b981dfb14bdce00d 100755 (executable)
@@ -110,6 +110,7 @@ def SetupBufferedOutput( env ):
 def read_opts(cfg, args):
     localopts = Options.Options(cfg, args)
     localopts.AddOptions(
+        ('LCGDIR', 'The path to the CVS Lib folder, if you platform has it'),
         ('BF_DEBUG_LIBS', 'list of libraries to build with debug symbols'),
         ('BF_PYTHON', 'base path for python', ''),
         ('BF_PYTHON_VERSION', 'Python version to use', ''),
@@ -118,7 +119,7 @@ def read_opts(cfg, args):
         ('BF_PYTHON_LIB', 'Python library', ''),
         ('BF_PYTHON_LIBPATH', 'Library path', ''),
         ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
-
+                               ('BF_NO_ELBEEM', 'Disable Fluid Sim', 'false'),
         (BoolOption('WITH_BF_OPENAL', 'Use OpenAL if true', '')),
         ('BF_OPENAL', 'base path for OpenAL', ''),
         ('BF_OPENAL_INC', 'include path for python headers', ''),