Skip to content

Commit

Permalink
new demo version 0.0.9b!
Browse files Browse the repository at this point in the history
  • Loading branch information
rlguy committed Apr 12, 2021
1 parent 6925b58 commit 6977ed7
Show file tree
Hide file tree
Showing 245 changed files with 3,480 additions and 1,051 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) 2020 Ryan L. Guy
Copyright (C) 2021 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Want to try FLIP Fluids addon before buying the full [Blender Market Product](ht

### Getting Started

Download the latest FLIP Fluids Demo installation file here: [FLIP_Fluids_addon_0.0.9a_demo_03_feb_2021.zip](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.0.9/FLIP_Fluids_addon_0.0.9a_demo_03_nov_2021.zip)
Download the latest FLIP Fluids Demo installation file here: [FLIP_Fluids_addon_0.0.9b_demo_03_feb_2021.zip](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.0.9/FLIP_Fluids_addon_0.0.9b_demo_06_apr_2021.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.

Get started creating your first simulation with our [beginners guide](https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Creating-Your-First-FLIP-Fluids-Simulation)!

### Have any questions?

Feel free to send us a message on the [Blender Market](https://blendermarket.com/products/flipfluids), or send us an email at [email protected]. We're always glad to help!
Feel free to send us a message on the [Blender Market](https://blendermarket.com/products/flipfluids), or send us an email at [email protected]. We're always glad to help!
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) 2020 Ryan L. Guy
# Copyright (C) 2021 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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
4 changes: 2 additions & 2 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ set(CMAKE_BUILD_TYPE Release)
set(FLUIDENGINE_VERSION_MAJOR 0)
set(FLUIDENGINE_VERSION_MINOR 0)
set(FLUIDENGINE_VERSION_REVISION 9)
set(FLUIDENGINE_VERSION_LABEL "0.0.9a Demo 03-FEB-2021")
set(FLUIDENGINE_VERSION_LABEL "0.0.9b Demo 06-APR-2021")

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

message(STATUS "FLIP Fluids verson ${FLUIDENGINE_VERSION_LABEL}")
message(STATUS "FLIP Fluids version ${FLUIDENGINE_VERSION_LABEL}")
if(BUILD_DEBUG)
message(STATUS "Building in debug mode")
else()
Expand Down
11 changes: 2 additions & 9 deletions 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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 @@ -99,14 +99,7 @@ def render_cancel(scene):

@bpy.app.handlers.persistent
def frame_change_pre(scene, depsgraph=None):
#scene.objects["mesh_cache"].modifiers["Ocean"].time = scene.objects["mesh_cache"].evaluated_get(depsgraph).modifiers["Ocean"].time

dprops = scene.flip_fluid.get_domain_properties()
domain_object = scene.flip_fluid.get_domain_object()
if domain_object is not None:
domain_object_eval = domain_object.evaluated_get(bpy.context.evaluated_depsgraph_get())
dprops_eval = domain_object_eval.flip_fluid.domain
dprops.render.override_frame = dprops_eval.render.override_frame
pass


@bpy.app.handlers.persistent
Expand Down
144 changes: 110 additions & 34 deletions src/addon/bake.py

Large diffs are not rendered by default.

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) 2020 Ryan L. Guy
# Copyright (C) 2021 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
12 changes: 6 additions & 6 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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 @@ -39,7 +39,7 @@ def __export_simulation_data_to_file(context, simobjects, filename):
jsonstr = json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))

os.makedirs(os.path.dirname(filename), exist_ok=True)
with open(filename, "w") as f:
with open(filename, 'w', encoding='utf-8') as f:
f.write(jsonstr)


Expand Down Expand Up @@ -218,7 +218,7 @@ def __export_static_mesh_data(object_data, mesh_directory):
info = {'mesh_type': 'STATIC'}
info_json = json.dumps(info, sort_keys=True)
info_filepath = os.path.join(mesh_directory, "mesh.info")
with open(info_filepath, "w") as f:
with open(info_filepath, 'w', encoding='utf-8') as f:
f.write(info_json)

