6 Commits
Author SHA1 Message Date
陈亮 83379f6ac6 修复导入错误 2025-07-22 12:45:19 +08:00
陈亮 7c9c534cfe 修复节点名称问题 2025-07-09 11:37:37 +08:00
陈亮 0a503675d0 添加示例 2025-07-04 10:46:46 +08:00
陈亮 6dd74b77f3 bump to v0.0.5 with Repository 2025-07-03 12:16:37 +08:00
陈亮 b4d04698bb bump to v0.0.4 2025-07-03 12:13:59 +08:00
陈亮 f95afc9c1b bump to v0.0.3 2025-07-03 12:07:10 +08:00
6 changed files with 1017 additions and 8 deletions
+3
View File
@@ -18,6 +18,9 @@
- `Batch Image Loop Open SunxAI`:读取图像批次,按索引逐张送出
- `Batch Image Loop Close SunxAI`:接收每次循环结果,自动拼接最终结果
![视频转动漫工作流](./example_workflows/Sun_sample_workflow.png)
📌 **特点:**
- 🚀 **逐帧处理**:每一张图像会被完整处理后,才进入下一张循环(不是在采样时同时执行多帧)
+11 -5
View File
@@ -1,16 +1,22 @@
import os
import importlib
import importlib.util
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
nodes_path = os.path.join(os.path.dirname(__file__), "nodes")
nodes_dir = os.path.join(os.path.dirname(__file__), "nodes")
for filename in os.listdir(nodes_path):
for filename in os.listdir(nodes_dir):
if filename.endswith(".py") and filename != "__init__.py":
module_name = f"{__name__}.nodes.{filename[:-3]}"
module = importlib.import_module(module_name)
filepath = os.path.join(nodes_dir, filename)
module_name = filename[:-3] # 不要带你的包名
# 动态加载模块(防止污染 __name__)
spec = importlib.util.spec_from_file_location(module_name, filepath)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
# 查找 *_CLASS_MAPPINGS
for attr in dir(module):
if attr.endswith("_CLASS_MAPPINGS"):
NODE_CLASS_MAPPINGS.update(getattr(module, attr))
+998
View File
@@ -0,0 +1,998 @@
{
"id": "7cbcec68-7fa6-47bb-a38a-da689949a001",
"revision": 0,
"last_node_id": 301,
"last_link_id": 519,
"nodes": [
{
"id": 6,
"type": "CLIPTextEncode",
"pos": [
13.008308410644531,
63.21992492675781
],
"size": [
280.2037048339844,
122.77008056640625
],
"flags": {
"collapsed": false
},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 59
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
237,
514
]
}
],
"title": "CLIP Text Encode (Positive Prompt)",
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.38",
"Node name for S&R": "CLIPTextEncode",
"widget_ue_connectable": {}
},
"widgets_values": [
"Change to anime style while maintaining the original composition"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 8,
"type": "VAEDecode",
"pos": [
1239.2454833984375,
68.62554931640625
],
"size": [
190,
46
],
"flags": {
"collapsed": false
},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 52
},
{
"name": "vae",
"type": "VAE",
"link": 61
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"slot_index": 0,
"links": [
513
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.38",
"Node name for S&R": "VAEDecode",
"widget_ue_connectable": {}
},
"widgets_values": []
},
{
"id": 31,
"type": "KSampler",
"pos": [
833.25634765625,
43.657920837402344
],
"size": [
304.3830871582031,
474
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 300
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 464
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 515
},
{
"name": "latent_image",
"type": "LATENT",
"link": 519
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
52
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.38",
"Node name for S&R": "KSampler",
"widget_ue_connectable": {}
},
"widgets_values": [
323524225475238,
"randomize",
20,
1,
"euler",
"simple",
1
]
},
{
"id": 35,
"type": "FluxGuidance",
"pos": [
505.7422790527344,
65.77576446533203
],
"size": [
210,
58
],
"flags": {
"collapsed": false
},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "conditioning",
"type": "CONDITIONING",
"link": 292
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
464
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.38",
"Node name for S&R": "FluxGuidance",
"widget_ue_connectable": {}
},
"widgets_values": [
2.5
]
},
{
"id": 37,
"type": "UNETLoader",
"pos": [
-525.5791015625,
114.7538070678711
],
"size": [
337.76861572265625,
82
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
300
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.38",
"Node name for S&R": "UNETLoader",
"models": [
{
"name": "flux1-dev-kontext_fp8_scaled.safetensors",
"url": "https://huggingface.co/Comfy-Org/flux1-kontext-dev_ComfyUI/resolve/main/split_files/diffusion_models/flux1-dev-kontext_fp8_scaled.safetensors",
"directory": "diffusion_models"
}
],
"widget_ue_connectable": {}
},
"widgets_values": [
"flux1-kontext-dev.safetensors",
"fp8_e4m3fn"
],
"color": "#322",
"bgcolor": "#533"
},
{
"id": 38,
"type": "DualCLIPLoader",
"pos": [
-525.5791015625,
244.75389099121094
],
"size": [
337.76861572265625,
130
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "CLIP",
"type": "CLIP",
"links": [
59
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.38",
"Node name for S&R": "DualCLIPLoader",
"models": [
{
"name": "clip_l.safetensors",
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors",
"directory": "text_encoders"
},
{
"name": "t5xxl_fp8_e4m3fn_scaled.safetensors",
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn_scaled.safetensors",
"directory": "text_encoders"
}
],
"widget_ue_connectable": {}
},
"widgets_values": [
"clip_l.safetensors",
"t5xxl_fp8_e4m3fn.safetensors",
"flux",
"default"
],
"color": "#322",
"bgcolor": "#533"
},
{
"id": 39,
"type": "VAELoader",
"pos": [
-525.5791015625,
424.7539367675781
],
"size": [
337.76861572265625,
58
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "VAE",
"type": "VAE",
"links": [
61,
517
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.38",
"Node name for S&R": "VAELoader",
"models": [
{
"name": "ae.safetensors",
"url": "https://huggingface.co/Comfy-Org/Lumina_Image_2.0_Repackaged/resolve/main/split_files/vae/ae.safetensors",
"directory": "vae"
}
],
"widget_ue_connectable": {}
},
"widgets_values": [
"FLUX/flux_vae.safetensors"
],
"color": "#322",
"bgcolor": "#533"
},
{
"id": 135,
"type": "ConditioningZeroOut",
"pos": [
543.3994750976562,
167.55950927734375
],
"size": [
240,
26
],
"flags": {
"collapsed": true
},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "conditioning",
"type": "CONDITIONING",
"link": 237
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
515
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.39",
"Node name for S&R": "ConditioningZeroOut",
"widget_ue_connectable": {}
},
"widgets_values": []
},
{
"id": 177,
"type": "ReferenceLatent",
"pos": [
333.2911376953125,
70.3294906616211
],
"size": [
143.41659545898438,
46
],
"flags": {
"collapsed": false
},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "conditioning",
"type": "CONDITIONING",
"link": 514
},
{
"name": "latent",
"shape": 7,
"type": "LATENT",
"link": 518
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
292
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.41",
"Node name for S&R": "ReferenceLatent",
"widget_ue_connectable": {}
},
"widgets_values": []
},
{
"id": 184,
"type": "MarkdownNote",
"pos": [
-1111.9537353515625,
66.36994934082031
],
"size": [
510.0960998535156,
116.33981323242188
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"title": "Model links",
"properties": {
"widget_ue_connectable": {}
},
"widgets_values": [
"A单图处理,会将单图处理完毕再进行下一张,不会将多张都卡在采样器,\n\n循环你可以加载视频或者图片序列都行。"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 210,
"type": "VHS_LoadVideo",
"pos": [
-550.1968994140625,
655.0445556640625
],
"size": [
252.056640625,
672.0849609375
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "meta_batch",
"shape": 7,
"type": "VHS_BatchManager",
"link": null
},
{
"name": "vae",
"shape": 7,
"type": "VAE",
"link": null
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
511
]
},
{
"name": "frame_count",
"type": "INT",
"links": null
},
{
"name": "audio",
"type": "AUDIO",
"links": null
},
{
"name": "video_info",
"type": "VHS_VIDEOINFO",
"links": null
}
],
"properties": {
"aux_id": "upseem/comfyui_sun_nodes",
"ver": "972c87da577b47211c4e9aeed30dc38c7bae607f",
"Node name for S&R": "VHS_LoadVideo",
"cnr_id": "comfyui-videohelpersuite",
"widget_ue_connectable": {}
},
"widgets_values": {
"video": "1.mp4",
"force_rate": 0,
"custom_width": 0,
"custom_height": 0,
"frame_load_cap": 0,
"skip_first_frames": 0,
"select_every_nth": 1,
"format": "AnimateDiff",
"choose video to upload": "image",
"videopreview": {
"hidden": false,
"paused": false,
"params": {
"filename": "1.mp4",
"type": "input",
"format": "video/mp4",
"force_rate": 0,
"custom_width": 0,
"custom_height": 0,
"frame_load_cap": 0,
"skip_first_frames": 0,
"select_every_nth": 1
}
}
}
},
{
"id": 275,
"type": "VHS_VideoCombine",
"pos": [
1217.2215576171875,
634.74658203125
],
"size": [
219.3603515625,
647.04052734375
],
"flags": {},
"order": 14,
"mode": 0,
"inputs": [
{
"label": "images",
"name": "images",
"type": "IMAGE",
"link": 507
},
{
"label": "audio",
"name": "audio",
"shape": 7,
"type": "AUDIO",
"link": null
},
{
"label": "meta_batch",
"name": "meta_batch",
"shape": 7,
"type": "VHS_BatchManager",
"link": null
},
{
"label": "vae",
"name": "vae",
"shape": 7,
"type": "VAE",
"link": null
}
],
"outputs": [
{
"label": "Filenames",
"name": "Filenames",
"type": "VHS_FILENAMES",
"slot_index": 0,
"links": null
}
],
"properties": {
"aux_id": "upseem/comfyui_sun_nodes",
"ver": "1.5.8",
"Node name for S&R": "VHS_VideoCombine",
"cnr_id": "comfyui-videohelpersuite",
"widget_ue_connectable": {}
},
"widgets_values": {
"frame_rate": 30,
"loop_count": 0,
"filename_prefix": "mp4/test",
"format": "video/h264-mp4",
"pix_fmt": "yuv420p",
"crf": 18,
"save_metadata": true,
"trim_to_audio": false,
"pingpong": false,
"save_output": true,
"videopreview": {
"hidden": false,
"paused": false,
"params": {
"filename": "aa_00101.mp4",
"subfolder": "mp4",
"type": "output",
"format": "video/h264-mp4",
"frame_rate": 3,
"workflow": "aa_00101.png",
"fullpath": "/root/autodl-tmp/ComfyUI/output/mp4/aa_00101.mp4"
}
}
}
},
{
"id": 298,
"type": "SunxAI_BatchImageLoopOpenChen",
"pos": [
-136.82192993164062,
654.65673828125
],
"size": [
249.73828125,
86
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "segmented_images",
"type": "IMAGE",
"link": 511
}
],
"outputs": [
{
"name": "FLOW_CONTROL",
"type": "FLOW_CONTROL",
"links": [
503
]
},
{
"name": "current_image",
"type": "IMAGE",
"links": [
516
]
},
{
"name": "max_iterations",
"type": "INT",
"links": [
504
]
},
{
"name": "iteration_count",
"type": "INT",
"links": []
}
],
"properties": {
"aux_id": "upseem/comfyui_sun_nodes",
"ver": "107ce434ed1cebb9dd9d881fd5b2460d4d74db7c",
"Node name for S&R": "SunxAI_BatchImageLoopOpenChen",
"widget_ue_connectable": {}
},
"widgets_values": []
},
{
"id": 299,
"type": "SunxAI_BatchImageLoopCloseChen",
"pos": [
847.4674072265625,
638.669921875
],
"size": [
302.2437438964844,
98
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "flow_control",
"type": "FLOW_CONTROL",
"link": 503
},
{
"name": "current_image",
"type": "IMAGE",
"link": 513
},
{
"name": "max_iterations",
"type": "INT",
"link": 504
}
],
"outputs": [
{
"name": "result_images",
"type": "IMAGE",
"links": [
507
]
}
],
"properties": {
"aux_id": "upseem/comfyui_sun_nodes",
"ver": "107ce434ed1cebb9dd9d881fd5b2460d4d74db7c",
"Node name for S&R": "SunxAI_BatchImageLoopCloseChen",
"widget_ue_connectable": {}
},
"widgets_values": [
false
]
},
{
"id": 300,
"type": "VAEEncode",
"pos": [
119.16875457763672,
266.8257141113281
],
"size": [
140,
46
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "pixels",
"type": "IMAGE",
"link": 516
},
{
"name": "vae",
"type": "VAE",
"link": 517
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
518,
519
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.42",
"Node name for S&R": "VAEEncode",
"widget_ue_connectable": {}
},
"widgets_values": []
}
],
"links": [
[
52,
31,
0,
8,
0,
"LATENT"
],
[
59,
38,
0,
6,
0,
"CLIP"
],
[
61,
39,
0,
8,
1,
"VAE"
],
[
237,
6,
0,
135,
0,
"CONDITIONING"
],
[
292,
177,
0,
35,
0,
"CONDITIONING"
],
[
300,
37,
0,
31,
0,
"MODEL"
],
[
464,
35,
0,
31,
1,
"CONDITIONING"
],
[
503,
298,
0,
299,
0,
"FLOW_CONTROL"
],
[
504,
298,
2,
299,
2,
"INT"
],
[
507,
299,
0,
275,
0,
"IMAGE"
],
[
511,
210,
0,
298,
0,
"IMAGE"
],
[
513,
8,
0,
299,
1,
"IMAGE"
],
[
514,
6,
0,
177,
0,
"CONDITIONING"
],
[
515,
135,
0,
31,
2,
"CONDITIONING"
],
[
516,
298,
1,
300,
0,
"IMAGE"
],
[
517,
39,
0,
300,
1,
"VAE"
],
[
518,
300,
0,
177,
1,
"LATENT"
],
[
519,
300,
0,
31,
3,
"LATENT"
]
],
"groups": [
{
"id": 1,
"title": "Step 1- Load models",
"bounding": [
-535.5791015625,
44.753883361816406,
360,
450
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
},
{
"id": 3,
"title": "循环执行",
"bounding": [
-588.2969970703125,
564.1963500976562,
2152.915283203125,
792.60986328125
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
},
{
"id": 6,
"title": "A:处理单张图片流程",
"bounding": [
-578.388916015625,
-9.562874794006348,
2136.165283203125,
532.2862548828125
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
},
{
"id": 7,
"title": "✅SUNXAI 循环节点",
"bounding": [
-565.919921875,
-272.7617492675781,
2125.043701171875,
224.5164031982422
],
"color": "#a1309b",
"font_size": 160,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.45000000000000245,
"offset": [
1211.9537353515625,
56.342079162597656
]
},
"frontendVersion": "1.23.4",
"groupNodes": {},
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true,
"ue_links": [],
"links_added_by_ue": []
},
"version": 0.4
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

+2 -1
View File
@@ -1,6 +1,7 @@
from comfy_execution.graph_utils import GraphBuilder, is_link
from ..tools.tools import VariantSupport
from comfyui_sun_nodes.tools.tools import VariantSupport
import torch.nn.functional as F
import torch
from nodes import NODE_CLASS_MAPPINGS as ALL_NODE_CLASS_MAPPINGS
+3 -2
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "comfyui_sun_nodes"
version = "0.0.2"
version = "0.0.7"
description = "Custom ComfyUI nodes by SunX.AI"
authors = [
{name = "SunX AI", email = "sunx.ai@hotmail.com"}
@@ -31,11 +31,12 @@ dev = [
[project.urls]
bugs = "https://github.com/upseem/comfyui_sun_nodes/issues"
homepage = "https://github.com/upseem/comfyui_sun_nodes"
Repository = "https://github.com/upseem/comfyui_sun_nodes"
[tool.comfy]
PublisherId = "sunxai"
DisplayName = "comfyui_Sun_nodes"
DisplayName = "ComfyUI Sun Nodes"
Icon = "https://avatars.githubusercontent.com/u/124853686"