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

Expose CanvasItemEditor and SpatialEditor to GDScript #3992

Closed
Tracked by #6276
neikeq opened this issue Mar 9, 2016 · 8 comments
Closed
Tracked by #6276

Expose CanvasItemEditor and SpatialEditor to GDScript #3992

neikeq opened this issue Mar 9, 2016 · 8 comments

Comments

@neikeq
Copy link
Contributor

neikeq commented Mar 9, 2016

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:

CanvasItemEditor::get_singleton()->get_viewport_control();
SpatialEditor::get_singleton()->get_editor_viewport(0);

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):

@kubecz3k kubecz3k added this to the 2.1 milestone Mar 9, 2016
@akien-mga akien-mga modified the milestones: 2.2, 2.1 Jul 15, 2016
@akien-mga
Copy link
Member

Not critical for the upcoming 2.1, so moving to the next milestone.

@neikeq
Copy link
Contributor Author

neikeq commented Jul 15, 2016

@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 :)

@neikeq neikeq self-assigned this Jul 15, 2016
@neikeq
Copy link
Contributor Author

neikeq commented Jul 23, 2016

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.
Leaving this for 2.2.

@bojidar-bg
Copy link
Contributor

bojidar-bg commented Aug 24, 2016

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()

😄

@akien-mga akien-mga removed this from the 2.2 milestone Aug 8, 2017
@aaronfranke
Copy link
Member

Is this still a desired feature?

@winston-yallow
Copy link
Contributor

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.

@blaze-the-star
Copy link

Is this still being worked on?

@neikeq
Copy link
Contributor Author

neikeq commented Sep 17, 2019

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.

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

No branches or pull requests

7 participants