[Bf-blender-cvs] [7f564d74f9e] blender2.8: Main Workspace Integration

Julian Eisel noreply at git.blender.org
Thu Jun 1 20:09:38 CEST 2017


Commit: 7f564d74f9edaaa41ce27c6e854869096f70b4da
Author: Julian Eisel
Date:   Thu Jun 1 19:56:58 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB7f564d74f9edaaa41ce27c6e854869096f70b4da

Main Workspace Integration

This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)

Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)

== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* 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.)
* Store an active render layer per workspace.
* 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. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.

Opening files without UI and commandline rendering should work fine.

Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.

== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* 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).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* 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. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.

== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)

== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)

Reviewed By: campbellbarton, mont29

Tags: #user_interface, #bf_blender_2.8

Maniphest Tasks: T50521

Differential Revision: https://developer.blender.org/D2451

===================================================================

M	build_files/cmake/macros.cmake
M	doc/doxygen/doxygen.source.h
A	release/datafiles/workspaces.blend
M	release/scripts/startup/bl_ui/space_info.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/CMakeLists.txt
M	source/blender/blenkernel/BKE_appdir.h
M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenkernel/BKE_blendfile.h
M	source/blender/blenkernel/BKE_context.h
M	source/blender/blenkernel/BKE_layer.h
M	source/blender/blenkernel/BKE_library.h
M	source/blender/blenkernel/BKE_main.h
M	source/blender/blenkernel/BKE_scene.h
M	source/blender/blenkernel/BKE_screen.h
A	source/blender/blenkernel/BKE_workspace.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/blendfile.c
M	source/blender/blenkernel/intern/context.c
M	source/blender/blenkernel/intern/idcode.c
M	source/blender/blenkernel/intern/image.c
M	source/blender/blenkernel/intern/layer.c
M	source/blender/blenkernel/intern/library.c
M	source/blender/blenkernel/intern/library_query.c
M	source/blender/blenkernel/intern/library_remap.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenkernel/intern/screen.c
A	source/blender/blenkernel/intern/workspace.c
M	source/blender/blenloader/BLO_readfile.h
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/blentranslation/BLT_translation.h
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/editors/CMakeLists.txt
M	source/blender/editors/animation/anim_markers.c
A	source/blender/editors/include/ED_scene.h
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_eyedropper.c
M	source/blender/editors/interface/interface_regions.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/interface/interface_utils.c
M	source/blender/editors/interface/resources.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/object/object_select.c
M	source/blender/editors/render/render_internal.c
M	source/blender/editors/render/render_update.c
M	source/blender/editors/render/render_view.c
A	source/blender/editors/scene/CMakeLists.txt
A	source/blender/editors/scene/scene_edit.c
M	source/blender/editors/screen/CMakeLists.txt
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/screen_context.c
M	source/blender/editors/screen/screen_draw.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/screen/screen_intern.h
M	source/blender/editors/screen/screen_ops.c
A	source/blender/editors/screen/workspace_edit.c
A	source/blender/editors/screen/workspace_layout_edit.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/space_action/space_action.c
M	source/blender/editors/space_api/spacetypes.c
M	source/blender/editors/space_buttons/space_buttons.c
M	source/blender/editors/space_clip/clip_editor.c
M	source/blender/editors/space_file/file_utils.c
M	source/blender/editors/space_file/filesel.c
M	source/blender/editors/space_graph/space_graph.c
M	source/blender/editors/space_image/space_image.c
M	source/blender/editors/space_info/space_info.c
M	source/blender/editors/space_nla/space_nla.c
M	source/blender/editors/space_node/node_edit.c
M	source/blender/editors/space_node/space_node.c
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_select.c
M	source/blender/editors/space_outliner/outliner_tools.c
M	source/blender/editors/space_outliner/space_outliner.c
M	source/blender/editors/space_time/space_time.c
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/editors/space_view3d/view3d_draw_legacy.c
M	source/blender/editors/space_view3d/view3d_header.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/editors/transform/transform_ops.c
M	source/blender/editors/transform/transform_orientations.c
M	source/blender/editors/util/CMakeLists.txt
M	source/blender/imbuf/intern/thumbs_blend.c
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesdna/DNA_defs.h
M	source/blender/makesdna/DNA_fileglobal_types.h
M	source/blender/makesdna/DNA_screen_types.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesdna/DNA_windowmanager_types.h
A	source/blender/makesdna/DNA_workspace_types.h
M	source/blender/makesdna/intern/makesdna.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_ID.c
M	source/blender/makesrna/intern/rna_context.c
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_main.c
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_screen.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_space_api.c
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/makesrna/intern/rna_wm.c
A	source/blender/makesrna/intern/rna_workspace.c
M	source/blender/python/intern/bpy_library_load.c
M	source/blender/python/intern/bpy_rna.c
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm.c
M	source/blender/windowmanager/intern/wm_draw.c
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/blender/windowmanager/intern/wm_files_link.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/intern/wm_stereo.c
M	source/blender/windowmanager/intern/wm_subwindow.c
M	source/blender/windowmanager/intern/wm_window.c
M	source/blender/windowmanager/wm_files.h
M	source/blender/windowmanager/wm_window.h
M	source/blenderplayer/bad_level_call_stubs/stubs.c
M	source/creator/CMakeLists.txt
M	source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp

