79 "The Blender version as a tuple of 3 numbers (major, minor, micro). eg. (4, 3, 1)"},
81 "The Blender File version, as a tuple of 3 numbers (major, minor, file sub-version), that "
82 "will be used to save a .blend file. The last item in this tuple indicates the file "
83 "sub-version, which is different from the release micro version (the last item of the "
84 "`bpy.app.version` tuple). The file sub-version can be incremented multiple times while a "
85 "Blender version is under development. This value is, and should be, used for handling "
86 "compatibility changes between Blender versions"},
87 {
"version_string",
"The Blender version formatted as a string"},
88 {
"version_cycle",
"The release status of this build alpha/beta/rc/release"},
90 "Boolean, True when blender is running without a user interface (started with -b)"},
91 {
"module",
"Boolean, True when running Blender as a python module"},
92 {
"factory_startup",
"Boolean, True when blender is running with --factory-startup)"},
93 {
"portable",
"Boolean, True unless blender was built to reference absolute paths (on UNIX)."},
96 {
"build_date",
"The date this blender instance was built"},
97 {
"build_time",
"The time this blender instance was built"},
98 {
"build_commit_timestamp",
"The unix timestamp of commit this blender instance was built"},
99 {
"build_commit_date",
"The date of commit this blender instance was built"},
100 {
"build_commit_time",
"The time of commit this blender instance was built"},
101 {
"build_hash",
"The commit hash this blender instance was built with"},
102 {
"build_branch",
"The branch this blender instance was built from"},
103 {
"build_platform",
"The platform this blender instance was built for"},
104 {
"build_type",
"The type of build (Release, Debug)"},
105 {
"build_cflags",
"C compiler flags"},
106 {
"build_cxxflags",
"C++ compiler flags"},
107 {
"build_linkflags",
"Binary linking flags"},
108 {
"build_system",
"Build system used"},
111 {
"alembic",
"Alembic library information backend"},
112 {
"usd",
"USD library information backend"},
113 {
"ffmpeg",
"FFmpeg library information backend"},
114 {
"ocio",
"OpenColorIO library information backend"},
115 {
"oiio",
"OpenImageIO library information backend"},
116 {
"opensubdiv",
"OpenSubdiv library information backend"},
117 {
"openvdb",
"OpenVDB library information backend"},
118 {
"sdl",
"SDL library information backend"},
119 {
"build_options",
"A set containing most important enabled optional build features"},
120 {
"handlers",
"Application handler callbacks"},
121 {
"translations",
"Application and addons internationalization API"},
124 {
"icons",
"Manage custom icons"},
125 {
"timers",
"Manage timers"},
132 "This module contains application values that remain unchanged during runtime.");
147 if (app_info ==
nullptr) {
150#define SetIntItem(flag) PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
151#define SetStrItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
152#define SetBytesItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
153#define SetObjItem(obj) PyStructSequence_SET_ITEM(app_info, pos++, obj)
163#ifdef WITH_PYTHON_MODULE
170#ifdef WITH_INSTALL_PORTABLE
229 if (PyErr_Occurred()) {
242 "Boolean, for debug info "
243 "(started with ``--debug`` / ``--debug-*`` matching this attribute name)");
247 return PyBool_FromLong(
G.debug &
flag);
253 const int param = PyObject_IsTrue(value);
256 PyErr_SetString(PyExc_TypeError,
"bpy.app.debug can only be True/False");
272 bpy_app_internet_offline_doc,
273 "Boolean, true when internet access is allowed by Blender & 3rd party scripts (read-only)");
276 bpy_app_internet_offline_override_doc,
277 "Boolean, true when internet access preference is overridden by the command line (read-only)");
281 bpy_app_global_flag_doc,
282 "Boolean, for application behavior "
283 "(started with ``--enable-*`` matching this attribute name)");
287 return PyBool_FromLong(
G.f &
flag);
293 const int param = PyObject_IsTrue(value);
296 PyErr_SetString(PyExc_TypeError,
"bpy.app.use_* can only be True/False");
314 const int param = PyObject_IsTrue(value);
316 PyErr_SetString(PyExc_ValueError,
"This bpy.app.use_* option can only be disabled");
324 bpy_app_debug_value_doc,
325 "Short, number which can be set to non-zero values for testing purposes");
328 return PyLong_FromLong(
G.debug_value);
335 if (param == -1 && PyErr_Occurred()) {
337 "bpy.app.debug_value can only be set to a whole number");
341 G.debug_value = param;
351 "String, the temp directory used by blender (read-only)");
359 bpy_app_driver_dict_doc,
360 "Dictionary for drivers namespace, editable in-place, reset on file load (read-only)");
365 PyErr_SetString(PyExc_RuntimeError,
"bpy.app.driver_namespace failed to create dictionary");
375 bpy_app_preview_render_size_doc,
376 "Reference size for icon/preview renders (read-only)");
379 return PyLong_FromLong(
390 bpy_app_python_args_doc,
391 "Leading arguments to use when calling Python directly (via ``sys.executable``). "
392 "These arguments match settings Blender uses to "
393 "ensure Python runs with a compatible environment (read-only).");
400 args[args_num++] =
"-I";
407 bpy_app_binary_path_doc,
408 "The location of Blender's executable, useful for utilities that open new instances. "
409 "Read-only unless Blender is built as a Python module - in this case the value is "
410 "an empty string which script authors may point to a Blender binary.");
418#ifndef WITH_PYTHON_MODULE
419 PyErr_SetString(PyExc_AttributeError,
420 "bpy.app.binary_path is only writable when built as a Python module");
423 PyObject *value_coerce =
nullptr;
425 if (filepath ==
nullptr) {
426 PyErr_Format(PyExc_ValueError,
"expected a string or bytes, got %s", Py_TYPE(value)->tp_name);
430 Py_XDECREF(value_coerce);
467 {
"debug_depsgraph_build",
472 {
"debug_depsgraph_eval",
477 {
"debug_depsgraph_tag",
482 {
"debug_depsgraph_time",
487 {
"debug_depsgraph_pretty",
499 {
"use_event_simulate",
502 bpy_app_global_flag_doc,
505 {
"use_userpref_skip_save_on_exit",
508 bpy_app_global_flag_doc,
514 bpy_app_debug_value_doc,
522 bpy_app_preview_render_size_doc,
524 {
"render_preview_size",
527 bpy_app_preview_render_size_doc,
533 bpy_app_internet_offline_doc,
535 {
"online_access_override",
538 bpy_app_internet_offline_override_doc,
547 {
"autoexec_fail_quiet",
561 bpy_app_binary_path_doc,
564 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr},
569 bpy_app_is_job_running_doc,
570 ".. staticmethod:: is_job_running(job_type)\n"
572 " Check whether a job of the given type is running.\n"
574 " :arg job_type: job type in :ref:`rna_enum_wm_job_type_items`.\n"
575 " :type job_type: str\n"
576 " :return: Whether a job of the given type is currently running.\n"
582 job_type_enum.
value = 0;
584 static const char *_keywords[] = {
"job_type",
nullptr};
585 static _PyArg_Parser _parser = {
592 if (!_PyArg_ParseTupleAndKeywordsFast(
601char *(*BPY_python_app_help_text_fn)(
bool all) =
nullptr;
605 bpy_app_help_text_doc,
606 ".. staticmethod:: help_text(all=False)\n"
608 " Return the help text as a string.\n"
610 " :arg all: Return all arguments, "
611 "even those which aren't available for the current platform.\n"
612 " :type all: bool\n");
616 static const char *_keywords[] = {
"all",
nullptr};
617 static _PyArg_Parser _parser = {
625 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser,
PyC_ParseBool, &
all)) {
630 PyObject *
result = PyUnicode_FromString(buf);
637# pragma clang diagnostic push
638# pragma clang diagnostic ignored "-Wcast-function-type"
640# pragma GCC diagnostic push
641# pragma GCC diagnostic ignored "-Wcast-function-type"
648 METH_VARARGS | METH_KEYWORDS | METH_STATIC,
649 bpy_app_is_job_running_doc},
652 METH_VARARGS | METH_KEYWORDS | METH_STATIC,
653 bpy_app_help_text_doc},
654 {
nullptr,
nullptr, 0,
nullptr},
659# pragma clang diagnostic pop
661# pragma GCC diagnostic pop
677 for (PyMethodDef *method =
bpy_app_methods; method->ml_name; method++) {
678 BLI_assert_msg(method->ml_flags & METH_STATIC,
"Only static methods make sense for 'bpy.app'");
679 PyObject *item = PyCFunction_New(method,
nullptr);
680 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
#define G_FLAG_INTERNET_OVERRIDE_PREF_ANY
@ 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 BLI_assert_msg(a, msg)
#define POINTER_AS_INT(i)
bool BPY_python_use_system_env_get()
Read Guarded memory(de)allocation.
int UI_icon_preview_to_render_size(enum eIconSizes size)
static int bpy_app_binary_path_set(PyObject *, PyObject *value, void *)
static PyObject * bpy_app_debug_value_get(PyObject *, void *)
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 int bpy_app_debug_set(PyObject *, PyObject *value, void *closure)
static PyObject * bpy_app_python_args_get(PyObject *, void *)
PyDoc_STRVAR(bpy_app_doc, "This module contains application values that remain unchanged during runtime.")
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)