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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-04-19 17:37:59 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-04-19 17:37:59 +0400
commitadff6aeb1c749183921c0facd373972bbeb874b4 (patch)
tree07987d408713eee8a3dd8bb5cb4ecf3c112de654 /source/blender/makesrna/RNA_access.h
parentd880257d165888638b7c924fb6ef7071343b783e (diff)
RNA: Generic Type Registration
The Python API to define Panels and Operators is based on subclassing, this makes that system more generic, and based on RNA. Hopefully that will make it easy to make various parts of Blender more extensible. * The system simply uses RNA properties and functions and marks them with REGISTER to make them part of the type registration process. Additionally, the struct must provide a register/unregister callback to create/free the PanelType or similar. * From the python side there were some small changes, mainly that registration now goes trough bpy.types.register instead of bpy.ui.addPanel. * Only Panels have been wrapped this way now. Check rna_ui.c to see how this code works. There's still some rough edges and possibilities to make it cleaner, though it works without any manual python code. * Started some docs here: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNATypeRegistration * Also changed some RNA_property and RNA_struct functions to not require a PointerRNA anymore, where they were not required (which is actually the cause of most changed files).
Diffstat (limited to 'source/blender/makesrna/RNA_access.h')
-rw-r--r--source/blender/makesrna/RNA_access.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 7c7ecf29bb9..5795bfe5b26 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -321,19 +321,25 @@ void RNA_blender_rna_pointer_create(PointerRNA *r_ptr);
/* Structs */
-const char *RNA_struct_identifier(PointerRNA *ptr);
-const char *RNA_struct_ui_name(PointerRNA *ptr);
-const char *RNA_struct_ui_description(PointerRNA *ptr);
+const char *RNA_struct_identifier(StructRNA *type);
+const char *RNA_struct_ui_name(StructRNA *type);
+const char *RNA_struct_ui_description(StructRNA *type);
-PropertyRNA *RNA_struct_name_property(PointerRNA *ptr);
-PropertyRNA *RNA_struct_iterator_property(PointerRNA *ptr);
+PropertyRNA *RNA_struct_name_property(StructRNA *type);
+PropertyRNA *RNA_struct_iterator_property(StructRNA *type);
-int RNA_struct_is_ID(PointerRNA *ptr);
-int RNA_struct_is_a(PointerRNA *ptr, StructRNA *srna);
+int RNA_struct_is_ID(StructRNA *type);
+int RNA_struct_is_a(StructRNA *type, StructRNA *srna);
+
+StructRegisterFunc RNA_struct_register(StructRNA *type);
+StructUnregisterFunc RNA_struct_unregister(StructRNA *type);
void *RNA_struct_py_type_get(StructRNA *srna);
void RNA_struct_py_type_set(StructRNA *srna, void *py_type);
+void *RNA_struct_blender_type_get(StructRNA *srna);
+void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type);
+
PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier);
const struct ListBase *RNA_struct_defined_properties(StructRNA *srna);
@@ -347,12 +353,20 @@ const struct ListBase *RNA_struct_defined_functions(StructRNA *srna);
/* Property Information */
-const char *RNA_property_identifier(PointerRNA *ptr, PropertyRNA *prop);
-PropertyType RNA_property_type(PointerRNA *ptr, PropertyRNA *prop);
-PropertySubType RNA_property_subtype(PointerRNA *ptr, PropertyRNA *prop);
-int RNA_property_flag(PointerRNA *ptr, PropertyRNA *prop);
+const char *RNA_property_identifier(PropertyRNA *prop);
+PropertyType RNA_property_type(PropertyRNA *prop);
+PropertySubType RNA_property_subtype(PropertyRNA *prop);
+int RNA_property_flag(PropertyRNA *prop);
+
+int RNA_property_array_length(PropertyRNA *prop);
+
+StructRNA *RNA_property_pointer_type(PropertyRNA *prop);
+int RNA_property_string_maxlength(PropertyRNA *prop);
-int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop);
+const char *RNA_property_ui_name(PropertyRNA *prop);
+const char *RNA_property_ui_description(PropertyRNA *prop);
+
+/* Dynamic Property Information */
void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, int *hardmax);
void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, int *softmax, int *step);
@@ -360,16 +374,10 @@ void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin,
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax);
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision);
-int RNA_property_string_maxlength(PointerRNA *ptr, PropertyRNA *prop);
-StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop);
-
void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **item, int *totitem);
int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value);
int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier);
-const char *RNA_property_ui_name(PointerRNA *ptr, PropertyRNA *prop);
-const char *RNA_property_ui_description(PointerRNA *ptr, PropertyRNA *prop);
-
int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop);
int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop);
int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop);
@@ -518,13 +526,14 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop);
/* Function */
-const char *RNA_function_identifier(PointerRNA *ptr, FunctionRNA *func);
-PropertyRNA *RNA_function_return(PointerRNA *ptr, FunctionRNA *func);
-const char *RNA_function_ui_description(PointerRNA *ptr, FunctionRNA *func);
+const char *RNA_function_identifier(FunctionRNA *func);
+PropertyRNA *RNA_function_return(FunctionRNA *func);
+const char *RNA_function_ui_description(FunctionRNA *func);
+int RNA_function_flag(FunctionRNA *func);
PropertyRNA *RNA_function_get_parameter(PointerRNA *ptr, FunctionRNA *func, int index);
PropertyRNA *RNA_function_find_parameter(PointerRNA *ptr, FunctionRNA *func, const char *identifier);
-const struct ListBase *RNA_function_defined_parameters(PointerRNA *ptr, FunctionRNA *func);
+const struct ListBase *RNA_function_defined_parameters(FunctionRNA *func);
/* Utility */