Skip to content

Commit

Permalink
new demo version 0.7.3!
Browse files Browse the repository at this point in the history
  • Loading branch information
rlguy committed Nov 22, 2023
1 parent db3393c commit 76f7c30
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 38 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![image](https://github.com/rlguy/Blender-FLIP-Fluids/assets/4285191/53714857-6f04-45c8-8c97-694e37cfb6b9)

Want to try the FLIP Fluids addon before buying the [full marketplace product](https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Official-Marketplaces-of-the-FLIP-Fluids-Addon)? Try out the **FLIP Fluids Demo** addon! The FLIP Fluids demo can do almost everything that the full version can and will let you create, run, and render your own fluid simulations with a few small limitations. The demo version is always up-to-date with the latest features and fixes of the full version.

### Limitations
Expand All @@ -9,7 +11,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.7.2_demo_(07_nov_2023.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.7.2/FLIP_Fluids_addon_0.7.2_demo_.07_nov_2023.zip)
Download the latest FLIP Fluids Demo installation file here: [FLIP_Fluids_addon_0.7.3_demo_(24_nov_2023.zip)](https://github.com/rlguy/Blender-FLIP-Fluids/releases/download/v0.7.3/FLIP_Fluids_addon_0.7.3_demo_.24_nov_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
4 changes: 2 additions & 2 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 7)
set(FLUIDENGINE_VERSION_REVISION 2)
set(FLUIDENGINE_VERSION_DATE "07-NOV-2023")
set(FLUIDENGINE_VERSION_REVISION 3)
set(FLUIDENGINE_VERSION_DATE "24-NOV-2023")

if(FLUIDENGINE_VERSION_TYPE_IS_STABLE_BUILD)
set(FLUIDENGINE_VERSION_TYPE_LABEL "Demo")
Expand Down
6 changes: 6 additions & 0 deletions src/addon/bake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,9 @@ def __initialize_fluid_simulation_settings(fluidsim, data):
enable_fluid_particle_interior_output = __get_parameter_data(particles.enable_fluid_particle_interior_output, frameno)
fluidsim.enable_fluid_particle_interior_output = enable_fluid_particle_interior_output

source_id = __get_parameter_data(particles.fluid_particle_source_id_blacklist, frameno)
fluidsim.fluid_particle_source_id_blacklist = source_id

enable_velocity_attribute = __get_parameter_data(particles.enable_fluid_particle_velocity_vector_attribute, frameno)
fluidsim.enable_fluid_particle_velocity_attribute = enable_velocity_attribute

Expand Down Expand Up @@ -2046,6 +2049,9 @@ def __update_animatable_domain_properties(fluidsim, data, frameno):
enable_fluid_particle_interior_output = __get_parameter_data(particles.enable_fluid_particle_interior_output, frameno)
__set_property(fluidsim, 'enable_fluid_particle_interior_output', enable_fluid_particle_interior_output)

source_id = __get_parameter_data(particles.fluid_particle_source_id_blacklist, frameno)
__set_property(fluidsim, 'fluid_particle_source_id_blacklist', source_id)

# Surface Settings

surface = dprops.surface
Expand Down
11 changes: 10 additions & 1 deletion src/addon/properties/domain_particles_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ class DomainParticlesProperties(bpy.types.PropertyGroup):
" to be interior particles if they are not classified as either surface or boundary particles",
default=True,
); exec(conv("enable_fluid_particle_interior_output"))
fluid_particle_source_id_blacklist = IntProperty(
name="Skip Source ID",
description="If the Source ID attribute is enabled, do not export fluid particles with the specified"
" Source ID value. Useful to reduce cache size and speed up playback in situations where particles"
" are not needed from specific Fluid or Inflow objects",
min=-1,
default=-1,
); exec(conv("fluid_particle_source_id_blacklist"))
enable_fluid_particle_velocity_vector_attribute = BoolProperty(
name="Generate Velocity Attributes",
description="Generate fluid 3D velocity vector attributes for the fluid particles. After"
Expand Down Expand Up @@ -147,7 +155,7 @@ class DomainParticlesProperties(bpy.types.PropertyGroup):
); exec(conv("enable_fluid_particle_source_id_attribute"))

