diff --git a/folder_paths.py b/folder_paths.py index e5b89492c..0acd22674 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -57,6 +57,10 @@ def get_input_directory(): global input_directory return input_directory +def get_clipspace_directory(): + global input_directory + return input_directory+"/clipspace" + #NOTE: used in http server so don't put folders that should not be accessed remotely def get_directory_by_type(type_name): @@ -66,6 +70,8 @@ def get_directory_by_type(type_name): return get_temp_directory() if type_name == "input": return get_input_directory() + if type_name == "clipspace": + return get_clipspace_directory() return None @@ -81,6 +87,9 @@ def annotated_filepath(name): elif name.endswith("[temp]"): base_dir = get_temp_directory() name = name[:-7] + elif name.endswith("[clipspace]"): + base_dir = get_clipspace_directory() + name = name[:-12] else: return name, None diff --git a/nodes.py b/nodes.py index 53e0f74bf..cd91a44b1 100644 --- a/nodes.py +++ b/nodes.py @@ -970,8 +970,9 @@ class LoadImage: @classmethod def INPUT_TYPES(s): input_dir = folder_paths.get_input_directory() + input_dir = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))] return {"required": - {"image": (sorted(os.listdir(input_dir)), )}, + {"image": (sorted(input_dir), )}, } CATEGORY = "image" diff --git a/server.py b/server.py index 40c42df3b..be08aea60 100644 --- a/server.py +++ b/server.py @@ -118,6 +118,8 @@ class PromptServer(): type_dir = folder_paths.get_input_directory() elif dir_type == "input": type_dir = folder_paths.get_input_directory() + elif dir_type == "clipspace": + type_dir = folder_paths.get_clipspace_directory() elif dir_type == "temp": type_dir = folder_paths.get_temp_directory() elif dir_type == "output": diff --git a/web/extensions/core/clipspace.js b/web/extensions/core/clipspace.js index 2661e3c9a..adb5877ea 100644 --- a/web/extensions/core/clipspace.js +++ b/web/extensions/core/clipspace.js @@ -118,8 +118,7 @@ export class ClipspaceDialog extends ComfyDialog { ]); const td = $el("td", {align:'center', width:'100px', height:'100px', colSpan:'2'}, - [ $el("img",{id:"clipspace_preview"},[]) ] - ); + [ $el("img",{id:"clipspace_preview", ondragstart:() => false},[]) ]); const row3 = $el("tr", {}, [td]); @@ -133,7 +132,7 @@ export class ClipspaceDialog extends ComfyDialog { createImgPreview() { if(ComfyApp.clipspace.imgs) { - return $el("img",{id:"clipspace_preview"}); + return $el("img",{id:"clipspace_preview", ondragstart:() => false}); } else return []; diff --git a/web/extensions/core/maskeditor.js b/web/extensions/core/maskeditor.js index 5f3c81f0c..c7cc99851 100644 --- a/web/extensions/core/maskeditor.js +++ b/web/extensions/core/maskeditor.js @@ -42,7 +42,9 @@ async function uploadMask(filepath, formData) { ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']] = new Image(); ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src = `view?filename=${filepath.filename}&type=${filepath.type}`; - ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']] = filepath; + + if(ComfyApp.clipspace.images) + ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']] = filepath; ClipspaceDialog.invalidatePreview(); } @@ -527,7 +529,7 @@ class MaskEditorDialog extends ComfyDialog { { "filename": filename, "subfolder": "", - "type": "temp", + "type": "clipspace", }; if(ComfyApp.clipspace.images) @@ -547,7 +549,7 @@ class MaskEditorDialog extends ComfyDialog { formData.append('image', blob, filename); formData.append('original_image', original_blob); - formData.append('type', "temp"); + formData.append('type', "clipspace"); uploadMask(item, formData); this.close(); diff --git a/web/scripts/app.js b/web/scripts/app.js index 49c562690..75118a02f 100644 --- a/web/scripts/app.js +++ b/web/scripts/app.js @@ -219,7 +219,11 @@ export class ComfyApp { else if(ComfyApp.clipspace.widgets) { const index_in_clip = ComfyApp.clipspace.widgets.findIndex(obj => obj.name === 'image'); if(index_in_clip >= 0) { - filename = `${ComfyApp.clipspace.widgets[index_in_clip].value}`; + const item = ComfyApp.clipspace.widgets[index_in_clip].value; + if(item.type) + filename = `${item.filename} [${item.type}]`; + else + filename = item.filename; } }