Skip to content

Commit

Permalink
Add callbacks for history management to *litegraph.js*.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jan 29, 2025
1 parent 9596ae0 commit c551b6e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions colour_hdri/network/resources/assets/litegraph.js/js/litegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -5467,6 +5467,8 @@ LGraphNode.prototype.executeAction = function(action)
this.onConnectingChange = null; //called before any link changes
this.onBeforeChange = null; //called before modifying the graph
this.onAfterChange = null; //called after modifying the graph
this.onBeforePaste = null; //called after copying the graph
this.onAfterPaste = null; //called after pasting into the graph

this.connections_width = 3;
this.round_radius = 8;
Expand Down Expand Up @@ -7459,6 +7461,11 @@ LGraphNode.prototype.executeAction = function(action)

this.graph.beforeChange();

if (this.graph.onBeforePaste != null)
{
this.graph.onBeforePaste();
}

//create nodes
var clipboard_info = JSON.parse(data);
// calculate top-left node, could work without this processing but using diff with last node pos :: clipboard_info.nodes[clipboard_info.nodes.length-1].pos
Expand Down Expand Up @@ -7524,6 +7531,11 @@ LGraphNode.prototype.executeAction = function(action)
this.selectNodes(nodes);

this.graph.afterChange();

if (this.graph.onAfterPaste != null)
{
this.graph.onAfterPaste();
}
};

/**
Expand Down

0 comments on commit c551b6e

Please sign in to comment.