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
Module
Asset System
labels 2023-05-05 16:54:04 +02:00
Julian Eisel added 61 commits 2023-05-05 16:54:11 +02:00
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.
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).
Currently only says "Has Project", but should be the project name once
that's supported.
Name and exact design of this is pending still, they are not optimal.
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.
Adds basic access to the active project and its properties to BPY
(`context.project`).
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.
Deletes the active project's .blender_project directory, but leaves all
actual project files (.blends and such) untouched.
Also show a button to set up a project.
Using the dev-fund heart icon temporarily :)
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 :)
Projects are supposed to support custom asset libraries too. So the
custom asset library types should be generalized and not be preferences
specific.
Unit tested, there is no UI for this yet.
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.
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.
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.
Will probably reorganize things even further, but step by step.
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.
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.
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
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
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
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/BKE_preferences.h
  • source/blender/blenkernel/CMakeLists.txt
  • source/blender/blenkernel/intern/blendfile.cc
  • source/blender/blenkernel/intern/preferences.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
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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.