diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-07 04:49:39 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-07 04:49:39 +0400 |
commit | 767db1b71674efb599f03b5892c32d207647acd3 (patch) | |
tree | fc64129bea43fe563bc0ad1448e17405e1b04bb0 /source/blender/makesrna/intern/rna_internal_types.h | |
parent | 88ab62c03189a04f6a74b040ad269e5a901c4af1 (diff) |
RNA: Commit of the API patch by vekoon. This adds Functions to RNA,
which can be defined to call C functions with defined parameters.
* Parameters are RNA properties, with the same types.
* Parameters are stored in a ParameterList, which is like a small
stack with the values. This is then used to call the C function.
* Includes Python integration.
* Only one test function is part of this commit, ID.rename.
* Integration with the editors/ module is not included in this
commit, there's some issues to be worked out for that still.
Diffstat (limited to 'source/blender/makesrna/intern/rna_internal_types.h')
-rw-r--r-- | source/blender/makesrna/intern/rna_internal_types.h | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index bc0c2a07b35..5e44b7f7452 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -28,6 +28,7 @@ #include "DNA_listBase.h" struct BlenderRNA; +struct ContainerRNA; struct StructRNA; struct PropertyRNA; struct PointerRNA; @@ -72,6 +73,40 @@ typedef int (*PropCollectionLengthFunc)(struct PointerRNA *ptr); typedef PointerRNA (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr, int key); typedef PointerRNA (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char *key); +/* Container - generic abstracted container of RNA properties */ +typedef struct ContainerRNA { + void *next, *prev; + + ListBase properties; +} ContainerRNA; + +struct ParameterList { + /* storage for parameters */ + void *data; + + /* function passed at creation time */ + FunctionRNA *func; +}; + +struct FunctionRNA { + /* structs are containers of properties */ + ContainerRNA cont; + + /* unique identifier */ + const char *identifier; + /* various options */ + int flag; + + /* single line description, displayed in the tooltip for example */ + const char *description; + + /* callback to execute the function */ + CallFunc call; + + /* parameter for the return value */ + PropertyRNA *ret; +}; + struct PropertyRNA { struct PropertyRNA *next, *prev; @@ -207,7 +242,8 @@ typedef struct CollectionPropertyRNA { /* changes to this struct require updating rna_generate_struct in makesrna.c */ struct StructRNA { - struct StructRNA *next, *prev; + /* structs are containers of properties */ + ContainerRNA cont; /* python type, this is a subtype of pyrna_struct_Type but used so each struct can have its own type * which is useful for subclassing RNA */ @@ -244,8 +280,8 @@ struct StructRNA { /* function to find path to this struct in an ID */ StructPathFunc path; - /* properties of this struct */ - ListBase properties; + /* functions of this struct */ + ListBase functions; }; /* Blender RNA |