Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy_app.c
| Show First 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *closure) | ||||
| } | } | ||||
| if (param) G.debug |= flag; | if (param) G.debug |= flag; | ||||
| else G.debug &= ~flag; | else G.debug &= ~flag; | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| PyDoc_STRVAR(bpy_app_global_flag_doc, | |||||
| "Boolean, for application behavior (started with --enable-* matching this attribute name)" | |||||
| ); | |||||
| static PyObject *bpy_app_global_flag_get(PyObject *UNUSED(self), void *closure) | |||||
| { | |||||
| const int flag = POINTER_AS_INT(closure); | |||||
| return PyBool_FromLong(G.f & flag); | |||||
| } | |||||
| static int bpy_app_global_flag_set(PyObject *UNUSED(self), PyObject *value, void *closure) | |||||
| { | |||||
| const int flag = POINTER_AS_INT(closure); | |||||
| const int param = PyObject_IsTrue(value); | |||||
| if (param == -1) { | |||||
| PyErr_SetString(PyExc_TypeError, "bpy.app.use_* can only be True/False"); | |||||
| return -1; | |||||
| } | |||||
| if (param) G.f |= flag; | |||||
| else G.f &= ~flag; | |||||
| return 0; | |||||
| } | |||||
| static int bpy_app_global_flag_set__only_disable(PyObject *UNUSED(self), PyObject *value, void *closure) | |||||
| { | |||||
| const int param = PyObject_IsTrue(value); | |||||
| if (param == 1) { | |||||
| PyErr_SetString(PyExc_ValueError, "This bpy.app.use_* option can only be disabled"); | |||||
| return -1; | |||||
| } | |||||
| return bpy_app_global_flag_set(NULL, value, closure); | |||||
| } | |||||
| #define BROKEN_BINARY_PATH_PYTHON_HACK | #define BROKEN_BINARY_PATH_PYTHON_HACK | ||||
| PyDoc_STRVAR(bpy_app_binary_path_python_doc, | PyDoc_STRVAR(bpy_app_binary_path_python_doc, | ||||
| "String, the path to the python executable (read-only)" | "String, the path to the python executable (read-only)" | ||||
| ); | ); | ||||
| static PyObject *bpy_app_binary_path_python_get(PyObject *self, void *UNUSED(closure)) | static PyObject *bpy_app_binary_path_python_get(PyObject *self, void *UNUSED(closure)) | ||||
| { | { | ||||
| /* refcount is held in BlenderAppType.tp_dict */ | /* refcount is held in BlenderAppType.tp_dict */ | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) | ||||
| G.debug_value = param; | G.debug_value = param; | ||||
| WM_main_add_notifier(NC_WINDOW, NULL); | WM_main_add_notifier(NC_WINDOW, NULL); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| static PyObject *bpy_app_global_flag_get(PyObject *UNUSED(self), void *closure) | |||||
| { | |||||
| const int flag = POINTER_AS_INT(closure); | |||||
| return PyBool_FromLong(G.f & flag); | |||||
| } | |||||
| PyDoc_STRVAR(bpy_app_tempdir_doc, | PyDoc_STRVAR(bpy_app_tempdir_doc, | ||||
| "String, the temp directory used by blender (read-only)" | "String, the temp directory used by blender (read-only)" | ||||
| ); | ); | ||||
| static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) | static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) | ||||
| { | { | ||||
| return PyC_UnicodeFromByte(BKE_tempdir_session()); | return PyC_UnicodeFromByte(BKE_tempdir_session()); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | static PyGetSetDef bpy_app_getsets[] = { | ||||
| {(char *)"debug_depsgraph_tag", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_TAG}, | {(char *)"debug_depsgraph_tag", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_TAG}, | ||||
| {(char *)"debug_depsgraph_time", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_TIME}, | {(char *)"debug_depsgraph_time", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_TIME}, | ||||
| {(char *)"debug_depsgraph_pretty", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_PRETTY}, | {(char *)"debug_depsgraph_pretty", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_PRETTY}, | ||||
| {(char *)"debug_simdata", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_SIMDATA}, | {(char *)"debug_simdata", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_SIMDATA}, | ||||
| {(char *)"debug_gpumem", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_GPU_MEM}, | {(char *)"debug_gpumem", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_GPU_MEM}, | ||||
| {(char *)"debug_io", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_IO}, | {(char *)"debug_io", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_IO}, | ||||
| {(char *)"use_static_override", bpy_app_use_static_override_get, bpy_app_use_static_override_set, (char *)bpy_app_use_static_override_doc, NULL}, | {(char *)"use_static_override", bpy_app_use_static_override_get, bpy_app_use_static_override_set, (char *)bpy_app_use_static_override_doc, NULL}, | ||||
| {(char *)"use_event_simulate", bpy_app_global_flag_get, bpy_app_global_flag_set__only_disable, (char *)bpy_app_global_flag_doc, (void *)G_EVENT_SIMULATE}, | |||||
| {(char *)"binary_path_python", bpy_app_binary_path_python_get, NULL, (char *)bpy_app_binary_path_python_doc, NULL}, | {(char *)"binary_path_python", bpy_app_binary_path_python_get, NULL, (char *)bpy_app_binary_path_python_doc, NULL}, | ||||
| {(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)bpy_app_debug_value_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 *)"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}, | {(char *)"driver_namespace", bpy_app_driver_dict_get, NULL, (char *)bpy_app_driver_dict_doc, NULL}, | ||||
| {(char *)"render_icon_size", bpy_app_preview_render_size_get, NULL, (char *)bpy_app_preview_render_size_doc, (void *)ICON_SIZE_ICON}, | {(char *)"render_icon_size", bpy_app_preview_render_size_get, NULL, (char *)bpy_app_preview_render_size_doc, (void *)ICON_SIZE_ICON}, | ||||
| Show All 39 Lines | |||||