From 6d01a6f2d268c20fc26992fb8f2784f749eeeddf Mon Sep 17 00:00:00 2001 From: leafiy Date: Tue, 11 Nov 2025 09:52:14 +0800 Subject: [PATCH] update --- README.md | 7 ++++--- psd_mockup_node.py | 28 +++++++++++++++------------- web/js/psd_mockup_upload.js | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 50b5f73..13830c1 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,10 @@ matches what you would get when replacing the layer inside Photoshop. ## Usage 1. Place PSD/PSB mockups under `ComfyUI/input/psd` (or pass an absolute path). -2. Use **PSD File Upload** (or the `psd_file` input on **PSD Mockup Embedder**) - and click the built-in “choose PSD to upload” button. The frontend script will - upload the file to `ComfyUI/input` and automatically select it for you. +2. Use **PSD File Upload** and click the built-in “choose PSD to upload” button. + Connect its output directly into the `psd_path` input of **PSD Mockup + Embedder** (or Inspector). The frontend script uploads to `ComfyUI/input` + and automatically feeds the resulting path through the link. 3. Load your artwork with any stock `Load Image` (or `Upload Image`) node and connect its `IMAGE` output to the embedder. Leave `smart_object_names` empty to target the first smart object automatically, or pass a diff --git a/psd_mockup_node.py b/psd_mockup_node.py index 4a8b227..d08c07a 100644 --- a/psd_mockup_node.py +++ b/psd_mockup_node.py @@ -256,17 +256,15 @@ def _save_png(image: Image.Image, psd_path: str) -> str: class PSDFileUploader: @classmethod def INPUT_TYPES(cls): - psd_files = _list_input_files(ALLOWED_PSD_EXTENSIONS) - if not psd_files: - psd_files = [""] return { "required": { "psd_file": ( - psd_files, + "STRING", { - "file_upload": True, - "file_upload_types": ["psd", "psb"], - "tooltip": "Click the upload icon to add a PSD/PSB into ComfyUI/input", + "default": "", + "multiline": False, + "placeholder": "Upload or paste a PSD path", + "tooltip": "Use the upload button to select a PSD/PSB or paste a path manually", }, ) } @@ -312,12 +310,16 @@ class PSDSmartObjectInspector: class PSDMockupEmbedder: @classmethod def INPUT_TYPES(cls): - psd_files = _list_input_files(ALLOWED_PSD_EXTENSIONS) - if not psd_files: - psd_files = [""] return { "required": { - "psd_file": (psd_files,), + "psd_path": ( + "STRING", + { + "default": "", + "forceInput": True, + "tooltip": "Connect PSD File Upload or provide an absolute path", + }, + ), "mockup_image": ("IMAGE",), }, "optional": { @@ -332,11 +334,11 @@ class PSDMockupEmbedder: def apply( self, - psd_file: str, + psd_path: str, mockup_image, smart_object_names: str = "", ): - resolved_psd = _resolve_input_path(psd_file, ALLOWED_PSD_EXTENSIONS) + resolved_psd = _resolve_input_path(psd_path, ALLOWED_PSD_EXTENSIONS) psd = PSDImage.open(resolved_psd) source_image = _tensor_to_pil(mockup_image) if source_image is None: diff --git a/web/js/psd_mockup_upload.js b/web/js/psd_mockup_upload.js index 3781c0d..f8aa6e3 100644 --- a/web/js/psd_mockup_upload.js +++ b/web/js/psd_mockup_upload.js @@ -1,7 +1,7 @@ import { app } from "../../../scripts/app.js"; import { api } from "../../../scripts/api.js"; -const PSD_NODE_CLASSES = ["PSDFileUploader", "PSDMockupEmbedder", "PSDSmartObjectInspector"]; +const PSD_NODE_CLASSES = ["PSDFileUploader", "PSDSmartObjectInspector"]; const ACCEPT_EXTENSIONS = [".psd", ".psb"]; function uploadPSDFile(file, node, onProgress) {