Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHamed Zaghaghi <hamed.zaghaghi@gmail.com>2008-12-02 04:05:23 +0300
committerHamed Zaghaghi <hamed.zaghaghi@gmail.com>2008-12-02 04:05:23 +0300
commit6780c0b12a63ac1395d97f199e25c4f692244efb (patch)
tree7821f5a2626fc96a4dd82ba3fa63ad22dcbe33f0 /source/blender/makesrna
parentaccfa06ede3231fe74e3e49858eb0d44ff0431e6 (diff)
* rna_property completed
CAUTION: some defines like PROP_INT in DNA_property_types.h are the same as enums in RNA_types.h, and may be encounter hidden errors in future.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h5
-rw-r--r--source/blender/makesrna/intern/rna_object.c23
-rw-r--r--source/blender/makesrna/intern/rna_property.c49
3 files changed, 72 insertions, 5 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 68866b89852..3b685792d33 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -53,6 +53,11 @@ extern StructRNA RNA_EnumProperty;
extern StructRNA RNA_EnumPropertyItem;
extern StructRNA RNA_FloatProperty;
extern StructRNA RNA_GameProperty;
+extern StructRNA RNA_GameBooleanProperty;
+extern StructRNA RNA_GameFloatProperty;
+extern StructRNA RNA_GameIntProperty;
+extern StructRNA RNA_GameStringProperty;
+extern StructRNA RNA_GameTimeProperty;
extern StructRNA RNA_Group;
extern StructRNA RNA_ID;
extern StructRNA RNA_IDProperty;
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 5026f92fcd2..0821345b3f1 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -31,9 +31,26 @@
#include "rna_internal.h"
#include "DNA_object_types.h"
+#include "DNA_property_types.h"
#ifdef RNA_RUNTIME
-
+static struct StructRNA* rna_Object_gameproperties_type(struct CollectionPropertyIterator *iter)
+{
+ bProperty *property= (bProperty*)iter->ptr.data;
+ switch(property->type){
+ case PROP_BOOL:
+ return &RNA_GameBooleanProperty;
+ case PROP_INT:
+ return &RNA_GameIntProperty;
+ case PROP_FLOAT:
+ return &RNA_GameFloatProperty;
+ case PROP_STRING:
+ return &RNA_GameStringProperty;
+ case PROP_TIME:
+ return &RNA_GameTimeProperty;
+ }
+ return &RNA_UnknownType;
+}
#else
void RNA_def_object(BlenderRNA *brna)
@@ -76,10 +93,8 @@ void RNA_def_object(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_collection_funcs(prop, 0, 0, 0, 0, "rna_Object_gameproperties_type", 0, 0, 0);
RNA_def_property_ui_text(prop, "Property", "Properties of this object.");
-
-
}
#endif
diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c
index 2414d91bfe2..94a16eaf9b9 100644
--- a/source/blender/makesrna/intern/rna_property.c
+++ b/source/blender/makesrna/intern/rna_property.c
@@ -49,6 +49,7 @@ void RNA_def_gameproperty(BlenderRNA *brna)
{PROP_TIME, "TIME", "Time", ""},
{0, NULL, NULL, NULL}};
+ /* Base Struct for GameProperty */
srna= RNA_def_struct(brna, "GameProperty", NULL , "GameProperty");
RNA_def_struct_sdna(srna, "bProperty");
@@ -57,12 +58,58 @@ void RNA_def_gameproperty(BlenderRNA *brna)
RNA_def_property_string_maxlength(prop, 31);
RNA_def_property_ui_text(prop, "Name", "Game Property name.");
- /* type is not editable, would need to do proper data free/alloc */
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
RNA_def_property_enum_items(prop, gameproperty_types_items);
RNA_def_property_ui_text(prop, "Game Property Types", "Game Property types.");
+ prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PROP_DEBUG);
+ RNA_def_property_ui_text(prop, "Debug", "Show debug information for this property.");
+
+ /* GameBooleanProperty */
+ srna= RNA_def_struct(brna, "GameBooleanProperty", "GameProperty" , "GameBooleanProperty");
+ RNA_def_struct_sdna(srna, "bProperty");
+
+ prop= RNA_def_property(srna, "boolean_value", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "data", 1);
+ RNA_def_property_ui_text(prop, "Value", "Property value.");
+
+ /* GameIntProperty */
+ srna= RNA_def_struct(brna, "GameIntProperty", "GameProperty" , "GameIntProperty");
+ RNA_def_struct_sdna(srna, "bProperty");
+
+ prop= RNA_def_property(srna, "int_value", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "data");
+ RNA_def_property_ui_text(prop, "Value", "Property value.");
+ RNA_def_property_range(prop, -10000, 10000);
+
+ /* GameFloatProperty */
+ srna= RNA_def_struct(brna, "GameFloatProperty", "GameProperty" , "GameFloatProperty");
+ RNA_def_struct_sdna(srna, "bProperty");
+
+ prop= RNA_def_property(srna, "float_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "data");
+ RNA_def_property_ui_text(prop, "Value", "Property value.");
+ RNA_def_property_range(prop, -10000, 10000);
+
+ /* GameTimerProperty */
+ srna= RNA_def_struct(brna, "GameTimeProperty", "GameProperty" , "GameTimeProperty");
+ RNA_def_struct_sdna(srna, "bProperty");
+
+ prop= RNA_def_property(srna, "timer_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "data");
+ RNA_def_property_ui_text(prop, "Value", "Property value.");
+ RNA_def_property_range(prop, -10000, 10000);
+
+ /* GameStringProperty */
+ srna= RNA_def_struct(brna, "GameStringProperty", "GameProperty" , "GameStringProperty");
+ RNA_def_struct_sdna(srna, "bProperty");
+
+ prop= RNA_def_property(srna, "string_value", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "poin");
+ RNA_def_property_string_maxlength(prop, MAX_PROPSTRING-1);
+ RNA_def_property_ui_text(prop, "Value", "Property value.");
}
#endif