I love Blender's built-in Asset-Browser, but as I add more assets I'm realizing that there doesn't appear to be way to sort entries in the Assets Library menu. And unfortunately, with every new instance of Blender the entries appear to be in a different order. It would be so much easier to find the library I need if these entries could be sorted alphabetically, or at least searched; is there a way to do either? Thanks. Blender 3.3.1, Windows 11
-
1$\begingroup$ Hello ! as an aside, I don't think you're supposed to have that many different libraries, even if it's supported. At first sight I think you can merge some of them (kitbash items, HDRIs, ...) and instead use catalogs to further differentiate between your assets. $\endgroup$– GorgiousNov 8, 2022 at 20:46
1 Answer
Asset Library entries are displayed in the order you entered them in your file paths preferences.
I think the reason you see them sometimes ordered differently, is because when you click on an enum property field, the items are sorted in reversed order depending on if the popup opened towards the top of the screen or toward the bottom of the screen.
I implemented a solution to sort the library names using python in my asset batch-operations addon.
Run this script in the text editor, it will sort your asset libraries alphabetically. You may want to backup your preferences somehow because if something goes wrong you might have mangled asset library names (it won't affect your files, just the name of the asset libraries).
import bpy
asset_libraries = bpy.context.preferences.filepaths.asset_libraries
asset_libraries_sorted = asset_libraries[:]
asset_libraries_sorted.sort(key=lambda al: al.name)
names = [a_l.name for a_l in asset_libraries_sorted]
paths = [a_l.path for a_l in asset_libraries_sorted]
for asset_library in asset_libraries:
asset_library.name += "__temporary__" # Two libs can't share the same name
for i, (name, path) in enumerate(zip(names, paths)):
asset_libraries[i].name = name
asset_libraries[i].path = path
How it works : Since you can't actually reorder the asset libraries in your preferences, the script makes a double ledger copy of the asset library names and their path to disk, sorts them, then overwrites each entry accordingly.
-
$\begingroup$ Thank you! I use your Asset Browser Utilities all the time. Amazing add-on! Issue: I just updated my version of ABU with your linked version, but when I attempt to enable it I get a Python error: No module named 'asset_browser_utilities' $\endgroup$ Nov 8, 2022 at 21:56
-
$\begingroup$ Make sure you download the latest release instead of copying the source directly, github messes up the zip name and the dev branch is a bit buggy :) : github.com/Gorgious56/asset_browser_utilities/releases $\endgroup$– GorgiousNov 9, 2022 at 13:27
-
$\begingroup$ That works! Very cool. Thank you! Yes, Github can be a tad confusing. Thank you for the script; I'll give it a go when I've worked up some courage. :) Thanks again! $\endgroup$ Nov 9, 2022 at 15:14