feat/debug-node #41

Merged
max merged 17 commits from feat/debug-node into main 2026-02-12 23:20:59 +01:00
3 changed files with 29 additions and 4 deletions
Showing only changes of commit bf6f632d27 - Show all commits

View File

@@ -160,6 +160,29 @@ export class GraphState {
return 1; 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() { copyNodes() {
if (this.activeNodeId === -1 && !this.selectedNodes?.size) { if (this.activeNodeId === -1 && !this.selectedNodes?.size) {
return; return;

View File

@@ -222,6 +222,10 @@ export class MouseEventManager {
this.state.boxSelection = true; 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); const node = this.graph.getNode(this.state.activeNodeId);
if (!node) return; if (!node) return;
node.state = node.state || {}; node.state = node.state || {};

View File

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