(nodeType, nodeData, app)
| 36 | app.registerExtension({ |
| 37 | name: "pysssss.QuickNodes", |
| 38 | async beforeRegisterNodeDef(nodeType, nodeData, app) { |
| 39 | if (nodeData.input && nodeData.input.required) { |
| 40 | const keys = Object.keys(nodeData.input.required); |
| 41 | for (let i = 0; i < keys.length; i++) { |
| 42 | if (nodeData.input.required[keys[i]][0] === "VAE") { |
| 43 | addMenuHandler(nodeType, function (_, options) { |
| 44 | options.unshift({ |
| 45 | content: "Use VAE", |
| 46 | callback: () => { |
| 47 | getOrAddVAELoader(this).connect(0, this, i); |
| 48 | }, |
| 49 | }); |
| 50 | }); |
| 51 | break; |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | if (nodeData.name === "KSampler") { |
| 57 | addMenuHandler(nodeType, function (_, options) { |
| 58 | options.unshift( |
| 59 | { |
| 60 | content: "Add Blank Input", |
| 61 | callback: () => { |
| 62 | const imageNode = addNode("EmptyLatentImage", this, { before: true }); |
| 63 | imageNode.connect(0, this, 3); |
| 64 | }, |
| 65 | }, |
| 66 | { |
| 67 | content: "Add Hi-res Fix", |
| 68 | callback: () => { |
| 69 | const upscaleNode = addNode("LatentUpscale", this); |
| 70 | this.connect(0, upscaleNode, 0); |
| 71 | |
| 72 | const sampleNode = addNode("KSampler", upscaleNode); |
| 73 | |
| 74 | for (let i = 0; i < 3; i++) { |
| 75 | const l = this.getInputLink(i); |
| 76 | if (l) { |
| 77 | app.graph.getNodeById(l.origin_id).connect(l.origin_slot, sampleNode, i); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | upscaleNode.connect(0, sampleNode, 3); |
| 82 | }, |
| 83 | }, |
| 84 | { |
| 85 | content: "Add 2nd Pass", |
| 86 | callback: () => { |
| 87 | const upscaleNode = addNode("LatentUpscale", this); |
| 88 | this.connect(0, upscaleNode, 0); |
| 89 | |
| 90 | const ckptNode = addNode("CheckpointLoaderSimple", this); |
| 91 | const sampleNode = addNode("KSampler", ckptNode); |
| 92 | |
| 93 | const positiveLink = this.getInputLink(1); |
| 94 | const negativeLink = this.getInputLink(2); |
| 95 | const positiveNode = positiveLink |
nothing calls this directly
no test coverage detected