87 "The Blender version as a tuple of 3 numbers (major, minor, micro). eg. (4, 3, 1)\n"
89 ":type: tuple[int, int, int]\n"},
91 "The Blender File version, as a tuple of 3 numbers (major, minor, file sub-version), that "
92 "will be used to save a .blend file. The last item in this tuple indicates the file "
93 "sub-version, which is different from the release micro version (the last item of the "
94 "``bpy.app.version`` tuple). The file sub-version can be incremented multiple times while a "
95 "Blender version is under development. This value is, and should be, used for handling "
96 "compatibility changes between Blender versions\n"
98 ":type: tuple[int, int, int]\n"},
100 "The Blender version formatted as a string\n"
104 "The release status of this build alpha/beta/rc/release\n"
108 "Boolean, True when blender is running without a user interface (started with -b)\n"
112 "Boolean, True when running Blender as a python module\n"
116 "Boolean, True when blender is running with --factory-startup\n"
120 "Boolean, True unless blender was built to reference absolute paths (on UNIX).\n"
126 "The date this Blender instance was built\n"
130 "The time this Blender instance was built\n"
133 {
"build_commit_timestamp",
134 "The unix timestamp of the commit this Blender instance was built from\n"
137 {
"build_commit_date",
138 "The date of the commit this Blender instance was built from\n"
141 {
"build_commit_time",
142 "The time of the commit this Blender instance was built from\n"
146 "The commit hash this Blender instance was built with\n"
150 "The branch this blender instance was built from\n"
154 "The platform this blender instance was built for\n"
158 "The type of build (Release, Debug)\n"
166 "C++ compiler flags\n"
170 "Binary linking flags\n"
174 "Build system used\n"
179 {
"alembic",
"Alembic library information backend"},
180 {
"usd",
"USD library information backend"},
181 {
"ffmpeg",
"FFmpeg library information backend"},
182 {
"ocio",
"OpenColorIO library information backend"},
183 {
"oiio",
"OpenImageIO library information backend"},
184 {
"opensubdiv",
"OpenSubdiv library information backend"},
185 {
"openvdb",
"OpenVDB library information backend"},
186 {
"sdl",
"SDL library information backend"},
187 {
"build_options",
"A set containing most important enabled optional build features"},
188 {
"handlers",
"Application handler callbacks"},
189 {
"translations",
"Application and addons internationalization API"},
192 {
"icons",
"Manage custom icons"},
193 {
"timers",
"Manage timers"},
200 "This module contains application values that remain unchanged during runtime.\n");
214 if (app_info ==
nullptr) {
217#define SetIntItem(flag) PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
218#define SetStrItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
219#define SetBytesItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
220#define SetObjItem(obj) PyStructSequence_SET_ITEM(app_info, pos++, obj)
230#ifdef WITH_PYTHON_MODULE
237#ifdef WITH_INSTALL_PORTABLE
296 if (PyErr_Occurred()) {
309 "Boolean, for debug info "
310 "(started with ``--debug`` / ``--debug-*`` matching this attribute name).\n"
316 return PyBool_FromLong(
G.debug & flag);
322 const int param = PyObject_IsTrue(value);
325 PyErr_SetString(PyExc_TypeError,
"bpy.app.debug can only be True/False");
341 bpy_app_internet_offline_doc,
342 "Boolean, true when internet access is allowed by Blender & 3rd party scripts "
348 bpy_app_internet_offline_override_doc,
349 "Boolean, true when internet access preference is overridden by the command line "
355 bpy_app_global_flag_doc,
356 "Boolean, for application behavior "
357 "(started with ``--enable-*`` matching this attribute name)\n"
363 bpy_app_autoexec_doc,
364 "Boolean, True when auto-execution is allowed (read-only).\n"
369 bpy_app_autoexec_override_doc,
370 "The auto-execution set by the command line, None when the preference isn't overridden "
373 ":type: bool | None\n");
376 bpy_app_autoexec_fail_doc,
377 "Boolean, True when auto-execution of scripts failed (read-only).\n"
382 bpy_app_autoexec_fail_quiet_doc,
383 "Boolean, True when auto-execution failure should be quiet, set after the warning is shown "
384 "once for the current blend file (read-only).\n"
391 return PyBool_FromLong(
G.f & flag);
396 if (!
G.autoexec_override.has_value()) {
399 return PyBool_FromLong(*
G.autoexec_override);
405 const int param = PyObject_IsTrue(value);
408 PyErr_SetString(PyExc_TypeError,
"bpy.app.use_* can only be True/False");
426 const int param = PyObject_IsTrue(value);
428 PyErr_SetString(PyExc_ValueError,
"This bpy.app.use_* option can only be disabled");
436 bpy_app_debug_value_doc,
437 "Integer value which can be set to non-zero values for testing purposes.\n"
442 return PyLong_FromLong(
G.debug_value);
449 if (param == -1 && PyErr_Occurred()) {
451 "bpy.app.debug_value can only be set to a whole number");
455 G.debug_value = param;
465 "String, the temp directory used by blender (read-only).\n"
475 bpy_app_cachedir_doc,
476 "String, the cache directory used by blender (read-only).\n"
478 "In rare cases the default cache directory may not be available;\n"
479 "in this case a temporary directory is used.\n"
486 BLI_assert_msg(cache_path[0],
"BKE_appdir_folder_caches must never return an empty path");
492 bpy_app_driver_dict_doc,
493 "Dictionary for drivers namespace, editable in-place, reset on file load (read-only).\n"
495 ":type: dict[str, Any]\n");
500 PyErr_SetString(PyExc_RuntimeError,
"bpy.app.driver_namespace failed to create dictionary");
510 bpy_app_render_icon_size_doc,
511 "Reference size for icon renders (read-only).\n"
516 bpy_app_render_preview_size_doc,
517 "Reference size for preview renders (read-only).\n"
522 return PyLong_FromLong(
528 bpy_app_autoexec_fail_message_doc,
529 "String, message describing the auto-execution failure (read-only).\n"
540 bpy_app_python_args_doc,
541 "Leading arguments to use when calling Python directly (via ``sys.executable``). "
542 "These arguments match settings Blender uses to "
543 "ensure Python runs with a compatible environment (read-only).\n"
545 ":type: tuple[str, ...]\n");
552 args[args_num++] =
"-I";
559 bpy_app_binary_path_doc,
560 "The location of Blender's executable, useful for utilities that open new instances. "
561 "Read-only unless Blender is built as a Python module - in this case the value is "
562 "an empty string which script authors may point to a Blender binary.\n"
572#ifndef WITH_PYTHON_MODULE
573 PyErr_SetString(PyExc_AttributeError,
574 "bpy.app.binary_path is only writable when built as a Python module");
577 PyObject *value_coerce =
nullptr;
579 if (filepath ==
nullptr) {
580 PyErr_Format(PyExc_ValueError,
"expected a string or bytes, got %s", Py_TYPE(value)->tp_name);
584 Py_XDECREF(value_coerce);
593 reinterpret_cast<void *
>(
G_DEBUG)},
624 {
"debug_depsgraph_build",
629 {
"debug_depsgraph_eval",
634 {
"debug_depsgraph_tag",
639 {
"debug_depsgraph_time",
644 {
"debug_depsgraph_pretty",
660 {
"use_event_simulate",
663 bpy_app_global_flag_doc,
666 {
"use_userpref_skip_save_on_exit",
669 bpy_app_global_flag_doc,
675 bpy_app_debug_value_doc,
684 bpy_app_render_icon_size_doc,
686 {
"render_preview_size",
689 bpy_app_render_preview_size_doc,
695 bpy_app_internet_offline_doc,
697 {
"online_access_override",
700 bpy_app_internet_offline_override_doc,
707 bpy_app_autoexec_doc,
709 {
"autoexec_override",
712 bpy_app_autoexec_override_doc,
717 bpy_app_autoexec_fail_doc,
719 {
"autoexec_fail_quiet",
722 bpy_app_autoexec_fail_quiet_doc,
724 {
"autoexec_fail_message",
727 bpy_app_autoexec_fail_message_doc,
737 bpy_app_binary_path_doc,
740 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr},
745 bpy_app_is_job_running_doc,
746 ".. function:: is_job_running(job_type)\n"
748 " Check whether a job of the given type is running.\n"
750 " :param job_type: job type in :ref:`rna_enum_wm_job_type_items`.\n"
751 " :type job_type: str\n"
752 " :return: Whether a job of the given type is currently running.\n"
758 job_type_enum.
value = 0;
760 static const char *_keywords[] = {
"job_type",
nullptr};
761 static _PyArg_Parser _parser = {
767 if (!_PyArg_ParseTupleAndKeywordsFast(
781char *(*BPY_python_app_help_text_fn)(
bool all) =
nullptr;
785 bpy_app_help_text_doc,
786 ".. function:: help_text(*, all=False)\n"
788 " Return the help text as a string.\n"
790 " :param all: Return all arguments, "
791 "even those which aren't available for the current platform.\n"
793 " :return: Help text.\n"
798 static const char *_keywords[] = {
"all",
nullptr};
799 static _PyArg_Parser _parser = {
806 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser,
PyC_ParseBool, &
all)) {
811 PyObject *
result = PyUnicode_FromString(buf);
818# pragma clang diagnostic push
819# pragma clang diagnostic ignored "-Wcast-function-type"
821# pragma GCC diagnostic push
822# pragma GCC diagnostic ignored "-Wcast-function-type"
827 bpy_app_memory_usage_undo_doc,
828 ".. function:: memory_usage_undo()\n"
830 " Get undo memory usage information.\n"
832 " :return: Memory usage of the undo stack in bytes.\n"
837 size_t total_memory = 0;
842 return PyLong_FromSize_t(total_memory);
848 METH_VARARGS | METH_KEYWORDS | METH_STATIC,
849 bpy_app_is_job_running_doc},
852 METH_VARARGS | METH_KEYWORDS | METH_STATIC,
853 bpy_app_help_text_doc},
854 {
"memory_usage_undo",
856 METH_NOARGS | METH_STATIC,
857 bpy_app_memory_usage_undo_doc},
858 {
nullptr,
nullptr, 0,
nullptr},
863# pragma clang diagnostic pop
865# pragma GCC diagnostic pop
881 for (PyMethodDef *method =
bpy_app_methods; method->ml_name; method++) {
882 BLI_assert_msg(method->ml_flags & METH_STATIC,
"Only static methods make sense for 'bpy.app'");
883 PyObject *item = PyCFunction_New(method,
nullptr);
884 PyDict_SetItemString(
BlenderAppType.tp_dict, method->ml_name, item);
#define BLENDER_VERSION_PATCH
#define BLENDER_VERSION_CYCLE
#define BLENDER_FILE_SUBVERSION
#define BLENDER_FILE_VERSION
#define G_FLAG_INTERNET_OVERRIDE_PREF_ANY
Read Blender memory allocation and freeing.
#define POINTER_AS_INT(i)
#define BLI_assert_msg(a, msg)
#define SetBytesItem(str)
bool all(VecOp< bool, D >) RET
int icon_preview_to_render_size(enum eIconSizes size)
void WM_main_add_notifier(uint type, void *reference)
PyObject * PyC_Tuple_PackArray_String(const char **array, uint len)
const EnumPropertyItem rna_enum_wm_job_type_items[]
PyObject * PyC_Err_SetString_Prefix(PyObject *exception_type_prefix, const char *str)
static PyObject * bpy_app_memory_usage_undo(PyObject *, PyObject *)
int PyC_ParseBool(PyObject *o, void *p)
static PyObject * bpy_app_autoexec_override_get(PyObject *, void *)
PyObject * BPY_app_timers_module()
UndoStack * ED_undo_stack_get()
static void py_struct_seq_method_init()
static PyStructSequence_Desc app_info_desc
static PyObject * bpy_app_binary_path_get(PyObject *, void *)
static PyObject * bpy_app_cachedir_get(PyObject *, void *)
static PyGetSetDef bpy_app_getsets[]
int bpy_pydriver_create_dict()
PyObject * BPY_app_icons_module()
@ WM_JOB_TYPE_SHADER_COMPILATION
PyObject * BPY_app_oiio_struct()
static int bpy_app_debug_set(PyObject *, PyObject *value, void *closure)
bool BPY_python_use_system_env_get()
PyDoc_STRVAR(bpy_bm_new_doc, ".. function:: new(*, use_operators=True)\n" "\n" " :param use_operators: Support calling operators in :mod:`bmesh.ops` (uses some " "extra memory per vert/edge/face).\n" " :type use_operators: bool\n" " :return: Return a new, empty BMesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n")
const char * BKE_tempdir_session() ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
static PyObject * bpy_app_debug_get(PyObject *, void *closure)
PyObject * PyC_UnicodeFromBytes(const char *str)
static PyTypeObject BlenderAppType
@ G_DEBUG_DEPSGRAPH_PRETTY
@ G_DEBUG_DEPSGRAPH_BUILD
PyObject * PyC_Tuple_Pack_I32(const Span< int > values)
static int bpy_app_global_flag_set__only_disable(PyObject *, PyObject *value, void *closure)
PyObject * BPY_app_openvdb_struct()
PyObject * bpy_pydriver_Dict
PyObject * BPY_app_usd_struct()
static void py_struct_seq_getset_init()
PyObject * BPY_app_ocio_struct()
bool WM_jobs_has_running(const wmWindowManager *window_manager, const void *owner, const eWM_JobType type, const eWM_JobFlag exclude_flags)
static PyMethodDef bpy_app_methods[]
bool GPU_shader_compiler_has_pending_work()
static PyObject * bpy_app_debug_value_get(PyObject *, void *)
static PyStructSequence_Field app_info_fields[]
int16_t PyC_Long_AsI16(PyObject *value)
static PyObject * bpy_app_global_flag_get(PyObject *, void *closure)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
static int bpy_app_binary_path_set(PyObject *, PyObject *value, void *)
static PyObject * bpy_app_tempdir_get(PyObject *, void *)
PyObject * BPY_app_alembic_struct()
size_t ED_undosys_total_memory_calc(UndoStack *ustack)
PyObject * BPY_app_opensubdiv_struct()
static PyObject * make_app_info()
const char * PyC_UnicodeAsBytes(PyObject *py_str, PyObject **r_coerce)
PyObject * BPY_app_handlers_struct()
void BKE_appdir_program_path_init(const char *argv0) ATTR_NONNULL(1)
PyObject * BPY_app_translations_struct()
PyObject * BPY_app_build_options_struct()
@ G_FLAG_USERPREF_NO_SAVE_ON_EXIT
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL
void BKE_appdir_folder_caches(char *path, size_t path_maxncpy) ATTR_NONNULL(1)
PyObject * BPY_app_ffmpeg_struct()
static int bpy_app_debug_value_set(PyObject *, PyObject *value, void *)
static PyObject * bpy_app_autoexec_fail_message_get(PyObject *, void *)
static PyObject * bpy_app_is_job_running(PyObject *, PyObject *args, PyObject *kwds)
PyObject * BPY_app_sdl_struct()
char *(*) BPY_python_app_help_text_fn(bool all)
const char * BKE_appdir_program_path() ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
static PyObject * bpy_app_render_preview_or_icon_size_get(PyObject *, void *closure)
int pyrna_enum_value_parse_string(PyObject *o, void *p)
const char * BKE_blender_version_string()
PyObject * BPY_app_struct()
static PyObject * bpy_app_driver_dict_get(PyObject *, void *)
static PyObject * bpy_app_python_args_get(PyObject *, void *)
static PyObject * bpy_app_help_text(PyObject *, PyObject *args, PyObject *kwds)
static int bpy_app_global_flag_set(PyObject *, PyObject *value, void *closure)
ulong build_commit_timestamp
header-only compatibility defines.
const EnumPropertyItem * items