[Bf-committers] bpy callback patch (replace scriptlink like functionality from 2.4x)

Bassam Kurdali bkurdali at freefactory.org
Fri Jun 24 18:12:15 CEST 2011


Will it be possible to set callbacks e.g. for transforms? i.e. if a
bone/face/vert moves in edit mode?

On Fri, 2011-06-24 at 09:02 -0700, Lorenzo Pierfederici wrote:
> Hi Campbell,
> 
> maybe the callbacks could have a name associated with them when registered,
> like:
> bpy.app.callbacks.render_post.append('my_callback', func)
> 
> That would make it easier to remove them from a script, and would probably
> make things easier in a gui, too.
> 
> cheers,
> lorenzo
> 
> On Fri, Jun 24, 2011 at 6:27 AM, Campbell Barton <ideasman42 at gmail.com>wrote:
> 
> > This is something thats been requested to be brought back from 2.4x
> > for quite a while,
> > however I wasn't that happy with scriptlinks having to be setup per
> > datablock, then scanning every datablock on frame change to see if any
> > have frame change scriptlinks for example - not too efficient and
> > cumbersome to manage scripts attached to each datablock.
> >
> > The method I'm proposing is to have scripts register functions with an
> > event, example.
> >
> > def func(context, scene): print("Render", scene)
> > bpy.app.callbacks.render_post.append(func)
> >
> > This way text's with 'Register' enabled can setup the event handlers
> > when loading the file.
> >
> > There are are of course cases where you might want to have a callbacks
> > associated with a specific datablock which this method doesn't deal
> > with.
> > instead you'd need to filter the data you want to operate on within
> > the callback - IMHO its just a trade-off between the 2 methods.
> >
> > Heres the patch which has some more details, only render and load
> > pre/post callbacks are done.
> > I'll add more if this general method is acceptable.
> >
> >
> > http://projects.blender.org/tracker/index.php?func=detail&aid=27752&group_id=9&atid=127
> >
> > --
> > - Campbell
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
> >
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers




More information about the Bf-committers mailing list