forked from bartvdbraak/blender
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);
This commit is contained in:
parent
a1e0868018
commit
c13bb258b1
@ -40,13 +40,15 @@ extern StructRNA RNA_ActuatorSensor;
|
|||||||
extern StructRNA RNA_AlwaysSensor;
|
extern StructRNA RNA_AlwaysSensor;
|
||||||
extern StructRNA RNA_AndController;
|
extern StructRNA RNA_AndController;
|
||||||
extern StructRNA RNA_Armature;
|
extern StructRNA RNA_Armature;
|
||||||
extern StructRNA RNA_BooleanProperty;
|
extern StructRNA RNA_BlenderRNA;
|
||||||
extern StructRNA RNA_Bone;
|
extern StructRNA RNA_Bone;
|
||||||
|
extern StructRNA RNA_BooleanProperty;
|
||||||
extern StructRNA RNA_Brush;
|
extern StructRNA RNA_Brush;
|
||||||
extern StructRNA RNA_Camera;
|
extern StructRNA RNA_Camera;
|
||||||
extern StructRNA RNA_CharInfo;
|
extern StructRNA RNA_CharInfo;
|
||||||
extern StructRNA RNA_CollectionProperty;
|
extern StructRNA RNA_CollectionProperty;
|
||||||
extern StructRNA RNA_CollisionSensor;
|
extern StructRNA RNA_CollisionSensor;
|
||||||
|
extern StructRNA RNA_ColorSequence;
|
||||||
extern StructRNA RNA_Constraint;
|
extern StructRNA RNA_Constraint;
|
||||||
// ... constraint types...
|
// ... constraint types...
|
||||||
extern StructRNA RNA_Controller;
|
extern StructRNA RNA_Controller;
|
||||||
@ -55,6 +57,7 @@ extern StructRNA RNA_CurveMap;
|
|||||||
extern StructRNA RNA_CurveMapPoint;
|
extern StructRNA RNA_CurveMapPoint;
|
||||||
extern StructRNA RNA_CurveMapping;
|
extern StructRNA RNA_CurveMapping;
|
||||||
extern StructRNA RNA_DelaySensor;
|
extern StructRNA RNA_DelaySensor;
|
||||||
|
extern StructRNA RNA_EffectSequence;
|
||||||
extern StructRNA RNA_EnumProperty;
|
extern StructRNA RNA_EnumProperty;
|
||||||
extern StructRNA RNA_EnumPropertyItem;
|
extern StructRNA RNA_EnumPropertyItem;
|
||||||
extern StructRNA RNA_ExpressionController;
|
extern StructRNA RNA_ExpressionController;
|
||||||
@ -65,11 +68,13 @@ extern StructRNA RNA_GameIntProperty;
|
|||||||
extern StructRNA RNA_GameProperty;
|
extern StructRNA RNA_GameProperty;
|
||||||
extern StructRNA RNA_GameStringProperty;
|
extern StructRNA RNA_GameStringProperty;
|
||||||
extern StructRNA RNA_GameTimeProperty;
|
extern StructRNA RNA_GameTimeProperty;
|
||||||
|
extern StructRNA RNA_GlowSequence;
|
||||||
extern StructRNA RNA_Group;
|
extern StructRNA RNA_Group;
|
||||||
extern StructRNA RNA_ID;
|
extern StructRNA RNA_ID;
|
||||||
extern StructRNA RNA_IDProperty;
|
extern StructRNA RNA_IDProperty;
|
||||||
extern StructRNA RNA_IDPropertyGroup;
|
extern StructRNA RNA_IDPropertyGroup;
|
||||||
extern StructRNA RNA_Image;
|
extern StructRNA RNA_Image;
|
||||||
|
extern StructRNA RNA_ImageSequence;
|
||||||
extern StructRNA RNA_ImageUser;
|
extern StructRNA RNA_ImageUser;
|
||||||
extern StructRNA RNA_IntProperty;
|
extern StructRNA RNA_IntProperty;
|
||||||
extern StructRNA RNA_Ipo;
|
extern StructRNA RNA_Ipo;
|
||||||
@ -77,7 +82,6 @@ extern StructRNA RNA_IpoCurve;
|
|||||||
extern StructRNA RNA_IpoDriver;
|
extern StructRNA RNA_IpoDriver;
|
||||||
extern StructRNA RNA_JoystickSensor;
|
extern StructRNA RNA_JoystickSensor;
|
||||||
extern StructRNA RNA_Key;
|
extern StructRNA RNA_Key;
|
||||||
extern StructRNA RNA_KeyBlock;
|
|
||||||
extern StructRNA RNA_KeyboardSensor;
|
extern StructRNA RNA_KeyboardSensor;
|
||||||
extern StructRNA RNA_Lamp;
|
extern StructRNA RNA_Lamp;
|
||||||
extern StructRNA RNA_Lattice;
|
extern StructRNA RNA_Lattice;
|
||||||
@ -104,8 +108,10 @@ extern StructRNA RNA_Mesh;
|
|||||||
extern StructRNA RNA_MessageSensor;
|
extern StructRNA RNA_MessageSensor;
|
||||||
extern StructRNA RNA_MetaBall;
|
extern StructRNA RNA_MetaBall;
|
||||||
extern StructRNA RNA_MetaElement;
|
extern StructRNA RNA_MetaElement;
|
||||||
extern StructRNA RNA_ModifierData;
|
extern StructRNA RNA_MetaSequence;
|
||||||
|
extern StructRNA RNA_Modifier;
|
||||||
extern StructRNA RNA_MouseSensor;
|
extern StructRNA RNA_MouseSensor;
|
||||||
|
extern StructRNA RNA_MovieSequence;
|
||||||
extern StructRNA RNA_NandController;
|
extern StructRNA RNA_NandController;
|
||||||
extern StructRNA RNA_NearSensor;
|
extern StructRNA RNA_NearSensor;
|
||||||
extern StructRNA RNA_Node;
|
extern StructRNA RNA_Node;
|
||||||
@ -116,6 +122,7 @@ extern StructRNA RNA_Operator;
|
|||||||
extern StructRNA RNA_OrController;
|
extern StructRNA RNA_OrController;
|
||||||
extern StructRNA RNA_PackedFile;
|
extern StructRNA RNA_PackedFile;
|
||||||
extern StructRNA RNA_Panel;
|
extern StructRNA RNA_Panel;
|
||||||
|
extern StructRNA RNA_PluginSequence;
|
||||||
extern StructRNA RNA_PointerProperty;
|
extern StructRNA RNA_PointerProperty;
|
||||||
extern StructRNA RNA_Property;
|
extern StructRNA RNA_Property;
|
||||||
extern StructRNA RNA_PropertySensor;
|
extern StructRNA RNA_PropertySensor;
|
||||||
@ -126,18 +133,34 @@ extern StructRNA RNA_RandomSensor;
|
|||||||
extern StructRNA RNA_RaySensor;
|
extern StructRNA RNA_RaySensor;
|
||||||
extern StructRNA RNA_Region;
|
extern StructRNA RNA_Region;
|
||||||
extern StructRNA RNA_Scene;
|
extern StructRNA RNA_Scene;
|
||||||
|
extern StructRNA RNA_SceneSequence;
|
||||||
extern StructRNA RNA_ScrArea;
|
extern StructRNA RNA_ScrArea;
|
||||||
extern StructRNA RNA_ScrEdge;
|
extern StructRNA RNA_ScrEdge;
|
||||||
extern StructRNA RNA_ScrVert;
|
extern StructRNA RNA_ScrVert;
|
||||||
extern StructRNA RNA_Screen;
|
extern StructRNA RNA_Screen;
|
||||||
extern StructRNA RNA_Sensor;
|
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_StringProperty;
|
||||||
extern StructRNA RNA_Struct;
|
extern StructRNA RNA_Struct;
|
||||||
extern StructRNA RNA_TextBox;
|
extern StructRNA RNA_TextBox;
|
||||||
extern StructRNA RNA_TouchSensor;
|
extern StructRNA RNA_TouchSensor;
|
||||||
|
extern StructRNA RNA_TransformSequence;
|
||||||
extern StructRNA RNA_UnknownType;
|
extern StructRNA RNA_UnknownType;
|
||||||
extern StructRNA RNA_VectorFont;
|
extern StructRNA RNA_VectorFont;
|
||||||
extern StructRNA RNA_WindowManager;
|
extern StructRNA RNA_WindowManager;
|
||||||
|
extern StructRNA RNA_WipeSequence;
|
||||||
extern StructRNA RNA_World;
|
extern StructRNA RNA_World;
|
||||||
extern StructRNA RNA_XnorController;
|
extern StructRNA RNA_XnorController;
|
||||||
extern StructRNA RNA_XorController;
|
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 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
|
* - 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.
|
* 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_main_pointer_create(struct Main *main, PointerRNA *r_ptr);
|
||||||
void RNA_id_pointer_create(StructRNA *idtype, struct ID *id, 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_pointer_create(StructRNA *idtype, struct ID *id, StructRNA *type, void *data, PointerRNA *r_ptr);
|
||||||
|
|
||||||
|
void RNA_blender_rna_pointer_create(PointerRNA *r_ptr);
|
||||||
|
|
||||||
/* Structs */
|
/* Structs */
|
||||||
|
|
||||||
const char *RNA_struct_identifier(PointerRNA *ptr);
|
const char *RNA_struct_identifier(PointerRNA *ptr);
|
||||||
|
@ -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 */
|
/* ID Properties */
|
||||||
|
|
||||||
IDProperty *rna_idproperties_get(StructRNA *type, void *data, int create)
|
IDProperty *rna_idproperties_get(StructRNA *type, void *data, int create)
|
||||||
|
@ -52,6 +52,11 @@ static int rna_Struct_name_length(PointerRNA *ptr)
|
|||||||
return strlen(((StructRNA*)ptr->data)->name);
|
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)
|
static void *rna_Struct_name_property_get(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
return ((StructRNA*)ptr->data)->nameproperty;
|
return ((StructRNA*)ptr->data)->nameproperty;
|
||||||
@ -368,6 +373,13 @@ static void *rna_CollectionProperty_fixed_type_get(PointerRNA *ptr)
|
|||||||
return ((CollectionPropertyRNA*)prop)->structtype;
|
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
|
#else
|
||||||
|
|
||||||
static void rna_def_struct(BlenderRNA *brna)
|
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_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.");
|
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);
|
prop= RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
|
||||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||||
RNA_def_property_struct_type(prop, "StringProperty");
|
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)
|
void RNA_def_rna(BlenderRNA *brna)
|
||||||
{
|
{
|
||||||
StructRNA *srna;
|
StructRNA *srna;
|
||||||
|
PropertyRNA *prop;
|
||||||
|
|
||||||
/* Struct*/
|
/* Struct*/
|
||||||
rna_def_struct(brna);
|
rna_def_struct(brna);
|
||||||
@ -596,6 +615,15 @@ void RNA_def_rna(BlenderRNA *brna)
|
|||||||
/* CollectionProperty */
|
/* CollectionProperty */
|
||||||
srna= RNA_def_struct(brna, "CollectionProperty", "Property", "Collection Definition");
|
srna= RNA_def_struct(brna, "CollectionProperty", "Property", "Collection Definition");
|
||||||
rna_def_pointer_property(srna, PROP_COLLECTION);
|
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
|
#endif
|
||||||
|
@ -39,7 +39,7 @@ static StructRNA *rna_Operator_refine(PointerRNA *ptr)
|
|||||||
return op->type->srna;
|
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;
|
wmOperator *op= (wmOperator*)ptr->data;
|
||||||
strcpy(value, op->type->name);
|
strcpy(value, op->type->name);
|
||||||
@ -49,7 +49,7 @@ static int rna_Operator_name_length(PointerRNA *ptr)
|
|||||||
{
|
{
|
||||||
wmOperator *op= (wmOperator*)ptr->data;
|
wmOperator *op= (wmOperator*)ptr->data;
|
||||||
return strlen(op->type->name);
|
return strlen(op->type->name);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user