[Bf-python] getting the Active Object?

Campbell Barton cbarton at metavr.com
Tue Mar 1 10:21:54 CET 2005


Object.GetSelected()[0] is almost always the active object.
But this is not Always true, Since the active object dosent Have to Be 
Selected to ba active.

I suggest an Object.GetActive(object) and Object.SetActive(object) to be 
added to the Object module allone with Object.GetSelected()
- Cam



Mark Potse wrote:

>Is there a way to identify the Active Object in 
>a BPY script?  As far as I can see, there's only
>the list of selected objects. But for a script that
>modifies a mesh I think it's more appropriate to 
>act on the active object, since that's what is 
>visible in Edit mode. 
>
>It is even possible (perhaps this is a spurious
>feature of Blender) that no object is selected,
>while there is still an active object.
>
>A getCurrent(), such as exists in the Scene module,
>may be the right thing.
>
>
>  
>


-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241




More information about the Bf-python mailing list