Blender  V2.93
idprop_py_api.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 struct BPy_IDGroup_Iter;
24 struct ID;
25 struct IDProperty;
26 
27 extern PyTypeObject BPy_IDArray_Type;
28 extern PyTypeObject BPy_IDGroup_Iter_Type;
29 extern PyTypeObject BPy_IDGroup_Type;
30 
31 #define BPy_IDArray_Check(v) (PyObject_TypeCheck(v, &BPy_IDArray_Type))
32 #define BPy_IDArray_CheckExact(v) (Py_TYPE(v) == &BPy_IDArray_Type)
33 #define BPy_IDGroup_Iter_Check(v) (PyObject_TypeCheck(v, &BPy_IDGroup_Iter_Type))
34 #define BPy_IDGroup_Iter_CheckExact(v) (Py_TYPE(v) == &BPy_IDGroup_Iter_Type)
35 #define BPy_IDGroup_Check(v) (PyObject_TypeCheck(v, &BPy_IDGroup_Type))
36 #define BPy_IDGroup_CheckExact(v) (Py_TYPE(v) == &BPy_IDGroup_Type)
37 
38 typedef struct BPy_IDProperty {
39  PyObject_VAR_HEAD
40  struct ID *id; /* can be NULL */
41  struct IDProperty *prop; /* must be second member */
42  struct IDProperty *parent;
44 
45 typedef struct BPy_IDArray {
46  PyObject_VAR_HEAD
47  struct ID *id; /* can be NULL */
48  struct IDProperty *prop; /* must be second member */
50 
51 typedef struct BPy_IDGroup_Iter {
52  PyObject_VAR_HEAD
54  struct IDProperty *cur;
55  int mode;
57 
58 PyObject *BPy_Wrap_GetKeys(struct IDProperty *prop);
59 PyObject *BPy_Wrap_GetValues(struct ID *id, struct IDProperty *prop);
60 PyObject *BPy_Wrap_GetItems(struct ID *id, struct IDProperty *prop);
61 int BPy_Wrap_SetMapItem(struct IDProperty *prop, PyObject *key, PyObject *val);
62 
63 PyObject *BPy_IDGroup_MapDataToPy(struct IDProperty *prop);
64 PyObject *BPy_IDGroup_WrapData(struct ID *id, struct IDProperty *prop, struct IDProperty *parent);
65 bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *key, struct IDProperty *group, PyObject *ob);
66 
67 void IDProp_Init_Types(void);
68 
69 PyObject *BPyInit_idprop(void);
70 
71 #define IDPROP_ITER_KEYS 0
72 #define IDPROP_ITER_ITEMS 1
void IDProp_Init_Types(void)
PyObject * BPy_IDGroup_MapDataToPy(struct IDProperty *prop)
bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *key, struct IDProperty *group, PyObject *ob)
struct BPy_IDGroup_Iter BPy_IDGroup_Iter
PyTypeObject BPy_IDGroup_Type
PyTypeObject BPy_IDArray_Type
PyTypeObject BPy_IDGroup_Iter_Type
struct BPy_IDProperty BPy_IDProperty
PyObject * BPy_Wrap_GetValues(struct ID *id, struct IDProperty *prop)
PyObject * BPyInit_idprop(void)
PyObject * BPy_Wrap_GetItems(struct ID *id, struct IDProperty *prop)
PyObject * BPy_IDGroup_WrapData(struct ID *id, struct IDProperty *prop, struct IDProperty *parent)
int BPy_Wrap_SetMapItem(struct IDProperty *prop, PyObject *key, PyObject *val)
PyObject * BPy_Wrap_GetKeys(struct IDProperty *prop)
struct BPy_IDArray BPy_IDArray
struct IDProperty * prop
Definition: idprop_py_api.h:48
PyObject_VAR_HEAD struct ID * id
Definition: idprop_py_api.h:47
struct IDProperty * cur
Definition: idprop_py_api.h:54
PyObject_VAR_HEAD BPy_IDProperty * group
Definition: idprop_py_api.h:53
struct IDProperty * parent
Definition: idprop_py_api.h:42
struct IDProperty * prop
Definition: idprop_py_api.h:41
PyObject_VAR_HEAD struct ID * id
Definition: idprop_py_api.h:40
Definition: DNA_ID.h:273