Skip to content

Commit 6977ed7

Browse files
committed
new demo version 0.0.9b!
1 parent 6925b58 commit 6977ed7

File tree

245 files changed

+3480
-1051
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

245 files changed

+3480
-1051
lines changed

LICENSE_MIT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2020 Ryan L. Guy
1+
Copyright (C) 2021 Ryan L. Guy
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Want to try FLIP Fluids addon before buying the full [Blender Market Product](ht
88

99
### Getting Started
1010

11-
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)
11+
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)
1212

1313
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.
1414

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

1717
### Have any questions?
1818

19-
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!
19+
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!

__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

build.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (C) 2020 Ryan L. Guy
3+
# Copyright (C) 2021 Ryan L. Guy
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal

cmake/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ set(CMAKE_BUILD_TYPE Release)
4747
set(FLUIDENGINE_VERSION_MAJOR 0)
4848
set(FLUIDENGINE_VERSION_MINOR 0)
4949
set(FLUIDENGINE_VERSION_REVISION 9)
50-
set(FLUIDENGINE_VERSION_LABEL "0.0.9a Demo 03-FEB-2021")
50+
set(FLUIDENGINE_VERSION_LABEL "0.0.9b Demo 06-APR-2021")
5151

5252
if(BUILD_DEBUG)
5353
set(FLUIDENGINE_VERSION_LABEL "${FLUIDENGINE_VERSION_LABEL} (DEBUG BUILD)")
5454
endif()
5555

56-
message(STATUS "FLIP Fluids verson ${FLUIDENGINE_VERSION_LABEL}")
56+
message(STATUS "FLIP Fluids version ${FLUIDENGINE_VERSION_LABEL}")
5757
if(BUILD_DEBUG)
5858
message(STATUS "Building in debug mode")
5959
else()

src/addon/__init__.py.in

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -99,14 +99,7 @@ def render_cancel(scene):
9999

100100
@bpy.app.handlers.persistent
101101
def frame_change_pre(scene, depsgraph=None):
102-
#scene.objects["mesh_cache"].modifiers["Ocean"].time = scene.objects["mesh_cache"].evaluated_get(depsgraph).modifiers["Ocean"].time
103-
104-
dprops = scene.flip_fluid.get_domain_properties()
105-
domain_object = scene.flip_fluid.get_domain_object()
106-
if domain_object is not None:
107-
domain_object_eval = domain_object.evaluated_get(bpy.context.evaluated_depsgraph_get())
108-
dprops_eval = domain_object_eval.flip_fluid.domain
109-
dprops.render.override_frame = dprops_eval.render.override_frame
102+
pass
110103

111104

112105
@bpy.app.handlers.persistent

src/addon/bake.py

+110-34
Large diffs are not rendered by default.

src/addon/exit_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/export.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ def __export_simulation_data_to_file(context, simobjects, filename):
3939
jsonstr = json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))
4040

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

4545

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

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

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

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

310310
object_data['data']['mesh_data'] = []

src/addon/filesystem/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/filesystem/filesystem_protection_layer.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -64,7 +64,12 @@ def get_directory_whitelist():
6464
def path_is_parent(parent_path, child_path):
6565
parent_path = os.path.abspath(parent_path)
6666
child_path = os.path.abspath(child_path)
67-
return os.path.commonpath([parent_path]) == os.path.commonpath([parent_path, child_path])
67+
try:
68+
parent_child_commonpath = os.path.commonpath([parent_path, child_path])
69+
except ValueError:
70+
# paths not on same drive
71+
return False
72+
return os.path.commonpath([parent_path]) == parent_child_commonpath
6873

6974

7075
def check_extensions_valid(extensions):

src/addon/materials/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/materials/material_library.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/objects/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/objects/flip_fluid_aabb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/objects/flip_fluid_cache.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -175,6 +175,11 @@ def initialize_cache_object(self):
175175
smooth_mod = cache_object.modifiers.new("Smooth", "SMOOTH")
176176
smooth_mod.iterations = 0
177177

178+
# Motion blur not supported. Leaving motion blur enabled can cause
179+
# slow render in versions of Blender 2.91+. Workaround is to
180+
# automatically disable motion blur on the object.
181+
cache_object.cycles.use_motion_blur = False
182+
178183
self._initialize_cache_object_octane(cache_object)
179184

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

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

469479

