diff --git a/src/Mod/CAM/Path/Tool/assets/ui/filedialog.py b/src/Mod/CAM/Path/Tool/assets/ui/filedialog.py index 22a6f2cb98..9717963fc1 100644 --- a/src/Mod/CAM/Path/Tool/assets/ui/filedialog.py +++ b/src/Mod/CAM/Path/Tool/assets/ui/filedialog.py @@ -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): diff --git a/src/Mod/CAM/Path/Tool/library/serializers/fctl.py b/src/Mod/CAM/Path/Tool/library/serializers/fctl.py index 37c8cd0d7d..e19843176b 100644 --- a/src/Mod/CAM/Path/Tool/library/serializers/fctl.py +++ b/src/Mod/CAM/Path/Tool/library/serializers/fctl.py @@ -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}"