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.

94 Commits

Author SHA1 Message Date
Julian Eisel dc30b7c884 Merge branch 'main' into blender-projects-basics 2023-12-07 14:47:22 +01:00
Julian Eisel 91bed72688 Fix compile error due to change in main 2023-12-06 12:00:03 +01:00
Julian Eisel b929e7fa98 Merge branch 'main' into blender-projects-basics 2023-12-06 11:48:46 +01:00
Julian Eisel 3f11d0844b Merge branch 'main' into blender-projects-basics 2023-11-30 18:09:49 +01:00
Julian Eisel 71c581c009 Merge branch 'main' into blender-projects-basics 2023-11-29 16:12:43 +01:00
Julian Eisel a8250a6b6a Merge branch 'main' into blender-projects-basics 2023-11-28 17:59:24 +01:00
Julian Eisel f4183821c0 Merge remote-tracking branch 'origin/main' into blender-projects-basics 2023-11-27 18:07:47 +01:00
Julian Eisel 7df9e1973a Merge remote-tracking branch 'origin/main' into blender-projects-basics 2023-11-24 11:08:39 +01:00
Julian Eisel a26c725514 Fix hidden execute region in project settings window 2023-11-23 18:10:20 +01:00
Julian Eisel 6d9055566f Fix project being reloaded on undo/redo 2023-11-23 18:09:46 +01:00
Julian Eisel 36c1cec983 Cleanup: Use nullptr instead of NULL in C++ 2023-11-23 18:09:23 +01:00
Julian Eisel 2ffbd7d9e4 Merge remote-tracking branch 'origin/main' into blender-projects-basics 2023-11-22 11:46:39 +01:00
Julian Eisel abffb9f3f4 Merge branch 'main' into blender-projects-basics 2023-11-22 01:02:12 +01:00
Julian Eisel c91ebdde92 General cleanup 2023-11-20 15:56:56 +01:00
Julian Eisel 62a9453d93 Cleanup: Add SPDX copyright info 2023-11-20 15:56:33 +01:00
Julian Eisel 36c1da8b1c Cleanup: Removing trailing return type 2023-11-20 15:55:23 +01:00
Julian Eisel 1cba58dff2 Remove Blender project C-API
With all relevant source files compiled in C++, there's no need for C
wrappers anymore.
2023-11-20 15:33:26 +01:00
Julian Eisel b7786bffbd Cleanup: Minor style edits 2023-11-20 11:24:02 +01:00
Julian Eisel fb3b5f66a4 Fix null pointer dereference on startup 2023-11-20 11:23:26 +01:00
Julian Eisel 093cf3f397 Fix compile errors after changes in main branch 2023-11-20 11:22:35 +01:00
Julian Eisel 0b8286724d Merge branch 'main' into blender-projects-basics 2023-11-20 10:51:28 +01:00
Julian Eisel c8b5e1c44a Add back missing files 2023-11-14 16:46:56 +01:00
Julian Eisel 2524394504 Merge branch 'main' into blender-projects-basics 2023-11-14 15:00:59 +01:00
Julian Eisel d2e45b1e2e A bunch of fixes after merge 2023-11-13 17:57:26 +01:00
Julian Eisel b3819fdc43 Merge branch 'main' into blender-projects-basics 2023-11-13 16:42:06 +01:00
Julian Eisel 6e7f547cba Revert "Fix #108078: Crash when inverting results in pose library sidebar"
This reverts commit 160678d224.

