diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-14 15:14:51 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-14 15:14:51 +0300 |
commit | d3b59d1358424371725526de824f45aa419cc13d (patch) | |
tree | a6f078cf0f8081af235bbc1bfe8ea12c9135ba27 /source | |
parent | a181b156399a13fa429159112e30c8005d5e8a59 (diff) |
Cleanup: Use DNA defaults for fluid modifier
This will make the "Reset to Default Value" operator in button right
click menus work for the fluid modifier. Before they always reset
the values to 0.
Differential Revision: https://developer.blender.org/D9206
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 236 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_fluid_defaults.h | 267 | ||||
-rw-r--r-- | source/blender/makesdna/intern/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_defaults.c | 12 |
4 files changed, 295 insertions, 221 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index a63e3fda5a3..8b71bb2c683 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -33,6 +33,7 @@ #include "BLI_task.h" #include "BLI_utildefines.h" +#include "DNA_defaults.h" #include "DNA_fluid_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" @@ -4858,255 +4859,48 @@ void BKE_fluid_modifier_create_type_data(struct FluidModifierData *fmd) BKE_fluid_modifier_freeDomain(fmd); } - /* domain object data */ - fmd->domain = MEM_callocN(sizeof(FluidDomainSettings), "FluidDomain"); + fmd->domain = DNA_struct_default_alloc(FluidDomainSettings); fmd->domain->fmd = fmd; - fmd->domain->effector_weights = BKE_effector_add_weights(NULL); - fmd->domain->fluid = NULL; - fmd->domain->fluid_mutex = BLI_rw_mutex_alloc(); - fmd->domain->force_group = NULL; - fmd->domain->fluid_group = NULL; - fmd->domain->effector_group = NULL; - - /* adaptive domain options */ - fmd->domain->adapt_margin = 4; - fmd->domain->adapt_res = 0; - fmd->domain->adapt_threshold = 0.02f; - - /* fluid domain options */ - fmd->domain->maxres = 32; - fmd->domain->solver_res = 3; - fmd->domain->border_collisions = 0; // open domain - fmd->domain->flags = FLUID_DOMAIN_USE_DISSOLVE_LOG | FLUID_DOMAIN_USE_ADAPTIVE_TIME; - fmd->domain->gravity[0] = 0.0f; - fmd->domain->gravity[1] = 0.0f; - fmd->domain->gravity[2] = -9.81f; - fmd->domain->active_fields = 0; - fmd->domain->type = FLUID_DOMAIN_TYPE_GAS; - fmd->domain->boundary_width = 1; - - /* smoke domain options */ - fmd->domain->alpha = 1.0f; - fmd->domain->beta = 1.0f; - fmd->domain->diss_speed = 5; - fmd->domain->vorticity = 0; - fmd->domain->active_color[0] = 0.0f; - fmd->domain->active_color[1] = 0.0f; - fmd->domain->active_color[2] = 0.0f; - fmd->domain->highres_sampling = SM_HRES_FULLSAMPLE; - - /* flame options */ - fmd->domain->burning_rate = 0.75f; - fmd->domain->flame_smoke = 1.0f; - fmd->domain->flame_vorticity = 0.5f; - fmd->domain->flame_ignition = 1.5f; - fmd->domain->flame_max_temp = 3.0f; - fmd->domain->flame_smoke_color[0] = 0.7f; - fmd->domain->flame_smoke_color[1] = 0.7f; - fmd->domain->flame_smoke_color[2] = 0.7f; - - /* noise options */ - fmd->domain->noise_strength = 1.0; - fmd->domain->noise_pos_scale = 2.0f; - fmd->domain->noise_time_anim = 0.1f; - fmd->domain->noise_scale = 2; - fmd->domain->noise_type = FLUID_NOISE_TYPE_WAVELET; - /* liquid domain options */ - fmd->domain->simulation_method = FLUID_DOMAIN_METHOD_FLIP; - fmd->domain->flip_ratio = 0.97f; - fmd->domain->particle_randomness = 0.1f; - fmd->domain->particle_number = 2; - fmd->domain->particle_minimum = 8; - fmd->domain->particle_maximum = 16; - fmd->domain->particle_radius = 1.0f; - fmd->domain->particle_band_width = 3.0f; - fmd->domain->fractions_threshold = 0.05f; - fmd->domain->sys_particle_maximum = 0; - - /* diffusion options*/ - fmd->domain->surface_tension = 0.0f; - fmd->domain->viscosity_base = 1.0f; - fmd->domain->viscosity_exponent = 6.0f; - - /* mesh options */ - fmd->domain->mesh_velocities = NULL; - fmd->domain->mesh_concave_upper = 3.5f; - fmd->domain->mesh_concave_lower = 0.4f; - fmd->domain->mesh_particle_radius = 2.0; - fmd->domain->mesh_smoothen_pos = 1; - fmd->domain->mesh_smoothen_neg = 1; - fmd->domain->mesh_scale = 2; - fmd->domain->totvert = 0; - fmd->domain->mesh_generator = FLUID_DOMAIN_MESH_IMPROVED; - - /* secondary particle options */ - fmd->domain->sndparticle_tau_min_wc = 2.0; - fmd->domain->sndparticle_tau_max_wc = 8.0; - fmd->domain->sndparticle_tau_min_ta = 5.0; - fmd->domain->sndparticle_tau_max_ta = 20.0; - fmd->domain->sndparticle_tau_min_k = 1.0; - fmd->domain->sndparticle_tau_max_k = 5.0; - fmd->domain->sndparticle_k_wc = 200; - fmd->domain->sndparticle_k_ta = 40; - fmd->domain->sndparticle_k_b = 0.5; - fmd->domain->sndparticle_k_d = 0.6; - fmd->domain->sndparticle_l_min = 10.0; - fmd->domain->sndparticle_l_max = 25.0; - fmd->domain->sndparticle_boundary = SNDPARTICLE_BOUNDARY_DELETE; - fmd->domain->sndparticle_combined_export = SNDPARTICLE_COMBINED_EXPORT_OFF; - fmd->domain->sndparticle_potential_radius = 2; - fmd->domain->sndparticle_update_radius = 2; - fmd->domain->particle_type = 0; - fmd->domain->particle_scale = 1; + /* Turn off incompatible options. */ +#ifndef WITH_OPENVDB + fmd->domain.cache_data_format = FLUID_DOMAIN_FILE_UNI; + fmd->domain.cache_particle_format = FLUID_DOMAIN_FILE_UNI; + fmd->domain.cache_noise_format = FLUID_DOMAIN_FILE_UNI; +#endif +#ifndef WITH_OPENVDB_BLOSC + fmd->domain.openvdb_compression = VDB_COMPRESSION_ZIP; +#endif - /* fluid guide options */ - fmd->domain->guide_parent = NULL; - fmd->domain->guide_alpha = 2.0f; - fmd->domain->guide_beta = 5; - fmd->domain->guide_vel_factor = 2.0f; - fmd->domain->guide_source = FLUID_DOMAIN_GUIDE_SRC_DOMAIN; + fmd->domain->effector_weights = BKE_effector_add_weights(NULL); + fmd->domain->fluid_mutex = BLI_rw_mutex_alloc(); - /* cache options */ - fmd->domain->cache_frame_start = 1; - fmd->domain->cache_frame_end = 250; - fmd->domain->cache_frame_pause_data = 0; - fmd->domain->cache_frame_pause_noise = 0; - fmd->domain->cache_frame_pause_mesh = 0; - fmd->domain->cache_frame_pause_particles = 0; - fmd->domain->cache_frame_pause_guide = 0; - fmd->domain->cache_frame_offset = 0; - fmd->domain->cache_flag = 0; - fmd->domain->cache_type = FLUID_DOMAIN_CACHE_REPLAY; - fmd->domain->cache_mesh_format = FLUID_DOMAIN_FILE_BIN_OBJECT; -#ifdef WITH_OPENVDB - fmd->domain->cache_data_format = FLUID_DOMAIN_FILE_OPENVDB; - fmd->domain->cache_particle_format = FLUID_DOMAIN_FILE_OPENVDB; - fmd->domain->cache_noise_format = FLUID_DOMAIN_FILE_OPENVDB; -#else - fmd->domain->cache_data_format = FLUID_DOMAIN_FILE_UNI; - fmd->domain->cache_particle_format = FLUID_DOMAIN_FILE_UNI; - fmd->domain->cache_noise_format = FLUID_DOMAIN_FILE_UNI; -#endif char cache_name[64]; BKE_fluid_cache_new_name_for_current_session(sizeof(cache_name), cache_name); BKE_modifier_path_init( fmd->domain->cache_directory, sizeof(fmd->domain->cache_directory), cache_name); - /* time options */ - fmd->domain->time_scale = 1.0; - fmd->domain->cfl_condition = 4.0; - fmd->domain->timesteps_minimum = 1; - fmd->domain->timesteps_maximum = 4; - - /* display options */ - fmd->domain->axis_slice_method = AXIS_SLICE_FULL; - fmd->domain->slice_axis = 0; - fmd->domain->interp_method = FLUID_DISPLAY_INTERP_LINEAR; - fmd->domain->draw_velocity = false; - fmd->domain->slice_per_voxel = 5.0f; - fmd->domain->slice_depth = 0.5f; - fmd->domain->display_thickness = 1.0f; - fmd->domain->show_gridlines = false; - fmd->domain->coba = NULL; - fmd->domain->grid_scale = 1.0f; - fmd->domain->vector_scale = 1.0f; - fmd->domain->vector_draw_type = VECTOR_DRAW_NEEDLE; - fmd->domain->vector_field = FLUID_DOMAIN_VECTOR_FIELD_VELOCITY; - fmd->domain->vector_scale_with_magnitude = true; - fmd->domain->vector_draw_mac_components = VECTOR_DRAW_MAC_X | VECTOR_DRAW_MAC_Y | - VECTOR_DRAW_MAC_Z; - fmd->domain->use_coba = false; - fmd->domain->coba_field = FLUID_DOMAIN_FIELD_DENSITY; - fmd->domain->gridlines_color_field = 0; - fmd->domain->gridlines_lower_bound = 0.0f; - fmd->domain->gridlines_upper_bound = 1.0f; - fmd->domain->gridlines_range_color[0] = 1.0f; - fmd->domain->gridlines_range_color[1] = 0.0f; - fmd->domain->gridlines_range_color[2] = 0.0f; - fmd->domain->gridlines_range_color[3] = 1.0f; - fmd->domain->gridlines_cell_filter = FLUID_CELL_TYPE_NONE; - - /* -- Deprecated / unsed options (below)-- */ - /* pointcache options */ - BLI_listbase_clear(&fmd->domain->ptcaches[1]); fmd->domain->point_cache[0] = BKE_ptcache_add(&(fmd->domain->ptcaches[0])); fmd->domain->point_cache[0]->flag |= PTCACHE_DISK_CACHE; fmd->domain->point_cache[0]->step = 1; fmd->domain->point_cache[1] = NULL; /* Deprecated */ - fmd->domain->cache_comp = SM_CACHE_LIGHT; - fmd->domain->cache_high_comp = SM_CACHE_LIGHT; - - /* OpenVDB cache options */ -#ifdef WITH_OPENVDB_BLOSC - fmd->domain->openvdb_compression = VDB_COMPRESSION_BLOSC; -#else - fmd->domain->openvdb_compression = VDB_COMPRESSION_ZIP; -#endif - fmd->domain->clipping = 1e-6f; - fmd->domain->openvdb_data_depth = 0; } else if (fmd->type & MOD_FLUID_TYPE_FLOW) { if (fmd->flow) { BKE_fluid_modifier_freeFlow(fmd); } - /* flow object data */ - fmd->flow = MEM_callocN(sizeof(FluidFlowSettings), "MantaFlow"); + fmd->flow = DNA_struct_default_alloc(FluidFlowSettings); fmd->flow->fmd = fmd; - fmd->flow->mesh = NULL; - fmd->flow->psys = NULL; - fmd->flow->noise_texture = NULL; - - /* initial velocity */ - fmd->flow->verts_old = NULL; - fmd->flow->numverts = 0; - fmd->flow->vel_multi = 1.0f; - fmd->flow->vel_normal = 0.0f; - fmd->flow->vel_random = 0.0f; - fmd->flow->vel_coord[0] = 0.0f; - fmd->flow->vel_coord[1] = 0.0f; - fmd->flow->vel_coord[2] = 0.0f; - - /* emission */ - fmd->flow->density = 1.0f; - fmd->flow->color[0] = 0.7f; - fmd->flow->color[1] = 0.7f; - fmd->flow->color[2] = 0.7f; - fmd->flow->fuel_amount = 1.0f; - fmd->flow->temperature = 1.0f; - fmd->flow->volume_density = 0.0f; - fmd->flow->surface_distance = 1.5f; - fmd->flow->particle_size = 1.0f; - fmd->flow->subframes = 0; - - /* texture control */ - fmd->flow->source = FLUID_FLOW_SOURCE_MESH; - fmd->flow->texture_size = 1.0f; - - fmd->flow->type = FLUID_FLOW_TYPE_SMOKE; - fmd->flow->behavior = FLUID_FLOW_BEHAVIOR_GEOMETRY; - fmd->flow->flags = FLUID_FLOW_ABSOLUTE | FLUID_FLOW_USE_PART_SIZE | FLUID_FLOW_USE_INFLOW; } else if (fmd->type & MOD_FLUID_TYPE_EFFEC) { if (fmd->effector) { BKE_fluid_modifier_freeEffector(fmd); } - /* effector object data */ - fmd->effector = MEM_callocN(sizeof(FluidEffectorSettings), "MantaEffector"); + fmd->effector = DNA_struct_default_alloc(FluidEffectorSettings); fmd->effector->fmd = fmd; - fmd->effector->mesh = NULL; - fmd->effector->verts_old = NULL; - fmd->effector->numverts = 0; - fmd->effector->surface_distance = 0.0f; - fmd->effector->type = FLUID_EFFECTOR_TYPE_COLLISION; - fmd->effector->flags = FLUID_EFFECTOR_USE_EFFEC; - - /* guide options */ - fmd->effector->guide_mode = FLUID_EFFECTOR_GUIDE_OVERRIDE; - fmd->effector->vel_multi = 1.0f; } } diff --git a/source/blender/makesdna/DNA_fluid_defaults.h b/source/blender/makesdna/DNA_fluid_defaults.h new file mode 100644 index 00000000000..4097e0d6bba --- /dev/null +++ b/source/blender/makesdna/DNA_fluid_defaults.h @@ -0,0 +1,267 @@ +/* + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#pragma once + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Fluid Domain Settings Struct + * \{ */ + +#define _DNA_DEFAULT_FluidDomainSettings \ + { \ + .fmd = NULL, \ + .fluid = NULL, \ + .fluid_old = NULL, \ + .fluid_mutex = NULL, \ + .fluid_group = NULL, \ + .force_group = NULL, \ + .effector_group = NULL, \ + .tex_density = NULL, \ + .tex_color = NULL, \ + .tex_wt = NULL, \ + .tex_shadow = NULL, \ + .tex_flame = NULL, \ + .tex_flame_coba = NULL, \ + .tex_coba = NULL, \ + .tex_field = NULL, \ + .tex_velocity_x = NULL, \ + .tex_velocity_y = NULL, \ + .tex_velocity_z = NULL, \ + .tex_flags = NULL, \ + .tex_range_field = NULL, \ + .guide_parent = NULL, \ + .mesh_velocities = NULL, \ + .effector_weights = NULL, /* #BKE_effector_add_weights. */ \ + .p0 = {0.0f, 0.0f, 0.0f}, \ + .p1 = {0.0f, 0.0f, 0.0f}, \ + .dp0 = {0.0f, 0.0f, 0.0f}, \ + .cell_size = {0.0f, 0.0f, 0.0f}, \ + .global_size = {0.0f, 0.0f, 0.0f}, \ + .prev_loc = {0.0f, 0.0f, 0.0f}, \ + .shift = {0, 0, 0}, \ + .shift_f = {0.0f, 0.0f, 0.0f}, \ + .obj_shift_f = {0.0f, 0.0f, 0.0f}, \ + .imat = _DNA_DEFAULT_UNIT_M4, \ + .obmat = _DNA_DEFAULT_UNIT_M4, \ + .fluidmat = _DNA_DEFAULT_UNIT_M4, \ + .fluidmat_wt = _DNA_DEFAULT_UNIT_M4, \ + .base_res = {0, 0, 0}, \ + .res_min = {0, 0, 0}, \ + .res_max = {0, 0, 0}, \ + .res = {0, 0, 0}, \ + .total_cells = 0, \ + .dx = 0, \ + .scale = 0.0f, \ + .boundary_width = 1, \ + .gravity_final = {0.0f, 0.0f, 0.0f}, \ + .adapt_margin = 4, \ + .adapt_res = 0, \ + .adapt_threshold = 0.02f, \ + .maxres = 32, \ + .solver_res = 3, \ + .border_collisions = 0, \ + .flags = FLUID_DOMAIN_USE_DISSOLVE_LOG | FLUID_DOMAIN_USE_ADAPTIVE_TIME, \ + .gravity = {0.0f, 0.0f, -9.81f}, \ + .active_fields = 0, \ + .type = FLUID_DOMAIN_TYPE_GAS, \ + .alpha = 1.0f, \ + .beta = 1.0f, \ + .diss_speed = 5, \ + .vorticity = 0.0f, \ + .active_color = {0.0f, 0.0f, 0.0f}, \ + .highres_sampling = SM_HRES_FULLSAMPLE, \ + .burning_rate = 0.75f, \ + .flame_smoke = 1.0f, \ + .flame_vorticity = 0.5f, \ + .flame_ignition = 1.5f, \ + .flame_max_temp = 3.0f, \ + .flame_smoke_color = {0.7f, 0.7f, 0.7f}, \ + .noise_strength = 1.0f, \ + .noise_pos_scale = 2.0f, \ + .noise_time_anim = 0.1f, \ + .res_noise = {0, 0, 0}, \ + .noise_scale = 2, \ + .noise_type = FLUID_NOISE_TYPE_WAVELET, \ + .particle_randomness = 0.1f, \ + .particle_number = 2, \ + .particle_minimum = 8, \ + .particle_maximum = 16, \ + .particle_radius = 1.0f, \ + .particle_band_width = 3.0f, \ + .fractions_threshold = 0.05f, \ + .flip_ratio = 0.97f, \ + .sys_particle_maximum = 0, \ + .simulation_method = FLUID_DOMAIN_METHOD_FLIP, \ + .surface_tension = 0.0f, \ + .viscosity_base = 1.0f, \ + .viscosity_exponent = 6.0f, \ + .mesh_concave_upper = 3.5f, \ + .mesh_concave_lower = 0.4f, \ + .mesh_particle_radius = 2.0f, \ + .mesh_smoothen_pos = 1, \ + .mesh_smoothen_neg = 1, \ + .mesh_scale = 2, \ + .totvert = 0, \ + .mesh_generator = FLUID_DOMAIN_MESH_IMPROVED, \ + .particle_type = 0, \ + .particle_scale = 1, \ + .sndparticle_tau_min_wc = 2.0f, \ + .sndparticle_tau_max_wc = 8.0f, \ + .sndparticle_tau_min_ta = 5.0f, \ + .sndparticle_tau_max_ta = 20.0f, \ + .sndparticle_tau_min_k = 1.0f, \ + .sndparticle_tau_max_k = 5.0f, \ + .sndparticle_k_wc = 200, \ + .sndparticle_k_ta = 40, \ + .sndparticle_k_b = 0.5f, \ + .sndparticle_k_d = 0.6f, \ + .sndparticle_l_min = 10.0f, \ + .sndparticle_l_max = 25.0f, \ + .sndparticle_potential_radius = 2, \ + .sndparticle_update_radius = 2, \ + .sndparticle_boundary = SNDPARTICLE_BOUNDARY_DELETE, \ + .sndparticle_combined_export = SNDPARTICLE_COMBINED_EXPORT_OFF, \ + .guide_alpha = 2.0f, \ + .guide_beta = 5, \ + .guide_vel_factor = 2.0f, \ + .guide_res = {0, 0, 0}, \ + .guide_source = FLUID_DOMAIN_GUIDE_SRC_DOMAIN, \ + .cache_frame_start = 1, \ + .cache_frame_end = 250, \ + .cache_frame_pause_data = 0, \ + .cache_frame_pause_noise = 0, \ + .cache_frame_pause_mesh = 0, \ + .cache_frame_pause_particles = 0, \ + .cache_frame_pause_guide = 0, \ + .cache_frame_offset = 0, \ + .cache_flag = 0, \ + .cache_mesh_format = FLUID_DOMAIN_FILE_BIN_OBJECT, \ + .cache_data_format = FLUID_DOMAIN_FILE_OPENVDB, \ + .cache_particle_format = FLUID_DOMAIN_FILE_OPENVDB, \ + .cache_noise_format = FLUID_DOMAIN_FILE_OPENVDB, \ + .cache_directory = "", \ + .error = "", \ + .cache_type = FLUID_DOMAIN_CACHE_REPLAY, \ + .cache_id = "", \ + .dt = 0.0f, \ + .time_total = 0.0f, \ + .time_per_frame = 0.0f, \ + .frame_length = 0.0f, \ + .time_scale = 1.0f, \ + .cfl_condition = 4.0f, \ + .timesteps_minimum = 1, \ + .timesteps_maximum = 4, \ + .slice_per_voxel = 5.0f, \ + .slice_depth = 0.5f, \ + .display_thickness = 1.0f, \ + .grid_scale = 1.0f, \ + .coba = NULL, \ + .vector_scale = 1.0f, \ + .gridlines_lower_bound = 0.0f, \ + .gridlines_upper_bound = 1.0f, \ + .gridlines_range_color = {1.0f, 0.0f, 0.0f, 1.0f}, \ + .axis_slice_method = AXIS_SLICE_FULL, \ + .slice_axis = 0, \ + .show_gridlines = false, \ + .draw_velocity = false, \ + .vector_draw_type = VECTOR_DRAW_NEEDLE, \ + .vector_field = FLUID_DOMAIN_VECTOR_FIELD_VELOCITY, \ + .vector_scale_with_magnitude = true, \ + .vector_draw_mac_components = VECTOR_DRAW_MAC_X | VECTOR_DRAW_MAC_Y | VECTOR_DRAW_MAC_Z, \ + .use_coba = false, \ + .coba_field = FLUID_DOMAIN_FIELD_DENSITY, \ + .interp_method = FLUID_DISPLAY_INTERP_LINEAR, \ + .gridlines_color_field = 0, \ + .gridlines_cell_filter = FLUID_CELL_TYPE_NONE, \ + .openvdb_compression = VDB_COMPRESSION_BLOSC, \ + .openvdb_compression = VDB_COMPRESSION_ZIP, \ + .clipping = 1e-6f, \ + .openvdb_data_depth = 0, \ + .viewsettings = 0, \ + .point_cache = {NULL, NULL}, /* Use #BKE_ptcache_add. */ \ + .ptcaches = {{NULL}}, \ + .cache_comp = SM_CACHE_LIGHT, \ + .cache_high_comp = SM_CACHE_LIGHT, \ + .cache_file_format = 0, \ + } + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Fluid Flow Settings Struct + * \{ */ + +#define _DNA_DEFAULT_FluidFlowSettings \ + { \ + .fmd = NULL, \ + .mesh = NULL, \ + .psys = NULL, \ + .noise_texture = NULL, \ + .verts_old = NULL, \ + .numverts = 0, \ + .vel_multi = 1.0f, \ + .vel_normal = 0.0f, \ + .vel_random = 0.0f, \ + .vel_coord = {0.0f, 0.0f, 0.0f}, \ + .density = 1.0f, \ + .color = {0.7f, 0.7f, 0.7f}, \ + .fuel_amount = 1.0f, \ + .temperature = 1.0f, \ + .volume_density = 0.0f, \ + .surface_distance = 1.5f, \ + .particle_size = 1.0f, \ + .subframes = 0, \ + .texture_size = 1.0f, \ + .texture_offset = 0.0f, \ + .uvlayer_name = "", \ + .vgroup_density = 0, \ + .type = FLUID_FLOW_TYPE_SMOKE, \ + .behavior = FLUID_FLOW_BEHAVIOR_GEOMETRY, \ + .source = FLUID_FLOW_SOURCE_MESH, \ + .texture_type = 0, \ + .flags = FLUID_FLOW_ABSOLUTE | FLUID_FLOW_USE_PART_SIZE | FLUID_FLOW_USE_INFLOW, \ + } + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Fluid Effector Settings Struct + * \{ */ + +#define _DNA_DEFAULT_FluidEffectorSettings \ + { \ + .fmd = NULL, \ + .mesh = NULL, \ + .verts_old = NULL, \ + .numverts = 0, \ + .surface_distance = 0.0f, \ + .flags = FLUID_EFFECTOR_USE_EFFEC, \ + .subframes = 0, \ + .type = FLUID_EFFECTOR_TYPE_COLLISION, \ + .vel_multi = 1.0f, \ + .guide_mode = FLUID_EFFECTOR_GUIDE_OVERRIDE, \ + } + +/** \} */ + +/* clang-format on */ diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index c2781385455..1cb95ea3f83 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -143,6 +143,7 @@ set(SRC ../DNA_camera_defaults.h ../DNA_curve_defaults.h ../DNA_defaults.h + ../DNA_fluid_defaults.h ../DNA_hair_defaults.h ../DNA_image_defaults.h ../DNA_lattice_defaults.h diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c index f0d76705e66..9aeed636399 100644 --- a/source/blender/makesdna/intern/dna_defaults.c +++ b/source/blender/makesdna/intern/dna_defaults.c @@ -91,6 +91,7 @@ #include "DNA_cloth_types.h" #include "DNA_collection_types.h" #include "DNA_curve_types.h" +#include "DNA_fluid_types.h" #include "DNA_hair_types.h" #include "DNA_image_types.h" #include "DNA_key_types.h" @@ -120,6 +121,7 @@ #include "DNA_camera_defaults.h" #include "DNA_collection_defaults.h" #include "DNA_curve_defaults.h" +#include "DNA_fluid_defaults.h" #include "DNA_hair_defaults.h" #include "DNA_image_defaults.h" #include "DNA_lattice_defaults.h" @@ -162,6 +164,11 @@ SDNA_DEFAULT_DECL_STRUCT(Collection); /* DNA_curve_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Curve); +/* DNA_fluid_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(FluidDomainSettings); +SDNA_DEFAULT_DECL_STRUCT(FluidFlowSettings); +SDNA_DEFAULT_DECL_STRUCT(FluidEffectorSettings); + /* DNA_image_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Image); @@ -329,6 +336,11 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = { /* DNA_curve_defaults.h */ SDNA_DEFAULT_DECL(Curve), + /* DNA_fluid_defaults.h */ + SDNA_DEFAULT_DECL(FluidDomainSettings), + SDNA_DEFAULT_DECL(FluidFlowSettings), + SDNA_DEFAULT_DECL(FluidEffectorSettings), + /* DNA_image_defaults.h */ SDNA_DEFAULT_DECL(Image), |