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_domain(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; static 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, "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, 100); 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, 100); 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 metres"); 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, "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_struct_type(prop, "FluidMeshVertex"); RNA_def_property_ui_text(prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation"); RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_FluidMeshVertex_data_length", NULL, NULL, NULL); rna_def_fluid_mesh_vertices(brna); }
static void rna_def_fluidsim_domain(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; static 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}}; static EnumPropertyItem viscosity_items[] = { {1, "MANUAL", 0, "Manual", "Manual viscosity settings."}, {2, "WATER", 0, "Water", "Viscosity of 1.0 * 10^-6."}, {3, "OIL", 0, "Oil", "Viscosity of 5.0 * 10^-5."}, {4, "HONEY", 0, "Honey", "Viscosity of 2.0 * 10^-3."}, {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, "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."); 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."); 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, 100); RNA_def_property_ui_text(prop, "Start Time", "Simulation time of the first blender frame."); 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, 100); RNA_def_property_ui_text(prop, "End Time", "Simulation time of the last blender frame."); 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, "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."); prop= RNA_def_property(srna, "path", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_maxlength(prop, 240); 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, "gravx"); 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, "viscosity_preset", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "viscosityMode"); RNA_def_property_enum_items(prop, viscosity_items); RNA_def_property_ui_text(prop, "Viscosity Preset", "Set viscosity of the fluid to a preset value, or use manual input."); 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, "real_world_size", 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 metres."); prop= RNA_def_property(srna, "grid_levels", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxRefine"); 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_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_smoothing", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing"); 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_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, "generate_speed_vectors", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "domainNovecgen", 0); RNA_def_property_ui_text(prop, "Generate Speed Vectors", "Generate speed vectors for vector blur."); /* particles */ prop= RNA_def_property(srna, "tracer_particles", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "generateTracers"); 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_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)."); }