Blender V4.3
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_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 "DNA_ID.h"
#include "UI_interface_icons.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"
#include "../generic/python_utildefines.hh"

Go to the source code of this file.

Macros

#define SetIntItem(flag)   PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
 
#define SetStrItem(str)   PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
 
#define SetBytesItem(str)   PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
 
#define SetObjItem(obj)   PyStructSequence_SET_ITEM(app_info, pos++, obj)
 

Functions

 PyDoc_STRVAR (bpy_app_doc, "This module contains application values that remain unchanged during runtime.")
 
static PyObject * make_app_info ()
 
 PyDoc_STRVAR (bpy_app_debug_doc, "Boolean, for debug info " "(started with ``--debug`` / ``--debug-*`` matching this attribute name)")
 
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)")
 
 PyDoc_STRVAR (bpy_app_internet_offline_override_doc, "Boolean, true when internet access preference is overridden by the command line (read-only)")
 
 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 *, 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")
 
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)")
 
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)")
 
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)")
 
static PyObject * bpy_app_preview_render_size_get (PyObject *, void *closure)
 
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).")
 
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.")
 
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")
 
static PyObject * bpy_app_help_text (PyObject *, PyObject *args, PyObject *kwds)
 
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 []
 
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)    PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))

Referenced by make_app_info().

◆ SetIntItem

#define SetIntItem ( flag)    PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))

Referenced by make_app_info().

◆ SetObjItem

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

Referenced by make_app_info().

◆ SetStrItem

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

Referenced by make_app_info().

Function Documentation

◆ bpy_app_autoexec_fail_message_get()

static PyObject * bpy_app_autoexec_fail_message_get ( PyObject * ,
void *  )
static

Definition at line 369 of file bpy_app.cc.

References G, and PyC_UnicodeFromBytes().

◆ bpy_app_binary_path_get()

static PyObject * bpy_app_binary_path_get ( PyObject * ,
void *  )
static

Definition at line 397 of file bpy_app.cc.

References BKE_appdir_program_path(), and PyC_UnicodeFromBytes().

◆ bpy_app_binary_path_set()

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

Definition at line 402 of file bpy_app.cc.

References BKE_appdir_program_path_init(), and PyC_UnicodeAsBytes().

◆ bpy_app_debug_get()

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

Definition at line 230 of file bpy_app.cc.

References flag, G, and POINTER_AS_INT.

◆ bpy_app_debug_set()

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

Definition at line 236 of file bpy_app.cc.

References flag, G, and POINTER_AS_INT.

◆ bpy_app_debug_value_get()

static PyObject * bpy_app_debug_value_get ( PyObject * ,
void *  )
static

Definition at line 312 of file bpy_app.cc.

References G.

◆ bpy_app_debug_value_set()

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

◆ bpy_app_driver_dict_get()

static PyObject * bpy_app_driver_dict_get ( PyObject * ,
void *  )
static

Definition at line 347 of file bpy_app.cc.

References bpy_pydriver_create_dict(), and bpy_pydriver_Dict.

◆ bpy_app_global_flag_get()

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

Definition at line 270 of file bpy_app.cc.

References flag, G, and POINTER_AS_INT.

◆ bpy_app_global_flag_set()

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

Definition at line 276 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()

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

Definition at line 296 of file bpy_app.cc.

References bpy_app_global_flag_set().

◆ bpy_app_help_text()

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

◆ bpy_app_is_job_running()

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

◆ bpy_app_preview_render_size_get()

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

Definition at line 363 of file bpy_app.cc.

References POINTER_AS_INT, and UI_icon_preview_to_render_size().

◆ bpy_app_python_args_get()

static PyObject * bpy_app_python_args_get ( PyObject * ,
void *  )
static

Definition at line 380 of file bpy_app.cc.

References BPY_python_use_system_env_get(), and PyC_Tuple_PackArray_String().

◆ BPY_app_struct()

PyObject * BPY_app_struct ( )

◆ bpy_app_tempdir_get()

