Blender  V2.59
bpy_util.h
Go to the documentation of this file.
00001 /*
00002  * $Id: bpy_util.h 35496 2011-03-12 15:18:08Z campbellbarton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Campbell Barton
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #ifndef BPY_UTIL_H
00031 #define BPY_UTIL_H
00032 
00033 #if PY_VERSION_HEX <  0x03020000
00034 #error "Python 3.2 or greater is required, you'll need to update your python."
00035 #endif
00036 
00037 #include "RNA_types.h" /* for EnumPropertyItem only */
00038 
00039 struct EnumPropertyItem;
00040 struct ReportList;
00041 
00042 char *BPy_enum_as_string(struct EnumPropertyItem *item);
00043 
00044 #define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) NULL}
00045 
00046 /* error reporting */
00047 short BPy_reports_to_error(struct ReportList *reports, PyObject *exception, const short clear);
00048 short BPy_errors_to_report(struct ReportList *reports);
00049 
00050 /* TODO - find a better solution! */
00051 struct bContext *BPy_GetContext(void);
00052 void BPy_SetContext(struct bContext *C);
00053 
00054 extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate);
00055 extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate);
00056 #endif