A Python "Pick" button

Hi All,

In Maxscript, there is a user input object called a “pick button.” You can create an instance of this button in your UI and when a user clicks the button at runtime it allows the user to pick and object in the scene and returns the object to the script (very handy).

Is there anything like that in Blender python?

Just passing by and saw this Q.

In blender python, you get at the active object(s) with:

objs = Blender.Object.GetSelected()

Thereafter, objs will be a list of all selected objects in the scene. The active object is always the first object in the list.

Hope this helps.

objs = Blender.Object.GetSelected() - is a bit flaw’d because
its possible for the active object not to be selected.
a new and better say to do this is…


import bpy
sce = bpy.data.scenes.active
obact = sce.objects.active # last selected object
obsel = sce.objects.context # all visible, selected, non hidden objects