@@ -5098,6 +5098,28 @@ def get_subdirectories(self, directory):
50985098 raise Exception (f'{ directory } is not a valid directory' )
50995099 return (subdirectories ,)
51005100
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+
51015123NODE_CLASS_MAPPINGS = {
51025124 'Wildcard Processor' : WildcardProcessor ,
51035125 'Empty Latent Ratio Select SDXL' : EmptyLatentRatioSelector ,
@@ -5164,7 +5186,8 @@ def get_subdirectories(self, directory):
51645186 'ImageOverlay' : ImageOverlay ,
51655187 'CinematicLook' : CinematicLook ,
51665188 'MosaicExpandImage' : MosaicExpandImage ,
5167- 'GetSubdirectories' : GetSubdirectories
5189+ 'GetSubdirectories' : GetSubdirectories ,
5190+ 'TextPadderMikey' : TextPadderMikey
51685191}
51695192
51705193NODE_DISPLAY_NAME_MAPPINGS = {
@@ -5233,5 +5256,6 @@ def get_subdirectories(self, directory):
52335256 'ImageOverlay' : 'Image Overlay (Mikey)' ,
52345257 'CinematicLook' : 'Cinematic Look (Mikey)' ,
52355258 'MosaicExpandImage' : 'Mosaic Expand Image (Mikey)' ,
5236- 'GetSubdirectories' : 'Get Subdirectories (Mikey)'
5259+ 'GetSubdirectories' : 'Get Subdirectories (Mikey)' ,
5260+ 'TextPadderMikey' : 'Text Padder (Mikey)'
52375261}
0 commit comments