mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-09 04:52:32 +08:00
save clipspace files to input/clipspace instead of temp
This commit is contained in:
parent
8c8bedbaf2
commit
3a28a28000
@ -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
|
||||
|
||||
|
||||
3
nodes.py
3
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"
|
||||
|
||||
@ -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":
|
||||
|
||||
@ -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 [];
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user