feat: add shortcut to quick connect to debug
Some checks failed
🚀 Lint & Test & Deploy / release (pull_request) Failing after 1m22s
Some checks failed
🚀 Lint & Test & Deploy / release (pull_request) Failing after 1m22s
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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 || {};
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user