diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 17:50:14 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 18:37:01 +0300 |
commit | d27ccf990c2b957a10f4676e3153f907829a4b22 (patch) | |
tree | 48667db9d5f51e3c951cb1106566a53db21d9adf /source/blender/makesrna/intern | |
parent | 7b87d3d34ec5bbaf777bdc27abdb69600915fce1 (diff) |
Mantaflow [Part 6]: Updates in /blender/source
A collection of smaller changes that are required in the /blender/source files. A lot of them are also due to variable renaming.
Reviewed By: sergey
Maniphest Tasks: T59995
Differential Revision: https://developer.blender.org/D3855
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fluidsim.c | 792 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_gpencil_modifier.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 83 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_smoke.c | 1218 |
9 files changed, 47 insertions, 2082 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index f3ade54d5ec..5e1d94a9a1a 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -44,7 +44,6 @@ set(DEFSRC rna_depsgraph.c rna_dynamicpaint.c rna_fcurve.c - rna_fluidsim.c rna_gpencil.c rna_gpencil_modifier.c rna_image.c @@ -55,6 +54,7 @@ set(DEFSRC rna_lightprobe.c rna_linestyle.c rna_main.c + rna_fluid.c rna_mask.c rna_material.c rna_mesh.c @@ -77,7 +77,6 @@ set(DEFSRC rna_sculpt_paint.c rna_sequencer.c rna_shader_fx.c - rna_smoke.c rna_sound.c rna_space.c rna_speaker.c @@ -241,16 +240,12 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() -if(WITH_MOD_FLUID) - add_definitions(-DWITH_MOD_FLUID) -endif() - if(WITH_FFTW3) add_definitions(-DWITH_FFTW3) endif() -if(WITH_MOD_SMOKE) - add_definitions(-DWITH_SMOKE) +if(WITH_MOD_FLUID) + add_definitions(-DWITH_FLUID) endif() if(WITH_MOD_OCEANSIM) @@ -348,7 +343,7 @@ blender_include_dirs( ../../../../intern/glew-mx ../../../../intern/guardedalloc ../../../../intern/memutil - ../../../../intern/smoke/extern + ../../../../intern/mantaflow/extern ) blender_include_dirs_sys( diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 009a723551e..9b38ca8009c 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -4231,7 +4231,6 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_curve.c", "rna_curve_api.c", RNA_def_curve}, {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, - {"rna_fluidsim.c", NULL, RNA_def_fluidsim}, {"rna_gpencil.c", NULL, RNA_def_gpencil}, {"rna_image.c", "rna_image_api.c", RNA_def_image}, {"rna_key.c", NULL, RNA_def_key}, @@ -4240,6 +4239,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_layer.c", NULL, RNA_def_view_layer}, {"rna_linestyle.c", NULL, RNA_def_linestyle}, {"rna_main.c", "rna_main_api.c", RNA_def_main}, + {"rna_fluid.c", NULL, RNA_def_fluid}, {"rna_material.c", "rna_material_api.c", RNA_def_material}, {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh}, {"rna_meta.c", "rna_meta_api.c", RNA_def_meta}, @@ -4263,7 +4263,6 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_screen.c", NULL, RNA_def_screen}, {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, {"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer}, - {"rna_smoke.c", NULL, RNA_def_smoke}, {"rna_space.c", "rna_space_api.c", RNA_def_space}, {"rna_speaker.c", NULL, RNA_def_speaker}, {"rna_test.c", NULL, RNA_def_test}, diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c deleted file mode 100644 index 2f09b90a81e..00000000000 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ /dev/null @@ -1,792 +0,0 @@ -/* - * 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 RNA - */ - -#include <stdlib.h> - -#include "DNA_object_fluidsim_types.h" - -#include "BLI_threads.h" -#include "BLI_utildefines.h" -#include "BLI_path_util.h" - -#include "RNA_define.h" - -#include "rna_internal.h" - -#include "WM_api.h" -#include "WM_types.h" - -#ifdef RNA_RUNTIME - -# include "MEM_guardedalloc.h" - -# include "DNA_scene_types.h" -# include "DNA_particle_types.h" - -# include "BKE_fluidsim.h" -# include "BKE_global.h" -# include "BKE_main.h" -# include "BKE_modifier.h" -# include "BKE_particle.h" -# include "BKE_pointcache.h" - -# include "DEG_depsgraph.h" - -static StructRNA *rna_FluidSettings_refine(struct PointerRNA *ptr) -{ - FluidsimSettings *fss = (FluidsimSettings *)ptr->data; - - switch (fss->type) { - case OB_FLUIDSIM_DOMAIN: - return &RNA_DomainFluidSettings; - case OB_FLUIDSIM_FLUID: - return &RNA_FluidFluidSettings; - case OB_FLUIDSIM_OBSTACLE: - return &RNA_ObstacleFluidSettings; - case OB_FLUIDSIM_INFLOW: - return &RNA_InflowFluidSettings; - case OB_FLUIDSIM_OUTFLOW: - return &RNA_OutflowFluidSettings; - case OB_FLUIDSIM_PARTICLE: - return &RNA_ParticleFluidSettings; - case OB_FLUIDSIM_CONTROL: - return &RNA_ControlFluidSettings; - default: - return &RNA_FluidSettings; - } -} - -static void rna_fluid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->owner_id; - - DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); - WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); -} - -static int fluidsim_find_lastframe(Main *bmain, Object *ob, FluidsimSettings *fss) -{ - char targetFileTest[FILE_MAX]; - char targetFile[FILE_MAX]; - int curFrame = 1; - - BLI_join_dirfile( - targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME); - BLI_path_abs(targetFile, modifier_path_relbase(bmain, ob)); - - do { - BLI_strncpy(targetFileTest, targetFile, sizeof(targetFileTest)); - BLI_path_frame(targetFileTest, curFrame++, 0); - } while (BLI_exists(targetFileTest)); - - return curFrame - 1; -} - -static void rna_fluid_find_enframe(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->owner_id; - FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType( - ob, eModifierType_Fluidsim); - - if (fluidmd->fss->flag & OB_FLUIDSIM_REVERSE) { - fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(bmain, ob, fluidmd->fss); - } - else { - fluidmd->fss->lastgoodframe = -1; - } - rna_fluid_update(bmain, scene, ptr); -} - -static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->owner_id; - FluidsimModifierData *fluidmd; - ParticleSystemModifierData *psmd; - ParticleSystem *psys, *next_psys; - ParticleSettings *part; - - fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); - fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; /* clear flag */ - - /* remove fluidsim particle system */ - if (fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) { - for (psys = ob->particlesystem.first; psys; psys = psys->next) { - if (psys->part->type == PART_FLUID) { - break; - } - } - - if (ob->type == OB_MESH && !psys) { - /* add particle system */ - part = BKE_particlesettings_add(bmain, "ParticleSettings"); - psys = MEM_callocN(sizeof(ParticleSystem), "particle_system"); - - part->type = PART_FLUID; - psys->part = part; - psys->pointcache = BKE_ptcache_add(&psys->ptcaches); - BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name)); - BLI_addtail(&ob->particlesystem, psys); - - /* add modifier */ - psmd = (ParticleSystemModifierData *)modifier_new(eModifierType_ParticleSystem); - BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name)); - psmd->psys = psys; - BLI_addtail(&ob->modifiers, psmd); - modifier_unique_name(&ob->modifiers, (ModifierData *)psmd); - } - } - else { - for (psys = ob->particlesystem.first; psys; psys = next_psys) { - next_psys = psys->next; - if (psys->part->type == PART_FLUID) { - /* clear modifier */ - psmd = psys_get_modifier(ob, psys); - BLI_remlink(&ob->modifiers, psmd); - modifier_free((ModifierData *)psmd); - - /* clear particle system */ - BLI_remlink(&ob->particlesystem, psys); - psys_free(ob, psys); - } - } - } - - rna_fluid_update(bmain, scene, ptr); -} - -static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value) -{ -# ifndef WITH_MOD_FLUID - (void)ptr; - value[0] = '\0'; -# else - Object *ob = (Object *)ptr->owner_id; - FluidsimSettings *fss = (FluidsimSettings *)ptr->data; - - fluid_estimate_memory(ob, fss, value); -# endif -} - -static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr) -{ -# ifndef WITH_MOD_FLUID - UNUSED_VARS(ptr); - return 0; -# else - char value[32]; - - rna_DomainFluidSettings_memory_estimate_get(ptr, value); - return strlen(value); -# endif -} - -static char *rna_FluidSettings_path(PointerRNA *ptr) -{ - FluidsimSettings *fss = (FluidsimSettings *)ptr->data; - ModifierData *md = (ModifierData *)fss->fmd; - char name_esc[sizeof(md->name) * 2]; - - BLI_strescape(name_esc, md->name, sizeof(name_esc)); - return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc); -} - -#else - -static void rna_def_fluidsim_slip(StructRNA *srna) -{ - PropertyRNA *prop; - - static const EnumPropertyItem slip_items[] = { - {OB_FSBND_NOSLIP, - "NOSLIP", - 0, - "No Slip", - "Obstacle causes zero normal and tangential velocity (=sticky), default for all " - "(only option for moving objects)"}, - {OB_FSBND_PARTSLIP, - "PARTIALSLIP", - 0, - "Partial Slip", - "Mix between no-slip and free-slip (non moving objects only!)"}, - {OB_FSBND_FREESLIP, - "FREESLIP", - 0, - "Free Slip", - "Obstacle only causes zero normal velocity (=not sticky, non moving objects only!)"}, - {0, NULL, 0, NULL, NULL}, - }; - - prop = RNA_def_property(srna, "slip_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "typeFlags"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_enum_items(prop, slip_items); - RNA_def_property_ui_text(prop, "Slip Type", ""); - - prop = RNA_def_property(srna, "partial_slip_factor", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_sdna(prop, NULL, "partSlipValue"); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text( - prop, - "Partial Slip Amount", - "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip"); -} - -static void rna_def_fluid_mesh_vertices(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "FluidVertexVelocity", NULL); - RNA_def_struct_ui_text(srna, "Fluid Mesh Velocity", "Velocity of a simulated fluid mesh"); - RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL); - - prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY); - RNA_def_property_array(prop, 3); - RNA_def_property_float_sdna(prop, NULL, "vel"); - RNA_def_property_ui_text(prop, "Velocity", ""); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); -} - -static void rna_def_fluidsim_domain(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem quality_items[] = { - {OB_FSDOM_GEOM, "GEOMETRY", 0, "Geometry", "Display geometry"}, - {OB_FSDOM_PREVIEW, "PREVIEW", 0, "Preview", "Display preview quality results"}, - {OB_FSDOM_FINAL, "FINAL", 0, "Final", "Display final quality results"}, - {0, NULL, 0, NULL, NULL}, - }; - - srna = RNA_def_struct(brna, "DomainFluidSettings", "FluidSettings"); - RNA_def_struct_sdna(srna, "FluidsimSettings"); - RNA_def_struct_ui_text(srna, - "Domain Fluid Simulation Settings", - "Fluid simulation settings for the domain of a fluid simulation"); - - /* standard settings */ - - prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "threads"); - RNA_def_property_range(prop, 0, BLENDER_MAX_THREADS); - RNA_def_property_ui_text( - prop, "Simulation Threads", "Override number of threads for the simulation, 0 is automatic"); - - prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "resolutionxyz"); - RNA_def_property_range(prop, 1, 1024); - RNA_def_property_ui_text(prop, "Resolution", "Domain resolution in X,Y and Z direction"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - - prop = RNA_def_property(srna, "preview_resolution", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "previewresxyz"); - RNA_def_property_range(prop, 1, 100); - RNA_def_property_ui_text( - prop, "Preview Resolution", "Preview resolution in X,Y and Z direction"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - - prop = RNA_def_property(srna, "viewport_display_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "guiDisplayMode"); - RNA_def_property_enum_items(prop, quality_items); - RNA_def_property_ui_text( - prop, "Viewport Display Mode", "How to display the mesh in the viewport"); - RNA_def_property_update(prop, 0, "rna_fluid_update"); - - prop = RNA_def_property(srna, "render_display_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "renderDisplayMode"); - RNA_def_property_enum_items(prop, quality_items); - RNA_def_property_ui_text(prop, "Render Display Mode", "How to display the mesh for rendering"); - - prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE); - RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse fluid frames"); - RNA_def_property_update(prop, 0, "rna_fluid_find_enframe"); - - prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_maxlength(prop, FILE_MAX); - RNA_def_property_string_sdna(prop, NULL, "surfdataPath"); - RNA_def_property_ui_text( - prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in"); - RNA_def_property_update(prop, 0, "rna_fluid_update"); - - prop = RNA_def_property(srna, "memory_estimate", PROP_STRING, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_string_funcs(prop, - "rna_DomainFluidSettings_memory_estimate_get", - "rna_DomainFluidSettings_memory_estimate_length", - NULL); - RNA_def_property_ui_text( - prop, "Memory Estimate", "Estimated amount of memory needed for baking the domain"); - - /* advanced settings */ - prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION); - RNA_def_property_float_sdna(prop, NULL, "grav"); - RNA_def_property_array(prop, 3); - RNA_def_property_range(prop, -1000.1, 1000.1); - RNA_def_property_ui_text(prop, "Gravity", "Gravity in X, Y and Z direction"); - - prop = RNA_def_property(srna, "use_time_override", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_OVERRIDE_TIME); - RNA_def_property_ui_text( - prop, - "Override Time", - "Use a custom start and end time (in seconds) instead of the scene's timeline"); - - prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME); - RNA_def_property_float_sdna(prop, NULL, "animStart"); - RNA_def_property_range(prop, 0, FLT_MAX); - RNA_def_property_ui_text( - prop, "Start Time", "Simulation time of the first blender frame (in seconds)"); - - prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME); - RNA_def_property_float_sdna(prop, NULL, "animEnd"); - RNA_def_property_range(prop, 0, FLT_MAX); - RNA_def_property_ui_text( - prop, "End Time", "Simulation time of the last blender frame (in seconds)"); - - prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "frameOffset"); - RNA_def_property_ui_text(prop, "Cache Offset", "Offset when reading baked cache"); - RNA_def_property_update(prop, NC_OBJECT, "rna_fluid_update"); - - prop = RNA_def_property(srna, "simulation_scale", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "realsize"); - RNA_def_property_range(prop, 0.001, 10); - RNA_def_property_ui_text(prop, "Real World Size", "Size of the simulation domain in meters"); - - prop = RNA_def_property(srna, "simulation_rate", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "animRate"); - RNA_def_property_range(prop, 0.0, 100.0); - RNA_def_property_ui_text( - prop, "Simulation Speed", "Fluid motion rate (0 = stationary, 1 = normal speed)"); - - prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "viscosityValue"); - RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text( - prop, - "Viscosity Base", - "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)"); - - prop = RNA_def_property(srna, "viscosity_exponent", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "viscosityExponent"); - RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text( - prop, - "Viscosity Exponent", - "Negative exponent for the viscosity value (to simplify entering small values " - "e.g. 5*10^-6)"); - - prop = RNA_def_property(srna, "grid_levels", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxRefine"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, -1, 4); - RNA_def_property_ui_text( - prop, "Grid Levels", "Number of coarsened grids to use (-1 for automatic)"); - - prop = RNA_def_property(srna, "compressibility", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "gstar"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 0.001, 0.1); - RNA_def_property_ui_text(prop, - "Compressibility", - "Allowed compressibility due to gravitational force for standing fluid " - "(directly affects simulation step size)"); - - /* domain boundary settings */ - - rna_def_fluidsim_slip(srna); - - prop = RNA_def_property(srna, "surface_smooth", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 0.0, 5.0); - RNA_def_property_ui_text( - prop, - "Surface Smoothing", - "Amount of surface smoothing (a value of 0 is off, 1 is normal smoothing and " - "more than 1 is extra smoothing)"); - - prop = RNA_def_property(srna, "surface_subdivisions", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "surfaceSubdivs"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 0, 5); - RNA_def_property_ui_text( - prop, - "Surface Subdivisions", - "Number of isosurface subdivisions (this is necessary for the inclusion of particles " - "into the surface generation - WARNING: can lead to longer computation times !)"); - - prop = RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "domainNovecgen", 0); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text( - prop, "Generate Speed Vectors", "Generate speed vectors for vector blur"); - - /* no collision object surface */ - prop = RNA_def_property(srna, "use_surface_noobs", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSSG_NOOBS); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text( - prop, - "Remove Air Bubbles", - "Removes the air gap between fluid surface and obstacles - WARNING: Can result " - "in a dissolving surface in other areas"); - - /* particles */ - - prop = RNA_def_property(srna, "tracer_particles", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "generateTracers"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 0, 10000); - RNA_def_property_ui_text(prop, "Tracer Particles", "Number of tracer particles to generate"); - - prop = RNA_def_property(srna, "generate_particles", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "generateParticles"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_text( - prop, "Generate Particles", "Amount of particles to generate (0=off, 1=normal, >1=more)"); - - /* simulated fluid mesh data */ - prop = RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "meshVelocities", "totvert"); - RNA_def_property_struct_type(prop, "FluidVertexVelocity"); - RNA_def_property_ui_text( - prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation"); - - rna_def_fluid_mesh_vertices(brna); -} - -static void rna_def_fluidsim_volume(StructRNA *srna) -{ - PropertyRNA *prop; - - static const EnumPropertyItem volume_type_items[] = { - {1, "VOLUME", 0, "Volume", "Use only the inner volume of the mesh"}, - {2, "SHELL", 0, "Shell", "Use only the outer shell of the mesh"}, - {3, "BOTH", 0, "Both", "Use both the inner volume and the outer shell of the mesh"}, - {0, NULL, 0, NULL, NULL}, - }; - - prop = RNA_def_property(srna, "volume_initialization", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "volumeInitType"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_enum_items(prop, volume_type_items); - RNA_def_property_ui_text( - prop, - "Volume Initialization", - "Volume initialization type " - "(WARNING: complex volumes might require too much memory and break simulation)"); - - prop = RNA_def_property(srna, "use_animated_mesh", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "domainNovecgen", 0); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text( - prop, - "Export Animated Mesh", - "Export this mesh as an animated one (slower and enforces No Slip, only use if really " - "necessary [e.g. armatures or parented objects], animated pos/rot/scale F-Curves " - "do not require it)"); -} - -static void rna_def_fluidsim_active(StructRNA *srna) -{ - PropertyRNA *prop; - - prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_ACTIVE); - RNA_def_property_ui_text(prop, "Enabled", "Object contributes to the fluid simulation"); -} - -static void rna_def_fluidsim_fluid(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "FluidFluidSettings", "FluidSettings"); - RNA_def_struct_sdna(srna, "FluidsimSettings"); - RNA_def_struct_ui_text(srna, - "Fluid Fluid Simulation Settings", - "Fluid simulation settings for the fluid in the simulation"); - - rna_def_fluidsim_active(srna); - rna_def_fluidsim_volume(srna); - - prop = RNA_def_property(srna, "initial_velocity", PROP_FLOAT, PROP_VELOCITY); - RNA_def_property_float_sdna(prop, NULL, "iniVelx"); - RNA_def_property_array(prop, 3); - RNA_def_property_range(prop, -1000.1, 1000.1); - RNA_def_property_ui_text(prop, "Initial Velocity", "Initial velocity of fluid"); -} - -static void rna_def_fluidsim_obstacle(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "ObstacleFluidSettings", "FluidSettings"); - RNA_def_struct_sdna(srna, "FluidsimSettings"); - RNA_def_struct_ui_text(srna, - "Obstacle Fluid Simulation Settings", - "Fluid simulation settings for obstacles in the simulation"); - - rna_def_fluidsim_active(srna); - rna_def_fluidsim_volume(srna); - rna_def_fluidsim_slip(srna); - - prop = RNA_def_property(srna, "impact_factor", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, -2.0, 10.0); - RNA_def_property_ui_text( - prop, - "Impact Factor", - "This is an unphysical value for moving objects - it controls the impact an obstacle " - "has on the fluid, =0 behaves a bit like outflow (deleting fluid), =1 is default, " - "while >1 results in high forces (can be used to tweak total mass)"); -} - -static void rna_def_fluidsim_inflow(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "InflowFluidSettings", "FluidSettings"); - RNA_def_struct_sdna(srna, "FluidsimSettings"); - RNA_def_struct_ui_text(srna, - "Inflow Fluid Simulation Settings", - "Fluid simulation settings for objects adding fluids in the simulation"); - - rna_def_fluidsim_active(srna); - rna_def_fluidsim_volume(srna); - - prop = RNA_def_property(srna, "inflow_velocity", PROP_FLOAT, PROP_VELOCITY); - RNA_def_property_float_sdna(prop, NULL, "iniVelx"); - RNA_def_property_array(prop, 3); - RNA_def_property_range(prop, -1000.1, 1000.1); - RNA_def_property_ui_text(prop, "Inflow Velocity", "Initial velocity of fluid"); - - prop = RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSINFLOW_LOCALCOORD); - RNA_def_property_ui_text( - prop, "Local Coordinates", "Use local coordinates for inflow (e.g. for rotating objects)"); -} - -static void rna_def_fluidsim_outflow(BlenderRNA *brna) -{ - StructRNA *srna; - - srna = RNA_def_struct(brna, "OutflowFluidSettings", "FluidSettings"); - RNA_def_struct_sdna(srna, "FluidsimSettings"); - RNA_def_struct_ui_text( - srna, - "Outflow Fluid Simulation Settings", - "Fluid simulation settings for objects removing fluids from the simulation"); - - rna_def_fluidsim_active(srna); - rna_def_fluidsim_volume(srna); -} - -static void rna_def_fluidsim_particle(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "ParticleFluidSettings", "FluidSettings"); - RNA_def_struct_sdna(srna, "FluidsimSettings"); - RNA_def_struct_ui_text(srna, - "Particle Fluid Simulation Settings", - "Fluid simulation settings for objects storing fluid particles generated" - " by the simulation"); - - prop = RNA_def_property(srna, "use_drops", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_DROP); - RNA_def_property_ui_text(prop, "Drops", "Show drop particles"); - - prop = RNA_def_property(srna, "use_floats", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_FLOAT); - RNA_def_property_ui_text(prop, "Floats", "Show floating foam particles"); - - prop = RNA_def_property(srna, "show_tracer", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_TRACER); - RNA_def_property_ui_text(prop, "Tracer", "Show tracer particles"); - - prop = RNA_def_property(srna, "particle_influence", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "particleInfSize"); - RNA_def_property_range(prop, 0.0, 2.0); - RNA_def_property_ui_text( - prop, - "Particle Influence", - "Amount of particle size scaling: 0=off (all same size), 1=full (range 0.2-2.0), " - ">1=stronger"); - - prop = RNA_def_property(srna, "alpha_influence", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "particleInfAlpha"); - RNA_def_property_range(prop, 0.0, 2.0); - RNA_def_property_ui_text( - prop, - "Alpha Influence", - "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), " - "1=full (larger particles get lower alphas, smaller ones higher values)"); - - prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_maxlength(prop, FILE_MAX); - RNA_def_property_string_sdna(prop, NULL, "surfdataPath"); - RNA_def_property_ui_text( - prop, "Path", "Directory (and/or filename prefix) to store and load particles from"); - RNA_def_property_update(prop, 0, "rna_fluid_update"); -} - -static void rna_def_fluidsim_control(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "ControlFluidSettings", "FluidSettings"); - RNA_def_struct_sdna(srna, "FluidsimSettings"); - RNA_def_struct_ui_text( - srna, - "Control Fluid Simulation Settings", - "Fluid simulation settings for objects controlling the motion of fluid in the simulation"); - - rna_def_fluidsim_active(srna); - - prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME); - RNA_def_property_float_sdna(prop, NULL, "cpsTimeStart"); - RNA_def_property_range(prop, 0.0, FLT_MAX); - RNA_def_property_ui_text(prop, "Start Time", "Time when the control particles are activated"); - - prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME); - RNA_def_property_float_sdna(prop, NULL, "cpsTimeEnd"); - RNA_def_property_range(prop, 0.0, FLT_MAX); - RNA_def_property_ui_text(prop, "End Time", "Time when the control particles are deactivated"); - - prop = RNA_def_property(srna, "attraction_strength", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "attractforceStrength"); - RNA_def_property_range(prop, -10.0, 10.0); - RNA_def_property_ui_text(prop, - "Attraction Strength", - "Force strength for directional attraction towards the control object"); - - prop = RNA_def_property(srna, "attraction_radius", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "attractforceRadius"); - RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_text( - prop, "Attraction Radius", "Force field radius around the control object"); - - prop = RNA_def_property(srna, "velocity_strength", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "velocityforceStrength"); - RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_text( - prop, - "Velocity Strength", - "Force strength of how much of the control object's velocity is influencing the " - "fluid velocity"); - - prop = RNA_def_property(srna, "velocity_radius", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "velocityforceRadius"); - RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_text( - prop, "Velocity Radius", "Force field radius around the control object"); - - prop = RNA_def_property(srna, "quality", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "cpsQuality"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 5.0, 100.0); - RNA_def_property_ui_text( - prop, "Quality", "Quality which is used for object sampling (higher = better but slower)"); - - prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse control object movement"); - RNA_def_property_update(prop, 0, "rna_fluid_find_enframe"); -} - -void RNA_def_fluidsim(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_fluid_type_items[] = { - {OB_FLUIDSIM_ENABLE, "NONE", 0, "None", ""}, - {OB_FLUIDSIM_DOMAIN, - "DOMAIN", - 0, - "Domain", - "Bounding box of this object represents the computational domain of the " - "fluid simulation"}, - {OB_FLUIDSIM_FLUID, - "FLUID", - 0, - "Fluid", - "Object represents a volume of fluid in the simulation"}, - {OB_FLUIDSIM_OBSTACLE, "OBSTACLE", 0, "Obstacle", "Object is a fixed obstacle"}, - {OB_FLUIDSIM_INFLOW, "INFLOW", 0, "Inflow", "Object adds fluid to the simulation"}, - {OB_FLUIDSIM_OUTFLOW, "OUTFLOW", 0, "Outflow", "Object removes fluid from the simulation"}, - {OB_FLUIDSIM_PARTICLE, - "PARTICLE", - 0, - "Particle", - "Object is made a particle system to display particles generated by a " - "fluidsim domain object"}, - {OB_FLUIDSIM_CONTROL, - "CONTROL", - 0, - "Control", - "Object is made a fluid control mesh, which influences the fluid"}, - {0, NULL, 0, NULL, NULL}, - }; - - srna = RNA_def_struct(brna, "FluidSettings", NULL); - RNA_def_struct_sdna(srna, "FluidsimSettings"); - RNA_def_struct_refine_func(srna, "rna_FluidSettings_refine"); - RNA_def_struct_path_func(srna, "rna_FluidSettings_path"); - RNA_def_struct_ui_text(srna, - "Fluid Simulation Settings", - "Fluid simulation settings for an object taking part in the simulation"); - - prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_fluid_type_items); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Type", "Type of participation in the fluid simulation"); - RNA_def_property_update(prop, 0, "rna_FluidSettings_update_type"); - -# if 0 - prop = RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); - RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by fluid simulation settings"); -# endif - - /* types */ - - rna_def_fluidsim_domain(brna); - rna_def_fluidsim_fluid(brna); - rna_def_fluidsim_obstacle(brna); - rna_def_fluidsim_inflow(brna); - rna_def_fluidsim_outflow(brna); - rna_def_fluidsim_particle(brna); - rna_def_fluidsim_control(brna); -} - -#endif diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 7aa3ee60c5a..59baf7e4cbf 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -43,7 +43,7 @@ #include "BKE_mesh_mapping.h" #include "BKE_mesh_remap.h" #include "BKE_multires.h" -#include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */ +#include "BKE_fluid.h" /* For fluidModifier_free & fluidModifier_createType */ #include "RNA_access.h" #include "RNA_define.h" @@ -174,7 +174,7 @@ static const EnumPropertyItem rna_enum_time_mode_items[] = { # include "DNA_particle_types.h" # include "DNA_curve_types.h" -# include "DNA_smoke_types.h" +# include "DNA_fluid_types.h" # include "BKE_cachefile.h" # include "BKE_context.h" diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 94394a4826b..46455a43b2e 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -155,7 +155,6 @@ void RNA_def_controller(struct BlenderRNA *brna); void RNA_def_curve(struct BlenderRNA *brna); void RNA_def_depsgraph(struct BlenderRNA *brna); void RNA_def_dynamic_paint(struct BlenderRNA *brna); -void RNA_def_fluidsim(struct BlenderRNA *brna); void RNA_def_fcurve(struct BlenderRNA *brna); void RNA_def_gpencil(struct BlenderRNA *brna); void RNA_def_greasepencil_modifier(struct BlenderRNA *brna); @@ -188,7 +187,7 @@ void RNA_def_view_layer(struct BlenderRNA *brna); void RNA_def_screen(struct BlenderRNA *brna); void RNA_def_sculpt_paint(struct BlenderRNA *brna); void RNA_def_sequencer(struct BlenderRNA *brna); -void RNA_def_smoke(struct BlenderRNA *brna); +void RNA_def_fluid(struct BlenderRNA *brna); void RNA_def_space(struct BlenderRNA *brna); void RNA_def_speaker(struct BlenderRNA *brna); void RNA_def_test(struct BlenderRNA *brna); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 3759b721152..6e5e38ab52e 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -45,7 +45,7 @@ #include "BKE_mesh_remap.h" #include "BKE_multires.h" #include "BKE_ocean.h" -#include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */ +#include "BKE_fluid.h" /* For fluidModifier_free & fluidModifier_createType */ #include "RNA_access.h" #include "RNA_define.h" @@ -275,7 +275,6 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = { ICON_MOD_EXPLODE, "Explode", "Break apart the mesh faces and let them follow particles"}, - {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""}, {eModifierType_Ocean, "OCEAN", ICON_MOD_OCEAN, "Ocean", "Generate a moving ocean surface"}, {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", @@ -287,7 +286,7 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = { ICON_MOD_PARTICLES, "Particle System", "Spawn particles from the shape"}, - {eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""}, + {eModifierType_Fluid, "FLUID", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""}, {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""}, {eModifierType_Surface, "SURFACE", ICON_MODIFIER, "Surface", ""}, {0, NULL, 0, NULL, NULL}, @@ -580,7 +579,7 @@ const EnumPropertyItem rna_enum_axis_flag_xyz_items[] = { #ifdef RNA_RUNTIME # include "DNA_particle_types.h" # include "DNA_curve_types.h" -# include "DNA_smoke_types.h" +# include "DNA_fluid_types.h" # include "BKE_cachefile.h" # include "BKE_context.h" @@ -661,8 +660,6 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_BevelModifier; case eModifierType_Shrinkwrap: return &RNA_ShrinkwrapModifier; - case eModifierType_Fluidsim: - return &RNA_FluidSimulationModifier; case eModifierType_Mask: return &RNA_MaskModifier; case eModifierType_SimpleDeform: @@ -671,8 +668,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_MultiresModifier; case eModifierType_Surface: return &RNA_SurfaceModifier; - case eModifierType_Smoke: - return &RNA_SmokeModifier; + case eModifierType_Fluid: + return &RNA_FluidModifier; case eModifierType_Solidify: return &RNA_SolidifyModifier; case eModifierType_Screw: @@ -720,6 +717,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr) case eModifierType_WeightedNormal: return &RNA_WeightedNormalModifier; /* Default */ + case eModifierType_Fluidsim: /* deprecated */ + case eModifierType_Smoke: case eModifierType_None: case eModifierType_ShapeKey: case NUM_MODIFIER_TYPES: @@ -1029,25 +1028,25 @@ static void rna_UVProjector_object_set(PointerRNA *ptr, /* Other rna callbacks */ -static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_fluid_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) { - SmokeModifierData *smd = (SmokeModifierData *)ptr->data; + FluidModifierData *mmd = (FluidModifierData *)ptr->data; Object *ob = (Object *)ptr->owner_id; /* nothing changed */ - if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) { + if ((mmd->type & MOD_FLUID_TYPE_DOMAIN) && mmd->domain) { return; } - smokeModifier_free(smd); /* XXX TODO: completely free all 3 pointers */ - smokeModifier_createType(smd); /* create regarding of selected type */ + fluidModifier_free(mmd); /* XXX TODO: completely free all 3 pointers */ + fluidModifier_createType(mmd); /* create regarding of selected type */ - switch (smd->type) { - case MOD_SMOKE_TYPE_DOMAIN: + switch (mmd->type) { + case MOD_FLUID_TYPE_DOMAIN: ob->dt = OB_WIRE; break; - case MOD_SMOKE_TYPE_FLOW: - case MOD_SMOKE_TYPE_COLL: + case MOD_FLUID_TYPE_FLOW: + case MOD_FLUID_TYPE_EFFEC: case 0: default: break; @@ -3607,23 +3606,23 @@ static void rna_def_modifier_cloth(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Hair Grid Resolution", ""); } -static void rna_def_modifier_smoke(BlenderRNA *brna) +static void rna_def_modifier_fluid(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem prop_smoke_type_items[] = { + static const EnumPropertyItem prop_fluid_type_items[] = { {0, "NONE", 0, "None", ""}, - {MOD_SMOKE_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""}, - {MOD_SMOKE_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"}, - {MOD_SMOKE_TYPE_COLL, "COLLISION", 0, "Collision", ""}, + {MOD_FLUID_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""}, + {MOD_FLUID_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"}, + {MOD_FLUID_TYPE_EFFEC, "EFFECTOR", 0, "Effector", ""}, {0, NULL, 0, NULL, NULL}, }; - srna = RNA_def_struct(brna, "SmokeModifier", "Modifier"); - RNA_def_struct_ui_text(srna, "Smoke Modifier", "Smoke simulation modifier"); - RNA_def_struct_sdna(srna, "SmokeModifierData"); - RNA_def_struct_ui_icon(srna, ICON_MOD_SMOKE); + srna = RNA_def_struct(brna, "FluidModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Fluid Modifier", "Fluid simulation modifier"); + RNA_def_struct_sdna(srna, "FluidModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM); prop = RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "domain"); @@ -3633,16 +3632,16 @@ static void rna_def_modifier_smoke(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "flow"); RNA_def_property_ui_text(prop, "Flow Settings", ""); - prop = RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "coll"); - RNA_def_property_ui_text(prop, "Collision Settings", ""); + prop = RNA_def_property(srna, "effec_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "effector"); + RNA_def_property_ui_text(prop, "Effector Settings", ""); - prop = RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "fluid_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_smoke_type_items); + RNA_def_property_enum_items(prop, prop_fluid_type_items); RNA_def_property_ui_text(prop, "Type", ""); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, 0, "rna_Smoke_set_type"); + RNA_def_property_update(prop, 0, "rna_fluid_set_type"); } static void rna_def_modifier_dynamic_paint(BlenderRNA *brna) @@ -4069,23 +4068,6 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); } -static void rna_def_modifier_fluidsim(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "FluidSimulationModifier", "Modifier"); - RNA_def_struct_ui_text(srna, "Fluid Simulation Modifier", "Fluid simulation modifier"); - RNA_def_struct_sdna(srna, "FluidsimModifierData"); - RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM); - - prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "fss"); - RNA_def_property_ui_text( - prop, "Settings", "Settings for how this object is used in the fluid simulation"); -} - static void rna_def_modifier_mask(BlenderRNA *brna) { StructRNA *srna; @@ -6388,13 +6370,12 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_collision(brna); rna_def_modifier_bevel(brna); rna_def_modifier_shrinkwrap(brna); - rna_def_modifier_fluidsim(brna); rna_def_modifier_mask(brna); rna_def_modifier_simpledeform(brna); rna_def_modifier_warp(brna); rna_def_modifier_multires(brna); rna_def_modifier_surface(brna); - rna_def_modifier_smoke(brna); + rna_def_modifier_fluid(brna); rna_def_modifier_solidify(brna); rna_def_modifier_screw(brna); rna_def_modifier_uvwarp(brna); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 16d70e21ec2..559b8ca4cc1 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -25,7 +25,7 @@ #include "DNA_object_force_types.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" -#include "DNA_smoke_types.h" +#include "DNA_fluid_types.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -738,10 +738,10 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr) } /* check smoke modifier */ - md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke); + md = (ModifierData *)modifiers_findByType(ob, eModifierType_Fluid); if (md) { - SmokeModifierData *smd = (SmokeModifierData *)md; - if (smd->domain->effector_weights == ew) { + FluidModifierData *mmd = (FluidModifierData *)md; + if (mmd->domain->effector_weights == ew) { char name_esc[sizeof(md->name) * 2]; BLI_strescape(name_esc, md->name, sizeof(name_esc)); return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 211d9e19ab4..51df843947d 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -950,11 +950,12 @@ static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr) return settings->draw_line[1]; } -static bool rna_PartSettings_is_fluid_get(PointerRNA *ptr) +static int rna_PartSettings_is_fluid_get(PointerRNA *ptr) { ParticleSettings *part = (ParticleSettings *)ptr->data; - return part->type == PART_FLUID; + return (part->type & (PART_FLUID_FLIP | PART_FLUID_SPRAY | PART_FLUID_BUBBLE | PART_FLUID_FOAM | + PART_FLUID_TRACER)); } static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c deleted file mode 100644 index c00cc789eff..00000000000 --- a/source/blender/makesrna/intern/rna_smoke.c +++ /dev/null @@ -1,1218 +0,0 @@ -/* - * 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 RNA - */ - -#include <stdlib.h> -#include <limits.h> - -#include "BLI_sys_types.h" - -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - -#include "BKE_modifier.h" -#include "BKE_smoke.h" -#include "BKE_pointcache.h" - -#include "DNA_modifier_types.h" -#include "DNA_object_force_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "DNA_smoke_types.h" - -#include "WM_types.h" - -#ifdef RNA_RUNTIME - -# include "BLI_threads.h" - -# include "BKE_colorband.h" -# include "BKE_context.h" -# include "BKE_particle.h" - -# include "DEG_depsgraph.h" -# include "DEG_depsgraph_build.h" - -# include "smoke_API.h" - -static void rna_Smoke_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY); -} - -static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - rna_Smoke_update(bmain, scene, ptr); - DEG_relations_tag_update(bmain); -} - -static void rna_Smoke_resetCache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data; - if (settings->smd && settings->smd->domain) { - settings->point_cache[0]->flag |= PTCACHE_OUTDATED; - } - DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY); -} - -static void rna_Smoke_cachetype_set(struct PointerRNA *ptr, int value) -{ - SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data; - Object *ob = (Object *)ptr->owner_id; - - if (value != settings->cache_file_format) { - /* Clear old caches. */ - PTCacheID id; - BKE_ptcache_id_from_smoke(&id, ob, settings->smd); - BKE_ptcache_id_clear(&id, PTCACHE_CLEAR_ALL, 0); - - settings->cache_file_format = value; - } -} - -static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data; - - smokeModifier_reset(settings->smd); - rna_Smoke_resetCache(bmain, scene, ptr); - - rna_Smoke_update(bmain, scene, ptr); -} - -static void rna_Smoke_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data; - - smokeModifier_reset(settings->smd); - - if (settings->smd && settings->smd->domain) { - settings->smd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED; - } - - rna_Smoke_dependency_update(bmain, scene, ptr); -} - -static char *rna_SmokeDomainSettings_path(PointerRNA *ptr) -{ - SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data; - ModifierData *md = (ModifierData *)settings->smd; - char name_esc[sizeof(md->name) * 2]; - - BLI_strescape(name_esc, md->name, sizeof(name_esc)); - return BLI_sprintfN("modifiers[\"%s\"].domain_settings", name_esc); -} - -static char *rna_SmokeFlowSettings_path(PointerRNA *ptr) -{ - SmokeFlowSettings *settings = (SmokeFlowSettings *)ptr->data; - ModifierData *md = (ModifierData *)settings->smd; - char name_esc[sizeof(md->name) * 2]; - - BLI_strescape(name_esc, md->name, sizeof(name_esc)); - return BLI_sprintfN("modifiers[\"%s\"].flow_settings", name_esc); -} - -static char *rna_SmokeCollSettings_path(PointerRNA *ptr) -{ - SmokeCollSettings *settings = (SmokeCollSettings *)ptr->data; - ModifierData *md = (ModifierData *)settings->smd; - char name_esc[sizeof(md->name) * 2]; - - BLI_strescape(name_esc, md->name, sizeof(name_esc)); - return BLI_sprintfN("modifiers[\"%s\"].coll_settings", name_esc); -} - -static int rna_SmokeModifier_grid_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - float *density = NULL; - int size = 0; - - if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) { - /* high resolution smoke */ - int res[3]; - - smoke_turbulence_get_res(sds->wt, res); - size = res[0] * res[1] * res[2]; - - density = smoke_turbulence_get_density(sds->wt); - } - else if (sds->fluid) { - /* regular resolution */ - size = sds->res[0] * sds->res[1] * sds->res[2]; - density = smoke_get_density(sds->fluid); - } - - length[0] = (density) ? size : 0; -# else - (void)ptr; - length[0] = 0; -# endif - return length[0]; -} - -static int rna_SmokeModifier_color_grid_get_length(PointerRNA *ptr, - int length[RNA_MAX_ARRAY_DIMENSION]) -{ - rna_SmokeModifier_grid_get_length(ptr, length); - - length[0] *= 4; - return length[0]; -} - -static int rna_SmokeModifier_velocity_grid_get_length(PointerRNA *ptr, - int length[RNA_MAX_ARRAY_DIMENSION]) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - float *vx = NULL; - float *vy = NULL; - float *vz = NULL; - int size = 0; - - /* Velocity data is always low-resolution. */ - if (sds->fluid) { - size = 3 * sds->res[0] * sds->res[1] * sds->res[2]; - vx = smoke_get_velocity_x(sds->fluid); - vy = smoke_get_velocity_y(sds->fluid); - vz = smoke_get_velocity_z(sds->fluid); - } - - length[0] = (vx && vy && vz) ? size : 0; -# else - (void)ptr; - length[0] = 0; -# endif - return length[0]; -} - -static int rna_SmokeModifier_heat_grid_get_length(PointerRNA *ptr, - int length[RNA_MAX_ARRAY_DIMENSION]) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - float *heat = NULL; - int size = 0; - - /* Heat data is always low-resolution. */ - if (sds->fluid) { - size = sds->res[0] * sds->res[1] * sds->res[2]; - heat = smoke_get_heat(sds->fluid); - } - - length[0] = (heat) ? size : 0; -# else - (void)ptr; - length[0] = 0; -# endif - return length[0]; -} - -static void rna_SmokeModifier_density_grid_get(PointerRNA *ptr, float *values) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - int length[RNA_MAX_ARRAY_DIMENSION]; - int size = rna_SmokeModifier_grid_get_length(ptr, length); - float *density; - - BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - - if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) { - density = smoke_turbulence_get_density(sds->wt); - } - else { - density = smoke_get_density(sds->fluid); - } - - memcpy(values, density, size * sizeof(float)); - - BLI_rw_mutex_unlock(sds->fluid_mutex); -# else - UNUSED_VARS(ptr, values); -# endif -} - -static void rna_SmokeModifier_velocity_grid_get(PointerRNA *ptr, float *values) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - int length[RNA_MAX_ARRAY_DIMENSION]; - int size = rna_SmokeModifier_velocity_grid_get_length(ptr, length); - float *vx, *vy, *vz; - int i; - - BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - - vx = smoke_get_velocity_x(sds->fluid); - vy = smoke_get_velocity_y(sds->fluid); - vz = smoke_get_velocity_z(sds->fluid); - - for (i = 0; i < size; i += 3) { - *(values++) = *(vx++); - *(values++) = *(vy++); - *(values++) = *(vz++); - } - - BLI_rw_mutex_unlock(sds->fluid_mutex); -# else - UNUSED_VARS(ptr, values); -# endif -} - -static void rna_SmokeModifier_color_grid_get(PointerRNA *ptr, float *values) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - int length[RNA_MAX_ARRAY_DIMENSION]; - int size = rna_SmokeModifier_grid_get_length(ptr, length); - - BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - - if (!sds->fluid) { - memset(values, 0, size * sizeof(float)); - } - else { - if (sds->flags & MOD_SMOKE_HIGHRES) { - if (smoke_turbulence_has_colors(sds->wt)) { - smoke_turbulence_get_rgba(sds->wt, values, 0); - } - else { - smoke_turbulence_get_rgba_from_density(sds->wt, sds->active_color, values, 0); - } - } - else { - if (smoke_has_colors(sds->fluid)) { - smoke_get_rgba(sds->fluid, values, 0); - } - else { - smoke_get_rgba_from_density(sds->fluid, sds->active_color, values, 0); - } - } - } - - BLI_rw_mutex_unlock(sds->fluid_mutex); -# else - UNUSED_VARS(ptr, values); -# endif -} - -static void rna_SmokeModifier_flame_grid_get(PointerRNA *ptr, float *values) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - int length[RNA_MAX_ARRAY_DIMENSION]; - int size = rna_SmokeModifier_grid_get_length(ptr, length); - float *flame; - - BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - - if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) { - flame = smoke_turbulence_get_flame(sds->wt); - } - else { - flame = smoke_get_flame(sds->fluid); - } - - if (flame) { - memcpy(values, flame, size * sizeof(float)); - } - else { - memset(values, 0, size * sizeof(float)); - } - - BLI_rw_mutex_unlock(sds->fluid_mutex); -# else - UNUSED_VARS(ptr, values); -# endif -} - -static void rna_SmokeModifier_heat_grid_get(PointerRNA *ptr, float *values) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - int length[RNA_MAX_ARRAY_DIMENSION]; - int size = rna_SmokeModifier_heat_grid_get_length(ptr, length); - float *heat; - - BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - - heat = smoke_get_heat(sds->fluid); - - if (heat != NULL) { - /* scale heat values from -2.0-2.0 to -1.0-1.0. */ - for (int i = 0; i < size; i++) { - values[i] = heat[i] * 0.5f; - } - } - else { - memset(values, 0, size * sizeof(float)); - } - - BLI_rw_mutex_unlock(sds->fluid_mutex); -# else - UNUSED_VARS(ptr, values); -# endif -} - -static void rna_SmokeModifier_temperature_grid_get(PointerRNA *ptr, float *values) -{ -# ifdef WITH_SMOKE - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - int length[RNA_MAX_ARRAY_DIMENSION]; - int size = rna_SmokeModifier_grid_get_length(ptr, length); - float *flame; - - BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - - if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) { - flame = smoke_turbulence_get_flame(sds->wt); - } - else { - flame = smoke_get_flame(sds->fluid); - } - - if (flame) { - /* Output is such that 0..1 maps to 0..1000K */ - float offset = sds->flame_ignition; - float scale = sds->flame_max_temp - sds->flame_ignition; - - for (int i = 0; i < size; i++) { - values[i] = (flame[i] > 0.01f) ? offset + flame[i] * scale : 0.0f; - } - } - else { - memset(values, 0, size * sizeof(float)); - } - - BLI_rw_mutex_unlock(sds->fluid_mutex); -# else - UNUSED_VARS(ptr, values); -# endif -} - -static void rna_SmokeFlow_density_vgroup_get(PointerRNA *ptr, char *value) -{ - SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data; - rna_object_vgroup_name_index_get(ptr, value, flow->vgroup_density); -} - -static int rna_SmokeFlow_density_vgroup_length(PointerRNA *ptr) -{ - SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data; - return rna_object_vgroup_name_index_length(ptr, flow->vgroup_density); -} - -static void rna_SmokeFlow_density_vgroup_set(PointerRNA *ptr, const char *value) -{ - SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data; - rna_object_vgroup_name_index_set(ptr, value, &flow->vgroup_density); -} - -static void rna_SmokeFlow_uvlayer_set(PointerRNA *ptr, const char *value) -{ - SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data; - rna_object_uvlayer_name_set(ptr, value, flow->uvlayer_name, sizeof(flow->uvlayer_name)); -} - -static void rna_Smoke_use_color_ramp_set(PointerRNA *ptr, bool value) -{ - SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; - - sds->use_coba = value; - - if (value && sds->coba == NULL) { - sds->coba = BKE_colorband_add(false); - } -} - -#else - -static void rna_def_smoke_domain_settings(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_noise_type_items[] = { - {MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""}, -# ifdef WITH_FFTW3 - {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""}, -# endif - /* {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */ - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem prop_compression_items[] = { - {VDB_COMPRESSION_ZIP, "ZIP", 0, "Zip", "Effective but slow compression"}, -# ifdef WITH_OPENVDB_BLOSC - {VDB_COMPRESSION_BLOSC, - "BLOSC", - 0, - "Blosc", - "Multithreaded compression, similar in size and quality as 'Zip'"}, -# endif - {VDB_COMPRESSION_NONE, "NONE", 0, "None", "Do not use any compression"}, - {0, NULL, 0, NULL, NULL}}; - - static const EnumPropertyItem smoke_cache_comp_items[] = { - {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Lite", "Fast but not so effective compression"}, - {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem smoke_highres_sampling_items[] = { - {SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""}, - {SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""}, - {SM_HRES_NEAREST, "NEAREST", 0, "Nearest", ""}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem smoke_data_depth_items[] = { - {16, "16", 0, "Float (Half)", "Half float (16 bit data)"}, - {0, "32", 0, "Float (Full)", "Full float (32 bit data)"}, /* default */ - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem smoke_domain_colli_items[] = { - {SM_BORDER_OPEN, "BORDEROPEN", 0, "Open", "Smoke doesn't collide with any border"}, - {SM_BORDER_VERTICAL, - "BORDERVERTICAL", - 0, - "Vertically Open", - "Smoke doesn't collide with top and bottom sides"}, - {SM_BORDER_CLOSED, "BORDERCLOSED", 0, "Collide All", "Smoke collides with every side"}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem cache_file_type_items[] = { - {PTCACHE_FILE_PTCACHE, - "POINTCACHE", - 0, - "Point Cache", - "Blender specific point cache file format"}, -# ifdef WITH_OPENVDB - {PTCACHE_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file format"}, -# endif - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem smoke_view_items[] = { - {MOD_SMOKE_SLICE_VIEW_ALIGNED, - "VIEW_ALIGNED", - 0, - "View", - "Slice volume parallel to the view plane"}, - {MOD_SMOKE_SLICE_AXIS_ALIGNED, - "AXIS_ALIGNED", - 0, - "Axis", - "Slice volume parallel to the major axis"}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem axis_slice_method_items[] = { - {AXIS_SLICE_FULL, "FULL", 0, "Full", "Slice the whole domain object"}, - {AXIS_SLICE_SINGLE, "SINGLE", 0, "Single", "Perform a single slice of the domain object"}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem interp_method_item[] = { - {VOLUME_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"}, - {VOLUME_INTERP_CUBIC, - "CUBIC", - 0, - "Cubic", - "Smoothed high quality interpolation, but slower"}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem axis_slice_position_items[] = { - {SLICE_AXIS_AUTO, - "AUTO", - 0, - "Auto", - "Adjust slice direction according to the view direction"}, - {SLICE_AXIS_X, "X", 0, "X", "Slice along the X axis"}, - {SLICE_AXIS_Y, "Y", 0, "Y", "Slice along the Y axis"}, - {SLICE_AXIS_Z, "Z", 0, "Z", "Slice along the Z axis"}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem vector_draw_items[] = { - {VECTOR_DRAW_NEEDLE, "NEEDLE", 0, "Needle", "Display vectors as needles"}, - {VECTOR_DRAW_STREAMLINE, "STREAMLINE", 0, "Streamlines", "Display vectors as streamlines"}, - {0, NULL, 0, NULL, NULL}, - }; - - srna = RNA_def_struct(brna, "SmokeDomainSettings", NULL); - RNA_def_struct_ui_text(srna, "Domain Settings", "Smoke domain settings"); - RNA_def_struct_sdna(srna, "SmokeDomainSettings"); - RNA_def_struct_path_func(srna, "rna_SmokeDomainSettings_path"); - - prop = RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxres"); - RNA_def_property_range(prop, 6, 512); - RNA_def_property_ui_range(prop, 24, 512, 2, -1); - RNA_def_property_ui_text(prop, "Max Res", "Maximal resolution used in the fluid domain"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "amplify", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "amplify"); - RNA_def_property_range(prop, 1, 10); - RNA_def_property_ui_range(prop, 1, 10, 1, -1); - RNA_def_property_ui_text( - prop, "Amplification", "Enhance the resolution of smoke by this factor using noise"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "use_high_resolution", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGHRES); - RNA_def_property_ui_text(prop, "High Res", "Enable high resolution (using amplification)"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "show_high_resolution", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_SHOW_HIGHRES); - RNA_def_property_ui_text( - prop, "Show High Resolution", "Show high resolution (using amplification)"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "noise"); - RNA_def_property_enum_items(prop, prop_noise_type_items); - RNA_def_property_ui_text( - prop, "Noise Method", "Noise method which is used for creating the high resolution"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "alpha"); - RNA_def_property_range(prop, -5.0, 5.0); - RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); - RNA_def_property_ui_text( - prop, - "Density", - "How much density affects smoke motion (higher value results in faster rising smoke)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "beta"); - RNA_def_property_range(prop, -5.0, 5.0); - RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); - RNA_def_property_ui_text( - prop, - "Heat", - "How much heat affects smoke motion (higher value results in faster rising smoke)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "coll_group"); - RNA_def_property_struct_type(prop, "Collection"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Collision Collection", "Limit collisions to this collection"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency"); - - prop = RNA_def_property(srna, "fluid_collection", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "fluid_group"); - RNA_def_property_struct_type(prop, "Collection"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Fluid Collection", "Limit fluid objects to this collection"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency"); - - prop = RNA_def_property(srna, "effector_collection", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "eff_group"); - RNA_def_property_struct_type(prop, "Collection"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency"); - - prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "strength"); - RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2); - RNA_def_property_ui_text(prop, "Strength", "Strength of noise"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_TIME); - RNA_def_property_int_sdna(prop, NULL, "diss_speed"); - RNA_def_property_range(prop, 1.0, 10000.0); - RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, -1); - RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE); - RNA_def_property_ui_text(prop, "Dissolve Smoke", "Enable smoke to disappear over time"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE_LOG); - RNA_def_property_ui_text(prop, "Logarithmic Dissolve", "Using 1/x "); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "point_cache[0]"); - RNA_def_property_struct_type(prop, "PointCache"); - RNA_def_property_ui_text(prop, "Point Cache", ""); - - prop = RNA_def_property(srna, "point_cache_compress_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "cache_comp"); - RNA_def_property_enum_items(prop, smoke_cache_comp_items); - RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used"); - - prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "openvdb_comp"); - RNA_def_property_enum_items(prop, prop_compression_items); - RNA_def_property_ui_text(prop, "Compression", "Compression method to be used"); - - prop = RNA_def_property(srna, "data_depth", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_depth"); - RNA_def_property_enum_items(prop, smoke_data_depth_items); - RNA_def_property_ui_text(prop, - "Data Depth", - "Bit depth for writing all scalar (including vector) " - "lower values reduce file size"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL); - - prop = RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); - RNA_def_property_enum_items(prop, smoke_domain_colli_items); - RNA_def_property_ui_text( - prop, "Border Collisions", "Select which domain border will be treated as collision object"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "EffectorWeights"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Effector Weights", ""); - - prop = RNA_def_property(srna, "highres_sampling", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, smoke_highres_sampling_items); - RNA_def_property_ui_text(prop, "Emitter", "Method for sampling the high resolution flow"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "time_scale"); - RNA_def_property_range(prop, 0.2, 1.5); - RNA_def_property_ui_range(prop, 0.2, 1.5, 0.02, 5); - RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "vorticity"); - RNA_def_property_range(prop, 0.01, 4.0); - RNA_def_property_ui_range(prop, 0.01, 4.0, 0.02, 5); - RNA_def_property_ui_text(prop, "Vorticity", "Amount of turbulence/rotation in fluid"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "density_grid", PROP_FLOAT, PROP_NONE); - RNA_def_property_array(prop, 32); - RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length"); - RNA_def_property_float_funcs(prop, "rna_SmokeModifier_density_grid_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Density Grid", "Smoke density grid"); - - prop = RNA_def_property(srna, "velocity_grid", PROP_FLOAT, PROP_NONE); - RNA_def_property_array(prop, 32); - RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_velocity_grid_get_length"); - RNA_def_property_float_funcs(prop, "rna_SmokeModifier_velocity_grid_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Velocity Grid", "Smoke velocity grid"); - - prop = RNA_def_property(srna, "flame_grid", PROP_FLOAT, PROP_NONE); - RNA_def_property_array(prop, 32); - RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length"); - RNA_def_property_float_funcs(prop, "rna_SmokeModifier_flame_grid_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Flame Grid", "Smoke flame grid"); - - prop = RNA_def_property(srna, "color_grid", PROP_FLOAT, PROP_NONE); - RNA_def_property_array(prop, 32); - RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_color_grid_get_length"); - RNA_def_property_float_funcs(prop, "rna_SmokeModifier_color_grid_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Color Grid", "Smoke color grid"); - - prop = RNA_def_property(srna, "heat_grid", PROP_FLOAT, PROP_NONE); - RNA_def_property_array(prop, 32); - RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_heat_grid_get_length"); - RNA_def_property_float_funcs(prop, "rna_SmokeModifier_heat_grid_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Heat Grid", "Smoke heat grid"); - - prop = RNA_def_property(srna, "temperature_grid", PROP_FLOAT, PROP_NONE); - RNA_def_property_array(prop, 32); - RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length"); - RNA_def_property_float_funcs(prop, "rna_SmokeModifier_temperature_grid_get", NULL, NULL); - RNA_def_property_ui_text( - prop, "Temperature Grid", "Smoke temperature grid, range 0..1 represents 0..1000K"); - - prop = RNA_def_property(srna, - "cell_size", - PROP_FLOAT, - PROP_XYZ); /* can change each frame when using adaptive domain */ - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "cell_size", "Cell Size"); - - prop = RNA_def_property(srna, - "start_point", - PROP_FLOAT, - PROP_XYZ); /* can change each frame when using adaptive domain */ - RNA_def_property_float_sdna(prop, NULL, "p0"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "p0", "Start point"); - - prop = RNA_def_property(srna, - "domain_resolution", - PROP_INT, - PROP_XYZ); /* can change each frame when using adaptive domain */ - RNA_def_property_int_sdna(prop, NULL, "res"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "res", "Smoke Grid Resolution"); - - prop = RNA_def_property(srna, "burning_rate", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01, 4.0); - RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5); - RNA_def_property_ui_text( - prop, "Speed", "Speed of the burning reaction (use larger values for smaller flame)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "flame_smoke", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 8.0); - RNA_def_property_ui_range(prop, 0.0, 4.0, 1.0, 5); - RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_range(prop, 0.0, 2.0); - RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5); - RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "flame_ignition", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.5, 5.0); - RNA_def_property_ui_range(prop, 0.5, 2.5, 1.0, 5); - RNA_def_property_ui_text(prop, "Ignition", "Minimum temperature of flames"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "flame_max_temp", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 1.0, 10.0); - RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5); - RNA_def_property_ui_text(prop, "Maximum", "Maximum temperature of flames"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "flame_smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke emitted from burning fuel"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_ADAPTIVE_DOMAIN); - RNA_def_property_ui_text( - prop, "Adaptive Domain", "Adapt simulation resolution and size to fluid"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "additional_res", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "adapt_res"); - RNA_def_property_range(prop, 0, 512); - RNA_def_property_ui_range(prop, 0, 512, 2, -1); - RNA_def_property_ui_text(prop, "Additional", "Maximum number of additional cells"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "adapt_margin", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "adapt_margin"); - RNA_def_property_range(prop, 2, 24); - RNA_def_property_ui_range(prop, 2, 24, 2, -1); - RNA_def_property_ui_text( - prop, "Margin", "Margin added around fluid to minimize boundary interference"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01, 0.5); - RNA_def_property_ui_range(prop, 0.01, 0.5, 1.0, 5); - RNA_def_property_ui_text( - prop, "Threshold", "Maximum amount of fluid cell can contain before it is considered empty"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - prop = RNA_def_property(srna, "cache_file_format", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "cache_file_format"); - RNA_def_property_enum_items(prop, cache_file_type_items); - RNA_def_property_enum_funcs(prop, NULL, "rna_Smoke_cachetype_set", NULL); - RNA_def_property_ui_text(prop, "File Format", "Select the file format to be used for caching"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); - - /* display settings */ - - prop = RNA_def_property(srna, "slice_method", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "slice_method"); - RNA_def_property_enum_items(prop, smoke_view_items); - RNA_def_property_ui_text(prop, "View Method", "How to slice the volume for viewport rendering"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "axis_slice_method", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "axis_slice_method"); - RNA_def_property_enum_items(prop, axis_slice_method_items); - RNA_def_property_ui_text(prop, "Method", ""); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "slice_axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "slice_axis"); - RNA_def_property_enum_items(prop, axis_slice_position_items); - RNA_def_property_ui_text(prop, "Axis", ""); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "slice_per_voxel", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "slice_per_voxel"); - RNA_def_property_range(prop, 0.0, 100.0); - RNA_def_property_ui_range(prop, 0.0, 5.0, 0.1, 1); - RNA_def_property_ui_text( - prop, "Slice Per Voxel", "How many slices per voxel should be generated"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "slice_depth", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_sdna(prop, NULL, "slice_depth"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3); - RNA_def_property_ui_text(prop, "Position", "Position of the slice"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "display_thickness", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "display_thickness"); - RNA_def_property_range(prop, 0.001, 1000.0); - RNA_def_property_ui_range(prop, 0.1, 100.0, 0.1, 3); - RNA_def_property_ui_text(prop, "Thickness", "Thickness of smoke drawing in the viewport"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL); - - prop = RNA_def_property(srna, "display_interpolation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "interp_method"); - RNA_def_property_enum_items(prop, interp_method_item); - RNA_def_property_ui_text( - prop, "Interpolation", "Interpolation method to use for smoke/fire volumes in solid mode"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "draw_velocity", 0); - RNA_def_property_ui_text( - prop, "Display Velocity", "Toggle visualization of the velocity field as needles"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "vector_display_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "vector_draw_type"); - RNA_def_property_enum_items(prop, vector_draw_items); - RNA_def_property_ui_text(prop, "Display Type", ""); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "vector_scale", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "vector_scale"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_range(prop, 0.0, 100.0, 0.1, 3); - RNA_def_property_ui_text(prop, "Scale", "Multiplier for scaling the vectors"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - /* --------- Color mapping. --------- */ - - prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "use_coba", 0); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Smoke_use_color_ramp_set"); - RNA_def_property_ui_text( - prop, - "Use Color Ramp", - "Render a simulation field while mapping its voxels values to the colors of a ramp"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - static const EnumPropertyItem coba_field_items[] = { - {FLUID_FIELD_COLOR_R, "COLOR_R", 0, "Red", "Red component of the color field"}, - {FLUID_FIELD_COLOR_G, "COLOR_G", 0, "Green", "Green component of the color field"}, - {FLUID_FIELD_COLOR_B, "COLOR_B", 0, "Blue", "Blue component of the color field"}, - {FLUID_FIELD_DENSITY, "DENSITY", 0, "Density", "Quantity of soot in the fluid"}, - {FLUID_FIELD_FLAME, "FLAME", 0, "Flame", "Flame field"}, - {FLUID_FIELD_FUEL, "FUEL", 0, "Fuel", "Fuel field"}, - {FLUID_FIELD_HEAT, "HEAT", 0, "Heat", "Temperature of the fluid"}, - {FLUID_FIELD_VELOCITY_X, "VELOCITY_X", 0, "X Velocity", "X component of the velocity field"}, - {FLUID_FIELD_VELOCITY_Y, "VELOCITY_Y", 0, "Y Velocity", "Y component of the velocity field"}, - {FLUID_FIELD_VELOCITY_Z, "VELOCITY_Z", 0, "Z Velocity", "Z component of the velocity field"}, - {0, NULL, 0, NULL, NULL}, - }; - - prop = RNA_def_property(srna, "coba_field", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "coba_field"); - RNA_def_property_enum_items(prop, coba_field_items); - RNA_def_property_ui_text(prop, "Field", "Simulation field to color map"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "coba"); - RNA_def_property_struct_type(prop, "ColorRamp"); - RNA_def_property_ui_text(prop, "Color Ramp", ""); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "clipping", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "clipping"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3); - RNA_def_property_ui_text( - prop, - "Clipping", - "Value under which voxels are considered empty space to optimize caching and rendering"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL); -} - -static void rna_def_smoke_flow_settings(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem smoke_flow_types[] = { - {MOD_SMOKE_FLOW_TYPE_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete smoke from simulation"}, - {MOD_SMOKE_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"}, - {MOD_SMOKE_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"}, - {MOD_SMOKE_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem smoke_flow_sources[] = { - {MOD_SMOKE_FLOW_SOURCE_PARTICLES, - "PARTICLES", - ICON_PARTICLES, - "Particle System", - "Emit smoke from particles"}, - {MOD_SMOKE_FLOW_SOURCE_MESH, - "MESH", - ICON_META_CUBE, - "Mesh", - "Emit smoke from mesh surface or volume"}, - {0, NULL, 0, NULL, NULL}, - }; - - static const EnumPropertyItem smoke_flow_texture_types[] = { - {MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO, - "AUTO", - 0, - "Generated", - "Generated coordinates centered to flow object"}, - {MOD_SMOKE_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"}, - {0, NULL, 0, NULL, NULL}, - }; - - srna = RNA_def_struct(brna, "SmokeFlowSettings", NULL); - RNA_def_struct_ui_text(srna, "Flow Settings", "Smoke flow settings"); - RNA_def_struct_sdna(srna, "SmokeFlowSettings"); - RNA_def_struct_path_func(srna, "rna_SmokeFlowSettings_path"); - - prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_sdna(prop, NULL, "density"); - RNA_def_property_range(prop, 0.0, 1); - RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 4); - RNA_def_property_ui_text(prop, "Density", ""); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, NULL, "color"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "fuel_amount", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 10); - RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 4); - RNA_def_property_ui_text(prop, "Flame Rate", ""); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "temp"); - RNA_def_property_range(prop, -10, 10); - RNA_def_property_ui_range(prop, -10, 10, 1, 1); - RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "psys"); - RNA_def_property_struct_type(prop, "ParticleSystem"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object"); - RNA_def_property_update(prop, 0, "rna_Smoke_reset_dependency"); - - prop = RNA_def_property(srna, "smoke_flow_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, smoke_flow_types); - RNA_def_property_ui_text(prop, "Flow Type", "Change how flow affects the simulation"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "smoke_flow_source", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "source"); - RNA_def_property_enum_items(prop, smoke_flow_sources); - RNA_def_property_ui_text(prop, "Source", "Change how smoke is emitted"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE); - RNA_def_property_ui_text( - prop, "Absolute Density", "Only allow given density value in emitter area"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "use_initial_velocity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY); - RNA_def_property_ui_text( - prop, "Initial Velocity", "Smoke has some initial velocity when it is emitted"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "vel_multi"); - RNA_def_property_range(prop, -100.0, 100.0); - RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5); - RNA_def_property_ui_text(prop, "Source", "Multiplier of source velocity passed to smoke"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "velocity_normal", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "vel_normal"); - RNA_def_property_range(prop, -100.0, 100.0); - RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5); - RNA_def_property_ui_text(prop, "Normal", "Amount of normal directional velocity"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "velocity_random", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "vel_random"); - RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_range(prop, 0.0, 2.0, 0.05, 5); - RNA_def_property_ui_text(prop, "Random", "Amount of random velocity"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_range(prop, 0.0, 1.0, 0.05, 5); - RNA_def_property_ui_text(prop, "Volume", "Factor for smoke emitted from inside the mesh volume"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5); - RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit smoke"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.1, 20.0); - RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5); - RNA_def_property_ui_text(prop, "Size", "Particle size in simulation cells"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "use_particle_size", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_USE_PART_SIZE); - RNA_def_property_ui_text( - prop, "Set Size", "Set particle size in simulation cells or use nearest cell"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, 50); - RNA_def_property_ui_range(prop, 0, 10, 1, -1); - RNA_def_property_ui_text(prop, - "Subframes", - "Number of additional samples to take between frames to improve " - "quality of fast moving flows"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "density_vertex_group", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, - "rna_SmokeFlow_density_vgroup_get", - "rna_SmokeFlow_density_vgroup_length", - "rna_SmokeFlow_density_vgroup_set"); - RNA_def_property_ui_text( - prop, "Vertex Group", "Name of vertex group which determines surface emission rate"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_TEXTUREEMIT); - RNA_def_property_ui_text(prop, "Use Texture", "Use a texture to control emission strength"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "texture_map_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "texture_type"); - RNA_def_property_enum_items(prop, smoke_flow_texture_types); - RNA_def_property_ui_text(prop, "Mapping", "Texture mapping type"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "uvlayer_name"); - RNA_def_property_ui_text(prop, "UV Map", "UV map name"); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmokeFlow_uvlayer_set"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "noise_texture", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Texture", "Texture that controls emission strength"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "texture_size", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01, 10.0); - RNA_def_property_ui_range(prop, 0.1, 5.0, 0.05, 5); - RNA_def_property_ui_text(prop, "Size", "Size of texture mapping"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); - - prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 200.0); - RNA_def_property_ui_range(prop, 0.0, 100.0, 0.05, 5); - RNA_def_property_ui_text(prop, "Offset", "Z-offset of texture mapping"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); -} - -static void rna_def_smoke_coll_settings(BlenderRNA *brna) -{ - static const EnumPropertyItem smoke_coll_type_items[] = { - {SM_COLL_STATIC, "COLLSTATIC", 0, "Static", "Non moving obstacle"}, - {SM_COLL_RIGID, "COLLRIGID", 0, "Rigid", "Rigid obstacle"}, - {SM_COLL_ANIMATED, "COLLANIMATED", 0, "Animated", "Animated obstacle"}, - {0, NULL, 0, NULL, NULL}, - }; - - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "SmokeCollSettings", NULL); - RNA_def_struct_ui_text(srna, "Collision Settings", "Smoke collision settings"); - RNA_def_struct_sdna(srna, "SmokeCollSettings"); - RNA_def_struct_path_func(srna, "rna_SmokeCollSettings_path"); - - prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, smoke_coll_type_items); - RNA_def_property_ui_text(prop, "Collision Type", "Collision type"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); -} - -void RNA_def_smoke(BlenderRNA *brna) -{ - rna_def_smoke_domain_settings(brna); - rna_def_smoke_flow_settings(brna); - rna_def_smoke_coll_settings(brna); -} - -#endif |