From 53f46c91a24081bd7b8903c9c80efa6c109a0615 Mon Sep 17 00:00:00 2001 From: Joel Clark Date: Sat, 2 Sep 2023 21:30:01 +1000 Subject: [PATCH] feat: Allow support for custom wildcard directory in sd-dynamic-prompts --- scripts/shared_paths.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/shared_paths.py b/scripts/shared_paths.py index a3d51a5..f2e32cd 100644 --- a/scripts/shared_paths.py +++ b/scripts/shared_paths.py @@ -33,10 +33,20 @@ try: except AttributeError: LYCO_PATH = None - def find_ext_wildcard_paths(): """Returns the path to the extension wildcards folder""" found = list(EXT_PATH.glob("*/wildcards/")) + # Try to find the wildcard path from the shared opts + try: + from modules.shared import opts + except ImportError: # likely not in an a1111 context + opts = None + + wildcard_dir = getattr(opts, "wildcard_dir", None) + if wildcard_dir is not None: + wildcard_dir = Path(wildcard_dir) + if wildcard_dir.exists(): + found.append(wildcard_dir) return found