@@ -5098,6 +5098,28 @@ def get_subdirectories(self, directory):
5098
5098
raise Exception (f'{ directory } is not a valid directory' )
5099
5099
return (subdirectories ,)
5100
5100
5101
+ class TextPadderMikey :
5102
+ # Pad text to a fixed length with a specified padding character
5103
+ @classmethod
5104
+ def INPUT_TYPES (cls ):
5105
+ return {'required' : {'text' : ('STRING' , {'default' : 'text to pad' }),
5106
+ 'length' : ('INT' , {'default' : 512 , 'min' : 1 , 'max' : 1000 }),
5107
+ 'technique' : (['pad' ,'repeat' ], {'default' : 'pad' }),
5108
+ 'padding_character' : ('STRING' , {'default' : ',' })}}
5109
+
5110
+ RETURN_TYPES = ('STRING' ,)
5111
+ RETURN_NAMES = ('padded_text' ,)
5112
+ FUNCTION = 'pad_text'
5113
+ CATEGORY = 'Mikey/Text'
5114
+
5115
+ def pad_text (self , text , length , technique , padding_character ):
5116
+ if technique == 'pad' :
5117
+ padded_text = text .ljust (length , padding_character )
5118
+ elif technique == 'repeat' :
5119
+ # repeat but don't cut off the text
5120
+ padded_text = text * (length // len (text ))
5121
+ return (padded_text ,)
5122
+
5101
5123
NODE_CLASS_MAPPINGS = {
5102
5124
'Wildcard Processor' : WildcardProcessor ,
5103
5125
'Empty Latent Ratio Select SDXL' : EmptyLatentRatioSelector ,
@@ -5164,7 +5186,8 @@ def get_subdirectories(self, directory):
5164
5186
'ImageOverlay' : ImageOverlay ,
5165
5187
'CinematicLook' : CinematicLook ,
5166
5188
'MosaicExpandImage' : MosaicExpandImage ,
5167
- 'GetSubdirectories' : GetSubdirectories
5189
+ 'GetSubdirectories' : GetSubdirectories ,
5190
+ 'TextPadderMikey' : TextPadderMikey
5168
5191
}
5169
5192
5170
5193
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -5233,5 +5256,6 @@ def get_subdirectories(self, directory):
5233
5256
'ImageOverlay' : 'Image Overlay (Mikey)' ,
5234
5257
'CinematicLook' : 'Cinematic Look (Mikey)' ,
5235
5258
'MosaicExpandImage' : 'Mosaic Expand Image (Mikey)' ,
5236
- 'GetSubdirectories' : 'Get Subdirectories (Mikey)'
5259
+ 'GetSubdirectories' : 'Get Subdirectories (Mikey)' ,
5260
+ 'TextPadderMikey' : 'Text Padder (Mikey)'
5237
5261
}
0 commit comments