revertible: 💄 use BOOLEAN instead of BOOL
Since this commit: https://github.com/comfyanonymous/ComfyUI/commit/9534f0f8a5a026654492da378f84d2cdc589ed01 Input <-> widget is possible on booleans. Locally I edited it but forgot about it not being in comfy This commit is reversable since I'm not yet sure of all the impacts
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -17,7 +17,7 @@ class AnimationBuilder:
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT", "FLOAT", "INT", "BOOL")
|
||||
RETURN_TYPES = ("INT", "FLOAT", "INT", "BOOLEAN")
|
||||
RETURN_NAMES = ("frame", "0-1 (scaled)", "count", "loop_ended")
|
||||
CATEGORY = "mtb/animation"
|
||||
FUNCTION = "build_animation"
|
||||
|
||||
+1
-1
@@ -261,7 +261,7 @@ class DeepBump:
|
||||
"LARGEST",
|
||||
],
|
||||
),
|
||||
"normals_to_height_seamless": ("BOOL", {"default": False}),
|
||||
"normals_to_height_seamless": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -143,12 +143,12 @@ class RestoreFace:
|
||||
"image": ("IMAGE",),
|
||||
"model": ("FACEENHANCE_MODEL",),
|
||||
# Input are aligned faces
|
||||
"aligned": ("BOOL", {"default": False}),
|
||||
"aligned": ("BOOLEAN", {"default": False}),
|
||||
# Only restore the center face
|
||||
"only_center_face": ("BOOL", {"default": False}),
|
||||
"only_center_face": ("BOOLEAN", {"default": False}),
|
||||
# Adjustable weights
|
||||
"weight": ("FLOAT", {"default": 0.5}),
|
||||
"save_tmp_steps": ("BOOL", {"default": True}),
|
||||
"save_tmp_steps": ("BOOLEAN", {"default": True}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -2,14 +2,13 @@
|
||||
import onnxruntime
|
||||
from pathlib import Path
|
||||
from PIL import Image
|
||||
from typing import List, Set, Tuple, Union, Optional
|
||||
from typing import List, Set, Union, Optional
|
||||
import cv2
|
||||
import folder_paths
|
||||
import glob
|
||||
import insightface
|
||||
import numpy as np
|
||||
import os
|
||||
import tempfile
|
||||
import torch
|
||||
from insightface.model_zoo.inswapper import INSwapper
|
||||
from ..utils import pil2tensor, tensor2pil
|
||||
@@ -120,7 +119,6 @@ class FaceSwap:
|
||||
"faces_index": ("STRING", {"default": "0"}),
|
||||
"faceanalysis_model": ("FACE_ANALYSIS_MODEL", {"default": "None"}),
|
||||
"faceswap_model": ("FACESWAP_MODEL", {"default": "None"}),
|
||||
"debug": ("BOOL", {"default": False}),
|
||||
},
|
||||
"optional": {},
|
||||
}
|
||||
@@ -136,7 +134,6 @@ class FaceSwap:
|
||||
faces_index: str,
|
||||
faceanalysis_model,
|
||||
faceswap_model,
|
||||
debug=False,
|
||||
):
|
||||
def do_swap(img):
|
||||
model_management.throw_exception_if_processing_interrupted()
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ class QrCode:
|
||||
"error_correct": (("L", "M", "Q", "H"), {"default": "L"}),
|
||||
"box_size": ("INT", {"default": 10, "max": 8096, "min": 0, "step": 1}),
|
||||
"border": ("INT", {"default": 4, "max": 8096, "min": 0, "step": 1}),
|
||||
"invert": (("BOOL",), {"default": False}),
|
||||
"invert": (("BOOLEAN",), {"default": False}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class FitNumber:
|
||||
return {
|
||||
"required": {
|
||||
"value": ("FLOAT", {"default": 0, "forceInput": True}),
|
||||
"clamp": ("BOOL", {"default": False}),
|
||||
"clamp": ("BOOLEAN", {"default": False}),
|
||||
"source_min": ("FLOAT", {"default": 0.0}),
|
||||
"source_max": ("FLOAT", {"default": 1.0}),
|
||||
"target_min": ("FLOAT", {"default": 0.0}),
|
||||
|
||||
@@ -6,9 +6,9 @@ import folder_paths
|
||||
from ..log import log
|
||||
import torch
|
||||
from frame_interpolation.eval import util, interpolator
|
||||
from ..utils import tensor2np
|
||||
import numpy as np
|
||||
import comfy
|
||||
import comfy.utils
|
||||
from PIL import Image
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
@@ -39,7 +39,7 @@ class GetBatchFromHistory:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"enable": ("BOOL", {"default": True}),
|
||||
"enable": ("BOOLEAN", {"default": True}),
|
||||
"count": ("INT", {"default": 1, "min": 0}),
|
||||
"offset": ("INT", {"default": 0, "min": -1e9, "max": 1e9}),
|
||||
},
|
||||
|
||||
@@ -377,7 +377,7 @@ class ImagePremultiply:
|
||||
"required": {
|
||||
"image": ("IMAGE",),
|
||||
"mask": ("MASK",),
|
||||
"invert": ("BOOL", {"default": False}),
|
||||
"invert": ("BOOLEAN", {"default": False}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ class ImageResizeFactor:
|
||||
"FLOAT",
|
||||
{"default": 2, "min": 0.01, "max": 16.0, "step": 0.01},
|
||||
),
|
||||
"supersample": ("BOOL", {"default": True}),
|
||||
"supersample": ("BOOLEAN", {"default": True}),
|
||||
"resampling": (
|
||||
["lanczos", "nearest", "bilinear", "bicubic"],
|
||||
{"default": "lanczos"},
|
||||
@@ -546,7 +546,7 @@ class SaveImageGrid:
|
||||
"required": {
|
||||
"images": ("IMAGE",),
|
||||
"filename_prefix": ("STRING", {"default": "ComfyUI"}),
|
||||
"save_intermediate": ("BOOL", {"default": False}),
|
||||
"save_intermediate": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
+2
-1
@@ -101,7 +101,8 @@ class SaveGif:
|
||||
"image": ("IMAGE",),
|
||||
"fps": ("INT", {"default": 12, "min": 1, "max": 120}),
|
||||
"resize_by": ("FLOAT", {"default": 1.0, "min": 0.1}),
|
||||
"pingpong": ("BOOL", {"default": False}),
|
||||
"optimize": ("BOOLEAN", {"default": False}),
|
||||
"pingpong": ("BOOLEAN", {"default": False}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ class ImageRemoveBackgroundRembg:
|
||||
"required": {
|
||||
"image": ("IMAGE",),
|
||||
"alpha_matting": (
|
||||
"BOOL",
|
||||
"BOOLEAN",
|
||||
{"default": False},
|
||||
),
|
||||
"alpha_matting_foreground_threshold": (
|
||||
@@ -29,7 +29,7 @@ class ImageRemoveBackgroundRembg:
|
||||
{"default": 10, "min": 0, "max": 255},
|
||||
),
|
||||
"post_process_mask": (
|
||||
"BOOL",
|
||||
"BOOLEAN",
|
||||
{"default": False},
|
||||
),
|
||||
"bgcolor": (
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ class IntToBool:
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("BOOL",)
|
||||
RETURN_TYPES = ("BOOLEAN",)
|
||||
FUNCTION = "int_to_bool"
|
||||
CATEGORY = "mtb/number"
|
||||
|
||||
|
||||
+1
-110
@@ -13,7 +13,7 @@ import * as shared from '/extensions/mtb/comfy_shared.js'
|
||||
import { log } from '/extensions/mtb/comfy_shared.js'
|
||||
import { api } from '/scripts/api.js'
|
||||
|
||||
const newTypes = ['BOOL', 'COLOR', 'BBOX']
|
||||
const newTypes = [, /*'BOOL'*/ 'COLOR', 'BBOX']
|
||||
|
||||
export const MtbWidgets = {
|
||||
BBOX: (key, val) => {
|
||||
@@ -204,116 +204,7 @@ export const MtbWidgets = {
|
||||
widget.desc = 'Represents a Bounding Box with x, y, width, and height.'
|
||||
return widget
|
||||
},
|
||||
BOOL: (key, val, compute = false) => {
|
||||
/** @type {import("/types/litegraph").IWidget} */
|
||||
const widget = {
|
||||
name: key,
|
||||
type: 'BOOL',
|
||||
options: { default: false },
|
||||
y: 0,
|
||||
|
||||
draw: function (ctx, node, widget_width, widgetY, height) {
|
||||
const hide = this.type !== 'BOOL' && app.canvas.ds.scale > 0.5
|
||||
if (hide) {
|
||||
return
|
||||
}
|
||||
const outline_color = LiteGraph.WIDGET_OUTLINE_COLOR
|
||||
const background_color = LiteGraph.WIDGET_BGCOLOR
|
||||
const text_color = LiteGraph.WIDGET_TEXT_COLOR
|
||||
const H = LiteGraph.NODE_WIDGET_HEIGHT
|
||||
// const arrowSize = 8
|
||||
|
||||
let margin = 15
|
||||
if (hide) return
|
||||
|
||||
let currentY = widgetY
|
||||
|
||||
ctx.textAlign = 'left'
|
||||
ctx.strokeStyle = outline_color
|
||||
ctx.fillStyle = background_color
|
||||
ctx.beginPath()
|
||||
// ctx.roundRect(margin, currentY, widget_width - margin * 2, H, [H * 0.5]);
|
||||
ctx.rect(margin, currentY, H, H) // Draw checkbox square
|
||||
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
|
||||
ctx.fillStyle = text_color
|
||||
// ctx.fillText(this.label || this.name, margin * 2 + 5, currentY + H * 0.7);
|
||||
ctx.fillText(
|
||||
this.label || this.name,
|
||||
H + margin * 2,
|
||||
currentY + H * 0.7
|
||||
)
|
||||
|
||||
// Draw arrow if the value is true
|
||||
// Draw checkmark if the value is true
|
||||
if (this.value) {
|
||||
ctx.fillStyle = text_color
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(margin + H * 0.15, currentY + H * 0.5)
|
||||
ctx.lineTo(margin + H * 0.4, currentY + H * 0.8)
|
||||
ctx.lineTo(margin + H * 0.85, currentY + H * 0.2)
|
||||
ctx.stroke()
|
||||
}
|
||||
},
|
||||
get value() {
|
||||
return this.inputEl.value === 'true'
|
||||
},
|
||||
set value(x) {
|
||||
this.inputEl.value = x
|
||||
},
|
||||
computeSize: function (width) {
|
||||
return [width, 32]
|
||||
},
|
||||
mouse: function (event, pos, node) {
|
||||
// let x = pos[0] - node.pos[0];
|
||||
// let y = pos[1] - node.pos[1];
|
||||
// let width = node.size[0];
|
||||
// let H = LiteGraph.NODE_WIDGET_HEIGHT;
|
||||
// let margin = 15;
|
||||
|
||||
// if (event.type == LiteGraph.pointerevents_method + "down") {
|
||||
// if (x > margin && x < widget_width - margin && y > widgetY && y < widgetY + H) {
|
||||
// this.value = !this.value; // Toggle checkbox value
|
||||
// shared.inner_value_change(this, this.value, event);
|
||||
// app.canvas.setDirty(true);
|
||||
// }
|
||||
// }
|
||||
if (event.type === 'pointerdown') {
|
||||
// get widgets of type type : "COLOR"
|
||||
const widgets = node.widgets.filter((w) => w.type === 'BOOL')
|
||||
|
||||
for (const w of widgets) {
|
||||
// color picker
|
||||
const rect = [w.last_y, w.last_y + 32]
|
||||
if (pos[1] > rect[0] && pos[1] < rect[1]) {
|
||||
// picker.style.position = "absolute";
|
||||
// picker.style.left = ( pos[0]) + "px";
|
||||
// picker.style.top = ( pos[1]) + "px";
|
||||
|
||||
// place at screen center
|
||||
// picker.style.position = "absolute";
|
||||
// picker.style.left = (window.innerWidth / 2) + "px";
|
||||
// picker.style.top = (window.innerHeight / 2) + "px";
|
||||
// picker.style.transform = "translate(-50%, -50%)";
|
||||
// picker.style.zIndex = 1000;
|
||||
|
||||
this.value = this.value ? false : true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// create a checkbox
|
||||
widget.inputEl = document.createElement('input')
|
||||
widget.inputEl.type = 'checkbox'
|
||||
widget.value = val || false
|
||||
|
||||
document.body.appendChild(widget.inputEl)
|
||||
return widget
|
||||
},
|
||||
COLOR: (key, val, compute = false) => {
|
||||
/** @type {import("/types/litegraph").IWidget} */
|
||||
const widget = {}
|
||||
|
||||
Reference in New Issue
Block a user