Sub topic 5
Extending, deselecting, and inverting the selection
This chapter assumes you can orbit, pan, and zoom the viewport, know the X, Y, and Z axes, and use the default keymap with left-click select. You should also know the difference between a selected object and the active object from the earlier chapters. Here you will learn how to change a selection without losing it, because most transform mistakes begin with the wrong objects selected.
Why selection modifiers matter
A plain click replaces the whole selection. Real scenes need more: add one more object, remove a stray one, or select everything except a few items. Blender gives you modifier keys and shortcuts for each case. All of them work in Object Mode.
The selection is a set of objects, and one of them can also be the active object. Every operation in this chapter changes that set. Some of them also change which object is active, and that matters for the transforms covered in later chapters.
The core shortcuts
| Goal | Default keymap action |
|---|---|
| Replace the selection with one object | Click the object |
| Add an object to the selection | Shift+click an unselected object |
| Remove an object from the selection | Shift+click a selected, non-active object |
| Make a selected object the active one | Shift+click a selected, non-active object (see the next section for the exact behavior) |
| Deselect everything | Alt+A, or click empty space |
| Select everything | A |
| Invert the selection | Ctrl+I |
| Select one object in a stack of overlapping ones | Alt+click cycles through them |
The next sections explain how each row works and where it surprises people.
Extending with Shift+click
Hold Shift and click an object to add it to the selection. The object you clicked last becomes the active object. It is drawn in a lighter orange outline than the other selected objects, so you can tell which one is active.
Shift+click behaves like a three-state cycle on the object you click:
- If the object is not selected, it becomes selected and active.
- If it is selected but not active, it becomes active and stays selected.
- If it is selected and active, it is deselected.
This catches many users out. Suppose three objects are selected and you want to remove one. A single Shift+click on a selected but non-active object makes it active. It does not remove it. A second Shift+click then deselects it. Watch the outline color after each click.
Deselecting
You have three ways to deselect.
- Alt+A deselects everything. This is the safest reset, and it works wherever the cursor is in the viewport.
- Click on empty space deselects everything when the Select tool is active. With the default Tweak or Select Box tool, a click on nothing clears the selection.
- Shift+click on the active object removes just that object.
Deselecting does not always clear the active object. After Alt+A, the last active object can still be referenced by Blender, but it is no longer selected, so tools that act on selected objects ignore it. Python scripts see this difference clearly, as the example later in this chapter shows.
Selecting all and inverting
Press A to select every selectable object in the current view layer. Hidden objects and objects with selection disabled are skipped.
Press Ctrl+I to invert the selection. Every selected object becomes unselected, and every unselected selectable object becomes selected. Inversion is the fastest way to say "everything except these":
- Click the objects you want to leave alone, using Shift+click for several.
- Press Ctrl+I.
- Everything else is now selected.
You can also find these commands in the Select menu of the 3D Viewport header: All, None, Invert, and the box, circle, and lasso options from the previous chapter.
Selecting from overlapping objects
When objects sit inside or behind each other, a click always picks the front-most one. Hold Alt and click the same spot repeatedly to cycle through the objects under the cursor. With Shift held as well, you can extend the selection while cycling. Another option is the Outliner, which lists every object by name. Click a name in the Outliner to select it. Ctrl+click adds to the selection, and Shift+click selects a range. The Outliner is also the reliable way to reach objects that are fully hidden inside others.
Combining modifiers with the selection tools
Box, circle, and lasso selection also respect modifier behavior. With the Select Box tool active, dragging replaces the selection by default. The tool options in the header offer mode buttons: Set, Extend, Subtract, Difference, and Intersect. These make the tool behave the same way every time without holding keys.
- Shift+drag extends the selection with the box.
- Ctrl+drag subtracts the boxed objects from the selection.
This is useful in crowded scenes. Select a large area with one box, then Ctrl+drag a smaller box to remove the objects you did not want.
Common errors
- Transforming the wrong set. You pressed G with an extra object still selected, and it moved too. Press Alt+A and rebuild the selection, or look for orange outlines before starting any transform.
- Expecting Shift+click to deselect in one click. On a selected non-active object, the first click only makes it active. Click again to remove it.
- Inverting with hidden objects. Ctrl+I does not touch hidden objects. If an object seems missing after inversion, check whether it is hidden with H or disabled for selection in the Outliner filter.
- Selecting in the wrong mode. These shortcuts act on objects only in Object Mode. In Edit Mode, the same keys act on vertices, edges, or faces.
- Selection disabled. Objects with the selection arrow turned off in the Outliner cannot be clicked, boxed, or inverted into the selection.
The same operations in Python
Selection state lives on objects and on the view layer. This script deselects everything, selects two named objects, then inverts the result by hand.
import bpy
bpy.ops.object.select_all(action='DESELECT')
for name in ("Cube", "Sphere"):
obj = bpy.data.objects.get(name)
if obj is not None:
obj.select_set(True)
# Make one of them active, as Shift+click would
cube = bpy.data.objects.get("Cube")
if cube is not None:
bpy.context.view_layer.objects.active = cube
# Invert: the same effect as Ctrl+I
bpy.ops.object.select_all(action='INVERT')
print([o.name for o in bpy.context.selected_objects])
print(bpy.context.view_layer.objects.active)The select_all operator takes 'SELECT', 'DESELECT', 'INVERT', and 'TOGGLE' as its action. Note that after inversion, Cube is no longer selected, yet it can still be the active object. That mirrors what you see in the viewport: the active object only has the lighter outline when it is also selected.
Checkpoints
Exercise
Three objects are selected, and object B is selected but not active. You Shift+click B once. What happens to B, and what do you do to remove it from the selection?
Show answer
The first Shift+click makes B the active object, and it stays selected. Shift+click B a second time, now that it is active, to deselect it.
Exercise
A scene has 40 objects. You want to move everything except the Camera and the Light. Describe the shortest selection method.
Show answer
Click the Camera, Shift+click the Light, and press Ctrl+I. Everything else that is visible and selectable is now selected, and G will move it.
Exercise
After running select_all with action='INVERT' in a script, the active object is still set but is not in the selected list. Why is this possible?
Show answer
The active object and the selection are separate states. Inversion changes which objects are selected, while view_layer.objects.active keeps pointing to the same object until you assign a different one.