Skip to content

Commit

Permalink
new demo version 0.7.4!
Browse files Browse the repository at this point in the history
  • Loading branch information
rlguy committed Jan 22, 2024
1 parent 76f7c30 commit 9403e6c
Show file tree
Hide file tree
Showing 263 changed files with 1,231 additions and 612 deletions.
2 changes: 1 addition & 1 deletion LICENSE_MIT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2023 Ryan L. Guy
Copyright (C) 2024 Ryan L. Guy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Want to try the FLIP Fluids addon before buying the [full marketplace product](h

### Getting Started

Download the latest FLIP Fluids Demo installation file here: [FLIP_Fluids_addon_0.7.3_demo_(24_nov_2023.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.7.3/FLIP_Fluids_addon_0.7.3_demo_.24_nov_2023.zip)
Download the latest FLIP Fluids Demo installation file here: [FLIP_Fluids_addon_0.7.4_demo_(22_jan_2024.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.7.4/FLIP_Fluids_addon_0.7.4_demo_.22_jan_2024.zip)

After downloading the demo addon, follow our [Installation Instructions](https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Addon-Installation-and-Uninstallation). The instructions are similar to installing any other Blender addon.

Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[[
Copyright (C) 2023 Ryan L. Guy
Copyright (C) 2024 Ryan L. Guy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -53,8 +53,8 @@ set(CMAKE_BUILD_TYPE Release)
set(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD TRUE)
set(FLUIDENGINE_VERSION_MAJOR 0)
set(FLUIDENGINE_VERSION_MINOR 7)
set(FLUIDENGINE_VERSION_REVISION 3)
set(FLUIDENGINE_VERSION_DATE "24-NOV-2023")
set(FLUIDENGINE_VERSION_REVISION 4)
set(FLUIDENGINE_VERSION_DATE "22-JAN-2024")

if(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD)
set(FLUIDENGINE_VERSION_TYPE_LABEL "Demo")
Expand Down
2 changes: 1 addition & 1 deletion src/addon/__init__.py.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
44 changes: 37 additions & 7 deletions src/addon/bake.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down Expand Up @@ -758,7 +758,11 @@ def __delete_outdated_savestates(cache_directory, savestate_id):
if savestate_number > savestate_id:
path = os.path.join(savestate_directory, d)
try:
fpl.delete_files_in_directory(path, extensions, remove_directory=True)
fpl.delete_files_in_directory(
path, extensions,
remove_directory=True,
display_popup_on_error=False
)
except:
print("Error: unable to delete directory <" + path + "> (skipping)")

Expand Down Expand Up @@ -828,15 +832,27 @@ def __load_save_state_data(fluidsim, data, cache_directory, savestate_id):
backup_autosave_directory = current_autosave_directory + ".backup"
if os.path.isdir(backup_autosave_directory):
# Backup autosave directory may already exist from a previous bake, remove if so
fpl.delete_files_in_directory(backup_autosave_directory, [".state", ".data"], remove_directory=True)
fpl.delete_files_in_directory(
backup_autosave_directory, [".state", ".data"],
remove_directory=True,
display_popup_on_error=False
)
os.rename(current_autosave_directory, backup_autosave_directory)
try:
old_directory = autosave_directory
new_directory = os.path.join(savestate_directory, "autosave")
shutil.copytree(old_directory, new_directory, dirs_exist_ok=True)
fpl.delete_files_in_directory(backup_autosave_directory, [".state", ".data"], remove_directory=True)
fpl.delete_files_in_directory(
backup_autosave_directory, [".state", ".data"],
remove_directory=True,
display_popup_on_error=False
)
except Exception as e:
os.rename(backup_autosave_directory, current_autosave_directory)
try:
os.rename(backup_autosave_directory, current_autosave_directory)
except FileNotFoundError:
pass
raise

if init_data.delete_outdated_meshes:
__delete_outdated_meshes(cache_directory, autosave_info["frame"])
Expand Down Expand Up @@ -2884,7 +2900,7 @@ def __write_autosave_data(domain_data, cache_directory, fluidsim, frameno):
)
for filepath in data_filepaths:
if os.path.isfile(filepath):
fpl.delete_file(filepath)
fpl.delete_file(filepath, display_popup_on_error=False)
except Exception as e:
print("FLIP Fluids: OS/Filesystem Error: Unable to delete older autosave files from storage")
print("Error Message: ", e)
Expand Down Expand Up @@ -2931,10 +2947,23 @@ def __write_autosave_data(domain_data, cache_directory, fluidsim, frameno):
numstr = str(frameno).zfill(6)
savestate_dir = os.path.join(cache_directory, "savestates", "autosave" + numstr)
if os.path.isdir(savestate_dir):
fpl.delete_files_in_directory(savestate_dir, [".state", ".data"], remove_directory=True)
fpl.delete_files_in_directory(
savestate_dir, [".state", ".data"],
remove_directory=True,
display_popup_on_error=False
)
shutil.copytree(autosave_dir, savestate_dir, dirs_exist_ok=True)


def __write_finished_file(cache_directory, frameno):
fstring = __frame_number_to_string(frameno)
finished_filename = "finished" + fstring + ".txt"
finished_filepath = os.path.join(cache_directory, "bakefiles", finished_filename)
filestring = fstring
with open(finished_filepath, 'w') as f:
f.write(filestring)


def __write_simulation_output(domain_data, fluidsim, frameno, cache_directory):
__write_bounds_data(cache_directory, fluidsim, frameno)

Expand All @@ -2959,6 +2988,7 @@ def __write_simulation_output(domain_data, fluidsim, frameno, cache_directory):
__write_logfile_data(cache_directory, domain_data.initialize.logfile_name, fluidsim)
__write_frame_stats_data(cache_directory, fluidsim, frameno)
__write_autosave_data(domain_data, cache_directory, fluidsim, frameno)
__write_finished_file(cache_directory, frameno)


def __get_current_frame_delta_time(domain_data, frameno):
Expand Down
2 changes: 1 addition & 1 deletion src/addon/exit_handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
21 changes: 14 additions & 7 deletions src/addon/export.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down Expand Up @@ -411,9 +411,14 @@ def __generate_meshing_volume_export_object(bl_meshing_object, bl_domain_object)
def add_objects_to_geometry_exporter(geometry_exporter):
domain = bpy.context.scene.flip_fluid.get_domain_object()
dprops = bpy.context.scene.flip_fluid.get_domain_properties()
objects = bpy.context.scene.flip_fluid.get_simulation_objects()

# Objects disabled in the viewport shouldn't be exported for the simulation, so skip these
objects = bpy.context.scene.flip_fluid.get_simulation_objects(skip_hide_viewport=True)
disable_topology_warning = dprops.advanced.disable_changing_topology_warning

for obj in objects:
print(obj)

# Add regular FLIP Fluid objects
for obj in objects:
props = obj.flip_fluid.get_property_group()
Expand Down Expand Up @@ -472,11 +477,13 @@ def export_simulation_data(context, data_filepath):

simulation_objects = flip_fluid_map.Map({})
simulation_objects.domain = domain_object
simulation_objects.fluid_objects = simprops.get_fluid_objects()
simulation_objects.obstacle_objects = simprops.get_obstacle_objects()
simulation_objects.inflow_objects = simprops.get_inflow_objects()
simulation_objects.outflow_objects = simprops.get_outflow_objects()
simulation_objects.force_field_objects = simprops.get_force_field_objects()

# Objects disabled in the viewport shouldn't be exported for the simulation, so skip these
simulation_objects.fluid_objects = simprops.get_fluid_objects(skip_hide_viewport=True)
simulation_objects.obstacle_objects = simprops.get_obstacle_objects(skip_hide_viewport=True)
simulation_objects.inflow_objects = simprops.get_inflow_objects(skip_hide_viewport=True)
simulation_objects.outflow_objects = simprops.get_outflow_objects(skip_hide_viewport=True)
simulation_objects.force_field_objects = simprops.get_force_field_objects(skip_hide_viewport=True)

success = __export_simulation_data_to_file(context, simulation_objects, data_filepath)

Expand Down
2 changes: 1 addition & 1 deletion src/addon/filesystem/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
46 changes: 29 additions & 17 deletions src/addon/filesystem/filesystem_protection_layer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down Expand Up @@ -129,7 +129,7 @@ def check_directory_valid(base_directory):
raise FilesystemProtectionError(error_msg)


def delete_files_in_directory(base_directory, extensions, remove_directory=False):
def delete_files_in_directory(base_directory, extensions, remove_directory=False, display_popup_on_error=True):
extension_blacklist = get_delete_directory_extension_blacklist()
for ext in extension_blacklist:
if ext in extensions:
Expand Down Expand Up @@ -169,17 +169,23 @@ def delete_files_in_directory(base_directory, extensions, remove_directory=False
first_error = str(e)

if remove_error_count > 0:
errmsg = "Error encountered attempting to remove " + str(remove_error_count) + " file(s). Reason: <" + first_error + ">. "
errmsg = "Error encountered attempting to remove " + str(remove_error_count) + " file(s) in <" + base_directory + ">. Reason: <" + first_error + ">. "
errmsg += "Try closing all applications accessing the directory, restarting Blender/System, or deleting directory manually."
bpy.ops.flip_fluid_operators.display_error(
'INVOKE_DEFAULT',
error_message="Error Removing Files",
error_description=errmsg,
popup_width=700
)
if display_popup_on_error:
# Method may be run from bake.py script where there is not window from this context
# in this case, 'display_popup_on_error' should be set so this operator does not run.
bpy.ops.flip_fluid_operators.display_error(
'INVOKE_DEFAULT',
error_message="Error Removing Files",
error_description=errmsg,
popup_width=700
)
else:
print(errmsg)
raise PermissionError(errmsg)


def delete_file(filepath, error_ok=False):
def delete_file(filepath, error_ok=False, display_popup_on_error=True):
if not os.path.isfile(filepath):
return

Expand All @@ -194,20 +200,26 @@ def delete_file(filepath, error_ok=False):
pass
else:
errmsg = "Error encountered attempting to remove file. Reason: <" + str(e) + ">."
bpy.ops.flip_fluid_operators.display_error(
'INVOKE_DEFAULT',
error_message="Error Removing Files",
error_description=errmsg,
popup_width=700
)
if display_popup_on_error:
# Method may be run from bake.py script where there is not window from this context
# in this case, 'display_popup_on_error' should be set so this operator does not run.
bpy.ops.flip_fluid_operators.display_error(
'INVOKE_DEFAULT',
error_message="Error Removing Files",
error_description=errmsg,
popup_width=700
)
else:
print(errmsg)
raise PermissionError(errmsg)


def clear_cache_directory(cache_directory, clear_export=False, clear_logs=False, remove_directory=False):
stats_filepath = os.path.join(cache_directory, "flipstats.data")
delete_file(stats_filepath)

bakefiles_dir = os.path.join(cache_directory, "bakefiles")
extensions = [".bbox", ".bobj", ".data", ".wwp", ".wwf", ".wwi", ".fpd", ".ffd", ".ffp3"]
extensions = [".bbox", ".bobj", ".data", ".wwp", ".wwf", ".wwi", ".fpd", ".ffd", ".ffp3", ".txt"]
delete_files_in_directory(bakefiles_dir, extensions, remove_directory=True)

temp_dir = os.path.join(cache_directory, "temp")
Expand Down
2 changes: 1 addition & 1 deletion src/addon/materials/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ and subdirectories are licensed under the MIT License:

MIT License

Copyright (C) 2023 Ryan L. Guy
Copyright (C) 2024 Ryan L. Guy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/addon/materials/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/materials/material_library.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/flip_fluid_aabb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/flip_fluid_cache.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/flip_fluid_geometry_database.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/flip_fluid_geometry_export_object.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/flip_fluid_geometry_exporter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/flip_fluid_map.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/flip_fluid_material_library.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/objects/flip_fluid_preset_stack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/operators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/operators/bake_operators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/operators/cache_operators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/addon/operators/draw_force_field_operators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Blender FLIP Fluids Add-on
# Copyright (C) 2023 Ryan L. Guy
# Copyright (C) 2024 Ryan L. Guy
#
# 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
Expand Down
Loading

0 comments on commit 9403e6c

Please sign in to comment.