Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/workspace_edit.c
| Show First 20 Lines • Show All 403 Lines • ▼ Show 20 Lines | static void workspace_add_menu(bContext *UNUSED(C), uiLayout *layout, void *template_v) | ||||
| const char *app_template = template_v; | const char *app_template = template_v; | ||||
| bool has_startup_items = false; | bool has_startup_items = false; | ||||
| wmOperatorType *ot_append = WM_operatortype_find("WORKSPACE_OT_append_activate", true); | wmOperatorType *ot_append = WM_operatortype_find("WORKSPACE_OT_append_activate", true); | ||||
| WorkspaceConfigFileData *startup_config = workspace_config_file_read(app_template); | WorkspaceConfigFileData *startup_config = workspace_config_file_read(app_template); | ||||
| WorkspaceConfigFileData *builtin_config = workspace_system_file_read(app_template); | WorkspaceConfigFileData *builtin_config = workspace_system_file_read(app_template); | ||||
| if (startup_config) { | if (startup_config) { | ||||
| for (WorkSpace *workspace = startup_config->workspaces.first; workspace; | LISTBASE_FOREACH (WorkSpace *, workspace, &startup_config->workspaces) { | ||||
| workspace = workspace->id.next) { | |||||
| uiLayout *row = uiLayoutRow(layout, false); | uiLayout *row = uiLayoutRow(layout, false); | ||||
| workspace_append_button(row, ot_append, workspace, startup_config->main); | workspace_append_button(row, ot_append, workspace, startup_config->main); | ||||
| has_startup_items = true; | has_startup_items = true; | ||||
| } | } | ||||
| } | } | ||||
| if (builtin_config) { | if (builtin_config) { | ||||
| bool has_title = false; | bool has_title = false; | ||||
| for (WorkSpace *workspace = builtin_config->workspaces.first; workspace; | LISTBASE_FOREACH (WorkSpace *, workspace, &startup_config->workspaces) { | ||||
| workspace = workspace->id.next) { | |||||
| if (startup_config && | if (startup_config && | ||||
| BLI_findstring(&startup_config->workspaces, workspace->id.name, offsetof(ID, name))) { | BLI_findstring(&startup_config->workspaces, workspace->id.name, offsetof(ID, name))) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!has_title) { | if (!has_title) { | ||||
| if (has_startup_items) { | if (has_startup_items) { | ||||
| uiItemS(layout); | uiItemS(layout); | ||||
| ▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines | |||||