Blender V5.0
bpy_app.cc File Reference
#include <Python.h>
#include "bpy_app.hh"
#include "bpy_app_alembic.hh"
#include "bpy_app_build_options.hh"
#include "bpy_app_ffmpeg.hh"
#include "bpy_app_ocio.hh"
#include "bpy_app_oiio.hh"
#include "bpy_app_opensubdiv.hh"
#include "bpy_app_openvdb.hh"
#include "bpy_app_sdl.hh"
#include "bpy_app_usd.hh"
#include "bpy_app_translations.hh"
#include "bpy_app_handlers.hh"
#include "bpy_capi_utils.hh"
#include "bpy_driver.hh"
#include "BPY_extern_python.hh"
#include "bpy_app_icons.hh"
#include "bpy_app_timers.hh"
#include "BLI_utildefines.h"
#include "BKE_appdir.hh"
#include "BKE_blender_version.h"
#include "BKE_global.hh"
#include "BKE_main.hh"
#include "GPU_shader.hh"
#include "UI_interface_icons.hh"
#include "ED_undo.hh"
#include "MEM_guardedalloc.h"
#include "RNA_enum_types.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "../generic/py_capi_rna.hh"
#include "../generic/py_capi_utils.hh"
#include "../generic/python_compat.hh"

Go to the source code of this file.

Macros

#define SetIntItem(flag)
#define SetStrItem(str)
#define SetBytesItem(str)
#define SetObjItem(obj)

Functions

 PyDoc_STRVAR (bpy_app_doc, "This module contains application values that remain unchanged during runtime.\n")
static PyObject * make_app_info ()
 PyDoc_STRVAR (bpy_app_debug_doc, "Boolean, for debug info " "(started with ``--debug`` / ``--debug-*`` matching this attribute name).\n" "\n" ":type: bool\n")
static PyObject * bpy_app_debug_get (PyObject *, void *closure)
static int bpy_app_debug_set (PyObject *, PyObject *value, void *closure)
 PyDoc_STRVAR (bpy_app_internet_offline_doc, "Boolean, true when internet access is allowed by Blender & 3rd party scripts " "(read-only).\n" "\n" ":type: bool\n")
 PyDoc_STRVAR (bpy_app_internet_offline_override_doc, "Boolean, true when internet access preference is overridden by the command line " "(read-only).\n" "\n" ":type: bool\n")
 PyDoc_STRVAR (bpy_app_global_flag_doc, "Boolean, for application behavior " "(started with ``--enable-*`` matching this attribute name)\n" "\n" ":type: bool\n")
 PyDoc_STRVAR (bpy_app_autoexec_fail_doc, "Boolean, True when auto-execution of scripts failed (read-only).\n" "\n" ":type: bool\n")
 PyDoc_STRVAR (bpy_app_autoexec_fail_quiet_doc, "Boolean, True when auto-execution failure should be quiet, set after the warning is shown " "once for the current blend file (read-only).\n" "\n" ":type: bool\n")
static PyObject * bpy_app_global_flag_get (PyObject *, void *closure)
static int bpy_app_global_flag_set (PyObject *, PyObject *value, void *closure)
static int bpy_app_global_flag_set__only_disable (PyObject *, PyObject *value, void *closure)
 PyDoc_STRVAR (bpy_app_debug_value_doc, "Short, number which can be set to non-zero values for testing purposes.\n" "\n" ":type: int\n")
static PyObject * bpy_app_debug_value_get (PyObject *, void *)
static int bpy_app_debug_value_set (PyObject *, PyObject *value, void *)
 PyDoc_STRVAR (bpy_app_tempdir_doc, "String, the temp directory used by blender (read-only).\n" "\n" ":type: str\n")
static PyObject * bpy_app_tempdir_get (PyObject *, void *)
 PyDoc_STRVAR (bpy_app_driver_dict_doc, "Dictionary for drivers namespace, editable in-place, reset on file load (read-only).\n" "\n" ":type: dict[str, Any]\n")
static PyObject * bpy_app_driver_dict_get (PyObject *, void *)
 PyDoc_STRVAR (bpy_app_preview_render_size_doc, "Reference size for icon/preview renders (read-only).\n" "\n" ":type: int\n")
static PyObject * bpy_app_preview_render_size_get (PyObject *, void *closure)
 PyDoc_STRVAR (bpy_app_autoexec_fail_message_doc, "String, message describing the auto-execution failure (read-only).\n" "\n" ":type: str\n")
