diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-08-20 14:52:50 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-08-20 17:23:22 +0300 |
commit | c9abb0fe2699478d1027667e6f527c8d60df5786 (patch) | |
tree | ce6c8e5c803db6a8fc36ec998ddd416b52fa162f /source/blender/editors/screen/workspace_edit.c | |
parent | f1ab36d15455e18d328923d7aedfa1472842cb98 (diff) |
Workspaces: replace bundled workspace.blend with embedded startup.blend.
We want these to have the same workspaces in both, so there is no reason
to have two files that are identical.
Diffstat (limited to 'source/blender/editors/screen/workspace_edit.c')
-rw-r--r-- | source/blender/editors/screen/workspace_edit.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 16587792c87..267dce87e26 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -50,6 +50,7 @@ #include "DNA_windowmanager_types.h" #include "DNA_workspace_types.h" +#include "ED_datafiles.h" #include "ED_object.h" #include "ED_screen.h" @@ -388,14 +389,13 @@ static WorkspaceConfigFileData *workspace_config_file_read( if (BLI_exists(workspace_config_path)) { has_path = true; } + + if (has_path) { + return BKE_blendfile_workspace_config_read(workspace_config_path, NULL, 0, reports); + } else { - workspace_config_file_path_from_folder_id(bmain, BLENDER_SYSTEM_DATAFILES, workspace_config_path); - if (BLI_exists(workspace_config_path)) { - has_path = true; - } + return BKE_blendfile_workspace_config_read(NULL, datatoc_startup_blend, datatoc_startup_blend_size, reports); } - - return has_path ? BKE_blendfile_workspace_config_read(workspace_config_path, reports) : NULL; } static void workspace_append_button( @@ -404,9 +404,14 @@ static void workspace_append_button( const ID *id = (ID *)workspace; PointerRNA opptr; char lib_path[FILE_MAX_LIBEXTRA]; + const char *filepath = from_main->name; + + if (strlen(filepath) == 0) { + filepath = BLO_EMBEDDED_STARTUP_BLEND; + } BLI_path_join( - lib_path, sizeof(lib_path), from_main->name, BKE_idcode_to_name(GS(id->name)), NULL); + lib_path, sizeof(lib_path), filepath, BKE_idcode_to_name(GS(id->name)), NULL); BLI_assert(STREQ(ot_append->idname, "WORKSPACE_OT_append_activate")); uiItemFullO_ptr( @@ -426,7 +431,9 @@ static void workspace_config_file_append_buttons( wmOperatorType *ot_append = WM_operatortype_find("WORKSPACE_OT_append_activate", true); for (WorkSpace *workspace = workspace_config->workspaces.first; workspace; workspace = workspace->id.next) { - workspace_append_button(layout, ot_append, workspace, workspace_config->main); + if (BLI_findstring(&bmain->workspaces, workspace->id.name, offsetof(ID, name)) == NULL) { + workspace_append_button(layout, ot_append, workspace, workspace_config->main); + } } BKE_blendfile_workspace_config_data_free(workspace_config); |