Merge remote-tracking branch 'origin/Main' into Main

This commit is contained in:
Lt.Dr.Data
2023-08-14 20:53:53 +09:00
4 changed files with 90 additions and 44 deletions
+3 -1
View File
@@ -181,7 +181,6 @@ NODE_CLASS_MAPPINGS = {
"ImpactWildcardProcessor": ImpactWildcardProcessor,
"ImpactWildcardEncode": ImpactWildcardEncode,
"ImpactLogger": ImpactLogger,
"SEGSDetailer": SEGSDetailer,
"SEGSPaste": SEGSPaste,
@@ -221,6 +220,9 @@ NODE_CLASS_MAPPINGS = {
"ImpactNeg": ImpactNeg,
"ImpactConditionalStopIteration": ImpactConditionalStopIteration,
"ImpactStringSelector": StringSelector,
"ImpactLogger": ImpactLogger,
"ImpactDummyInput": ImpactDummyInput,
}
+31 -2
View File
@@ -258,14 +258,43 @@ app.registerExtension({
node.widgets_values[1] = node.widgets[1].value;
}
this._value = value;
node._value = value;
},
get: () => {
return this._value;
return node._value;
}
});
}
if(node.comfyClass == "ImpactWildcardEncode") {
node._value = "Select the LoRA to add to the text";
Object.defineProperty(node.widgets[3], "value", {
set: (value) => {
const stackTrace = new Error().stack;
if(stackTrace.includes('inner_value_change')) {
if(value != "Select the LoRA to add to the text") {
let lora_name = value;
if (lora_name.endsWith('.safetensors')) {
lora_name = lora_name.slice(0, -12);
}
node.widgets[0].value += `<lora:${lora_name}>`;
node.widgets_values[0] = node.widgets[0].value;
}
}
node._value = value;
},
get: () => {
return node._value;
}
});
// Preventing validation errors from occurring in any situation.
node.widgets[3].serializeValue = () => { return "Select the LoRA to add to the text"; }
}
if(node.comfyClass == "ImpactWildcardProcessor" || node.comfyClass == "ImpactWildcardEncode") {
node.widgets[0].inputEl.placeholder = "Wildcard Prompt (User input)";
node.widgets[1].inputEl.placeholder = "Populated Prompt (Will be generated automatically)";
+1 -1
View File
@@ -2,7 +2,7 @@ import configparser
import os
version = "V3.16"
version = "V3.16.2"
dependency_version = 9
+55 -40
View File
@@ -2480,6 +2480,7 @@ class ImpactWildcardEncode:
"wildcard_text": ("STRING", {"multiline": True}),
"populated_text": ("STRING", {"multiline": True}),
"mode": ("BOOLEAN", {"default": True, "label_on": "Populate", "label_off": "Fixed"}),
"Select to add LoRA": (["Select the LoRA to add to the text"] + folder_paths.get_filename_list("loras"), ),
},
}
@@ -2488,8 +2489,8 @@ class ImpactWildcardEncode:
RETURN_TYPES = ("MODEL", "CLIP", "CONDITIONING", )
FUNCTION = "doit"
def doit(self, model, clip, wildcard_text, populated_text, mode):
model, clip, conditioning = impact.wildcards.process_with_loras(populated_text, model, clip)
def doit(self, *args, **kwargs):
model, clip, conditioning = impact.wildcards.process_with_loras(kwargs['populated_text'], kwargs['model'], kwargs['clip'])
return (model, clip, conditioning)
@@ -2609,44 +2610,6 @@ class KSamplerAdvancedBasicPipe:
return (basic_pipe, latent, vae)
from impact.logics import AnyType
class ImpactLogger:
@classmethod
def INPUT_TYPES(s):
return {"required": {
"data": (AnyType("*"), ""),
},
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
}
CATEGORY = "ImpactPack/Debug"
OUTPUT_NODE = True
RETURN_TYPES = ()
FUNCTION = "doit"
def doit(self, data, prompt, extra_pnginfo):
shape = ""
if hasattr(data, "shape"):
shape = f"{data.shape} / "
print(f"[IMPACT LOGGER]: {shape}{data}")
print(f" PROMPT: {prompt}")
# for x in prompt:
# if 'inputs' in x and 'populated_text' in x['inputs']:
# print(f"PROMP: {x['10']['inputs']['populated_text']}")
#
# for x in extra_pnginfo['workflow']['nodes']:
# if x['type'] == 'ImpactWildcardProcessor':
# print(f" WV : {x['widgets_values'][1]}\n")
return {}
class ImageBatchToImageList:
@classmethod
def INPUT_TYPES(s):
@@ -2729,3 +2692,55 @@ class StringSelector:
selected = lines[select % len(lines)]
return (selected, )
from impact.logics import AnyType
class ImpactLogger:
@classmethod
def INPUT_TYPES(s):
return {"required": {
"data": (AnyType("*"), ""),
},
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
}
CATEGORY = "ImpactPack/Debug"
OUTPUT_NODE = True
RETURN_TYPES = ()
FUNCTION = "doit"
def doit(self, data, prompt, extra_pnginfo):
shape = ""
if hasattr(data, "shape"):
shape = f"{data.shape} / "
print(f"[IMPACT LOGGER]: {shape}{data}")
print(f" PROMPT: {prompt}")
# for x in prompt:
# if 'inputs' in x and 'populated_text' in x['inputs']:
# print(f"PROMP: {x['10']['inputs']['populated_text']}")
#
# for x in extra_pnginfo['workflow']['nodes']:
# if x['type'] == 'ImpactWildcardProcessor':
# print(f" WV : {x['widgets_values'][1]}\n")
return {}
class ImpactDummyInput:
@classmethod
def INPUT_TYPES(s):
return {"required": {}}
CATEGORY = "ImpactPack/Debug"
RETURN_TYPES = (AnyType("*"),)
FUNCTION = "doit"
def doit(self):
return ("DUMMY",)