[Bf-blender-cvs] [6e1db12] workspaces: Rename "Default" workspace to "General"

Julian Eisel noreply at git.blender.org
Sat Dec 31 18:00:54 CET 2016


Commit: 6e1db12a128679838a313c2f8e195e2f3d562f18
Author: Julian Eisel
Date:   Sat Dec 31 17:59:20 2016 +0100
Branches: workspaces
https://developer.blender.org/rB6e1db12a128679838a313c2f8e195e2f3d562f18

Rename "Default" workspace to "General"

Default screen-layout is still called "Default", not sure if we should change that. Ideally the layouts shouldn't be identified by names anyway.

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

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 54d4ad7..4f3babc 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -72,21 +72,29 @@ void BLO_update_defaults_userpref_blend(void)
 }
 
 /**
- * New workspace design: Remove all screens except of "Default" one.
+ * New workspace design: Remove all screens/workspaces except of "Default" one and rename the workspace to "General".
  * For compatibility, a new workspace has been created for each screen of old files,
  * we only want one workspace and one screen in the default startup file however.
  */
 static void update_defaults_startup_workspaces(Main *bmain)
 {
+	WorkSpace *workspace_default = NULL;
+
 	BKE_workspace_iter_begin(workspace, bmain->workspaces.first)
 	{
 		if (STREQ(BKE_workspace_name_get(workspace), "Default")) {
+			/* don't rename within iterator, renaming causes listbase to be re-sorted */
+			workspace_default = workspace;
 		}
 		else {
 			BKE_workspace_remove(workspace, bmain);
 		}
 	}
 	BKE_workspace_iter_end;
+
+	/* rename "Default" workspace to "General" */
+	BKE_libblock_rename(bmain, BKE_workspace_id_get(workspace_default), "General");
+	BLI_assert(BLI_listbase_count(BKE_workspace_layouts_get(workspace_default)) == 1);
 }
 
 /**




More information about the Bf-blender-cvs mailing list