From c2691c93d51409a987381171af920eeec30e484f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastia=CC=81n=20Barschkis?= Date: Fri, 7 Aug 2020 15:33:51 +0200 Subject: Fix T79201: Mantaflow: Fluid guides don't affect simulation. This broke during the OpenVDB update for 2.90. Just making sure that guiding velocity files are being read correctly. --- extern/mantaflow/preprocessed/gitinfo.h | 2 +- extern/mantaflow/preprocessed/grid.h | 102 +++++++++----- extern/mantaflow/preprocessed/grid.h.reg.cpp | 186 +++++++++++++------------ intern/mantaflow/intern/MANTA_main.cpp | 14 +- intern/mantaflow/intern/strings/fluid_script.h | 13 +- source/blender/makesdna/DNA_fluid_types.h | 8 +- 6 files changed, 186 insertions(+), 139 deletions(-) diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index ce088d6c400..e87c8739cf4 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit 841bfd09c068dfb95637c0ec14fa78305286a433" +#define MANTA_GIT_VERSION "commit e2f6e59e3679f88e5100ae2145410cca4971b9df" diff --git a/extern/mantaflow/preprocessed/grid.h b/extern/mantaflow/preprocessed/grid.h index a7aac80891a..9bd4e5d72d9 100644 --- a/extern/mantaflow/preprocessed/grid.h +++ b/extern/mantaflow/preprocessed/grid.h @@ -355,6 +355,38 @@ class GridBase : public PbClass { return isInBounds(Vec3i(i, j, k), bnd); } +#ifdef BLENDER + //! expose name field to Python for Blender + void setName(const std::string &name) + { + mName = name; + } + static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + { + try { + PbArgs _args(_linargs, _kwds); + GridBase *pbo = dynamic_cast(Pb::objFromPy(_self)); + bool noTiming = _args.getOpt("notiming", -1, 0); + pbPreparePlugin(pbo->getParent(), "GridBase::setName", !noTiming); + PyObject *_retval = 0; + { + ArgLocker _lock; + const std::string &name = _args.get("name", 0, &_lock); + pbo->_args.copy(_args); + _retval = getPyNone(); + pbo->setName(name); + pbo->_args.check(); + } + pbFinalizePlugin(pbo->getParent(), "GridBase::setName", !noTiming); + return _retval; + } + catch (std::exception &e) { + pbSetError("GridBase::setName", e.what()); + return 0; + } + } + +#endif protected: GridType mType; Vec3i mSize; @@ -373,7 +405,7 @@ template class Grid : public GridBase { public: //! init new grid, values are set to zero Grid(FluidSolver *parent, bool show = true); - static int _W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static int _W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { PbClass *obj = Pb::objFromPy(_self); if (obj) @@ -410,7 +442,7 @@ template class Grid : public GridBase { typedef GridBase BASETYPE_GRID; int save(std::string name); - static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -435,7 +467,7 @@ template class Grid : public GridBase { } int load(std::string name); - static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -461,7 +493,7 @@ template class Grid : public GridBase { //! set all cells to zero void clear(); - static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -588,7 +620,7 @@ template class Grid : public GridBase { // Grid& operator=(const Grid& a); //! copy content from other grid (use this one instead of operator= !) Grid ©From(const Grid &a, bool copyType = true); - static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -618,7 +650,7 @@ template class Grid : public GridBase { //! get grid type int getGridType(); - static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -643,7 +675,7 @@ template class Grid : public GridBase { //! add/subtract other grid void add(const Grid &a); - static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -669,7 +701,7 @@ template class Grid : public GridBase { } void sub(const Grid &a); - static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -696,7 +728,7 @@ template class Grid : public GridBase { //! set all cells to constant value void setConst(T s); - static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -723,7 +755,7 @@ template class Grid : public GridBase { //! add constant to all grid cells void addConst(T s); - static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -750,7 +782,7 @@ template class Grid : public GridBase { //! add scaled other grid to current one (note, only "Real" factor, "T" type not supported here!) void addScaled(const Grid &a, const T &factor); - static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -778,7 +810,7 @@ template class Grid : public GridBase { //! multiply contents of grid void mult(const Grid &a); - static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -805,7 +837,7 @@ template class Grid : public GridBase { //! multiply each cell by a constant scalar value void multConst(T s); - static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_22(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -832,7 +864,7 @@ template class Grid : public GridBase { //! safely divide contents of grid (with zero check) Grid &safeDivide(const Grid &a); - static PyObject *_W_22(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_23(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -858,7 +890,7 @@ template class Grid : public GridBase { //! clamp content to range (for vec3, clamps each component separately) void clamp(Real min, Real max); - static PyObject *_W_23(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_24(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -886,7 +918,7 @@ template class Grid : public GridBase { //! reduce small values to zero void stomp(const T &threshold); - static PyObject *_W_24(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_25(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -913,7 +945,7 @@ template class Grid : public GridBase { //! permute grid axes, e.g. switch y with z (0,2,1) void permuteAxes(int axis0, int axis1, int axis2); - static PyObject *_W_25(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_26(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -942,7 +974,7 @@ template class Grid : public GridBase { //! permute grid axes, e.g. switch y with z (0,2,1) void permuteAxesCopyToGrid(int axis0, int axis1, int axis2, Grid &out); - static PyObject *_W_26(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -972,7 +1004,7 @@ template class Grid : public GridBase { //! join other grid by either keeping min or max value at cell void join(const Grid &a, bool keepMax = true); - static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1001,7 +1033,7 @@ template class Grid : public GridBase { // common compound operators //! get absolute max value in grid Real getMaxAbs() const; - static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_29(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1026,7 +1058,7 @@ template class Grid : public GridBase { //! get max value in grid Real getMax() const; - static PyObject *_W_29(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_30(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1051,7 +1083,7 @@ template class Grid : public GridBase { //! get min value in grid Real getMin() const; - static PyObject *_W_30(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1076,7 +1108,7 @@ template class Grid : public GridBase { //! calculate L1 norm of grid content Real getL1(int bnd = 0); - static PyObject *_W_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1102,7 +1134,7 @@ template class Grid : public GridBase { //! calculate L2 norm of grid content Real getL2(int bnd = 0); - static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1128,7 +1160,7 @@ template class Grid : public GridBase { //! set all boundary cells to constant value (Dirichlet) void setBound(T value, int boundaryWidth = 1); - static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1156,7 +1188,7 @@ template class Grid : public GridBase { //! set all boundary cells to last inner value (Neumann) void setBoundNeumann(int boundaryWidth = 1); - static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1183,7 +1215,7 @@ template class Grid : public GridBase { //! get data pointer of grid std::string getDataPointer(); - static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1208,7 +1240,7 @@ template class Grid : public GridBase { //! debugging helper, print grid from python. skip boundary of width bnd void printGrid(int zSlice = -1, bool printIndex = false, int bnd = 1); - static PyObject *_W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1276,7 +1308,7 @@ class MACGrid : public Grid { { mType = (GridType)(TypeMAC | TypeVec3); } - static int _W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static int _W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { PbClass *obj = Pb::objFromPy(_self); if (obj) @@ -1358,7 +1390,7 @@ class MACGrid : public Grid { //! set all boundary cells of a MAC grid to certain value (Dirchlet). Respects staggered grid //! locations optionally, only set normal components void setBoundMAC(Vec3 value, int boundaryWidth, bool normalOnly = false); - static PyObject *_W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1399,7 +1431,7 @@ class FlagGrid : public Grid { { mType = (GridType)(TypeFlags | TypeInt); } - static int _W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static int _W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { PbClass *obj = Pb::objFromPy(_self); if (obj) @@ -1579,7 +1611,7 @@ class FlagGrid : public Grid { const std::string &inflow = " ", const std::string &outflow = " ", Grid *phiWalls = 0x00); - static PyObject *_W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1613,7 +1645,7 @@ class FlagGrid : public Grid { //! set fluid flags inside levelset (liquids) void updateFromLevelset(LevelsetGrid &levelset); - static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1640,7 +1672,7 @@ class FlagGrid : public Grid { //! set all cells (except obs/in/outflow) to type (fluid by default) void fillGrid(int type = TypeFluid); - static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_43(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1669,7 +1701,7 @@ class FlagGrid : public Grid { //! warning for large grids! only regular int returned (due to python interface) //! optionally creates mask in RealGrid (1 where flag matches, 0 otherwise) int countCells(int flag, int bnd = 0, Grid *mask = NULL); - static PyObject *_W_43(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_44(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); diff --git a/extern/mantaflow/preprocessed/grid.h.reg.cpp b/extern/mantaflow/preprocessed/grid.h.reg.cpp index 9fe3e7298fa..2c95c002dad 100644 --- a/extern/mantaflow/preprocessed/grid.h.reg.cpp +++ b/extern/mantaflow/preprocessed/grid.h.reg.cpp @@ -8,103 +8,103 @@ namespace Manta { #ifdef _C_FlagGrid static const Pb::Register _R_26("FlagGrid", "FlagGrid", "Grid"); template<> const char *Namify::S = "FlagGrid"; -static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_39); -static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_40); -static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_41); -static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_42); -static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_43); +static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_40); +static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_41); +static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_42); +static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_43); +static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_44); #endif #ifdef _C_Grid static const Pb::Register _R_32("Grid", "Grid", "GridBase"); template<> const char *Namify>::S = "Grid"; -static const Pb::Register _R_33("Grid", "Grid", Grid::_W_9); -static const Pb::Register _R_34("Grid", "save", Grid::_W_10); -static const Pb::Register _R_35("Grid", "load", Grid::_W_11); -static const Pb::Register _R_36("Grid", "clear", Grid::_W_12); -static const Pb::Register _R_37("Grid", "copyFrom", Grid::_W_13); -static const Pb::Register _R_38("Grid", "getGridType", Grid::_W_14); -static const Pb::Register _R_39("Grid", "add", Grid::_W_15); -static const Pb::Register _R_40("Grid", "sub", Grid::_W_16); -static const Pb::Register _R_41("Grid", "setConst", Grid::_W_17); -static const Pb::Register _R_42("Grid", "addConst", Grid::_W_18); -static const Pb::Register _R_43("Grid", "addScaled", Grid::_W_19); -static const Pb::Register _R_44("Grid", "mult", Grid::_W_20); -static const Pb::Register _R_45("Grid", "multConst", Grid::_W_21); -static const Pb::Register _R_46("Grid", "safeDivide", Grid::_W_22); -static const Pb::Register _R_47("Grid", "clamp", Grid::_W_23); -static const Pb::Register _R_48("Grid", "stomp", Grid::_W_24); -static const Pb::Register _R_49("Grid", "permuteAxes", Grid::_W_25); -static const Pb::Register _R_50("Grid", "permuteAxesCopyToGrid", Grid::_W_26); -static const Pb::Register _R_51("Grid", "join", Grid::_W_27); -static const Pb::Register _R_52("Grid", "getMaxAbs", Grid::_W_28); -static const Pb::Register _R_53("Grid", "getMax", Grid::_W_29); -static const Pb::Register _R_54("Grid", "getMin", Grid::_W_30); -static const Pb::Register _R_55("Grid", "getL1", Grid::_W_31); -static const Pb::Register _R_56("Grid", "getL2", Grid::_W_32); -static const Pb::Register _R_57("Grid", "setBound", Grid::_W_33); -static const Pb::Register _R_58("Grid", "setBoundNeumann", Grid::_W_34); -static const Pb::Register _R_59("Grid", "getDataPointer", Grid::_W_35); -static const Pb::Register _R_60("Grid", "printGrid", Grid::_W_36); +static const Pb::Register _R_33("Grid", "Grid", Grid::_W_10); +static const Pb::Register _R_34("Grid", "save", Grid::_W_11); +static const Pb::Register _R_35("Grid", "load", Grid::_W_12); +static const Pb::Register _R_36("Grid", "clear", Grid::_W_13); +static const Pb::Register _R_37("Grid", "copyFrom", Grid::_W_14); +static const Pb::Register _R_38("Grid", "getGridType", Grid::_W_15); +static const Pb::Register _R_39("Grid", "add", Grid::_W_16); +static const Pb::Register _R_40("Grid", "sub", Grid::_W_17); +static const Pb::Register _R_41("Grid", "setConst", Grid::_W_18); +static const Pb::Register _R_42("Grid", "addConst", Grid::_W_19); +static const Pb::Register _R_43("Grid", "addScaled", Grid::_W_20); +static const Pb::Register _R_44("Grid", "mult", Grid::_W_21); +static const Pb::Register _R_45("Grid", "multConst", Grid::_W_22); +static const Pb::Register _R_46("Grid", "safeDivide", Grid::_W_23); +static const Pb::Register _R_47("Grid", "clamp", Grid::_W_24); +static const Pb::Register _R_48("Grid", "stomp", Grid::_W_25); +static const Pb::Register _R_49("Grid", "permuteAxes", Grid::_W_26); +static const Pb::Register _R_50("Grid", "permuteAxesCopyToGrid", Grid::_W_27); +static const Pb::Register _R_51("Grid", "join", Grid::_W_28); +static const Pb::Register _R_52("Grid", "getMaxAbs", Grid::_W_29); +static const Pb::Register _R_53("Grid", "getMax", Grid::_W_30); +static const Pb::Register _R_54("Grid", "getMin", Grid::_W_31); +static const Pb::Register _R_55("Grid", "getL1", Grid::_W_32); +static const Pb::Register _R_56("Grid", "getL2", Grid::_W_33); +static const Pb::Register _R_57("Grid", "setBound", Grid::_W_34); +static const Pb::Register _R_58("Grid", "setBoundNeumann", Grid::_W_35); +static const Pb::Register _R_59("Grid", "getDataPointer", Grid::_W_36); +static const Pb::Register _R_60("Grid", "printGrid", Grid::_W_37); static const Pb::Register _R_61("Grid", "Grid", "GridBase"); template<> const char *Namify>::S = "Grid"; -static const Pb::Register _R_62("Grid", "Grid", Grid::_W_9); -static const Pb::Register _R_63("Grid", "save", Grid::_W_10); -static const Pb::Register _R_64("Grid", "load", Grid::_W_11); -static const Pb::Register _R_65("Grid", "clear", Grid::_W_12); -static const Pb::Register _R_66("Grid", "copyFrom", Grid::_W_13); -static const Pb::Register _R_67("Grid", "getGridType", Grid::_W_14); -static const Pb::Register _R_68("Grid", "add", Grid::_W_15); -static const Pb::Register _R_69("Grid", "sub", Grid::_W_16); -static const Pb::Register _R_70("Grid", "setConst", Grid::_W_17); -static const Pb::Register _R_71("Grid", "addConst", Grid::_W_18); -static const Pb::Register _R_72("Grid", "addScaled", Grid::_W_19); -static const Pb::Register _R_73("Grid", "mult", Grid::_W_20); -static const Pb::Register _R_74("Grid", "multConst", Grid::_W_21); -static const Pb::Register _R_75("Grid", "safeDivide", Grid::_W_22); -static const Pb::Register _R_76("Grid", "clamp", Grid::_W_23); -static const Pb::Register _R_77("Grid", "stomp", Grid::_W_24); -static const Pb::Register _R_78("Grid", "permuteAxes", Grid::_W_25); -static const Pb::Register _R_79("Grid", "permuteAxesCopyToGrid", Grid::_W_26); -static const Pb::Register _R_80("Grid", "join", Grid::_W_27); -static const Pb::Register _R_81("Grid", "getMaxAbs", Grid::_W_28); -static const Pb::Register _R_82("Grid", "getMax", Grid::_W_29); -static const Pb::Register _R_83("Grid", "getMin", Grid::_W_30); -static const Pb::Register _R_84("Grid", "getL1", Grid::_W_31); -static const Pb::Register _R_85("Grid", "getL2", Grid::_W_32); -static const Pb::Register _R_86("Grid", "setBound", Grid::_W_33); -static const Pb::Register _R_87("Grid", "setBoundNeumann", Grid::_W_34); -static const Pb::Register _R_88("Grid", "getDataPointer", Grid::_W_35); -static const Pb::Register _R_89("Grid", "printGrid", Grid::_W_36); +static const Pb::Register _R_62("Grid", "Grid", Grid::_W_10); +static const Pb::Register _R_63("Grid", "save", Grid::_W_11); +static const Pb::Register _R_64("Grid", "load", Grid::_W_12); +static const Pb::Register _R_65("Grid", "clear", Grid::_W_13); +static const Pb::Register _R_66("Grid", "copyFrom", Grid::_W_14); +static const Pb::Register _R_67("Grid", "getGridType", Grid::_W_15); +static const Pb::Register _R_68("Grid", "add", Grid::_W_16); +static const Pb::Register _R_69("Grid", "sub", Grid::_W_17); +static const Pb::Register _R_70("Grid", "setConst", Grid::_W_18); +static const Pb::Register _R_71("Grid", "addConst", Grid::_W_19); +static const Pb::Register _R_72("Grid", "addScaled", Grid::_W_20); +static const Pb::Register _R_73("Grid", "mult", Grid::_W_21); +static const Pb::Register _R_74("Grid", "multConst", Grid::_W_22); +static const Pb::Register _R_75("Grid", "safeDivide", Grid::_W_23); +static const Pb::Register _R_76("Grid", "clamp", Grid::_W_24); +static const Pb::Register _R_77("Grid", "stomp", Grid::_W_25); +static const Pb::Register _R_78("Grid", "permuteAxes", Grid::_W_26); +static const Pb::Register _R_79("Grid", "permuteAxesCopyToGrid", Grid::_W_27); +static const Pb::Register _R_80("Grid", "join", Grid::_W_28); +static const Pb::Register _R_81("Grid", "getMaxAbs", Grid::_W_29); +static const Pb::Register _R_82("Grid", "getMax", Grid::_W_30); +static const Pb::Register _R_83("Grid", "getMin", Grid::_W_31); +static const Pb::Register _R_84("Grid", "getL1", Grid::_W_32); +static const Pb::Register _R_85("Grid", "getL2", Grid::_W_33); +static const Pb::Register _R_86("Grid", "setBound", Grid::_W_34); +static const Pb::Register _R_87("Grid", "setBoundNeumann", Grid::_W_35); +static const Pb::Register _R_88("Grid", "getDataPointer", Grid::_W_36); +static const Pb::Register _R_89("Grid", "printGrid", Grid::_W_37); static const Pb::Register _R_90("Grid", "Grid", "GridBase"); template<> const char *Namify>::S = "Grid"; -static const Pb::Register _R_91("Grid", "Grid", Grid::_W_9); -static const Pb::Register _R_92("Grid", "save", Grid::_W_10); -static const Pb::Register _R_93("Grid", "load", Grid::_W_11); -static const Pb::Register _R_94("Grid", "clear", Grid::_W_12); -static const Pb::Register _R_95("Grid", "copyFrom", Grid::_W_13); -static const Pb::Register _R_96("Grid", "getGridType", Grid::_W_14); -static const Pb::Register _R_97("Grid", "add", Grid::_W_15); -static const Pb::Register _R_98("Grid", "sub", Grid::_W_16); -static const Pb::Register _R_99("Grid", "setConst", Grid::_W_17); -static const Pb::Register _R_100("Grid", "addConst", Grid::_W_18); -static const Pb::Register _R_101("Grid", "addScaled", Grid::_W_19); -static const Pb::Register _R_102("Grid", "mult", Grid::_W_20); -static const Pb::Register _R_103("Grid", "multConst", Grid::_W_21); -static const Pb::Register _R_104("Grid", "safeDivide", Grid::_W_22); -static const Pb::Register _R_105("Grid", "clamp", Grid::_W_23); -static const Pb::Register _R_106("Grid", "stomp", Grid::_W_24); -static const Pb::Register _R_107("Grid", "permuteAxes", Grid::_W_25); -static const Pb::Register _R_108("Grid", "permuteAxesCopyToGrid", Grid::_W_26); -static const Pb::Register _R_109("Grid", "join", Grid::_W_27); -static const Pb::Register _R_110("Grid", "getMaxAbs", Grid::_W_28); -static const Pb::Register _R_111("Grid", "getMax", Grid::_W_29); -static const Pb::Register _R_112("Grid", "getMin", Grid::_W_30); -static const Pb::Register _R_113("Grid", "getL1", Grid::_W_31); -static const Pb::Register _R_114("Grid", "getL2", Grid::_W_32); -static const Pb::Register _R_115("Grid", "setBound", Grid::_W_33); -static const Pb::Register _R_116("Grid", "setBoundNeumann", Grid::_W_34); -static const Pb::Register _R_117("Grid", "getDataPointer", Grid::_W_35); -static const Pb::Register _R_118("Grid", "printGrid", Grid::_W_36); +static const Pb::Register _R_91("Grid", "Grid", Grid::_W_10); +static const Pb::Register _R_92("Grid", "save", Grid::_W_11); +static const Pb::Register _R_93("Grid", "load", Grid::_W_12); +static const Pb::Register _R_94("Grid", "clear", Grid::_W_13); +static const Pb::Register _R_95("Grid", "copyFrom", Grid::_W_14); +static const Pb::Register _R_96("Grid", "getGridType", Grid::_W_15); +static const Pb::Register _R_97("Grid", "add", Grid::_W_16); +static const Pb::Register _R_98("Grid", "sub", Grid::_W_17); +static const Pb::Register _R_99("Grid", "setConst", Grid::_W_18); +static const Pb::Register _R_100("Grid", "addConst", Grid::_W_19); +static const Pb::Register _R_101("Grid", "addScaled", Grid::_W_20); +static const Pb::Register _R_102("Grid", "mult", Grid::_W_21); +static const Pb::Register _R_103("Grid", "multConst", Grid::_W_22); +static const Pb::Register _R_104("Grid", "safeDivide", Grid::_W_23); +static const Pb::Register _R_105("Grid", "clamp", Grid::_W_24); +static const Pb::Register _R_106("Grid", "stomp", Grid::_W_25); +static const Pb::Register _R_107("Grid", "permuteAxes", Grid::_W_26); +static const Pb::Register _R_108("Grid", "permuteAxesCopyToGrid", Grid::_W_27); +static const Pb::Register _R_109("Grid", "join", Grid::_W_28); +static const Pb::Register _R_110("Grid", "getMaxAbs", Grid::_W_29); +static const Pb::Register _R_111("Grid", "getMax", Grid::_W_30); +static const Pb::Register _R_112("Grid", "getMin", Grid::_W_31); +static const Pb::Register _R_113("Grid", "getL1", Grid::_W_32); +static const Pb::Register _R_114("Grid", "getL2", Grid::_W_33); +static const Pb::Register _R_115("Grid", "setBound", Grid::_W_34); +static const Pb::Register _R_116("Grid", "setBoundNeumann", Grid::_W_35); +static const Pb::Register _R_117("Grid", "getDataPointer", Grid::_W_36); +static const Pb::Register _R_118("Grid", "printGrid", Grid::_W_37); #endif #ifdef _C_GridBase static const Pb::Register _R_119("GridBase", "GridBase", "PbClass"); @@ -118,12 +118,13 @@ static const Pb::Register _R_125("GridBase", "is3D", GridBase::_W_5); static const Pb::Register _R_126("GridBase", "is4D", GridBase::_W_6); static const Pb::Register _R_127("GridBase", "getSizeT", GridBase::_W_7); static const Pb::Register _R_128("GridBase", "getStrideT", GridBase::_W_8); +static const Pb::Register _R_129("GridBase", "setName", GridBase::_W_9); #endif #ifdef _C_MACGrid -static const Pb::Register _R_129("MACGrid", "MACGrid", "Grid"); +static const Pb::Register _R_130("MACGrid", "MACGrid", "Grid"); template<> const char *Namify::S = "MACGrid"; -static const Pb::Register _R_130("MACGrid", "MACGrid", MACGrid::_W_37); -static const Pb::Register _R_131("MACGrid", "setBoundMAC", MACGrid::_W_38); +static const Pb::Register _R_131("MACGrid", "MACGrid", MACGrid::_W_38); +static const Pb::Register _R_132("MACGrid", "setBoundMAC", MACGrid::_W_39); #endif static const Pb::Register _R_7("GridType_TypeNone", 0); static const Pb::Register _R_8("GridType_TypeReal", 1); @@ -253,6 +254,7 @@ void PbRegister_file_7() KEEP_UNUSED(_R_129); KEEP_UNUSED(_R_130); KEEP_UNUSED(_R_131); + KEEP_UNUSED(_R_132); } } } // namespace Manta \ No newline at end of file diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index 5b2cbb09979..6e6451be725 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -1014,7 +1014,7 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd) mRNAMap["NAME_GUIDEVEL_X"] = FLUID_NAME_GUIDEVEL_X; mRNAMap["NAME_GUIDEVEL_Y"] = FLUID_NAME_GUIDEVEL_Y; mRNAMap["NAME_GUIDEVEL_Z"] = FLUID_NAME_GUIDEVEL_Z; - mRNAMap["NAME_GUIDEVEL"] = FLUID_NAME_GUIDEVEL; + mRNAMap["NAME_VELOCITY_GUIDE"] = FLUID_NAME_VELOCITY_GUIDE; /* Cache file names. */ mRNAMap["NAME_CONFIG"] = FLUID_NAME_CONFIG; @@ -1539,6 +1539,7 @@ bool MANTA::bakeGuiding(FluidModifierData *fmd, int framenr) cacheDirGuiding[0] = '\0'; string volume_format = getCacheFileEnding(fds->cache_data_format); + string resumable_cache = !(fds->flags & FLUID_DOMAIN_USE_RESUMABLE_CACHE) ? "False" : "True"; BLI_path_join(cacheDirGuiding, sizeof(cacheDirGuiding), @@ -1549,7 +1550,7 @@ bool MANTA::bakeGuiding(FluidModifierData *fmd, int framenr) ss.str(""); ss << "bake_guiding_" << mCurrentID << "('" << escapeSlashes(cacheDirGuiding) << "', " << framenr - << ", '" << volume_format << "')"; + << ", '" << volume_format << "', " << resumable_cache << ")"; pythonCommands.push_back(ss.str()); return runPythonString(pythonCommands); @@ -2190,9 +2191,16 @@ bool MANTA::hasParticles(FluidModifierData *fmd, int framenr) bool MANTA::hasGuiding(FluidModifierData *fmd, int framenr, bool sourceDomain) { string subdirectory = (sourceDomain) ? FLUID_DOMAIN_DIR_DATA : FLUID_DOMAIN_DIR_GUIDE; - string filename = (sourceDomain) ? FLUID_NAME_VELOCITY : FLUID_NAME_GUIDEVEL; + string filename = (sourceDomain) ? FLUID_NAME_DATA : FLUID_NAME_GUIDING; string extension = getCacheFileEnding(fmd->domain->cache_data_format); bool exists = BLI_exists(getFile(fmd, subdirectory, filename, extension, framenr).c_str()); + + /* Check old file naming. */ + if (!exists) { + filename = (sourceDomain) ? FLUID_NAME_VEL : FLUID_NAME_GUIDEVEL; + exists = BLI_exists(getFile(fmd, subdirectory, filename, extension, framenr).c_str()); + } + if (with_debug) cout << "Fluid: Has Guiding: " << exists << endl; diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h index 0045d839be4..83ad201fcbd 100644 --- a/intern/mantaflow/intern/strings/fluid_script.h +++ b/intern/mantaflow/intern/strings/fluid_script.h @@ -329,7 +329,7 @@ y_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_Y$')\n\ z_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_Z$')\n\ \n\ # Final guide vel grid needs to have independent size\n\ -guidevel_sg$ID$ = sg$ID$.create(MACGrid, name='$NAME_GUIDEVEL$')\n\ +guidevel_sg$ID$ = sg$ID$.create(MACGrid, name='$NAME_VELOCITY_GUIDE$')\n\ \n\ # Keep track of important objects in dict to load them later on\n\ fluid_guiding_dict_s$ID$ = { 'guidevel' : guidevel_sg$ID$ }\n"; @@ -700,14 +700,16 @@ const std::string fluid_load_guiding = "\n\ def fluid_load_guiding_$ID$(path, framenr, file_format):\n\ mantaMsg('Fluid load guiding, frame ' + str(framenr))\n\ + guidevel_sg$ID$.setName('$NAME_VELOCITY_GUIDE$')\n\ fluid_file_import_s$ID$(dict=fluid_guiding_dict_s$ID$, path=path, framenr=framenr, file_format=file_format, file_name=file_guiding_s$ID$)\n"; const std::string fluid_load_vel = "\n\ def fluid_load_vel_$ID$(path, framenr, file_format):\n\ mantaMsg('Fluid load vel, frame ' + str(framenr))\n\ + guidevel_sg$ID$.setName('$NAME_VELOCITY$') # for loading data the guidevel grid will pretend to be the vel grid\n\ fluid_vel_dict_s$ID$ = { 'vel' : guidevel_sg$ID$ }\n\ - fluid_file_import_s$ID$(dict=fluid_vel_dict_s$ID$, path=path, framenr=framenr, file_format=file_format)\n"; + fluid_file_import_s$ID$(dict=fluid_vel_dict_s$ID$, path=path, framenr=framenr, file_format=file_format, file_name=file_data_s$ID$)\n"; ////////////////////////////////////////////////////////////////////// // EXPORT @@ -748,12 +750,13 @@ def fluid_file_export_s$ID$(framenr, file_format, path, dict, file_name=None, mo const std::string fluid_save_guiding = "\n\ -def fluid_save_guiding_$ID$(path, framenr, file_format):\n\ +def fluid_save_guiding_$ID$(path, framenr, file_format, resumable):\n\ mantaMsg('Fluid save guiding, frame ' + str(framenr))\n\ + dict = fluid_guiding_dict_s$ID$\n\ if not withMPSave or isWindows:\n\ - fluid_file_export_s$ID$(dict=fluid_guiding_dict_s$ID$, framenr=framenr, file_format=file_format, path=path, file_name=file_guiding_s$ID$)\n\ + fluid_file_export_s$ID$(dict=dict, framenr=framenr, file_format=file_format, path=path, file_name=file_guiding_s$ID$)\n\ else:\n\ - fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, file_name=file_guiding_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=fluid_guiding_dict_s$ID$, do_join=False)\n"; + fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, file_name=file_guiding_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=dict, do_join=False)\n"; ////////////////////////////////////////////////////////////////////// // STANDALONE MODE diff --git a/source/blender/makesdna/DNA_fluid_types.h b/source/blender/makesdna/DNA_fluid_types.h index 3bbfb1dd0c4..6035c43ad57 100644 --- a/source/blender/makesdna/DNA_fluid_types.h +++ b/source/blender/makesdna/DNA_fluid_types.h @@ -225,8 +225,9 @@ enum { #define FLUID_NAME_GUIDING "fluid_guiding" /* Fluid object names.*/ -#define FLUID_NAME_FLAGS "flags" /* == OpenVDB grid attribute name. */ -#define FLUID_NAME_VELOCITY "velocity" /* == OpenVDB grid attribute name. */ +#define FLUID_NAME_FLAGS "flags" /* == OpenVDB grid attribute name. */ +#define FLUID_NAME_VELOCITY "velocity" /* == OpenVDB grid attribute name. */ +#define FLUID_NAME_VEL "vel" #define FLUID_NAME_VELOCITYTMP "velocity_previous" /* == OpenVDB grid attribute name. */ #define FLUID_NAME_VELOCITYX "x_vel" #define FLUID_NAME_VELOCITYY "y_vel" @@ -367,7 +368,8 @@ enum { #define FLUID_NAME_GUIDEVEL_X "x_guidevel" #define FLUID_NAME_GUIDEVEL_Y "y_guidevel" #define FLUID_NAME_GUIDEVEL_Z "z_guidevel" -#define FLUID_NAME_GUIDEVEL "velocity_guide" +#define FLUID_NAME_GUIDEVEL "guidevel" +#define FLUID_NAME_VELOCITY_GUIDE "velocity_guide" /* Cache file extensions. */ #define FLUID_DOMAIN_EXTENSION_UNI ".uni" -- cgit v1.2.3