-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add EditorInterface get_main_screen_editor()
method
#2081
Comments
For whatever reason |
Duplicate of #23955. I found this because I make a 2d editor level plugin and I only want the panel show when it's on the 2D edit mode. Hope it be can add in 3.x |
I think this can be closed at least according to this. |
This comment has been minimized.
This comment has been minimized.
The proposal is about adding a method that would return the name of the current main screen plugin/editor. I.e. "2D", "3D", "Script", "AssetLib", or one of the names added by editor plugins. You can get this name by listening to the The linked method returns a VBox in the editor layout that hosts main screen plugins, which is a completely different matter. While the proposed name for the new method is similar (and perhaps should be changed with the implementation), the purpose is different. |
@Calinou I see in the EDIT: |
@granitrocky That's the node name, not the name of the tab. The name of the tab is significant, because it is used with methods like |
Hm, yeah. turns out they don't come out as main screen plugins. EDIT: |
@Calinou I will admit that cpp is not my strong suit. Is there a way to override the GDVIRTUAL methods within the class.h files? I'd like to implement |
If you mean implementing support for virtual methods that scripts can contain, it should be feasible. Check BaseButton's I suggest joining the Godot Contributors Chat and asking on the |
I actually mean overriding the GDVIRTUAL entirely within the cpp code. For example, |
Describe the project you are working on
Godot editor plugins (gdscript)
Describe the problem or limitation you are having in your project
I'm creating plugins which do something depending on the active screen (2D, 3D, Script etc).
I need to get current main screen editor name from plugin, but there is no such method.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Adding method to get main screen editor name would completely solve the problem
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
This should work better but still not well tested:
As you can see this is a hacky workaround, I don't like it because it depends on UI tree and UI states (like
Button.pressed
).UPD:
solution by pycbouh
https://github.com/pycbouh/godot-time-tracker/blob/master/addons/time-tracker/plugin.gd#L76-L118
Is there a reason why this should be core and not an add-on in the asset library?
Because this method is necessary for creating this kind of plugins.
The text was updated successfully, but these errors were encountered: