84 "The Blender version as a tuple of 3 numbers (major, minor, micro). eg. (4, 3, 1)\n"
86 ":type: tuple[int, int, int]\n"},
88 "The Blender File version, as a tuple of 3 numbers (major, minor, file sub-version), that "
89 "will be used to save a .blend file. The last item in this tuple indicates the file "
90 "sub-version, which is different from the release micro version (the last item of the "
91 "``bpy.app.version`` tuple). The file sub-version can be incremented multiple times while a "
92 "Blender version is under development. This value is, and should be, used for handling "
93 "compatibility changes between Blender versions\n"
95 ":type: tuple[int, int, int]\n"},
97 "The Blender version formatted as a string\n"
101 "The release status of this build alpha/beta/rc/release\n"
105 "Boolean, True when blender is running without a user interface (started with -b)\n"
109 "Boolean, True when running Blender as a python module\n"
113 "Boolean, True when blender is running with --factory-startup\n"
117 "Boolean, True unless blender was built to reference absolute paths (on UNIX).\n"
123 "The date this blender instance was built\n"
127 "The time this blender instance was built\n"
130 {
"build_commit_timestamp",
131 "The unix timestamp of commit this blender instance was built\n"
134 {
"build_commit_date",
135 "The date of commit this blender instance was built\n"
138 {
"build_commit_time",
139 "The time of commit this blender instance was built\n"
143 "The commit hash this blender instance was built with\n"
147 "The branch this blender instance was built from\n"
151 "The platform this blender instance was built for\n"
155 "The type of build (Release, Debug)\n"
163 "C++ compiler flags\n"
167 "Binary linking flags\n"
171 "Build system used\n"
176 {
"alembic",
"Alembic library information backend"},
177 {
"usd",
"USD library information backend"},
178 {
"ffmpeg",
"FFmpeg library information backend"},
179 {
"ocio",
"OpenColorIO library information backend"},
180 {
"oiio",
"OpenImageIO library information backend"},
181 {
"opensubdiv",
"OpenSubdiv library information backend"},
182 {
"openvdb",
"OpenVDB library information backend"},
183 {
"sdl",
"SDL library information backend"},
184 {
"build_options",
"A set containing most important enabled optional build features"},
185 {
"handlers",
"Application handler callbacks"},
186 {
"translations",
"Application and addons internationalization API"},
189 {
"icons",
"Manage custom icons"},
190 {
"timers",
"Manage timers"},
197 "This module contains application values that remain unchanged during runtime.\n");
211 if (app_info ==
nullptr) {
214#define SetIntItem(flag) PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
215#define SetStrItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
216#define SetBytesItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
217#define SetObjItem(obj) PyStructSequence_SET_ITEM(app_info, pos++, obj)
227#ifdef WITH_PYTHON_MODULE
234#ifdef WITH_INSTALL_PORTABLE
293 if (PyErr_Occurred()) {
306 "Boolean, for debug info "
307 "(started with ``--debug`` / ``--debug-*`` matching this attribute name).\n"
313 return PyBool_FromLong(
G.debug &
flag);
319 const int param = PyObject_IsTrue(value);
322 PyErr_SetString(PyExc_TypeError,
"bpy.app.debug can only be True/False");
338 bpy_app_internet_offline_doc,
339 "Boolean, true when internet access is allowed by Blender & 3rd party scripts "
345 bpy_app_internet_offline_override_doc,
346 "Boolean, true when internet access preference is overridden by the command line "
352 bpy_app_global_flag_doc,
353 "Boolean, for application behavior "
354 "(started with ``--enable-*`` matching this attribute name)\n"
360 bpy_app_autoexec_fail_doc,
361 "Boolean, True when auto-execution of scripts failed (read-only).\n"
366 bpy_app_autoexec_fail_quiet_doc,
367 "Boolean, True when auto-execution failure should be quiet, set after the warning is shown "
368 "once for the current blend file (read-only).\n"
375 return PyBool_FromLong(
G.f &
flag);
381 const int param = PyObject_IsTrue(value);
384 PyErr_SetString(PyExc_TypeError,
"bpy.app.use_* can only be True/False");
402 const int param = PyObject_IsTrue(value);
404 PyErr_SetString(PyExc_ValueError,
"This bpy.app.use_* option can only be disabled");
412 bpy_app_debug_value_doc,
413 "Short, number which can be set to non-zero values for testing purposes.\n"
418 return PyLong_FromLong(
G.debug_value);
425 if (param == -1 && PyErr_Occurred()) {
427 "bpy.app.debug_value can only be set to a whole number");
431 G.debug_value = param;
441 "String, the temp directory used by blender (read-only).\n"
451 bpy_app_driver_dict_doc,
452 "Dictionary for drivers namespace, editable in-place, reset on file load (read-only).\n"
454 ":type: dict[str, Any]\n");
459 PyErr_SetString(PyExc_RuntimeError,
"bpy.app.driver_namespace failed to create dictionary");
469 bpy_app_preview_render_size_doc,
470 "Reference size for icon/preview renders (read-only).\n"
475 return PyLong_FromLong(
481 bpy_app_autoexec_fail_message_doc,
482 "String, message describing the auto-execution failure (read-only).\n"
493 bpy_app_python_args_doc,
494 "Leading arguments to use when calling Python directly (via ``sys.executable``). "
495 "These arguments match settings Blender uses to "
496 "ensure Python runs with a compatible environment (read-only).\n"
498 ":type: tuple[str, ...]\n");
505 args[args_num++] =
"-I";
512 bpy_app_binary_path_doc,
513 "The location of Blender's executable, useful for utilities that open new instances. "
514 "Read-only unless Blender is built as a Python module - in this case the value is "
515 "an empty string which script authors may point to a Blender binary.\n"
525#ifndef WITH_PYTHON_MODULE
526 PyErr_SetString(PyExc_AttributeError,
527 "bpy.app.binary_path is only writable when built as a Python module");
530 PyObject *value_coerce =
nullptr;
532 if (filepath ==
nullptr) {
533 PyErr_Format(PyExc_ValueError,
"expected a string or bytes, got %s", Py_TYPE(value)->tp_name);
537 Py_XDECREF(value_coerce);
569 {
"debug_depsgraph_build",
574 {
"debug_depsgraph_eval",
579 {
"debug_depsgraph_tag",
584 {
"debug_depsgraph_time",
589 {
"debug_depsgraph_pretty",
601 {
"use_event_simulate",
604 bpy_app_global_flag_doc,
607 {
"use_userpref_skip_save_on_exit",
610 bpy_app_global_flag_doc,
616 bpy_app_debug_value_doc,
624 bpy_app_preview_render_size_doc,
626 {
"render_preview_size",
629 bpy_app_preview_render_size_doc,
635 bpy_app_internet_offline_doc,
637 {
"online_access_override",
640 bpy_app_internet_offline_override_doc,
647 bpy_app_autoexec_fail_doc,
649 {
"autoexec_fail_quiet",
652 bpy_app_autoexec_fail_quiet_doc,
654 {
"autoexec_fail_message",
657 bpy_app_autoexec_fail_message_doc,
667 bpy_app_binary_path_doc,
670 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr},
675 bpy_app_is_job_running_doc,
676 ".. staticmethod:: is_job_running(job_type)\n"
678 " Check whether a job of the given type is running.\n"
680 " :arg job_type: job type in :ref:`rna_enum_wm_job_type_items`.\n"
681 " :type job_type: str\n"
682 " :return: Whether a job of the given type is currently running.\n"
688 job_type_enum.
value = 0;
690 static const char *_keywords[] = {
"job_type",
nullptr};
691 static _PyArg_Parser _parser = {
698 if (!_PyArg_ParseTupleAndKeywordsFast(
712char *(*BPY_python_app_help_text_fn)(
bool all) =
nullptr;
716 bpy_app_help_text_doc,
717 ".. staticmethod:: help_text(*, all=False)\n"
719 " Return the help text as a string.\n"
721 " :arg all: Return all arguments, "
722 "even those which aren't available for the current platform.\n"
724 " :return: Help text.\n"
729 static const char *_keywords[] = {
"all",
nullptr};
730 static _PyArg_Parser _parser = {
738 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser,
PyC_ParseBool, &
all)) {
743 PyObject *
result = PyUnicode_FromString(buf);
750# pragma clang diagnostic push
751# pragma clang diagnostic ignored "-Wcast-function-type"
753# pragma GCC diagnostic push
754# pragma GCC diagnostic ignored "-Wcast-function-type"
759 bpy_app_memory_usage_undo_doc,
760 ".. staticmethod:: memory_usage_undo()\n"
762 " Get undo memory usage information.\n"
764 " :return: Memory usage of the undo stack in bytes.\n"
769 size_t total_memory = 0;
774 return PyLong_FromSize_t(total_memory);
780 METH_VARARGS | METH_KEYWORDS | METH_STATIC,
781 bpy_app_is_job_running_doc},
784 METH_VARARGS | METH_KEYWORDS | METH_STATIC,
785 bpy_app_help_text_doc},
786 {
"memory_usage_undo",
788 METH_NOARGS | METH_STATIC,
789 bpy_app_memory_usage_undo_doc},
790 {
nullptr,
nullptr, 0,
nullptr},
795# pragma clang diagnostic pop
797# pragma GCC diagnostic pop
813 for (PyMethodDef *method =
bpy_app_methods; method->ml_name; method++) {
814 BLI_assert_msg(method->ml_flags & METH_STATIC,
"Only static methods make sense for 'bpy.app'");
815 PyObject *item = PyCFunction_New(method,
nullptr);
816 PyDict_SetItemString(
BlenderAppType.tp_dict, method->ml_name, item);
const char * BKE_appdir_program_path() ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
void BKE_appdir_program_path_init(const char *argv0) ATTR_NONNULL(1)
#define BLENDER_VERSION_PATCH
const char * BKE_blender_version_string(void)
#define BLENDER_VERSION_CYCLE
#define BLENDER_FILE_SUBVERSION
#define BLENDER_FILE_VERSION
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET
@ G_FLAG_USERPREF_NO_SAVE_ON_EXIT
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL
@ G_DEBUG_DEPSGRAPH_PRETTY
@ G_DEBUG_DEPSGRAPH_BUILD
#define G_FLAG_INTERNET_OVERRIDE_PREF_ANY
#define BLI_assert_msg(a, msg)
#define POINTER_AS_INT(i)
bool BPY_python_use_system_env_get()
UndoStack * ED_undo_stack_get()
size_t ED_undosys_total_memory_calc(UndoStack *ustack)
bool GPU_shader_batch_is_compiling()
Read Guarded memory(de)allocation.
int UI_icon_preview_to_render_size(enum eIconSizes size)
@ WM_JOB_TYPE_SHADER_COMPILATION
static int bpy_app_binary_path_set(PyObject *, PyObject *value, void *)
static PyObject * bpy_app_debug_value_get(PyObject *, void *)
PyDoc_STRVAR(bpy_app_doc, "This module contains application values that remain unchanged during runtime.\n")
static void py_struct_seq_getset_init()
static PyObject * bpy_app_autoexec_fail_message_get(PyObject *, void *)
static PyStructSequence_Field app_info_fields[]
static PyObject * bpy_app_tempdir_get(PyObject *, void *)
static int bpy_app_debug_value_set(PyObject *, PyObject *value, void *)
static PyObject * make_app_info()
static PyObject * bpy_app_preview_render_size_get(PyObject *, void *closure)
static int bpy_app_global_flag_set(PyObject *, PyObject *value, void *closure)
PyObject * BPY_app_struct()
#define SetBytesItem(str)
static PyGetSetDef bpy_app_getsets[]
static PyObject * bpy_app_global_flag_get(PyObject *, void *closure)
static int bpy_app_global_flag_set__only_disable(PyObject *, PyObject *value, void *closure)
ulong build_commit_timestamp
static PyObject * bpy_app_memory_usage_undo(PyObject *, PyObject *)
static int bpy_app_debug_set(PyObject *, PyObject *value, void *closure)
static PyObject * bpy_app_python_args_get(PyObject *, void *)
static PyObject * bpy_app_binary_path_get(PyObject *, void *)
char *(* BPY_python_app_help_text_fn)(bool all)
static void py_struct_seq_method_init()
static PyMethodDef bpy_app_methods[]
static PyStructSequence_Desc app_info_desc
static PyObject * bpy_app_driver_dict_get(PyObject *, void *)
static PyObject * bpy_app_debug_get(PyObject *, void *closure)
static PyTypeObject BlenderAppType
static PyObject * bpy_app_help_text(PyObject *, PyObject *args, PyObject *kwds)
static PyObject * bpy_app_is_job_running(PyObject *, PyObject *args, PyObject *kwds)
PyObject * BPY_app_alembic_struct()
PyObject * BPY_app_build_options_struct()
PyObject * BPY_app_ffmpeg_struct()
PyObject * BPY_app_handlers_struct()
PyObject * BPY_app_icons_module()
PyObject * BPY_app_ocio_struct()
PyObject * BPY_app_oiio_struct()
PyObject * BPY_app_opensubdiv_struct()
PyObject * BPY_app_openvdb_struct()
PyObject * BPY_app_sdl_struct()
PyObject * BPY_app_timers_module()
PyObject * BPY_app_translations_struct()
PyObject * BPY_app_usd_struct()
PyObject * bpy_pydriver_Dict
int bpy_pydriver_create_dict()
bool all(VecOp< bool, D >) RET
void MEM_freeN(void *vmemh)
int pyrna_enum_value_parse_string(PyObject *o, void *p)
int16_t PyC_Long_AsI16(PyObject *value)
PyObject * PyC_Err_SetString_Prefix(PyObject *exception_type_prefix, const char *str)
PyObject * PyC_UnicodeFromBytes(const char *str)
PyObject * PyC_Tuple_PackArray_String(const char **array, uint len)
int PyC_ParseBool(PyObject *o, void *p)
const char * PyC_UnicodeAsBytes(PyObject *py_str, PyObject **r_coerce)
PyObject * PyC_Tuple_Pack_I32(const blender::Span< int > values)
header-only compatibility defines.
#define PY_ARG_PARSER_HEAD_COMPAT()
const EnumPropertyItem rna_enum_wm_job_type_items[]
const EnumPropertyItem * items
void * BKE_tempdir_session
void WM_main_add_notifier(uint type, void *reference)
bool WM_jobs_has_running_type(const wmWindowManager *wm, int job_type)