use constructor title instead of getTitle

This commit is contained in:
TinyTerra
2024-06-22 11:57:02 +10:00
parent 1eb331c48f
commit 10a0e26f4e
5 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -656,7 +656,7 @@ app.registerExtension({
}
},
nodeCreated(node) {
if (["pipeLoader", "pipeLoaderSDXL"].includes(node.getTitle())) {
if (["pipeLoader", "pipeLoaderSDXL"].includes(node.constructor.title)) {
for (let widget of node.widgets) {
if (widget.name === "control_after_generate") {
widget.value = "fixed"
+4 -3
View File
@@ -8,6 +8,7 @@ const doesInputWithNameExist = (node, name) => node.inputs ? node.inputs.some((i
function updateNodeHeight(node) {
node.setSize([node.size[0], node.computeSize()[1]]);
app.canvas.dirty_canvas = true;
}
function toggleWidget(node, widget, show = false, suffix = "") {
@@ -310,7 +311,7 @@ function widgetLogic(node, widget) {
break;
case 'mode':
if (node.getTitle() === "pipeLoraStack") {
if (node.constructor.title === "pipeLoraStack") {
let number_to_show2 = findWidgetByName(node, 'num_loras')?.value + 1
for (let i = 0; i < number_to_show2; i++) {
if (widget.value === "simple") {
@@ -324,7 +325,7 @@ function widgetLogic(node, widget) {
}
updateNodeHeight(node)
break;
} else {
} else if (node.constructor.title === "advPlot combo") {
if (widget.value === 'all') {
toggleWidget(node, findWidgetByName(node, 'start_from'))
toggleWidget(node, findWidgetByName(node, 'end_with'))
@@ -525,7 +526,7 @@ app.registerExtension({
name: "comfy.ttN.dynamicWidgets",
nodeCreated(node) {
const nodeTitle = node.getTitle();
const nodeTitle = node.constructor.title;
if (getSetTitles.includes(nodeTitle)) {
getSetters(node);
}
+1 -1
View File
@@ -280,7 +280,7 @@ app.registerExtension({
_initializeAutocompleteList(nsp_keys, '__');
},
nodeCreated(node) {
if (node.widgets && node.getTitle() !== "xyPlot") {
if (node.widgets && !["xyPlot", "advanced xyPlot"].includes(node.constructor.title)) {
const relevantWidgets = node.widgets.filter(_isRelevantWidget);
relevantWidgets.forEach(_attachInputHandler);
const lorasWidgets = node.widgets.filter(_isLorasWidget);
+1 -1
View File
@@ -203,7 +203,7 @@ app.registerExtension({
}
},
nodeCreated(node) {
if (node.getTitle() === "xyPlot") {
if (node.constructor.title === "xyPlot") {
addGetSetters(node);
dropdownCreator(node);
+6 -6
View File
@@ -12,7 +12,7 @@ function getWidgetsOptions(node) {
const current_value = w.value
if (widgets_to_ignore.includes(w.name)) continue
//console.log(`WIDGET ${w.name}, ${w.type}, ${w.options}`)
if (w.name === 'seed' || (w.name === 'value' && node.getTitle().toLowerCase() == 'seed')) {
if (w.name === 'seed' || (w.name === 'value' && node.constructor.title.toLowerCase() == 'seed')) {
widgetsOptions[w.name] = {'Random Seed': `${w.options.max}/${w.options.min}/${w.options.step}`}
continue
}
@@ -106,7 +106,7 @@ function getNodesWidgetsDict(xyNode, plotLines=false) {
const plotNodeLink = xyNodeLinks[0]
const plotNodeID = xyNode.graph.links[plotNodeLink].target_id
const plotNodeTitle = xyNode.graph._nodes_by_id[plotNodeID].getTitle()
const plotNodeTitle = xyNode.graph._nodes_by_id[plotNodeID].constructor.title
const plotNode = app.graph._nodes_by_id[plotNodeID]
const options = getWidgetsOptions(plotNode)
@@ -117,8 +117,8 @@ function getNodesWidgetsDict(xyNode, plotLines=false) {
const inputIDS = _recursiveGetInputIDs(plotNode)
for (const iID of inputIDS) {
const iNode = app.graph._nodes_by_id[iID];
const iNodeTitle = iNode.getTitle()
if (iNode.type === 'ttN advanced xyPlot') {
const iNodeTitle = iNode.constructor.title
if (iNodeTitle === 'advanced xyPlot') {
continue
}
const options = getWidgetsOptions(iNode)
@@ -258,7 +258,7 @@ function findUpstreamXYPlot(targetID) {
if (!currentNode) {
return
}
if (currentNode.getTitle() === 'advanced xyPlot') {
if (currentNode.constructor.title === 'advanced xyPlot') {
return currentNode;
} else {
if (!currentNode.outputs) {
@@ -478,7 +478,7 @@ app.registerExtension({
}*/
},
nodeCreated(node) {
const node_title = node.getTitle();
const node_title = node.constructor.title;
if (node_title === "advanced xyPlot") {
dropdownCreator(node);