Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5392aa237 | ||
|
|
16a2b55fa1 | ||
|
|
b423b09ff3 | ||
|
|
e66add88cb | ||
|
|
32b22c39cb | ||
|
|
259baac177 | ||
|
|
67ef8c13a8 | ||
|
|
b2bb1876de | ||
|
|
cda4e626e7 | ||
|
|
d835aff0cb | ||
|
|
21e1967c5e | ||
|
|
c9b5baf4d9 | ||
|
|
67c974c96e | ||
|
|
b46ccb03c9 | ||
|
|
0ecf98e08b | ||
|
|
f024034724 | ||
|
|
327a21f009 | ||
|
|
cfc51532b8 | ||
|
|
00988f92e4 | ||
|
|
868c6085a8 | ||
|
|
a47a56bda0 | ||
|
|
3667b42b2f | ||
|
|
7d142d7d62 |
@@ -7,15 +7,19 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- "pyproject.toml"
|
- "pyproject.toml"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-node:
|
publish-node:
|
||||||
name: Publish Custom Node to registry
|
name: Publish Custom Node to registry
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.repository_owner == 'shadowcz007' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Publish Custom Node
|
- name: Publish Custom Node
|
||||||
uses: Comfy-Org/publish-node-action@main
|
uses: Comfy-Org/publish-node-action@v1
|
||||||
with:
|
with:
|
||||||
## Add your own personal access token to your Github Repository secrets and reference it here.
|
## Add your own personal access token to your Github Repository secrets and reference it here.
|
||||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||||
|
|||||||
+867
-121
File diff suppressed because it is too large
Load Diff
+22
-10
@@ -123,8 +123,13 @@ def composite_images(foreground, background, mask, is_multiply_blend=False, posi
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Resize the foreground image with antialiasing
|
# Resize the foreground image with antialiasing
|
||||||
layer_image = layer['image'].resize((layer['width'], layer['height']), Image.ANTIALIAS)
|
try:
|
||||||
layer_mask = layer['mask'].resize((layer['width'], layer['height']), Image.ANTIALIAS)
|
resampling_method = Image.Resampling.LANCZOS
|
||||||
|
except AttributeError:
|
||||||
|
resampling_method = Image.ANTIALIAS
|
||||||
|
|
||||||
|
layer_image = layer['image'].resize((layer['width'], layer['height']), resampling_method)
|
||||||
|
layer_mask = layer['mask'].resize((layer['width'], layer['height']), resampling_method)
|
||||||
|
|
||||||
bg_image.paste(layer_image, (layer['x'], layer['y']), layer_mask)
|
bg_image.paste(layer_image, (layer['x'], layer['y']), layer_mask)
|
||||||
|
|
||||||
@@ -1041,29 +1046,33 @@ def generate_text_image(text,
|
|||||||
|
|
||||||
if layout == "vertical":
|
if layout == "vertical":
|
||||||
for line in lines:
|
for line in lines:
|
||||||
max_char_width = max(font.getsize(char)[0] for char in line)
|
max_char_width = max(font.getbbox(char)[2] - font.getbbox(char)[0] for char in line)
|
||||||
for char in line:
|
for char in line:
|
||||||
char_width, char_height = font.getsize(char)
|
left, top, right, bottom = font.getbbox(char)
|
||||||
|
char_width = right - left
|
||||||
|
char_height = bottom - top
|
||||||
char_coordinates.append((x, y))
|
char_coordinates.append((x, y))
|
||||||
y += char_height + spacing
|
y += char_height + spacing
|
||||||
max_height = max(max_height, y + padding)
|
max_height = max(max_height, y + padding)
|
||||||
x += max_char_width + line_spacing
|
x += max_char_width + line_spacing
|
||||||
y = padding
|
y = padding
|
||||||
max_width = x
|
max_width = x
|
||||||
total_line_width = sum(font.getsize(line)[1] for line in lines)
|
total_line_width = sum(font.getbbox(line)[2] - font.getbbox(line)[0] for line in lines)
|
||||||
total_spacing = line_spacing * (len(lines) - 1)
|
total_spacing = line_spacing * (len(lines) - 1)
|
||||||
max_width = total_line_width + total_spacing + padding * 2
|
max_width = total_line_width + total_spacing + padding * 2
|
||||||
else:
|
else:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line_width, line_height = font.getsize(line)
|
line_width, line_height = font.getbbox(line)[2] - font.getbbox(line)[0], font.getbbox(line)[3] - font.getbbox(line)[1]
|
||||||
for char in line:
|
for char in line:
|
||||||
char_width, char_height = font.getsize(char)
|
left, top, right, bottom = font.getbbox(char)
|
||||||
|
char_width = right - left
|
||||||
|
char_height = bottom - top
|
||||||
char_coordinates.append((x, y))
|
char_coordinates.append((x, y))
|
||||||
x += char_width + spacing
|
x += char_width + spacing
|
||||||
max_width = max(max_width, x + padding)
|
max_width = max(max_width, x + padding)
|
||||||
y += line_height + line_spacing
|
y += line_height + line_spacing
|
||||||
x = padding
|
x = padding
|
||||||
total_line_heights = sum(font.getsize(line)[1] for line in lines)
|
total_line_heights = sum(font.getbbox(line)[3] - font.getbbox(line)[1] for line in lines)
|
||||||
total_spacing = line_spacing * (len(lines) - 1)
|
total_spacing = line_spacing * (len(lines) - 1)
|
||||||
max_height = total_line_heights + total_spacing + padding * 2
|
max_height = total_line_heights + total_spacing + padding * 2
|
||||||
|
|
||||||
@@ -2951,11 +2960,14 @@ class ResizeImage:
|
|||||||
im=tensor2pil(im)
|
im=tensor2pil(im)
|
||||||
|
|
||||||
im=im.convert('RGB')
|
im=im.convert('RGB')
|
||||||
a_im,hex=get_average_color_image(im)
|
|
||||||
|
|
||||||
|
a_im,hex=get_average_color_image(im)
|
||||||
|
|
||||||
if average_color=='on':
|
if average_color=='on':
|
||||||
fill_color=hex
|
fill_color=hex
|
||||||
|
|
||||||
|
a_im=resize_image(a_im,scale_option,w,h,fill_color)
|
||||||
|
|
||||||
im=resize_image(im,scale_option,w,h,fill_color)
|
im=resize_image(im,scale_option,w,h,fill_color)
|
||||||
|
|
||||||
im=pil2tensor(im)
|
im=pil2tensor(im)
|
||||||
|
|||||||
+1
-1
@@ -234,7 +234,7 @@ class StyleAlignedSampleReferenceLatents:
|
|||||||
"steps": ("INT", {"default": 20, "min": 1, "max": 10000}),
|
"steps": ("INT", {"default": 20, "min": 1, "max": 10000}),
|
||||||
"cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01}),
|
"cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01}),
|
||||||
|
|
||||||
"scheduler": (comfy.samplers.KSampler.SCHEDULERS.reverse(), ),
|
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, ),
|
||||||
"denoise": ("FLOAT", {"default": 1, "min": 0.0, "max": 1.0, "step": 0.01}),
|
"denoise": ("FLOAT", {"default": 1, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -7,6 +7,7 @@ import os
|
|||||||
import folder_paths
|
import folder_paths
|
||||||
import node_helpers
|
import node_helpers
|
||||||
import hashlib
|
import hashlib
|
||||||
|
from uuid import uuid4
|
||||||
|
|
||||||
# Tensor to PIL
|
# Tensor to PIL
|
||||||
def tensor2pil(image):
|
def tensor2pil(image):
|
||||||
@@ -26,7 +27,7 @@ def tensor_to_hash(tensor):
|
|||||||
return hash_value
|
return hash_value
|
||||||
|
|
||||||
|
|
||||||
def create_temp_file(image):
|
def create_temp_file(image, uuid):
|
||||||
output_dir = folder_paths.get_temp_directory()
|
output_dir = folder_paths.get_temp_directory()
|
||||||
|
|
||||||
(
|
(
|
||||||
@@ -35,7 +36,7 @@ def create_temp_file(image):
|
|||||||
counter,
|
counter,
|
||||||
subfolder,
|
subfolder,
|
||||||
_,
|
_,
|
||||||
) = folder_paths.get_save_image_path('material', output_dir)
|
) = folder_paths.get_save_image_path(f'material_{uuid}', output_dir)
|
||||||
|
|
||||||
|
|
||||||
image=tensor2pil(image)
|
image=tensor2pil(image)
|
||||||
@@ -59,6 +60,7 @@ class EditMask:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.image_id = None
|
self.image_id = None
|
||||||
|
self.uuid = str(uuid4())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
@@ -117,13 +119,13 @@ class EditMask:
|
|||||||
image_path = os.path.join(base_dir,subfolder, name)
|
image_path = os.path.join(base_dir,subfolder, name)
|
||||||
|
|
||||||
if image_path==None:
|
if image_path==None:
|
||||||
image_path,images=create_temp_file(image)
|
image_path,images=create_temp_file(image, self.uuid)
|
||||||
|
|
||||||
print('#image_path',os.path.exists(image_path),image_path)
|
print('#image_path',os.path.exists(image_path),image_path)
|
||||||
# image_path = folder_paths.get_annotated_filepath(image) #文件名
|
# image_path = folder_paths.get_annotated_filepath(image) #文件名
|
||||||
|
|
||||||
if not os.path.exists(image_path):
|
if not os.path.exists(image_path):
|
||||||
image_path,images=create_temp_file(image)
|
image_path,images=create_temp_file(image, self.uuid)
|
||||||
|
|
||||||
|
|
||||||
img = node_helpers.pillow(Image.open, image_path)
|
img = node_helpers.pillow(Image.open, image_path)
|
||||||
|
|||||||
@@ -267,7 +267,13 @@ function downloadJsonFile (jsonData, fileName = 'mix_app.json') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function save (json, download = false, showInfo = true) {
|
async function save (json, download = false, showInfo = true) {
|
||||||
let nodesAll = window._nodesAll || (await getObjectInfo())
|
if (!window._nodesAll) {
|
||||||
|
window._nodesAll = await getObjectInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
let nodesAll = window._nodesAll;
|
||||||
|
|
||||||
|
// let nodesAll = window._nodesAll || (await getObjectInfo())
|
||||||
|
|
||||||
console.log('####SAVE', nodesAll, json)
|
console.log('####SAVE', nodesAll, json)
|
||||||
|
|
||||||
@@ -417,9 +423,9 @@ function getInputsAndOutputs () {
|
|||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: 'Mixlab.utils.AppInfo',
|
name: 'Mixlab.utils.AppInfo',
|
||||||
init () {
|
init () {
|
||||||
if (!window._nodesAll) {
|
// if (!window._nodesAll) {
|
||||||
getObjectInfo().then(r => (window._nodesAll = r))
|
// getObjectInfo().then(r => (window._nodesAll = r))
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
async beforeRegisterNodeDef (nodeType, nodeData, app) {
|
async beforeRegisterNodeDef (nodeType, nodeData, app) {
|
||||||
if (nodeType.comfyClass == 'AppInfo') {
|
if (nodeType.comfyClass == 'AppInfo') {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { api } from '../../../scripts/api.js'
|
|||||||
import { ComfyWidgets } from '../../../scripts/widgets.js'
|
import { ComfyWidgets } from '../../../scripts/widgets.js'
|
||||||
import { $el } from '../../../scripts/ui.js'
|
import { $el } from '../../../scripts/ui.js'
|
||||||
|
|
||||||
import WaveSurfer from 'https://cdn.jsdelivr.net/npm/wavesurfer.js@7/dist/wavesurfer.esm.js'
|
import WaveSurfer from './wavesurfer.esm.js'
|
||||||
|
|
||||||
function get_position_style (ctx, widget_width, y, node_height) {
|
function get_position_style (ctx, widget_width, y, node_height) {
|
||||||
const MARGIN = 4 // the margin around the html element
|
const MARGIN = 4 // the margin around the html element
|
||||||
|
|||||||
@@ -1735,14 +1735,16 @@ app.registerExtension({
|
|||||||
|
|
||||||
// 把json往里 拖
|
// 把json往里 拖
|
||||||
document.addEventListener('drop', async event => {
|
document.addEventListener('drop', async event => {
|
||||||
event.preventDefault()
|
// Only intercept the JSON files handled here. Calling preventDefault()
|
||||||
event.stopPropagation()
|
// unconditionally swallowed every drop, so ComfyUI's native drag&drop
|
||||||
|
// (guarded by event.defaultPrevented) never loaded dropped workflows
|
||||||
// Dragging from Chrome->Firefox there is a file but its a bmp, so ignore that
|
// (PNG / JSON / etc.). Keep preventDefault scoped to the handled case.
|
||||||
if (
|
if (
|
||||||
event.dataTransfer.files.length &&
|
event.dataTransfer.files.length &&
|
||||||
event.dataTransfer.files[0].type == 'application/json'
|
event.dataTransfer.files[0].type == 'application/json'
|
||||||
) {
|
) {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = async () => {
|
reader.onload = async () => {
|
||||||
loadAppJson(reader.result)
|
loadAppJson(reader.result)
|
||||||
@@ -2171,6 +2173,10 @@ app.registerExtension({
|
|||||||
|
|
||||||
fetch('manager/badge_mode').then(r => {
|
fetch('manager/badge_mode').then(r => {
|
||||||
if (r.status === 404) {
|
if (r.status === 404) {
|
||||||
|
// 已有ComfyUI自带的badge
|
||||||
|
if(node.badges?.[0]?.()){
|
||||||
|
return
|
||||||
|
}
|
||||||
// 右上角的badge是否已经绘制
|
// 右上角的badge是否已经绘制
|
||||||
if (!node.badge_enabled) {
|
if (!node.badge_enabled) {
|
||||||
if (!node.getNickname) {
|
if (!node.getNickname) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user