WIP: Basic Blender Project Support (experimental feature) #107655

Draft
Julian Eisel wants to merge 94 commits from blender-projects-basics into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

With this patch, Blender supports awareness of projects, whereby a project is a
directory on disk with an arbitrary amount of .blend files, as well as project
wide settings. The concept is quite expandable, this patch implements the very
basics.

For further info, see https://wiki.blender.org/wiki/Source/Blender_Projects

Old review: https://developer.blender.org/D16288


What's Implemented Here

User visible:

  • Experimental option for the project support.
  • Operators to set up a new project and delete a project configuration (not the project files).
  • Active project (loaded whenever the current file location changes).
  • Display active project name in window title.
  • Project Settings window, similar to the Preferences.
  • Per project asset libraries (path relative to the project root), setup in the Project Settings, accessible in the Asset Browser & asset views.
  • Confirmation dialog when exiting a file without saving modified project settings.
  • File Browser displays project directories with special icon (temporary heart icon).

Internal:

  • Reading and writing project settings into a JSON file (.blender_project/settings.json).
  • Internal Project APIs and access to active project data via BPY.
  • Split custom asset library code from preferences.
  • Rather extensive unit tests for the core project code.

The code should be a good architectural foundation to build on.

TODO:

  • Fix failing Windows unit tests
  • Link assets from project asset libraries by default and use relative paths
  • Expose Import Method option for asset libraries in Project Settings
  • Hide .blender_project directory on Windows
  • Icon for projects
With this patch, Blender supports awareness of projects, whereby a project is a directory on disk with an arbitrary amount of .blend files, as well as project wide settings. The concept is quite expandable, this patch implements the very basics. For further info, see https://wiki.blender.org/wiki/Source/Blender_Projects Old review: https://developer.blender.org/D16288 ---- ## What's Implemented Here **User visible:** * Experimental option for the project support. * Operators to set up a new project and delete a project configuration (not the project files). * Active project (loaded whenever the current file location changes). * Display active project name in window title. * Project Settings window, similar to the Preferences. * Per project asset libraries (path relative to the project root), setup in the Project Settings, accessible in the Asset Browser & asset views. * Confirmation dialog when exiting a file without saving modified project settings. * File Browser displays project directories with special icon (temporary heart icon). **Internal:** * Reading and writing project settings into a JSON file (`.blender_project/settings.json`). * Internal Project APIs and access to active project data via BPY. * Split custom asset library code from preferences. * Rather extensive unit tests for the core project code. The code should be a good architectural foundation to build on. **TODO:** * [ ] Fix failing Windows unit tests * [ ] Link assets from project asset libraries by default and use relative paths * [ ] Expose *Import Method* option for asset libraries in Project Settings * [ ] Hide `.blender_project` directory on Windows * [ ] Icon for projects
Julian Eisel added the
Interest
User Interface
Interest
Core
Interest
Asset Browser
labels 2023-05-05 16:54:04 +02:00
Julian Eisel added 61 commits 2023-05-05 16:54:11 +02:00
939f20490d Handle and test both Unix and Windows style slashes
When unit testing on Unix with Windows style slashes, the project
directories would have the backslash in the name, rather than
recognizing it as nested directory. We could just expect native paths
only like most BLI functions, but it's not a big problem to just support
any format and just convert it internally. The most important part is
that the API defines well how it deals with the different formats, and
that this is unit tested. Ideally we'd have some path object type that
abstracts away the difference.
ce9949f7fa Support active project, set when loading or writing a file (+ tests)
The active project is determined via the path of the .blend file. So if
that changes (on write) or when a new .blend file is opend, the active
project is updated.

Some of the added tests require a latest checkout of the libraries SVN
repository (see rBL63043).
24cb209915 Show hint in window title when editing file inside project
Currently only says "Has Project", but should be the project name once
that's supported.
c32b7bfe54 Add "New Project" operator to select a directory to use as project root
Name and exact design of this is pending still, they are not optimal.
d5ae369efa Initial support for reading project name from settings.json
Adds very basic json deserializing for reading a project name from a
`.blender_project/settings.json` file. The name is displayed in the
window title.
483a70eeb5 Support changing project name in Project Settings UI + show location
Adds basic access to the active project and its properties to BPY
(`context.project`).
525f24f1ba Disable buttons if no project is loaded, always show hint then
Disable the navigation and "Save Settings" buttons when there is no
active project.

The message saying that no project is loaded always shows up now, even
if the UI somehow displays a section that is not the "General" one.
3013cf0b37 Add menu with operator to delete project configuration
Deletes the active project's .blender_project directory, but leaves all
actual project files (.blends and such) untouched.
9dc2bcf166 Indicate project folders with special icon in File Browser
Using the dev-fund heart icon temporarily :)
416a486c00 Swap order of Show Preferences and Show Project Settings menu entires
Looks a bit less nice, but doesn't mess with muscle memory as much,
since the Preferences used to be last in the menu. I for one kept
opening the wrong window :)
378e0d96fc Make custom asset libraries independent of Preferences
Projects are supposed to support custom asset libraries too. So the
custom asset library types should be generalized and not be preferences
specific.
1f819df7df Add UI for setting up project asset libraries
Looks just like the UI for setting up custom asset libraries in the
Preferences. However project asset libraries use paths relative to the
project root directory.

