New Nodes | BoolInt | EnableDisable | SwapInputs
This commit is contained in:
+12
-1
@@ -40,6 +40,10 @@ from .classes.JDCN_BatchCounter import N_CLASS_MAPPINGS as BatchCounterMappings,
|
||||
from .classes.JDCN_BatchCounterAdvance import N_CLASS_MAPPINGS as BatchCounterAdvanceMappings, N_DISPLAY_NAME_MAPPINGS as BatchCounterAdvanceNameMappings
|
||||
from .classes.JDCN_AnyCheckpointLoader import N_CLASS_MAPPINGS as AnyCheckpointLoaderMappings, N_DISPLAY_NAME_MAPPINGS as AnyCheckpointLoaderNameMappings
|
||||
from .classes.JDCN_StringManipulator import N_CLASS_MAPPINGS as StringManipulatorMappings, N_DISPLAY_NAME_MAPPINGS as StringManipulatorNameMappings
|
||||
from .classes.JDCN_SwapInputs import N_CLASS_MAPPINGS as SwapInputsMappings, N_DISPLAY_NAME_MAPPINGS as SwapInputsNameMappings
|
||||
from .classes.JDCN_BoolInt import N_CLASS_MAPPINGS as BoolIntMappings, N_DISPLAY_NAME_MAPPINGS as BoolIntNameMappings
|
||||
from .classes.JDCN_EnableDisable import N_CLASS_MAPPINGS as EnableDisableMappings, N_DISPLAY_NAME_MAPPINGS as EnableDisableNameMappings
|
||||
# from .classes.JDCN_ShowAny import N_CLASS_MAPPINGS as ShowAnyMappings, N_DISPLAY_NAME_MAPPINGS as ShowAnyNameMappings
|
||||
|
||||
from .LogicUtil.logic_gates import CLASS_MAPPINGS as LogicMapping, CLASS_NAMES as LogicNames
|
||||
from .LogicUtil.randomness import CLASS_MAPPINGS as RandomMapping, CLASS_NAMES as RandomNames
|
||||
@@ -70,7 +74,10 @@ NODE_CLASS_MAPPINGS.update(TXTFileSaverMappings)
|
||||
NODE_CLASS_MAPPINGS.update(BatchCounterMappings)
|
||||
NODE_CLASS_MAPPINGS.update(BatchCounterAdvanceMappings)
|
||||
NODE_CLASS_MAPPINGS.update(StringManipulatorMappings)
|
||||
|
||||
NODE_CLASS_MAPPINGS.update(SwapInputsMappings)
|
||||
NODE_CLASS_MAPPINGS.update(BoolIntMappings)
|
||||
NODE_CLASS_MAPPINGS.update(EnableDisableMappings)
|
||||
# NODE_CLASS_MAPPINGS.update(ShowAnyMappings)
|
||||
|
||||
#Logic Util https://github.com/aria1th/ComfyUI-LogicUtils
|
||||
NODE_CLASS_MAPPINGS.update(IOMapping)
|
||||
@@ -102,6 +109,10 @@ NODE_DISPLAY_NAME_MAPPINGS.update(TXTFileSaverNameMappings)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(BatchCounterNameMappings)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(BatchCounterAdvanceNameMappings)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(StringManipulatorNameMappings)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(SwapInputsNameMappings)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(BoolIntNameMappings)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(EnableDisableNameMappings)
|
||||
# NODE_DISPLAY_NAME_MAPPINGS.update(ShowAnyNameMappings)
|
||||
|
||||
#Logic Util https://github.com/aria1th/ComfyUI-LogicUtils
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(IONames)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
class JDCN_BoolInt:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"Boolean": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
}
|
||||
RETURN_TYPES = ("BOOLEAN", "INTEGER",)
|
||||
RETURN_NAMES = ("boolean", "int",)
|
||||
FUNCTION = "checkit"
|
||||
CATEGORY = "🔵 JDCN 🔵"
|
||||
|
||||
def checkit(self, Boolean):
|
||||
if Boolean:
|
||||
return (True,1,)
|
||||
else:
|
||||
return (False,0,)
|
||||
|
||||
|
||||
N_CLASS_MAPPINGS = {
|
||||
"JDCN_BoolInt": JDCN_BoolInt,
|
||||
}
|
||||
|
||||
N_DISPLAY_NAME_MAPPINGS = {
|
||||
"JDCN_BoolInt": "JDCN_BoolInt",
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
from .shared import Any
|
||||
|
||||
any = Any("*")
|
||||
|
||||
class JDCN_EnableDisable:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"Enable": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
}
|
||||
RETURN_TYPES = (any,)
|
||||
RETURN_NAMES = ("output",)
|
||||
FUNCTION = "checkit"
|
||||
CATEGORY = "🔵 JDCN 🔵"
|
||||
|
||||
def checkit(self, Enable):
|
||||
if Enable:
|
||||
return ("enable",)
|
||||
else:
|
||||
return ("disable",)
|
||||
|
||||
|
||||
N_CLASS_MAPPINGS = {
|
||||
"JDCN_EnableDisable": JDCN_EnableDisable,
|
||||
}
|
||||
|
||||
N_DISPLAY_NAME_MAPPINGS = {
|
||||
"JDCN_EnableDisable": "JDCN_EnableDisable",
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
from .shared import Any
|
||||
any = Any("*")
|
||||
class JDCN_ShowAny:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"source": (any,),
|
||||
"text": ("STRING", {"multiline": True, "default": "output"}),
|
||||
},
|
||||
}
|
||||
RETURN_TYPES = (any,)
|
||||
RETURN_NAMES = ("output",)
|
||||
FUNCTION = "main"
|
||||
CATEGORY = "🔵 JDCN 🔵"
|
||||
# OUTPUT_NODE = True
|
||||
def main(self, source, text):
|
||||
return (source,)
|
||||
|
||||
N_CLASS_MAPPINGS = {
|
||||
"JDCN_ShowAny": JDCN_ShowAny,
|
||||
}
|
||||
N_DISPLAY_NAME_MAPPINGS = {
|
||||
"JDCN_ShowAny": "JDCN_ShowAny",
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
from .shared import Any
|
||||
|
||||
any = Any("*")
|
||||
|
||||
class JDCN_SwapInputs:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"inputA": (any,),
|
||||
"inputB": (any,),
|
||||
"SwapIT": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
}
|
||||
RETURN_TYPES = (any, any,)
|
||||
RETURN_NAMES = ("outputA", "outputB",)
|
||||
FUNCTION = "swapit"
|
||||
CATEGORY = "🔵 JDCN 🔵"
|
||||
|
||||
def swapit(self, inputA, inputB, SwapIT):
|
||||
if SwapIT:
|
||||
return (inputB, inputA,)
|
||||
else:
|
||||
return (inputA, inputB,)
|
||||
|
||||
|
||||
N_CLASS_MAPPINGS = {
|
||||
"JDCN_SwapInputs": JDCN_SwapInputs,
|
||||
}
|
||||
|
||||
N_DISPLAY_NAME_MAPPINGS = {
|
||||
"JDCN_SwapInputs": "JDCN_SwapInputs",
|
||||
}
|
||||
@@ -1,3 +1,33 @@
|
||||
class Any(str):
|
||||
def __eq__(self, __value: object) -> bool:
|
||||
return True
|
||||
|
||||
def __ne__(self, __value: object) -> bool:
|
||||
return False
|
||||
|
||||
class AllTrue(str):
|
||||
def __init__(self, representation=None) -> None:
|
||||
self.repr = representation
|
||||
pass
|
||||
def __ne__(self, __value: object) -> bool:
|
||||
return False
|
||||
# isinstance, jsonserializable hijack
|
||||
def __instancecheck__(self, instance):
|
||||
return True
|
||||
def __subclasscheck__(self, subclass):
|
||||
return True
|
||||
def __bool__(self):
|
||||
return True
|
||||
def __str__(self):
|
||||
return self.repr
|
||||
# jsonserializable hijack
|
||||
def __jsonencode__(self):
|
||||
return self.repr
|
||||
def __repr__(self) -> str:
|
||||
return self.repr
|
||||
def __eq__(self, __value: object) -> bool:
|
||||
return True
|
||||
|
||||
FILE_EXTENSIONS = {
|
||||
"images": [
|
||||
".jpg",
|
||||
|
||||
+44
-3
@@ -6,9 +6,12 @@ const NODE_WIDGET_MAP = {
|
||||
"JDCN_AnyFileListRandom": "random_seed",
|
||||
"JDCN_BatchCounter": "Lap",
|
||||
"JDCN_BatchCounterAdvance": "Lap",
|
||||
"JDCN_StringManipulator":"index"
|
||||
"JDCN_StringManipulator": "index",
|
||||
"JDCN_ShowAny": "source",
|
||||
};
|
||||
|
||||
let unAttachedControl = {}
|
||||
|
||||
class JDCN_BatchImageLoadFromListControl {
|
||||
constructor(node, indexWidget) {
|
||||
for (const [i, w] of node.widgets.entries()) {
|
||||
@@ -103,7 +106,7 @@ class JDCN_BatchCounterControl {
|
||||
|
||||
let lap = this.seedWidget.value
|
||||
let range = this.rangeWidget.value
|
||||
this.logWidget.value = ""+(lap*range)
|
||||
this.logWidget.value = "" + (lap * range)
|
||||
|
||||
}
|
||||
|
||||
@@ -293,9 +296,47 @@ const JDCN_StringManipulator = {
|
||||
},
|
||||
};
|
||||
|
||||
class JDCN_ShowAnyControl {
|
||||
constructor(node, logWidget) {
|
||||
this.node = node
|
||||
for (const [i, w] of node.widgets.entries()) {
|
||||
switch (w.name) {
|
||||
case logWidget:
|
||||
this.logWidget = w
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let JDCN_ShowAny = {
|
||||
name: "JDCN_ShowAny",
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
if (nodeData.name === "JDCN_ShowAny") {
|
||||
nodeType.prototype.onNodeCreated = function () {
|
||||
unAttachedControl["JDCN_ShowAny"] = new JDCN_ShowAnyControl(this, "text");
|
||||
unAttachedControl["JDCN_ShowAny"].node.onConnectInput = function(targetSlot, type, output, originNode, originSlot) {
|
||||
console.log(originNode,this)
|
||||
}
|
||||
unAttachedControl["JDCN_ShowAny"].node.onSerialize = function() {
|
||||
if(this.isOutputConnected(0)) {
|
||||
console.log(this.getOutputNodes(0))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const onExecuted = nodeType.prototype.onExecuted;
|
||||
nodeType.prototype.onExecuted = function (message) {
|
||||
onExecuted === null || onExecuted === void 0 ? void 0 : onExecuted.apply(this, [message]);
|
||||
console.log(this)
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
// app.registerExtension(JDCN_BatchImageLoadFromList);
|
||||
app.registerExtension(JDCN_AnyFileSelector);
|
||||
app.registerExtension(JDCN_AnyFileListRandom);
|
||||
app.registerExtension(JDCN_BatchCounter);
|
||||
app.registerExtension(JDCN_BatchCounterAdvance);
|
||||
app.registerExtension(JDCN_StringManipulator);
|
||||
app.registerExtension(JDCN_StringManipulator);
|
||||
// app.registerExtension(JDCN_ShowAny);
|
||||
Reference in New Issue
Block a user