jcfnav
(jcfnav)
January 29, 2025, 8:29am
1
Hi all,
I’m migrating from Blender 4.2 to 4.3 little by little, and I have a long list of assets in 4.2. I don’t want to copy/paste all the asset paths manually.
I know I can save and transfer the whole preferences file, but I only need to export my Asset Libraries and load them into the new version.
Is there a way to do this efficiently?
Okidoki
(Okidoki)
January 29, 2025, 10:18am
2
Isn’t there something like in 3.6 :
Blender Preferences → File Path → Asset Libraries → User Library
( and whatever you have added ) and the according Path and Import Method ??
jcfnav
(jcfnav)
January 29, 2025, 10:37am
3
Yes, if I go on by one by copying each path and pasting it on the nex blender version it works fine if you have only 2-3 paths, but if you have over 15, it is a pain.
PS. I’m asking chatgpt since I think this might need a script using json
Okidoki
(Okidoki)
January 29, 2025, 12:58pm
4
Also:
Usually when installing a new blender version the user is asked to import the older settings…
jcfnav
(jcfnav)
January 29, 2025, 1:42pm
5
Thanks yeah, I’m aware of that, but I just need the assets libraries paths, nothing else from it.
jcfnav
(jcfnav)
January 29, 2025, 1:47pm
6
I got it working using chatgpt.
If anyone else has to do the same, this worked for me in Windows.
Run this in B4.2 (in my case)
import bpy
import json
import os
# Get Desktop path
desktop_path = os.path.join(os.path.expanduser("~"), "Desktop")
export_path = os.path.join(desktop_path, "blender_asset_paths.json")
# Get asset library paths from Blender preferences
asset_libs = bpy.context.preferences.filepaths.asset_libraries
# Extract paths
asset_data = [{"name": lib.name, "path": lib.path} for lib in asset_libs]
# Save to JSON file
with open(export_path, "w") as f:
json.dump(asset_data, f, indent=4)
print(f"Asset libraries exported to: {export_path}")
Then run this in B4.3
import bpy
import json
import os
# Get Desktop path
desktop_path = os.path.join(os.path.expanduser("~"), "Desktop")
import_path = os.path.join(desktop_path, "blender_asset_paths.json")
# Check if file exists
if not os.path.exists(import_path):
print("No asset library file found on Desktop!")
else:
with open(import_path, "r") as f:
asset_data = json.load(f)
# Add asset libraries to Blender 4.3 preferences
for lib in asset_data:
lib_name = lib.get("name", "Unnamed Library")
lib_directory = lib.get("directory") or lib.get("path") # Handle both cases
if lib_directory:
existing_lib = bpy.context.preferences.filepaths.asset_libraries.get(lib_name)
if not existing_lib: # Avoid duplicates
new_lib = bpy.context.preferences.filepaths.asset_libraries.new(name=lib_name, directory=lib_directory)
print(f"Added asset library: {lib_name} → {lib_directory}")
else:
print(f"Skipping library '{lib_name}' due to missing directory/path.")
print("Asset libraries imported successfully!")
2 Likes