===================================================================

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index bb356f51ab9..92342d580c3 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -585,6 +585,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
 		bf_editor_armature
 		bf_editor_physics
 		bf_editor_render
+		bf_editor_scene
 		bf_editor_screen
 		bf_editor_sculpt_paint
 		bf_editor_sound
diff --git a/doc/doxygen/doxygen.source.h b/doc/doxygen/doxygen.source.h
index 3ef20466664..6f12991fb44 100644
--- a/doc/doxygen/doxygen.source.h
+++ b/doc/doxygen/doxygen.source.h
@@ -223,6 +223,10 @@
  *  \ingroup editors
  */
 
+/** \defgroup edscene scene
+ *  \ingroup editors
+ */
+
 /** \defgroup edsculpt sculpt and paint
  *  \ingroup editors
  */
diff --git a/release/datafiles/workspaces.blend b/release/datafiles/workspaces.blend
new file mode 100644
index 00000000000..4e5e9646830
Binary files /dev/null and b/release/datafiles/workspaces.blend differ
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 90168429724..f05808c7a2c 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -28,7 +28,10 @@ class INFO_HT_header(Header):
         layout = self.layout
 
         window = context.window
+        workspace = context.workspace
+        screen = context.screen
         scene = context.scene
+        layer = context.render_layer
         rd = scene.render
 
         row = layout.row(align=True)
@@ -36,15 +39,27 @@ class INFO_HT_header(Header):
 
         INFO_MT_editor_menus.draw_collapsible(context, layout)
 
-        if window.screen.show_fullscreen:
+        layout.separator()
+
+        if screen.show_fullscreen:
             layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
             layout.separator()
         else:
-            layout.template_ID_preview(context.window, "screen", new="screen.new", unlink="screen.delete", rows=2, cols=6)
-            layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
+            layout.template_ID(window, "workspace", new="workspace.workspace_add_menu", unlink="workspace.workspace_delete")
+            layout.template_search_preview(window, "screen", workspace, "screens", new="screen.new", unlink="screen.delete", rows=2, cols=6)
+
+        if hasattr(workspace, 'object_mode'):
+            act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[workspace.object_mode]
+        else:
+            act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[layer.objects.active.mode]
+        layout.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon)
+
+        layout.template_search(workspace, "render_layer", scene, "render_layers")
 
         layout.separator()
 
+        layout.template_ID(window, "scene", new="scene.new", unlink="scene.delete")
+
         if rd.has_multiple_engines:
             layout.prop(rd, "engine", text="")
 
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index dad8ca73dce..0250f4a8ce8 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -57,7 +57,9 @@ class USERPREF_HT_header(Header):
 
         layout.operator_context = 'INVOKE_DEFAULT'
 
-        if userpref.active_section == 'INPUT':
+        if userpref.active_section == 'INTERFACE':
+            layout.operator("wm.save_workspace_file")
+        elif userpref.active_section == 'INPUT':
             layout.operator("wm.keyconfig_import")
             layout.operator("wm.keyconfig_export")
         elif userpref.active_section == 'ADDONS':
@@ -224,7 +226,6 @@ class USERPREF_PT_interface(Panel):
         col.prop(view, "show_large_cursors")
         col.prop(view, "show_view_name", text="View Name")
         col.prop(view, "show_playback_fps", text="Playback FPS")
