minor fix and some renaming
This commit is contained in:
+1
-1
@@ -75,7 +75,7 @@ export function input_changed(node, slot, connect, link_info) {
|
||||
|
||||
function post_configure_fixes(node) {
|
||||
if (is_combo_clone(node)) reset_comboclone_on_load(node)
|
||||
if (is_UEnode(node, false)) fix_inputs(node, "post_configure_fixes")
|
||||
if (is_UEnode(node)) fix_inputs(node, "post_configure_fixes")
|
||||
}
|
||||
ue_callbacks.register_allnode_callback('afterConfigureGraph', post_configure_fixes)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import { any_restrictions, describe_restrictions } from "./ue_properties.js";
|
||||
import { app } from "../../scripts/app.js";
|
||||
import { create, is_UEnode } from "./use_everywhere_utilities.js";
|
||||
import { create } from "./use_everywhere_utilities.js";
|
||||
import { edit_window } from "./floating_window.js";
|
||||
import { settingsCache } from "./use_everywhere_cache.js";
|
||||
|
||||
|
||||
+2
-2
@@ -93,7 +93,7 @@ Convert node properties when loaded.
|
||||
export function setup_ue_properties_onload(node) {
|
||||
if (!node.properties?.ue_properties) node.properties.ue_properties = {}
|
||||
if ( !version_at_least(node.properties?.ue_properties?.version, "7.0") ) {
|
||||
if (is_UEnode(node, false)) {
|
||||
if (is_UEnode(node)) {
|
||||
// convert a pre 7.0 UE node
|
||||
node.properties.ue_properties = {
|
||||
version : VERSION,
|
||||
@@ -123,7 +123,7 @@ export function setup_ue_properties_onload(node) {
|
||||
}
|
||||
|
||||
function convert_node_types(node) {
|
||||
if (!is_UEnode(node, false)) return
|
||||
if (!is_UEnode(node)) return
|
||||
|
||||
if (node.type=="Anything Everywhere?") {
|
||||
node.widgets.forEach((w)=>{w.hidden=true})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
import { display_name } from "./use_everywhere_classes.js";
|
||||
import { is_UEnode, get_real_node, Logger } from "./use_everywhere_utilities.js";
|
||||
import { get_real_node, Logger } from "./use_everywhere_utilities.js";
|
||||
|
||||
|
||||
function _convert_to_links(ue, added_links, removed_links) {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
import { convert_to_links } from "./use_everywhere_apply.js";
|
||||
import { Logger } from "./use_everywhere_utilities.js";
|
||||
import { Logger, is_UEnode, node_can_broadcast } from "./use_everywhere_utilities.js";
|
||||
import { settingsCache } from "./use_everywhere_cache.js";
|
||||
import { visible_graph } from "./use_everywhere_subgraph_utils.js";
|
||||
import { edit_restrictions } from "./ue_properties_editor.js";
|
||||
import { is_UEnode } from "./use_everywhere_utilities.js";
|
||||
import { i18ify_settings } from "./i18n.js";
|
||||
import { VERSION, shared } from "./shared.js";
|
||||
import { for_all_graphs } from "./recursive_callbacks.js";
|
||||
@@ -222,10 +221,11 @@ export function add_extra_menu_items(node_or_node_type, ioio) {
|
||||
node_or_node_type.getExtraMenuOptions = function(_, options) {
|
||||
getExtraMenuOptions?.apply(this, arguments);
|
||||
options.push(null);
|
||||
if (is_UEnode(this, true)) {
|
||||
node_menu_settings(options, this);
|
||||
} else {
|
||||
non_ue_menu_settings(options, this);
|
||||
if (node_can_broadcast(this)) {
|
||||
add_restrictions_and_convert(options, this);
|
||||
}
|
||||
if (!is_UEnode(node)) {
|
||||
add_input_and_output_settings(options, node)
|
||||
}
|
||||
options.push(null);
|
||||
ioio(options,'callback',`menu option on ${this.id}`);
|
||||
@@ -234,76 +234,78 @@ export function add_extra_menu_items(node_or_node_type, ioio) {
|
||||
}
|
||||
|
||||
|
||||
function node_menu_settings(options, node) {
|
||||
function add_restrictions_and_convert(options, node) {
|
||||
options.push(
|
||||
{
|
||||
content: "Edit restrictions",
|
||||
callback: edit_restrictions,
|
||||
}
|
||||
)
|
||||
if (is_UEnode(node, true)) {
|
||||
options.push(
|
||||
{
|
||||
content: "Convert to real links",
|
||||
callback: async () => {
|
||||
const ues = shared.graphAnalyser.analyse_graph(visible_graph());
|
||||
if (ues===null) {
|
||||
Logger.log_problem("Convert to real links failed to get ues")
|
||||
alert("Convert failed - press f12 to see the console log")
|
||||
} else {
|
||||
convert_to_links(ues, node);
|
||||
if (is_UEnode(node)) {
|
||||
visible_graph().remove(node);
|
||||
} else {
|
||||
node.properties.ue_convert = false
|
||||
}
|
||||
|
||||
options.push(
|
||||
{
|
||||
content: "Convert to real links",
|
||||
callback: async () => {
|
||||
const ues = shared.graphAnalyser.analyse_graph(visible_graph());
|
||||
if (ues===null) {
|
||||
Logger.log_problem("Convert to real links failed to get ues")
|
||||
alert("Convert failed - press f12 to see the console log")
|
||||
} else {
|
||||
convert_to_links(ues, node);
|
||||
if (is_UEnode(node)) {
|
||||
visible_graph().remove(node);
|
||||
} else {
|
||||
node.properties.ue_convert = false
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
if (!is_UEnode(node, false)) {
|
||||
non_ue_menu_settings(options, node)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function non_ue_menu_settings(options, node) {
|
||||
options.push(
|
||||
{
|
||||
content: node.properties.rejects_ue_links ? "Allow UE Links" : "Reject UE Links",
|
||||
has_submenu: false,
|
||||
callback: () => { node.properties.rejects_ue_links = !!!node.properties.rejects_ue_links },
|
||||
}
|
||||
)
|
||||
if (node.widgets?.length) {
|
||||
function add_input_and_output_settings(options, node) {
|
||||
if (node.inputs?.length) {
|
||||
options.push(
|
||||
{
|
||||
content: "UE Connectable Inputs",
|
||||
has_submenu: true,
|
||||
callback: widget_ue_submenu,
|
||||
}
|
||||
content: node.properties.rejects_ue_links ? "Allow UE Links" : "Reject UE Links",
|
||||
has_submenu: false,
|
||||
callback: () => { node.properties.rejects_ue_links = !!!node.properties.rejects_ue_links },
|
||||
}
|
||||
)
|
||||
}
|
||||
options.push(
|
||||
{
|
||||
content: node.properties.ue_convert ? "Remove UE broadcasting" : "Add UE broadcasting",
|
||||
has_submenu: false,
|
||||
callback: () => { node.properties.ue_convert = !!!node.properties.ue_convert },
|
||||
}
|
||||
)
|
||||
if (node.properties.ue_convert) {
|
||||
options.push(
|
||||
|
||||
if (!node.properties.rejects_ue_links) {
|
||||
options.push(
|
||||
{
|
||||
content: "Broadcasting Outputs",
|
||||
content: "UE Connectable Inputs",
|
||||
has_submenu: true,
|
||||
callback: output_ue_submenu,
|
||||
}
|
||||
callback: widget_ue_submenu,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (node.outputs.length) {
|
||||
options.push(
|
||||
{
|
||||
content: node.properties.ue_convert ? "Remove UE broadcasting" : "Add UE broadcasting",
|
||||
has_submenu: false,
|
||||
callback: () => { node.properties.ue_convert = !!!node.properties.ue_convert },
|
||||
}
|
||||
)
|
||||
if (node.properties.ue_convert) {
|
||||
options.push(
|
||||
{
|
||||
content: "Broadcasting Outputs",
|
||||
has_submenu: true,
|
||||
callback: output_ue_submenu,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove_ue_nodes(graph) {
|
||||
graph._nodes.filter((node)=>is_UEnode(node, false)).forEach((node)=>{graph.remove(node)})
|
||||
graph._nodes.filter((node)=>is_UEnode(node)).forEach((node)=>{graph.remove(node)})
|
||||
}
|
||||
|
||||
export function canvas_menu_settings(options) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Logger, get_real_node, Pausable, is_UEnode } from "./use_everywhere_utilities.js";
|
||||
import { Logger, get_real_node, Pausable, node_can_broadcast } from "./use_everywhere_utilities.js";
|
||||
import { app } from "../../scripts/app.js";
|
||||
import { settingsCache } from "./use_everywhere_cache.js";
|
||||
import { in_visible_graph, visible_graph } from "./use_everywhere_subgraph_utils.js";
|
||||
@@ -78,7 +78,7 @@ export function nodes_not_my_color(node, already_limited_to) {
|
||||
}
|
||||
|
||||
export function title_bar_additions(node, ctx, title_height) {
|
||||
if (is_UEnode(node, true)) {
|
||||
if (node_can_broadcast(node)) {
|
||||
const restricted = any_restrictions(node);
|
||||
const sending = shared.linkRenderController.node_sending_anywhere(node);
|
||||
|
||||
|
||||
@@ -266,12 +266,18 @@ export function is_connected(input, treat_bypassed_as_live, graph) {
|
||||
/*
|
||||
Is this a UE node?
|
||||
*/
|
||||
export function is_UEnode(node_or_nodeType, include_converts) {
|
||||
if (include_converts && node_or_nodeType.properties?.ue_convert) return true;
|
||||
const title = node_or_nodeType.type || node_or_nodeType.comfyClass;
|
||||
return ((title) && (title.startsWith("Anything Everywhere") || title==="Seed Everywhere" || title==="Prompts Everywhere"))
|
||||
export function is_UEnode(node_or_nodeType) {
|
||||
const type = node_or_nodeType.type || node_or_nodeType.comfyClass;
|
||||
return ((type) && (type.startsWith("Anything Everywhere") || type==="Seed Everywhere" || type==="Prompts Everywhere"))
|
||||
}
|
||||
|
||||
export function node_can_broadcast(node_or_nodeType) {
|
||||
if (node_or_nodeType.properties?.ue_convert) return true;
|
||||
return is_UEnode(node_or_nodeType)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Inject a call into a method on object with name methodname.
|
||||
The injection is added at the end of the existing method (if the method didn't exist, it is created)
|
||||
|
||||
Reference in New Issue
Block a user