Skip to content

Commit

Permalink
new demo version 0.6.4!
Browse files Browse the repository at this point in the history
  • Loading branch information
rlguy committed May 23, 2023
1 parent 9b4f628 commit f353224
Show file tree
Hide file tree
Showing 38 changed files with 784 additions and 215 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ src/engine/versionutils.cpp
src/addon/__init__.py
src/addon/utils/installation_utils.py
CMakeLists.txt
build
build
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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.6.3_demo_(20_apr_2023.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.6.3/FLIP_Fluids_addon_0.6.3_demo_.20_apr_2023.zip)
Download the latest FLIP Fluids Demo installation file here: [FLIP_Fluids_addon_0.6.4_demo_(23_may_2023.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.6.3/FLIP_Fluids_addon_0.6.4_demo_.23_may_2023.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
11 changes: 5 additions & 6 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
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 6)
set(FLUIDENGINE_VERSION_REVISION 3)
set(FLUIDENGINE_VERSION_DATE "20-APR-2023")
set(FLUIDENGINE_VERSION_REVISION 4)
set(FLUIDENGINE_VERSION_DATE "23-MAY-2023")

if(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD)
set(FLUIDENGINE_VERSION_TYPE_LABEL "Demo")
Expand All @@ -65,10 +65,9 @@ else()
endif()

set(FLUIDENGINE_VERSION_LABEL "${FLUIDENGINE_VERSION_MAJOR}.${FLUIDENGINE_VERSION_MINOR}.${FLUIDENGINE_VERSION_REVISION} ${FLUIDENGINE_VERSION_TYPE_LABEL} ${FLUIDENGINE_VERSION_DATE}")

if(BUILD_DEBUG)
set(FLUIDENGINE_VERSION_LABEL "${FLUIDENGINE_VERSION_LABEL} (DEBUG BUILD)")
endif()
#if(BUILD_DEBUG)
# set(FLUIDENGINE_VERSION_LABEL "${FLUIDENGINE_VERSION_LABEL} (DEBUG BUILD)")
#endif()

message(STATUS "FLIP Fluids version ${FLUIDENGINE_VERSION_LABEL}")
if(BUILD_DEBUG)
Expand Down
4 changes: 2 additions & 2 deletions src/addon/bake.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@ def __delete_outdated_savestates(cache_directory, savestate_id):
if savestate_number > savestate_id:
path = os.path.join(savestate_directory, d)
try:
print("Delete savestate", path)
fpl.delete_files_in_directory(path, extensions, remove_directory=True)
except:
print("Error: unable to delete directory <" + path + "> (skipping)")
Expand Down Expand Up @@ -2371,6 +2370,7 @@ def __get_frame_stats_dict(cstats):
stats["fluid_particles"] = cstats.fluid_particles
stats["diffuse_particles"] = cstats.diffuse_particles
stats["substeps"] = cstats.substeps
stats["performance_score"] = cstats.performance_score
stats["pressure_solver_enabled"] = cstats.pressure_solver_enabled
stats["pressure_solver_success"] = cstats.pressure_solver_success
stats["pressure_solver_error"] = cstats.pressure_solver_error
Expand Down Expand Up @@ -2664,7 +2664,7 @@ def __write_autosave_data(domain_data, cache_directory, fluidsim, frameno):
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)
shutil.copytree(autosave_dir, savestate_dir)
shutil.copytree(autosave_dir, savestate_dir, dirs_exist_ok=True)


