Skip to content

Commit ae971e6

Browse files
committed
new demo version 0.7.0!
1 parent 398fed7 commit ae971e6

Some content is hidden

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

45 files changed

+3988
-2109
lines changed

README.md

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

1010
### Getting Started
1111

12-
Download the latest FLIP Fluids Demo installation file here: [FLIP_Fluids_addon_0.6.5_demo_(07_jun_2023.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.6.3/FLIP_Fluids_addon_0.6.5_demo_.07_jun_2023.zip)
12+
Download the latest FLIP Fluids Demo installation file here: [FLIP_Fluids_addon_0.7.0_demo_(27_jun_2023.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.7.0/FLIP_Fluids_addon_0.7.0_demo_.27_jun_2023.zip)
1313

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

cmake/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ set(CMAKE_BUILD_TYPE Release)
5252

5353
set(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD TRUE)
5454
set(FLUIDENGINE_VERSION_MAJOR 0)
55-
set(FLUIDENGINE_VERSION_MINOR 6)
56-
set(FLUIDENGINE_VERSION_REVISION 5)
57-
set(FLUIDENGINE_VERSION_DATE "07-JUN-2023")
55+
set(FLUIDENGINE_VERSION_MINOR 7)
56+
set(FLUIDENGINE_VERSION_REVISION 0)
57+
set(FLUIDENGINE_VERSION_DATE "27-JUN-2023")
5858

5959
if(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD)
6060
set(FLUIDENGINE_VERSION_TYPE_LABEL "Demo")
@@ -119,14 +119,14 @@ if(MSVC)
119119
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
120120
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
121121
elseif(MINGW)
122-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -O3 -std=c++11 -Wall")
122+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -fopenmp -O3 -std=c++11 -Wall")
123123
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
124124
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
125125
elseif(APPLE)
126126
set(CMAKE_MACOSX_RPATH ON)
127127
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -Wall -Wno-return-type-c-linkage")
128128
else()
129-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_NANOSLEEP -O3 -std=c++11 -Wall -fPIC -pthread")
129+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_NANOSLEEP -fopenmp -O3 -std=c++11 -Wall -fPIC -pthread")
130130
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${PROJECT_SOURCE_DIR}/src/engine/glibc_version_header/force_link_glibc_2.5.h")
131131
endif()
132132

src/addon/export.py

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def __get_domain_data_dict(context, dobj):
135135
dprops.advanced.initialize_num_threads_auto_detect()
136136
d['advanced']['num_threads_auto_detect'] = dprops.advanced.num_threads_auto_detect
137137
d['simulation']['frames_per_second'] = dprops.simulation.get_frame_rate_data_dict()
138+
d['simulation']['time_scale'] = dprops.simulation.get_time_scale_data_dict()
138139
d['world']['gravity'] = dprops.world.get_gravity_data_dict()
139140
d['world']['scene_use_gravity'] = dprops.world.get_scene_use_gravity_data_dict()
140141
d['world']['native_surface_tension_scale'] = dprops.world.native_surface_tension_scale

src/addon/operators/draw_grid_operators.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -364,26 +364,30 @@ def draw_callback_3d(self, context):
364364
# Draw
365365
display_grid = dprops.debug.display_simulation_grid
366366
if vcu.is_blender_28():
367+
line_draw_mode = '3D_UNIFORM_COLOR'
368+
if vcu.is_blender_36():
369+
# 3D/2D prefix deprecated in recent versions of Blender
370+
line_draw_mode = 'UNIFORM_COLOR'
367371
if display_grid and dprops.debug.enabled_debug_grids[2]:
368-
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
372+
shader = gpu.shader.from_builtin(line_draw_mode)
369373
batch = batch_for_shader(shader, 'LINES', {"pos": z_coords})
370374
shader.bind()
371375
shader.uniform_float("color", (z_color[0], z_color[1], z_color[2], 1.0))
372376
batch.draw(shader)
373377
if display_grid and dprops.debug.enabled_debug_grids[1]:
374-
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
378+
shader = gpu.shader.from_builtin(line_draw_mode)
375379
batch = batch_for_shader(shader, 'LINES', {"pos": y_coords})
376380
shader.bind()
377381
shader.uniform_float("color", (y_color[0], y_color[1], y_color[2], 1.0))
378382
batch.draw(shader)
379383
if display_grid and dprops.debug.enabled_debug_grids[0]:
380-
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
384+
shader = gpu.shader.from_builtin(line_draw_mode)
381385
batch = batch_for_shader(shader, 'LINES', {"pos": x_coords})
382386
shader.bind()
383387
shader.uniform_float("color", (x_color[0], x_color[1], x_color[2], 1.0))
384388
batch.draw(shader)
385389
if dprops.debug.display_domain_bounds:
386-
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
390+
shader = gpu.shader.from_builtin(line_draw_mode)
387391
batch = batch_for_shader(shader, 'LINES', {"pos": bounds_coords})
388392
shader.bind()
389393
shader.uniform_float("color", (bounds_color[0], bounds_color[1], bounds_color[2], 1.0))

src/addon/operators/helper_operators.py

+160-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
import bpy, os, stat, subprocess, platform, math, mathutils, fnmatch, random
17+
import bpy, os, stat, subprocess, platform, math, mathutils, fnmatch, random, mathutils, datetime
1818
from bpy.props import (
1919
BoolProperty,
2020
StringProperty
@@ -23,6 +23,7 @@
2323
from ..utils import version_compatibility_utils as vcu
2424
from ..utils import export_utils
2525
from ..utils import audio_utils
26+
from ..objects import flip_fluid_cache
2627
from ..objects import flip_fluid_aabb
2728
from . import bake_operators
2829
from .. import render
@@ -2796,6 +2797,160 @@ def execute(self, context):
27962797
return {'FINISHED'}
27972798

27982799

2800+
class FlipFluidMeasureObjectSpeed(bpy.types.Operator):
2801+
bl_idname = "flip_fluid_operators.measure_object_speed"
2802+
bl_label = "Measure Object Speed"
2803+
bl_description = ("Measure and display the speed of the active object within the simulation" +
2804+
" for the current frame. The measured speed depends on the object animation, simulation" +
2805+
" world scale and time scale, and animation frame rate." +
2806+
" The objects center speed, min vertex speed, and max vertex speed will be computed. Using" +
2807+
" this operator on an object with complex geometry or a high polycount may cause Blender to" +
2808+
" pause during computation")
2809+
2810+
2811+
@classmethod
2812+
def poll(cls, context):
2813+
selected_objects = bpy.context.selected_objects
2814+
bl_object = vcu.get_active_object(context)
2815+
if selected_objects:
2816+
if bl_object not in selected_objects:
2817+
bl_object = selected_objects[0]
2818+
else:
2819+
bl_object = None
2820+
return bl_object is not None
2821+
2822+
2823+
def frame_set(self, context, frameno):
2824+
from ..properties import helper_properties
2825+
helper_properties.DISABLE_FRAME_CHANGE_POST_HANDLER = True
2826+
flip_fluid_cache.DISABLE_MESH_CACHE_LOAD = True
2827+
context.scene.frame_set(frameno)
2828+
flip_fluid_cache.DISABLE_MESH_CACHE_LOAD = False
2829+
helper_properties.DISABLE_FRAME_CHANGE_POST_HANDLER = False
2830+
2831+
2832+
def get_object_vertices_and_center(self, context, bl_object, frameno):
2833+
self.frame_set(context, frameno)
2834+
2835+
vertices = []
2836+
center = None
2837+
if bl_object.type == 'EMPTY':
2838+
vertices.append(mathutils.Vector(bl_object.matrix_world.translation))
2839+
center = mathutils.Vector(bl_object.matrix_world.translation)
2840+
else:
2841+
depsgraph = context.evaluated_depsgraph_get()
2842+
obj_eval = bl_object.evaluated_get(depsgraph)
2843+
evaluated_mesh = obj_eval.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph)
2844+
for mv in evaluated_mesh.vertices:
2845+
vertices.append(obj_eval.matrix_world @ mv.co)
2846+
2847+
local_bbox_center = 0.125 * sum((mathutils.Vector(b) for b in bl_object.bound_box), mathutils.Vector())
2848+
center = bl_object.matrix_world @ local_bbox_center
2849+
2850+
return vertices, center
2851+
2852+
2853+
def execute(self, context):
2854+
timer_start = datetime.datetime.now()
2855+
2856+
hprops = context.scene.flip_fluid_helper
2857+
hprops.is_translation_data_available = False
2858+
2859+
selected_objects = bpy.context.selected_objects
2860+
bl_object = vcu.get_active_object(context)
2861+
if selected_objects:
2862+
if bl_object not in selected_objects:
2863+
bl_object = selected_objects[0]
2864+
else:
2865+
bl_object = None
2866+
2867+
if bl_object is None:
2868+
err_msg = "No active object selected."
2869+
self.report({'ERROR'}, err_msg)
2870+
print("Measure Object Speed Error: " + err_msg + "\n")
2871+
return {'CANCELLED'}
2872+
2873+
valid_object_types = ['MESH', 'EMPTY', 'CURVE']
2874+
if bl_object.type not in valid_object_types:
2875+
err_msg = "Invalid object type <" + bl_object.type + ">. Object must be a Mesh, Curve, or Empty to measure speed."
2876+
self.report({'ERROR'}, err_msg)
2877+
print("Measure Object Speed Error: " + err_msg + "\n")
2878+
return {'CANCELLED'}
2879+
2880+
original_frame = context.scene.frame_current
2881+
frame1 = original_frame - 1
2882+
frame2 = original_frame + 1
2883+
2884+
print("Measure Object Speed: Exporting <" + bl_object.name + "> geometry for frame " + str(frame1) + "...", end=' ')
2885+
vertices1, center1 = self.get_object_vertices_and_center(context, bl_object, frame1)
2886+
print("Exported " + str(len(vertices1)) + " vertices.")
2887+
2888+
if len(vertices1) == 0:
2889+
err_msg = "Object does not contain geometry."
2890+
self.report({'ERROR'}, err_msg)
2891+
print("Measure Object Speed Error: " + err_msg + "\n")
2892+
self.frame_set(context, original_frame)
2893+
return {'CANCELLED'}
2894+
2895+
print("Measure Object Speed: Exporting <" + bl_object.name + "> geometry for frame " + str(frame2) + "...", end=' ')
2896+
vertices2, center2 = self.get_object_vertices_and_center(context, bl_object, frame2)
2897+
print("Exported " + str(len(vertices2)) + " vertices.")
2898+
self.frame_set(context, original_frame)
2899+
2900+
if len(vertices1) != len(vertices1):
2901+
err_msg = "Cannot measure velocity of object with changing topology."
2902+
self.report({'ERROR'}, err_msg)
2903+
print("Measure Object Speed Error: " + err_msg + "\n")
2904+
return {'CANCELLED'}
2905+
2906+
center_translation = (center2 - center1).length / float(frame2 - frame1)
2907+
min_translation = float('inf')
2908+
max_translation = -float('inf')
2909+
sum_translation = 0.0
2910+
for i in range(len(vertices1)):
2911+
translation = (vertices2[i] - vertices1[i]).length / float(frame2 - frame1)
2912+
min_translation = min(min_translation, translation)
2913+
max_translation = max(max_translation, translation)
2914+
sum_translation += translation
2915+
avg_translation = sum_translation / len(vertices1)
2916+
2917+
timer_end = datetime.datetime.now()
2918+
ms_duration = int((timer_end - timer_start).microseconds / 1000)
2919+
2920+
hprops.min_vertex_translation = min_translation
2921+
hprops.max_vertex_translation = max_translation
2922+
hprops.avg_vertex_translation = avg_translation
2923+
hprops.center_translation = center_translation
2924+
hprops.translation_data_object_name = bl_object.name
2925+
hprops.translation_data_object_vertices = len(vertices1)
2926+
hprops.translation_data_object_frame = original_frame
2927+
hprops.translation_data_object_compute_time = ms_duration
2928+
hprops.is_translation_data_available = True
2929+
2930+
info_str = "Measure Object Speed: Finished computing <" + bl_object.name + "> vertex translations for frame "
2931+
info_str += str(original_frame) + " in " + str(ms_duration) + " milliseconds.\n"
2932+
print(info_str)
2933+
2934+
return {'FINISHED'}
2935+
2936+
2937+
class FlipFluidClearMeasureObjectSpeed(bpy.types.Operator):
2938+
bl_idname = "flip_fluid_operators.clear_measure_object_speed"
2939+
bl_label = "Clear Speed Data"
2940+
bl_description = "Clear the measured object speed display"
2941+
2942+
2943+
@classmethod
2944+
def poll(cls, context):
2945+
return True
2946+
2947+
2948+
def execute(self, context):
2949+
hprops = context.scene.flip_fluid_helper
2950+
hprops.is_translation_data_available = False
2951+
return {'FINISHED'}
2952+
2953+
27992954
def register():
28002955
classes = [
28012956
FlipFluidHelperRemesh,
@@ -2851,6 +3006,8 @@ def register():
28513006
FlipFluidMakePrefixFilenameRenderOutput,
28523007
FlipFluidAutoLoadBakedFramesCMD,
28533008
FlipFluidCopySettingsFromActive,
3009+
FlipFluidMeasureObjectSpeed,
3010+
FlipFluidClearMeasureObjectSpeed,
28543011
]
28553012

28563013
# Workaround for a bug in FLIP Fluids 1.6.0
@@ -2920,3 +3077,5 @@ def unregister():
29203077
bpy.utils.unregister_class(FlipFluidMakePrefixFilenameRenderOutput)
29213078
bpy.utils.unregister_class(FlipFluidAutoLoadBakedFramesCMD)
29223079
bpy.utils.unregister_class(FlipFluidCopySettingsFromActive)
3080+
bpy.utils.unregister_class(FlipFluidMeasureObjectSpeed)
3081+
bpy.utils.unregister_class(FlipFluidClearMeasureObjectSpeed)

src/addon/properties/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def scene_update_post(scene):
4848

4949
def frame_change_post(scene, depsgraph=None):
5050
object_properties.frame_change_post(scene, depsgraph)
51+
helper_properties.frame_change_post(scene, depsgraph)
5152

5253

5354
def load_pre():

src/addon/properties/domain_advanced_properties.py

+6
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ class DomainAdvancedProperties(bpy.types.PropertyGroup):
209209
default=True,
210210
); exec(conv("surface_tension_substeps_exceeded_tooltip"))
211211

212+
frame_substeps_expanded = BoolProperty(default=True); exec(conv("frame_substeps_expanded"))
213+
simulation_method_expanded = BoolProperty(default=True); exec(conv("simulation_method_expanded"))
214+
simulation_stability_expanded = BoolProperty(default=False); exec(conv("simulation_stability_expanded"))
215+
multithreading_expanded = BoolProperty(default=True); exec(conv("multithreading_expanded"))
216+
warnings_and_errors_expanded = BoolProperty(default=False); exec(conv("warnings_and_errors_expanded"))
217+
212218

213219
def register_preset_properties(self, registry, path):
214220
add = registry.add_property

src/addon/properties/domain_cache_properties.py

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ class DomainCacheProperties(bpy.types.PropertyGroup):
8686

8787
is_cache_directory_set = BoolProperty(default=False); exec(conv("is_cache_directory_set"))
8888

89+
cache_directory_expanded = BoolProperty(default=True); exec(conv("cache_directory_expanded"))
90+
link_exported_geometry_expanded = BoolProperty(default=False); exec(conv("link_exported_geometry_expanded"))
91+
cache_operators_expanded = BoolProperty(default=False); exec(conv("cache_operators_expanded"))
92+
8993

9094
def register_preset_properties(self, registry, path):
9195
pass

src/addon/properties/domain_properties.py

+8
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ class FlipFluidDomainProperties(bpy.types.PropertyGroup):
140140
type=preset_properties.PresetRegistry,
141141
); exec(conv("property_registry"))
142142

143+
domain_settings_tabbed_panel_view = EnumProperty(
144+
name="Domain Panel View",
145+
description="Select settings panel to display",
146+
items=types.domain_settings_panel,
147+
default='DOMAIN_SETTINGS_PANEL_SIMULATION',
148+
options={'HIDDEN'},
149+
); exec(conv("domain_settings_tabbed_panel_view"))
150+
143151

144152
def initialize(self):
145153
self.simulation.initialize()

0 commit comments

Comments
 (0)