mirror of
https://github.com/justUmen/Bjornulf_custom_nodes.git
synced 2026-03-21 20:52:11 -03:00
0.76
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
class CombineTexts:
|
||||
SPECIAL_PREFIX = "ImSpEcIaL" # The special text (password) to look for
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
@@ -25,11 +27,22 @@ class CombineTexts:
|
||||
else:
|
||||
return str(item)
|
||||
|
||||
combined_text = self.get_delimiter(delimiter).join([
|
||||
flatten(kwargs[f"text_{i}"])
|
||||
# Check each input for the special prefix
|
||||
for i in range(1, number_of_inputs + 1):
|
||||
text_key = f"text_{i}"
|
||||
if text_key in kwargs:
|
||||
text = flatten(kwargs[text_key])
|
||||
if text.startswith(self.SPECIAL_PREFIX):
|
||||
# Output only the text after the prefix, stripping leading whitespace
|
||||
return (text[len(self.SPECIAL_PREFIX):].lstrip(),)
|
||||
|
||||
# If no prefix is found, combine all non-empty inputs as usual
|
||||
text_entries = [
|
||||
flatten(kwargs.get(f"text_{i}", ""))
|
||||
for i in range(1, number_of_inputs + 1)
|
||||
if f"text_{i}" in kwargs
|
||||
])
|
||||
if f"text_{i}" in kwargs and flatten(kwargs.get(f"text_{i}", "")).strip() != ""
|
||||
]
|
||||
combined_text = self.get_delimiter(delimiter).join(text_entries)
|
||||
return (combined_text,)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user