asagi4 / comfyui-prompt-control

ComfyUI nodes for prompt editing and LoRA control

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FR] Custom mask support

SRagy opened this issue · comments

commented

Describe what's missing
A way to use nonrectangular masks.

Additional context
I know it might seem slightly against the ethos of the extension, however, it would be convenient to be able to feed custom masks (e.g. hand drawn ones) into a node. Unless I'm missing something, the existing syntax limits to rectangular masks and specification is a touch clunky. If masks were taken as input, then they could be activated within the text [perhaps with a syntax like (MASK:mask1)]

This would provide a similar functionality to Automatic1111's regional prompter extension's custom masks option.

That's not a terrible idea. it should be pretty easy to implement a ScheduleToCondMasked node with that functionality.

I added an experimental implementation.

It's very lightly tested so I'm not documenting it yet, but please give it a try. Just use PCScheduleAddMasks to attach masks to the prompt schedule object and then in the prompt use IMASK(index, weight, combineop) to refer to them. (the defaults are 0, 1.0, multiply if not specified). The mask indexing starts from 0.

The node allows adding up to 4 masks in one go (they're all optional), but you can use it as many times as you need; it'll just extend the mask list.

commented

That was super fast, thanks! I will get back to you as soon as I've had a chance to test it, which will be some time in the next two days.