Expose GridMapEditorPlugin to scripts and add methods to manipulate to the selection and selected palette item #99639
+207
−11
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.
This PR allows editor scripts and plugins to access
GridMapEditorPlugin
and adds methods for extending the editor's functionality by allowing manipulation of the selection and selected palette item.This addresses godotengine/godot-proposals#11161. It can also help with custom grid map tools that could be added later by scripts as i wrote in godotengine/godot-proposals#11206 (comment).
The video below shows how it could be used to implement a script that replaces tiles in the selection:
Godot.Gridmap.Selection.Plugin.webm
(obviously this is just an example -and probably the replace functionality should be core part of the editor- to show how the API can be used but it could also be used for making game-specific tools like assigning data -to be stored elsewhere, like in a node- to cells, or to pre-fill a gridmap with some procedural code that can be then manually edited, or to quickly set data and/or colors -especially useful for data as they can be something different than color- if #94282 is merged, etc)