[Bf-blender-cvs] [892c438aa77] temp-topbar-ui: Remove topbar by default except for paint workpaces
Campbell Barton
noreply at git.blender.org
Tue Apr 23 00:41:13 CEST 2019
Commit: 892c438aa772d3436029cc90c265e5ba4881c8bd
Author: Campbell Barton
Date: Sun Apr 21 16:46:08 2019 +1000
Branches: temp-topbar-ui
https://developer.blender.org/rB892c438aa772d3436029cc90c265e5ba4881c8bd
Remove topbar by default except for paint workpaces
===================================================================
M source/blender/blenloader/intern/versioning_defaults.c
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 25bd738ce45..74999cdff9a 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -143,6 +143,11 @@ static ID *rename_id_for_versioning(Main *bmain,
* This function can be emptied each time the startup.blend is updated. */
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
{
+ /* For all builtin templates shipped with Blender. */
+ bool builtin_template = (!app_template || STREQ(app_template, "2D_Animation") ||
+ STREQ(app_template, "Sculpting") || STREQ(app_template, "VFX") ||
+ STREQ(app_template, "Video_Editing"));
+
/* For all startup.blend files. */
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
@@ -189,31 +194,29 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
}
- if (app_template == NULL) {
+ if (builtin_template) {
/* Name all screens by their workspaces (avoids 'Default.###' names). */
- {
- /* Default only has one window. */
- wmWindow *win = ((wmWindowManager *)bmain->wm.first)->windows.first;
- for (WorkSpace *workspace = bmain->workspaces.first; workspace;
- workspace = workspace->id.next) {
- WorkSpaceLayout *layout = BKE_workspace_hook_layout_for_workspace_get(win->workspace_hook,
- workspace);
- bScreen *screen = layout->screen;
- BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2);
- BLI_libblock_ensure_unique_name(bmain, screen->id.name);
- }
+ /* Default only has one window. */
+ wmWindow *win = ((wmWindowManager *)bmain->wm.first)->windows.first;
+ for (WorkSpace *workspace = bmain->workspaces.first; workspace;
+ workspace = workspace->id.next) {
+ WorkSpaceLayout *layout = BKE_workspace_hook_layout_for_workspace_get(win->workspace_hook,
+ workspace);
+ bScreen *screen = layout->screen;
+ BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2);
+ BLI_libblock_ensure_unique_name(bmain, screen->id.name);
}
+ }
- {
- /* 'UV Editing' should use UV mode. */
- bScreen *screen = BLI_findstring(&bmain->screens, "UV Editing", offsetof(ID, name) + 2);
- for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_IMAGE) {
- SpaceImage *sima = (SpaceImage *)sl;
- if (sima->mode == SI_MODE_VIEW) {
- sima->mode = SI_MODE_UV;
- }
+ if (app_template == NULL) {
+ /* 'UV Editing' should use UV mode. */
+ bScreen *screen = BLI_findstring(&bmain->screens, "UV Editing", offsetof(ID, name) + 2);
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = (SpaceImage *)sl;
+ if (sima->mode == SI_MODE_VIEW) {
+ sima->mode = SI_MODE_UV;
}
}
}
@@ -264,11 +267,6 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
}
- /* For all builtin templates shipped with Blender. */
- bool builtin_template = (!app_template || STREQ(app_template, "2D_Animation") ||
- STREQ(app_template, "Sculpting") || STREQ(app_template, "VFX") ||
- STREQ(app_template, "Video_Editing"));
-
if (builtin_template) {
/* Clear all tools to use default options instead, ignore the tool saved in the file. */
for (WorkSpace *workspace = bmain->workspaces.first; workspace;
@@ -293,6 +291,34 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
}
+ /* Show toopbar for sculpt/paint modes. */
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ bool show_tool_header = false;
+ if (app_template == NULL) {
+ if (STR_ELEM(screen->id.name + 2, "Sculpting", "Texture Paint")) {
+ show_tool_header = true;
+ }
+ }
+ else if (STREQ(app_template, "2D_Animation")) {
+ if (STR_ELEM(screen->id.name + 2, "Sculpting", "Texture Paint")) {
+ show_tool_header = true;
+ }
+ }
+
+ if (show_tool_header == false) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+ for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_TOOL_HEADER) {
+ ar->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
+ }
+ }
+ }
+ }
+ }
+ }
+
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
@@ -328,8 +354,8 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
/* Rename light objects. */
- rename_id_for_versioning(bmain, ID_OB, "Light", "Light");
- rename_id_for_versioning(bmain, ID_LA, "Light", "Light");
+ rename_id_for_versioning(bmain, ID_OB, "Lamp", "Light");
+ rename_id_for_versioning(bmain, ID_LA, "Lamp", "Light");
for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) {
/* Match default for new meshes. */
More information about the Bf-blender-cvs
mailing list