fluid_particles_expanded = BoolProperty(default=True); exec(conv("fluid_particles_expanded"))
fluid_particle_generation_expanded = BoolProperty(default=True); exec(conv("fluid_particle_generation_expanded"))
fluid_particle_generation_expanded = BoolProperty(default=False); exec(conv("fluid_particle_generation_expanded"))
fluid_particle_display_settings_expanded = BoolProperty(default=False); exec(conv("fluid_particle_display_settings_expanded"))
geometry_attributes_expanded = BoolProperty(default=False); exec(conv("geometry_attributes_expanded"))
velocity_attributes_expanded = BoolProperty(default=False); exec(conv("velocity_attributes_expanded"))
Expand All @@ -162,6 +170,7 @@ def register_preset_properties(self, registry, path):
add(path + ".enable_fluid_particle_surface_output", "Export Surface Particles", group_id=0)
add(path + ".enable_fluid_particle_boundary_output", "Export Boundary Particles", group_id=0)
add(path + ".enable_fluid_particle_interior_output", "Export Interior Particles", group_id=0)
add(path + ".fluid_particle_source_id_blacklist", "Skip Source ID", group_id=0)
add(path + ".enable_fluid_particle_velocity_vector_attribute", "Velocity Attribute", group_id=0)
add(path + ".enable_fluid_particle_speed_attribute", "Speed Attribute", group_id=0)
add(path + ".enable_fluid_particle_vorticity_vector_attribute", "Vorticity Attribute", group_id=0)
Expand Down
3 changes: 2 additions & 1 deletion src/addon/ui/domain_particles_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ def draw(self, context):
subcolumn.prop(pprops, "enable_fluid_particle_surface_output")
subcolumn.prop(pprops, "enable_fluid_particle_boundary_output")
subcolumn.prop(pprops, "enable_fluid_particle_interior_output")
subcolumn.separator()
subcolumn.prop(pprops, "fluid_particle_source_id_blacklist", text="Skip Particles With Source ID Value")

box = self.layout.box()
row = box.row(align=True)
Expand All @@ -262,7 +264,6 @@ def draw(self, context):

box = self.layout.box()
row = box.row(align=True)
row.enabled = pprops.enable_fluid_particle_output
row.prop(pprops, "fluid_particle_display_settings_expanded",
icon="TRIA_DOWN" if pprops.fluid_particle_display_settings_expanded else "TRIA_RIGHT",
icon_only=True,
Expand Down
12 changes: 6 additions & 6 deletions src/addon/ui/fluid_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def draw(self, context):
box.label(text="Geometry Attributes:")
column = box.column(align=True)
if vcu.is_blender_293():
is_color_attribute_enabled = (dprops.surface.enable_color_attribute or
dprops.particles.enable_fluid_particle_color_attribute)
is_color_attribute_enabled = dprops is not None and (dprops.surface.enable_color_attribute or
dprops.particles.enable_fluid_particle_color_attribute)
show_color = dprops is not None and is_color_attribute_enabled
split = column.split(align=True)
column_left = split.column(align=True)
Expand Down Expand Up @@ -162,8 +162,8 @@ def draw(self, context):
row.label(text="Domain required for this option")
column.separator()

is_lifetime_attribute_enabled = (dprops.surface.enable_lifetime_attribute or
dprops.particles.enable_fluid_particle_lifetime_attribute)
is_lifetime_attribute_enabled = dprops is not None and (dprops.surface.enable_lifetime_attribute or
dprops.particles.enable_fluid_particle_lifetime_attribute)
show_lifetime = dprops is not None and is_lifetime_attribute_enabled
split = column.split(align=True)
column_left = split.column(align=True)
Expand All @@ -182,8 +182,8 @@ def draw(self, context):
row.label(text="Domain required for this option")
column.separator()

is_source_id_attribute_enabled = (dprops.surface.enable_source_id_attribute or
dprops.particles.enable_fluid_particle_source_id_attribute)
is_source_id_attribute_enabled = dprops is not None and (dprops.surface.enable_source_id_attribute or
dprops.particles.enable_fluid_particle_source_id_attribute)
show_source_id = dprops is not None and is_source_id_attribute_enabled
split = column.split(align=True)
column_left = split.column(align=True)
Expand Down
12 changes: 6 additions & 6 deletions src/addon/ui/inflow_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def draw(self, context):
box.label(text="Geometry Attributes:")
column = box.column(align=True)
if vcu.is_blender_293():
is_color_attribute_enabled = (dprops.surface.enable_color_attribute or
dprops.particles.enable_fluid_particle_color_attribute)
is_color_attribute_enabled = dprops is not None and (dprops.surface.enable_color_attribute or
dprops.particles.enable_fluid_particle_color_attribute)
show_color = dprops is not None and is_color_attribute_enabled
split = column.split(align=True)
column_left = split.column(align=True)
Expand Down Expand Up @@ -175,8 +175,8 @@ def draw(self, context):
row.label(text="Domain required for this option")
column.separator()

is_lifetime_attribute_enabled = (dprops.surface.enable_lifetime_attribute or
dprops.particles.enable_fluid_particle_lifetime_attribute)
is_lifetime_attribute_enabled = dprops is not None and (dprops.surface.enable_lifetime_attribute or
dprops.particles.enable_fluid_particle_lifetime_attribute)
show_lifetime = dprops is not None and is_lifetime_attribute_enabled
split = column.split(align=True)
column_left = split.column(align=True)
Expand All @@ -195,8 +195,8 @@ def draw(self, context):
row.label(text="Domain required for this option")
column.separator()

is_source_id_attribute_enabled = (dprops.surface.enable_source_id_attribute or
dprops.particles.enable_fluid_particle_source_id_attribute)
is_source_id_attribute_enabled = dprops is not None and (dprops.surface.enable_source_id_attribute or
dprops.particles.enable_fluid_particle_source_id_attribute)
show_source_id = dprops is not None and is_source_id_attribute_enabled
split = column.split(align=True)
column_left = split.column(align=True)
Expand Down
15 changes: 15 additions & 0 deletions src/engine/c_bindings/fluidsimulation_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,21 @@ extern "C" {
);
}

