diff --git a/js/use_everywhere_apply.js b/js/use_everywhere_apply.js index 9695ffb..947b9d1 100644 --- a/js/use_everywhere_apply.js +++ b/js/use_everywhere_apply.js @@ -66,7 +66,7 @@ function _convert_graph_to_links(graph, ues, control_node_id) { const links_out_of_subgraph = new Set() const problem_links = new Set() - const new_subgraph_node = graph._nodes_by_id[graph.last_node_id]; + const new_subgraph_node = graph.getNodeById(graph.last_node_id); const new_subgraph = new_subgraph_node?.subgraph; added_links.forEach(added_link => { @@ -96,7 +96,7 @@ function _convert_graph_to_links(graph, ues, control_node_id) { links_out_of_subgraph.forEach((llink)=>{ const control_node_id = llink.control_node?.id - const control_node_in_graph = graph._nodes_by_id[control_node_id] + const control_node_in_graph = graph.getNodeById(control_node_id) if (control_node_in_graph) { // the control node is outside, so we should disconnect anything else that is connected to the same output of the subgraph node new_subgraph_node.outputs[new_subgraph.links[llink.id].target_slot].links.forEach((link_id)=>{ @@ -121,7 +121,7 @@ function _convert_graph_to_links(graph, ues, control_node_id) { } removed_links.forEach(llink => { - graph._nodes_by_id[llink.origin_id].connect(llink.origin_slot, graph._nodes_by_id[llink.target_id], llink.target_slot) + graph.getNodeById(llink.origin_id).connect(llink.origin_slot, graph.getNodeById(llink.target_id), llink.target_slot) }) }; diff --git a/js/use_everywhere_subgraph_utils.js b/js/use_everywhere_subgraph_utils.js index 3a8d593..3a7db4c 100644 --- a/js/use_everywhere_subgraph_utils.js +++ b/js/use_everywhere_subgraph_utils.js @@ -40,7 +40,7 @@ export function fix_new_subgraph_node(node) { subgraph.inputNode.slots.forEach((slot, i)=>{ slot.linkIds.forEach((lid) => { const link = subgraph.links[lid] - const target = subgraph._nodes_by_id[link.target_id] + const target = subgraph.getNodeById(link.target_id) const slot_name = target.inputs[link.target_slot].name const ue_connectable = target.properties.ue_properties.widget_ue_connectable[slot_name] if (ue_connectable) { @@ -58,29 +58,6 @@ export function fix_new_subgraph_node(node) { } } -function fix_subgraph_widgets(node) { - return - // some code for Issue 390 - fixing widgets on subgraph nodes - which doesn't work yet - const graph = node.subgraph - const widgets = node.widgets - if (!graph) return - shared.graphAnalyser.analyse_graph(graph, true) - node.inputs.forEach((input,slot)=>{ - if (!input.widget) { - const connected_widgets = graph.extra['ue_links']. - filter((uel)=>(uel.upstream=="-10" && uel.upstream_slot==slot)). - map((uel)=>graph._nodes_by_id[uel.downstream]?.inputs[uel.downstream_slot]?.widget). - filter((w)=>(w)) - if (connected_widgets.length>0) { - const new_widget = node.addWidget() - input._widget = new_widget - input.widget = {name:new_widget.name} - } - } - }) -} -ue_callbacks.register_allnode_callback('afterConfigureGraph', fix_subgraph_widgets, true ) - class WrappedIONode { constructor(io_node) { this.io_node = io_node; diff --git a/js/use_everywhere_ui.js b/js/use_everywhere_ui.js index ae95d6d..6ca38e2 100644 --- a/js/use_everywhere_ui.js +++ b/js/use_everywhere_ui.js @@ -170,7 +170,7 @@ export class LinkRenderController extends Pausable { const widgets_disabled = [] app.canvas.graph.extra['ue_links']?.forEach((uel) => { - const node = app.canvas.graph._nodes_by_id[uel.downstream] + const node = app.canvas.graph.getNodeById(uel.downstream) if (node) { const name = node.inputs[uel.downstream_slot]?.name; if (name) { @@ -336,7 +336,7 @@ export class LinkRenderController extends Pausable { graph : m.node.graph, sending_to : m.node, input_index : m.node_index, - control_node : m.node.graph._nodes_by_id[m.id], + control_node : m.node.graph.getNodeById(m.id), control_node_input_index : m.index, type : m.type, }, ctx, 0, "#F00") @@ -387,7 +387,7 @@ export class LinkRenderController extends Pausable { /* this is the end node; get the position of the input */ var pos2 = node.getConnectionPos(true, ue_connection.input_index, this.slot_pos1); - const control_node = graph._nodes_by_id[ue_connection.control_node.id] + const control_node = graph.getNodeById(ue_connection.control_node.id) if (!control_node) { Logger.problem(`Couldn't find position for UE link ${ue_connection}.`,null,true) return; diff --git a/js/use_everywhere_utilities.js b/js/use_everywhere_utilities.js index 6def3c4..bc16378 100644 --- a/js/use_everywhere_utilities.js +++ b/js/use_everywhere_utilities.js @@ -48,7 +48,7 @@ export function get_real_node(node_id, graph) { const nid = node_id.toString(); if (nid==-10) return wrap_input(graph.inputNode); // special case for subgraph input if (nid==-20) return wrap_input(graph.outputNode); // special case for subgraph input - return graph._nodes_by_id[nid]; + return graph.getNodeById(nid); } export class Logger {