-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Expose CanvasItemEditor and SpatialEditor to GDScript #3992
Comments
Not critical for the upcoming 2.1, so moving to the next milestone. |
@akien-mga I was actually going to try adding this before releasing 2.1 if I had some time. Leaving it like this for now. I will check later :) |
Never mind. Exposing the canvas editor viewport is easy, but SpatialEditorViewport may need a better strategy. It may also be good to expose some information about the two editors, like the selected tool mode, etc. |
It is really simple to get access to the viewport BTW (works at least for canvas): var viewport = get_tree().get_edited_scene_root().get_parent() 😄 |
Is this still a desired feature? |
Yes this is still a desired feature (at least for me). The workaround mentioned by bojidar-bg does not always work. I had some cases where the edited_scene_root was null. |
Is this still being worked on? |
I'm closing this issue as I'm no longer interested in this feature right now. If anyone is still interested, feel free to open a more detailed proposal in godotengine/godot-proposals. I may make one myself in the future if I regain interest. |
It would be great to have access to CanvasItemEditor and SpatialEditor from GDScript.
The main usage example I can think of is creating plugins that need to draw to the CanvasItemEditor's viewport (like a TileMapEditor plugin) or to the SpatialEditorViewport (like this grass plugin).
In C++ you would access these viewports this way:
But there is no way to access them from GDScript unless you use some crazy tricks like this (which could stop working if the editors child structure changes):
The text was updated successfully, but these errors were encountered: