Blender V5.3
bpy_app_handlers.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
12
13#include "BLI_utildefines.hh"
14#include <Python.h>
15
16#include "../generic/python_compat.hh" /* IWYU pragma: keep. */
17
18#include "BKE_callbacks.hh"
19
20#include "RNA_access.hh"
21
22#include "bpy_app_handlers.hh"
23#include "bpy_rna.hh"
24
25#include "BPY_extern.hh"
26
27namespace blender {
28
30 PointerRNA **pointers,
31 const int pointers_num,
32 void *arg);
33
34static PyTypeObject BlenderAppCbType;
35
36#define FILEPATH_SAVE_ARG \
37 "Accepts one argument: " \
38 "the file being saved, an empty string for the startup-file."
39#define PYDOC_FILEPATH_SAVE_TYPE "\n\n:type: list[Callable[[str], None]]"
40
41#define FILEPATH_LOAD_ARG \
42 "Accepts one argument: " \
43 "the file being loaded, an empty string for the startup-file."
44#define PYDOC_FILEPATH_LOAD_TYPE "\n\n:type: list[Callable[[str], None]]"
45
46#define RENDER_STATS_ARG \
47 "Accepts one argument: " \
48 "the render progress as a string containing current frame, current sample, render time and " \
49 "saving time."
50#define PYDOC_RENDER_STATS_TYPE "\n\n:type: list[Callable[[str], None]]"
51
52#define DEPSGRAPH_UPDATE_ARG \
53 "Accepts one or two arguments: " \
54 "The scene data-block, and optionally the dependency graph being updated"
55#define PYDOC_DEPSGRAPH_UPDATE_TYPE \
56 "\n\n:type: list[" \
57 "Callable[[bpy.types.Scene, bpy.types.Depsgraph], None] | " \
58 "Callable[[bpy.types.Scene], None]" \
59 "]"
60
61#define RENDER_ARG \
62 "Accepts one argument: " \
63 "the scene data-block being rendered"
64#define PYDOC_RENDER_TYPE "\n\n:type: list[Callable[[bpy.types.Scene], None]]"
65
66#define OBJECT_BAKE_ARG \
67 "Accepts one argument: " \
68 "the object data-block being baked"
69#define PYDOC_OBJECT_BAKE_TYPE "\n\n:type: list[Callable[[bpy.types.Object], None]]"
70
71#define COMPOSITE_ARG \
72 "Accepts one argument: " \
73 "the scene data-block"
74#define PYDOC_COMPOSITE_TYPE "\n\n:type: list[Callable[[bpy.types.Scene], None]]"
75
76#define ANNOTATION_ARG \
77 "Accepts two arguments: " \
78 "the annotation data-block and dependency graph"
79#define PYDOC_ANNOTATION_TYPE \
80 "\n\n:type: list[Callable[[bpy.types.GreasePencil, bpy.types.Depsgraph], None]]"
81
82#define BLENDIMPORT_ARG \
83 "Accepts one argument: " \
84 "a BlendImportContext"
85#define PYDOC_BLENDIMPORT_TYPE "\n\n:type: list[Callable[[bpy.types.BlendImportContext], None]]"
86
87#define SCENE_ARG \
88 "Accepts one argument: " \
89 "the scene data-block"
90#define PYDOC_SCENE_TYPE "\n\n:type: list[Callable[[bpy.types.Scene], None]]"
91#define PYDOC_HANDLER_TYPE_NONE "\n\n:type: list[Callable[[], None]]"
92#define PYDOC_HANDLER_TYPE_BOOL "\n\n:type: list[Callable[[bool], None]]"
93
97static PyStructSequence_Field app_cb_info_fields[] = {
98 {"frame_change_pre",
99 "Called when a frame change is triggered for playback and rendering, "
100 "before any data is evaluated for the new frame. "
101 "This makes it possible to change data and relations (for example swap an object "
102 "to another mesh) for the new frame. Note that this handler is **not** to be used as 'before "
103 "the frame changes' event. The dependency graph is not available in this handler, as data "
104 "and relations may have been altered and the dependency graph has not yet been updated for "
105 "that. " SCENE_ARG PYDOC_SCENE_TYPE},
106 {"frame_change_post",
107 "Called after frame change for playback and rendering, after the data has been evaluated "
109 {"render_pre", "on render (before). " RENDER_ARG PYDOC_RENDER_TYPE},
110 {"render_post", "on render (after). " RENDER_ARG PYDOC_RENDER_TYPE},
111 {"render_write",
112 "on writing a render frame (directly after the frame is written). " RENDER_ARG
114 {"render_stats", "on printing render statistics. " RENDER_STATS_ARG PYDOC_RENDER_STATS_TYPE},
115 {"render_init", "on initialization of a render job. " RENDER_ARG PYDOC_RENDER_TYPE},
116 {"render_complete", "on completion of render job. " RENDER_ARG PYDOC_RENDER_TYPE},
117 {"render_cancel", "on canceling a render job. " RENDER_ARG PYDOC_RENDER_TYPE},
118
119 {"load_pre",
120 "on loading a new blend file (before). " FILEPATH_LOAD_ARG PYDOC_FILEPATH_LOAD_TYPE},
121 {"load_post",
122 "on loading a new blend file (after). " FILEPATH_LOAD_ARG PYDOC_FILEPATH_LOAD_TYPE},
123 {"load_post_fail",
124 "on failure to load a new blend file (after). " FILEPATH_LOAD_ARG PYDOC_FILEPATH_LOAD_TYPE},
125
126 {"save_pre", "on saving a blend file (before). " FILEPATH_SAVE_ARG PYDOC_FILEPATH_SAVE_TYPE},
127 {"save_post", "on saving a blend file (after). " FILEPATH_SAVE_ARG PYDOC_FILEPATH_SAVE_TYPE},
128 {"save_post_fail",
129 "on failure to save a blend file (after). " FILEPATH_SAVE_ARG PYDOC_FILEPATH_SAVE_TYPE},
130
131 {"undo_pre", "on loading an undo step (before). " SCENE_ARG PYDOC_SCENE_TYPE},
132 {"undo_post", "on loading an undo step (after). " SCENE_ARG PYDOC_SCENE_TYPE},
133 {"redo_pre", "on loading a redo step (before). " SCENE_ARG PYDOC_SCENE_TYPE},
134 {"redo_post", "on loading a redo step (after). " SCENE_ARG PYDOC_SCENE_TYPE},
135 {"depsgraph_update_pre",
136 "on depsgraph update (pre). " DEPSGRAPH_UPDATE_ARG PYDOC_DEPSGRAPH_UPDATE_TYPE},
137 {"depsgraph_update_post",
138 "on depsgraph update (post). " DEPSGRAPH_UPDATE_ARG PYDOC_DEPSGRAPH_UPDATE_TYPE},
139 {"version_update", "on ending the versioning code" PYDOC_HANDLER_TYPE_NONE},
140 {"load_factory_preferences_post",
141 "on loading factory preferences (after)" PYDOC_HANDLER_TYPE_NONE},
142 {"load_factory_startup_post", "on loading factory startup (after)" PYDOC_HANDLER_TYPE_NONE},
143 {"xr_session_start_pre", "on starting an xr session (before)" PYDOC_HANDLER_TYPE_NONE},
144 {"annotation_pre", "on drawing an annotation (before). " ANNOTATION_ARG PYDOC_ANNOTATION_TYPE},
145 {"annotation_post", "on drawing an annotation (after). " ANNOTATION_ARG PYDOC_ANNOTATION_TYPE},
146 {"object_bake_pre", "before starting a bake job. " OBJECT_BAKE_ARG PYDOC_OBJECT_BAKE_TYPE},
147 {"object_bake_complete",
148 "on completing a bake job; will be called in the main "
150 {"object_bake_cancel",
151 "on canceling a bake job; will be called in the main "
153 {"composite_pre",
154 "on a compositing background job (before). " COMPOSITE_ARG PYDOC_COMPOSITE_TYPE},
155 {"composite_post",
156 "on a compositing background job (after). " COMPOSITE_ARG PYDOC_COMPOSITE_TYPE},
157 {"composite_cancel",
158 "on a compositing background job (cancel). " COMPOSITE_ARG PYDOC_COMPOSITE_TYPE},
159 {"animation_playback_pre",
160 "on starting animation playback. " DEPSGRAPH_UPDATE_ARG PYDOC_DEPSGRAPH_UPDATE_TYPE},
161 {"animation_playback_post",
162 "on ending animation playback. " DEPSGRAPH_UPDATE_ARG PYDOC_DEPSGRAPH_UPDATE_TYPE},
163 {"translation_update_post", "on translation settings update" PYDOC_HANDLER_TYPE_NONE},
164 /* NOTE(@ideasman42): This avoids bad-level calls into BPY API
165 * but should not be considered part of the public Python API.
166 * If there is a compelling reason to make these public, the leading `_` can be removed. */
167 {"_extension_repos_update_pre", "on changes to extension repos (before)"},
168 {"_extension_repos_update_post", "on changes to extension repos (after)"},
169 {"_extension_repos_sync", "on creating or synchronizing the active repository"},
170 {"_extension_repos_files_clear",
171 "remove files from the repository directory (uses as a string argument)"},
172 {"blend_import_pre",
173 "on linking or appending data (before). " BLENDIMPORT_ARG PYDOC_BLENDIMPORT_TYPE},
174 {"blend_import_post",
175 "on linking or appending data (after). " BLENDIMPORT_ARG PYDOC_BLENDIMPORT_TYPE},
176 {"exit_pre",
177 "just before Blender shuts down, while all data is still valid. "
178 "Accepts one boolean argument. True indicates either that a user has been using Blender and "
179 "exited, or that Blender is exiting in a circumstance that should be treated as if that were "
180 "the case. False indicates that Blender is running in background mode, or is exiting due to "
181 "failed command line arguments, etc." PYDOC_HANDLER_TYPE_BOOL},
182
183/* sets the permanent tag */
184#define APP_CB_OTHER_FIELDS 1
185 {"persistent",
186 "Function decorator for callback functions not to be removed when loading new files"
187 "\n\n:type: type"},
188
189 {nullptr},
190};
191
192static PyStructSequence_Desc app_cb_info_desc = {
193 /*name*/ "bpy.app.handlers",
194 /*doc*/ ".. include:: include__bpy_app_handlers.rst\n",
195 /*fields*/ app_cb_info_fields,
196 /*n_in_sequence*/ ARRAY_SIZE(app_cb_info_fields) - 1,
197};
198
199#if 0
200# if (BKE_CB_EVT_TOT != ARRAY_SIZE(app_cb_info_fields))
201# error "Callbacks are out of sync"
202# endif
203#endif
204
205/* -------------------------------------------------------------------- */
208
209#define PERMINENT_CB_ID "_bpy_persistent"
210
211static PyObject *bpy_app_handlers_persistent_new(PyTypeObject * /*type*/,
212 PyObject *args,
213 PyObject * /*kwds*/)
214{
215 PyObject *value;
216
217 if (!PyArg_ParseTuple(args,
218 "O" /* `func` */
219 ":bpy.app.handlers.persistent",
220 &value))
221 {
222 return nullptr;
223 }
224
225 if (PyFunction_Check(value)) {
226 PyObject **dict_ptr = _PyObject_GetDictPtr(value);
227 if (dict_ptr == nullptr) {
228 PyErr_SetString(PyExc_ValueError,
229 "bpy.app.handlers.persistent wasn't able to "
230 "get the dictionary from the function passed");
231 return nullptr;
232 }
233
234 /* set id */
235 if (*dict_ptr == nullptr) {
236 *dict_ptr = PyDict_New();
237 }
238
239 PyDict_SetItemString(*dict_ptr, PERMINENT_CB_ID, Py_None);
240
241 Py_INCREF(value);
242 return value;
243 }
244
245 PyErr_SetString(PyExc_ValueError, "bpy.app.handlers.persistent expected a function");
246 return nullptr;
247}
248
250static PyTypeObject BPyPersistent_Type = {
251#if defined(_MSC_VER)
252 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
253#else
254 /*ob_base*/ PyVarObject_HEAD_INIT(&PyType_Type, 0)
255#endif
256 /*tp_name*/ "persistent",
257 /*tp_basicsize*/ 0,
258 /*tp_itemsize*/ 0,
259 /*tp_dealloc*/ nullptr,
260 /*tp_vectorcall_offset*/ 0,
261 /*tp_getattr*/ nullptr,
262 /*tp_setattr*/ nullptr,
263 /*tp_as_async*/ nullptr,
264 /*tp_repr*/ nullptr,
265 /*tp_as_number*/ nullptr,
266 /*tp_as_sequence*/ nullptr,
267 /*tp_as_mapping*/ nullptr,
268 /*tp_hash*/ nullptr,
269 /*tp_call*/ nullptr,
270 /*tp_str*/ nullptr,
271 /*tp_getattro*/ nullptr,
272 /*tp_setattro*/ nullptr,
273 /*tp_as_buffer*/ nullptr,
274 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
275 /*tp_doc*/ nullptr,
276 /*tp_traverse*/ nullptr,
277 /*tp_clear*/ nullptr,
278 /*tp_richcompare*/ nullptr,
279 /*tp_weaklistoffset*/ 0,
280 /*tp_iter*/ nullptr,
281 /*tp_iternext*/ nullptr,
282 /*tp_methods*/ nullptr,
283 /*tp_members*/ nullptr,
284 /*tp_getset*/ nullptr,
285 /*tp_base*/ nullptr,
286 /*tp_dict*/ nullptr,
287 /*tp_descr_get*/ nullptr,
288 /*tp_descr_set*/ nullptr,
289 /*tp_dictoffset*/ 0,
290 /*tp_init*/ nullptr,
291 /*tp_alloc*/ nullptr,
293 /*tp_free*/ nullptr,
294 /*tp_is_gc*/ nullptr,
295 /*tp_bases*/ nullptr,
296 /*tp_mro*/ nullptr,
297 /*tp_cache*/ nullptr,
298 /*tp_subclasses*/ nullptr,
299 /*tp_weaklist*/ nullptr,
300 /*tp_del*/ nullptr,
301 /*tp_version_tag*/ 0,
302 /*tp_finalize*/ nullptr,
303 /*tp_vectorcall*/ nullptr,
304};
305
307
308static PyObject *py_cb_array[BKE_CB_EVT_TOT] = {nullptr};
309
310static PyObject *make_app_cb_info()
311{
312 PyObject *app_cb_info;
313 int pos;
314
315 app_cb_info = PyStructSequence_New(&BlenderAppCbType);
316 if (app_cb_info == nullptr) {
317 return nullptr;
318 }
319
320 for (pos = 0; pos < BKE_CB_EVT_TOT; pos++) {
321 if (app_cb_info_fields[pos].name == nullptr) {
322 Py_FatalError("invalid callback slots 1");
323 }
324 PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos] = PyList_New(0)));
325 }
326 if (app_cb_info_fields[pos + APP_CB_OTHER_FIELDS].name != nullptr) {
327 Py_FatalError("invalid callback slots 2");
328 }
329
330 /* custom function */
331 PyStructSequence_SET_ITEM(app_cb_info, pos++, Py_NewRef((PyObject *)&BPyPersistent_Type));
332
333 return app_cb_info;
334}
335
337{
338 PyObject *ret;
339
340#if defined(_MSC_VER)
341 BPyPersistent_Type.ob_base.ob_base.ob_type = &PyType_Type;
342#endif
343
344 if (PyType_Ready(&BPyPersistent_Type) < 0) {
345 BLI_assert_msg(0, "error initializing 'bpy.app.handlers.persistent'");
346 }
347
348 PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc);
349
351
352 /* prevent user from creating new instances */
353 BlenderAppCbType.tp_init = nullptr;
354 BlenderAppCbType.tp_new = nullptr;
355 /* Without this we can't do `set(sys.modules)` #29635. */
356 BlenderAppCbType.tp_hash = reinterpret_cast<hashfunc>(Py_HashPointer);
357
358 /* assign the C callbacks */
359 if (ret) {
360 static bCallbackFuncStore funcstore_array[BKE_CB_EVT_TOT] = {{nullptr}};
361 bCallbackFuncStore *funcstore;
362 int pos = 0;
363
364 for (pos = 0; pos < BKE_CB_EVT_TOT; pos++) {
365 funcstore = &funcstore_array[pos];
366 funcstore->func = bpy_app_generic_callback;
367 funcstore->alloc = 0;
368 funcstore->arg = POINTER_FROM_INT(pos);
369 BKE_callback_add(funcstore, eCbEvent(pos));
370 }
371 }
372
373 return ret;
374}
375
376void BPY_app_handlers_reset(const bool do_all)
377{
378 PyGILState_STATE gilstate = PyGILState_Ensure();
379 int pos = 0;
380
381 if (do_all) {
382 for (pos = 0; pos < BKE_CB_EVT_TOT; pos++) {
383 /* clear list */
384 PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, nullptr);
385 }
386 }
387 else {
388 /* save string conversion thrashing */
389 PyObject *perm_id_str = PyUnicode_FromString(PERMINENT_CB_ID);
390
391 for (pos = 0; pos < BKE_CB_EVT_TOT; pos++) {
392 /* clear only items without PERMINENT_CB_ID */
393 PyObject *ls = py_cb_array[pos];
394 Py_ssize_t i;
395
396 for (i = PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
397 PyObject *item = PyList_GET_ITEM(ls, i);
398
399 if (PyMethod_Check(item)) {
400 PyObject *item_test = PyMethod_GET_FUNCTION(item);
401 if (item_test) {
402 item = item_test;
403 }
404 }
405
406 PyObject **dict_ptr;
407 if (PyFunction_Check(item) && (dict_ptr = _PyObject_GetDictPtr(item)) && (*dict_ptr) &&
408 (PyDict_GetItem(*dict_ptr, perm_id_str) != nullptr))
409 {
410 /* keep */
411 }
412 else {
413 /* remove */
414 // PySequence_DelItem(ls, i); /* more obvious but slower */
415 PyList_SetSlice(ls, i, i + 1, nullptr);
416 }
417 }
418 }
419
420 Py_DECREF(perm_id_str);
421 }
422
423 PyGILState_Release(gilstate);
424}
425
426static PyObject *choose_arguments(PyObject *func, PyObject *args_all, PyObject *args_single)
427{
428 if (!PyFunction_Check(func)) {
429 return args_all;
430 }
431 PyCodeObject *code = reinterpret_cast<PyCodeObject *>(PyFunction_GetCode(func));
432 if (code->co_argcount == 1) {
433 return args_single;
434 }
435 return args_all;
436}
437
438/* the actual callback - not necessarily called from py */
440 PointerRNA **pointers,
441 const int pointers_num,
442 void *arg)
443{
444 const int cb_index = POINTER_AS_INT(arg);
445 PyObject *cb_list = py_cb_array[cb_index];
446 /* NOTE: check without the GIL as an early exit since there are usually no handlers,
447 * acquiring it every time adds overhead. The size is read again once the GIL is held. */
448 if (PyList_GET_SIZE(cb_list) != 0) {
449 const PyGILState_STATE gilstate = PyGILState_Ensure();
450
451 const int num_arguments = 2;
452 PyObject *args_all = PyTuple_New(num_arguments); /* save python creating each call */
453 PyObject *args_single = PyTuple_New(1);
454
455 /* setup arguments */
456 for (int i = 0; i < pointers_num; ++i) {
457 PyTuple_SET_ITEM(
459 }
460 for (int i = pointers_num; i < num_arguments; ++i) {
461 PyTuple_SET_ITEM(args_all, i, Py_NewRef(Py_None));
462 }
463
464 if (pointers_num == 0) {
465 PyTuple_SET_ITEM(args_single, 0, Py_NewRef(Py_None));
466 }
467 else {
468 PyTuple_SET_ITEM(
469 args_single, 0, pyrna_struct_CreatePyObject_with_primitive_support(pointers[0]));
470 }
471
472 /* Iterate the list and run the callbacks
473 * NOTE: the list size is checked after each call since the scripts may remove themselves. */
474 Py_ssize_t cb_list_num = PyList_GET_SIZE(cb_list);
475 for (Py_ssize_t pos = 0; pos < cb_list_num; pos++) {
476 PyObject *func = PyList_GET_ITEM(cb_list, pos);
477 PyObject *args = choose_arguments(func, args_all, args_single);
478 PyObject *ret = PyObject_Call(func, args, nullptr);
479 if (ret == nullptr) {
480 /* Don't set last system variables because they might cause some
481 * dangling pointers to external render engines (when exception
482 * happens during rendering) which will break logic of render pipeline
483 * which expects to be the only user of render engine when rendering
484 * is finished. */
485
486 /* Note the handler called, the exception itself typically has the function name. */
487 PySys_WriteStderr(
488 "Error in bpy.app.handlers.%s[%d]:\n", app_cb_info_fields[cb_index].name, int(pos));
489 PyErr_PrintEx(0);
490 }
491 else {
492 Py_DECREF(ret);
493 }
494
495 /* Only support removing itself, anything else is impractical to support.
496 * Furthermore it's bad practice and should not be needed.
497 *
498 * Script authors removing other handlers get undefined behavior (although it won't crash).
499 *
500 * NOTE: changes that keep the list size aren't detected, so a handler that removes itself
501 * and appends a handler skips the next handler, accept this limitation. */
502 const Py_ssize_t cb_list_num_next = PyList_GET_SIZE(cb_list);
503 if (cb_list_num != cb_list_num_next) [[unlikely]] {
504 if (cb_list_num_next + 1 == cb_list_num) {
505 /* When a later handler was removed, the handler is still at `pos`. */
506 if (!((pos < cb_list_num_next) && (PyList_GET_ITEM(cb_list, pos) == func))) {
507 pos--;
508 }
509 }
510 else if (cb_list_num_next < cb_list_num) {
511 /* Removed more than one. */
512 PySys_WriteStderr(
513 "Warning in bpy.app.handlers.%s[%d]:\n"
514 "Handlers must only ever remove themselves!\n",
515 app_cb_info_fields[cb_index].name,
516 int(pos));
517 }
518 /* Appending is supported. */
519 cb_list_num = cb_list_num_next;
520 }
521 }
522
523 Py_DECREF(args_all);
524 Py_DECREF(args_single);
525
526 PyGILState_Release(gilstate);
527 }
528}
529
530} // namespace blender
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define BLI_assert_msg(a, msg)
#define PYDOC_RENDER_STATS_TYPE
#define PYDOC_ANNOTATION_TYPE
#define PYDOC_OBJECT_BAKE_TYPE
#define PYDOC_HANDLER_TYPE_BOOL
#define FILEPATH_SAVE_ARG
#define APP_CB_OTHER_FIELDS
#define RENDER_ARG
#define SCENE_ARG
#define PERMINENT_CB_ID
#define FILEPATH_LOAD_ARG
#define DEPSGRAPH_UPDATE_ARG
#define COMPOSITE_ARG
#define PYDOC_HANDLER_TYPE_NONE
#define PYDOC_FILEPATH_LOAD_TYPE
#define PYDOC_RENDER_TYPE
#define PYDOC_FILEPATH_SAVE_TYPE
#define OBJECT_BAKE_ARG
#define PYDOC_SCENE_TYPE
#define ANNOTATION_ARG
#define PYDOC_COMPOSITE_TYPE
#define PYDOC_DEPSGRAPH_UPDATE_TYPE
#define PYDOC_BLENDIMPORT_TYPE
#define RENDER_STATS_ARG
#define BLENDIMPORT_ARG
#define main()
BMesh Iterators.
static PyTypeObject BlenderAppCbType
static PyStructSequence_Desc app_cb_info_desc
void BPY_app_handlers_reset(bool do_all)
void bpy_app_generic_callback(Main *main, PointerRNA **pointers, const int pointers_num, void *arg)
void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
Definition callbacks.cc:87
static PyStructSequence_Field app_cb_info_fields[]
static PyObject * make_app_cb_info()
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
PyObject * BPY_app_handlers_struct()
static PyObject * choose_arguments(PyObject *func, PyObject *args_all, PyObject *args_single)
PyObject * pyrna_struct_CreatePyObject_with_primitive_support(PointerRNA *ptr)
Definition bpy_rna.cc:8910
static PyObject * bpy_app_handlers_persistent_new(PyTypeObject *, PyObject *args, PyObject *)
static PyTypeObject BPyPersistent_Type
static PyObject * py_cb_array[BKE_CB_EVT_TOT]
header-only compatibility defines.
#define Py_HashPointer
void(*) func(Main *, PointerRNA **, int pointers_num, void *arg)