adieyal / dynamicprompts

Templating language for generating prompts for text to image generators such as Stable Diffusion
MIT License
124 stars 20 forks source link

If a wildcard is set to 0 disable another wildcard? #76

Open DivanoDova opened 1 year ago

DivanoDova commented 1 year ago

Is there a way to disable another wildcard if the another one is set to 0

For Example if have this prompt: {0-2$$__mywildcard/chairs__} {0-2$$__mywildcard/colors__}, And i want to avoid using __mywildcard/colors__ if theres is no __mywildcard/chairs__

So what i need is a way to put 0 to __mywildcard/colors__ if __mywildcard/chairs__ is put to 0

Thanks

akx commented 1 year ago

It's not exactly the same, but

{0-2$$__mywildcard/chairs__ __mywildcard/colors__}

would give you 0 to 2 repetitions of chair + color – would that work?

DivanoDova commented 1 year ago

It's not exactly the same, but


{0-2$$__mywildcard/chairs__ __mywildcard/colors__}

would give you 0 to 2 repetitions of chair + color – would that work?

I just tried to do this but it seems to always return one chair and one colors never 0 or 2

adieyal commented 1 year ago

The reason why that doesn't work is because the variant wildcard syntax only works for wildcards, not other tokens, i.e. {0-2$$_mywildcard/chairs__} works but {0-2$$_mywildcard/chairs__ anything_else_here} won't

I don't think we have a solution for this yet.