@@ -156,20 +156,26 @@ Please check the [video](https://youtu.be/eyjy10T201M).
|
||||
- 2025-05-11 - v1.9.10 1. Update Wan Video repaint workflows.
|
||||
- 2025-05-12 - v1.9.11 1. Add Wan Video VACE ff/flf2vid repaint workflows.
|
||||
- 2025-05-12 - v1.9.12 1. Update Wan Video VACE workflow.
|
||||
- 2025-05-18 - v1.9.13 1. Update Wan Video VACE workflow.
|
||||
- 2025-05-20 - v1.9.14 1. Add Trim Video Latent Node ot Native Wan VACE workflow. Update Native t2v and r2v Wan VACE workflow.
|
||||
2. Remove Save Image and Save Webm nodes for Auto Mask | Auto Motion | Control Video Module workflow. Video Combine can save as both.
|
||||
|
||||
</details>
|
||||
|
||||
- 2025-05-18 - v1.9.13
|
||||
1. Update Wan Video VACE workflow.
|
||||
|
||||
- 2025-05-20 - v1.9.14
|
||||
1. Add Trim Video Latent Node ot Native Wan VACE workflow. Update Native t2v and r2v Wan VACE workflow.
|
||||
2. Remove Save Image and Save Webm nodes for Auto Mask | Auto Motion | Control Video Module workflow. Video Combine can save as both.
|
||||
|
||||
- 2025-05-29 - v1.9.15
|
||||
1. Use 10 camera for MV Sampling by default.
|
||||
1. Use 10 camera for Hy3D MV Sampling by default.
|
||||
2. Add Mesh MV sample generation module workflow using IG2MV, MV Adapter and Stable X Delight.
|
||||
3. Add Multi-GPU version of Wan Video Generation workflows.
|
||||
4. Add the Wan Vace fp16 model to the model list instruction.
|
||||
4. Add the Wan Vace 14B fp16 model to the model list instruction.
|
||||
|
||||
- 2025-06-02 - v1.9.16
|
||||
1. Add Dilated ControlNet for Wan Video t2v workflows.
|
||||
2. Add Canny & HED Control Video generation methods for Dilated ControlNet.
|
||||
3. Add Save|Load StringListToJSON nodes to save|load ATI Trajectory presets.
|
||||
4. Add ATI Trajectory generation method to Video-Auto Motion module.
|
||||
5. Add Wan Video ATI Trajectory ff2vid workflow.
|
||||
6. Use bf16 Wan Video VAE by default for all Wan Video generation workflows.
|
||||
7. Add Multi-GPU version of Flux Image Generation workflow.
|
||||
|
||||
## Installation
|
||||
1. `git clone https://github.com/jakechai/ComfyUI-JakeUpgrade` into the `custom_nodes` folder
|
||||
@@ -210,6 +216,7 @@ Please check the [video](https://youtu.be/eyjy10T201M).
|
||||
|
||||
## Video Introduction
|
||||
- Wan Video | Wan Vace workflows: [Youtube](https://youtu.be/4KNOufzVsUs) | [Bilibili](https://www.bilibili.com/video/BV1kCJGzgEL4/)
|
||||
- Wan Video update 1(Dilated CN | ATI | Uni3C preview): [Youtube](WIP) | [Bilibili](WIP)
|
||||
- img2mesh Hunyuan3D Wrapper workflow: [Youtube](https://youtu.be/g94Jufz9Znw) | [Bilibili](https://www.bilibili.com/video/BV1w7ZMY2Ehp/) | [portable ComfyUI v0.3.27+pytorch 2.5.1+cuda 12.4](https://drive.google.com/file/d/1rUchssRRdqLQtu0A-OCkKKLU8_bd0y8q/view?usp=sharing)
|
||||
- img2mesh Hunyuan3D Add more MV texture samples: [Youtube](https://www.youtube.com/watch?v=hdMAksRD9jM)
|
||||
- 1.8.x Update(Group Nodes | Detail Daemon | Crop and Stitch | Stop At Clip Layer | ControlNet Efficiency Mask | ControlNet Loader | "None" selection for IPAdapter Loader| Imgen workflows | API workflows | Krita workflows | Get Mesh 3D data): [Youtube](https://youtu.be/pwHsGnn0zsg) | [Bilibili](https://www.bilibili.com/video/BV1J3cuenEE2/)
|
||||
@@ -237,6 +244,7 @@ Please check the [video](https://youtu.be/eyjy10T201M).
|
||||
- [JK_workflow_imgen_SD3](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_imgen_SD3.json)
|
||||
- [JK_workflow_imgen_SD3 legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_imgen_SD3_legacy.json)
|
||||
- [JK_workflow_imgen_Flux](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_imgen_Flux.json)
|
||||
- [JK_workflow_imgen_Flux_mGPU](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_imgen_Flux_mGPU.json)
|
||||
- [JK_workflow_imgen_Flux legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_imgen_Flux_legacy.json)
|
||||
- [JK_workflow_imgen_API](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_imgen_API.json)
|
||||
- [JK_workflow_img2mesh_Hunyuan3DWrapper](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_img2mesh_Hunyuan3DWrapper.json)
|
||||
@@ -255,22 +263,23 @@ Please check the [video](https://youtu.be/eyjy10T201M).
|
||||
- [JK_workflow_Video-Wan__VACE](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_Video-Wan__VACE.json)
|
||||
- [JK_workflow_Video-Wan__VACE_mGPU](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_Video-Wan__VACE_mGPU.json)
|
||||
- [JK_workflow_Video-Wan__SkyreelDF](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_Video-Wan__SkyreelDF.json)
|
||||
- [JK_workflow_Video-Wan__SkyreelDF_mGPU](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_Video-Wan__SkyreelDF_mGPU.json)
|
||||
- [JK_workflow_Video-FramePack](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Main/JK_workflow_Video-FramePack.json)
|
||||
|
||||
#### Module
|
||||
- [JK_module_AutoPrompt](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_00_AutoPrompt.json)
|
||||
- [JK_module_Image Generation](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_01_ImgGen.json)
|
||||
- [JK_module_Image Generation Adv](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_01_ImgGen_Adv.json)
|
||||
- [JK_module_Refine](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_04_Refine.json)
|
||||
- [JK_module_Refine legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_04_Refine_legacy.json)
|
||||
- [JK_module_Upscale 1st](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_05_Upscale_1st.json)
|
||||
- [JK_module_Upscale 1st legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_05_Upscale_1st_legacy.json)
|
||||
- [JK_module_Upscale 2nd](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_05_Upscale_2nd.json)
|
||||
- [JK_module_Detailer](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_06_Detailer.json)
|
||||
- [JK_module_Detailer legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_06_Detailer_legacy.json)
|
||||
- [JK_module_HandFix](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_06_HandFix.json)
|
||||
- [JK_module_HandFix legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_06_HandFix_legacy.json)
|
||||
- [JK_module_Inpaint](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_07_Inpaint.json)
|
||||
- [JK_module_00_AutoPrompt](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_00_AutoPrompt.json)
|
||||
- [JK_module_01_Image Generation](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_01_ImgGen.json)
|
||||
- [JK_module_01_Image Generation Adv](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_01_ImgGen_Adv.json)
|
||||
- [JK_module_04_Refine](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_04_Refine.json)
|
||||
- [JK_module_04_Refine legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_04_Refine_legacy.json)
|
||||
- [JK_module_05_Upscale 1st](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_05_Upscale_1st.json)
|
||||
- [JK_module_05_Upscale 1st legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_05_Upscale_1st_legacy.json)
|
||||
- [JK_module_05_Upscale 2nd](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_05_Upscale_2nd.json)
|
||||
- [JK_module_06_Detailer](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_06_Detailer.json)
|
||||
- [JK_module_06_Detailer legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_06_Detailer_legacy.json)
|
||||
- [JK_module_06_HandFix](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_06_HandFix.json)
|
||||
- [JK_module_06_HandFix legacy](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_06_HandFix_legacy.json)
|
||||
- [JK_module_07_Inpaint](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_07_Inpaint.json)
|
||||
- [JK_module_NoiseInjectionVariation](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_NoiseInjectionVariation.json)
|
||||
- [JK_module_Concept](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Concept.json)
|
||||
- [JK_module_Seamless Texture](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Seamless%20Texture.json)
|
||||
@@ -280,6 +289,7 @@ Please check the [video](https://youtu.be/eyjy10T201M).
|
||||
- [JK_module_Mesh-Gen18MVTex](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Mesh-Gen18MVTex.json)
|
||||
- [JK_module_Video-AutoMask](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Video-AutoMask.json)
|
||||
- [JK_module_Video-AutoMotion](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Video-AutoMotion.json)
|
||||
- [JK_module_Video-AutoPrompt](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Video-AutoPrompt.json)
|
||||
- [JK_module_Video-Control](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Video-Control.json)
|
||||
- [JK_module_Video-Upscale&Interpolation](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Video-Upscale&Interpolation.json)
|
||||
- [JK_module_Video-Upscale&Interpolation_mGPU](https://github.com/jakechai/ComfyUI-JakeUpgrade/blob/master/Workflow/ComfyUI/Module/JK_module_Video-Upscale&Interpolation_mGPU.json)
|
||||
@@ -491,7 +501,7 @@ Please check the [video](https://youtu.be/eyjy10T201M).
|
||||
- [Florence 2](https://github.com/kijai/ComfyUI-Florence2)
|
||||
- [Segment Anything 2](https://github.com/kijai/ComfyUI-segment-anything-2)
|
||||
- [Mat Anyone](https://github.com/KytraScript/ComfyUI_MatAnyone_Kytra)
|
||||
- (multi-gpu)[ComfyUI MultiGPU](https://github.com/neuratech-ai/ComfyUI-MultiGPU)
|
||||
- (multi-gpu)[ComfyUI MultiGPU](https://github.com/pollockjj/ComfyUI-MultiGPU)
|
||||
|
||||
### Krita workflow
|
||||
- [Inpaint Nodes](https://github.com/Acly/comfyui-inpaint-nodes)
|
||||
@@ -691,6 +701,8 @@ Please check the [video](https://youtu.be/eyjy10T201M).
|
||||
Scale To Resolution JK🐉
|
||||
Inject Noise Params JK🐉
|
||||
SD3 Prompts Switch JK🐉
|
||||
Save String List To JSON JK🐉
|
||||
Load String List From JSON JK🐉
|
||||
Reroute Nodes
|
||||
Reroute List JK🐉
|
||||
Reroute Ckpt JK🐉
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6
-2
@@ -35,6 +35,9 @@ NODE_CLASS_MAPPINGS = {
|
||||
"Scale To Resolution JK": ScaleToResolution_JK,
|
||||
"Inject Noise Params JK": Inject_Noise_Params_JK,
|
||||
"SD3 Prompts Switch JK": SD3_Prompts_Switch_JK,
|
||||
"Guidance Default JK": GuidanceDefault_JK,
|
||||
"Save String List To JSON JK": SaveStringListToJSON_JK,
|
||||
"Load String List From JSON JK": LoadStringListFromJSON_JK,
|
||||
### Reroute Nodes
|
||||
"Reroute List JK": RerouteList_JK,
|
||||
"Reroute Ckpt JK": RerouteCkpt_JK,
|
||||
@@ -67,7 +70,6 @@ NODE_CLASS_MAPPINGS = {
|
||||
"NodesState JK": NodesState_JK,
|
||||
"Ksampler Parameters JK": KsamplerParameters_JK,
|
||||
"Ksampler Parameters Default JK": KsamplerParametersDefault_JK,
|
||||
"Guidance Default JK": GuidanceDefault_JK,
|
||||
"Project Setting JK": ProjectSetting_JK,
|
||||
"Base Model Parameters JK": BaseModelParameters_JK,
|
||||
"Base Model Parameters Extract JK": BaseModelParametersExtract_JK,
|
||||
@@ -217,6 +219,9 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"Scale To Resolution JK": "Scale To Resolution JK🐉",
|
||||
"Inject Noise Params JK": "Inject Noise Params JK🐉",
|
||||
"SD3 Prompts Switch JK": "SD3 Prompts Switch JK🐉",
|
||||
"Guidance Default JK": "Guidance Default JK🐉",
|
||||
"Save String List To JSON JK": "Save String List To JSON JK🐉",
|
||||
"Load String List From JSON JK": "Load String List From JSON JK🐉",
|
||||
### Reroute Nodes
|
||||
"Reroute List JK": "Reroute List JK🐉",
|
||||
"Reroute Ckpt JK": "Reroute Ckpt JK🐉",
|
||||
@@ -249,7 +254,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"NodesState JK": "Nodes State JK🐉",
|
||||
"Ksampler Parameters JK": "Ksampler Parameters JK🐉",
|
||||
"Ksampler Parameters Default JK": "Ksampler Parameters Default JK🐉",
|
||||
"Guidance Default JK": "Guidance Default JK🐉",
|
||||
"Project Setting JK": "Project Setting JK🐉",
|
||||
"Base Model Parameters JK": "Base Model Parameters JK🐉",
|
||||
"Base Model Parameters Extract JK": "Base Model Parameters Extract JK🐉",
|
||||
|
||||
+165
-9
@@ -61,14 +61,25 @@ def parse_name(path_name):
|
||||
return filename
|
||||
|
||||
def calculate_sha256(file_path):
|
||||
if not os.path.exists(file_path):
|
||||
print(f"Warning: File not found at {file_path}. Cannot calculate hash.")
|
||||
return None
|
||||
|
||||
sha256_hash = hashlib.sha256()
|
||||
|
||||
with open(file_path, "rb") as f:
|
||||
# Read the file in chunks to avoid loading the entire file into memory
|
||||
for byte_block in iter(lambda: f.read(4096), b""):
|
||||
sha256_hash.update(byte_block)
|
||||
|
||||
return sha256_hash.hexdigest()
|
||||
|
||||
try:
|
||||
# 以二进制模式读取文件,分块处理大文件
|
||||
with open(file_path, "rb") as f:
|
||||
for byte_block in iter(lambda: f.read(8192), b""):
|
||||
sha256_hash.update(byte_block)
|
||||
|
||||
return sha256_hash.hexdigest()
|
||||
except IOError as e:
|
||||
print(f"Error reading file {file_path} for hash calculation: {e}")
|
||||
return None
|
||||
except Exception as e:
|
||||
print(f"Error calculating hash for {file_path}: {e}")
|
||||
return None
|
||||
|
||||
def handle_whitespace(string: str):
|
||||
return string.strip().replace("\n", " ").replace("\r", " ").replace("\t", " ")
|
||||
@@ -788,6 +799,147 @@ class GuidanceDefault_JK:
|
||||
|
||||
return (guidance,)
|
||||
|
||||
class SaveStringListToJSON_JK:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string_input": ("STRING", {"default": ''}),
|
||||
"file_path": ("STRING", {"default": ''}),
|
||||
"overwrite": ("BOOLEAN", {"default": True}),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("string_output",)
|
||||
FUNCTION = "save_strlist"
|
||||
CATEGORY = "JK/Misc"
|
||||
|
||||
def save_strlist(self, string_input, file_path, overwrite):
|
||||
|
||||
# 1. 检查文件路径是否为空
|
||||
if not file_path:
|
||||
print("Error: file_path is empty. Cannot save JSON.")
|
||||
return ("",) # 返回空字符串以表示操作未成功
|
||||
|
||||
# 2. 处理覆盖逻辑
|
||||
# 如果文件已存在且不允许覆盖,则跳过保存
|
||||
if os.path.exists(file_path) and not overwrite:
|
||||
print(f"File '{file_path}' already exists and overwrite is set to False. Skipping save.")
|
||||
return (string_input,)
|
||||
|
||||
# 3. 确保目标目录存在
|
||||
# 获取文件所在目录的路径
|
||||
parent_dir = os.path.dirname(file_path)
|
||||
if parent_dir and not os.path.exists(parent_dir):
|
||||
try:
|
||||
os.makedirs(parent_dir, exist_ok=True)
|
||||
print(f"Created directory: {parent_dir}")
|
||||
except Exception as e:
|
||||
print(f"Error creating directory {parent_dir}: {e}")
|
||||
return (string_input,)
|
||||
|
||||
# 4. 保存STRING数据到文件
|
||||
try:
|
||||
# 'w' 模式会创建文件(如果不存在)或截断文件(如果存在)
|
||||
# 编码设置为utf-8以支持各种字符
|
||||
# indent=4 使JSON文件格式化,更易读
|
||||
with open(file_path, 'w', encoding='utf-8') as file:
|
||||
json.dump(string_input, file, indent=4)
|
||||
print(f"Successfully saved JSON to {file_path}")
|
||||
except Exception as e:
|
||||
print(f"Error saving JSON to {file_path}: {e}")
|
||||
return (string_input,)
|
||||
|
||||
# 5. 返回原始输入字符串,作为下游节点的输入
|
||||
return (string_input,)
|
||||
|
||||
class LoadStringListFromJSON_JK:
|
||||
def __init__(self):
|
||||
# 缓存变量:每个节点实例都会有自己的缓存
|
||||
self._cached_file_path = None
|
||||
self._cached_file_hash = None
|
||||
self._cached_data = None
|
||||
self._last_force_reload_value = 0
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"file_path": ("STRING", {"default": ''}),
|
||||
},
|
||||
"optional": {
|
||||
"force_reload": ("INT", {"default": 0, "min": 0, "max": 100000}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("string_output",)
|
||||
FUNCTION = "load_strlist"
|
||||
CATEGORY = "JK/Misc"
|
||||
|
||||
def load_strlist(self, file_path, force_reload=0):
|
||||
# 1. 检查文件路径是否为空
|
||||
if not file_path:
|
||||
print("Warning: file_path is empty. Returning empty JSON string.")
|
||||
self._cached_file_path = None
|
||||
self._cached_file_hash = None
|
||||
self._cached_data = None
|
||||
return ("",)
|
||||
|
||||
# 2. 检查文件是否存在
|
||||
if not os.path.exists(file_path):
|
||||
print(f"Error: File not found at {file_path}. Returning empty JSON string.")
|
||||
self._cached_file_path = None
|
||||
self._cached_file_hash = None
|
||||
self._cached_data = None
|
||||
return ("",)
|
||||
|
||||
# 3. 计算当前文件的哈希值
|
||||
current_file_hash = calculate_sha256(file_path)
|
||||
|
||||
# 4. 判断是否需要重新加载文件
|
||||
if (file_path != self._cached_file_path or
|
||||
current_file_hash != self._cached_file_hash or
|
||||
force_reload != self._last_force_reload_value):
|
||||
|
||||
print(f"Loading JSON from {file_path} (reloaded due to change or force_reload).")
|
||||
try:
|
||||
with open(file_path, 'r') as file:
|
||||
str_lists = json.load(file) # json.load() 返回的是Python对象
|
||||
|
||||
# 更新缓存
|
||||
self._cached_file_path = file_path
|
||||
self._cached_file_hash = current_file_hash
|
||||
self._cached_data = str_lists
|
||||
self._last_force_reload_value = force_reload
|
||||
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Error decoding JSON from {file_path}: {e}")
|
||||
# 解码失败时,清除缓存,避免下次仍然使用错误的数据
|
||||
self._cached_file_path = None
|
||||
self._cached_file_hash = None
|
||||
self._cached_data = None
|
||||
return ("",)
|
||||
|
||||
except Exception as e:
|
||||
print(f"An unexpected error occurred while reading {file_path}: {e}")
|
||||
self._cached_file_path = None
|
||||
self._cached_file_hash = None
|
||||
self._cached_data = None
|
||||
return ("",)
|
||||
else:
|
||||
print(f"Using cached JSON data for {file_path} (no change detected).")
|
||||
|
||||
# 5. 返回结果
|
||||
if self._cached_data is not None:
|
||||
return (self._cached_data,)
|
||||
else:
|
||||
return ("",)
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
# Reroute Nodes
|
||||
#---------------------------------------------------------------------------------------------------------------------#
|
||||
@@ -6114,6 +6266,9 @@ NODE_CLASS_MAPPINGS = {
|
||||
"Scale To Resolution JK": ScaleToResolution_JK,
|
||||
"Inject Noise Params JK": Inject_Noise_Params_JK,
|
||||
"SD3 Prompts Switch JK": SD3_Prompts_Switch_JK,
|
||||
"Guidance Default JK": GuidanceDefault_JK,
|
||||
"Save String List To JSON JK": SaveStringListToJSON_JK,
|
||||
"Load String List From JSON JK": LoadStringListFromJSON_JK,
|
||||
### Reroute Nodes
|
||||
"Reroute List JK": RerouteList_JK,
|
||||
"Reroute Ckpt JK": RerouteCkpt_JK,
|
||||
@@ -6146,7 +6301,6 @@ NODE_CLASS_MAPPINGS = {
|
||||
"NodesState JK": NodesState_JK,
|
||||
"Ksampler Parameters JK": KsamplerParameters_JK,
|
||||
"Ksampler Parameters Default JK": KsamplerParametersDefault_JK,
|
||||
"Guidance Default JK": GuidanceDefault_JK,
|
||||
"Project Setting JK": ProjectSetting_JK,
|
||||
"Base Model Parameters JK": BaseModelParameters_JK,
|
||||
"Base Model Parameters Extract JK": BaseModelParametersExtract_JK,
|
||||
@@ -6295,6 +6449,9 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"Scale To Resolution JK": "Scale To Resolution JK🐉",
|
||||
"Inject Noise Params JK": "Inject Noise Params JK🐉",
|
||||
"SD3 Prompts Switch JK": "SD3 Prompts Switch JK🐉",
|
||||
"Guidance Default JK": "Guidance Default JK🐉",
|
||||
"Save String List To JSON JK": "Save String List To JSON JK🐉",
|
||||
"Load String List From JSON JK": "Load String List From JSON JK🐉",
|
||||
### Reroute Nodes
|
||||
"Reroute List JK": "Reroute List JK🐉",
|
||||
"Reroute Ckpt JK": "Reroute Ckpt JK🐉",
|
||||
@@ -6327,7 +6484,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"NodesState JK": "Nodes State JK🐉",
|
||||
"Ksampler Parameters JK": "Ksampler Parameters JK🐉",
|
||||
"Ksampler Parameters Default JK": "Ksampler Parameters Default JK🐉",
|
||||
"Guidance Default JK": "Guidance Default JK🐉",
|
||||
"Project Setting JK": "Project Setting JK🐉",
|
||||
"Base Model Parameters JK": "Base Model Parameters JK🐉",
|
||||
"Base Model Parameters Extract JK": "Base Model Parameters Extract JK🐉",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-jakeupgrade"
|
||||
description = "ComfyUI workflow customization by Jake."
|
||||
version = "1.9.15"
|
||||
version = "1.9.16"
|
||||
license = {file = "LICENSE"}
|
||||
dependencies = ["opencv-python", "piexif", "torch", "numpy", "numexpr", "simpleeval"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user