9
$\begingroup$

I'm writing a generic add-on bpy.types.Operator based on this question. It creates and arranges planes along an object, then splits the object along each new plane.

The user has control over the number of planes to arrange, and the direction along which to arrange them. The way I'm going now, everything happens in the execute method, so the user never sees how the planes are arranged; they're added, the object is split, and they go away all at once.

In this case, it'd be nice to have the execute method be responsible for laying the planes, and then a "final apply" hook splits the object, and removes the planes.

Is it possible to have a block of code run after an operator finishes?

(Is this possible within the python API, or must it be implemented as a modifier in C?)

$\endgroup$
3
  • 1
    $\begingroup$ I don't have time to look into it this very second, but at first blush, I'd say look into how modal operators work. Modal workflows tend to be frowned upon in Blender, but they're not explicitly disallowed. $\endgroup$
    – Fweeb
    Jul 1, 2013 at 15:25
  • 2
    $\begingroup$ A related question is here: blender.stackexchange.com/q/431/228 $\endgroup$
    – satishgoda
    Jul 1, 2013 at 15:28
  • $\begingroup$ You may check on macros, which let you chain multiple operator calls. $\endgroup$
    – CodeManX
    Mar 9, 2014 at 4:37

1 Answer 1

4
$\begingroup$

No, Blender doesn't have this functionality, Check on the documentation for bpy.app.handlers, aside from this we don't provide other hooks into Blender.

$\endgroup$
2
  • $\begingroup$ It seems that modifiers do this. For example, the mirror modifier will show the greyed out result of the reflection until it's finally applied, then they become editable vertices/edges/faces. Might I be able to implement what I'm after as a modifier? $\endgroup$
    – ajwood
    Jul 2, 2013 at 13:26
  • $\begingroup$ @ajwood, yep, modifiers can do some operation on-top of geometry you make, but currently this must be written in C and isn't possible with python hooks. $\endgroup$
    – ideasman42
    Jul 2, 2013 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .