Blender V5.0
bpy_app_handlers.cc File Reference
#include "BLI_utildefines.h"
#include <Python.h>
#include "../generic/python_compat.hh"
#include "BKE_callbacks.hh"
#include "RNA_access.hh"
#include "bpy_app_handlers.hh"
#include "bpy_rna.hh"
#include "BPY_extern.hh"

Go to the source code of this file.

Macros

#define FILEPATH_SAVE_ARG
#define FILEPATH_LOAD_ARG
#define RENDER_STATS_ARG
#define DEPSGRAPH_UPDATE_ARG
#define RENDER_ARG
#define OBJECT_BAKE_ARG
#define COMPOSITE_ARG
#define ANNOTATION_ARG
#define BLENDIMPORT_ARG
#define APP_CB_OTHER_FIELDS   1

Functions

void bpy_app_generic_callback (Main *main, PointerRNA **pointers, const int pointers_num, void *arg)
static PyObject * make_app_cb_info ()
PyObject * BPY_app_handlers_struct ()
void BPY_app_handlers_reset (const bool do_all)
static PyObject * choose_arguments (PyObject *func, PyObject *args_all, PyObject *args_single)

Variables

static PyTypeObject BlenderAppCbType
static PyStructSequence_Field app_cb_info_fields []
static PyStructSequence_Desc app_cb_info_desc
static PyObject * py_cb_array [BKE_CB_EVT_TOT] = {nullptr}

Permanent Tagging Code

#define PERMINENT_CB_ID   "_bpy_persistent"
static PyTypeObject BPyPersistent_Type
static PyObject * bpy_app_handlers_persistent_new (PyTypeObject *, PyObject *args, PyObject *)

Detailed Description

This file defines a #PyStructSequence accessed via bpy.app.handlers, which exposes various lists that the script author can add callback functions into (called via blenders generic BLI_cb API)

Definition in file bpy_app_handlers.cc.

Macro Definition Documentation

◆ ANNOTATION_ARG

#define ANNOTATION_ARG
Value:
"Accepts two arguments: " \
"the annotation data-block and dependency graph"

Definition at line 55 of file bpy_app_handlers.cc.

◆ APP_CB_OTHER_FIELDS

#define APP_CB_OTHER_FIELDS   1

Referenced by make_app_cb_info().

◆ BLENDIMPORT_ARG

#define BLENDIMPORT_ARG
Value:
"Accepts one argument: " \
"a BlendImportContext"

Definition at line 58 of file bpy_app_handlers.cc.

◆ COMPOSITE_ARG

#define COMPOSITE_ARG
Value:
"Accepts one argument: " \
"the scene data-block"

Definition at line 52 of file bpy_app_handlers.cc.

◆ DEPSGRAPH_UPDATE_ARG

#define DEPSGRAPH_UPDATE_ARG
Value:
"Accepts two arguments: " \
"The scene data-block and the dependency graph being updated"

Definition at line 43 of file bpy_app_handlers.cc.

◆ FILEPATH_LOAD_ARG

#define FILEPATH_LOAD_ARG
Value:
"Accepts one argument: " \
"the file being loaded, an empty string for the startup-file."

Definition at line 37 of file bpy_app_handlers.cc.

◆ FILEPATH_SAVE_ARG

#define FILEPATH_SAVE_ARG
Value:
"Accepts one argument: " \
"the file being saved, an empty string for the startup-file."

Definition at line 34 of file bpy_app_handlers.cc.

◆ OBJECT_BAKE_ARG

#define OBJECT_BAKE_ARG
Value:
"Accepts one argument: " \
"the object data-block being baked"

Definition at line 49 of file bpy_app_handlers.cc.

◆ PERMINENT_CB_ID

#define PERMINENT_CB_ID   "_bpy_persistent"

Definition at line 151 of file bpy_app_handlers.cc.

Referenced by bpy_app_handlers_persistent_new(), and BPY_app_handlers_reset().

◆ RENDER_ARG

#define RENDER_ARG
Value:
"Accepts one argument: " \
"the scene data-block being rendered"

Definition at line 46 of file bpy_app_handlers.cc.

◆ RENDER_STATS_ARG

#define RENDER_STATS_ARG
Value:
"Accepts one argument: " \
"the render stats (render/saving time plus in background mode frame/used [peak] memory)."

Definition at line 40 of file bpy_app_handlers.cc.

Function Documentation

◆ bpy_app_generic_callback()

void bpy_app_generic_callback ( Main * main,
PointerRNA ** pointers,
const int pointers_num,
void * arg )

◆ bpy_app_handlers_persistent_new()

PyObject * bpy_app_handlers_persistent_new ( PyTypeObject * ,
PyObject * args,
PyObject *  )
static

Definition at line 153 of file bpy_app_handlers.cc.

References PERMINENT_CB_ID.

◆ BPY_app_handlers_reset()

void BPY_app_handlers_reset ( const bool do_all)

Definition at line 314 of file bpy_app_handlers.cc.

References BKE_CB_EVT_TOT, i, PERMINENT_CB_ID, pos, py_cb_array, and Py_DECREF().

Referenced by BPY_python_reset().

◆ BPY_app_handlers_struct()

◆ choose_arguments()

PyObject * choose_arguments ( PyObject * func,
PyObject * args_all,
PyObject * args_single )
static

Definition at line 364 of file bpy_app_handlers.cc.

Referenced by bpy_app_generic_callback().

◆ make_app_cb_info()

PyObject * make_app_cb_info ( )
static

Variable Documentation

◆ app_cb_info_desc

PyStructSequence_Desc app_cb_info_desc
static
Initial value:
= {
"bpy.app.handlers",
"This module contains callback lists",
}
#define ARRAY_SIZE(arr)
static PyStructSequence_Field app_cb_info_fields[]

Definition at line 134 of file bpy_app_handlers.cc.

Referenced by BPY_app_handlers_struct().

◆ app_cb_info_fields

PyStructSequence_Field app_cb_info_fields[]
static

See BKE_callbacks.hh eCbEvent declaration for the policy on naming.

Definition at line 65 of file bpy_app_handlers.cc.

Referenced by bpy_app_generic_callback(), and make_app_cb_info().

◆ BlenderAppCbType

PyTypeObject BlenderAppCbType
static

Definition at line 32 of file bpy_app_handlers.cc.

Referenced by BPY_app_handlers_struct(), and make_app_cb_info().

◆ BPyPersistent_Type

PyTypeObject BPyPersistent_Type
static

Dummy type because decorators can't be a #PyCFunction.

Definition at line 188 of file bpy_app_handlers.cc.

Referenced by BPY_app_handlers_struct(), and make_app_cb_info().

◆ py_cb_array

PyObject* py_cb_array[BKE_CB_EVT_TOT] = {nullptr}
static