Page MenuHome

Python handlers for operators
AbandonedPublic

Authored by Alexander Romanov (a.romanov) on Jun 6 2016, 6:00 PM.

Details

Summary

A large part of Blender logic is implemented through operators' calls. And sometime it is necessary to handle such events.
This patch adds new hooks to handle exec, invoke and modal methods.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D2052

Event Timeline

Alexander Romanov (a.romanov) retitled this revision from to Python handlers for operators.
Alexander Romanov (a.romanov) updated this object.
source/blender/python/intern/bpy_app_handlers.c
325

I'm not sure that this way to return the result is right.

Alexander Romanov (a.romanov) removed rB Blender as the repository for this revision.

Hi, am quite skeptical of this feature since its very easy for script authors to add overhead to _all_ Blender interactions, especially since operators run for example - on mouse-wheel, updating modal operators with a timer (many times a second).

I'd like to see some example use-cases of this, maybe it can be supported differently, or limited to spesific operators.

Even this I find a bit weak, since probably Python developers want to handle low level events.
So in this case having to attach some handler to every operator that may select (for example) is weak too.

Example events could include: (object_ ... create / delete / select / hide / reveal / mode_change ... _pre / _post).
Even in this case, we may not want to expose so many editing operations as handlers, I'm just saying that if we are to support more handlers, I would see about doing it this way... not that it's certain we accept this into master.

I think this needs to be more in a design discussion phase then code we accept/reject.

Would you mind making a design task for this, and link it in the reply?

While the ability to have Python interact with operators can be useful, this patch isn't going to be accepted in its current state.

Closing.