dprops = __get_domain_properties()
Expand All @@ -242,7 +242,7 @@ def __export_keyframed_mesh_data(object_data, mesh_directory):
matrix_data = object_data['data']['matrix_data']
matrix_json = json.dumps(matrix_data)
matrix_filepath = os.path.join(mesh_directory, "transforms.data")
with open(matrix_filepath, "w") as f:
with open(matrix_filepath, 'w', encoding='utf-8') as f:
f.write(matrix_json)

info = {
Expand All @@ -252,7 +252,7 @@ def __export_keyframed_mesh_data(object_data, mesh_directory):
}
info_json = json.dumps(info, sort_keys=True)
info_filepath = os.path.join(mesh_directory, "mesh.info")
with open(info_filepath, "w") as f:
with open(info_filepath, 'w', encoding='utf-8') as f:
f.write(info_json)

matrix_filesize = os.stat(matrix_filepath).st_size
Expand Down Expand Up @@ -304,7 +304,7 @@ def __export_animated_mesh_data(object_data, mesh_directory):
}
info_json = json.dumps(info, sort_keys=True)
info_filepath = os.path.join(mesh_directory, "mesh.info")
with open(info_filepath, "w") as f:
with open(info_filepath, 'w', encoding='utf-8') as f:
f.write(info_json)

object_data['data']['mesh_data'] = []
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) 2020 Ryan L. Guy
# Copyright (C) 2021 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
9 changes: 7 additions & 2 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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 @@ -64,7 +64,12 @@ def get_directory_whitelist():
def path_is_parent(parent_path, child_path):
parent_path = os.path.abspath(parent_path)
child_path = os.path.abspath(child_path)
return os.path.commonpath([parent_path]) == os.path.commonpath([parent_path, child_path])
try:
parent_child_commonpath = os.path.commonpath([parent_path, child_path])
except ValueError:
# paths not on same drive
return False
return os.path.commonpath([parent_path]) == parent_child_commonpath


def check_extensions_valid(extensions):
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) 2020 Ryan L. Guy
# Copyright (C) 2021 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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
14 changes: 12 additions & 2 deletions 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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 @@ -175,6 +175,11 @@ def initialize_cache_object(self):
smooth_mod = cache_object.modifiers.new("Smooth", "SMOOTH")
smooth_mod.iterations = 0

# Motion blur not supported. Leaving motion blur enabled can cause
# slow render in versions of Blender 2.91+. Workaround is to
# automatically disable motion blur on the object.
cache_object.cycles.use_motion_blur = False

self._initialize_cache_object_octane(cache_object)

self.cache_object = cache_object
Expand Down Expand Up @@ -464,6 +469,11 @@ def initialize_duplivert_object(self, vertices=[], polygons=[], scale=1.0, insta
vcu.set_object_instance_type(cache_object, instance_type)
vcu.set_object_hide_viewport(duplivert_object, True)

# Motion blur not supported. Leaving motion blur enabled can cause
# slow render in versions of Blender 2.91+. Workaround is to
# automatically disable motion blur on the object.
duplivert_object.cycles.use_motion_blur = False

self.duplivert_object = duplivert_object


Expand Down Expand Up @@ -792,7 +802,7 @@ def _initialize_bounds_data(self, frameno):
filepath = self._get_bounds_filepath(frameno)
bounds_data = None
if os.path.isfile(filepath):
with open(filepath, 'r') as f:
with open(filepath, 'r', encoding='utf-8') as f:
bounds_data = json.loads(f.read())
self.bounds.set(bounds_data)

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) 2020 Ryan L. Guy
# Copyright (C) 2021 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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
8 changes: 4 additions & 4 deletions 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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 @@ -208,7 +208,7 @@ def _initialize_library_material_list(self):
description_path = f[:-len(extension)] + "description"
description_text = ""
if os.path.isfile(description_path):
with open(description_path, 'r') as description_file:
with open(description_path, 'r', encoding='utf-8') as description_file:
description_text = description_file.read()