def __write_simulation_output(domain_data, fluidsim, frameno, cache_directory):
Expand Down
2 changes: 1 addition & 1 deletion src/addon/filesystem/filesystem_protection_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def clear_cache_directory(cache_directory, clear_export=False, clear_logs=False,

savestates_dir = os.path.join(cache_directory, "savestates")
if os.path.isdir(savestates_dir):
extensions = [".data", ".state"]
extensions = [".data", ".state", ".backup"]
savestate_subdirs = [d for d in os.listdir(savestates_dir) if os.path.isdir(os.path.join(savestates_dir, d))]
for subd in savestate_subdirs:
if subd.startswith("autosave"):
Expand Down
9 changes: 9 additions & 0 deletions src/addon/objects/flip_fluid_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ def initialize_cache_object(self):
def delete_cache_object(self):
if self.cache_object is None:
return
if not bpy.context.scene.flip_fluid.is_domain_in_active_scene():
return
self.unload_duplivert_object()
cache_object = self.cache_object
vcu.delete_object(cache_object)
Expand Down Expand Up @@ -850,6 +852,8 @@ def unload_duplivert_object(self):


def get_cache_object(self):
if not bpy.context.scene.flip_fluid.is_domain_in_active_scene():
return None
if self.cache_object is None:
return None

Expand Down Expand Up @@ -1731,6 +1735,8 @@ def initialize_cache_objects(self):
self.initialize_cache_settings()
if not self._is_domain_set():
return
if not bpy.context.scene.flip_fluid.is_domain_in_active_scene():
return

self.surface.initialize_cache_object()

Expand Down Expand Up @@ -1785,6 +1791,9 @@ def reset_cache_objects(self):
self.initialize_cache_settings()
if not self._is_domain_set():
return
if not bpy.context.scene.flip_fluid.is_domain_in_active_scene():
return

self.surface.reset_cache_object()
self.foam.reset_cache_object()
self.bubble.reset_cache_object()
Expand Down
12 changes: 12 additions & 0 deletions src/addon/operators/bake_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ def execute(self, context):
self.cancel(context)
return {'CANCELLED'}

if not context.scene.flip_fluid.is_domain_in_active_scene():
self.report({"ERROR"},
"Active scene must contain domain object to begin baking. Select the scene that contains the domain object and try again.")
self.cancel(context)
return {'CANCELLED'}

dprops = self._get_domain_properties()
if dprops.bake.is_simulation_running:
self.cancel(context)
Expand Down Expand Up @@ -525,6 +531,12 @@ def execute(self, context):
self.cancel(context)
return {'CANCELLED'}

if not context.scene.flip_fluid.is_domain_in_active_scene():
self.report({"ERROR"},
"Active scene must contain domain object to begin baking. Select the scene that contains the domain object, save, and try again.")
self.cancel(context)
return {'CANCELLED'}

self._reset_bake(context)
self._initialize_domain(context)
success = self._export_simulation_data(context)
Expand Down
105 changes: 104 additions & 1 deletion src/addon/operators/cache_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def execute(self, context):


class FlipFluidIncreaseDecreaseCacheDirectory(bpy.types.Operator):
bl_idname = "flip_fluid_operators.increment_decrease_cache_directory"
bl_idname = "flip_fluid_operators.increase_decrease_cache_directory"
bl_label = "Increase/Decrease Cache Directory"
bl_description = ("Increase or decrease a numbered suffix on the cache directory." +
" Note: this will not rename an existing cache directory")
Expand Down Expand Up @@ -468,6 +468,105 @@ def execute(self, context):
return {'FINISHED'}


class FlipFluidIncreaseDecreaseRenderDirectory(bpy.types.Operator):
bl_idname = "flip_fluid_operators.increase_decrease_render_directory"
bl_label = "Increase/Decrease Render Directory"
bl_description = ("Increase or decrease a numbered suffix on the render output directory." +
" Note: this will not rename an existing render output directory")

increment_mode = StringProperty(default="INCREASE")
exec(vcu.convert_attribute_to_28("increment_mode"))


@classmethod
def poll(cls, context):
return True


def get_trailing_number(self, s):
m = re.search(r'\d+$', s)
return int(m.group()) if m else None


def ends_with_slash(self, s):
return s.endswith("/") or s.endswith("\\")


def ends_with_underscore(self, s):
return s.endswith("_")


def execute(self, context):
render_directory = context.scene.render.filepath

basename = render_directory
endswith_slash = self.ends_with_slash(basename)
endswith_underscore = self.ends_with_underscore(basename)

slash_character = ""
if endswith_slash:
slash_character = basename[-1]
basename = basename[:-1]
elif endswith_underscore:
basename = basename[:-1]

suffix_number = self.get_trailing_number(basename)
if suffix_number:
basename = basename[:-len(str(suffix_number))]
if endswith_underscore:
if self.ends_with_underscore(basename):
basename = basename[:-1]

if self.increment_mode == 'INCREASE':
if not suffix_number:
suffix_number = 0
suffix_number += 1
suffix_string = str(suffix_number)
else:
if not suffix_number:
return {'FINISHED'}
if suffix_number <= 1:
suffix_string = ""

else:
suffix_string = str(suffix_number - 1)

if endswith_slash:
new_basename = basename + suffix_string + slash_character
elif endswith_underscore:
if suffix_string:
new_basename = basename + "_" + suffix_string + "_"
else:
new_basename = basename + "_"
else:
new_basename = basename + suffix_string

context.scene.render.filepath = new_basename
return {'FINISHED'}


class FlipFluidIncreaseDecreaseCacheRenderVersion(bpy.types.Operator):
bl_idname = "flip_fluid_operators.increase_decrease_cache_render_version"
bl_label = "Increase/Decrease Cache and Render Version"
bl_description = ("Increase or decrease a numbered suffix on both the cache" +
" directory and render output directory. Note: this will not rename an" +
" existing cache our render output directory")

increment_mode = StringProperty(default="INCREASE")
exec(vcu.convert_attribute_to_28("increment_mode"))


@classmethod
def poll(cls, context):
return True


def execute(self, context):
bpy.ops.flip_fluid_operators.increase_decrease_cache_directory(increment_mode=self.increment_mode)
bpy.ops.flip_fluid_operators.increase_decrease_render_directory(increment_mode=self.increment_mode)
return {'FINISHED'}


class FlipFluidRelativeLinkedGeometryDirectory(bpy.types.Operator):
bl_idname = "flip_fluid_operators.relative_linked_geometry_directory"
bl_label = "Make Relative"
Expand Down Expand Up @@ -569,6 +668,8 @@ def register():
bpy.utils.register_class(FlipFluidAbsoluteCacheDirectory)
bpy.utils.register_class(FlipFluidMatchFilenameCacheDirectory)
bpy.utils.register_class(FlipFluidIncreaseDecreaseCacheDirectory)
bpy.utils.register_class(FlipFluidIncreaseDecreaseRenderDirectory)
bpy.utils.register_class(FlipFluidIncreaseDecreaseCacheRenderVersion)
bpy.utils.register_class(FlipFluidRelativeLinkedGeometryDirectory)
bpy.utils.register_class(FlipFluidAbsoluteLinkedGeometryDirectory)
bpy.utils.register_class(FlipFluidClearLinkedGeometryDirectory)
Expand All @@ -588,6 +689,8 @@ def unregister():
bpy.utils.unregister_class(FlipFluidAbsoluteCacheDirectory)
bpy.utils.unregister_class(FlipFluidMatchFilenameCacheDirectory)
bpy.utils.unregister_class(FlipFluidIncreaseDecreaseCacheDirectory)
bpy.utils.unregister_class(FlipFluidIncreaseDecreaseRenderDirectory)
bpy.utils.unregister_class(FlipFluidIncreaseDecreaseCacheRenderVersion)
bpy.utils.unregister_class(FlipFluidRelativeLinkedGeometryDirectory)
bpy.utils.unregister_class(FlipFluidAbsoluteLinkedGeometryDirectory)
bpy.utils.unregister_class(FlipFluidClearLinkedGeometryDirectory)
6 changes: 6 additions & 0 deletions src/addon/operators/export_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ def modal(self, context, event):
self.cancel(context)
return {'CANCELLED'}

if not context.scene.flip_fluid.is_domain_in_active_scene():
self.report({"ERROR"},
"Active scene must contain domain object during export - halting export and baking process. Please do not switch active scenes during export.")
self.cancel(context)
return {'CANCELLED'}

if dprops.bake.is_export_operator_cancelled:
self.cancel(context)
return {'FINISHED'}
Expand Down
Loading

0 comments on commit f353224

Please sign in to comment.