Main Workspace Integration
Needs ReviewPublic

Authored by Julian Eisel (Severin) on Fri, Jan 6, 12:01 AM.



Main Workspace Integration

This patch does the main integration of workspaces, which is a concept we agreed on during the 2.8 UI workshop (check the write-up).
Patch/branch based on blender2.8.

Main Changes/Features

  • Introduces the new Workspaces (general description).
  • Store screen-layouts (bScreen) per workspace.
  • Store an active screen-layout per workspace. Changing the workspace will enable this layout.
  • Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
  • Moved mode switch from 3D View header to Info Editor header.
  • Store active scene in window (not directly workspace related, but overlaps quite a bit).
  • Removed 'Use Global Scene' User Preference option.
  • Compatibility with old files - a new workspace is created for every screen-layout of old files.
  • Default .blend only contains one workspace though ('General'). Idea is that users can add pre-configured workspaces from a menu, rather than having a bunch of default ones of which most will probably never be used.
  • Support appending workspaces.
  • Ctrl+Left and Ctrl+Right now cycle through workspaces instead of screens - not sure if that's what users want.

Also made sure opening files without UI and command-line rendering works fine.

Temporary UI for until new top-bar implementation is done.


  • Workspaces are data-blocks.
  • Adding and removing bScreens should be done through ED_workspace_layout API now.
  • A workspace can only be visible in one window. If it could be displayed in multiple ones, all these workspaces would share the same UI data (same editors, same layout, same editor settings, etc) - which doesn't make much sense. Duplicating a window or opening an area in a new window duplicates the active workspace too.
  • The same applies to screen-layouts too. This is nothing new, current Blender already works like this.
  • The mode menu (which is now in the Info Editor header) doesn't display Grease Pencil Edit mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
  • Screen-layouts (bScreen) are IDs and thus stored in a main list-base. Had to add a wrapper WorkSpaceLayout so we can store them in a list-base within workspaces, too. I think on the long run we could completely replace bScreen by workspace structs (by moving screen-layout data to WorkSpaceLayout and everything else to WorkSpace).
  • WorkSpace types should only be accessed through BKE_workspace API, added a compile time check to ensure their DNA headers are only included in DNA and BKE_workspace namespace.
  • For a really few cases, we need the scene within a area/region listener. Previously we could get it from the screen, now we pass it as parameter to the listener. Not so nice to have this for such few cases.
  • Added scene operators SCENE_OT_, was previously done through screen operators.
  • Renamed directories editors/screen/ to editors/workspace/, renamed notifier NC_SCREEN to NC_WORKSPACE (screen is part of workspace now).

Additional changes I had to make:

  • Reworked how we store custom transform orientations in 3D Views. Previously it was enough to store the index of the active orientation in a 3D View as we were always able to find out which scene a 3D View belongs to. This isn't the case now that the scene is stored in the window, because inactive workspaces don't belong to a specified window. When removing a custom orientation we still need to unset it from each 3D view that uses it though, so we need to identify it reliably. Solved by additionally storing the active custom orientation in the 3D view as a pointer, so we can always identify it correctly when removing it.
  • Added support for template_ID to use a custom list to search the IDs in. Needed so workspaces display their own list of screens, not the main list.
  • Added support for data-blocks that are either linkable, appendable or both. Needed so workspaces can be appended but not linked (a linked workspace would mean its entire UI isn't editable).

BPY API Changes

  • Removed Screen.scene, added Window.scene
  • UILayout.template_ID and UILayout.template_ID_preview now additionally take search_data and search_property as parameters to define a custom collection to search the IDs in (optional).
  • Removed UserPreferencesView.use_global_scene
  • Added Context.workspace, Window.workspace and BlendData.workspaces
  • Added bpy.types.WorkSpace containing screen (active screen), screens and object_mode

What's left?

  • Make workspaces part of 'workflow' files -
  • Get the new layer system ready and make workspaces store the active layer.
  • Get the override system ready and support overrides per workspace.
  • Support custom UI setups as part of workspaces.
  • Allow enabling add-ons per workspace.
  • Support custom workspace keymaps.
  • Allow adding a pre-defined workspace from a menu (asset manager?)
  • Workspaces need an icon :)

Diff Detail

rB Blender
Build Status
Buildable 375
Build 375: arc lint + arc unit
Julian Eisel (Severin) updated the summary for this revision. (Show Details)Fri, Jan 6, 12:13 AM
Julian Eisel (Severin) updated the summary for this revision. (Show Details)
Julian Eisel (Severin) updated the summary for this revision. (Show Details)
Julian Eisel (Severin) updated the summary for this revision. (Show Details)Fri, Jan 6, 12:16 AM

As for the state of this: The branch appears to work rock solid now. I don't plan any more changes so feel free to test/review for merge into blender2.8 :)

Julian Eisel (Severin) updated the summary for this revision. (Show Details)Fri, Jan 6, 12:42 AM

Eeek.... sorry for the noise :/

The patch is too big for a throughout review (>10k lines). Any part in particular you think needs cross-checking?

Also, I was under the impression that the user's detault workspaces would be saved in a separate file. I think the patch is not covering this.

Could you create a Doc on how to use this to help with testing. Ive built a branch and compiled for others to test but unclear how to utilize it, For example you image above which shows the workspace tabs at the top of the screen, How do i create these setups? Cheers J