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_types.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_types.h')
-rw-r--r--source/blender/makesrna/RNA_types.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 2020ca1edb8..69d9a6db7ce 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -35,6 +35,8 @@ struct PropertyRNA;
struct StructRNA;
struct BlenderRNA;
struct IDProperty;
+struct bContext;
+struct ReportList;
/* Pointer
*
@@ -91,6 +93,11 @@ typedef enum PropertyFlag {
/* function paramater flags */
PROP_REQUIRED = 4,
+ PROP_RETURN = 8,
+
+ /* registering */
+ PROP_REGISTER = 16,
+ PROP_REGISTER_OPTIONAL = 16|32,
/* internal flags */
PROP_BUILTIN = 128,
@@ -147,6 +154,10 @@ typedef struct ParameterIterator {
typedef enum FunctionFlag {
FUNC_TYPESTATIC = 1, /* for static functions, FUNC_ STATIC is taken by some windows header it seems */
+ /* registering */
+ FUNC_REGISTER = 2,
+ FUNC_REGISTER_OPTIONAL = 2|4,
+
/* internal flags */
FUNC_BUILTIN = 128,
FUNC_EXPORT = 256,
@@ -168,6 +179,13 @@ typedef enum StructFlag {
STRUCT_GENERATED = 4
} StructFlag;
+typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);
+typedef int (*StructCallbackFunc)(struct PointerRNA *ptr, struct FunctionRNA *func, struct ParameterList *list);
+typedef void (*StructFreeFunc)(void *data);
+typedef struct StructRNA *(*StructRegisterFunc)(const struct bContext *C, struct ReportList *reports, void *data,
+ StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
+typedef void (*StructUnregisterFunc)(const struct bContext *C, struct StructRNA *type);
+
typedef struct StructRNA StructRNA;
/* Blender RNA