Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy & Paste all items #302

Merged
merged 4 commits into from
Nov 13, 2024
Merged

Copy & Paste all items #302

merged 4 commits into from
Nov 13, 2024

Conversation

webfiltered
Copy link
Contributor

@webfiltered webfiltered commented Nov 11, 2024

Copy & paste rewrite

  • Adds support for groups & reroutes
  • Remaps links & reroutes, maintaining connections
  • Fixes bug where pasted node links could be corrupted / lost by one bad node entry
copy-pasta-all.mp4

Overview of changes

  • All items are run through serialize or asSerialisable
  • All links to the inputs of copied nodes are included
  • Nodes are still cloned as this behaviour is relied on in places, however original IDs are reinserted and copied
  • Links use the new Serialisable interface, serialising them as objects like everything else
  • Re-linking and ID mutation only occurs when pasting
  • Paste returns map of original IDs to pasted items (_paste method only, at present - public API later if no issues)

This should provide a much cleaner way to extend and utilise Litegraph's copy and paste.

Requires

@webfiltered webfiltered marked this pull request as ready for review November 12, 2024 01:10
Complete rewrite of copy & paste
Fixes a bug where failure to clone a node would corrupt all subsequent nodes
No longer mutates nodes when copying
@webfiltered
Copy link
Contributor Author

webfiltered commented Nov 12, 2024

Edit: Resolved

Part of the rewrite was removing a workaround in Litegraph (a new, disparate format for links). groupNode reads directly from the copy / paste system's internal workings, so is now failing tests. Looking at it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants