[Bf-blender-cvs] [245129e8e2a] master: Fix T65445: wrong defaults when appending workspaces from builtin templates

Brecht Van Lommel noreply at git.blender.org
Thu Jun 13 17:57:02 CEST 2019


Commit: 245129e8e2a6fb24b7a3c6623eae9a6b2010c238
Author: Brecht Van Lommel
Date:   Thu Jun 13 16:33:01 2019 +0200
Branches: master
https://developer.blender.org/rB245129e8e2a6fb24b7a3c6623eae9a6b2010c238

Fix T65445: wrong defaults when appending workspaces from builtin templates

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

M	source/blender/blenloader/BLO_readfile.h
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/editors/screen/workspace_edit.c

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

diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index cf00e4d5f84..8769ed37d16 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -40,6 +40,7 @@ struct Scene;
 struct UserDef;
 struct View3D;
 struct ViewLayer;
+struct WorkSpace;
 struct bContext;
 struct bScreen;
 struct wmWindowManager;
@@ -166,6 +167,7 @@ void BLO_expand_main(void *fdhandle, struct Main *mainvar);
 /* Update defaults in startup.blend & userprefs.blend, without having to save and embed it */
 void BLO_update_defaults_userpref_blend(void);
 void BLO_update_defaults_startup_blend(struct Main *mainvar, const char *app_template);
+void BLO_update_defaults_workspace(struct WorkSpace *workspace, const char *app_template);
 
 /* Version patch user preferences. */
 void BLO_version_defaults_userpref_blend(struct Main *mainvar, struct UserDef *userdef);
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 617329ef5f2..355260f7b26 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -286,7 +286,7 @@ static void blo_update_defaults_screen(bScreen *screen,
   }
 }
 
-static void blo_update_defaults_workspace(WorkSpace *workspace, const char *app_template)
+void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template)
 {
   ListBase *layouts = BKE_workspace_layouts_get(workspace);
   for (WorkSpaceLayout *layout = layouts->first; layout; layout = layout->next) {
@@ -367,7 +367,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
 {
   /* For all app templates. */
   for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
-    blo_update_defaults_workspace(workspace, app_template);
+    BLO_update_defaults_workspace(workspace, app_template);
   }
 
   /* For builtin templates only. */
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index 9fcd0e5295c..6030b6fded5 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -376,6 +376,9 @@ static int workspace_append_activate_exec(bContext *C, wmOperator *op)
     BLI_assert(appended_workspace != NULL);
 
     if (appended_workspace) {
+      /* Set defaults. */
+      BLO_update_defaults_workspace(appended_workspace, NULL);
+
       /* Reorder to last position. */
       BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);



More information about the Bf-blender-cvs mailing list