static PyObject * bpy_app_tempdir_get ( PyObject * ,
void *  )
static

Definition at line 338 of file bpy_app.cc.

References BKE_tempdir_session, and PyC_UnicodeFromBytes().

◆ make_app_info()

◆ py_struct_seq_getset_init()

static void py_struct_seq_getset_init ( )
static

Definition at line 642 of file bpy_app.cc.

References BlenderAppType, and bpy_app_getsets.

Referenced by BPY_app_struct().

◆ py_struct_seq_method_init()

static void py_struct_seq_method_init ( )
static

Definition at line 652 of file bpy_app.cc.

References BlenderAppType, BLI_assert_msg, and bpy_app_methods.

Referenced by BPY_app_struct().

◆ PyDoc_STRVAR() [1/13]

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."  )

◆ PyDoc_STRVAR() [2/13]

PyDoc_STRVAR ( bpy_app_debug_doc ,
" Boolean,
for debug info " "(started with ``--debug``/``--debug- *`` matching this attribute name)"  )

◆ PyDoc_STRVAR() [3/13]

PyDoc_STRVAR ( bpy_app_debug_value_doc ,
" Short,
number which can be set to non-zero values for testing purposes"  )

◆ PyDoc_STRVAR() [4/13]

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

◆ PyDoc_STRVAR() [5/13]

PyDoc_STRVAR ( bpy_app_driver_dict_doc ,
"Dictionary for drivers namespace,
editable in- place,
reset on file load(read-only)"  )

◆ PyDoc_STRVAR() [6/13]

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

◆ PyDoc_STRVAR() [7/13]

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"  )

◆ PyDoc_STRVAR() [8/13]

PyDoc_STRVAR ( bpy_app_internet_offline_doc ,
" Boolean,
true when internet access is allowed by Blender &3rd party scripts(read-only)"  )

◆ PyDoc_STRVAR() [9/13]

PyDoc_STRVAR ( bpy_app_internet_offline_override_doc ,
" Boolean,
true when internet access preference is overridden by the command line(read-only)"  )

◆ PyDoc_STRVAR() [10/13]

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() [11/13]

PyDoc_STRVAR ( bpy_app_preview_render_size_doc ,
"Reference size for icon/preview renders (read-only)"  )

◆ PyDoc_STRVAR() [12/13]

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)."  )

◆ PyDoc_STRVAR() [13/13]

PyDoc_STRVAR ( bpy_app_tempdir_doc ,
" String,
the temp directory used by blender(read-only)"  )

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:80

Definition at line 131 of file bpy_app.cc.

Referenced by BPY_app_struct().

◆ app_info_fields

PyStructSequence_Field app_info_fields[]
static

Definition at line 80 of file bpy_app.cc.

◆ BlenderAppType

PyTypeObject BlenderAppType
static

◆ bpy_app_getsets

PyGetSetDef bpy_app_getsets[]
static

Definition at line 420 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},
{nullptr, nullptr, 0, nullptr},
}
static PyObject * bpy_app_help_text(PyObject *, PyObject *args, PyObject *kwds)
Definition bpy_app.cc:599
static PyObject * bpy_app_is_job_running(PyObject *, PyObject *args, PyObject *kwds)
Definition bpy_app.cc:564

Definition at line 626 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 587 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 69 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 72 of file bpy_app.cc.

Referenced by make_app_info(), and print_version_full().

◆ build_commit_date

char build_commit_date = "\0"

◆ build_commit_time

char build_commit_time = "\0"

◆ build_commit_timestamp

ulong build_commit_timestamp = BUILD_COMMIT_TIMESTAMP

Definition at line 65 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 73 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[]

Definition at line 68 of file bpy_app.cc.

Referenced by make_app_info().

◆ build_linkflags

char build_linkflags = "unmaintained buildsystem alert!"

Definition at line 74 of file bpy_app.cc.

Referenced by make_app_info(), and print_version_full().

◆ build_platform

char build_platform = BUILD_PLATFORM

Definition at line 70 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 75 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 71 of file bpy_app.cc.

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