Sub topic 2
Selecting objects
Every transform in Blender acts on the current selection. Before you move, rotate, or scale anything, you need to know which objects are selected, how to change that, and why a click sometimes selects nothing. This chapter covers the selection itself: what it is, how it is stored, and the basic ways to change it. It assumes you have Blender installed with the default keymap (left-click select), that you can orbit, pan, and zoom the viewport, and that you know the X, Y, and Z axes.
Other chapters cover the active object, box, circle, and lasso selection, and the extend and invert modifiers. This chapter stays with the core idea.
What a selection is
A selection is a set of objects that the next operator will act on. An operator is a command such as move, delete, or duplicate. Selection has two properties worth knowing:
- Each object has its own selected flag. Selecting one object does not change the flag on any other object unless the click also deselects the others.
- The flag belongs to the object within a view layer. A view layer is the list of collections and objects that the current scene shows. An object can be selected in one view layer and not in another.
In Object Mode, the selection holds whole objects. In Edit Mode, the selection holds vertices, edges, or faces of one object. If your click selects mesh points instead of whole objects, check the mode selector at the top-left of the viewport and switch back to Object Mode (Tab toggles Edit Mode for a mesh).
Reading the selection in the viewport
Blender shows selection with an outline around the object:
| Look | Meaning |
|---|---|
| No outline | Not selected |
| Dark orange outline | Selected |
| Light yellow-orange outline | Selected, and the active object |
The header of the viewport and the status bar can also help. Turn on Statistics in the status bar (right-click it) to see counts such as Objects 2/5, meaning two of five objects are selected. The Outliner, the tree list at the top right, also highlights the names of selected objects.
Selecting with a click
With the default keymap, these basic actions cover most work:
- Left-click an object to select it. Any previously selected objects are deselected, so the selection becomes exactly one object.
- Left-click empty space to deselect everything.
- Press A to select all visible, selectable objects.
- Press Alt+A to deselect all.
The same actions exist in the Select menu in the viewport header (All, None, Invert). Use the menu if you forget a shortcut.
A click picks the object whose surface is under the cursor, not the object nearest in the scene. In wireframe view or with X-ray on (Alt+Z), Blender can also pick objects by their edges, even through other geometry.
Cycling through overlapping objects
When objects overlap along your line of sight, a click selects the front one. To reach one behind it, hold Alt and left-click repeatedly. Blender opens a pick list or cycles through the objects under the cursor, depending on version and settings. Some Linux window managers use Alt+click for moving windows. If Alt+click does nothing in the viewport, change that window manager setting or select from the Outliner instead.
Selecting from the Outliner
The Outliner lists every object by name, grouped under collections. Clicking a name selects that object and deselects the others, just like a viewport click. This is the most reliable method when an object is hidden behind others, very small, or far out of view.
Two things to know:
- Clicking a collection name selects the collection as the active collection. It does not select the objects inside it. To select all objects in a collection, right-click it and choose Select Objects.
- The Outliner and the viewport share one selection. Selecting in one updates the other.
Why an object will not select
If clicking has no effect, one of these usually applies:
- The object is hidden. Hidden objects (H in the viewport, or the eye icon in the Outliner) cannot be selected. Press Alt+H to reveal hidden objects. Revealed objects become selected.
- The object is disabled for selection. The Outliner has a filter for a selectability toggle, shown as an arrow icon. Open the filter dropdown at the top of the Outliner and enable Selectable. When the arrow is off for an object, clicks in the viewport pass through it.
- The collection is excluded. An unchecked collection checkbox removes its objects from the view layer entirely.
- You are in the wrong mode. In Edit Mode or Sculpt Mode, clicks act on mesh data or brush strokes, not whole objects.
- A lock or tool is interfering. A selected tool in the toolbar that is not Select Box or Tweak can turn a click-drag into something else. Pick the Select Box tool at the top of the toolbar.
How selection flows
Selection in Python
The selection is also data you can read from a script. In the Scripting workspace, you can list what is selected:
import bpy
for obj in bpy.context.selected_objects:
print(obj.name, obj.type)
print("Count:", len(bpy.context.selected_objects))bpy.context.selected_objects is a list of the objects that are selected in the current view layer. It is read-only: assigning to it does nothing useful. To change the selection, set the flag on each object, or use an operator.
To test a single object, ask for its flag:
import bpy
obj = bpy.data.objects.get("Cube")
if obj is not None:
print(obj.name, "selected:", obj.select_get())select_get() and select_set() are methods rather than properties because the state depends on the view layer. Setting the flag is covered later in the chapter on Python transforms. For now, notice that bpy.data.objects lists every object in the file, while bpy.context.selected_objects lists only the ones the user has selected and can see.
Common errors
- Deleting or moving the wrong thing. Often the selection holds more objects than you thought. Check the status bar count and the Outliner highlights before you run an operator.
- Expecting a click to add to the selection. A plain click replaces the selection. The extend modifiers are the subject of a later chapter.
- Selecting a collection instead of its objects. Use Select Objects from the collection's context menu.
- A script that finds nothing.
selected_objectsis empty when nothing is selected, and it reflects the view layer of the current context. Scripts run from a timer, a handler, or the command line may see a different context from the one you expect.
Exercise
Exercise
You click an object in the viewport and the Outliner highlights its name, but the next click on a second object leaves only the second object selected. Why, and what does the status bar show after each click?
Show answer
A plain left-click replaces the selection: Blender deselects every other object and then selects the one under the cursor. After the first click the status bar shows 1 object selected, and after the second click it still shows 1, with the second object highlighted in the Outliner.
Exercise
A script prints an empty list for bpy.context.selected_objects, although you can see an object in the viewport. Name two possible reasons.
Show answer
The object is visible but not selected (no orange outline), or the object is in a different view layer than the one in the script's context. A third possibility is that the script is running in a context where the view layer differs from the one on screen.