fix default library name on import

This commit is contained in:
sliptonic
2025-09-21 13:32:31 -05:00
parent ef08e4bf88
commit 3b789eed2b
2 changed files with 9 additions and 9 deletions

View File

@@ -139,12 +139,12 @@ class AssetOpenDialog(QFileDialog):
# Load and return the asset.
try:
# Choose deserialization method based on whether toolbits were imported
if use_context_deserialize and hasattr(serializer_class, 'deep_deserialize_with_context'):
# Pass file path context for external dependency resolution
# Always use context-aware deserialization for libraries to get meaningful names
if hasattr(serializer_class, 'deep_deserialize_with_context'):
# Pass file path context for meaningful library names and external dependency resolution
asset = serializer_class.deep_deserialize_with_context(raw_data, file_path)
else:
# Use regular deserialization - toolbits should be in stores now
# Fallback to regular deserialization
asset = serializer_class.deep_deserialize(raw_data)
if not isinstance(asset, self.asset_class):

View File

@@ -73,9 +73,9 @@ class FCTLSerializer(AssetSerializer):
# instance, overriding any 'id' that might be in the data_dict (which
# is from an older version of the format).
# For the label, prefer data_dict["label"], then "name", then fallback to "Unnamed Library"
# Avoid using the UUID as the library name
label = data_dict.get("label") or data_dict.get("name") or "Unnamed Library"
# For the label, prefer data_dict["label"], then "name", then fallback to using the id as filename
# The id parameter often contains the filename stem when importing from files
label = data_dict.get("label") or data_dict.get("name") or id or "Unnamed Library"
library = Library(label, id=id)
if dependencies is None:
@@ -194,8 +194,8 @@ class FCTLSerializer(AssetSerializer):
from ...camassets import cam_assets
from ...toolbit.serializers import all_serializers as toolbit_serializers
# Generate a unique ID for this library instance
library_id = str(uuid.uuid4())
# Use filename stem as library ID for meaningful names
library_id = file_path.stem
Path.Log.info(
f"FCTL DEEP_DESERIALIZE_WITH_CONTEXT: Starting deep deserialization for library from {file_path}"