Convert usages of EditorNode to EditorPlugin #58506
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Warning: This can't be merged as-is because there are some heap-use-after-free caused by deleted EditorPlugins and EditorInterface. I need to figure out how to fix them.
Follow up of #57306
This PR remove direct usages of EditorNode in favor of EditorPlugin and EditorInterface methods.
Where necessary, the EditorPlugin pointer is stored in the class where necessary (pretty much how it was done for EditorNode before #57306).
In some cases, I create local variables because the new syntax is too long (and it was too long).
Also, it reduces the EditorPlugin includes to 3 by forward-declaring everything else. EDIT: Now done in #60684
Note for reviewers:
There are some inconsistencies, unrelated changes, missing and wrong changes in the PR. Here's a list:
To check that, compare the old name with the one in the EditorInterface's method body. If they differ, the used EditorInterface method is wrong.
For example, EditorInterface::get_base_control calls EditorNode::get_gui_base
Many methods in EditorNode don't have their counterparts in EditorInterface, which I want to add in a follow-up PR to further reduce the (direct) dependencies to EditorNode.
Here's a list of the methods:
This PR decreases the EditorNode::get_singleton usages.
EditorNode::get_singleton usages in master (4dc8214):
EditorNode::get_singleton usages in this PR: