mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Projects: Auto use {project_root} for asset library paths
Add a PROP_VARIABLES_PROJECT to indicate a string property can use project variables, and use it for the asset library path. The file browser will make such paths automatically project relative when writing back to the RNA property. To make it so this works for project asset libraries but has no effect on preferences libraries, there are now two separate UserAssetLibrary subclasses with and without PROP_VARIABLES_PROJECT on the path. Pull Request: https://projects.blender.org/blender/blender/pulls/163777
This commit is contained in:
parent
84a71075a3
commit
ec00e6cf37
8 changed files with 159 additions and 64 deletions
|
|
@ -772,10 +772,6 @@ class PROJECT_OT_AssetLibraryAdd(Operator):
|
|||
.decode('utf-8', 'ignore') \
|
||||
or data_(ASSET_LIBRARY_DEFAULT_NAME)
|
||||
|
||||
# Replace base path with {project_root} if it is within the project folder.
|
||||
root_path = bpy.data.project.root_path
|
||||
if asset_library_path.startswith(root_path):
|
||||
asset_library_path = "{project_root}" + asset_library_path[len(root_path):]
|
||||
bpy.data.project.asset_libraries.new(name=asset_library_name, directory=asset_library_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue