| 
									
										
										
										
											2011-02-23 10:52:22 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  |  * ***** 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. | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Contributor(s): Campbell Barton | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** END GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-27 20:10:08 +00:00
										 |  |  | /** \file blender/python/intern/bpy_app.c
 | 
					
						
							|  |  |  |  *  \ingroup pythonintern | 
					
						
							| 
									
										
										
										
											2011-11-05 08:21:12 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This file defines a 'PyStructSequence' accessed via 'bpy.app', mostly | 
					
						
							|  |  |  |  * exposing static applications variables such as version and buildinfo | 
					
						
							|  |  |  |  * however some writable variables have been added such as 'debug' and 'tempdir' | 
					
						
							| 
									
										
										
										
											2011-02-27 20:10:08 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 04:15:25 +00:00
										 |  |  | #include <Python.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | #include "bpy_app.h"
 | 
					
						
							| 
									
										
										
										
											2011-06-24 16:54:30 +00:00
										 |  |  | #include "bpy_app_handlers.h"
 | 
					
						
							| 
									
										
										
										
											2011-02-14 04:15:25 +00:00
										 |  |  | #include "bpy_driver.h"
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-14 17:18:36 +00:00
										 |  |  | #include "BLI_path_util.h"
 | 
					
						
							| 
									
										
										
										
											2011-01-07 18:36:47 +00:00
										 |  |  | #include "BLI_utildefines.h"
 | 
					
						
							| 
									
										
										
										
											2010-03-14 17:18:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-07 19:18:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | #include "BKE_blender.h"
 | 
					
						
							|  |  |  | #include "BKE_global.h"
 | 
					
						
							|  |  |  | #include "structseq.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-13 14:14:22 +00:00
										 |  |  | #include "../generic/py_capi_utils.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | #ifdef BUILD_DATE
 | 
					
						
							| 
									
										
										
										
											2010-03-14 17:18:36 +00:00
										 |  |  | extern char build_date[]; | 
					
						
							|  |  |  | extern char build_time[]; | 
					
						
							|  |  |  | extern char build_rev[]; | 
					
						
							|  |  |  | extern char build_platform[]; | 
					
						
							|  |  |  | extern char build_type[]; | 
					
						
							| 
									
										
										
										
											2010-10-18 12:56:14 +00:00
										 |  |  | extern char build_cflags[]; | 
					
						
							|  |  |  | extern char build_cxxflags[]; | 
					
						
							|  |  |  | extern char build_linkflags[]; | 
					
						
							| 
									
										
										
										
											2010-10-19 05:00:36 +00:00
										 |  |  | extern char build_system[]; | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyTypeObject BlenderAppType; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-19 11:12:48 +00:00
										 |  |  | static PyStructSequence_Field app_info_fields[]= { | 
					
						
							| 
									
										
										
										
											2010-12-03 17:05:21 +00:00
										 |  |  | 	{(char *)"version", (char *)"The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"}, | 
					
						
							|  |  |  | 	{(char *)"version_string", (char *)"The Blender version formatted as a string"}, | 
					
						
							| 
									
										
										
										
											2011-04-01 15:13:58 +00:00
										 |  |  | 	{(char *)"version_char", (char *)"The Blender version character (for minor releases)"}, | 
					
						
							|  |  |  | 	{(char *)"version_cycle", (char *)"The release status of this build alpha/beta/rc/release"}, | 
					
						
							| 
									
										
										
										
											2010-12-03 17:05:21 +00:00
										 |  |  | 	{(char *)"binary_path", (char *)"The location of blenders executable, useful for utilities that spawn new instances"}, | 
					
						
							|  |  |  | 	{(char *)"background", (char *)"Boolean, True when blender is running without a user interface (started with -b)"}, | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* buildinfo */ | 
					
						
							| 
									
										
										
										
											2010-12-03 17:05:21 +00:00
										 |  |  | 	{(char *)"build_date", (char *)"The date this blender instance was built"}, | 
					
						
							|  |  |  | 	{(char *)"build_time", (char *)"The time this blender instance was built"}, | 
					
						
							|  |  |  | 	{(char *)"build_revision", (char *)"The subversion revision this blender instance was built with"}, | 
					
						
							|  |  |  | 	{(char *)"build_platform", (char *)"The platform this blender instance was built for"}, | 
					
						
							|  |  |  | 	{(char *)"build_type", (char *)"The type of build (Release, Debug)"}, | 
					
						
							| 
									
										
										
										
											2010-12-06 12:36:55 +00:00
										 |  |  | 	{(char *)"build_cflags", (char *)"C compiler flags"}, | 
					
						
							|  |  |  | 	{(char *)"build_cxxflags", (char *)"C++ compiler flags"}, | 
					
						
							|  |  |  | 	{(char *)"build_linkflags", (char *)"Binary linking flags"}, | 
					
						
							|  |  |  | 	{(char *)"build_system", (char *)"Build system used"}, | 
					
						
							| 
									
										
										
										
											2011-06-24 16:54:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* submodules */ | 
					
						
							|  |  |  | 	{(char *)"handlers", (char *)"Application handler callbacks"}, | 
					
						
							| 
									
										
										
										
											2011-02-13 10:52:18 +00:00
										 |  |  | 	{NULL} | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-19 11:12:48 +00:00
										 |  |  | static PyStructSequence_Desc app_info_desc= { | 
					
						
							| 
									
										
										
										
											2010-12-03 17:05:21 +00:00
										 |  |  | 	(char *)"bpy.app",     /* name */ | 
					
						
							|  |  |  | 	(char *)"This module contains application values that remain unchanged during runtime.",    /* doc */ | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | 	app_info_fields,    /* fields */ | 
					
						
							| 
									
										
										
										
											2010-05-18 15:57:51 +00:00
										 |  |  | 	(sizeof(app_info_fields)/sizeof(PyStructSequence_Field)) - 1 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-12 17:58:54 +00:00
										 |  |  | #define DO_EXPAND(VAL)  VAL ## 1
 | 
					
						
							|  |  |  | #define EXPAND(VAL)     DO_EXPAND(VAL)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | static PyObject *make_app_info(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	PyObject *app_info; | 
					
						
							| 
									
										
										
										
											2011-03-19 11:12:48 +00:00
										 |  |  | 	int pos= 0; | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-19 11:12:48 +00:00
										 |  |  | 	app_info= PyStructSequence_New(&BlenderAppType); | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | 	if (app_info == NULL) { | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SetIntItem(flag) \
 | 
					
						
							|  |  |  | 	PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag)) | 
					
						
							| 
									
										
										
										
											2010-02-12 21:45:47 +00:00
										 |  |  | #define SetStrItem(str) \
 | 
					
						
							|  |  |  | 	PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str)) | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | #define SetObjItem(obj) \
 | 
					
						
							|  |  |  | 	PyStructSequence_SET_ITEM(app_info, pos++, obj) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION)); | 
					
						
							|  |  |  | 	SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION)); | 
					
						
							| 
									
										
										
										
											2011-04-12 17:58:54 +00:00
										 |  |  | #if defined(BLENDER_VERSION_CHAR) && EXPAND(BLENDER_VERSION_CHAR) != 1
 | 
					
						
							| 
									
										
										
										
											2011-04-01 15:13:58 +00:00
										 |  |  | 	SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR)); | 
					
						
							| 
									
										
										
										
											2011-04-12 17:58:54 +00:00
										 |  |  | #else
 | 
					
						
							|  |  |  | 	SetStrItem(""); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2011-04-01 14:04:26 +00:00
										 |  |  | 	SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE)); | 
					
						
							| 
									
										
										
										
											2011-10-21 17:37:38 +00:00
										 |  |  | 	SetStrItem(BLI_program_path()); | 
					
						
							| 
									
										
										
										
											2010-05-18 15:57:51 +00:00
										 |  |  | 	SetObjItem(PyBool_FromLong(G.background)); | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* build info */ | 
					
						
							| 
									
										
										
										
											2010-02-28 22:48:50 +00:00
										 |  |  | #ifdef BUILD_DATE
 | 
					
						
							| 
									
										
										
										
											2010-03-14 17:18:36 +00:00
										 |  |  | 	SetStrItem(build_date); | 
					
						
							|  |  |  | 	SetStrItem(build_time); | 
					
						
							|  |  |  | 	SetStrItem(build_rev); | 
					
						
							|  |  |  | 	SetStrItem(build_platform); | 
					
						
							|  |  |  | 	SetStrItem(build_type); | 
					
						
							| 
									
										
										
										
											2010-10-18 12:56:14 +00:00
										 |  |  | 	SetStrItem(build_cflags); | 
					
						
							|  |  |  | 	SetStrItem(build_cxxflags); | 
					
						
							|  |  |  | 	SetStrItem(build_linkflags); | 
					
						
							| 
									
										
										
										
											2010-10-19 05:00:36 +00:00
										 |  |  | 	SetStrItem(build_system); | 
					
						
							| 
									
										
										
										
											2010-02-28 22:48:50 +00:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2010-10-13 00:08:24 +00:00
										 |  |  | 	SetStrItem("Unknown"); | 
					
						
							|  |  |  | 	SetStrItem("Unknown"); | 
					
						
							| 
									
										
										
										
											2010-10-19 05:00:36 +00:00
										 |  |  | 	SetStrItem("Unknown"); | 
					
						
							| 
									
										
										
										
											2010-10-13 00:08:24 +00:00
										 |  |  | 	SetStrItem("Unknown"); | 
					
						
							|  |  |  | 	SetStrItem("Unknown"); | 
					
						
							|  |  |  | 	SetStrItem("Unknown"); | 
					
						
							| 
									
										
										
										
											2010-10-18 12:56:14 +00:00
										 |  |  | 	SetStrItem("Unknown"); | 
					
						
							|  |  |  | 	SetStrItem("Unknown"); | 
					
						
							|  |  |  | 	SetStrItem("Unknown"); | 
					
						
							| 
									
										
										
										
											2010-02-28 22:48:50 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-24 16:54:30 +00:00
										 |  |  | 	SetObjItem(BPY_app_handlers_struct()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | #undef SetIntItem
 | 
					
						
							|  |  |  | #undef SetStrItem
 | 
					
						
							|  |  |  | #undef SetObjItem
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (PyErr_Occurred()) { | 
					
						
							|  |  |  | 		Py_CLEAR(app_info); | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return app_info; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | /* a few getsets because it makes sense for them to be in bpy.app even though
 | 
					
						
							|  |  |  |  * they are not static */ | 
					
						
							| 
									
										
										
										
											2011-11-26 15:18:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(bpy_app_debug_doc, | 
					
						
							|  |  |  | "Boolean, set when blender is running in debug mode (started with --debug)" | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2010-10-13 23:25:08 +00:00
										 |  |  | static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure)) | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	return PyBool_FromLong(G.f & G_DEBUG); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-13 23:25:08 +00:00
										 |  |  | static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	int param= PyObject_IsTrue(value); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-13 01:29:08 +00:00
										 |  |  | 	if (param < 0) { | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | 		PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False"); | 
					
						
							|  |  |  | 		return -1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-10-13 01:29:08 +00:00
										 |  |  | 	if (param)  G.f |=  G_DEBUG; | 
					
						
							|  |  |  | 	else        G.f &= ~G_DEBUG; | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-26 15:18:30 +00:00
										 |  |  | PyDoc_STRVAR(bpy_app_debug_value_doc, | 
					
						
							|  |  |  | "Int, number which can be set to non-zero values for testing purposes" | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2010-12-15 06:03:45 +00:00
										 |  |  | static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return PyLong_FromSsize_t(G.rt); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int param= PyLong_AsSsize_t(value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (param == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  | 		PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number"); | 
					
						
							|  |  |  | 		return -1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	G.rt= param; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-26 15:18:30 +00:00
										 |  |  | PyDoc_STRVAR(bpy_app_tempdir_doc, | 
					
						
							|  |  |  | "String, the temp directory used by blender (read-only)" | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2010-10-13 23:25:08 +00:00
										 |  |  | static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-10-21 17:37:38 +00:00
										 |  |  | 	return PyC_UnicodeFromByte(BLI_temporary_dir()); | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-26 15:18:30 +00:00
										 |  |  | PyDoc_STRVAR(bpy_app_driver_dict_doc, | 
					
						
							|  |  |  | "Dictionary for drivers namespace, editable in-place, reset on file load (read-only)" | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2010-11-27 02:39:51 +00:00
										 |  |  | static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(closure)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (bpy_pydriver_Dict == NULL) | 
					
						
							|  |  |  | 		if (bpy_pydriver_create_dict() != 0) { | 
					
						
							|  |  |  | 			PyErr_SetString(PyExc_RuntimeError, "bpy.app.driver_namespace failed to create dictionary"); | 
					
						
							|  |  |  | 			return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Py_INCREF(bpy_pydriver_Dict); | 
					
						
							|  |  |  | 	return bpy_pydriver_Dict; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-13 10:52:18 +00:00
										 |  |  | static PyGetSetDef bpy_app_getsets[]= { | 
					
						
							| 
									
										
										
										
											2011-11-26 15:18:30 +00:00
										 |  |  | 	{(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, NULL}, | 
					
						
							|  |  |  | 	{(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)bpy_app_debug_value_doc, NULL}, | 
					
						
							|  |  |  | 	{(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)bpy_app_tempdir_doc, NULL}, | 
					
						
							|  |  |  | 	{(char *)"driver_namespace", bpy_app_driver_dict_get, NULL, (char *)bpy_app_driver_dict_doc, NULL}, | 
					
						
							| 
									
										
										
										
											2010-11-27 02:39:51 +00:00
										 |  |  | 	{NULL, NULL, NULL, NULL, NULL} | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static void py_struct_seq_getset_init(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/* tricky dynamic members, not to py-spec! */ | 
					
						
							| 
									
										
										
										
											2010-11-27 02:39:51 +00:00
										 |  |  | 	PyGetSetDef *getset; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-13 01:29:08 +00:00
										 |  |  | 	for (getset= bpy_app_getsets; getset->name; getset++) { | 
					
						
							| 
									
										
										
										
											2010-11-27 02:39:51 +00:00
										 |  |  | 		PyDict_SetItemString(BlenderAppType.tp_dict, getset->name, PyDescr_NewGetSet(&BlenderAppType, getset)); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | } | 
					
						
							|  |  |  | /* end dynamic bpy.app */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | PyObject *BPY_app_struct(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	PyObject *ret; | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | 	PyStructSequence_InitType(&BlenderAppType, &app_info_desc); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ret= make_app_info(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* prevent user from creating new instances */ | 
					
						
							| 
									
										
										
										
											2011-03-19 11:12:48 +00:00
										 |  |  | 	BlenderAppType.tp_init= NULL; | 
					
						
							|  |  |  | 	BlenderAppType.tp_new= NULL; | 
					
						
							| 
									
										
										
										
											2011-12-16 00:06:01 +00:00
										 |  |  | 	BlenderAppType.tp_hash= (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */ | 
					
						
							| 
									
										
										
										
											2010-10-12 23:47:43 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* kindof a hack ontop of PyStructSequence */ | 
					
						
							|  |  |  | 	py_struct_seq_getset_init(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-31 23:49:04 +00:00
										 |  |  | 	return ret; | 
					
						
							| 
									
										
										
										
											2010-01-31 23:41:46 +00:00
										 |  |  | } |