diff --git a/__init__.py b/__init__.py index 44985ba..8876987 100644 --- a/__init__.py +++ b/__init__.py @@ -35,6 +35,7 @@ NODE_CLASS_MAPPINGS = { _n("Integer"): TypeNodes.IntegerNode, _n("Text"): TypeNodes.StringNode, _n("Text_Box"): TypeNodes.MultilineStringNode, + _n("DynamicPrompts_Text_Box"): TypeNodes.AsDynamicPromptsStringNode, _n("String_Concatenate"): StringNodes.StringConcat, _n("String_Replace"): StringNodes.StringReplace, _n("To_text_(Debug)"): DebugNodes.ShowDataDebug, diff --git a/pyscripts/Nodes/Custom/Types.py b/pyscripts/Nodes/Custom/Types.py index ed9d438..98296ed 100644 --- a/pyscripts/Nodes/Custom/Types.py +++ b/pyscripts/Nodes/Custom/Types.py @@ -38,7 +38,7 @@ class IntegerNode: CATEGORY = TREE_VARIABLE FUNCTION = "get_value" - def get_value(self, Value): + def get_value(self, Value: float): return (int(Value),) @@ -58,7 +58,7 @@ class StringNode: FUNCTION = "get_value" CATEGORY = TREE_VARIABLE - def get_value(self, Text): + def get_value(self, Text: str) -> tuple[str]: return (Text,) @@ -78,5 +78,25 @@ class MultilineStringNode: FUNCTION = "get_value" CATEGORY = TREE_VARIABLE - def get_value(self, Text): + def get_value(self, Text: str) -> tuple[str]: + return (Text,) + +class AsDynamicPromptsStringNode: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "Text": Field.string(multiline=True, dynamicPrompts=True), + }, + } + + + RETURN_TYPES = ("STRING",) + FUNCTION = "get_value" + CATEGORY = TREE_VARIABLE + + def get_value(self, Text: str) -> tuple[str]: return (Text,) diff --git a/pyscripts/components/fields.py b/pyscripts/components/fields.py index 432efab..a735291 100644 --- a/pyscripts/components/fields.py +++ b/pyscripts/components/fields.py @@ -17,11 +17,11 @@ class Field: return (field,) @staticmethod - def bool( + def boolean( default: float = False, force: bool = False ) -> tuple[str, dict]: field_data = {"default": default, "force": force} - return Field.field("BOOL", field_data) + return Field.field("BOOLEAN", field_data) @staticmethod def float( @@ -40,9 +40,12 @@ class Field: @staticmethod def string( - default: str = '', multiline: bool = False, force: bool = False + default: str = '', + multiline: bool = False, + force: bool = False, + dynamicPrompts: bool = False ) -> tuple[str, dict]: - field_data = {"default": default, 'multiline': multiline, "forceInput": force} + field_data = {"default": default, 'multiline': multiline, "forceInput": force, "dynamicPrompts": dynamicPrompts} return Field.field("STRING", field_data) @staticmethod