[Bf-python] Proposal to getSelected and getAcitve

Mark Potse mark at potse.nl
Fri Mar 4 17:51:39 CET 2005


Thanks, gentlemen. If there's still no getActive() method, at
least there's some clarification.

On 03-Mar-2005 Willian Padovani Germano wrote:
> Campbell is right, the active object may not be selected (if no object 
> is selected).  But isn't it better to only allow access to an active 
> object if it is selected?  This gives a clear, well defined and 
> *reliable* way to access the active object.

It depends on the purpose of the script. I think it is intuitive and 
useful to act on the active object when doing something that would
be done in edit mode when done manually. Modifying a mesh, for example.

I encountered the problem after writing a little script that fills
one or more holes in a mesh, and takes a (coarse) selection of vertices
as input to know which hole to fill. So this script is typically 
called while Blender is in edit mode. I noticed that sometimes the
script didn't work, and it took a long time before I found out that
there was no object selected, while there was still an object in 
edit mode. I expected my script to act on the thing that I saw.

For scripts that do things with objects or scenes etc it may be
better to act on selected objects, though.

Why/when would it be unreliable to access an active but unselected
object?


Mark


-- 
 Mark Potse  < http://www.potse.nl >
 Institute of Biomedical Engineering
 University of Montreal * * * Canada



More information about the Bf-python mailing list