diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-15 16:46:50 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-15 16:46:50 +0300 |
commit | c13bb258b1149d8bbfb97b896a58cd748e7cd861 (patch) | |
tree | 5b8d35a79ff7f6bf42b3b0c14f52c295e7da56ec /source/blender | |
parent | a1e0868018150f89a9b0ca2d92122ef75ec5c119 (diff) |
RNA:
Added some functionality to make inspecting all RNA structs possible. Not used
yet, but can be tested by replacing this line in space_outliner.c:
RNA_main_pointer_create(G.main, &cell.ptr);
with:
RNA_blender_rna_pointer_create(&cell.ptr);
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 33 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 28 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 4 |
4 files changed, 68 insertions, 5 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 020f01197ab..cfcc3eb3e75 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -40,13 +40,15 @@ extern StructRNA RNA_ActuatorSensor; extern StructRNA RNA_AlwaysSensor; extern StructRNA RNA_AndController; extern StructRNA RNA_Armature; -extern StructRNA RNA_BooleanProperty; +extern StructRNA RNA_BlenderRNA; extern StructRNA RNA_Bone; +extern StructRNA RNA_BooleanProperty; extern StructRNA RNA_Brush; extern StructRNA RNA_Camera; extern StructRNA RNA_CharInfo; extern StructRNA RNA_CollectionProperty; extern StructRNA RNA_CollisionSensor; +extern StructRNA RNA_ColorSequence; extern StructRNA RNA_Constraint; // ... constraint types... extern StructRNA RNA_Controller; @@ -55,6 +57,7 @@ extern StructRNA RNA_CurveMap; extern StructRNA RNA_CurveMapPoint; extern StructRNA RNA_CurveMapping; extern StructRNA RNA_DelaySensor; +extern StructRNA RNA_EffectSequence; extern StructRNA RNA_EnumProperty; extern StructRNA RNA_EnumPropertyItem; extern StructRNA RNA_ExpressionController; @@ -65,11 +68,13 @@ extern StructRNA RNA_GameIntProperty; extern StructRNA RNA_GameProperty; extern StructRNA RNA_GameStringProperty; extern StructRNA RNA_GameTimeProperty; +extern StructRNA RNA_GlowSequence; extern StructRNA RNA_Group; extern StructRNA RNA_ID; extern StructRNA RNA_IDProperty; extern StructRNA RNA_IDPropertyGroup; extern StructRNA RNA_Image; +extern StructRNA RNA_ImageSequence; extern StructRNA RNA_ImageUser; extern StructRNA RNA_IntProperty; extern StructRNA RNA_Ipo; @@ -77,7 +82,6 @@ extern StructRNA RNA_IpoCurve; extern StructRNA RNA_IpoDriver; extern StructRNA RNA_JoystickSensor; extern StructRNA RNA_Key; -extern StructRNA RNA_KeyBlock; extern StructRNA RNA_KeyboardSensor; extern StructRNA RNA_Lamp; extern StructRNA RNA_Lattice; @@ -104,8 +108,10 @@ extern StructRNA RNA_Mesh; extern StructRNA RNA_MessageSensor; extern StructRNA RNA_MetaBall; extern StructRNA RNA_MetaElement; -extern StructRNA RNA_ModifierData; +extern StructRNA RNA_MetaSequence; +extern StructRNA RNA_Modifier; extern StructRNA RNA_MouseSensor; +extern StructRNA RNA_MovieSequence; extern StructRNA RNA_NandController; extern StructRNA RNA_NearSensor; extern StructRNA RNA_Node; @@ -116,6 +122,7 @@ extern StructRNA RNA_Operator; extern StructRNA RNA_OrController; extern StructRNA RNA_PackedFile; extern StructRNA RNA_Panel; +extern StructRNA RNA_PluginSequence; extern StructRNA RNA_PointerProperty; extern StructRNA RNA_Property; extern StructRNA RNA_PropertySensor; @@ -126,18 +133,34 @@ extern StructRNA RNA_RandomSensor; extern StructRNA RNA_RaySensor; extern StructRNA RNA_Region; extern StructRNA RNA_Scene; +extern StructRNA RNA_SceneSequence; extern StructRNA RNA_ScrArea; extern StructRNA RNA_ScrEdge; extern StructRNA RNA_ScrVert; extern StructRNA RNA_Screen; extern StructRNA RNA_Sensor; +extern StructRNA RNA_Sequence; +extern StructRNA RNA_SequenceColorBalance; +extern StructRNA RNA_SequenceCrop; +extern StructRNA RNA_SequenceEditor; +extern StructRNA RNA_SequenceElement; +extern StructRNA RNA_SequenceProxy; +extern StructRNA RNA_SequenceTransform; +extern StructRNA RNA_ShapeKey; +extern StructRNA RNA_ShapeKeyBezierPoint; +extern StructRNA RNA_ShapeKeyCurvePoint; +extern StructRNA RNA_ShapeKeyPoint; +extern StructRNA RNA_SoundSequence; +extern StructRNA RNA_SpeedControlSequence; extern StructRNA RNA_StringProperty; extern StructRNA RNA_Struct; extern StructRNA RNA_TextBox; extern StructRNA RNA_TouchSensor; +extern StructRNA RNA_TransformSequence; extern StructRNA RNA_UnknownType; extern StructRNA RNA_VectorFont; extern StructRNA RNA_WindowManager; +extern StructRNA RNA_WipeSequence; extern StructRNA RNA_World; extern StructRNA RNA_XnorController; extern StructRNA RNA_XorController; @@ -149,12 +172,16 @@ extern StructRNA RNA_XorController; * - a pointer to a datablock can be created with the type and id data pointer * - a pointer to data contained in a datablock can be created with the id type * and id data pointer, and the data type and pointer to the struct itself. + * + * There is also a way to get a pointer with the information about all structs. */ void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr); void RNA_id_pointer_create(StructRNA *idtype, struct ID *id, PointerRNA *r_ptr); void RNA_pointer_create(StructRNA *idtype, struct ID *id, StructRNA *type, void *data, PointerRNA *r_ptr); +void RNA_blender_rna_pointer_create(PointerRNA *r_ptr); + /* Structs */ const char *RNA_struct_identifier(PointerRNA *ptr); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 2c9cb9f4dfa..0b15d4fa996 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -87,6 +87,14 @@ static void rna_pointer_inherit_id(PointerRNA *parent, PointerRNA *ptr) } } +void RNA_blender_rna_pointer_create(PointerRNA *r_ptr) +{ + r_ptr->id.type= NULL; + r_ptr->id.data= NULL; + r_ptr->type= &RNA_BlenderRNA; + r_ptr->data= &BLENDER_RNA; +} + /* ID Properties */ IDProperty *rna_idproperties_get(StructRNA *type, void *data, int create) diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 064f22d1508..d86ab720b90 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -52,6 +52,11 @@ static int rna_Struct_name_length(PointerRNA *ptr) return strlen(((StructRNA*)ptr->data)->name); } +static void *rna_Struct_from_get(PointerRNA *ptr) +{ + return ((StructRNA*)ptr->data)->from; +} + static void *rna_Struct_name_property_get(PointerRNA *ptr) { return ((StructRNA*)ptr->data)->nameproperty; @@ -368,6 +373,13 @@ static void *rna_CollectionProperty_fixed_type_get(PointerRNA *ptr) return ((CollectionPropertyRNA*)prop)->structtype; } +/* Blender RNA */ + +static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + rna_iterator_listbase_begin(iter, &((BlenderRNA*)ptr->data)->structs, NULL); +} + #else static void rna_def_struct(BlenderRNA *brna) @@ -388,6 +400,12 @@ static void rna_def_struct(BlenderRNA *brna) RNA_def_property_string_funcs(prop, "rna_Struct_identifier_get", "rna_Struct_identifier_length", NULL); RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting."); + prop= RNA_def_property(srna, "from", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_struct_type(prop, "Struct"); + RNA_def_property_pointer_funcs(prop, "rna_Struct_from_get", NULL, NULL); + RNA_def_property_ui_text(prop, "From", "Struct definition this is derived from."); + prop= RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_struct_type(prop, "StringProperty"); @@ -562,6 +580,7 @@ static void rna_def_pointer_property(StructRNA *srna, PropertyType type) void RNA_def_rna(BlenderRNA *brna) { StructRNA *srna; + PropertyRNA *prop; /* Struct*/ rna_def_struct(brna); @@ -596,6 +615,15 @@ void RNA_def_rna(BlenderRNA *brna) /* CollectionProperty */ srna= RNA_def_struct(brna, "CollectionProperty", "Property", "Collection Definition"); rna_def_pointer_property(srna, PROP_COLLECTION); + + /* Blender RNA */ + srna= RNA_def_struct(brna, "BlenderRNA", NULL, "Blender RNA"); + + prop= RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_struct_type(prop, "Struct"); + RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0); + RNA_def_property_ui_text(prop, "Structs", ""); } #endif diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 11dfcb6a210..0ec62cd5666 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -39,7 +39,7 @@ static StructRNA *rna_Operator_refine(PointerRNA *ptr) return op->type->srna; } -static void rna_Operator_name_get(PointerRNA *ptr, char *value) +/*static void rna_Operator_name_get(PointerRNA *ptr, char *value) { wmOperator *op= (wmOperator*)ptr->data; strcpy(value, op->type->name); @@ -49,7 +49,7 @@ static int rna_Operator_name_length(PointerRNA *ptr) { wmOperator *op= (wmOperator*)ptr->data; return strlen(op->type->name); -} +}*/ #else |