Add files via upload
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
import importlib
|
||||
import os
|
||||
|
||||
node_list = [ #Add list of .py files containing nodes here
|
||||
"jru_int2string",
|
||||
"jru_concatstringwithdelimiter",
|
||||
"jru_int2floatmultiply",
|
||||
"jru_imagesizer",
|
||||
"jru_float2string",
|
||||
"jru_concatstring",
|
||||
"jru_float2int",
|
||||
"jru_string2int",
|
||||
"jru_int2string"
|
||||
|
||||
]
|
||||
|
||||
NODE_CLASS_MAPPINGS = {}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {}
|
||||
|
||||
for module_name in node_list:
|
||||
imported_module = importlib.import_module(".{}".format(module_name), __name__)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS, **imported_module.NODE_CLASS_MAPPINGS}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {**NODE_DISPLAY_NAME_MAPPINGS, **imported_module.NODE_DISPLAY_NAME_MAPPINGS}
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
@@ -0,0 +1,35 @@
|
||||
class ConcatString_jru:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string_a": ("STRING", {"forceInput":True,"default":"","multiline": True}),
|
||||
"string_b": ("STRING", {"forceInput":True,"default":"","multiline": True}),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("STRING", )
|
||||
FUNCTION = "concat"
|
||||
|
||||
CATEGORY = "JaRue"
|
||||
|
||||
def concat(self, string_a, string_b):
|
||||
c = string_a + string_b
|
||||
return (c,)
|
||||
|
||||
|
||||
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"ConcatString_jru": ConcatString_jru
|
||||
}
|
||||
|
||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"ConcatString_jru": "Concat String"
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
class ConcatStringWithDelimiter_jru:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string_a": ("STRING", {"forceInput":True,"default":"","multiline": False}),
|
||||
"string_b": ("STRING", {"forceInput":True,"default":"","multiline": False}),
|
||||
"string_c": ("STRING", {"forceInput":True,"default":"_","multiline": False}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RETURN_TYPES = ("STRING", )
|
||||
FUNCTION = "concat"
|
||||
|
||||
CATEGORY = "JaRue"
|
||||
|
||||
def concat(self, string_a, string_b, string_c):
|
||||
c = string_a + string_c + string_b
|
||||
return (c,)
|
||||
|
||||
|
||||
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"ConcatStringWithDelimiter_jru": ConcatStringWithDelimiter_jru
|
||||
}
|
||||
|
||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"ConcatStringWithDelimiter_jru": "Concat Strings w/ Delimiter"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
class Float2Int_jru:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"float_a": ("FLOAT", {"forceInput":True,"default":1,"min": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RETURN_TYPES = ("INT", )
|
||||
FUNCTION = "fFloat2Int"
|
||||
|
||||
CATEGORY = "JaRue"
|
||||
|
||||
def fFloat2Int(self, float_a):
|
||||
c = int(float_a)
|
||||
return (c,)
|
||||
|
||||
|
||||
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Float2Int_jru": Float2Int_jru
|
||||
}
|
||||
|
||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"Float2Int_jru": "Convert Float to Integer"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
class Float2String_jru:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"float_a": ("FLOAT", {"forceInput":True,"default":1,"min": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RETURN_TYPES = ("STRING", )
|
||||
FUNCTION = "fFloat2String"
|
||||
|
||||
CATEGORY = "JaRue"
|
||||
|
||||
def fFloat2String(self, float_a):
|
||||
c = str(float_a)
|
||||
return (c,)
|
||||
|
||||
|
||||
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Float2String_jru": Float2String_jru
|
||||
}
|
||||
|
||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"Float2String_jru": "Convert Float to String"
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import math
|
||||
|
||||
class ImageSizer_jru:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"model_type": (["SD","SDXL"],),
|
||||
"aspect_ratio_width": ("INT",{
|
||||
"default": 1,
|
||||
"step":1,
|
||||
"display": "number"
|
||||
}),
|
||||
"aspect_ratio_height": ("INT",{
|
||||
"default": 1,
|
||||
"step":1,
|
||||
"display": "number"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT","INT")
|
||||
RETURN_NAMES = ("Width", "Height")
|
||||
|
||||
FUNCTION = "run"
|
||||
|
||||
CATEGORY = "JaRue"
|
||||
|
||||
def run(self, model_type, aspect_ratio_width, aspect_ratio_height):
|
||||
# Define the total pixel counts for SD and SDXL
|
||||
total_pixels = {
|
||||
'SD': 512 * 512,
|
||||
'SDXL': 1024 * 1024
|
||||
}
|
||||
|
||||
# Calculate the number of total pixels based on model type
|
||||
pixels = total_pixels.get(model_type, 0)
|
||||
|
||||
# Calculate the aspect ratio decimal
|
||||
aspect_ratio_decimal = aspect_ratio_width / aspect_ratio_height
|
||||
|
||||
# Calculate width and height
|
||||
width = math.sqrt(pixels * aspect_ratio_decimal)
|
||||
height = pixels / width
|
||||
|
||||
# Return the width and height as a tuple of integers
|
||||
return (int(round(width)), int(round(height)))
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"ImageSizer_jru": ImageSizer_jru
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"ImageSizer_jru": "Image Sizer"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
class Int2FloatMultiply_jru:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"int_a": ("INT", {"forceInput":True,"default":0,"min": 0}),
|
||||
"float_b": ("FLOAT", {"forceInput":True,"default":1.0}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RETURN_TYPES = ("FLOAT", )
|
||||
FUNCTION = "int2floatmlt"
|
||||
|
||||
CATEGORY = "JaRue"
|
||||
|
||||
def int2floatmlt(self, int_a, float_b):
|
||||
c = int_a * float_b
|
||||
return (c,)
|
||||
|
||||
|
||||
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Int2FloatMultiply_jru": Int2FloatMultiply_jru
|
||||
}
|
||||
|
||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"Int2FloatMultiply_jru": "Convert Integer to Float w/ multiply"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
class Int2String_jru:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"int_a": ("INT", {"forceInput":True,"default":0,"min": 0}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RETURN_TYPES = ("STRING", )
|
||||
FUNCTION = "concat"
|
||||
|
||||
CATEGORY = "JaRue"
|
||||
|
||||
def concat(self, int_a):
|
||||
c = str(int_a)
|
||||
return (c,)
|
||||
|
||||
|
||||
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Int2String_jru": Int2String_jru
|
||||
}
|
||||
|
||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"Int2String_jru": "Convert Integer to String"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
class String2Int_jru:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string_a": ("STRING", {"forceInput":True,"default":"","multiline": False}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RETURN_TYPES = ("INT", )
|
||||
FUNCTION = "concat"
|
||||
|
||||
CATEGORY = "JaRue"
|
||||
|
||||
def concat(self, string_a):
|
||||
c = int(string_a)
|
||||
return (c,)
|
||||
|
||||
|
||||
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"String2Int_jru": String2Int_jru
|
||||
}
|
||||
|
||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"String2Int_jru": "Convert String to Integer"
|
||||
}
|
||||
Reference in New Issue
Block a user