Had to do some changes to project data storage to avoid memory issues.
97f667058c Set default project name & add default asset library
Default project name will just be the directory name. The default asset
library will be called "Project Library" and point to an `assets/`
directory inside the project root directory.
6177df9dce Support displaying project asset libraries in asset browser
The hint in the asset browser for when the selected library path doesn't
exists is updated to mention the project settings too, and there is a
button to open the project settings in the asset library section.
80a4c388f9 Cleanup: Move project settings code to own file
Will probably reorganize things even further, but step by step.
eafc9cb446 Refactor BKE project interface & implementation
Mostly this is about more cleanly separating between `BlenderProject`
and `ProjectSettings`. Overall this is a nice improvement I think, helps
readability of interfaces and implementation a lot.
e1d90eccc5 Fix error when changing asset library name or path
Coded the RNA functions to only work with the preferences for the
start. But we actually don't have to care here if the libraries are
defined in the preferences or project.
907a7aba1e Confirmation prompt for closing file with unsaved project settings
The regular confirmation prompt is shown then with a "Save modified
project settings" checkbox.
Julian Eisel added
Module
Core
and removed
Interest
Core
labels 2023-05-05 17:03:22 +02:00
Julian Eisel added 4 commits 2023-06-13 17:06:04 +02:00
160678d224 Fix #108078: Crash when inverting results in pose library sidebar
a958ae36e8 introduced support for UI lists to reference items that would
never be shown, regardless of filter settings. This was to skip assets
in the asset view template that were not of the requested type. UI list
sorting code wasn't updated to account for such items that should be
entirely ignored.

The following commit will remove some code duplication, just keeping
that cleanup separate from the fix.
Julian Eisel added 1 commit 2023-06-13 17:09:11 +02:00
29e6157b79 Add path based asset library type for unit tests
With the two separate custom asset library types (from preferences and
from projects), things become a bit arbitrary/confusing for unit tests.
Add a dedicated asset library type for them, that should keep things
simpler.
Julian Eisel added 1 commit 2023-06-13 17:09:47 +02:00
Julian Eisel added 4 commits 2023-11-13 17:57:51 +01:00
Julian Eisel added 2 commits 2023-11-14 18:21:43 +01:00
Julian Eisel added 2 commits 2023-11-20 11:23:07 +01:00
Julian Eisel added 1 commit 2023-11-20 11:23:59 +01:00
Julian Eisel added 1 commit 2023-11-20 11:24:24 +01:00
Julian Eisel added 1 commit 2023-11-20 15:34:23 +01:00
1cba58dff2 Remove Blender project C-API
With all relevant source files compiled in C++, there's no need for C
wrappers anymore.
Julian Eisel added 1 commit 2023-11-20 15:55:54 +01:00
Julian Eisel added 2 commits 2023-11-20 15:57:16 +01:00
Julian Eisel added 1 commit 2023-11-22 01:27:37 +01:00
Julian Eisel added 1 commit 2023-11-22 11:46:53 +01:00
Julian Eisel added 1 commit 2023-11-23 18:09:39 +01:00
Julian Eisel added 1 commit 2023-11-23 18:09:59 +01:00
Julian Eisel added 1 commit 2023-11-23 18:10:34 +01:00
Julian Eisel added 1 commit 2023-11-24 11:08:55 +01:00
Julian Eisel added 1 commit 2023-11-27 18:09:12 +01:00
Julian Eisel added 1 commit 2023-11-28 18:00:00 +01:00
Julian Eisel added 1 commit 2023-11-29 16:12:58 +01:00
Julian Eisel added 1 commit 2023-11-30 18:10:03 +01:00
Julian Eisel added 1 commit 2023-12-06 11:49:22 +01:00
Julian Eisel added 1 commit 2023-12-06 12:00:21 +01:00
Julian Eisel added 1 commit 2023-12-07 14:48:09 +01:00
This pull request has changes conflicting with the target branch.
  • scripts/startup/bl_ui/space_topbar.py
  • scripts/startup/bl_ui/space_userpref.py
  • source/blender/asset_system/intern/asset_library.cc
  • source/blender/asset_system/intern/asset_library_service.cc
  • source/blender/asset_system/tests/asset_library_service_test.cc
  • source/blender/asset_system/tests/asset_representation_test.cc
  • source/blender/blenkernel/CMakeLists.txt
  • source/blender/blenkernel/intern/blendfile.cc
  • source/blender/blenkernel/intern/preferences.cc
  • source/blender/blenloader/intern/versioning_userdef.cc

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin blender-projects-basics:blender-projects-basics
git checkout blender-projects-basics
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107655
No description provided.