static PyObject * bpy_app_autoexec_fail_message_get (PyObject *, void *)
 PyDoc_STRVAR (bpy_app_python_args_doc, "Leading arguments to use when calling Python directly (via ``sys.executable``). " "These arguments match settings Blender uses to " "ensure Python runs with a compatible environment (read-only).\n" "\n" ":type: tuple[str, ...]\n")
static PyObject * bpy_app_python_args_get (PyObject *, void *)
 PyDoc_STRVAR (bpy_app_binary_path_doc, "The location of Blender's executable, useful for utilities that open new instances. " "Read-only unless Blender is built as a Python module - in this case the value is " "an empty string which script authors may point to a Blender binary.\n" "\n" ":type: str\n")
static PyObject * bpy_app_binary_path_get (PyObject *, void *)
static int bpy_app_binary_path_set (PyObject *, PyObject *value, void *)
 PyDoc_STRVAR (bpy_app_is_job_running_doc, ".. staticmethod:: is_job_running(job_type)\n" "\n" " Check whether a job of the given type is running.\n" "\n" " :arg job_type: job type in :ref:`rna_enum_wm_job_type_items`.\n" " :type job_type: str\n" " :return: Whether a job of the given type is currently running.\n" " :rtype: bool\n")
static PyObject * bpy_app_is_job_running (PyObject *, PyObject *args, PyObject *kwds)
 PyDoc_STRVAR (bpy_app_help_text_doc, ".. staticmethod:: help_text(*, all=False)\n" "\n" " Return the help text as a string.\n" "\n" " :arg all: Return all arguments, " "even those which aren't available for the current platform.\n" " :type all: bool\n" " :return: Help text.\n" " :rtype: str\n")
static PyObject * bpy_app_help_text (PyObject *, PyObject *args, PyObject *kwds)
 PyDoc_STRVAR (bpy_app_memory_usage_undo_doc, ".. staticmethod:: memory_usage_undo()\n" "\n" " Get undo memory usage information.\n" "\n" " :return: Memory usage of the undo stack in bytes.\n" " :rtype: int\n")
static PyObject * bpy_app_memory_usage_undo (PyObject *, PyObject *)
static void py_struct_seq_getset_init ()
static void py_struct_seq_method_init ()
PyObject * BPY_app_struct ()

Variables

char build_date [] = BUILD_DATE
char build_time [] = BUILD_TIME
ulong build_commit_timestamp = BUILD_COMMIT_TIMESTAMP
char build_commit_date [] = "\0"
char build_commit_time [] = "\0"
char build_hash [] = BUILD_HASH
char build_branch [] = BUILD_BRANCH
char build_platform [] = BUILD_PLATFORM
char build_type [] = BUILD_TYPE
char build_cflags [] = "unmaintained buildsystem alert!"
char build_cxxflags [] = "unmaintained buildsystem alert!"
char build_linkflags [] = "unmaintained buildsystem alert!"
char build_system [] = "unmaintained buildsystem alert!"
static PyTypeObject BlenderAppType
static PyStructSequence_Field app_info_fields []
static PyStructSequence_Desc app_info_desc
static PyGetSetDef bpy_app_getsets []
char *(* BPY_python_app_help_text_fn )(bool all) = nullptr
static PyMethodDef bpy_app_methods []

Detailed Description

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'

Definition in file bpy_app.cc.

Macro Definition Documentation

◆ SetBytesItem

#define SetBytesItem ( str)
Value:
PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
#define str(s)
uint pos

Referenced by make_app_info().

◆ SetIntItem

#define SetIntItem ( flag)
Value:
PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
uint8_t flag
Definition wm_window.cc:145

Referenced by make_app_info().

◆ SetObjItem

#define SetObjItem ( obj)
Value:
PyStructSequence_SET_ITEM(app_info, pos++, obj)

Referenced by make_app_info().

◆ SetStrItem

#define SetStrItem ( str)
Value:
PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))

Referenced by make_app_info().

Function Documentation

◆ bpy_app_autoexec_fail_message_get()

PyObject * bpy_app_autoexec_fail_message_get ( PyObject * ,
void *  )
static

Definition at line 486 of file bpy_app.cc.

References G, and PyC_UnicodeFromBytes().

◆ bpy_app_binary_path_get()

PyObject * bpy_app_binary_path_get ( PyObject * ,
void *  )
static

