[Bf-blender-cvs] [384ec9dfc87] fluid-mantaflow: just cleanup and minor bug fixes

Sebastián Barschkis noreply at git.blender.org
Sat Mar 31 18:02:36 CEST 2018


Commit: 384ec9dfc87ccbab91df5eb52d0c8c7c788d19b3
Author: Sebastián Barschkis
Date:   Mon Mar 26 21:14:30 2018 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB384ec9dfc87ccbab91df5eb52d0c8c7c788d19b3

just cleanup and minor bug fixes

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

M	intern/mantaflow/intern/FLUID.cpp
M	intern/mantaflow/intern/strings/liquid_script.h
M	intern/mantaflow/intern/strings/shared_script.h
M	intern/mantaflow/intern/strings/smoke_script.h
M	source/blender/blenkernel/BKE_pointcache.h
M	source/blender/blenkernel/intern/pointcache.c
M	source/blender/blenkernel/intern/smoke.c
M	source/blender/editors/physics/physics_fluid.c

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

diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index 3b13db9d01a..d5e4022e35b 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -306,9 +306,9 @@ void FLUID::initSmokeHigh(SmokeModifierData *smd)
 {
 	std::vector<std::string> pythonCommands;
 	std::string tmpString = smoke_alloc_high
+		+ smoke_wavelet_turbulence_noise
 		+ smoke_variables_high
 		+ smoke_bounds_high
-		+ smoke_wavelet_turbulence_noise
 		+ smoke_adaptive_step_high
 		+ smoke_save_data_high
 		+ smoke_pre_step_high
@@ -1009,7 +1009,7 @@ int FLUID::readCacheLow(SmokeModifierData *smd, int framenr)
 	{
 		// Mesh loading
 		BLI_path_join(cacheDir, sizeof(cacheDir), smd->domain->cache_directory, FLUID_CACHE_DIR_MESH_LOW, NULL);
-		if (BLI_exists(cacheDir) && (smd->domain->cache_flag & (FLUID_CACHE_BAKED_MESH_LOW | FLUID_CACHE_BAKED_LOW)))
+		if (BLI_exists(cacheDir) && (smd->domain->cache_flag & FLUID_CACHE_BAKED_MESH_LOW ))
 		{
 			ss.str("");
 			ss << "liquid_load_mesh_low_" << mCurrentID << "('" << cacheDir << "', " << framenr << ")";
@@ -1049,7 +1049,7 @@ int FLUID::readCacheLow(SmokeModifierData *smd, int framenr)
 	if (mUsingDrops || mUsingBubbles || mUsingFloats || mUsingTracers) {
 		// Secondary particles loading
 		BLI_path_join(cacheDir, sizeof(cacheDir), smd->domain->cache_directory, FLUID_CACHE_DIR_PARTICLES_LOW, NULL);
-		if (BLI_exists(cacheDir) && (smd->domain->cache_flag & (FLUID_CACHE_BAKED_PARTICLES_LOW | FLUID_CACHE_BAKED_LOW)))
+		if (BLI_exists(cacheDir) && (smd->domain->cache_flag & FLUID_CACHE_BAKED_PARTICLES_LOW))
 		{
 			ss.str("");
 			ss << "liquid_load_particles_low_" << mCurrentID << "('" << cacheDir << "', " << framenr << ")";
@@ -1110,7 +1110,7 @@ int FLUID::readCacheHigh(SmokeModifierData *smd, int framenr)
 	{
 		// Mesh loading
 		BLI_path_join(cacheDir, sizeof(cacheDir), smd->domain->cache_directory, FLUID_CACHE_DIR_MESH_HIGH, NULL);
-		if (BLI_exists(cacheDir) && (smd->domain->cache_flag & (FLUID_CACHE_BAKED_MESH_HIGH | FLUID_CACHE_BAKED_HIGH)))
+		if (BLI_exists(cacheDir) && (smd->domain->cache_flag & FLUID_CACHE_BAKED_MESH_HIGH))
 		{
 			ss.str("");
 			ss << "liquid_load_mesh_high_" << mCurrentID << "('" << cacheDir << "', " << framenr << ")";
@@ -1126,7 +1126,7 @@ int FLUID::readCacheHigh(SmokeModifierData *smd, int framenr)
 		}
 		// Data (flip particles) loading
 		BLI_path_join(cacheDir, sizeof(cacheDir), smd->domain->cache_directory, FLUID_CACHE_DIR_DATA_HIGH, NULL);
-		if (BLI_exists(cacheDir) && (smd->domain->cache_flag & (FLUID_CACHE_BAKED_PARTICLES_HIGH | FLUID_CACHE_BAKED_HIGH)))
+		if (BLI_exists(cacheDir) && (smd->domain->cache_flag & FLUID_CACHE_BAKED_HIGH))
 		{
 			ss.str("");
 			ss << "liquid_load_data_high_" << mCurrentID << "('" << cacheDir << "', " << framenr << ", True)";
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index 39b69c391eb..2c500122ab8 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -188,7 +188,7 @@ def liquid_adaptive_step_low_$ID$(framenr):\n\
     liquid_post_step_low_$ID$()\n";
 
 const std::string liquid_adaptive_step_high = "\n\
-def fluid_step_high_$ID$(framenr):\n\
+def liquid_adaptive_step_high_$ID$(framenr):\n\
     mantaMsg('Manta step high, frame ' + str(framenr))\n\
     \n\
     xl$ID$.frame = framenr\n\
diff --git a/intern/mantaflow/intern/strings/shared_script.h b/intern/mantaflow/intern/strings/shared_script.h
index 9e002ae8973..3ab9f2dd8c9 100644
--- a/intern/mantaflow/intern/strings/shared_script.h
+++ b/intern/mantaflow/intern/strings/shared_script.h
@@ -355,12 +355,15 @@ def bake_fluid_process_high_$ID$(framenr, path_data_low, path_data_high):\n\
     mantaMsg('Bake fluid high')\n\
     \n\
     # Load grids before stepping - because every process has its own memory space!\n\
-    if framenr>1:\n\
+    if using_smoke_s$ID$ and framenr>1: # smoke needs low-res vel grid\n\
         fluid_load_data_low_$ID$(path_data_low, framenr-1) # load data from previous frame\n\
     if using_liquid_s$ID$ and framenr>1:\n\
         liquid_load_data_low_$ID$(path_data_low, framenr-1, True)\n\
     \n\
-    fluid_step_high_$ID$(framenr)\n\
+    if using_smoke_s$ID$:\n\
+        smoke_adaptive_step_high_$ID$(framenr)\n\
+    if using_liquid_s$ID$:\n\
+        liquid_adaptive_step_high_$ID$(framenr)\n\
     \n\
     if using_smoke_s$ID$:\n\
         smoke_save_data_high_$ID$(path_data_high, framenr)\n\
diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h
index 60469e04104..7927e911337 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -298,7 +298,7 @@ def smoke_adaptive_step_low_$ID$(framenr):\n\
     smoke_post_step_low_$ID$()\n";
 
 const std::string smoke_adaptive_step_high = "\n\
-def fluid_step_high_$ID$(framenr):\n\
+def smoke_adaptive_step_high_$ID$(framenr):\n\
     xl$ID$.frame = framenr\n\
     xl$ID$.timeTotal = xl$ID$.frame * dt0_s$ID$\n\
     last_frame_s$ID$ = xl$ID$.frame\n\
@@ -563,7 +563,7 @@ def smoke_save_data_high_$ID$(path, framenr):\n\
     texture_w_s$ID$.save(os.path.join(path, 'texture_w_' + framenr + '.uni'))\n\
     texture_u2_s$ID$.save(os.path.join(path, 'texture_u2_' + framenr + '.uni'))\n\
     texture_v2_s$ID$.save(os.path.join(path, 'texture_v2_' + framenr + '.uni'))\n\
-    texture_w2_s$ID$.save(os.path.join(path, 'texture_w2_' + framenr + '.uni')\n\
+    texture_w2_s$ID$.save(os.path.join(path, 'texture_w2_' + framenr + '.uni'))\n\
     if using_colors_s$ID$:\n\
         color_r_xl$ID$.save(os.path.join(path, 'color_r_xl_' + framenr + '.uni'))\n\
         color_g_xl$ID$.save(os.path.join(path, 'color_g_xl_' + framenr + '.uni'))\n\
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index 49b248851e5..cab607f82d9 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -126,7 +126,6 @@ enum {
 	/* Volumetric file formats */
 	PTCACHE_FILE_PTCACHE = (1 << 0),
 	PTCACHE_FILE_OPENVDB = (1 << 1),
-	PTCACHE_FILE_UNI = (1 << 2),
 
 	/* Surface file formats */
 	PTCACHE_FILE_OBJECT = (1 << 3),
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index af38239dfea..f4b71cdd5ee 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1629,9 +1629,6 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
 	pid->write_mesh_stream		= NULL;
 	pid->read_mesh_stream		= NULL;
 
-	pid->write_uni_stream		= NULL;
-	pid->read_uni_stream		= NULL;
-
 	pid->write_extra_data		= NULL;
 	pid->read_extra_data		= NULL;
 	pid->interpolate_extra_data	= NULL;
@@ -1692,9 +1689,6 @@ void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *cl
 	pid->write_mesh_stream		= NULL;
 	pid->read_mesh_stream		= NULL;
 
-	pid->write_uni_stream		= NULL;
-	pid->read_uni_stream		= NULL;
-
 	pid->write_extra_data		= NULL;
 	pid->read_extra_data		= NULL;
 	pid->interpolate_extra_data	= NULL;
@@ -1740,8 +1734,6 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo
 		pid->write_mesh_stream	= NULL;
 		pid->read_mesh_stream	= NULL;
 
-		pid->write_uni_stream	= NULL;
-		pid->read_uni_stream	= NULL;
 	}
 	else if (smd->domain->type == MOD_SMOKE_DOMAIN_TYPE_LIQUID)
 	{
@@ -1750,9 +1742,6 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo
 		
 		pid->write_mesh_stream	= ptcache_mesh_write;
 		pid->read_mesh_stream	= ptcache_mesh_read;
-
-		pid->write_uni_stream	= NULL; // ptcache_uni_write;
-		pid->read_uni_stream	= NULL; // ptcache_uni_read;
 	}
 
 	pid->write_openvdb_stream	= ptcache_smoke_openvdb_write;
@@ -1961,8 +1950,6 @@ static const char *ptcache_file_extension(const PTCacheID *pid)
 			return PTCACHE_EXT;
 		case PTCACHE_FILE_OPENVDB:
 			return ".vdb";
-		case PTCACHE_FILE_UNI:
-			return ".uni";
 		case PTCACHE_FILE_OBJECT:
 			return ".bobj.gz";
 	}
@@ -1972,8 +1959,6 @@ static const char *ptcache_file_extension(const PTCacheID *pid)
 		return PTCACHE_EXT;
 	if (pid->file_type & PTCACHE_FILE_OPENVDB)
 		return ".vdb";
-	if (pid->file_type & PTCACHE_FILE_UNI)
-		return ".uni";
 	if (pid->file_type & PTCACHE_FILE_OBJECT)
 		return ".bobj.gz";
 
@@ -2779,29 +2764,6 @@ static int ptcache_read_mesh_stream(PTCacheID *pid, int cfra)
 	return 1;
 }
 
-static int ptcache_read_uni_stream(PTCacheID *pid, int cfra, bool load_liquid_data)
-{
-	char filename[FILE_MAX * 2];
-	char pathname[FILE_MAX * 2];
-
-	/* save blend file before using disk pointcache */
-	if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL) == 0)
-		return 0;
-
-	ptcache_filename(pid, filename, cfra, 1, 1);
-	ptcache_filename(pid, pathname, cfra, 1, 0);
-
-	if (!BLI_exists(filename)) {
-		return 0;
-	}
-
-	if (!pid->read_uni_stream(pid->calldata, filename, pathname, load_liquid_data)) {
-		return 0;
-	}
-
-	return 1;
-}
-
 static int ptcache_read(PTCacheID *pid, int cfra)
 {
 	PTCacheMem *pm = NULL;
@@ -2958,12 +2920,6 @@ int BKE_ptcache_read(PTCacheID *pid, float cfra, bool no_extrapolate_old)
 				return 0;
 			}
 		}
-		else if (pid->file_type & PTCACHE_FILE_UNI && pid->read_uni_stream) {
-			pid->file_type = PTCACHE_FILE_UNI;
-			if (!ptcache_read_uni_stream(pid, cfra1, true)) {
-				return 0;
-			}
-		}
 		else if (pid->file_type & PTCACHE_FILE_PTCACHE && pid->read_stream) {
 			pid->file_type = PTCACHE_FILE_PTCACHE;
 			if (!ptcache_read_stream(pid, cfra1))
@@ -2995,12 +2951,6 @@ int BKE_ptcache_read(PTCacheID *pid, float cfra, bool no_extrapolate_old)
 				return 0;
 			}
 		}
-		else if (pid->file_type & PTCACHE_FILE_UNI && pid->read_uni_stream) {
-			pid->file_type = PTCACHE_FILE_UNI;
-			if (!ptcache_read_uni_stream(pid, cfra2, true)) {
-				return 0;
-			}
-		}
 		else if (pid->file_type & PTCACHE_FILE_PTCACHE && pid->read_stream) {
 			pid->file_type = PTCACHE_FILE_PTCACHE;
 			if (!ptcache_read_stream(pid, cfra2))
@@ -3122,25 +3072,6 @@ static int ptcache_write_mesh_stream(PTCacheID *pid, in

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list