This commit is contained in:
+3
-23
@@ -3,7 +3,7 @@ import { api } from "../../scripts/api.js";
|
||||
|
||||
import { shared, deferred_actions } from "./shared.js";
|
||||
|
||||
import { is_UEnode, inject, Logger, graphConverter, create, node_can_broadcast, running_nodes2 } from "./use_everywhere_utilities.js";
|
||||
import { is_UEnode, Logger, graphConverter, create, node_can_broadcast, running_nodes2 } from "./use_everywhere_utilities.js";
|
||||
import { title_bar_additions, LinkRenderController } from "./use_everywhere_ui.js";
|
||||
import { GraphAnalyser } from "./use_everywhere_graph_analysis.js";
|
||||
import { canvas_menu_settings, SETTINGS, add_extra_menu_items } from "./use_everywhere_settings.js";
|
||||
@@ -25,14 +25,8 @@ function add_methods_to_all_nodes(node) {
|
||||
if (node.ue_methods_added) return Logger.log_problem(`Node ${node.id} already has UE methods added`);
|
||||
|
||||
try {
|
||||
add_extra_menu_items(node, inject_outdating_into_object_method) // right click menu additions
|
||||
|
||||
//const original_onDrawTitleBar = node.onDrawTitleBar;
|
||||
//node.onDrawTitleBar = function(ctx, title_height) {
|
||||
// original_onDrawTitleBar?.apply(this, arguments);
|
||||
// title_bar_additions(node, ctx, title_height)
|
||||
//}
|
||||
|
||||
add_extra_menu_items(node) // right click menu additions
|
||||
|
||||
const original_onMouseEnter = node.onMouseEnter;
|
||||
node.onMouseEnter = function(e) {
|
||||
original_onMouseEnter?.apply(this, arguments)
|
||||
@@ -52,20 +46,6 @@ function add_methods_to_all_nodes(node) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Inject a call to linkRenderController.mark_list_link_outdated into a method with name methodname on all objects in the array
|
||||
If object is undefined, do nothing.
|
||||
The injection is added at the end of the existing method (if the method didn't exist, it is created).
|
||||
*/
|
||||
function inject_outdating_into_objects(array, methodname, tracetext) {
|
||||
if (array) {
|
||||
array.forEach((object) => { inject_outdating_into_object_method(object, methodname, tracetext); })
|
||||
}
|
||||
}
|
||||
function inject_outdating_into_object_method(object, methodname, tracetext) {
|
||||
if (object) inject(object, methodname, tracetext, shared.linkRenderController.mark_link_list_outdated, shared.linkRenderController);
|
||||
}
|
||||
|
||||
app.registerExtension({
|
||||
name: "cg.customnodes.use_everywhere",
|
||||
settings: SETTINGS,
|
||||
|
||||
@@ -222,7 +222,7 @@ function output_ue_submenu(value, options, e, menu, node) {
|
||||
|
||||
|
||||
|
||||
export function add_extra_menu_items(node, ioio) {
|
||||
export function add_extra_menu_items(node) {
|
||||
if (node.ue_extra_menu_items_added) return
|
||||
const getExtraMenuOptions = node.getExtraMenuOptions;
|
||||
node.getExtraMenuOptions = function(_, options) {
|
||||
@@ -235,7 +235,6 @@ export function add_extra_menu_items(node, ioio) {
|
||||
add_input_and_output_settings(options, node)
|
||||
}
|
||||
options.push(null);
|
||||
ioio(options,'callback',`menu option on ${this.id}`);
|
||||
}
|
||||
node.ue_extra_menu_items_added = true
|
||||
}
|
||||
|
||||
@@ -294,21 +294,6 @@ export function node_can_broadcast(node) {
|
||||
return (node.properties?.ue_convert || is_UEnode(node))
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
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)
|
||||
injectionthis and injectionarguments are passed into the apply call (as the this and the arguments)
|
||||
*/
|
||||
export function inject(object, methodname, tracetext, injection, injectionthis, injectionarguments) {
|
||||
const original = object[methodname];
|
||||
object[methodname] = function() {
|
||||
original?.apply(this, arguments);
|
||||
injection.apply(injectionthis, injectionarguments);
|
||||
}
|
||||
}
|
||||
|
||||
export class Pausable {
|
||||
constructor(name) {
|
||||
this.name = name
|
||||
|
||||
Reference in New Issue
Block a user