mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-27 14:50:20 +08:00
Merge branch 'comfyanonymous:master' into quantize-palette
This commit is contained in:
commit
42eefe6b56
@ -88,3 +88,8 @@ class Example:
|
|||||||
NODE_CLASS_MAPPINGS = {
|
NODE_CLASS_MAPPINGS = {
|
||||||
"Example": Example
|
"Example": Example
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
|
"Example": "Example Node"
|
||||||
|
}
|
||||||
|
|||||||
50
nodes.py
50
nodes.py
@ -1104,6 +1104,54 @@ NODE_CLASS_MAPPINGS = {
|
|||||||
"DiffusersLoader": DiffusersLoader,
|
"DiffusersLoader": DiffusersLoader,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
|
# Sampling
|
||||||
|
"KSampler": "KSampler",
|
||||||
|
"KSamplerAdvanced": "KSampler (Advanced)",
|
||||||
|
# Loaders
|
||||||
|
"CheckpointLoader": "Load Checkpoint (With Config)",
|
||||||
|
"CheckpointLoaderSimple": "Load Checkpoint",
|
||||||
|
"VAELoader": "Load VAE",
|
||||||
|
"LoraLoader": "Load LoRA",
|
||||||
|
"CLIPLoader": "Load CLIP",
|
||||||
|
"ControlNetLoader": "Load ControlNet Model",
|
||||||
|
"DiffControlNetLoader": "Load ControlNet Model (diff)",
|
||||||
|
"StyleModelLoader": "Load Style Model",
|
||||||
|
"CLIPVisionLoader": "Load CLIP Vision",
|
||||||
|
"UpscaleModelLoader": "Load Upscale Model",
|
||||||
|
# Conditioning
|
||||||
|
"CLIPVisionEncode": "CLIP Vision Encode",
|
||||||
|
"StyleModelApply": "Apply Style Model",
|
||||||
|
"CLIPTextEncode": "CLIP Text Encode (Prompt)",
|
||||||
|
"CLIPSetLastLayer": "CLIP Set Last Layer",
|
||||||
|
"ConditioningCombine": "Conditioning (Combine)",
|
||||||
|
"ConditioningSetArea": "Conditioning (Set Area)",
|
||||||
|
"ControlNetApply": "Apply ControlNet",
|
||||||
|
# Latent
|
||||||
|
"VAEEncodeForInpaint": "VAE Encode (for Inpainting)",
|
||||||
|
"SetLatentNoiseMask": "Set Latent Noise Mask",
|
||||||
|
"VAEDecode": "VAE Decode",
|
||||||
|
"VAEEncode": "VAE Encode",
|
||||||
|
"LatentRotate": "Rotate Latent",
|
||||||
|
"LatentFlip": "Flip Latent",
|
||||||
|
"LatentCrop": "Crop Latent",
|
||||||
|
"EmptyLatentImage": "Empty Latent Image",
|
||||||
|
"LatentUpscale": "Upscale Latent",
|
||||||
|
"LatentComposite": "Latent Composite",
|
||||||
|
# Image
|
||||||
|
"SaveImage": "Save Image",
|
||||||
|
"PreviewImage": "Preview Image",
|
||||||
|
"LoadImage": "Load Image",
|
||||||
|
"LoadImageMask": "Load Image (as Mask)",
|
||||||
|
"ImageScale": "Upscale Image",
|
||||||
|
"ImageUpscaleWithModel": "Upscale Image (using Model)",
|
||||||
|
"ImageInvert": "Invert Image",
|
||||||
|
"ImagePadForOutpaint": "Pad Image for Outpainting",
|
||||||
|
# _for_testing
|
||||||
|
"VAEDecodeTiled": "VAE Decode (Tiled)",
|
||||||
|
"VAEEncodeTiled": "VAE Encode (Tiled)",
|
||||||
|
}
|
||||||
|
|
||||||
def load_custom_node(module_path):
|
def load_custom_node(module_path):
|
||||||
module_name = os.path.basename(module_path)
|
module_name = os.path.basename(module_path)
|
||||||
if os.path.isfile(module_path):
|
if os.path.isfile(module_path):
|
||||||
@ -1119,6 +1167,8 @@ def load_custom_node(module_path):
|
|||||||
module_spec.loader.exec_module(module)
|
module_spec.loader.exec_module(module)
|
||||||
if hasattr(module, "NODE_CLASS_MAPPINGS") and getattr(module, "NODE_CLASS_MAPPINGS") is not None:
|
if hasattr(module, "NODE_CLASS_MAPPINGS") and getattr(module, "NODE_CLASS_MAPPINGS") is not None:
|
||||||
NODE_CLASS_MAPPINGS.update(module.NODE_CLASS_MAPPINGS)
|
NODE_CLASS_MAPPINGS.update(module.NODE_CLASS_MAPPINGS)
|
||||||
|
if hasattr(module, "NODE_DISPLAY_NAME_MAPPINGS") and getattr(module, "NODE_DISPLAY_NAME_MAPPINGS") is not None:
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS.update(module.NODE_DISPLAY_NAME_MAPPINGS)
|
||||||
else:
|
else:
|
||||||
print(f"Skip {module_path} module for custom nodes due to the lack of NODE_CLASS_MAPPINGS.")
|
print(f"Skip {module_path} module for custom nodes due to the lack of NODE_CLASS_MAPPINGS.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -177,7 +177,8 @@ class PromptServer():
|
|||||||
info['input'] = obj_class.INPUT_TYPES()
|
info['input'] = obj_class.INPUT_TYPES()
|
||||||
info['output'] = obj_class.RETURN_TYPES
|
info['output'] = obj_class.RETURN_TYPES
|
||||||
info['output_name'] = obj_class.RETURN_NAMES if hasattr(obj_class, 'RETURN_NAMES') else info['output']
|
info['output_name'] = obj_class.RETURN_NAMES if hasattr(obj_class, 'RETURN_NAMES') else info['output']
|
||||||
info['name'] = x #TODO
|
info['name'] = x
|
||||||
|
info['display_name'] = nodes.NODE_DISPLAY_NAME_MAPPINGS[x] if x in nodes.NODE_DISPLAY_NAME_MAPPINGS.keys() else x
|
||||||
info['description'] = ''
|
info['description'] = ''
|
||||||
info['category'] = 'sd'
|
info['category'] = 'sd'
|
||||||
if hasattr(obj_class, 'CATEGORY'):
|
if hasattr(obj_class, 'CATEGORY'):
|
||||||
|
|||||||
@ -21,28 +21,74 @@ const colorPalettes = {
|
|||||||
"MODEL": "#B39DDB", // light lavender-purple
|
"MODEL": "#B39DDB", // light lavender-purple
|
||||||
"STYLE_MODEL": "#C2FFAE", // light green-yellow
|
"STYLE_MODEL": "#C2FFAE", // light green-yellow
|
||||||
"VAE": "#FF6E6E", // bright red
|
"VAE": "#FF6E6E", // bright red
|
||||||
}
|
},
|
||||||
}
|
"litegraph_base": {
|
||||||
|
"NODE_TITLE_COLOR": "#999",
|
||||||
|
"NODE_SELECTED_TITLE_COLOR": "#FFF",
|
||||||
|
"NODE_TEXT_SIZE": 14,
|
||||||
|
"NODE_TEXT_COLOR": "#AAA",
|
||||||
|
"NODE_SUBTEXT_SIZE": 12,
|
||||||
|
"NODE_DEFAULT_COLOR": "#333",
|
||||||
|
"NODE_DEFAULT_BGCOLOR": "#353535",
|
||||||
|
"NODE_DEFAULT_BOXCOLOR": "#666",
|
||||||
|
"NODE_DEFAULT_SHAPE": "box",
|
||||||
|
"NODE_BOX_OUTLINE_COLOR": "#FFF",
|
||||||
|
"DEFAULT_SHADOW_COLOR": "rgba(0,0,0,0.5)",
|
||||||
|
"DEFAULT_GROUP_FONT": 24,
|
||||||
|
|
||||||
|
"WIDGET_BGCOLOR": "#222",
|
||||||
|
"WIDGET_OUTLINE_COLOR": "#666",
|
||||||
|
"WIDGET_TEXT_COLOR": "#DDD",
|
||||||
|
"WIDGET_SECONDARY_TEXT_COLOR": "#999",
|
||||||
|
|
||||||
|
"LINK_COLOR": "#9A9",
|
||||||
|
"EVENT_LINK_COLOR": "#A86",
|
||||||
|
"CONNECTING_LINK_COLOR": "#AFA",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"palette_2": {
|
"solarized": {
|
||||||
"id": "palette_2",
|
"id": "solarized",
|
||||||
"name": "Palette 2",
|
"name": "Solarized",
|
||||||
"colors": {
|
"colors": {
|
||||||
"node_slot": {
|
"node_slot": {
|
||||||
"CLIP": "#556B2F", // Dark Olive Green
|
"CLIP": "#859900", // Green
|
||||||
"CLIP_VISION": "#4B0082", // Indigo
|
"CLIP_VISION": "#6c71c4", // Indigo
|
||||||
"CLIP_VISION_OUTPUT": "#006400", // Green
|
"CLIP_VISION_OUTPUT": "#859900", // Green
|
||||||
"CONDITIONING": "#FF1493", // Deep Pink
|
"CONDITIONING": "#d33682", // Magenta
|
||||||
"CONTROL_NET": "#8B4513", // Saddle Brown
|
"CONTROL_NET": "#cb4b16", // Orange
|
||||||
"IMAGE": "#8B0000", // Dark Red
|
"IMAGE": "#dc322f", // Red
|
||||||
"LATENT": "#00008B", // Dark Blue
|
"LATENT": "#268bd2", // Blue
|
||||||
"MASK": "#2F4F4F", // Dark Slate Grey
|
"MASK": "#073642", // Base02
|
||||||
"MODEL": "#FF8C00", // Dark Orange
|
"MODEL": "#cb4b16", // Orange
|
||||||
"STYLE_MODEL": "#004A4A", // Sherpa Blue
|
"STYLE_MODEL": "#073642", // Base02
|
||||||
"UPSCALE_MODEL": "#4A004A", // Tyrian Purple
|
"UPSCALE_MODEL": "#6c71c4", // Indigo
|
||||||
"VAE": "#4F394F", // Loulou
|
"VAE": "#586e75", // Base1
|
||||||
}
|
},
|
||||||
}
|
"litegraph_base": {
|
||||||
|
"NODE_TITLE_COLOR": "#fdf6e3",
|
||||||
|
"NODE_SELECTED_TITLE_COLOR": "#b58900",
|
||||||
|
"NODE_TEXT_SIZE": 14,
|
||||||
|
"NODE_TEXT_COLOR": "#657b83",
|
||||||
|
"NODE_SUBTEXT_SIZE": 12,
|
||||||
|
"NODE_DEFAULT_COLOR": "#586e75",
|
||||||
|
"NODE_DEFAULT_BGCOLOR": "#073642",
|
||||||
|
"NODE_DEFAULT_BOXCOLOR": "#839496",
|
||||||
|
"NODE_DEFAULT_SHAPE": "box",
|
||||||
|
"NODE_BOX_OUTLINE_COLOR": "#fdf6e3",
|
||||||
|
"DEFAULT_SHADOW_COLOR": "rgba(0,0,0,0.5)",
|
||||||
|
"DEFAULT_GROUP_FONT": 24,
|
||||||
|
|
||||||
|
"WIDGET_BGCOLOR": "#002b36",
|
||||||
|
"WIDGET_OUTLINE_COLOR": "#839496",
|
||||||
|
"WIDGET_TEXT_COLOR": "#fdf6e3",
|
||||||
|
"WIDGET_SECONDARY_TEXT_COLOR": "#93a1a1",
|
||||||
|
|
||||||
|
"LINK_COLOR": "#2aa198",
|
||||||
|
"EVENT_LINK_COLOR": "#268bd2",
|
||||||
|
"CONNECTING_LINK_COLOR": "#859900",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -192,8 +238,20 @@ app.registerExtension({
|
|||||||
if (colorPalette.colors) {
|
if (colorPalette.colors) {
|
||||||
if (colorPalette.colors.node_slot) {
|
if (colorPalette.colors.node_slot) {
|
||||||
Object.assign(app.canvas.default_connection_color_byType, colorPalette.colors.node_slot);
|
Object.assign(app.canvas.default_connection_color_byType, colorPalette.colors.node_slot);
|
||||||
app.canvas.draw(true, true);
|
Object.assign(LGraphCanvas.link_type_colors, colorPalette.colors.node_slot);
|
||||||
}
|
}
|
||||||
|
if (colorPalette.colors.litegraph_base) {
|
||||||
|
// Everything updates correctly in the loop, except the Node Title and Link Color for some reason
|
||||||
|
app.canvas.node_title_color = colorPalette.colors.litegraph_base.NODE_TITLE_COLOR;
|
||||||
|
app.canvas.default_link_color = colorPalette.colors.litegraph_base.LINK_COLOR;
|
||||||
|
|
||||||
|
for (const key in colorPalette.colors.litegraph_base) {
|
||||||
|
if (colorPalette.colors.litegraph_base.hasOwnProperty(key) && LiteGraph.hasOwnProperty(key)) {
|
||||||
|
LiteGraph[key] = colorPalette.colors.litegraph_base[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
app.canvas.draw(true, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -835,7 +835,7 @@ class ComfyApp {
|
|||||||
app.#invokeExtensionsAsync("nodeCreated", this);
|
app.#invokeExtensionsAsync("nodeCreated", this);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: nodeData.name,
|
title: nodeData.display_name || nodeData.name,
|
||||||
comfyClass: nodeData.name,
|
comfyClass: nodeData.name,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user