EXPORTDLL int FluidSimulation_get_fluid_particle_source_id_blacklist(FluidSimulation* obj,
int *err) {
return CBindings::safe_execute_method_ret_0param(
obj, &FluidSimulation::getFluidParticleSourceIDBlacklist, err
);
}

EXPORTDLL void FluidSimulation_set_fluid_particle_source_id_blacklist(FluidSimulation* obj,
int id,
int *err) {
CBindings::safe_execute_method_void_1param(
obj, &FluidSimulation::setFluidParticleSourceIDBlacklist, id, err
);
}

EXPORTDLL int FluidSimulation_get_surface_subdivision_level(FluidSimulation* obj,
int *err) {
return CBindings::safe_execute_method_ret_0param(
Expand Down
52 changes: 40 additions & 12 deletions src/engine/fluidsimulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,16 @@ bool FluidSimulation::isFluidParticleInteriorOutputEnabled() {
return _isFluidParticleInteriorOutputEnabled;
}

int FluidSimulation::getFluidParticleSourceIDBlacklist() {
return _fluidParticleSourceIDBlacklist;
}

void FluidSimulation::setFluidParticleSourceIDBlacklist(int id) {
_logfile.log(std::ostringstream().flush() <<
_logfile.getTime() << " setFluidParticleSourceIDBlacklist: " << id << std::endl);
_fluidParticleSourceIDBlacklist = id;
}

int FluidSimulation::getSurfaceSubdivisionLevel() {
return _outputFluidSurfaceSubdivisionLevel;
}
Expand Down Expand Up @@ -10315,13 +10325,6 @@ void FluidSimulation::_calculateFluidCurvatureGridThread() {
}

void FluidSimulation::_launchCalculateFluidCurvatureGridThread() {
if (!_isSurfaceTensionEnabled &&
!_isSheetSeedingEnabled &&
!_isDiffuseMaterialOutputEnabled &&
!_isFluidParticleOutputEnabled) {
return;
}

_fluidCurvatureThread = std::thread(&FluidSimulation::_calculateFluidCurvatureGridThread,
this);
_isCalculateFluidCurvatureGridThreadRunning = true;
Expand Down Expand Up @@ -13975,11 +13978,18 @@ void FluidSimulation::_generateFluidParticleDataFFP3(ParticleSystem &fluidPartic
bool isSurfaceEnabled = _isFluidParticleSurfaceOutputEnabled;
bool isBoundaryEnabled = _isFluidParticleBoundaryOutputEnabled;
bool isInteriorEnabled = _isFluidParticleInteriorOutputEnabled;
bool isSourceIDEnabled = _isFluidParticleSourceIDAttributeEnabled;
int skipSourceID = _fluidParticleSourceIDBlacklist;

std::vector<uint16_t> *particle_ids;
_markerParticles.getAttributeValues("ID", particle_ids);
int idLimit = (int)std::round(_fluidParticleIDLimit * _fluidParticleOutputAmount);

std::vector<int> *source_ids = NULL;
if (isSourceIDEnabled) {
_markerParticles.getAttributeValues("SOURCEID", source_ids);
}

int numsurface = 0;
int numboundary = 0;
int numinterior = 0;
Expand All @@ -13990,6 +14000,12 @@ void FluidSimulation::_generateFluidParticleDataFFP3(ParticleSystem &fluidPartic
continue;
}

if (isSourceIDEnabled && skipSourceID >= 0) {
if (source_ids->at(i) == skipSourceID) {
continue;
}
}

if (isSurfaceEnabled && ptype == MarkerParticleType::surface) {
numsurface++;
} else if (isBoundaryEnabled && ptype == MarkerParticleType::boundary) {
Expand All @@ -14012,6 +14028,12 @@ void FluidSimulation::_generateFluidParticleDataFFP3(ParticleSystem &fluidPartic
continue;
}

if (isSourceIDEnabled && skipSourceID >= 0) {
if (source_ids->at(i) == skipSourceID) {
continue;
}
}

if (isSurfaceEnabled && ptype == MarkerParticleType::surface) {
idCountsSurface[pid]++;
} else if (isBoundaryEnabled && ptype == MarkerParticleType::boundary) {
Expand Down Expand Up @@ -14044,6 +14066,12 @@ void FluidSimulation::_generateFluidParticleDataFFP3(ParticleSystem &fluidPartic
continue;
}

if (isSourceIDEnabled && skipSourceID >= 0) {
if (source_ids->at(i) == skipSourceID) {
continue;
}
}

if (isSurfaceEnabled && ptype == MarkerParticleType::surface) {
dataFFP3.sortedFluidParticleIndexTable[i] = indexOffsetSurface + idBinStartIndexSurface[pid];
idBinStartIndexSurface[pid]++;
Expand Down Expand Up @@ -14432,7 +14460,11 @@ void FluidSimulation::_stepFluid(double dt) {
_joinUpdateLiquidLevelSetThread();
_launchAdvectVelocityFieldThread();
_joinAdvectVelocityFieldThread();
_launchCalculateFluidCurvatureGridThread();

if (_isSurfaceTensionEnabled or _isSheetSeedingEnabled or _isDiffuseMaterialOutputEnabled) {
_launchCalculateFluidCurvatureGridThread();
}

_saveVelocityField();
_applyBodyForcesToVelocityField(dt);
_applyViscosityToVelocityField(dt);
Expand All @@ -14454,10 +14486,6 @@ void FluidSimulation::_stepFluid(double dt) {
_joinCalculateFluidCurvatureGridThread();
}

if (_isFluidParticleOutputEnabled) {
_joinCalculateFluidCurvatureGridThread();
}

_updateSheetSeeding();
_updateMarkerParticleVelocities();
_deleteSavedVelocityField();
Expand Down
4 changes: 4 additions & 0 deletions src/engine/fluidsimulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ class FluidSimulation
void disableFluidParticleInteriorOutput();
bool isFluidParticleInteriorOutputEnabled();

int getFluidParticleSourceIDBlacklist();
void setFluidParticleSourceIDBlacklist(int id);

/*
The surface subdivision level determines how many times the
simulation grid is divided when converting marker particles
Expand Down Expand Up @@ -2162,6 +2165,7 @@ class FluidSimulation
double _fluidParticleOutputAmount = 1.0;
bool _isFluidParticleBoundaryOutputEnabled = true;
bool _isFluidParticleInteriorOutputEnabled = true;
int _fluidParticleSourceIDBlacklist = true;

bool _isFluidParticleVelocityAttributeEnabled = false;
bool _isFluidParticleSpeedAttributeEnabled = false;
Expand Down
Loading

0 comments on commit 76f7c30

Please sign in to comment.