Definition at line 518 of file bpy_app.cc.

References BKE_appdir_program_path(), and PyC_UnicodeFromBytes().

◆ bpy_app_binary_path_set()

int bpy_app_binary_path_set ( PyObject * ,
PyObject * value,
void *  )
static

Definition at line 523 of file bpy_app.cc.

References BKE_appdir_program_path_init(), and PyC_UnicodeAsBytes().

◆ bpy_app_debug_get()

PyObject * bpy_app_debug_get ( PyObject * ,
void * closure )
static

Definition at line 310 of file bpy_app.cc.

References flag, G, and POINTER_AS_INT.

◆ bpy_app_debug_set()

int bpy_app_debug_set ( PyObject * ,
PyObject * value,
void * closure )
static

Definition at line 316 of file bpy_app.cc.

References flag, G, and POINTER_AS_INT.

◆ bpy_app_debug_value_get()

PyObject * bpy_app_debug_value_get ( PyObject * ,
void *  )
static

Definition at line 416 of file bpy_app.cc.

References G.

◆ bpy_app_debug_value_set()

int bpy_app_debug_value_set ( PyObject * ,
PyObject * value,
void *  )
static

◆ bpy_app_driver_dict_get()

PyObject * bpy_app_driver_dict_get ( PyObject * ,
void *  )
static

Definition at line 455 of file bpy_app.cc.

References bpy_pydriver_create_dict(), and bpy_pydriver_Dict.

◆ bpy_app_global_flag_get()

PyObject * bpy_app_global_flag_get ( PyObject * ,
void * closure )
static

Definition at line 372 of file bpy_app.cc.

References flag, G, and POINTER_AS_INT.

◆ bpy_app_global_flag_set()

int bpy_app_global_flag_set ( PyObject * ,
PyObject * value,
void * closure )
static

Definition at line 378 of file bpy_app.cc.

References flag, G, and POINTER_AS_INT.

Referenced by bpy_app_global_flag_set__only_disable().

◆ bpy_app_global_flag_set__only_disable()

int bpy_app_global_flag_set__only_disable ( PyObject * ,
PyObject * value,
void * closure )
static

Definition at line 398 of file bpy_app.cc.

References bpy_app_global_flag_set().

◆ bpy_app_help_text()

PyObject * bpy_app_help_text ( PyObject * ,
PyObject * args,
PyObject * kwds )
static

◆ bpy_app_is_job_running()

◆ bpy_app_memory_usage_undo()

PyObject * bpy_app_memory_usage_undo ( PyObject * ,
PyObject *  )
static

Definition at line 767 of file bpy_app.cc.

References ED_undo_stack_get(), and ED_undosys_total_memory_calc().

◆ bpy_app_preview_render_size_get()

PyObject * bpy_app_preview_render_size_get ( PyObject * ,
void * closure )
static

Definition at line 473 of file bpy_app.cc.

References POINTER_AS_INT, and UI_icon_preview_to_render_size().

◆ bpy_app_python_args_get()

PyObject * bpy_app_python_args_get ( PyObject * ,
void *  )
static

Definition at line 499 of file bpy_app.cc.

References BPY_python_use_system_env_get(), and PyC_Tuple_PackArray_String().

◆ BPY_app_struct()

PyObject * BPY_app_struct ( )
nodiscard

◆ bpy_app_tempdir_get()

PyObject * bpy_app_tempdir_get ( PyObject * ,
void *  )
static

Definition at line 444 of file bpy_app.cc.

References BKE_tempdir_session, and PyC_UnicodeFromBytes().

◆ make_app_info()

◆ py_struct_seq_getset_init()

void py_struct_seq_getset_init ( )
static

Definition at line 801 of file bpy_app.cc.

References BlenderAppType, bpy_app_getsets, and Py_DECREF().

Referenced by BPY_app_struct().

◆ py_struct_seq_method_init()

void py_struct_seq_method_init ( )
static

Definition at line 811 of file bpy_app.cc.

References BlenderAppType, BLI_assert_msg, bpy_app_methods, and Py_DECREF().

Referenced by BPY_app_struct().

◆ PyDoc_STRVAR() [1/17]

