Skip to content

Commit f1c1585

Browse files
committed
new demo version 0.8.2!
1 parent 4d5ab9a commit f1c1585

14 files changed

+125
-51
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Want to try the FLIP Fluids addon before buying the [full marketplace product](h
1111

1212
### Getting Started
1313

14-
1. **Download** the latest FLIP Fluids Demo: [FLIP_Fluids_addon_0.8.1_demo_(16_jul_2024.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.8.1/FLIP_Fluids_addon_0.8.1_demo_.16_jul_2024.zip)
14+
1. **Download** the latest FLIP Fluids Demo: [FLIP_Fluids_addon_0.8.2_demo_(16_oct_2024.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.8.2/FLIP_Fluids_addon_0.8.2_demo_.16_oct_2024.zip)
1515
2. **Install** the FLIP Fluids Demo: [Installation Instructions](https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Addon-Installation-and-Uninstallation)
1616
3. **Get Started** with creating your first FLIP Fluids addon simulation:
1717
- [Video Learning Series](https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Video-Learning-Series)

cmake/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ set(CMAKE_BUILD_TYPE Release)
5353
set(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD TRUE)
5454
set(FLUIDENGINE_VERSION_MAJOR 0)
5555
set(FLUIDENGINE_VERSION_MINOR 8)
56-
set(FLUIDENGINE_VERSION_REVISION 1)
57-
set(FLUIDENGINE_VERSION_DATE "16-JUL-2024")
56+
set(FLUIDENGINE_VERSION_REVISION 2)
57+
set(FLUIDENGINE_VERSION_DATE "18-OCT-2024")
5858

5959
if(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD)
6060
set(FLUIDENGINE_VERSION_TYPE_LABEL "Demo")

src/addon/objects/flip_fluid_geometry_database.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def get_curve_animated(self, name_slug, frameno):
601601

602602

603603
def get_mesh_geometry_data_dict_for_frame(self, simulation_data, frameno):
604-
cmd = """ SELECT object_id, object_slug, object_motion_type FROM object"""
604+
cmd = """ SELECT object_id, object_slug, object_motion_type, export_mesh FROM object"""
605605
self._cursor.execute(cmd)
606606
result = self._cursor.fetchall()
607607

@@ -611,6 +611,13 @@ def get_mesh_geometry_data_dict_for_frame(self, simulation_data, frameno):
611611
object_id = row[0]
612612
name_slug = row[1]
613613
object_motion_type = row[2]
614+
export_mesh = row[3]
615+
616+
if not export_mesh:
617+
# Object could be a centroid, vertices, axis, or curve
618+
# This method is only for retrieving mesh type data
619+
continue
620+
614621
is_static = object_motion_type == 'STATIC'
615622
is_dynamic = not is_static
616623

src/addon/operators/command_line_operators.py

+35-5
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,36 @@ def get_blender_app_binary_path_windows():
277277
return blender_exe_path
278278

279279

280+
def launch_command_windows(command_list, command_text, script_prefix_string, keep_window_open=True):
281+
# Launch command on Windows OS using subprocess.call().
282+
# If the command list contains an argument with a special character that
283+
# subprocess.call cannot handle, write the command to a batch file and
284+
# launch using os.startfile.
285+
286+
special_characters = ["&"]
287+
valid_command_list = True
288+
for arg in command_list:
289+
for ch in special_characters:
290+
if ch in arg:
291+
valid_command_list = False
292+
break
293+
294+
if valid_command_list:
295+
subprocess.call(command_list, shell=True)
296+
else:
297+
bat_text = "echo off\nchcp 65001\n"
298+
bat_text += command_text + "\n"
299+
if keep_window_open:
300+
bat_text += "cmd /k\n"
301+
302+
script_name = script_prefix_string + bpy.path.basename(bpy.context.blend_data.filepath) + ".bat"
303+
script_filepath = os.path.join(os.path.dirname(bpy.data.filepath), script_name)
304+
with open(script_filepath, 'w') as f:
305+
f.write(bat_text)
306+
307+
os.startfile(script_filepath)
308+
309+
280310
def launch_command_darwin_or_linux(command_text, script_prefix_string):
281311
script_text = "#!/bin/bash\n" + command_text
282312
script_name = script_prefix_string + bpy.path.basename(bpy.context.blend_data.filepath) + ".sh"
@@ -442,7 +472,7 @@ def execute(self, context):
442472
if system == "Windows":
443473
if vcu.get_addon_preferences().cmd_bake_max_attempts == 0:
444474
# Launch with a single command
445-
subprocess.call(command_list, shell=True)
475+
launch_command_windows(command_list, command_text, "BAKE_")
446476
else:
447477
cmd_bake_script_filepath = self.generate_bake_batch_file()
448478
os.startfile(cmd_bake_script_filepath)
@@ -546,7 +576,7 @@ def execute(self, context):
546576

547577
system = platform.system()
548578
if system == "Windows":
549-
subprocess.call(command_list, shell=True)
579+
launch_command_windows(command_list, command_text, "RENDER_ANIMATION_")
550580
elif system == "Darwin" or system == "Linux":
551581
launch_command_darwin_or_linux(command_text, "RENDER_ANIMATION_")
552582

@@ -655,7 +685,7 @@ def execute(self, context):
655685

656686
system = platform.system()
657687
if system == "Windows":
658-
subprocess.call(command_list, shell=True)
688+
launch_command_windows(command_list, command_text, "RENDER_FRAME_", keep_window_open=not hprops.cmd_close_window_after_render)
659689
elif system == "Darwin" or system == "Linux":
660690
command_text = "\"" + bpy.app.binary_path + "\" --background \"" + bpy.data.filepath + "\" --python \"" + script_path + "\"" + " -- " + frame_string + " " + open_image_after
661691
launch_command_darwin_or_linux(command_text, "RENDER_FRAME_")
@@ -734,7 +764,7 @@ def execute(self, context):
734764

735765
system = platform.system()
736766
if system == "Windows":
737-
subprocess.call(command_list, shell=True)
767+
launch_command_windows(command_list, command_text, "ALEMBIC_EXPORT_")
738768
elif system == "Darwin" or system == "Linux":
739769
command_text = "\"" + bpy.app.binary_path + "\" --background \"" + bpy.data.filepath + "\" --python \"" + script_path + "\""
740770
launch_command_darwin_or_linux(command_text, "ALEMBIC_EXPORT_")
@@ -1106,7 +1136,7 @@ def execute(self, context):
11061136

11071137
system = platform.system()
11081138
if system == "Windows":
1109-
subprocess.call(command_list, shell=True)
1139+
launch_command_windows(command_list, command_text, "RENDER_PASS_ANIMATION")
11101140
elif system == "Darwin" or system == "Linux":
11111141
command_text = "\"" + bpy.app.binary_path + "\" --background \"" + bpy.data.filepath + "\" --python \"" + script_path + "\""
11121142
launch_command_darwin_or_linux(command_text, "RENDER_PASS_ANIMATION_")

src/addon/operators/preferences_operators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class FLIPFluidInstallMixboxPlugin(bpy.types.Operator, ImportHelper):
266266

267267
filename_ext = "*.plugin"
268268
filter_glob = StringProperty(
269-
default="*.plugin",
269+
default="*.plugin;*.zip",
270270
options={'HIDDEN'},
271271
maxlen=255,
272272
)

src/addon/properties/domain_whitewater_properties.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ class DomainWhitewaterProperties(bpy.types.PropertyGroup):
227227
" particles to prevent exceeding this limit. If set to 0, the"
228228
" solver will not limit the number of whitewater particles,"
229229
" however this may require large amounts of storage space depending"
230-
" on the simulation",
231-
min=0, max=2000,
230+
" on the simulation and is not recommended",
231+
min=0, max=357,
232232
default=12,
233233
precision=2,
234234
); exec(conv("max_whitewater_particles"))

src/addon/properties/flip_fluid_properties.py

+2
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ def get_force_field_objects(self, skip_hide_viewport=False):
222222
def get_simulation_objects(self, skip_hide_viewport=False):
223223
objects = []
224224
for obj in vcu.get_all_scene_objects():
225+
if obj.flip_fluid.object_type == 'TYPE_NONE':
226+
continue
225227
if not obj.flip_fluid.is_active:
226228
continue
227229
if skip_hide_viewport and obj.hide_viewport:

src/addon/resources/command_line_scripts/alembic_export.py

+5
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,11 @@ def get_alembic_output_filepath():
422422

423423
print("\n*** Preparing Alembic Export ***\n")
424424

425+
if bpy.context.mode != 'OBJECT':
426+
# Meshes can only be exported in Object Mode
427+
bpy.ops.object.mode_set(mode='OBJECT')
428+
print("Viewport set to Object Mode.\n")
429+
425430
retval = check_cache_exists()
426431
if not retval:
427432
exit()

src/addon/resources/command_line_scripts/run_simulation.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@ def play_sound(json_audio_filepath, block=False):
44
if not (bpy.app.version >= (2, 80, 0)):
55
# aud not supported in Blender 2.79 or lower
66
return
7-
7+
88
try:
9-
prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences
9+
if bpy.app.version >= (4, 2, 0):
10+
for module in bpy.context.preferences.addons:
11+
module_name = module.module
12+
if module_name.endswith("flip_fluids_addon"):
13+
prefs = bpy.context.preferences.addons[module_name].preferences
14+
print(prefs)
15+
break
16+
else:
17+
prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences
1018
except:
11-
print("FLIP Fluids: Unable to locate addon preferences")
12-
return
19+
print("FLIP Fluids: Unable to locate addon preferences")
20+
return
21+
1322
if not prefs.enable_bake_alarm:
14-
return
23+
return
1524

1625
import aud
1726

src/addon/resources/command_line_scripts/run_simulation_and_render_sequence.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@ def play_sound(json_audio_filepath, block=False):
66
return
77

88
try:
9-
prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences
9+
if bpy.app.version >= (4, 2, 0):
10+
for module in bpy.context.preferences.addons:
11+
module_name = module.module
12+
if module_name.endswith("flip_fluids_addon"):
13+
prefs = bpy.context.preferences.addons[module_name].preferences
14+
print(prefs)
15+
break
16+
else:
17+
prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences
1018
except:
11-
print("FLIP Fluids: Unable to locate addon preferences")
12-
return
19+
print("FLIP Fluids: Unable to locate addon preferences")
20+
return
21+
1322
if not prefs.enable_bake_alarm:
14-
return
23+
return
1524

1625
import aud
1726

src/addon/resources/command_line_scripts/run_simulation_and_render_sequence_batch.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@ def play_sound(json_audio_filepath, block=False):
66
return
77

88
try:
9-
prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences
9+
if bpy.app.version >= (4, 2, 0):
10+
for module in bpy.context.preferences.addons:
11+
module_name = module.module
12+
if module_name.endswith("flip_fluids_addon"):
13+
prefs = bpy.context.preferences.addons[module_name].preferences
14+
print(prefs)
15+
break
16+
else:
17+
prefs = bpy.context.preferences.addons["flip_fluids_addon"].preferences
1018
except:
1119
print("FLIP Fluids: Unable to locate addon preferences")
1220
return
21+
1322
if not prefs.enable_bake_alarm:
1423
return
1524

src/addon/utils/installation_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
IS_INSTALLATION_COMPLETE = False
2323
IS_STABLE_BUILD = True
2424

25-
IS_MIXBOX_SUPPORTED = False
25+
IS_MIXBOX_SUPPORTED = True
2626
IS_MIXBOX_INSTALLATION_COMPLETE = False
2727
MIXBOX_BOOST_FACTOR = 1.2
2828

src/engine/diffuseparticlesimulation.cpp

+30-28
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void DiffuseParticleSimulation::setMaxNumDiffuseParticles(int n) {
242242
FLUIDSIM_ASSERT(n >= 0);
243243
_maxNumDiffuseParticles = n;
244244
if (n == 0) {
245-
_maxNumDiffuseParticles = std::numeric_limits<unsigned int>::max();
245+
_maxNumDiffuseParticles = _maxNumDiffuseParticlesLimit;
246246
}
247247
}
248248

@@ -759,6 +759,7 @@ void DiffuseParticleSimulation::getSprayParticleFileDataWWP(std::vector<char> &d
759759
std::vector<vmath::vec3> *particlePositions;
760760
std::vector<unsigned char> *particleIds;
761761
std::vector<char> *particleTypes;
762+
762763
_diffuseParticles.getAttributeValues("POSITION", particlePositions);
763764
_diffuseParticles.getAttributeValues("ID", particleIds);
764765
_diffuseParticles.getAttributeValues("TYPE", particleTypes);
@@ -2896,13 +2897,14 @@ void DiffuseParticleSimulation::_getDiffuseParticleFileDataWWP(std::vector<vmath
28962897
std::vector<char> &data) {
28972898
FLUIDSIM_ASSERT(positions.size() == ids.size())
28982899

2899-
std::vector<int> idcounts(_diffuseParticleIDLimit, 0);
2900+
std::vector<unsigned int> idcounts(_diffuseParticleIDLimit, 0);
29002901
for (size_t i = 0; i < ids.size(); i++) {
29012902
idcounts[(int)ids[i]]++;
29022903
}
29032904

2904-
std::vector<int> idBinIndices(_diffuseParticleIDLimit, 0);
2905-
std::vector<int> idData(_diffuseParticleIDLimit, 0);
2905+
std::vector<unsigned int> idBinIndices(_diffuseParticleIDLimit, 0);
2906+
std::vector<unsigned int> idData(_diffuseParticleIDLimit, 0);
2907+
29062908
int currentBinIndex = 0;
29072909
for (size_t i = 0; i < idcounts.size(); i++) {
29082910
idBinIndices[i] = currentBinIndex;
@@ -2916,16 +2918,16 @@ void DiffuseParticleSimulation::_getDiffuseParticleFileDataWWP(std::vector<vmath
29162918
idBinIndices[ids[i]]++;
29172919
}
29182920

2919-
int idDataSize = (int)idData.size() * sizeof(int);
2920-
int numVertices = (int)positions.size();
2921-
int vertexDataSize = 3 * numVertices * sizeof(float);
2922-
int dataSize = idDataSize + vertexDataSize;
2921+
unsigned int idDataSize = (unsigned int)idData.size() * sizeof(int);
2922+
unsigned int numVertices = (unsigned int)positions.size();
2923+
unsigned int vertexDataSize = 3 * numVertices * sizeof(float);
2924+
unsigned int dataSize = idDataSize + vertexDataSize;
29232925

29242926
data.clear();
29252927
data.resize(dataSize);
29262928
data.shrink_to_fit();
29272929

2928-
int byteOffset = 0;
2930+
unsigned int byteOffset = 0;
29292931
std::memcpy(data.data() + byteOffset, (char *)idData.data(), idDataSize);
29302932
byteOffset += idDataSize;
29312933

@@ -2938,36 +2940,36 @@ void DiffuseParticleSimulation::_getDiffuseParticleFileDataWWI(std::vector<int>
29382940
std::vector<char> &data) {
29392941
FLUIDSIM_ASSERT(intvalues.size() == ids.size())
29402942

2941-
std::vector<int> idcounts(_diffuseParticleIDLimit, 0);
2943+
std::vector<unsigned int> idcounts(_diffuseParticleIDLimit, 0);
29422944
for (size_t i = 0; i < ids.size(); i++) {
2943-
idcounts[(int)ids[i]]++;
2945+
idcounts[(unsigned int)ids[i]]++;
29442946
}
29452947

2946-
std::vector<int> idBinIndices(_diffuseParticleIDLimit, 0);
2947-
std::vector<int> idData(_diffuseParticleIDLimit, 0);
2948+
std::vector<unsigned int> idBinIndices(_diffuseParticleIDLimit, 0);
2949+
std::vector<unsigned int> idData(_diffuseParticleIDLimit, 0);
29482950
int currentBinIndex = 0;
29492951
for (size_t i = 0; i < idcounts.size(); i++) {
29502952
idBinIndices[i] = currentBinIndex;
29512953
currentBinIndex += idcounts[i];
29522954
idData[i] = currentBinIndex - 1;
29532955
}
29542956

2955-
std::vector<int> intData(intvalues.size());
2957+
std::vector<unsigned int> intData(intvalues.size());
29562958
for (size_t i = 0; i < intvalues.size(); i++) {
29572959
intData[idBinIndices[ids[i]]] = intvalues[i];
29582960
idBinIndices[ids[i]]++;
29592961
}
29602962

2961-
int idDataSize = (int)idData.size() * sizeof(int);
2962-
int numVertices = (int)intvalues.size();
2963-
int intDataSize = numVertices * sizeof(int);
2964-
int dataSize = idDataSize + intDataSize;
2963+
unsigned int idDataSize = (unsigned int)idData.size() * sizeof(int);
2964+
unsigned int numVertices = (unsigned int)intvalues.size();
2965+
unsigned int intDataSize = numVertices * sizeof(int);
2966+
unsigned int dataSize = idDataSize + intDataSize;
29652967

29662968
data.clear();
29672969
data.resize(dataSize);
29682970
data.shrink_to_fit();
29692971

2970-
int byteOffset = 0;
2972+
unsigned int byteOffset = 0;
29712973
std::memcpy(data.data() + byteOffset, (char *)idData.data(), idDataSize);
29722974
byteOffset += idDataSize;
29732975

@@ -2980,13 +2982,13 @@ void DiffuseParticleSimulation::_getDiffuseParticleFileDataWWF(std::vector<float
29802982
std::vector<char> &data) {
29812983
FLUIDSIM_ASSERT(floatvalues.size() == ids.size())
29822984

2983-
std::vector<int> idcounts(_diffuseParticleIDLimit, 0);
2985+
std::vector<unsigned int> idcounts(_diffuseParticleIDLimit, 0);
29842986
for (size_t i = 0; i < ids.size(); i++) {
2985-
idcounts[(int)ids[i]]++;
2987+
idcounts[(unsigned int)ids[i]]++;
29862988
}
29872989

2988-
std::vector<int> idBinIndices(_diffuseParticleIDLimit, 0);
2989-
std::vector<int> idData(_diffuseParticleIDLimit, 0);
2990+
std::vector<unsigned int> idBinIndices(_diffuseParticleIDLimit, 0);
2991+
std::vector<unsigned int> idData(_diffuseParticleIDLimit, 0);
29902992
int currentBinIndex = 0;
29912993
for (size_t i = 0; i < idcounts.size(); i++) {
29922994
idBinIndices[i] = currentBinIndex;
@@ -3000,16 +3002,16 @@ void DiffuseParticleSimulation::_getDiffuseParticleFileDataWWF(std::vector<float
30003002
idBinIndices[ids[i]]++;
30013003
}
30023004

3003-
int idDataSize = (int)idData.size() * sizeof(int);
3004-
int numVertices = (int)floatvalues.size();
3005-
int intDataSize = numVertices * sizeof(int);
3006-
int dataSize = idDataSize + intDataSize;
3005+
unsigned int idDataSize = (int)idData.size() * sizeof(int);
3006+
unsigned int numVertices = (int)floatvalues.size();
3007+
unsigned int intDataSize = numVertices * sizeof(int);
3008+
unsigned int dataSize = idDataSize + intDataSize;
30073009

30083010
data.clear();
30093011
data.resize(dataSize);
30103012
data.shrink_to_fit();
30113013

3012-
int byteOffset = 0;
3014+
unsigned int byteOffset = 0;
30133015
std::memcpy(data.data() + byteOffset, (char *)idData.data(), idDataSize);
30143016
byteOffset += idDataSize;
30153017

0 commit comments

Comments
 (0)