From 519890a5cc5c09d1eabf1fbb355863db0deae17e Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Sun, 2 Apr 2023 15:57:12 +0100 Subject: [PATCH] Adds middle click for default node creation Enable two useful properties --- web/extensions/core/slotDefaults.js | 21 +++++++++++++++++++++ web/scripts/app.js | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 web/extensions/core/slotDefaults.js diff --git a/web/extensions/core/slotDefaults.js b/web/extensions/core/slotDefaults.js new file mode 100644 index 00000000..0b6a0a15 --- /dev/null +++ b/web/extensions/core/slotDefaults.js @@ -0,0 +1,21 @@ +import { app } from "/scripts/app.js"; + +// Adds defaults for quickly adding nodes with middle click on the input/output + +app.registerExtension({ + name: "Comfy.SlotDefaults", + init() { + LiteGraph.middle_click_slot_add_default_node = true; + LiteGraph.slot_types_default_in = { + MODEL: "CheckpointLoaderSimple", + LATENT: "EmptyLatentImage", + VAE: "VAELoader", + }; + + LiteGraph.slot_types_default_out = { + LATENT: "VAEDecode", + IMAGE: "SaveImage", + CLIP: "CLIPTextEncode", + }; + }, +}); diff --git a/web/scripts/app.js b/web/scripts/app.js index 5af6d5fc..c216d261 100644 --- a/web/scripts/app.js +++ b/web/scripts/app.js @@ -676,6 +676,9 @@ class ComfyApp { const canvas = (this.canvas = new LGraphCanvas(canvasEl, this.graph)); this.ctx = canvasEl.getContext("2d"); + LiteGraph.release_link_on_empty_shows_menu = true; + LiteGraph.alt_drag_do_clone_nodes = true; + this.graph.start(); function resizeCanvas() {