own patch [#27752] Python Callback (Scriptlink functionality)
Python: * adds bpy.app.handlers which contains lists, each for an event type: render_pre, render_post, load_pre, load_post, save_pre, save_post * each list item needs to be a callable object which takes 1 argument (the ID). * callbacks are cleared on file load. Example: def MyFunc(scene): print("Callback:", data) bpy.app.handlers.render_post.append(MyFunc) C: * This patch adds a generic C callback api which is currently only used by python. * Unlike python callbacks these are not cleared on file load.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <Python.h>
|
||||
|
||||
#include "bpy_app.h"
|
||||
#include "bpy_app_handlers.h"
|
||||
#include "bpy_driver.h"
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
@@ -74,6 +75,9 @@ static PyStructSequence_Field app_info_fields[]= {
|
||||
{(char *)"build_cxxflags", (char *)"C++ compiler flags"},
|
||||
{(char *)"build_linkflags", (char *)"Binary linking flags"},
|
||||
{(char *)"build_system", (char *)"Build system used"},
|
||||
|
||||
/* submodules */
|
||||
{(char *)"handlers", (char *)"Application handler callbacks"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -140,6 +144,8 @@ static PyObject *make_app_info(void)
|
||||
SetStrItem("Unknown");
|
||||
#endif
|
||||
|
||||
SetObjItem(BPY_app_handlers_struct());
|
||||
|
||||
#undef SetIntItem
|
||||
#undef SetStrItem
|
||||
#undef SetObjItem
|
||||
|
Reference in New Issue
Block a user