2024-07-22 11:27:32 -04:00
|
|
|
from comfy.cldm.control_types import UNION_CONTROLNET_TYPES
|
2024-09-14 09:05:16 -04:00
|
|
|
import nodes
|
|
|
|
|
import comfy.utils
|
2025-10-18 00:13:05 +03:00
|
|
|
from typing_extensions import override
|
|
|
|
|
from comfy_api.latest import ComfyExtension, io
|
2024-07-16 17:01:40 -04:00
|
|
|
|
2025-10-18 00:13:05 +03:00
|
|
|
class SetUnionControlNetType(io.ComfyNode):
|
2024-07-16 17:01:40 -04:00
|
|
|
@classmethod
|
2025-10-18 00:13:05 +03:00
|
|
|
def define_schema(cls):
|
|
|
|
|
return io.Schema(
|
|
|
|
|
node_id="SetUnionControlNetType",
|
2026-06-17 08:33:09 +08:00
|
|
|
search_aliases=["set controlnet type", "union controlnet type"],
|
|
|
|
|
display_name="Set Union ControlNet Type",
|
2026-05-27 17:43:33 -07:00
|
|
|
category="model/conditioning/controlnet",
|
2025-10-18 00:13:05 +03:00
|
|
|
inputs=[
|
|
|
|
|
io.ControlNet.Input("control_net"),
|
|
|
|
|
io.Combo.Input("type", options=["auto"] + list(UNION_CONTROLNET_TYPES.keys())),
|
|
|
|
|
],
|
|
|
|
|
outputs=[
|
|
|
|
|
io.ControlNet.Output(),
|
|
|
|
|
],
|
|
|
|
|
)
|
2024-07-16 17:01:40 -04:00
|
|
|
|
2025-10-18 00:13:05 +03:00
|
|
|
@classmethod
|
|
|
|
|
def execute(cls, control_net, type) -> io.NodeOutput:
|
2024-07-16 17:01:40 -04:00
|
|
|
control_net = control_net.copy()
|
2024-07-22 11:30:38 -04:00
|
|
|
type_number = UNION_CONTROLNET_TYPES.get(type, -1)
|
2024-07-16 17:01:40 -04:00
|
|
|
if type_number >= 0:
|
|
|
|
|
control_net.set_extra_arg("control_type", [type_number])
|
|
|
|
|
else:
|
|
|
|
|
control_net.set_extra_arg("control_type", [])
|
|
|
|
|
|
2025-10-18 00:13:05 +03:00
|
|
|
return io.NodeOutput(control_net)
|
|
|
|
|
|
|
|
|
|
set_controlnet_type = execute # TODO: remove
|
|
|
|
|
|
2024-07-16 17:01:40 -04:00
|
|
|
|
2025-10-18 00:13:05 +03:00
|
|
|
class ControlNetInpaintingAliMamaApply(io.ComfyNode):
|
2024-09-14 09:05:16 -04:00
|
|
|
@classmethod
|
2025-10-18 00:13:05 +03:00
|
|
|
def define_schema(cls):
|
|
|
|
|
return io.Schema(
|
|
|
|
|
node_id="ControlNetInpaintingAliMamaApply",
|
add search aliases to all nodes (#12035)
* feat: Add search_aliases field to node schema
Adds `search_aliases` field to improve node discoverability. Users can define alternative search terms for nodes (e.g., "text concat" → StringConcatenate).
Changes:
- Add `search_aliases: list[str]` to V3 Schema
- Add `SEARCH_ALIASES` support for V1 nodes
- Include field in `/object_info` response
- Add aliases to high-priority core nodes
V1 usage:
```python
class MyNode:
SEARCH_ALIASES = ["alt name", "synonym"]
```
V3 usage:
```python
io.Schema(
node_id="MyNode",
search_aliases=["alt name", "synonym"],
...
)
```
## Related PRs
- Frontend: Comfy-Org/ComfyUI_frontend#XXXX (draft - merge after this)
- Docs: Comfy-Org/docs#XXXX (draft - merge after stable)
* Propagate search_aliases through V3 Schema.get_v1_info to NodeInfoV1
* feat: add SEARCH_ALIASES for core nodes (#12016)
Add search aliases to 22 core nodes in nodes.py to improve node discoverability:
- Checkpoint/model loaders: CheckpointLoader, DiffusersLoader
- Conditioning nodes: ConditioningAverage, ConditioningSetArea, ConditioningSetMask, ConditioningZeroOut
- Style nodes: StyleModelApply
- Image nodes: LoadImageMask, LoadImageOutput, ImageBatch, ImageInvert, ImagePadForOutpaint
- Latent nodes: LoadLatent, SaveLatent, LatentBlend, LatentComposite, LatentCrop, LatentFlip, LatentFromBatch, LatentUpscale, LatentUpscaleBy, RepeatLatentBatch
* feat: add SEARCH_ALIASES for image, mask, and string nodes (#12017)
Add search aliases to nodes in comfy_extras for better discoverability:
- nodes_mask.py: mask manipulation nodes
- nodes_images.py: image processing nodes
- nodes_post_processing.py: post-processing effect nodes
- nodes_string.py: string manipulation nodes
- nodes_compositing.py: compositing nodes
- nodes_morphology.py: morphological operation nodes
- nodes_latent.py: latent space nodes
Uses search_aliases parameter in io.Schema() for v3 nodes.
* feat: add SEARCH_ALIASES for audio and video nodes (#12018)
Add search aliases to audio and video nodes for better discoverability:
- nodes_audio.py: audio loading, saving, and processing nodes
- nodes_video.py: video loading and processing nodes
- nodes_wan.py: WAN model nodes
Uses search_aliases parameter in io.Schema() for v3 nodes.
* feat: add SEARCH_ALIASES for model and misc nodes (#12019)
Add search aliases to model-related and miscellaneous nodes:
- Model nodes: nodes_model_merging.py, nodes_model_advanced.py, nodes_lora_extract.py
- Sampler nodes: nodes_custom_sampler.py, nodes_align_your_steps.py
- Control nodes: nodes_controlnet.py, nodes_attention_multiply.py, nodes_hooks.py
- Training nodes: nodes_train.py, nodes_dataset.py
- Utility nodes: nodes_logic.py, nodes_canny.py, nodes_differential_diffusion.py
- Architecture-specific: nodes_sd3.py, nodes_pixart.py, nodes_lumina2.py, nodes_kandinsky5.py, nodes_hidream.py, nodes_fresca.py, nodes_hunyuan3d.py
- Media nodes: nodes_load_3d.py, nodes_webcam.py, nodes_preview_any.py, nodes_wanmove.py
Uses search_aliases parameter in io.Schema() for v3 nodes, SEARCH_ALIASES class attribute for legacy nodes.
2026-01-22 18:36:58 -08:00
|
|
|
search_aliases=["masked controlnet"],
|
2026-06-17 08:33:09 +08:00
|
|
|
display_name="Apply ControlNet Inpainting (AliMama)",
|
2026-05-27 17:43:33 -07:00
|
|
|
category="model/conditioning/controlnet",
|
2025-10-18 00:13:05 +03:00
|
|
|
inputs=[
|
|
|
|
|
io.Conditioning.Input("positive"),
|
|
|
|
|
io.Conditioning.Input("negative"),
|
|
|
|
|
io.ControlNet.Input("control_net"),
|
|
|
|
|
io.Vae.Input("vae"),
|
|
|
|
|
io.Image.Input("image"),
|
|
|
|
|
io.Mask.Input("mask"),
|
|
|
|
|
io.Float.Input("strength", default=1.0, min=0.0, max=10.0, step=0.01),
|
feat: mark 429 widgets as advanced for collapsible UI (#12197)
* feat: mark 429 widgets as advanced for collapsible UI
Mark widgets as advanced across core, comfy_extras, and comfy_api_nodes
to support the new collapsible advanced inputs section in the frontend.
Changes:
- 267 advanced markers in comfy_extras/
- 162 advanced markers in comfy_api_nodes/
- All files pass python3 -m py_compile verification
Widgets marked advanced (hidden by default):
- Scheduler internals: sigma_max, sigma_min, rho, mu, beta, alpha
- Sampler internals: eta, s_noise, order, rtol, atol, h_init, pcoeff, etc.
- Memory optimization: tile_size, overlap, temporal_size, temporal_overlap
- Pipeline controls: add_noise, start_at_step, end_at_step
- Timing controls: start_percent, end_percent
- Layer selection: stop_at_clip_layer, layers, block_number
- Video encoding: codec, crf, format
- Device/dtype: device, noise_device, dtype, weight_dtype
Widgets kept basic (always visible):
- Core params: strength, steps, cfg, denoise, seed, width, height
- Model selectors: ckpt_name, lora_name, vae_name, sampler_name
- Common controls: upscale_method, crop, batch_size, fps, opacity
Related: frontend PR #11939
Amp-Thread-ID: https://ampcode.com/threads/T-019c1734-6b61-702e-b333-f02c399963fc
* fix: remove advanced=True from DynamicCombo.Input (unsupported)
Amp-Thread-ID: https://ampcode.com/threads/T-019c1734-6b61-702e-b333-f02c399963fc
* fix: address review - un-mark model merge, video, image, and training node widgets as advanced
Per comfyanonymous review:
- Model merge arguments should not be advanced (all 14 model-specific merge classes)
- SaveAnimatedWEBP lossless/quality/method should not be advanced
- SaveWEBM/SaveVideo codec/crf/format should not be advanced
- TrainLoraNode options should not be advanced (7 inputs)
Amp-Thread-ID: https://ampcode.com/threads/T-019c322b-a3a8-71b7-9962-d44573ca6352
* fix: un-mark batch_size and webcam width/height as advanced (should stay basic)
Amp-Thread-ID: https://ampcode.com/threads/T-019c3236-1417-74aa-82a3-bcb365fbe9d1
---------
Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com>
2026-02-19 19:20:02 -08:00
|
|
|
io.Float.Input("start_percent", default=0.0, min=0.0, max=1.0, step=0.001, advanced=True),
|
|
|
|
|
io.Float.Input("end_percent", default=1.0, min=0.0, max=1.0, step=0.001, advanced=True),
|
2025-10-18 00:13:05 +03:00
|
|
|
],
|
|
|
|
|
outputs=[
|
|
|
|
|
io.Conditioning.Output(display_name="positive"),
|
|
|
|
|
io.Conditioning.Output(display_name="negative"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def execute(cls, positive, negative, control_net, vae, image, mask, strength, start_percent, end_percent) -> io.NodeOutput:
|
2024-09-14 09:17:13 -04:00
|
|
|
extra_concat = []
|
|
|
|
|
if control_net.concat_mask:
|
|
|
|
|
mask = 1.0 - mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1]))
|
|
|
|
|
mask_apply = comfy.utils.common_upscale(mask, image.shape[2], image.shape[1], "bilinear", "center").round()
|
|
|
|
|
image = image * mask_apply.movedim(1, -1).repeat(1, 1, 1, image.shape[3])
|
|
|
|
|
extra_concat = [mask]
|
|
|
|
|
|
2025-10-18 00:13:05 +03:00
|
|
|
result = nodes.ControlNetApplyAdvanced().apply_controlnet(positive, negative, control_net, image, strength, start_percent, end_percent, vae=vae, extra_concat=extra_concat)
|
|
|
|
|
return io.NodeOutput(result[0], result[1])
|
|
|
|
|
|
|
|
|
|
apply_inpaint_controlnet = execute # TODO: remove
|
|
|
|
|
|
2024-09-14 09:05:16 -04:00
|
|
|
|
2025-10-18 00:13:05 +03:00
|
|
|
class ControlNetExtension(ComfyExtension):
|
|
|
|
|
@override
|
|
|
|
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
|
|
|
|
return [
|
|
|
|
|
SetUnionControlNetType,
|
|
|
|
|
ControlNetInpaintingAliMamaApply,
|
|
|
|
|
]
|
2024-09-14 09:05:16 -04:00
|
|
|
|
|
|
|
|
|
2025-10-18 00:13:05 +03:00
|
|
|
async def comfy_entrypoint() -> ControlNetExtension:
|
|
|
|
|
return ControlNetExtension()
|