PyDoc_STRVAR ( bpy_app_autoexec_fail_doc ,
" Boolean,
True when auto-execution of scripts failed(read-only).\n" "\n" ":type:bool\n"  )

◆ PyDoc_STRVAR() [2/17]

PyDoc_STRVAR ( bpy_app_autoexec_fail_message_doc ,
" String,
message describing the auto-execution failure(read-only).\n" "\n" ":type:str\n"  )

◆ PyDoc_STRVAR() [3/17]

PyDoc_STRVAR ( bpy_app_autoexec_fail_quiet_doc ,
" Boolean,
True when auto-execution failure should be quiet,
set after the warning is shown " "once for the current blend file(read-only).\n" "\n" ":type:bool\n"  )

◆ PyDoc_STRVAR() [4/17]

PyDoc_STRVAR ( bpy_app_binary_path_doc ,
"The location of Blender's executable,
useful for utilities that open new instances. " "Read-only unless Blender is built as a Python module - in this case the value is " "an empty string which script authors may point to a Blender binary.\n" "\n" ":type:str\n"  )

◆ PyDoc_STRVAR() [5/17]

PyDoc_STRVAR ( bpy_app_debug_doc ,
" Boolean,
for debug info " "(started with ``--debug``/``--debug- *`` matching this attribute name).\n" "\n" ":type:bool\n"  )

◆ PyDoc_STRVAR() [6/17]

PyDoc_STRVAR ( bpy_app_debug_value_doc ,
" Short,
number which can be set to non-zero values for testing purposes.\n" "\n" ":type:int\n"  )

◆ PyDoc_STRVAR() [7/17]

PyDoc_STRVAR ( bpy_app_doc ,
"This module contains application values that remain unchanged during runtime.\n"  )

◆ PyDoc_STRVAR() [8/17]

PyDoc_STRVAR ( bpy_app_driver_dict_doc ,
"Dictionary for drivers namespace,
editable in- place,
reset on file load(read-only).\n" "\n" ":type:dict\n" [str, Any] )

◆ PyDoc_STRVAR() [9/17]

PyDoc_STRVAR ( bpy_app_global_flag_doc ,
" Boolean,
for application behavior " "(started with ``--enable- *`` matching this attribute name)\n" "\n" ":type:bool\n"  )

◆ PyDoc_STRVAR() [10/17]

PyDoc_STRVAR ( bpy_app_help_text_doc ,
".. staticmethod:: help_text(*, all=False)\n" "\n" " Return the help text as a string.\n" "\n" " :arg all: Return all arguments,
" "even those which aren 't available for the current platform.\n" " :type all:bool\n" " :return:Help text.\n" " :rtype:str\n"  )

◆ PyDoc_STRVAR() [11/17]

PyDoc_STRVAR ( bpy_app_internet_offline_doc ,
" Boolean,
true when internet access is allowed by Blender &3rd party scripts " "(read-only).\n" "\n" ":type:bool\n"  )

◆ PyDoc_STRVAR() [12/17]

PyDoc_STRVAR ( bpy_app_internet_offline_override_doc ,
" Boolean,
true when internet access preference is overridden by the command line " "(read-only).\n" "\n" ":type:bool\n"  )

◆ PyDoc_STRVAR() [13/17]

PyDoc_STRVAR ( bpy_app_is_job_running_doc ,
".. staticmethod:: is_job_running(job_type)\n" "\n" " Check whether a job of the given type is running.\n" "\n" " :arg job_type: job type in :ref:`rna_enum_wm_job_type_items`.\n" " :type job_type: str\n" " :return: Whether a job of the given type is currently running.\n" " :rtype: bool\n"  )

◆ PyDoc_STRVAR() [14/17]

PyDoc_STRVAR ( bpy_app_memory_usage_undo_doc ,
".. staticmethod:: memory_usage_undo()\n" "\n" " Get undo memory usage information.\n" "\n" " :return: Memory usage of the undo stack in bytes.\n" " :rtype: int\n"  )

◆ PyDoc_STRVAR() [15/17]

PyDoc_STRVAR ( bpy_app_preview_render_size_doc ,
"Reference size for icon/preview renders (read-only).\n" "\n" ":type: int\n"  )

◆ PyDoc_STRVAR() [16/17]

PyDoc_STRVAR ( bpy_app_python_args_doc ,
"Leading arguments to use when calling Python directly (via ``sys.executable``). " "These arguments match settings Blender uses to " "ensure Python runs with a compatible environment (read-only).\n" "\n" ":type: tuple\n" [str,...] )

◆ PyDoc_STRVAR() [17/17]

PyDoc_STRVAR ( bpy_app_tempdir_doc ,
" String,
the temp directory used by blender(read-only).\n" "\n" ":type:str\n"  )

Variable Documentation

◆ app_info_desc

PyStructSequence_Desc app_info_desc
static
Initial value:
= {
"bpy.app",
bpy_app_doc,
}
#define ARRAY_SIZE(arr)
static PyStructSequence_Field app_info_fields[]
Definition bpy_app.cc:82

Definition at line 198 of file bpy_app.cc.

Referenced by BPY_app_struct().

◆ app_info_fields

PyStructSequence_Field app_info_fields[]
static

Definition at line 82 of file bpy_app.cc.

◆ BlenderAppType

PyTypeObject BlenderAppType
static

◆ bpy_app_getsets

PyGetSetDef bpy_app_getsets[]
static

Definition at line 541 of file bpy_app.cc.

Referenced by py_struct_seq_getset_init().

◆ bpy_app_methods

PyMethodDef bpy_app_methods[]
static
Initial value:
= {
{"is_job_running",
(PyCFunction)bpy_app_is_job_running,
METH_VARARGS | METH_KEYWORDS | METH_STATIC,
bpy_app_is_job_running_doc},
{"help_text",
(PyCFunction)bpy_app_help_text,
METH_VARARGS | METH_KEYWORDS | METH_STATIC,
bpy_app_help_text_doc},
{"memory_usage_undo",
METH_NOARGS | METH_STATIC,
bpy_app_memory_usage_undo_doc},
{nullptr, nullptr, 0, nullptr},
}
static PyObject * bpy_app_memory_usage_undo(PyObject *, PyObject *)
Definition bpy_app.cc:767
static PyObject * bpy_app_help_text(PyObject *, PyObject *args, PyObject *kwds)
Definition bpy_app.cc:726
static PyObject * bpy_app_is_job_running(PyObject *, PyObject *args, PyObject *kwds)
Definition bpy_app.cc:684

Definition at line 777 of file bpy_app.cc.

Referenced by py_struct_seq_method_init().

◆ BPY_python_app_help_text_fn

char *(* BPY_python_app_help_text_fn) (bool all) ( bool all) = nullptr

Definition at line 712 of file bpy_app.cc.

Referenced by bpy_app_help_text(), and main_args_setup().

◆ build_branch

char build_branch = BUILD_BRANCH

Definition at line 71 of file bpy_app.cc.

Referenced by make_app_info(), and print_version_full().

◆ build_cflags

char build_cflags = "unmaintained buildsystem alert!"

Definition at line 74 of file bpy_app.cc.

Referenced by make_app_info(), and print_version_full().

◆ build_commit_date

char build_commit_date = "\0"

Definition at line 68 of file bpy_app.cc.

Referenced by crashlog_file_generate(), main(), make_app_info(), and print_version_full().

◆ build_commit_time

char build_commit_time = "\0"

Definition at line 69 of file bpy_app.cc.

Referenced by crashlog_file_generate(), main(), make_app_info(), and print_version_full().

◆ build_commit_timestamp

ulong build_commit_timestamp = BUILD_COMMIT_TIMESTAMP

Definition at line 67 of file bpy_app.cc.

Referenced by main(), make_app_info(), and write_global().

◆ build_cxxflags

char build_cxxflags = "unmaintained buildsystem alert!"

Definition at line 75 of file bpy_app.cc.

Referenced by make_app_info(), and print_version_full().

◆ build_date

char build_date = BUILD_DATE

◆ build_hash

char build_hash = BUILD_HASH

◆ build_linkflags

char build_linkflags = "unmaintained buildsystem alert!"

Definition at line 76 of file bpy_app.cc.

Referenced by make_app_info(), and print_version_full().

◆ build_platform

char build_platform = BUILD_PLATFORM

Definition at line 72 of file bpy_app.cc.

Referenced by arg_handle_debug_mode_set(), make_app_info(), and print_version_full().

◆ build_system

char build_system = "unmaintained buildsystem alert!"

Definition at line 77 of file bpy_app.cc.

Referenced by make_app_info(), and print_version_full().

◆ build_time

char build_time = BUILD_TIME

◆ build_type

char build_type = BUILD_TYPE

Definition at line 73 of file bpy_app.cc.

Referenced by arg_handle_debug_mode_set(), make_app_info(), and print_version_full().