Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using separator, wildcards and multi-selection in ImpactWildcardProcessor only selected a single result from wildcard #873

Open
polystruct opened this issue Jan 2, 2025 · 0 comments

Comments

@polystruct
Copy link

When using the ImpactWildcardProcessor node, using custom wildcards, I tried to use a multi-selection like so:

a person wearing {3$$, $$__jewelry__}, in __place__

The intention is that this would transform into something like the following:

a person wearing a ring, necklace, anklet, in the Statue of Liberty

However, it only selected a single wildcard:

a person wearing a ring, in the Statue of Liberty

I was able to fix this by editing modules/impact/wildcards.py as follows:

--- wildcards.py.orig	2025-01-02 20:27:48.766142076 +0100
+++ wildcards.py	2025-01-02 20:30:38.170029305 +0100
@@ -157,7 +157,13 @@
                     elif select_range is not None and len(multi_select_pattern) == 3:
                         # PATTERN: count$$ sep $$
                         select_sep = multi_select_pattern[1]
-                        options[0] = multi_select_pattern[2]
+                        matches = re.findall(wildcard_pattern, multi_select_pattern[2])
+                        if len(options) == 1 and matches:
+                            # count$$ sep $$<single wildcard>
+                            options = get_wildcard_options(multi_select_pattern[2])
+                        else:
+                            # count$$ sep $$opt1|opt2|...
+                            options[0] = multi_select_pattern[2]
 
             adjusted_probabilities = []
 

This is based on the code slightly above, which allows for a multi-selection using separator and regular (non-wildcard) options, just using multi_select_pattern[2] instead of multi_select_pattern[1].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant