Commit: d28cb620dd03db369f8c02c294fc0074f3f598c7
Author: Sebastián Barschkis
Date:   Sat Nov 12 02:31:04 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBd28cb620dd03db369f8c02c294fc0074f3f598c7

added numObstacle grid in manta script and access functions

===================================================================

M       intern/mantaflow/extern/manta_fluid_API.h
M       intern/mantaflow/intern/FLUID.cpp
M       intern/mantaflow/intern/FLUID.h
M       intern/mantaflow/intern/manta_fluid_API.cpp
M       intern/mantaflow/intern/strings/liquid_script.h
M       intern/mantaflow/intern/strings/smoke_script.h

===================================================================

diff --git a/intern/mantaflow/extern/manta_fluid_API.h 
b/intern/mantaflow/extern/manta_fluid_API.h
index 6a3fb1b..6b5e4de 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -117,6 +117,7 @@ void liquid_save_data_high(struct FLUID *liquid, char 
*pathname);
 void liquid_load_data_high(struct FLUID *liquid, char *pathname);
 void liquid_manta_export(struct FLUID* smoke, struct SmokeModifierData *smd);
 
+int *fluid_get_num_obstacle(struct FLUID *fluid);
 
 #ifdef __cplusplus
 }
diff --git a/intern/mantaflow/intern/FLUID.cpp 
b/intern/mantaflow/intern/FLUID.cpp
index 928398d..7090476 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -4,7 +4,7 @@
  * 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. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -451,7 +451,7 @@ FLUID::~FLUID()
        mUsingHeat    = false;
        mUsingFire    = false;
        mUsingColors  = false;
-       mUsingHighRes = false;  
+       mUsingHighRes = false;
 }
 
 void FLUID::runPythonString(std::vector<std::string> commands)
@@ -871,7 +871,8 @@ void FLUID::updatePointers(SmokeModifierData *smd)
 {
        std::cout << "Updating pointers low res" << std::endl;
 
-       mObstacle = (int*) getGridPointer("flags", "s");
+       mObstacle    = (int*) getGridPointer("flags",  "s");
+       mNumObstacle = (int*) getGridPointer("numObs", "s");
        
        mVelocityX = (float*) getGridPointer("x_vel", "s");
        mVelocityY = (float*) getGridPointer("y_vel", "s");
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index 1de5f35..23174d9 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -4,7 +4,7 @@
  * 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. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -98,7 +98,7 @@ public:
        inline float* getForceY() { return mForceY; }
        inline float* getForceZ() { return mForceZ; }
        inline int* getObstacle() { return mObstacle; }
-       inline unsigned char* getObstaclesAnim() { return mObstaclesAnim; }
+       inline int* getNumObstacle() { return mNumObstacle; }
        inline float* getFlame() { return mFlame; }
        inline float* getFuel() { return mFuel; }
        inline float* getReact() { return mReact; }
@@ -187,7 +187,7 @@ private:
        float* mForceY;
        float* mForceZ;
        int* mObstacle; /* only used (useful) for static obstacles like domain 
boundaries */
-       unsigned char* mObstaclesAnim;
+       int* mNumObstacle;
        float *mFlame;
        float *mFuel;
        float *mReact;
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp 
b/intern/mantaflow/intern/manta_fluid_API.cpp
index f6bcc44..2d4f49d 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -420,12 +420,10 @@ extern "C" void smoke_get_ob_velocity(FLUID *smoke, float 
**x, float **y, float
        *z = smoke->getObVelocityZ();
 }
 
-#if 0
-extern "C" unsigned char *smoke_get_obstacle_anim(FLUID *smoke)
+extern "C" int *fluid_get_num_obstacle(FLUID *fluid)
 {
-       return smoke->getObstaclesAnim();
+       return fluid->getNumObstacle();
 }
-#endif
 
 extern "C" void flame_get_spectrum(unsigned char *spec, int width, float t1, 
float t2)
 {
diff --git a/intern/mantaflow/intern/strings/liquid_script.h 
b/intern/mantaflow/intern/strings/liquid_script.h
index 77b2c45..0b223a4 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -73,7 +73,7 @@ mantaMsg('Liquid variables high')\n";
 const std::string liquid_alloc_low = "\n\
 mantaMsg('Liquid alloc low')\n\
 flags      = s.create(FlagGrid)\n\
-\n\
+numObs     = s.create(IntGrid)\n\
 phiParts   = s.create(LevelsetGrid)\n\
 phi        = s.create(LevelsetGrid)\n\
 phiInit    = s.create(LevelsetGrid)\n\
@@ -272,7 +272,7 @@ def load_liquid_data_low(path):\n\
     x_obvel.load(os.path.join(path, 'x_obvel.uni'))\n\
     y_obvel.load(os.path.join(path, 'y_obvel.uni'))\n\
     z_obvel.load(os.path.join(path, 'z_obvel.uni'))\n\
-       \n\
+    \n\
     pp.load(os.path.join(path, 'pp.uni'))\n\
     pVel.load(os.path.join(path, 'pVel.uni'))\n\
     \n\
@@ -310,7 +310,7 @@ def save_liquid_data_low(path):\n\
     x_obvel.save(os.path.join(path, 'x_obvel.uni'))\n\
     y_obvel.save(os.path.join(path, 'y_obvel.uni'))\n\
     z_obvel.save(os.path.join(path, 'z_obvel.uni'))\n\
-       \n\
+    \n\
     pp.save(os.path.join(path, 'pp.uni'))\n\
     pVel.save(os.path.join(path, 'pVel.uni'))\n\
     \n\
@@ -332,6 +332,7 @@ def save_liquid_data_high(path):\n\
 const std::string liquid_delete_grids_low = "\n\
 mantaMsg('Deleting lowres grids, mesh, particlesystem')\n\
 if 'flags'      in globals() : del flags\n\
+if 'numObs'     in globals() : del numObs\n\
 if 'phiParts'   in globals() : del phiParts\n\
 if 'phi'        in globals() : del phi\n\
 if 'phiInit'    in globals() : del phiInit\n\
diff --git a/intern/mantaflow/intern/strings/smoke_script.h 
b/intern/mantaflow/intern/strings/smoke_script.h
index 8f0ad1b7..cd6aac8 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -89,6 +89,7 @@ const std::string smoke_alloc_low = "\n\
 # prepare grids low\n\
 mantaMsg('Smoke alloc low')\n\
 flags       = s.create(FlagGrid)\n\
+numObs      = s.create(IntGrid)\n\
 vel         = s.create(MACGrid)\n\
 x_vel       = s.create(RealGrid)\n\
 y_vel       = s.create(RealGrid)\n\
@@ -478,6 +479,7 @@ if 'heat' in globals() : del heat\n";
 const std::string smoke_delete_grids_low = "\n\
 mantaMsg('Deleting base grids low')\n\
 if 'flags'       in globals() : del flags\n\
+if 'numObs'      in globals() : del numObs\n\
 if 'vel'         in globals() : del vel\n\
 if 'x_vel'       in globals() : del x_vel\n\
 if 'y_vel'       in globals() : del y_vel\n\

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to