Skip to content

Commit

Permalink
new demo version 0.7.0!
Browse files Browse the repository at this point in the history
  • Loading branch information
rlguy committed Jun 27, 2023
1 parent 398fed7 commit ae971e6
Show file tree
Hide file tree
Showing 45 changed files with 3,988 additions and 2,109 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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.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)
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)

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
10 changes: 5 additions & 5 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ 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 5)
set(FLUIDENGINE_VERSION_DATE "07-JUN-2023")
set(FLUIDENGINE_VERSION_MINOR 7)
set(FLUIDENGINE_VERSION_REVISION 0)
set(FLUIDENGINE_VERSION_DATE "27-JUN-2023")

if(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD)
set(FLUIDENGINE_VERSION_TYPE_LABEL "Demo")
Expand Down Expand Up @@ -119,14 +119,14 @@ if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
elseif(MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -O3 -std=c++11 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -fopenmp -O3 -std=c++11 -Wall")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
elseif(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -Wall -Wno-return-type-c-linkage")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_NANOSLEEP -O3 -std=c++11 -Wall -fPIC -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_NANOSLEEP -fopenmp -O3 -std=c++11 -Wall -fPIC -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${PROJECT_SOURCE_DIR}/src/engine/glibc_version_header/force_link_glibc_2.5.h")
endif()

Expand Down
1 change: 1 addition & 0 deletions src/addon/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def __get_domain_data_dict(context, dobj):
dprops.advanced.initialize_num_threads_auto_detect()
d['advanced']['num_threads_auto_detect'] = dprops.advanced.num_threads_auto_detect
d['simulation']['frames_per_second'] = dprops.simulation.get_frame_rate_data_dict()
d['simulation']['time_scale'] = dprops.simulation.get_time_scale_data_dict()
d['world']['gravity'] = dprops.world.get_gravity_data_dict()
d['world']['scene_use_gravity'] = dprops.world.get_scene_use_gravity_data_dict()
d['world']['native_surface_tension_scale'] = dprops.world.native_surface_tension_scale
Expand Down
12 changes: 8 additions & 4 deletions src/addon/operators/draw_grid_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,26 +364,30 @@ def draw_callback_3d(self, context):
# Draw
display_grid = dprops.debug.display_simulation_grid
if vcu.is_blender_28():
line_draw_mode = '3D_UNIFORM_COLOR'
if vcu.is_blender_36():
# 3D/2D prefix deprecated in recent versions of Blender
line_draw_mode = 'UNIFORM_COLOR'
if display_grid and dprops.debug.enabled_debug_grids[2]:
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
shader = gpu.shader.from_builtin(line_draw_mode)
batch = batch_for_shader(shader, 'LINES', {"pos": z_coords})
shader.bind()
shader.uniform_float("color", (z_color[0], z_color[1], z_color[2], 1.0))
batch.draw(shader)
if display_grid and dprops.debug.enabled_debug_grids[1]:
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
shader = gpu.shader.from_builtin(line_draw_mode)
batch = batch_for_shader(shader, 'LINES', {"pos": y_coords})
shader.bind()
shader.uniform_float("color", (y_color[0], y_color[1], y_color[2], 1.0))
batch.draw(shader)
if display_grid and dprops.debug.enabled_debug_grids[0]:
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
shader = gpu.shader.from_builtin(line_draw_mode)
batch = batch_for_shader(shader, 'LINES', {"pos": x_coords})
shader.bind()
shader.uniform_float("color", (x_color[0], x_color[1], x_color[2], 1.0))
batch.draw(shader)
if dprops.debug.display_domain_bounds:
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
shader = gpu.shader.from_builtin(line_draw_mode)
batch = batch_for_shader(shader, 'LINES', {"pos": bounds_coords})
shader.bind()
shader.uniform_float("color", (bounds_color[0], bounds_color[1], bounds_color[2], 1.0))
Expand Down
161 changes: 160 additions & 1 deletion src/addon/operators/helper_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import bpy, os, stat, subprocess, platform, math, mathutils, fnmatch, random
import bpy, os, stat, subprocess, platform, math, mathutils, fnmatch, random, mathutils, datetime
from bpy.props import (
BoolProperty,
StringProperty
Expand All @@ -23,6 +23,7 @@
from ..utils import version_compatibility_utils as vcu
from ..utils import export_utils
from ..utils import audio_utils
from ..objects import flip_fluid_cache
from ..objects import flip_fluid_aabb
from . import bake_operators
from .. import render
Expand Down Expand Up @@ -2796,6 +2797,160 @@ def execute(self, context):
return {'FINISHED'}


class FlipFluidMeasureObjectSpeed(bpy.types.Operator):
bl_idname = "flip_fluid_operators.measure_object_speed"
bl_label = "Measure Object Speed"
bl_description = ("Measure and display the speed of the active object within the simulation" +
" for the current frame. The measured speed depends on the object animation, simulation" +
" world scale and time scale, and animation frame rate." +
" The objects center speed, min vertex speed, and max vertex speed will be computed. Using" +
" this operator on an object with complex geometry or a high polycount may cause Blender to" +
" pause during computation")


@classmethod
def poll(cls, context):
selected_objects = bpy.context.selected_objects
bl_object = vcu.get_active_object(context)
if selected_objects:
if bl_object not in selected_objects:
bl_object = selected_objects[0]
else:
bl_object = None
return bl_object is not None


def frame_set(self, context, frameno):
from ..properties import helper_properties
helper_properties.DISABLE_FRAME_CHANGE_POST_HANDLER = True
flip_fluid_cache.DISABLE_MESH_CACHE_LOAD = True
context.scene.frame_set(frameno)
flip_fluid_cache.DISABLE_MESH_CACHE_LOAD = False
helper_properties.DISABLE_FRAME_CHANGE_POST_HANDLER = False


def get_object_vertices_and_center(self, context, bl_object, frameno):
self.frame_set(context, frameno)

vertices = []
center = None
if bl_object.type == 'EMPTY':
vertices.append(mathutils.Vector(bl_object.matrix_world.translation))
center = mathutils.Vector(bl_object.matrix_world.translation)
else:
depsgraph = context.evaluated_depsgraph_get()
obj_eval = bl_object.evaluated_get(depsgraph)
evaluated_mesh = obj_eval.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph)
for mv in evaluated_mesh.vertices:
vertices.append(obj_eval.matrix_world @ mv.co)

local_bbox_center = 0.125 * sum((mathutils.Vector(b) for b in bl_object.bound_box), mathutils.Vector())
center = bl_object.matrix_world @ local_bbox_center

return vertices, center


def execute(self, context):
timer_start = datetime.datetime.now()

hprops = context.scene.flip_fluid_helper
hprops.is_translation_data_available = False

selected_objects = bpy.context.selected_objects
bl_object = vcu.get_active_object(context)
if selected_objects:
if bl_object not in selected_objects:
bl_object = selected_objects[0]
else:
bl_object = None

if bl_object is None:
err_msg = "No active object selected."
self.report({'ERROR'}, err_msg)
print("Measure Object Speed Error: " + err_msg + "\n")
return {'CANCELLED'}

valid_object_types = ['MESH', 'EMPTY', 'CURVE']
if bl_object.type not in valid_object_types:
err_msg = "Invalid object type <" + bl_object.type + ">. Object must be a Mesh, Curve, or Empty to measure speed."
self.report({'ERROR'}, err_msg)
print("Measure Object Speed Error: " + err_msg + "\n")
return {'CANCELLED'}

original_frame = context.scene.frame_current
frame1 = original_frame - 1
frame2 = original_frame + 1

print("Measure Object Speed: Exporting <" + bl_object.name + "> geometry for frame " + str(frame1) + "...", end=' ')
vertices1, center1 = self.get_object_vertices_and_center(context, bl_object, frame1)
print("Exported " + str(len(vertices1)) + " vertices.")

if len(vertices1) == 0:
err_msg = "Object does not contain geometry."
self.report({'ERROR'}, err_msg)
print("Measure Object Speed Error: " + err_msg + "\n")
self.frame_set(context, original_frame)
return {'CANCELLED'}

print("Measure Object Speed: Exporting <" + bl_object.name + "> geometry for frame " + str(frame2) + "...", end=' ')
vertices2, center2 = self.get_object_vertices_and_center(context, bl_object, frame2)
print("Exported " + str(len(vertices2)) + " vertices.")
self.frame_set(context, original_frame)

if len(vertices1) != len(vertices1):
err_msg = "Cannot measure velocity of object with changing topology."
self.report({'ERROR'}, err_msg)
print("Measure Object Speed Error: " + err_msg + "\n")
return {'CANCELLED'}

center_translation = (center2 - center1).length / float(frame2 - frame1)
min_translation = float('inf')
max_translation = -float('inf')
sum_translation = 0.0
for i in range(len(vertices1)):
translation = (vertices2[i] - vertices1[i]).length / float(frame2 - frame1)
min_translation = min(min_translation, translation)
max_translation = max(max_translation, translation)
sum_translation += translation
avg_translation = sum_translation / len(vertices1)

timer_end = datetime.datetime.now()
ms_duration = int((timer_end - timer_start).microseconds / 1000)

hprops.min_vertex_translation = min_translation
hprops.max_vertex_translation = max_translation
hprops.avg_vertex_translation = avg_translation
hprops.center_translation = center_translation
hprops.translation_data_object_name = bl_object.name
hprops.translation_data_object_vertices = len(vertices1)
hprops.translation_data_object_frame = original_frame
hprops.translation_data_object_compute_time = ms_duration
hprops.is_translation_data_available = True

info_str = "Measure Object Speed: Finished computing <" + bl_object.name + "> vertex translations for frame "
info_str += str(original_frame) + " in " + str(ms_duration) + " milliseconds.\n"
print(info_str)

return {'FINISHED'}


class FlipFluidClearMeasureObjectSpeed(bpy.types.Operator):
bl_idname = "flip_fluid_operators.clear_measure_object_speed"
bl_label = "Clear Speed Data"
bl_description = "Clear the measured object speed display"


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


def execute(self, context):
hprops = context.scene.flip_fluid_helper
hprops.is_translation_data_available = False
return {'FINISHED'}


def register():
classes = [
FlipFluidHelperRemesh,
Expand Down Expand Up @@ -2851,6 +3006,8 @@ def register():
FlipFluidMakePrefixFilenameRenderOutput,
FlipFluidAutoLoadBakedFramesCMD,
FlipFluidCopySettingsFromActive,
FlipFluidMeasureObjectSpeed,
FlipFluidClearMeasureObjectSpeed,
]

# Workaround for a bug in FLIP Fluids 1.6.0
Expand Down Expand Up @@ -2920,3 +3077,5 @@ def unregister():
bpy.utils.unregister_class(FlipFluidMakePrefixFilenameRenderOutput)
bpy.utils.unregister_class(FlipFluidAutoLoadBakedFramesCMD)
bpy.utils.unregister_class(FlipFluidCopySettingsFromActive)
bpy.utils.unregister_class(FlipFluidMeasureObjectSpeed)
bpy.utils.unregister_class(FlipFluidClearMeasureObjectSpeed)
1 change: 1 addition & 0 deletions src/addon/properties/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def scene_update_post(scene):

def frame_change_post(scene, depsgraph=None):
object_properties.frame_change_post(scene, depsgraph)
helper_properties.frame_change_post(scene, depsgraph)


def load_pre():
Expand Down
6 changes: 6 additions & 0 deletions src/addon/properties/domain_advanced_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ class DomainAdvancedProperties(bpy.types.PropertyGroup):
default=True,
); exec(conv("surface_tension_substeps_exceeded_tooltip"))

