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>2008-11-01 02:50:02 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-01 02:50:02 +0300
commit7f24dbe5fc5a00ee161717070deb6baf4af8e83e (patch)
tree3d62a641123bdd8c61e9d2bf5b40203befac2597 /source/blender/makesrna/RNA_types.h
parentb589489ef8d56976165fb88ebf7b59dbc417d443 (diff)
RNA / Data API
This is the first code for the Data API, also known as RNA system in the 2.5 Branch. It does not include a user interface, and only wraps some Scene properties for testing. It is integrated with Scons and Makefiles, and compiles a 'makesrna' program that generates an RNA.c file. http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataAPI http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNA The changes are quite local, basically adding a makesrna module which works similar to the makesdna module. The one external change is in moving genfile.c from blenloader to the makesdna module, so that it can be reused by the RNA code. This also meant changing the DNA makefiles. It seems to be doing dependencies correct still in my tests, but if there is an issue with the DNA not being rebuilt this commit might be the one causing it. Also it seems for scons the makesdna and makesrna modules are compiling without warnings. Not a new issue but this should be fixed. The RNA code supports all types as defined in the Data API design, so in that sense it is fairly complete and I hope that aspect will not have to change much. Some obviously missing parts are context related code, notify() functions for updates and user defined / ID properties.
Diffstat (limited to 'source/blender/makesrna/RNA_types.h')
-rw-r--r--source/blender/makesrna/RNA_types.h247
1 files changed, 247 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
new file mode 100644
index 00000000000..9faa8b2fd8e
--- /dev/null
+++ b/source/blender/makesrna/RNA_types.h
@@ -0,0 +1,247 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contributor(s): Blender Foundation (2008).
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef RNA_TYPES
+#define RNA_TYPES
+
+#include "DNA_listBase.h"
+
+struct BlenderRNA;
+struct StructRNA;
+struct PropertyRNA;
+struct CollectionPropertyIterator;
+struct bContext;
+
+typedef void (*PropNotifyFunc)(struct bContext *C, void *data);
+typedef int (*PropBooleanGetFunc)(void *data);
+typedef void (*PropBooleanSetFunc)(void *data, int value);
+typedef int (*PropBooleanArrayGetFunc)(void *data, int index);
+typedef void (*PropBooleanArraySetFunc)(void *data, int index, int value);
+typedef int (*PropIntGetFunc)(void *data);
+typedef void (*PropIntSetFunc)(void *data, int value);
+typedef int (*PropIntArrayGetFunc)(void *data, int index);
+typedef void (*PropIntArraySetFunc)(void *data, int index, int value);
+typedef float (*PropFloatGetFunc)(void *data);
+typedef void (*PropFloatSetFunc)(void *data, float value);
+typedef float (*PropFloatArrayGetFunc)(void *data, int index);
+typedef void (*PropFloatArraySetFunc)(void *data, int index, float value);
+typedef void (*PropStringGetFunc)(void *data, char *value);
+typedef int (*PropStringLengthFunc)(void *data);
+typedef void (*PropStringSetFunc)(void *data, const char *value);
+typedef int (*PropEnumGetFunc)(void *data);
+typedef void (*PropEnumSetFunc)(void *data, int value);
+typedef void* (*PropPointerGetFunc)(void *data);
+typedef void (*PropPointerSetFunc)(void *data, void *value);
+typedef struct StructRNA* (*PropPointerTypeFunc)(void *data);
+typedef void (*PropCollectionBeginFunc)(struct CollectionPropertyIterator *iter, void *data);
+typedef void (*PropCollectionNextFunc)(struct CollectionPropertyIterator *iter);
+typedef void (*PropCollectionEndFunc)(struct CollectionPropertyIterator *iter);
+typedef void* (*PropCollectionGetFunc)(struct CollectionPropertyIterator *iter);
+typedef struct StructRNA* (*PropCollectionTypeFunc)(struct CollectionPropertyIterator *iter);
+typedef int (*PropCollectionLengthFunc)(void *data);
+typedef void* (*PropCollectionLookupIntFunc)(void *data, int key, struct StructRNA **type);
+typedef void* (*PropCollectionLookupStringFunc)(void *data, const char *key, struct StructRNA **type);
+
+typedef enum PropertyType {
+ PROP_BOOLEAN = 0,
+ PROP_INT = 1,
+ PROP_FLOAT = 2,
+ PROP_STRING = 3,
+ PROP_ENUM = 4,
+ PROP_POINTER = 5,
+ PROP_COLLECTION = 6
+} PropertyType;
+
+typedef enum PropertySubType {
+ PROP_NONE = 0,
+ PROP_UNSIGNED = 1,
+ PROP_FILEPATH = 2,
+ PROP_COLOR = 3,
+ PROP_VECTOR = 4,
+ PROP_MATRIX = 5,
+ PROP_ROTATION = 6
+} PropertySubType;
+
+typedef enum PropertyFlag {
+ PROP_EDITABLE = 1,
+ PROP_EVALUATEABLE = 2
+} PropertyFlag;
+
+typedef struct CollectionPropertyIterator {
+ void *internal;
+ int valid;
+} CollectionPropertyIterator;
+
+typedef struct PropertyEnumItem {
+ int value;
+ const char *cname;
+ const char *name;
+} PropertyEnumItem;
+
+typedef struct PropertyRNA {
+ struct PropertyRNA *next, *prev;
+
+ /* C code name */
+ const char *cname;
+ /* various options */
+ int flag;
+
+ /* user readable name */
+ const char *name;
+ /* single line description, displayed in the tooltip for example */
+ const char *description;
+
+ /* property type as it appears to the outside */
+ PropertyType type;
+ /* subtype, 'interpretation' of the property */
+ PropertySubType subtype;
+ /* if an array this is > 0, specifying the length */
+ unsigned int arraylength;
+
+ /* callback for notifys on change */
+ PropNotifyFunc notify;
+} PropertyRNA;
+
+/* information specific to the property type */
+typedef struct BooleanPropertyRNA {
+ PropertyRNA property;
+
+ PropBooleanGetFunc get;
+ PropBooleanSetFunc set;
+
+ PropBooleanArrayGetFunc getarray;
+ PropBooleanArraySetFunc setarray;
+
+ int defaultvalue;
+ const int *defaultarray;
+} BooleanPropertyRNA;
+
+typedef struct IntPropertyRNA {
+ PropertyRNA property;
+
+ PropIntGetFunc get;
+ PropIntSetFunc set;
+
+ PropIntArrayGetFunc getarray;
+ PropIntArraySetFunc setarray;
+
+ int softmin, softmax;
+ int hardmin, hardmax;
+ int step;
+
+ int defaultvalue;
+ const int *defaultarray;
+} IntPropertyRNA;
+
+typedef struct FloatPropertyRNA {
+ PropertyRNA property;
+
+ PropFloatGetFunc get;
+ PropFloatSetFunc set;
+
+ PropFloatArrayGetFunc getarray;
+ PropFloatArraySetFunc setarray;
+
+ float softmin, softmax;
+ float hardmin, hardmax;
+ float step, precision;
+
+ float defaultvalue;
+ const float *defaultarray;
+} FloatPropertyRNA;
+
+typedef struct StringPropertyRNA {
+ PropertyRNA property;
+
+ PropStringGetFunc get;
+ PropStringLengthFunc length;
+ PropStringSetFunc set;
+
+ int maxlength; /* includes string terminator! */
+
+ const char *defaultvalue;
+} StringPropertyRNA;
+
+typedef struct EnumPropertyRNA {
+ PropertyRNA property;
+
+ PropEnumGetFunc get;
+ PropEnumSetFunc set;
+
+ const PropertyEnumItem *item;
+ int totitem;
+
+ int defaultvalue;
+} EnumPropertyRNA;
+
+typedef struct PointerPropertyRNA {
+ PropertyRNA property;
+
+ PropPointerGetFunc get;
+ PropPointerSetFunc set;
+ PropPointerTypeFunc type; /* optional */
+
+ struct StructRNA *structtype;
+} PointerPropertyRNA;
+
+typedef struct CollectionPropertyRNA {
+ PropertyRNA property;
+
+ PropCollectionBeginFunc begin;
+ PropCollectionNextFunc next;
+ PropCollectionEndFunc end; /* optional */
+ PropCollectionGetFunc get;
+ PropCollectionTypeFunc type; /* optional */
+ PropCollectionLengthFunc length; /* optional */
+ PropCollectionLookupIntFunc lookupint; /* optional */
+ PropCollectionLookupStringFunc lookupstring; /* optional */
+
+ struct StructRNA *structtype;
+} CollectionPropertyRNA;
+
+typedef struct StructRNA {
+ struct StructRNA *next, *prev;
+
+ /* C code name */
+ const char *cname;
+ /* various options */
+ int flag;
+
+ /* user readable name */
+ const char *name;
+
+ /* property that defines the name */
+ PropertyRNA *nameproperty;
+
+ /* properties of this struct */
+ ListBase properties;
+} StructRNA;
+
+typedef struct BlenderRNA {
+ /* structs */
+ ListBase structs;
+} BlenderRNA;
+
+#endif /* RNA_TYPES */
+