[Bf-committers] SystemError when using simple mesh commands in scripts started from the command line...

Dietrich Bollmann diresu at web.de
Sun Nov 8 13:28:00 CET 2009


Hi Martin,

Thanks for your explanations!

> [1] Operators have two calling modes: exec and invoke. Invoke is for
interactive operations and exec is for instantaneous operations (an
operator can be made to work in both modes, some have invoke redirect to
exec).

So invoke would be used for functionality which for instance use mouse
input to rotate some object?

And operations used in a script which does not need user input would
only use exec?

> The event is required for all invoke operator calls, there's no way to
skip it in those case. What could be done is not requiring it when an
operator runs with exec.

Probably the bpy.ops.mesh.primitive_cube_add() command than would be of
the second kind and not require the window context?  

This should make all non-interactive scripts work I suppose - and solve
my problem :)

Just by curiosity:

Concerning interactive commands, why isn't it enough to specify the
window(s) when registering an event handler? 

Aren't interactive commands (event handlers) reacting on user input
invoked by events in the queue of the window they registered for?  As
there is exactly one event queue per window the window should be clear,
no?

Non-interactive commands on the other hand wouldn't need the context at
all.  (At least if they only manipulate a scene and not some window
itself.) 

Are there documents which explain Blenders new event system?

Thanks again!

Cheers, Dietrich


> On Sat, 2009-11-07 at 10:22 -0800, Martin Poirier wrote:
> Hi,
> 
> --- On Sat, 11/7/09, Dietrich Bollmann <diresu at web.de> wrote:
> 
> > I understand that the scene has to be set (the syntax could
> > be nicer
> > though) and I suppose that the window is necessary for
> > polling the
> > current windows event queue before executing the command
> > when creating
> > meshes from the GUI.
> 
> The window is used to get the event during operator execution when using invoke and not exec[1].
> 
> > If this intuition should be right it probably doesn't make
> > sense to poll
> > any window queue when executing code from a script and it
> > should be
> > enough to skip the polling when the window context is not
> > set at the
> > place of throwing an error?
> 
> The event is required for all invoke operator calls, there's no way to skip it in those case. What could be done is not requiring it when an operator runs with exec.
> 
> Martin
> 
> [1] Operators have two calling modes: exec and invoke. Invoke is for interactive operations and exec is for instantaneous operations (an operator can be made to work in both modes, some have invoke redirect to exec).
> 
> 
>       __________________________________________________________________
> Looking for the perfect gift? Give the gift of Flickr! 
> 
> http://www.flickr.com/gift/
> _______________________________________________
> 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