Wasn't my intention to push this to this branch. It's an unrelated patch
for the main branch.
2023-06-19 11:24:47 +02:00
Julian Eisel 46a3ca8497 Merge branch 'main' into blender-projects-basics 2023-06-19 11:24:07 +02:00
Julian Eisel fe8a9b57cf Include project libraries in "All" library 2023-06-13 17:09:12 +02:00
Julian Eisel 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.
2023-06-13 17:06:46 +02:00
Julian Eisel 536f9ed12b Correct DNA defaults location for custom asset library definitions 2023-06-13 17:05:27 +02:00
Julian Eisel ea4f732cf8 General compile fixes & updates to changes in main 2023-06-13 17:01:23 +02:00
Julian Eisel 10d8c389b3 Merge branch 'main' into blender-projects-basics 2023-06-13 12:54:01 +02:00
Julian Eisel 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.
2023-06-13 11:24:53 +02:00
Julian Eisel 576af00029 Merge branch 'main', update to changes 2023-02-17 15:37:16 +01:00
Julian Eisel b999b79d08 Support project asset libraries in new asset library loading 2023-01-12 14:37:39 +01:00
Julian Eisel e63671c21d Support & use new asset library path query from master 2023-01-10 16:45:39 +01:00
Julian Eisel 3ff321bc98 Merge branch 'master' into blender-projects-basics 2023-01-10 16:37:29 +01:00
Julian Eisel f0eba2fe6c Merge branch 'master' into blender-projects-basics 2023-01-10 15:54:27 +01:00
Julian Eisel 01f9ac24ed Adapt to changes in master, fixes all compile errors 2023-01-06 17:20:03 +01:00
Julian Eisel 58d32e8185 Merge branch 'master' into blender-projects-basics 2023-01-06 15:26:21 +01:00
Julian Eisel 7158e0eb4c Merge branch 'master' into blender-projects-basics 2022-11-02 11:58:03 +01:00
Julian Eisel 75794f95c0 Fix incorrect operator name in UI script 2022-10-18 19:00:15 +02:00
Julian Eisel 7234c363db Hide UI behind experimental option 2022-10-18 18:26:50 +02:00
Julian Eisel c475201378 Use operator poll instead of cancelling; Minor cleanup 2022-10-18 17:32:10 +02:00
Julian Eisel 907a7aba1e Confirmation prompt for closing file with unsaved project settings
The regular confirmation prompt is shown then with a "Save modified
project settings" checkbox.
2022-10-18 16:44:43 +02:00
Julian Eisel 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.
2022-10-18 16:23:53 +02:00
Julian Eisel 42091addb0 Add comment on asset library definition 2022-10-18 15:45:20 +02:00
Julian Eisel 7aba0015d0 Cleanup: Remove unused headers 2022-10-18 15:30:19 +02:00
Julian Eisel 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.
2022-10-18 15:24:56 +02:00
Julian Eisel 30b08fbec5 Merge branch 'master' into blender-projects-basics 2022-10-18 15:18:36 +02:00
Julian Eisel 55512dd2a8 Update to path changes in master 2022-10-18 11:49:50 +02:00
Julian Eisel dacbcde446 Merge branch 'master' into blender-projects-basics 2022-10-17 22:36:47 +02:00
Julian Eisel 7987608fae Add missing break 2022-10-17 15:10:18 +02:00
Julian Eisel 3dfe0421f2 Attempt to fix build error on clean builds 2022-10-14 19:14:38 +02:00
Julian Eisel 80a4c388f9 Cleanup: Move project settings code to own file
Will probably reorganize things even further, but step by step.
2022-10-14 19:13:06 +02:00
Julian Eisel 8ea0551d36 Cleanup: Move operators & operator logic to editors/project 2022-10-14 15:17:23 +02:00
Julian Eisel 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.
2022-10-13 21:31:20 +02:00
Julian Eisel 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.
2022-10-13 19:37:03 +02:00
Julian Eisel 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.
2022-10-13 16:43:54 +02:00
Julian Eisel f22cc99944 Merge branch 'master' into blender-projects-basics 2022-10-13 12:06:12 +02:00
Julian Eisel 97e21ed248 Support writing asset library definitions to the project settings
Unit tested, there is no UI for this yet.
2022-10-13 11:57:24 +02:00
Julian Eisel 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.
2022-10-12 16:29:30 +02:00
Julian Eisel 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 :)
2022-10-12 15:57:54 +02:00
Julian Eisel 9dc2bcf166 Indicate project folders with special icon in File Browser
Using the dev-fund heart icon temporarily :)
2022-10-07 15:58:14 +02:00
Julian Eisel c8daddf7db Rename File->New Project to Set up Project, open settings after 2022-10-07 15:37:54 +02:00
Julian Eisel b2b00cb8ea Improve message in Project Settings when there's no project + cleanup
Also show a button to set up a project.
2022-10-07 11:55:23 +02:00
Julian Eisel 0cba4a12a3 Merge branch 'master' into blender-projects-basics 2022-10-07 11:12:23 +02:00
Julian Eisel 4441e3b791 Fix incorrect setting of initial file browser location 2022-10-06 19:36:23 +02:00
Julian Eisel 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.
2022-10-06 19:32:06 +02:00
Julian Eisel 3002bd6e88 Show warning popup when creating project not containing the current file 2022-10-06 17:42:49 +02:00
Julian Eisel 3ad6715265 Cleanup: Move project operators closer together 2022-10-06 17:39:53 +02:00
Julian Eisel 2578c0ba92 Show warning when saving files outside the active project 2022-10-06 17:35:05 +02:00
Julian Eisel 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.
2022-10-06 17:00:04 +02:00
Julian Eisel 871bdb5d1f Keep track of unsaved changes, indicate in "Save Settings" button 2022-10-06 16:42:59 +02:00
Julian Eisel 818a3d3743 Merge branch 'master' into blender-projects-basics 2022-10-06 16:03:40 +02:00
Julian Eisel 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`).
2022-10-06 15:53:04 +02:00
Julian Eisel 6fde8ab8db Cleanup: variable names, memory debug names 2022-10-06 15:52:22 +02:00
Julian Eisel cd15fbbed6 Support saving project settings to .blender_project/settings.json 2022-10-06 15:51:10 +02:00
Julian Eisel 3ab935c8a9 Project Settings: Add sections support and display some text for testing 2022-10-04 02:15:48 +02:00
Julian Eisel 420cc8a093 Add operator to open project settings window (like preferences) 2022-10-03 22:40:44 +02:00
Julian Eisel c8583415e5 Add theme options for new project settings editor 2022-10-03 21:45:10 +02:00
Julian Eisel 5cc304b9a7 Add most bolierplate code & some buttons for Project Settings editor 2022-10-03 21:34:17 +02:00
Julian Eisel c2fce60bea Don't display save file name & red-alert on "New Project..." 2022-10-03 16:15:45 +02:00
Julian Eisel a2863b8891 Merge branch 'master' into blender-projects-basics 2022-10-03 10:42:58 +02:00
Julian Eisel 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.
2022-09-29 16:58:15 +02:00
Julian Eisel 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.
2022-09-29 15:47:41 +02:00
Julian Eisel 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.
2022-09-29 15:46:32 +02:00
Julian Eisel 5fb4b2d6ce Fix project not updated correctly on file save and write 2022-09-29 15:46:01 +02:00
Julian Eisel 1e105e99b0 Merge branch 'master' into blender-projects-basics 2022-09-29 14:38:07 +02:00
Julian Eisel 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).
2022-09-29 14:29:00 +02:00
Julian Eisel 994c33ae71 Merge branch 'master' into blender-projects-basics 2022-09-29 00:17:53 +02:00
Julian Eisel 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.
2022-09-29 00:17:20 +02:00
Julian Eisel 6d7a301b04 Test project paths with unicode characters & trailing slashes 2022-09-28 16:08:50 +02:00
Julian Eisel 39987a890a Add create, dummy load function and tests for project settings directory 2022-09-27 15:30:02 +02:00