Skip to content

Commit

Permalink
two new text nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Suzie1 committed Jan 10, 2024
1 parent 0f453cd commit d5f4cca
Show file tree
Hide file tree
Showing 6 changed files with 1,029 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Patch_Notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# 🧩 Comfyroll Studio - Patch Notes

## v1.65 Jan 10, 2024
- added CR Text Length
- added CR Text Operation
- updated CR Text Concatenate, output is now any_type

## v1.64 Jan 9, 2024
- added CR Set Value on String

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ __🔤 Utils Text__
* CR Multiline Text (new 24/12/2023)
* CR Split String
* CR Text Concatenate (new 2/1/2024)
* CR Text Replace (new 8/1/2024)
* CR Text Replace (new 8/1/2024)
* CR Text Length (new 10/1/2024)
* CR Text Operation (new 10/1/2024)
* CR Save Text To File (new 27/12/2023)

__⚙️ Utils Other__
Expand Down
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@author: Suzie1
@title: Comfyroll Studio
@nickname: Comfyroll Studio
@description: 162 custom nodes for artists, designers and animators.
@description: 164 custom nodes for artists, designers and animators.
"""

from .live_node_mappings import LIVE_NODE_CLASS_MAPPINGS, LIVE_NODE_DISPLAY_NAME_MAPPINGS
Expand All @@ -36,7 +36,7 @@
NODE_DISPLAY_NAME_MAPPINGS = LIVE_NODE_DISPLAY_NAME_MAPPINGS

print("------------------------------------------")
print("\033[34mComfyroll Studio v1.64 : \033[92m 162 Nodes Loaded\033[0m")
print("\033[34mComfyroll Studio v1.65 : \033[92m 164 Nodes Loaded\033[0m")
print("------------------------------------------")
print("** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md")
print("** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki")
Expand Down
6 changes: 5 additions & 1 deletion live_node_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@
"CR Split String": CR_SplitString,
"CR Text Concatenate": CR_TextConcatenate,
"CR Text Replace": CR_TextReplace,
"CR Text Length": CR_TextLength,
"CR Text Operation": CR_TextOperation,
"CR Save Text To File": CR_SaveTextToFile,
### Utils Other
"CR Integer Multiple": CR_IntegerMultipleOf,
Expand Down Expand Up @@ -431,7 +433,9 @@
"CR Multiline Text": "🔤 CR Multiline Text",
"CR Split String": "🔤 CR Split String",
"CR Text Concatenate": "🔤 CR Text Concatenate",
"CR Text Replace": "🔤 CR Text Replace",
"CR Text Replace": "🔤 CR Text Replace",
"CR Text Length": "🔤 CR Text Length",
"CR Text Operation": "🔤 CR Text Operation",
"CR Save Text To File": "🔤 CR Save Text To File",
### Utils Other
"CR Integer Multiple": "⚙️ CR Integer Multiple",
Expand Down
78 changes: 74 additions & 4 deletions nodes/nodes_utils_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def INPUT_TYPES(cls):
}
}

RETURN_TYPES = ("STRING", "STRING", )
RETURN_TYPES = (any_type, "STRING", )
RETURN_NAMES = ("STRING", "show_help", )
FUNCTION = "concat_text"
CATEGORY = icons.get("Comfyroll/Utils/Text")
Expand Down Expand Up @@ -281,7 +281,75 @@ def replace_text(self, text, test_string, value_if_true, value_if_false):
text_out = value_if_false

return (text_out, show_help)


#---------------------------------------------------------------------------------------------------------------------#
class CR_TextOperation:

@ classmethod
def INPUT_TYPES(cls):

operations = ["uppercase", "lowercase", "capitalize", "invert_case", "reverse", "trim", "remove_spaces"]

return {
"required": {
"text": ("STRING", {"multiline": False, "default": "", "forceInput": True}),
"operation": (operations,),
},
}

RETURN_TYPES = (any_type, "STRING", )
RETURN_NAMES = ("STRING", "show_help", )
FUNCTION = "text_operation"
CATEGORY = icons.get("Comfyroll/Utils/Text")

def text_operation(self, text, operation):

show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/List-Nodes#cr-text_operation"

if operation == "uppercase":
text_out = text.upper()
elif operation == "lowercase":
text_out = text.lower()
elif operation == "capitalize":
text_out = text.capitalize()
elif operation == "invert_case":
text_out = text.swapcase()
elif operation == "reverse":
text_out = text[::-1]
elif operation == "trim":
text_out = text.strip()
elif operation == "remove_spaces":
text_out = text.replace(" ", "")
else:
return "CR Text Operation: Invalid operation."

return (text_out, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
class CR_TextLength:

@ classmethod
def INPUT_TYPES(cls):

return {
"required": {
"text": ("STRING", {"multiline": False, "default": "", "forceInput": True}),
},
}

RETURN_TYPES = ("INT", "STRING", )
RETURN_NAMES = ("INT", "show_help", )
FUNCTION = "len_text"
CATEGORY = icons.get("Comfyroll/Utils/Text")

def len_text(self, text):

show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/List-Nodes#cr-text-length"

int_out = len(text)

return (int_out, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
# MAPPINGS
#---------------------------------------------------------------------------------------------------------------------#
Expand All @@ -294,8 +362,10 @@ def replace_text(self, text, test_string, value_if_true, value_if_false):
"CR Split String": CR_SplitString,
"CR Text Concatenate": CR_TextConcatenate,
"CR Text Replace": CR_TextReplace,
"CR Save Text To File": CR_SaveTextToFile,
"CR Set Value on String": CR_SetValueOnString,
"CR Text Length": CR_TextLength,
"CR Text Operation": CR_TextOperation,
"CR Set Value on String": CR_SetValueOnString,
"CR Save Text To File": CR_SaveTextToFile,
}
'''

Loading

0 comments on commit d5f4cca

Please sign in to comment.