Blender 2.8: workspace list from user configuration is empty
Closed, ResolvedPublic

Description

Short description of error
List of workspaces in user configuration sometimes is empty. Should never be the case.
If no workspaces.blend is found in the user configuration itself (which must never have 0 workspaces), the bundled default one is used as fallback (should be in [build_dir]/[release_dir]/datafiles/).
The user who reported this did have the bundled workspace.blend in the right place, so this is not the cause.

Exact steps for others to reproduce the error

  • Launch Blender from command line
  • Press "+" button to add a new workspace
  • If appearing menu only contains "Duplicate Current", there's the bug.

Mainly leaving this here for myself.

Related Objects

Julian Eisel (Severin) triaged this task as Normal priority.Oct 5 2017, 6:40 PM

Got it! Happens all the time when launching Blender from command line here. Still need to investigate but now I know how to recreate at least :)

So this only happens for dev builds executed from the build directory. It's caused by this loading a different release directory path for dev builds https://developer.blender.org/diffusion/B/browse/master/source/blender/blenkernel/intern/appdir.c;33b5e8daff2cfe269bdb527cf0de6dd083b01daf$323-331.

I'd suggest this fix

1diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
2index 78257cb7d1e..dbcc2e06022 100644
3--- a/source/creator/CMakeLists.txt
4+++ b/source/creator/CMakeLists.txt
5@@ -412,11 +412,17 @@ if(WITH_OPENCOLORIO)
6​ )
7​ endif()
8
9-# Add default workspaces.blend to build (under [version]/datafiles
10+# Add default workspaces.blend to build datafiles. Copy to two locations, so it works
11+# for dev & regular builds (see weird dev-build exception in get_path_system()).
12​ install(
13​ FILES ${CMAKE_SOURCE_DIR}/release/datafiles/workspaces.blend
14​ DESTINATION ${TARGETDIR_VER}/datafiles
15​ )
16+configure_file(
17+ ${CMAKE_SOURCE_DIR}/release/datafiles/workspaces.blend
18+ ${CMAKE_BINARY_DIR}/release/datafiles/workspaces.blend
19+ COPYONLY
20+)
21
22​ # helpful tip when using make
23​ if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*")
The ugly thing is it actually copies the default workspaces.blend to two directories:

  • Once during CMake configuration. Copied into [build_dir]/release/datafiles.
  • Once during make install. Copied into [install_dir]/[version]/datafiles.

That said it should work fine with all cases.

Alternatively we could remove mentioned lines in appdir.c, although I don't know what it's currently used for. @Campbell Barton (campbellbarton)/@Sergey Sharybin (sergey) any opinion on that matter?

I think it's simplest to do datatoc as startup.blend unless there is a good reason to make this work differently.

AFAICS no big changes are needed for this, just follow existing conventions.


Update, swapping CWD & EXE dirs is far simpler!