Python Panels WIP

- Register python panels
- Added a generic class checking function BPY_class_validate() for panels/operators.
- No button drawing yet

Brecht, Added RNA_enum_value_from_id() and RNA_enum_id_from_value() to rna_access.c to do lookups between identifiers and values of EnumPropertyItem's, Not sure if these should go here.
This commit is contained in:
2009-04-01 12:43:07 +00:00
parent 3a28a74505
commit 3224efc384
18 changed files with 299 additions and 153 deletions

View File

@@ -28,6 +28,9 @@
#define BPY_UTIL_H
#include "bpy_compat.h"
#include "RNA_types.h" /* for EnumPropertyItem only */
struct EnumPropertyItem;
/* for internal use only, so python can interchange a sequence of strings with flags */
typedef struct BPY_flag_def {
@@ -46,4 +49,22 @@ void BPY_getFileAndNum(char **filename, int *lineno);
/* own python like utility function */
PyObject *PyObject_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
/* Class type checking, use for checking classes can be added as operators, panels etc */
typedef struct BPY_class_attr_check {
const char *name; /* name of the class attribute */
char type; /* 's' = string, 'f' = function, 'l' = list, (add as needed) */
int arg_count; /* only for function types, -1 for undefined, includes self arg */
int flag; /* other options */
} BPY_class_attr_check;
/* BPY_class_attr_check, flag */
#define BPY_CLASS_ATTR_OPTIONAL 1
#define BPY_CLASS_ATTR_NONE_OK 2
int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_class, BPY_class_attr_check* class_attrs, PyObject **py_class_attrs);
char *BPy_enum_as_string(struct EnumPropertyItem *item);
#endif