diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-02-09 19:17:24 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-02-09 19:17:24 +0300 |
commit | a048354e9f9bee20d23c7647c92790dc11f818d7 (patch) | |
tree | f32ba8dc9742f42a07e42fc8f9986bd8a99fbad7 /intern/mantaflow | |
parent | 86e24ea10cba05dcb48eccc026530edab14dfe01 (diff) |
Fluid: Fixed file formats for script exporter
File formats in the exported scripts were using hardcoded file extensions and not the ones specified in the UI.
Diffstat (limited to 'intern/mantaflow')
-rw-r--r-- | intern/mantaflow/intern/MANTA_main.cpp | 54 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/fluid_script.h | 12 |
2 files changed, 37 insertions, 29 deletions
diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index f13dc4e5f52..91853ca566b 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -572,6 +572,29 @@ void MANTA::terminateMantaflow() mantaInitialized = false; } +static std::string getCacheFileEnding(char cache_format) +{ + if (MANTA::with_debug) + std::cout << "MANTA::getCacheFileEnding()" << std::endl; + + switch (cache_format) { + case FLUID_DOMAIN_FILE_UNI: + return ".uni"; + case FLUID_DOMAIN_FILE_OPENVDB: + return ".vdb"; + case FLUID_DOMAIN_FILE_RAW: + return ".raw"; + case FLUID_DOMAIN_FILE_BIN_OBJECT: + return ".bobj.gz"; + case FLUID_DOMAIN_FILE_OBJECT: + return ".obj"; + default: + if (MANTA::with_debug) + std::cout << "Error: Could not find file extension" << std::endl; + return ".uni"; + } +} + std::string MANTA::getRealValue(const std::string &varName, FluidModifierData *mmd) { std::ostringstream ss; @@ -815,6 +838,14 @@ std::string MANTA::getRealValue(const std::string &varName, FluidModifierData *m ss << mmd->time; else if (varName == "END_FRAME") ss << mmd->domain->cache_frame_end; + else if (varName == "CACHE_DATA_FORMAT") + ss << getCacheFileEnding(mmd->domain->cache_data_format); + else if (varName == "CACHE_MESH_FORMAT") + ss << getCacheFileEnding(mmd->domain->cache_mesh_format); + else if (varName == "CACHE_NOISE_FORMAT") + ss << getCacheFileEnding(mmd->domain->cache_noise_format); + else if (varName == "CACHE_PARTICLE_FORMAT") + ss << getCacheFileEnding(mmd->domain->cache_particle_format); else if (varName == "SIMULATION_METHOD") { if (mmd->domain->simulation_method & FLUID_DOMAIN_METHOD_FLIP) { ss << "'FLIP'"; @@ -987,29 +1018,6 @@ std::string MANTA::parseScript(const std::string &setup_string, FluidModifierDat return res.str(); } -static std::string getCacheFileEnding(char cache_format) -{ - if (MANTA::with_debug) - std::cout << "MANTA::getCacheFileEnding()" << std::endl; - - switch (cache_format) { - case FLUID_DOMAIN_FILE_UNI: - return ".uni"; - case FLUID_DOMAIN_FILE_OPENVDB: - return ".vdb"; - case FLUID_DOMAIN_FILE_RAW: - return ".raw"; - case FLUID_DOMAIN_FILE_BIN_OBJECT: - return ".bobj.gz"; - case FLUID_DOMAIN_FILE_OBJECT: - return ".obj"; - default: - if (MANTA::with_debug) - std::cout << "Error: Could not find file extension" << std::endl; - return ".uni"; - } -} - int MANTA::updateFlipStructures(FluidModifierData *mmd, int framenr) { if (MANTA::with_debug) diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h index babcdd7551e..477cf3ff789 100644 --- a/intern/mantaflow/intern/strings/fluid_script.h +++ b/intern/mantaflow/intern/strings/fluid_script.h @@ -689,12 +689,12 @@ if (GUI):\n\ gui.show()\n\ gui.pause()\n\ \n\ -cache_dir = '$CACHE_DIR$'\n\ -cache_resumable = $CACHE_RESUMABLE$\n\ -file_format_data = '.uni'\n\ -file_format_noise = '.uni'\n\ -file_format_particles = '.uni'\n\ -file_format_mesh = '.bobj.gz'\n\ +cache_resumable = $CACHE_RESUMABLE$\n\ +cache_dir = '$CACHE_DIR$'\n\ +file_format_data = '$CACHE_DATA_FORMAT$'\n\ +file_format_noise = '$CACHE_NOISE_FORMAT$'\n\ +file_format_particles = '$CACHE_PARTICLE_FORMAT$'\n\ +file_format_mesh = '$CACHE_MESH_FORMAT$'\n\ \n\ # Start and stop for simulation\n\ current_frame = $CURRENT_FRAME$\n\ |