-        col.prop(view, "use_global_scene")
         col.prop(view, "object_origin_size")
 
         col.separator()
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 448e66ec540..1788c889719 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -90,6 +90,7 @@ set(SRC_DNA_INC
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_view2d_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_view3d_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_windowmanager_types.h
+	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_workspace_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_world_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_movieclip_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_tracking_types.h
diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h
index ac8f861fa56..ffbdc6972f4 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -82,6 +82,7 @@ enum {
 
 #define BLENDER_STARTUP_FILE    "startup.blend"
 #define BLENDER_USERPREF_FILE   "userpref.blend"
+#define BLENDER_WORKSPACES_FILE "workspaces.blend"
 #define BLENDER_QUIT_FILE       "quit.blend"
 #define BLENDER_BOOKMARK_FILE   "bookmarks.txt"
 #define BLENDER_HISTORY_FILE    "recent-files.txt"
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index bc3db11f34b..ae87f1097d1 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         280
-#define BLENDER_SUBVERSION      0
+#define BLENDER_SUBVERSION      1
 /* Several breakages with 270, e.g. constraint deg vs rad */
 #define BLENDER_MINVERSION      270
 #define BLENDER_MINSUBVERSION   6
diff --git a/source/blender/blenkernel/BKE_blendfile.h b/source/blender/blenkernel/BKE_blendfile.h
index ac58451e412..d9fff5343b0 100644
--- a/source/blender/blenkernel/BKE_blendfile.h
+++ b/source/blender/blenkernel/BKE_blendfile.h
@@ -60,6 +60,10 @@ struct UserDef *BKE_blendfile_userdef_read_from_memory(
 
 int BKE_blendfile_userdef_write(const char *filepath, struct ReportList *reports);
 
+struct WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepath, struct ReportList *reports);
+bool BKE_blendfile_workspace_config_write(struct Main *bmain, const char *filepath, struct ReportList *reports);
+void BKE_blendfile_workspace_config_data_free(struct WorkspaceConfigFileData *workspace_config);
+
 
 /* partial blend file writing */
 void BKE_blendfile_write_partial_tag_ID(struct ID *id, bool set);
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index c911d9ec952..b71f5a4aa8e 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -145,6 +145,7 @@ void CTX_py_dict_set(bContext *C, void *value);
 
 struct wmWindowManager *CTX_wm_manager(const bContext *C);
 struct wmWindow *CTX_wm_window(const bContext *C);
+struct WorkSpace *CTX_wm_workspace(const bContext *C);
 struct bScreen *CTX_wm_screen(const bContext *C);
 struct ScrArea *CTX_wm_area(const bContext *C);
 struct SpaceLink *CTX_wm_space_data(const bContext *C);
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index c6ec7e9df25..17ab0bf0d2b 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -60,6 +60,7 @@ struct SceneLayer;
 void BKE_layer_exit(void);
 
 struct SceneLayer *BKE_scene_layer_render_active(const struct Scene *scene);
+struct SceneLayer *BKE_scene_layer_context_active_ex(const struct Main *bmain, const struct Scene *scene);
 struct SceneLayer *BKE_scene_layer_context_active(const struct Scene *scene);
 struct SceneLayer *BKE_scene_layer_add(struct Scene *scene, const char *name);
 
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 6649cfbb585..dcc15c66c3e 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -95,7 +95,7 @@ void id_clear_lib_data_ex(struct Main *bmain, struct ID *id, const bool id_in_ma
 
 struct ListBase *which_libbase(struct Main *mainlib, short type);
 
-#define MAX_LIBARRAY    35
+#define MAX_LIBARRAY    36
 int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
 
 /* Main API */
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 387045878f3..a616429fa95 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -123,6 +123,7 @@ typedef struct Main {
 	ListBase mask;
 	ListBase linestyle;
 	ListBase cachefiles;
+	ListBase workspaces;
 
 	char id_tag_update[MAX_LIBARRAY];
 
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 454fba0126e..cd59ef98903 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -52,11 +52,13 @@ struct SceneLayer;
 struct UnitSettings;
 struct Main;
 
-#define SCE_COPY_NEW        0
-#define SCE_COPY_EMPTY      1
-#define SCE_COPY_LINK_OB    2
-#define SCE_COPY_LINK_DATA  3
-#define SCE_COPY_FULL       4
+typedef enum eSceneCopyMethod {
+	SCE_COPY_NEW       = 0,
+	SCE_COPY_EMPTY     = 1,
+	SCE_COPY_LINK_OB   = 2,
+	SCE_COPY_LINK_DATA = 3,
+	SCE_COPY_FULL      = 4,
+} eSceneCopyMethod;
 
 /* Use as the contents of a 'for' loop: for (SETLOOPER(...)) { ... */
 #define SETLOOPER(_sce_basis, _sce_iter, _base)                               \
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 7def41d0540..645a99d592f 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -308,11 +308,12 @@ unsigned int BKE_screen_view3d_layer_active(
 unsigned int BKE_screen_view3d_layer_all(const struct bScreen *sc) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
 
 void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene);
-void BKE_screen_view3d_scene_sync(

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list