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/rna_property.c | |
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/rna_property.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_property.c | 24 |
1 files changed, 22 insertions, 2 deletions
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); |