feat: add shortcut to quick connect to debug
Some checks failed
🚀 Lint & Test & Deploy / release (pull_request) Failing after 1m22s

This commit is contained in:
2026-02-12 22:27:11 +01:00
parent e098be6013
commit bf6f632d27
3 changed files with 29 additions and 4 deletions

View File

@@ -160,6 +160,29 @@ export class GraphState {
return 1;
}
tryConnectToDebugNode(nodeId: number) {
const node = this.graph.nodes.get(nodeId);
if (!node) return;
if (node.type.endsWith('/debug')) return;
if (!node.state.type?.outputs?.length) return;
for (const _node of this.graph.nodes.values()) {
if (_node.type.endsWith('/debug')) {
this.graph.createEdge(node, 0, _node, 'input');
return;
}
}
const debugNode = this.graph.createNode({
type: 'max/plantarium/debug',
position: [node.position[0] + 30, node.position[1]],
props: {}
});
if (debugNode) {
this.graph.createEdge(node, 0, debugNode, 'input');
}
}
copyNodes() {
if (this.activeNodeId === -1 && !this.selectedNodes?.size) {
return;

View File

@@ -222,6 +222,10 @@ export class MouseEventManager {
this.state.boxSelection = true;
}
if (event.ctrlKey && event.shiftKey && this.state.activeNodeId !== -1) {
this.state.tryConnectToDebugNode(this.state.activeNodeId);
}
const node = this.graph.getNode(this.state.activeNodeId);
if (!node) return;
node.state = node.state || {};

View File

@@ -13,11 +13,9 @@ export function getDebugData() {
export const debugNode = {
id: 'max/plantarium/debug',
inputs: {
a: {
input: {
type: '*'
}
},
execute(data: Int32Array) {
return data;
}
execute() {}
} as const;