diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-07-20 20:21:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-07-20 20:21:55 +0400 |
commit | 33bfd7397b8b0031bd2cf46d2037a8da4ef40888 (patch) | |
tree | b956392c96cc696052ef1fc46279f02d84e6adf8 /source/blender/makesrna/intern | |
parent | cc69f1301387ea920a225b6eb49283e3c03e1b06 (diff) |
BGE Button types panel, can edit existing buttons but not add new ones yet.
World Physics panel too though Im not sure if we'll eventually move this into another struct.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_property.c | 24 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_world.c | 32 |
3 files changed, 55 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 05a60f3c0f9..32a97d2c86a 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -705,7 +705,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "prop", NULL); - RNA_def_property_struct_type(prop, "GameProperty"); + RNA_def_property_struct_type(prop, "GameProperty"); /* rna_property.c */ RNA_def_property_ui_text(prop, "Properties", "Game engine properties."); prop= RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index a840552b86f..a1fcbac274e 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -33,6 +33,8 @@ #ifdef RNA_RUNTIME +#include "BKE_property.h" + static StructRNA* rna_GameProperty_refine(struct PointerRNA *ptr) { bProperty *property= (bProperty*)ptr->data; @@ -67,6 +69,24 @@ static void rna_GameFloatProperty_value_set(PointerRNA *ptr, float value) *(float*)(&prop->data)= value; } +static void rna_GameProperty_type_set(PointerRNA *ptr, int value) +{ + bProperty *prop= (bProperty*)(ptr->data); + + if(prop->type != value) { + prop->type= value; + init_property(prop); + } +} + +static void rna_GameProperty_name_set(PointerRNA *ptr, const char *value) +{ + bProperty *prop= (bProperty*)(ptr->data); + BLI_strncpy(prop->name, value, sizeof(prop->name)); + unique_property(NULL, prop, 1); +} + + #else void RNA_def_gameproperty(BlenderRNA *brna) @@ -89,14 +109,14 @@ void RNA_def_gameproperty(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_GameProperty_refine"); prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* must be unique */ RNA_def_property_ui_text(prop, "Name", "Available as as GameObject attributes in the game engines python api"); RNA_def_struct_name_property(srna, prop); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GameProperty_name_set"); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, gameproperty_type_items); RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_enum_funcs(prop, NULL, "rna_GameProperty_type_set", NULL); prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PROP_DEBUG); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index c93d18d4017..773037176de 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -422,6 +422,38 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Real Sky", "Render background with a real horizon, relative to the camera angle."); RNA_def_property_update(prop, NC_WORLD, NULL); + /* game settings */ + /* should go in a fake substruct however not sure if they move about */ + prop= RNA_def_property(srna, "game_fps", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "ticrate"); + RNA_def_property_range(prop, 1, 120); + RNA_def_property_ui_text(prop, "Frames Per Second", "The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate."); + + prop= RNA_def_property(srna, "game_logic_step_max", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); + RNA_def_property_range(prop, 1, 5); + RNA_def_property_ui_text(prop, "Max Logic Steps", "The maxmimum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics."); + + prop= RNA_def_property(srna, "game_physics_substep", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "physubstep"); + RNA_def_property_range(prop, 1, 5); + RNA_def_property_ui_text(prop, "Physics Sub Steps", "The maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime."); + + prop= RNA_def_property(srna, "game_physics_step_max", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxphystep"); + RNA_def_property_range(prop, 1, 5); + RNA_def_property_ui_text(prop, "Max Physics Steps", "The number of simulation substep per physic timestep, higher value give better physics precision."); + + prop= RNA_def_property(srna, "game_use_occlusion_culling", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING); + RNA_def_property_ui_text(prop, "Enabled", "Use optimized Bullet DBVT tree for view frustrum and occlusion culling"); + + prop= RNA_def_property(srna, "game_occlusion_culling_resolution", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); + RNA_def_property_range(prop, 128, 1024); + RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precsion (slower)."); + + /* physics */ prop= RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "physicsEngine"); |