| 
									
										
										
										
											2008-12-28 08:41:49 +00:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * $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, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
										
											2008-12-28 08:41:49 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Contributor(s): Campbell Barton | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** END GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <Python.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-21 16:03:26 +00:00
										 |  |  | #ifndef BPY_UTIL_H
 | 
					
						
							|  |  |  | #define BPY_UTIL_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-10 00:07:34 +00:00
										 |  |  | #if PY_VERSION_HEX <  0x03010000
 | 
					
						
							| 
									
										
										
										
											2009-08-10 02:07:34 +00:00
										 |  |  | #error "Python versions below 3.1 are not supported anymore, you'll need to update your python."
 | 
					
						
							| 
									
										
										
										
											2009-08-10 00:07:34 +00:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-01 12:43:07 +00:00
										 |  |  | #include "RNA_types.h" /* for EnumPropertyItem only */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct EnumPropertyItem; | 
					
						
							| 
									
										
										
										
											2009-04-19 13:37:59 +00:00
										 |  |  | struct ReportList; | 
					
						
							| 
									
										
										
										
											2009-03-20 10:51:58 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-28 08:41:49 +00:00
										 |  |  | void PyObSpit(char *name, PyObject *var); | 
					
						
							| 
									
										
										
										
											2009-03-02 20:18:29 +00:00
										 |  |  | void PyLineSpit(void); | 
					
						
							| 
									
										
										
										
											2009-02-28 13:27:45 +00:00
										 |  |  | void BPY_getFileAndNum(char **filename, int *lineno); | 
					
						
							| 
									
										
										
										
											2009-03-18 22:22:58 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-14 12:53:47 +00:00
										 |  |  | PyObject *BPY_exception_buffer(void); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-18 22:22:58 +00:00
										 |  |  | /* own python like utility function */ | 
					
						
							|  |  |  | PyObject *PyObject_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...); | 
					
						
							| 
									
										
										
										
											2009-03-21 16:03:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-01 12:43:07 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* 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 */ | 
					
						
							| 
									
										
										
										
											2010-03-22 09:30:00 +00:00
										 |  |  | 	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 		len;		/* only for string types currently */ | 
					
						
							| 
									
										
										
										
											2009-04-01 12:43:07 +00:00
										 |  |  | 	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); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-11 16:17:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-10 04:50:48 +00:00
										 |  |  | #define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
 | 
					
						
							| 
									
										
										
										
											2009-04-11 16:17:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-19 13:37:59 +00:00
										 |  |  | /* error reporting */ | 
					
						
							|  |  |  | int BPy_reports_to_error(struct ReportList *reports); | 
					
						
							| 
									
										
										
										
											2009-06-14 12:53:47 +00:00
										 |  |  | int BPy_errors_to_report(struct ReportList *reports); | 
					
						
							| 
									
										
										
										
											2009-04-19 13:37:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-25 13:48:44 +00:00
										 |  |  | /* TODO - find a better solution! */ | 
					
						
							|  |  |  | struct bContext *BPy_GetContext(void); | 
					
						
							|  |  |  | void BPy_SetContext(struct bContext *C); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-07 16:20:19 +00:00
										 |  |  | extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate); | 
					
						
							|  |  |  | extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-01 10:51:34 +00:00
										 |  |  | int BPyAsPrimitiveArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix); | 
					
						
							| 
									
										
										
										
											2009-03-21 16:03:26 +00:00
										 |  |  | #endif
 |