Removed(commented) "Tuples" nodes; Removed "TUPLES" type from "Get size" nodes; (DON'T FORGET TO REPLACE THEM IF THEY'RE PERSISTS IN YOUR WORKFLOW) Types moved into their own class with class methods and default parameters instead of just tuples with strings and dicts; Added "Logic node" (>, <, =, AND, OR, XOR); (idk why i did this one, but got an idea that with object recognition models to count objects and correct them in next iterations would be not so bad idea as i think. Or something like this) changed README.md to current state of this repo
88 lines
2.2 KiB
Python
88 lines
2.2 KiB
Python
from custom_nodes.Derfuu_ComfyUI_ModdedNodes.pyscripts.components.fields import Field
|
|
from custom_nodes.Derfuu_ComfyUI_ModdedNodes.pyscripts.components.tree import TREE_TRIGONOMETRY
|
|
|
|
import math
|
|
|
|
class SinNode:
|
|
def __init__(self):
|
|
pass
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(self):
|
|
return {
|
|
"required": {
|
|
"value": Field.float(),
|
|
"type_": Field.combo(["RAD", "DEG"]),
|
|
"arcSin": Field.combo([False, True])
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("FLOAT",)
|
|
FUNCTION = "get_value"
|
|
CATEGORY = TREE_TRIGONOMETRY
|
|
|
|
def get_value(self, value, type_="RAD", arcSin=False):
|
|
if type_ == "DEG":
|
|
value = math.radians(value)
|
|
if arcSin == True:
|
|
value = math.asin(value)
|
|
else:
|
|
value = math.sin(value)
|
|
return (value,)
|
|
|
|
|
|
class CosNode:
|
|
def __init__(self):
|
|
pass
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(self):
|
|
return {
|
|
"required": {
|
|
"value": Field.float(),
|
|
"type_": Field.combo(["RAD", "DEG"],),
|
|
"arcCos": Field.combo([False, True],)
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("FLOAT",)
|
|
FUNCTION = "get_value"
|
|
CATEGORY = TREE_TRIGONOMETRY
|
|
|
|
def get_value(self, value, type_="RAD", arcCos=False):
|
|
if type_ == "DEG":
|
|
value = math.radians(value)
|
|
if arcCos == True:
|
|
value = math.acos(value)
|
|
else:
|
|
value = math.cos(value)
|
|
return (value,)
|
|
|
|
|
|
class tgNode:
|
|
def __init__(self):
|
|
pass
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(self):
|
|
return {
|
|
"required": {
|
|
"value": Field.float(),
|
|
"type_": Field.combo(["RAD", "DEG"],),
|
|
"arcTan": Field.combo([False, True],)
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("FLOAT",)
|
|
FUNCTION = "get_value"
|
|
CATEGORY = TREE_TRIGONOMETRY
|
|
|
|
def get_value(self, value, type_="RAD", arcTan=False):
|
|
if type_ == "DEG":
|
|
value = math.radians(value)
|
|
if arcTan == True:
|
|
value = math.atan(value)
|
|
else:
|
|
value = math.tan(value)
|
|
return (value,)
|