frame_substeps_expanded = BoolProperty(default=True); exec(conv("frame_substeps_expanded"))
simulation_method_expanded = BoolProperty(default=True); exec(conv("simulation_method_expanded"))
simulation_stability_expanded = BoolProperty(default=False); exec(conv("simulation_stability_expanded"))
multithreading_expanded = BoolProperty(default=True); exec(conv("multithreading_expanded"))
warnings_and_errors_expanded = BoolProperty(default=False); exec(conv("warnings_and_errors_expanded"))


def register_preset_properties(self, registry, path):
add = registry.add_property
Expand Down
4 changes: 4 additions & 0 deletions src/addon/properties/domain_cache_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class DomainCacheProperties(bpy.types.PropertyGroup):

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

cache_directory_expanded = BoolProperty(default=True); exec(conv("cache_directory_expanded"))
link_exported_geometry_expanded = BoolProperty(default=False); exec(conv("link_exported_geometry_expanded"))
cache_operators_expanded = BoolProperty(default=False); exec(conv("cache_operators_expanded"))


def register_preset_properties(self, registry, path):
pass
Expand Down
8 changes: 8 additions & 0 deletions src/addon/properties/domain_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ class FlipFluidDomainProperties(bpy.types.PropertyGroup):
type=preset_properties.PresetRegistry,
); exec(conv("property_registry"))

domain_settings_tabbed_panel_view = EnumProperty(
name="Domain Panel View",
description="Select settings panel to display",
items=types.domain_settings_panel,
default='DOMAIN_SETTINGS_PANEL_SIMULATION',
options={'HIDDEN'},
); exec(conv("domain_settings_tabbed_panel_view"))


def initialize(self):
self.simulation.initialize()
Expand Down
Loading

0 comments on commit ae971e6

Please sign in to comment.