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

EditorPlugins for main editors (like 2D/3D/Script) or tools (like AssetLib) need a way to know the "main screen" parent #5786

Closed
Tracked by #6276
gau-veldt opened this issue Jul 18, 2016 · 0 comments · Fixed by #6516

Comments

@gau-veldt
Copy link
Contributor

gau-veldt commented Jul 18, 2016

Operating system or device - Godot version:
Godot v2.1.beta.official

Issue description (what happened, and what was expected):
An EditorPlugin indicates it wants the "main screen" edit area (this is the area occupied by 2D, 3D, Script and AssetLib when selected) by overriding has_main_screen() to return true and overriding get_name() to return a string for the name in the panel for selecting it visible. However that is as far as one can get since the rest of the necessary functionality is missing. There is no method to:

  1. indicate the editor's main screen has been selected visible (unhide your controls),
  2. indicate the editor's main screen is about to switch (hide your controls), nor
  3. method to call to get the client area for the main screen so the scene of controls may be placed appropriately (and subsequently removed on deactivation) into the scene tree.

Just so we're clear I've attached an image. The "main screen" as understood by both the API and the current help documentation refer to the area outlined by the green box as the "main screen". It does not refer to the entire editor window. There has been confusion when I brought this up on FB and some folks figured I wanted the entire editor window which is not the case (which has its own issues anyways such as appearing over top menus and stuff making it only suitable for popups and dialogs, not a long-lived editor control with large real estate footprint making it unsuitable for the sidebars).

plugin-screenie

Steps to reproduce:

myplugin.tscn:

//bunch of controls for myplugin

myplugin.gd:

tool
extends EditorPlugin

var myControl=preload("res://addons/myplugin/myplugin.tscn")

func has_main_screen():
    return true

func get_name()
    return "MyPluginScreen"

func _enter_tree():
    # we actually have nowhere known to place myControl
    # as a child to have it appear in the "main screen" area
    pass

func _exit_tree():
    # correspondingly we have no remove_child(myControl) method to call
    # since we never had anywhere to call add_child(myControl) to begin with
    myControl.queue_free()
    pass

Link to minimal example project (optional but very welcome):
see above (don't forget a suitable plugin.cfg)

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

Successfully merging a pull request may close this issue.

2 participants