new_material = self.material_list.add()
Expand Down Expand Up @@ -239,12 +239,12 @@ def _update_material_library_hash(self):
icon_hash_path = os.path.join(icon_dir, "material_library_hash")
old_material_library_hash = None
if os.path.isfile(icon_hash_path):
with open(icon_hash_path, "r") as f:
with open(icon_hash_path, 'r', encoding='utf-8') as f:
old_material_library_hash = f.read()

current_material_library_hash = self._calculate_material_library_hash()
if current_material_library_hash != old_material_library_hash:
with open(icon_hash_path, "w") as f:
with open(icon_hash_path, 'w', encoding='utf-8') as f:
f.write(current_material_library_hash)
return True

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) 2020 Ryan L. Guy
# Copyright (C) 2021 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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
39 changes: 22 additions & 17 deletions 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) 2020 Ryan L. Guy
# Copyright (C) 2021 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 @@ -45,7 +45,7 @@ def _update_stats(context):
cache_dir = dprops.cache.get_cache_abspath()
statsfilepath = os.path.join(cache_dir, dprops.stats.stats_filename)
if not os.path.isfile(statsfilepath):
with open(statsfilepath, 'w') as f:
with open(statsfilepath, 'w', encoding='utf-8') as f:
f.write(json.dumps({}, sort_keys=True, indent=4))

temp_dir = os.path.join(cache_dir, "temp")
Expand All @@ -54,13 +54,13 @@ def _update_stats(context):
if not stat_files:
return

with open(statsfilepath, 'r') as f:
with open(statsfilepath, 'r', encoding='utf-8') as f:
stats_dict = json.loads(f.read())

for statpath in stat_files:
filename = os.path.basename(statpath)
frameno = int(filename[len("framestats"):-len(".data")])
with open(statpath, 'r') as frame_stats:
with open(statpath, 'r', encoding='utf-8') as frame_stats:
try:
frame_stats_dict = json.loads(frame_stats.read())
except:
Expand All @@ -71,7 +71,7 @@ def _update_stats(context):
stats_dict[str(frameno)] = frame_stats_dict
fpl.delete_file(statpath)

with open(statsfilepath, 'w') as f:
with open(statsfilepath, 'w', encoding='utf-8') as f:
f.write(json.dumps(stats_dict, sort_keys=True, indent=4))

dprops.stats.is_stats_current = False
Expand Down Expand Up @@ -539,6 +539,17 @@ def _clear_cache(self, context):
)


def _reset_property_data(self):
dprops = bpy.context.scene.flip_fluid.get_domain_properties()
dprops.mesh_cache.reset_cache_objects()
dprops.stats.refresh_stats()
dprops.stats.reset_time_remaining()
dprops.stats.reset_stats_values()
dprops.bake.check_autosave()
dprops.render.reset_bake()



@classmethod
def poll(cls, context):
dprops = bpy.context.scene.flip_fluid.get_domain_properties()
Expand All @@ -551,21 +562,15 @@ def execute(self, context):
dprops = bpy.context.scene.flip_fluid.get_domain_properties()
cache_path = dprops.cache.get_cache_abspath()
if not os.path.isdir(cache_path):
self.report({"ERROR"}, "Current cache directory does not exist")
return {'CANCELLED'}
dprops.cache.mark_cache_directory_set()
self._reset_property_data()
self.report({"INFO"}, "Current cache directory does not exist - skipping cache reset")
return {'FINISHED'}

dprops.cache.mark_cache_directory_set()
self._clear_cache(context)
dprops.mesh_cache.reset_cache_objects()

self.report({"INFO"}, "Successfully reset bake")

dprops.stats.refresh_stats()
dprops.stats.reset_time_remaining()
dprops.stats.reset_stats_values()
dprops.bake.check_autosave()
dprops.render.reset_bake()
self._reset_property_data()

self.report({"INFO"}, "Successfully reset bake")
return {'FINISHED'}


Expand Down
Loading

0 comments on commit 6977ed7

Please sign in to comment.