Page MenuHome

Python Callback (Scriptlink functionality)
Closed, ArchivedPublicPATCH

Description

This patch adds callbacks for use in C and Python
- callbacks which can be added in C (not related to python), each callback receives optional context, main, id and its own argument.

- python adds its own callback which scripters can access, this is a simple callback

def MyFunc(context, data): print("Callback:", data)
bpy.app.callbacks.load_post += [MyFunc]

The callbacks are cleared on loading new files as with drivers.

To keep the patch simple to review I've only added render and load callbacks.

Event Timeline

note,
#include "../../blenlib/intern/BLI_callbacks.h"
Ill move this file, just didnt for the purpose of having the patch easier to read.

should have mentioned the python callbacks get a context and ID Data or None. On render passes a scene for instance.

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Unknown Status.Jun 24 2011, 6:55 PM