Cleanup: remove compilation warning in previous commit.
[blender-staging.git] / source / blender / python / BPY_extern.h
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
17 /** \file
18  * \ingroup python
19  */
20
21 #pragma once
22
23 struct AnimationEvalContext;
24 struct ARegionType;
25 struct ChannelDriver; /* DNA_anim_types.h */
26 struct ID;            /* DNA_ID.h */
27 struct ListBase;      /* DNA_listBase.h */
28 struct Object;        /* DNA_object_types.h */
29 struct PathResolvedRNA;
30 struct Text;              /* defined in DNA_text_types.h */
31 struct bConstraint;       /* DNA_constraint_types.h */
32 struct bConstraintOb;     /* DNA_constraint_types.h */
33 struct bConstraintTarget; /* DNA_constraint_types.h*/
34 struct bContext;
35 struct bContextDataResult;
36 struct bPythonConstraint; /* DNA_constraint_types.h */
37 struct wmWindowManager;
38
39 #include "BLI_utildefines.h"
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 void BPY_pyconstraint_exec(struct bPythonConstraint *con,
46                            struct bConstraintOb *cob,
47                            struct ListBase *targets);
48 //  void BPY_pyconstraint_settings(void *arg1, void *arg2);
49 void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct);
50 void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con);
51 int BPY_is_pyconstraint(struct Text *text);
52 //  void BPY_free_pyconstraint_links(struct Text *text);
53
54 /* global interpreter lock */
55
56 typedef void *BPy_ThreadStatePtr;
57
58 BPy_ThreadStatePtr BPY_thread_save(void);
59 void BPY_thread_restore(BPy_ThreadStatePtr tstate);
60
61 /* our own wrappers to Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS */
62 #define BPy_BEGIN_ALLOW_THREADS \
63   { \
64     BPy_ThreadStatePtr _bpy_saved_tstate = BPY_thread_save(); \
65     (void)0
66 #define BPy_END_ALLOW_THREADS \
67   BPY_thread_restore(_bpy_saved_tstate); \
68   } \
69   (void)0
70
71 void BPY_text_free_code(struct Text *text);
72 void BPY_modules_update(void);
73 void BPY_modules_load_user(struct bContext *C);
74
75 void BPY_app_handlers_reset(const short do_all);
76
77 void BPY_driver_reset(void);
78 float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
79                       struct ChannelDriver *driver,
80                       struct ChannelDriver *driver_orig,
81                       const struct AnimationEvalContext *anim_eval_context);
82
83 void BPY_DECREF(void *pyob_ptr); /* Py_DECREF() */
84 void BPY_DECREF_RNA_INVALIDATE(void *pyob_ptr);
85 int BPY_context_member_get(struct bContext *C,
86                            const char *member,
87                            struct bContextDataResult *result);
88 void BPY_context_set(struct bContext *C);
89 void BPY_context_update(struct bContext *C);
90
91 #define BPY_context_dict_clear_members(C, ...) \
92   BPY_context_dict_clear_members_array(&((C)->data.py_context), \
93                                        (C)->data.py_context_orig, \
94                                        ((const char *[]){__VA_ARGS__}), \
95                                        VA_NARGS_COUNT(__VA_ARGS__))
96 void BPY_context_dict_clear_members_array(void **dict_p,
97                                           void *dict_orig,
98                                           const char *context_members[],
99                                           uint context_members_len);
100
101 void BPY_id_release(struct ID *id);
102
103 bool BPY_string_is_keyword(const char *str);
104
105 /* bpy_rna_callback.c */
106 void BPY_callback_screen_free(struct ARegionType *art);
107 void BPY_callback_wm_free(struct wmWindowManager *wm);
108
109 /* I18n for addons */
110 #ifdef WITH_INTERNATIONAL
111 const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *msgid);
112 #endif
113
114 #ifdef __cplusplus
115 } /* extern "C" */
116 #endif