mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-23 04:26:59 +08:00
Merge remote-tracking branch 'upstream/master' into cleanup_if_idle
This commit is contained in:
commit
bf066b67e7
@ -139,6 +139,7 @@ class SplitSigmas:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RETURN_TYPES = ("SIGMAS","SIGMAS")
|
RETURN_TYPES = ("SIGMAS","SIGMAS")
|
||||||
|
RETURN_NAMES = ("high_sigmas", "low_sigmas")
|
||||||
CATEGORY = "sampling/custom_sampling/sigmas"
|
CATEGORY = "sampling/custom_sampling/sigmas"
|
||||||
|
|
||||||
FUNCTION = "get_sigmas"
|
FUNCTION = "get_sigmas"
|
||||||
@ -148,6 +149,27 @@ class SplitSigmas:
|
|||||||
sigmas2 = sigmas[step:]
|
sigmas2 = sigmas[step:]
|
||||||
return (sigmas1, sigmas2)
|
return (sigmas1, sigmas2)
|
||||||
|
|
||||||
|
class SplitSigmasDenoise:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required":
|
||||||
|
{"sigmas": ("SIGMAS", ),
|
||||||
|
"denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RETURN_TYPES = ("SIGMAS","SIGMAS")
|
||||||
|
RETURN_NAMES = ("high_sigmas", "low_sigmas")
|
||||||
|
CATEGORY = "sampling/custom_sampling/sigmas"
|
||||||
|
|
||||||
|
FUNCTION = "get_sigmas"
|
||||||
|
|
||||||
|
def get_sigmas(self, sigmas, denoise):
|
||||||
|
steps = max(sigmas.shape[-1] - 1, 0)
|
||||||
|
total_steps = round(steps * denoise)
|
||||||
|
sigmas1 = sigmas[:-(total_steps)]
|
||||||
|
sigmas2 = sigmas[-(total_steps + 1):]
|
||||||
|
return (sigmas1, sigmas2)
|
||||||
|
|
||||||
class FlipSigmas:
|
class FlipSigmas:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
@ -599,6 +621,7 @@ NODE_CLASS_MAPPINGS = {
|
|||||||
"SamplerDPMPP_SDE": SamplerDPMPP_SDE,
|
"SamplerDPMPP_SDE": SamplerDPMPP_SDE,
|
||||||
"SamplerDPMAdaptative": SamplerDPMAdaptative,
|
"SamplerDPMAdaptative": SamplerDPMAdaptative,
|
||||||
"SplitSigmas": SplitSigmas,
|
"SplitSigmas": SplitSigmas,
|
||||||
|
"SplitSigmasDenoise": SplitSigmasDenoise,
|
||||||
"FlipSigmas": FlipSigmas,
|
"FlipSigmas": FlipSigmas,
|
||||||
|
|
||||||
"CFGGuider": CFGGuider,
|
"CFGGuider": CFGGuider,
|
||||||
|
|||||||
@ -164,6 +164,41 @@ class MaskEditorDialog extends ComfyDialog {
|
|||||||
return divElement;
|
return divElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createOpacitySlider(self, name, callback) {
|
||||||
|
const divElement = document.createElement('div');
|
||||||
|
divElement.id = "maskeditor-opacity-slider";
|
||||||
|
divElement.style.cssFloat = "left";
|
||||||
|
divElement.style.fontFamily = "sans-serif";
|
||||||
|
divElement.style.marginRight = "4px";
|
||||||
|
divElement.style.color = "var(--input-text)";
|
||||||
|
divElement.style.backgroundColor = "var(--comfy-input-bg)";
|
||||||
|
divElement.style.borderRadius = "8px";
|
||||||
|
divElement.style.borderColor = "var(--border-color)";
|
||||||
|
divElement.style.borderStyle = "solid";
|
||||||
|
divElement.style.fontSize = "15px";
|
||||||
|
divElement.style.height = "21px";
|
||||||
|
divElement.style.padding = "1px 6px";
|
||||||
|
divElement.style.display = "flex";
|
||||||
|
divElement.style.position = "relative";
|
||||||
|
divElement.style.top = "2px";
|
||||||
|
divElement.style.pointerEvents = "auto";
|
||||||
|
self.opacity_slider_input = document.createElement('input');
|
||||||
|
self.opacity_slider_input.setAttribute('type', 'range');
|
||||||
|
self.opacity_slider_input.setAttribute('min', '0.1');
|
||||||
|
self.opacity_slider_input.setAttribute('max', '1.0');
|
||||||
|
self.opacity_slider_input.setAttribute('step', '0.01')
|
||||||
|
self.opacity_slider_input.setAttribute('value', '0.7');
|
||||||
|
const labelElement = document.createElement("label");
|
||||||
|
labelElement.textContent = name;
|
||||||
|
|
||||||
|
divElement.appendChild(labelElement);
|
||||||
|
divElement.appendChild(self.opacity_slider_input);
|
||||||
|
|
||||||
|
self.opacity_slider_input.addEventListener("input", callback);
|
||||||
|
|
||||||
|
return divElement;
|
||||||
|
}
|
||||||
|
|
||||||
setlayout(imgCanvas, maskCanvas) {
|
setlayout(imgCanvas, maskCanvas) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
@ -203,6 +238,13 @@ class MaskEditorDialog extends ComfyDialog {
|
|||||||
self.updateBrushPreview(self, null, null);
|
self.updateBrushPreview(self, null, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.brush_opacity_slider = this.createOpacitySlider(self, "Opacity", (event) => {
|
||||||
|
self.brush_opacity = event.target.value;
|
||||||
|
if (self.brush_color_mode !== "negative") {
|
||||||
|
self.maskCanvas.style.opacity = self.brush_opacity;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.colorButton = this.createLeftButton(this.getColorButtonText(), () => {
|
this.colorButton = this.createLeftButton(this.getColorButtonText(), () => {
|
||||||
if (self.brush_color_mode === "black") {
|
if (self.brush_color_mode === "black") {
|
||||||
self.brush_color_mode = "white";
|
self.brush_color_mode = "white";
|
||||||
@ -237,6 +279,7 @@ class MaskEditorDialog extends ComfyDialog {
|
|||||||
bottom_panel.appendChild(this.saveButton);
|
bottom_panel.appendChild(this.saveButton);
|
||||||
bottom_panel.appendChild(cancelButton);
|
bottom_panel.appendChild(cancelButton);
|
||||||
bottom_panel.appendChild(this.brush_size_slider);
|
bottom_panel.appendChild(this.brush_size_slider);
|
||||||
|
bottom_panel.appendChild(this.brush_opacity_slider);
|
||||||
bottom_panel.appendChild(this.colorButton);
|
bottom_panel.appendChild(this.colorButton);
|
||||||
|
|
||||||
imgCanvas.style.position = "absolute";
|
imgCanvas.style.position = "absolute";
|
||||||
@ -472,7 +515,7 @@ class MaskEditorDialog extends ComfyDialog {
|
|||||||
else {
|
else {
|
||||||
return {
|
return {
|
||||||
mixBlendMode: "initial",
|
mixBlendMode: "initial",
|
||||||
opacity: "0.7",
|
opacity: this.brush_opacity,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,6 +581,7 @@ class MaskEditorDialog extends ComfyDialog {
|
|||||||
this.maskCtx.putImageData(maskData, 0, 0);
|
this.maskCtx.putImageData(maskData, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
brush_opacity = 0.7;
|
||||||
brush_size = 10;
|
brush_size = 10;
|
||||||
brush_color_mode = "black";
|
brush_color_mode = "black";
|
||||||
drawing_mode = false;
|
drawing_mode = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user