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

Fix InstructionTree and Block circular dependency #182

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

dbnicholson
Copy link
Member

Since 4338632 there's been a circular dependency between InstructionTree and Block that manifests as a script error due to a non-existent resource in a seemingly unrelated object. Several components use InstructionTree.TreeNode including Block, and prior to 4338632 there were no references to any non-native classes. Split out the block tree functions to a new BlockTreeUtil class so that InstructionTree no longer contains references to Block.

Since 4338632 there's been a circular dependency between InstructionTree
and Block that manifests as a script error due to a non-existent
resource in a seemingly unrelated object. Several components use
InstructionTree.TreeNode including Block, and prior to 4338632 there
were no references to any non-native classes. Split out the block tree
functions to a new BlockTreeUtil class so that InstructionTree no longer
contains references to Block.
@dbnicholson
Copy link
Member Author

This will almost certainly cause conflicts in the decoupling PRs.

@@ -3,6 +3,7 @@ extends Control

const Background = preload("res://addons/block_code/ui/blocks/utilities/background/background.gd")
const BlockCanvas = preload("res://addons/block_code/ui/block_canvas/block_canvas.gd")
const BlockTreeUtil = preload("res://addons/block_code/ui/block_tree_util.gd")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not at all convinced of this name or path. What seemed to be in common in the functions moved was that they were about a tree of Block nodes. @wnbaum's work completely changes the way this is handled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is going to be changed anyways maybe the current name/path doesn't matter that much?

@manuq
Copy link
Contributor

manuq commented Aug 1, 2024

This will almost certainly cause conflicts in the decoupling PRs.

No problem, we can rebase.

Copy link
Contributor

@manuq manuq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, this fixes the circular dependency in a decent way with a separate script. I tested it in both the development project and by copying the plugin to a new project and then enabling it. No errors present.

@manuq manuq merged commit 03b1384 into main Aug 1, 2024
2 checks passed
@manuq manuq deleted the it-block-cycle branch August 1, 2024 14:12
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