This commit is contained in:
jammyfu
2025-01-22 07:31:27 +08:00
parent bafcfff8b0
commit bbdca191ef
11 changed files with 64 additions and 30 deletions
+8
View File
@@ -389,6 +389,14 @@ Usage:
MIT License
## 🤝 Updates
### v0.3.1 (2025-01-22)
- **Bug Fixes:**
- Fixed crash issue in Text Combiner when handling special characters
- Fixed issue with Dynamic Image Input node not handling inputs correctly in certain cases
- Fixed display error in Mask Previewer during batch preview
- Fixed compatibility issues with path separator conversion functionality on some systems
- Fixed processing errors in Image Resolution Adjuster at specific resolutions
### v0.3.0 (2025-01-21)
- **Breaking Changes:**
- Modified namespace structure for better compatibility
+9
View File
@@ -408,6 +408,15 @@ Switch节点用于在工作流中动态切换不同的输入或输出路径。
MIT License
## 🤝 更新说明
### v0.3.1 (2025-01-22)
- **Bug修复:**
- 修复了文本组合器在处理特殊字符时的崩溃问题
- 修复了动态图像输入节点在某些情况下未正确处理输入的问题
- 修复了蒙版预览器在批量预览时的显示错误
- 修复了路径分隔符转换功能在某些系统上的兼容性问题
- 修复了图像分辨率调整器在特定分辨率下的处理错误
### v0.3.0 (2025-01-21)
- **重大变更:**
- 修改了命名空间结构以提高兼容性
+3 -1
View File
@@ -9,7 +9,9 @@ class DynamicImageCombiner:
@classmethod
def INPUT_TYPES(s):
return {
"required": {},
"required": {
"image_1": ("IMAGE",), # 添加一个初始图像输入
},
"optional": {},
"_meta": {
"preferred_width": 300,
+3 -1
View File
@@ -10,7 +10,9 @@ class DynamicMaskCombiner:
@classmethod
def INPUT_TYPES(s):
return {
"required": {},
"required": {
"mask_1": ("MASK",), # 添加一个初始掩码输入
},
"optional": {},
"_meta": {
"preferred_width": 300,
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "Painting Coder Utils"
description = "A practical collection of nodes for ComfyUI that streamlines image and text processing workflows. Features include image optimized resolution adjustment, text cleaning tools, dynamic image/text combination, and mask preview utilities. Perfect for artists and developers looking to enhance their AI art creation pipeline."
version = "0.2.2"
version = "0.3.0"
license = {file = "LICENSE"}
dependencies = ["numpy>=1.21.0", "Pillow>=9.0.0", "torch>=1.7.0", "gradio>=4.0.0"]
+16 -9
View File
@@ -1,20 +1,28 @@
import { app } from "/scripts/app.js";
app.registerExtension({
name: "Comfy.PaintingCoder.DynamicImageCombiner",
name: "PaintingCoder.DynamicImageCombiner",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
// 检查是否为 DynamicImageCombiner 节点
if (nodeData.name === "DynamicImageCombiner") {
if (nodeData.name === "DynamicImageCombiner" || nodeData.name === "PaintingCoder::DynamicImageCombiner") {
// 保存原始的 onNodeCreated 方法
const onNodeCreated = nodeType.prototype.onNodeCreated;
// 重写 onNodeCreated 方法
nodeType.prototype.onNodeCreated = function() {
const result = onNodeCreated ? onNodeCreated.apply(this, arguments) : undefined;
// 确保至少有一个输入点
if (!this.inputs || this.inputs.length === 0) {
this.addInput("image_1", "IMAGE");
}
// 初始化连接计数器
this.lastConnectedCount = 0;
// 添加第一个图像输入
this.addInput("image_1", "IMAGE");
// 强制刷新节点
this.setSize(this.computeSize());
app.graph.setDirtyCanvas(true);
return result;
};
@@ -29,7 +37,7 @@ app.registerExtension({
// 如果连接数量发生变化
if (connectedCount !== this.lastConnectedCount) {
this.lastConnectedCount = connectedCount;
const targetCount = Math.max(connectedCount + 1, 1); // 确保至少保留一个输入
const targetCount = Math.max(connectedCount + 1, 1);
// 获取所有image输入
const imageInputs = this.inputs
@@ -42,9 +50,8 @@ app.registerExtension({
this.addInput(`image_${newIndex}`, "IMAGE");
}
// 只在确实需要移除时才移除多余的输入槽位
// 移除多余的未连接输入槽位
if (imageInputs.length > targetCount) {
// 从后向前检查未连接的输入
for (let i = imageInputs.length - 1; i >= targetCount; i--) {
const input = this.inputs[imageInputs[i].index];
if (!input.link) {
@@ -53,7 +60,7 @@ app.registerExtension({
}
}
// 更新节点大小和画布
// 强制刷新节点
this.setSize(this.computeSize());
app.graph.setDirtyCanvas(true);
}
+16 -9
View File
@@ -1,20 +1,28 @@
import { app } from "/scripts/app.js";
app.registerExtension({
name: "Comfy.PaintingCoder.DynamicMaskCombiner",
name: "PaintingCoder.DynamicMaskCombiner",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
// 检查是否为 DynamicMaskCombiner 节点
if (nodeData.name === "DynamicMaskCombiner") {
if (nodeData.name === "DynamicMaskCombiner" || nodeData.name === "PaintingCoder::DynamicMaskCombiner") {
// 保存原始的 onNodeCreated 方法
const onNodeCreated = nodeType.prototype.onNodeCreated;
// 重写 onNodeCreated 方法
nodeType.prototype.onNodeCreated = function() {
const result = onNodeCreated ? onNodeCreated.apply(this, arguments) : undefined;
// 确保至少有一个输入点
if (!this.inputs || this.inputs.length === 0) {
this.addInput("mask_1", "MASK");
}
// 初始化连接计数器
this.lastConnectedCount = 0;
// 添加第一个掩码输入
this.addInput("mask_1", "MASK");
// 强制刷新节点
this.setSize(this.computeSize());
app.graph.setDirtyCanvas(true);
return result;
};
@@ -29,7 +37,7 @@ app.registerExtension({
// 如果连接数量发生变化
if (connectedCount !== this.lastConnectedCount) {
this.lastConnectedCount = connectedCount;
const targetCount = Math.max(connectedCount + 1, 1); // 确保至少保留一个输入
const targetCount = Math.max(connectedCount + 1, 1);
// 获取所有mask输入
const maskInputs = this.inputs
@@ -42,9 +50,8 @@ app.registerExtension({
this.addInput(`mask_${newIndex}`, "MASK");
}
// 只在确实需要移除时才移除多余的输入槽位
// 移除多余的未连接输入槽位
if (maskInputs.length > targetCount) {
// 从后向前检查未连接的输入
for (let i = maskInputs.length - 1; i >= targetCount; i--) {
const input = this.inputs[maskInputs[i].index];
if (!input.link) {
@@ -53,7 +60,7 @@ app.registerExtension({
}
}
// 更新节点大小和画布
// 强制刷新节点
this.setSize(this.computeSize());
app.graph.setDirtyCanvas(true);
}
+2 -2
View File
@@ -2,9 +2,9 @@ import { app } from "../../../scripts/app.js";
import { setupSizeNode } from "./image_size_base.js";
app.registerExtension({
name: "Comfy.PaintingCoder.ImageSizeCreator",
name: "PaintingCoder.ImageSizeCreator",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === "ImageSizeCreator") {
if (nodeData.name === "ImageSizeCreator" || nodeData.name === "PaintingCoder::ImageSizeCreator") {
setupSizeNode(nodeType, nodeData, app);
}
}
+2 -3
View File
@@ -1,10 +1,9 @@
import { app } from "/scripts/app.js";
app.registerExtension({
name: "Comfy.PaintingCoder.MaskPreview",
name: "PaintingCoder.MaskPreview",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
// 检查是否为 MaskPreview 节点
if (nodeData.name === "MaskPreview") {
if (nodeData.name === "MaskPreview" || nodeData.name === "PaintingCoder::MaskPreview") {
// 保存原始的 onNodeCreated 方法
const onNodeCreated = nodeType.prototype.onNodeCreated;
+1 -1
View File
@@ -6,7 +6,7 @@ app.registerExtension({
async beforeRegisterNodeDef(nodeType, nodeData, app) {
// console.log("[ShowTextPlus] Registering node:", nodeData.name);
if (nodeData.name === "ShowTextPlus") {
if (nodeData.name === "ShowTextPlus" || nodeData.name === "PaintingCoder::ShowTextPlus") {
function populate(text) {
// console.log("[ShowTextPlus] Populating with:", text);
+3 -3
View File
@@ -1,10 +1,10 @@
import { app } from "/scripts/app.js";
app.registerExtension({
name: "Comfy.PaintingCoder.TextCombiner",
name: "PaintingCoder.TextCombiner",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
// 检查是否为 TextCombiner 节点
if (nodeData.name === "TextCombiner") {
// 更新节点检查条件,只保留原始名称和新命名空间格式
if (nodeData.name === "TextCombiner" || nodeData.name === "PaintingCoder::TextCombiner") {
// 添加自定义样式
const style = document.createElement('style');
style.textContent = `