433
This commit is contained in:
@@ -66,7 +66,7 @@ function _convert_graph_to_links(graph, ues, control_node_id) {
|
|||||||
const links_out_of_subgraph = new Set()
|
const links_out_of_subgraph = new Set()
|
||||||
const problem_links = 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;
|
const new_subgraph = new_subgraph_node?.subgraph;
|
||||||
|
|
||||||
added_links.forEach(added_link => {
|
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)=>{
|
links_out_of_subgraph.forEach((llink)=>{
|
||||||
const control_node_id = llink.control_node?.id
|
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) {
|
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
|
// 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)=>{
|
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 => {
|
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)
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export function fix_new_subgraph_node(node) {
|
|||||||
subgraph.inputNode.slots.forEach((slot, i)=>{
|
subgraph.inputNode.slots.forEach((slot, i)=>{
|
||||||
slot.linkIds.forEach((lid) => {
|
slot.linkIds.forEach((lid) => {
|
||||||
const link = subgraph.links[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 slot_name = target.inputs[link.target_slot].name
|
||||||
const ue_connectable = target.properties.ue_properties.widget_ue_connectable[slot_name]
|
const ue_connectable = target.properties.ue_properties.widget_ue_connectable[slot_name]
|
||||||
if (ue_connectable) {
|
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 {
|
class WrappedIONode {
|
||||||
constructor(io_node) {
|
constructor(io_node) {
|
||||||
this.io_node = io_node;
|
this.io_node = io_node;
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ export class LinkRenderController extends Pausable {
|
|||||||
const widgets_disabled = []
|
const widgets_disabled = []
|
||||||
|
|
||||||
app.canvas.graph.extra['ue_links']?.forEach((uel) => {
|
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) {
|
if (node) {
|
||||||
const name = node.inputs[uel.downstream_slot]?.name;
|
const name = node.inputs[uel.downstream_slot]?.name;
|
||||||
if (name) {
|
if (name) {
|
||||||
@@ -336,7 +336,7 @@ export class LinkRenderController extends Pausable {
|
|||||||
graph : m.node.graph,
|
graph : m.node.graph,
|
||||||
sending_to : m.node,
|
sending_to : m.node,
|
||||||
input_index : m.node_index,
|
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,
|
control_node_input_index : m.index,
|
||||||
type : m.type,
|
type : m.type,
|
||||||
}, ctx, 0, "#F00")
|
}, ctx, 0, "#F00")
|
||||||
@@ -387,7 +387,7 @@ export class LinkRenderController extends Pausable {
|
|||||||
/* this is the end node; get the position of the input */
|
/* this is the end node; get the position of the input */
|
||||||
var pos2 = node.getConnectionPos(true, ue_connection.input_index, this.slot_pos1);
|
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) {
|
if (!control_node) {
|
||||||
Logger.problem(`Couldn't find position for UE link ${ue_connection}.`,null,true)
|
Logger.problem(`Couldn't find position for UE link ${ue_connection}.`,null,true)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export function get_real_node(node_id, graph) {
|
|||||||
const nid = node_id.toString();
|
const nid = node_id.toString();
|
||||||
if (nid==-10) return wrap_input(graph.inputNode); // special case for subgraph input
|
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
|
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 {
|
export class Logger {
|
||||||
|
|||||||
Reference in New Issue
Block a user