Sub topic 11
How workspaces and modes work together
This chapter assumes you can switch between Object Mode and Edit Mode, you know the built-in workspace tabs along the top of the window, and you can run a short script from the Scripting workspace. The Python sections are optional.
Two separate things that get linked
A mode and a workspace are stored in different places.
- A mode belongs to an object. An object is in Object Mode, Edit Mode, Sculpt Mode, and so on. Only one mode is active at a time for the active object.
- A workspace belongs to the window. It stores the editor layout: which editors are open, how they are split, and what each editor shows.
Neither one forces the other. You can sit in the Modeling workspace in Object Mode, or in Layout in Edit Mode. The link is a setting on the workspace, which Blender applies at one moment only: when you switch to that workspace.
The workspace's Mode setting
Every workspace stores a mode. When you activate the workspace, Blender tries to put the active object into that mode.
To see it in the interface, open the Properties editor and choose the Tool tab. The Workspace panel has a Mode dropdown. It shows the mode that workspace switches to.
In the default startup file, the built-in workspaces use these modes. Versions can differ slightly, so check your own file.
| Workspace | Stored mode | Why |
|---|---|---|
| Layout | Object Mode | Arranging whole objects |
| Modeling | Edit Mode | Shaping mesh geometry |
| Sculpting | Sculpt Mode | Brush work on the mesh |
| UV Editing | Edit Mode | UV islands are edited on selected mesh faces |
| Texture Paint | Texture Paint Mode | Painting image textures |
| Shading | Object Mode | Editing materials on whole objects |
| Animation | Object Mode | Keyframing objects |
| Rendering, Compositing, Geometry Nodes, Scripting | Object Mode | Work that does not need an element-level mode |
This is why clicking the Modeling tab drops you straight into Edit Mode, and clicking Layout brings you back to Object Mode.
What the switch actually does
Switching workspace is equivalent to the layout change plus one mode switch. The mode switch follows the same rules as any other mode change.
- It acts on the active object. If nothing is active, there is nothing to switch.
- It only works if the object type supports the mode. A camera has no Edit Mode in the mesh sense, and a mesh has no Pose Mode. In those cases the object keeps its current mode.
- Leaving a mode runs the normal exit. Leaving Edit Mode writes your edits back to the mesh data, so switching from Modeling to Layout commits the edit.
A practical result is that a workspace tab can change your data state without your touching the mode menu. If you are partway through an Edit Mode operation and click Layout, you leave Edit Mode as a side effect.
Mode changes inside a workspace
You are not locked to the stored mode. In Modeling, you can press Tab to go to Object Mode and continue working there. Your layout stays the same, and only the object's mode changes.
Be careful about what happens the next time you return to that workspace. Blender applies the workspace's stored mode again when you switch to it. Whether the stored mode also follows your manual changes depends on the Blender version, so test it in yours. Change the mode with Tab, look at the Workspace panel's Mode field, and note whether it changed. Then do not assume the same result in an older or newer release.
Workspaces that change the mode, but not for every object
Because the mode switch needs the active object to support the mode, the result depends on what is selected.
- Click Sculpting with a mesh active, and you enter Sculpt Mode.
- Click Sculpting with a light active, and you see the Sculpting layout while the light stays in Object Mode. The viewport then shows no sculpting tools, which can look like a broken workspace.
- Click Modeling with nothing active, and the layout changes but no mode switch happens.
Check the active object before concluding that a workspace is misbehaving.
Per-workspace tool and viewport state
A workspace also remembers some state that is separate from the mode. Examples are which tool is active for each mode and the viewport settings in its 3D Viewport editors, such as shading type and overlays. Two workspaces can both use Edit Mode and still show different tools and different viewport shading, because each workspace keeps its own.
So a workspace is a task setup: a layout, a mode, and a tool state, saved together. The mode is the only part that changes object data.
Reading the stored mode with Python
The workspace's stored mode is exposed on the workspace as object_mode. This script lists the workspaces and their stored modes.
import bpy
for ws in bpy.data.workspaces:
print(f"{ws.name:20} {ws.object_mode}")Run it from the Scripting workspace and read the output in the System Console or the Python Console. The values are the same mode names you see in the Mode dropdown, in uppercase form, such as OBJECT, EDIT, and SCULPT.
Creating a workspace with its own mode
To build a personal workspace, duplicate an existing one, rename it, and set its stored mode. This script makes a copy of the current workspace named "Retopo" that opens in Edit Mode, then activates it.
import bpy
before = set(bpy.data.workspaces.keys())
bpy.ops.workspace.duplicate()
created = [ws for ws in bpy.data.workspaces if ws.name not in before]
if created:
new_ws = created[0]
new_ws.name = "Retopo"
new_ws.object_mode = 'EDIT'
bpy.context.window.workspace = new_ws
print("Created", new_ws.name, "with mode", new_ws.object_mode)
else:
print("No workspace was created")The script compares workspace names before and after the duplicate, so it does not depend on which workspace the operator leaves active. It needs a window context, so run it from the Text Editor with Run Script rather than from a background process.
Doing the mode switch yourself
When a script must be in a particular mode, do not rely on the workspace to put it there. Set the mode directly and check it first.
import bpy
obj = bpy.context.active_object
if obj is not None and obj.type == 'MESH' and obj.mode != 'EDIT':
bpy.ops.object.mode_set(mode='EDIT')
print(obj.mode if obj else "no active object")This is more predictable than a workspace change, because it does not depend on layout loading and it states the mode you need.
Common problems
| Symptom | Likely cause | What to do |
|---|---|---|
| Clicking a tab puts the object in a mode you did not want | The workspace's stored Mode is set to that mode | Change the Mode in the Tool tab of the Properties editor |
| The tab changes the layout but the mode stays the same | The active object does not support the mode, or nothing is active | Select a suitable object and click the tab again |
| Edits seem to vanish after clicking a tab | You left Edit Mode, and the edit was written to the mesh | Re-enter Edit Mode and check the geometry |
| A script reads the old mode after switching workspace | The mode switch is applied after the script step | Set the mode explicitly with `mode_set` |
Exercise
You build a "Retopo" workspace from a copy of Modeling and set its stored mode to Edit Mode. A teammate opens your file, selects the scene's Camera, and clicks the Retopo tab. What do they see, and why?
Show answer
They see the Retopo layout, but the camera stays in Object Mode. Clicking the tab loads the layout and tries to put the active object into the workspace's stored mode. A camera does not support mesh Edit Mode, so the mode switch is skipped and the object keeps its current mode.
Exercise
You want a script to move vertices in Edit Mode. Why is it safer to call bpy.ops.object.mode_set(mode='EDIT') than to switch the window to the Modeling workspace?
Show answer
The mode_set call states exactly the mode you need and applies it to the active object. A workspace switch only applies its stored mode if the object supports it, and the switch may take effect after your script's next line has already run. The workspace also changes the layout, which your script does not need.