@@ -792,7 +802,7 @@ def _initialize_bounds_data(self, frameno):
792802
filepath = self._get_bounds_filepath(frameno)
793803
bounds_data = None
794804
if os.path.isfile(filepath):
795-
with open(filepath, 'r') as f:
805+
with open(filepath, 'r', encoding='utf-8') as f:
796806
bounds_data = json.loads(f.read())
797807
self.bounds.set(bounds_data)
798808

src/addon/objects/flip_fluid_geometry_database.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/objects/flip_fluid_geometry_export_object.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/objects/flip_fluid_geometry_exporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/objects/flip_fluid_map.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/objects/flip_fluid_material_library.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -208,7 +208,7 @@ def _initialize_library_material_list(self):
208208
description_path = f[:-len(extension)] + "description"
209209
description_text = ""
210210
if os.path.isfile(description_path):
211-
with open(description_path, 'r') as description_file:
211+
with open(description_path, 'r', encoding='utf-8') as description_file:
212212
description_text = description_file.read()
213213

214214
new_material = self.material_list.add()
@@ -239,12 +239,12 @@ def _update_material_library_hash(self):
239239
icon_hash_path = os.path.join(icon_dir, "material_library_hash")
240240
old_material_library_hash = None
241241
if os.path.isfile(icon_hash_path):
242-
with open(icon_hash_path, "r") as f:
242+
with open(icon_hash_path, 'r', encoding='utf-8') as f:
243243
old_material_library_hash = f.read()
244244

245245
current_material_library_hash = self._calculate_material_library_hash()
246246
if current_material_library_hash != old_material_library_hash:
247-
with open(icon_hash_path, "w") as f:
247+
with open(icon_hash_path, 'w', encoding='utf-8') as f:
248248
f.write(current_material_library_hash)
249249
return True
250250

src/addon/objects/flip_fluid_preset_stack.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/operators/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by

src/addon/operators/bake_operators.py

+22-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blender FLIP Fluids Add-on
2-
# Copyright (C) 2020 Ryan L. Guy
2+
# Copyright (C) 2021 Ryan L. Guy
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ def _update_stats(context):
4545
cache_dir = dprops.cache.get_cache_abspath()
4646
statsfilepath = os.path.join(cache_dir, dprops.stats.stats_filename)
4747
if not os.path.isfile(statsfilepath):
48-
with open(statsfilepath, 'w') as f:
48+
with open(statsfilepath, 'w', encoding='utf-8') as f:
4949
f.write(json.dumps({}, sort_keys=True, indent=4))
5050

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

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

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

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

7777
dprops.stats.is_stats_current = False
@@ -539,6 +539,17 @@ def _clear_cache(self, context):
539539
)
540540

541541

542+
def _reset_property_data(self):
543+
dprops = bpy.context.scene.flip_fluid.get_domain_properties()
544+
dprops.mesh_cache.reset_cache_objects()
545+
dprops.stats.refresh_stats()
546+
dprops.stats.reset_time_remaining()
547+
dprops.stats.reset_stats_values()
548+
dprops.bake.check_autosave()
549+
dprops.render.reset_bake()
550+
551+
552+
542553
@classmethod
543554
def poll(cls, context):
544555
dprops = bpy.context.scene.flip_fluid.get_domain_properties()
@@ -551,21 +562,15 @@ def execute(self, context):
551562
dprops = bpy.context.scene.flip_fluid.get_domain_properties()
552563
cache_path = dprops.cache.get_cache_abspath()
553564
if not os.path.isdir(cache_path):
554-
self.report({"ERROR"}, "Current cache directory does not exist")
555-
return {'CANCELLED'}
556-
dprops.cache.mark_cache_directory_set()
565+
self._reset_property_data()
566+
self.report({"INFO"}, "Current cache directory does not exist - skipping cache reset")
567+
return {'FINISHED'}
557568

569+
dprops.cache.mark_cache_directory_set()
558570
self._clear_cache(context)
559-
dprops.mesh_cache.reset_cache_objects()
560-
561-
self.report({"INFO"}, "Successfully reset bake")
562-
563-
dprops.stats.refresh_stats()
564-
dprops.stats.reset_time_remaining()
565-
dprops.stats.reset_stats_values()
566-
dprops.bake.check_autosave()
567-
dprops.render.reset_bake()
571+
self._reset_property_data()
568572

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

571576

0 commit comments

Comments
 (0)