Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_heightmap.c
- This file was added.
| /* | |||||
| * 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_mesh_types.h" | |||||
| #include "DNA_heightmap_types.h" | |||||
| #include "BLI_utildefines.h" | |||||
| #include "RNA_access.h" | |||||
| #include "RNA_define.h" | |||||
| #include "RNA_enum_types.h" | |||||
| #include "rna_internal.h" | |||||
| #include "WM_api.h" | |||||
| #include "WM_types.h" | |||||
| #ifdef RNA_RUNTIME | |||||
| # include "BLI_math.h" | |||||
| # include "MEM_guardedalloc.h" | |||||
| # include "DNA_object_types.h" | |||||
| # include "DNA_scene_types.h" | |||||
| # include "DNA_heightmap_types.h" | |||||
| # include "BKE_main.h" | |||||
| # include "BKE_heightmap.h" | |||||
| # include "BKE_scene.h" | |||||
| # include "DEG_depsgraph.h" | |||||
| static void rna_heightmap_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | |||||
| { | |||||
| Object *ob = (Object *)ptr->owner_id; | |||||
| WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); | |||||
| } | |||||
| #else | |||||
| static void rna_def_heightmap(BlenderRNA *brna) | |||||
| { | |||||
| static const EnumPropertyItem debug_mode_items[] = { | |||||
| {HEIGHTMAP_DEBUG_NONE, | |||||
| "NONE", | |||||
| 0, | |||||
| "None", | |||||
| ""}, | |||||
| {HEIGHTMAP_DEBUG_HEIGHT, | |||||
| "HEIGHT", | |||||
| 0, | |||||
| "Height", | |||||
| ""}, | |||||
| {HEIGHTMAP_DEBUG_WATER, | |||||
| "WATER", | |||||
| 0, | |||||
| "Water", | |||||
| ""}, | |||||
| {HEIGHTMAP_DEBUG_SEDIMENT, | |||||
| "SEDIMENT", | |||||
| 0, | |||||
| "Sediment", | |||||
| ""}, | |||||
| {HEIGHTMAP_DEBUG_FLUX, | |||||
| "FLUX", | |||||
| 0, | |||||
| "Flux", | |||||
| ""}, | |||||
| {HEIGHTMAP_DEBUG_VELOCITY, | |||||
| "VELOCITY", | |||||
| 0, | |||||
| "Velocity", | |||||
| ""}, | |||||
| {HEIGHTMAP_DEBUG_SLIPPERAGE, | |||||
| "SLIPPERAGE", | |||||
| 0, | |||||
| "Slipperage", | |||||
| ""}, | |||||
| {HEIGHTMAP_DEBUG_TERRAIN_MOVEMENTS, | |||||
| "TERRAIN_MOVES", | |||||
| 0, | |||||
| "Terrain movements", | |||||
| ""}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| StructRNA *srna; | |||||
| PropertyRNA *prop; | |||||
| srna = RNA_def_struct(brna, "HeightMap", "ID"); | |||||
| RNA_def_struct_ui_text(srna, "HeightMap", "HeightMap data-block to defined blobby surfaces"); | |||||
| RNA_def_struct_ui_icon(srna, ICON_GRID); | |||||
| prop = RNA_def_property(srna, "erosion", PROP_POINTER, PROP_NONE); | |||||
| RNA_def_property_pointer_sdna(prop, NULL, "erosion"); | |||||
| RNA_def_property_struct_type(prop, "ErosionSettings"); | |||||
| RNA_def_property_ui_text(prop, "Erosion", ""); | |||||
| /* number values */ | |||||
| prop = RNA_def_property(srna, "res", PROP_INT, PROP_NONE); | |||||
| RNA_def_property_int_sdna(prop, NULL, "res"); | |||||
| RNA_def_property_range(prop, 0, 8192); | |||||
| RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport"); | |||||
| RNA_def_property_update(prop, 0, "rna_heightmap_update"); | |||||
| prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "noise_scale"); | |||||
| RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport"); | |||||
| RNA_def_property_update(prop, 0, "rna_heightmap_update"); | |||||
| /* enum values */ | |||||
| prop = RNA_def_property(srna, "debug_data", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "debug_data"); | |||||
| RNA_def_property_enum_items(prop, debug_mode_items); | |||||
| RNA_def_property_ui_text(prop, "Debug Data", ""); | |||||
| RNA_def_property_update(prop, 0, "rna_heightmap_update"); | |||||
| /* flags */ | |||||
| prop = RNA_def_property(srna, "use_live_preview", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", HEIGHTMAP_LIVE_PREVIEW); | |||||
| RNA_def_property_ui_text(prop, "Erosion Live", ""); | |||||
| RNA_def_property_update(prop, 0, "rna_heightmap_update"); | |||||
| /* anim */ | |||||
| rna_def_animdata_common(srna); | |||||
| } | |||||
| static void rna_def_erosion_settings(BlenderRNA *brna) | |||||
| { | |||||
| StructRNA *srna; | |||||
| PropertyRNA *prop; | |||||
| srna = RNA_def_struct(brna, "ErosionSettings", NULL); | |||||
| RNA_def_struct_sdna(srna, "ErosionSettings"); | |||||
| RNA_def_struct_ui_text(srna, "Erosion", ""); | |||||
| /* Hydrolic erosion settings */ | |||||
| prop = RNA_def_property(srna, "kc", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "kc"); | |||||
| RNA_def_property_range(prop, 0.f, 0.5f); | |||||
| RNA_def_property_ui_text(prop, "Kc", ""); | |||||
| prop = RNA_def_property(srna, "kd", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "kd"); | |||||
| RNA_def_property_range(prop, 0.f, 0.5f); | |||||
| RNA_def_property_ui_text(prop, "Kd", ""); | |||||
| prop = RNA_def_property(srna, "ks", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "ks"); | |||||
| RNA_def_property_range(prop, 0.f, 0.5f); | |||||
| RNA_def_property_ui_text(prop, "Ks", ""); | |||||
| prop = RNA_def_property(srna, "evaporation", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "evaporation"); | |||||
| RNA_def_property_range(prop, 0.f, 1.f); | |||||
| RNA_def_property_ui_text(prop, "Evaporation Rate", ""); | |||||
| prop = RNA_def_property(srna, "velocity_advection", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "velocity_advection"); | |||||
| RNA_def_property_range(prop, 0.f, 1.f); | |||||
| RNA_def_property_ui_text(prop, "Velocity Advection", ""); | |||||
| prop = RNA_def_property(srna, "thermal_angle", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "thermal_angle"); | |||||
| RNA_def_property_range(prop, 1.f, 10.f); | |||||
| RNA_def_property_ui_text(prop, "Banks Angle", ""); | |||||
| prop = RNA_def_property(srna, "thermal_strength", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "thermal_strength"); | |||||
| RNA_def_property_range(prop, 0.f, 5.f); | |||||
| RNA_def_property_ui_text(prop, "Thermal Strength", ""); | |||||
| } | |||||
| void RNA_def_heightmap(BlenderRNA *brna) | |||||
| { | |||||
| rna_def_heightmap(brna); | |||||
| rna_def_erosion_settings(brna); | |||||
| } | |||||
| #endif | |||||