Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-23 01:49:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-23 01:52:14 +0300
commitf2dc78f13fb7aa7af02828ec42d8ecf030d7b2a5 (patch)
tree2d0475ed17089fb87983a71c5c56baabf2f98724 /source/blender/blenloader
parent36c2162660524ec241b96d14befcc2422ff7ec5c (diff)
App Template: match screen names to workspaces
Doing this makes versioning workspace screens simpler. This was already done for the default startup file.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index a89b9a034f0..c5263708f43 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -144,6 +144,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. */
+ const bool builtin_template =
+ (!app_template ||
+ STR_ELEM(app_template, "2D_Animation", "Sculpting", "VFX", "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) {
@@ -191,31 +196,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;
}
}
}
@@ -266,11 +269,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;