From bd9f1257bc24de0c8856d032cfb004a904f5eb9f Mon Sep 17 00:00:00 2001 From: Samuel Abels Date: Mon, 26 May 2025 23:36:50 +0200 Subject: [PATCH] CAM: only copy shape icons if the shape folder is not initialized --- src/Mod/CAM/Path/Tool/camassets.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Mod/CAM/Path/Tool/camassets.py b/src/Mod/CAM/Path/Tool/camassets.py index e244170b36..7ee11cd376 100644 --- a/src/Mod/CAM/Path/Tool/camassets.py +++ b/src/Mod/CAM/Path/Tool/camassets.py @@ -66,7 +66,6 @@ def ensure_toolbitshape_assets_initialized(asset_manager: AssetManager, store_na if not asset_manager.exists(uri, store=store_name): asset_manager.add_file("toolbitshape", path) - if asset_manager.is_empty("toolbitshapesvg", store=store_name): for path in builtin_shape_path.glob("*.svg"): uri = AssetUri.build( asset_type="toolbitshapesvg", @@ -75,7 +74,6 @@ def ensure_toolbitshape_assets_initialized(asset_manager: AssetManager, store_na if not asset_manager.exists(uri, store=store_name): asset_manager.add_file("toolbitshapesvg", path, asset_id=path.stem + ".svg") - if asset_manager.is_empty("toolbitshapepng", store=store_name): for path in builtin_shape_path.glob("*.png"): uri = AssetUri.build( asset_type="toolbitshapepng", @@ -147,6 +145,18 @@ class CamAssetManager(AssetManager): """ return super().get(uri, store=store, depth=depth) + def get_or_none( + self, + uri: Union[AssetUri, str], + store: Union[str, Sequence[str]] = ("local", "builtin"), + depth: Optional[int] = None, + ) -> Optional[Asset]: + """ + Gets an asset from the "local" store, falling back to the "builtin" + store if not found locally. + """ + return super().get_or_none(uri, store=store, depth=depth) + # Set up the CAM asset manager. Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())