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

Properties doesn't show up when export in script derived from EditorPlugin #49557

Open
nongvantinh opened this issue Jun 13, 2021 · 14 comments
Open

Comments

@nongvantinh
Copy link
Contributor

Godot version

Godot Engine v3.3.2.stable.official

System information

Windows 10

Issue description

When writing an editor plugin, I tried to export a variable, but it doesn't show up in the engine.

Steps to reproduce

Write an editor with export variable, look something like this.

export(PackedScene) var CannotExportVariable

And in the editor dock of the plugin doesn't show up exported property.

Screenshot (45)

Screenshot (44)

Minimal reproduction project

ExportPropertiesInEditorPlugin.zip

@nongvantinh
Copy link
Contributor Author

@timothyqiu
Copy link
Member

IIRC, this is expected behavior.

Exported variables appear in the Inspector if you are inspecting that node / resource instance. But what you're doing is adding a custom dock panel, and the Inspector is still inspecting the script itself.

You might need to manually inspect the added custom dock panel node, or design the UI as usual if what you want is a text field on that new dock.

@nongvantinh
Copy link
Contributor Author

I want to load a resource from file system with that exported variable.

@nongvantinh
Copy link
Contributor Author

nongvantinh commented Jun 13, 2021

Also, FileDialog node doesn't show up even I manually design it in editor.
ExportPropertiesInEditorPlugin.zip

Screenshot (47)
Screenshot (46)

@timothyqiu
Copy link
Member

You need to use EditorFileDialog instead of FileDialog.

@nongvantinh
Copy link
Contributor Author

There is no EditorFileDialog node in editor.
Since I can not export variable in code then It's still don't work.
Screenshot (48)

@timothyqiu
Copy link
Member

timothyqiu commented Jun 13, 2021

@nongvantinh It can be created add added by code. Something like:

var dialog = EditorFileDialog.new()
add_child(dialog)
dialog.popup_centered()

@nongvantinh
Copy link
Contributor Author

Thanks, It may work. I'll give it a try.
And still I can not export variable, that is why I think it's a bug or there is some way to do it and the docs don't say how.

@timothyqiu
Copy link
Member

Add get_editor_interface().inspect_object(self) below the add_control_dock line, reload the plugin and you'll see the Inspector inspecting your plugin, and thus shows the exported variable.

But I don't think it's supposed to be used that way.

@nongvantinh
Copy link
Contributor Author

get_editor_interface().inspect_object(self) does show it in inspector but when I click somewhere that inspector with exported variable disappear until plugin re-enable again.

@timothyqiu
Copy link
Member

get_editor_interface().inspect_object(self) does show it in inspector but when I click somewhere that inspector with exported variable disappear until plugin re-enable again.

That's how Inspector works. I think what you need is your own UI in the dock then :)

@nongvantinh
Copy link
Contributor Author

nongvantinh commented Jun 13, 2021

To the beginning. I can not export variable or create some UI node's PackedScene, Material, ResourceLoader, ...
I think it's the limit of the engine. This is not even a bug.

@timothyqiu
Copy link
Member

In case you only want the exported variable when needed instead of always show it, you can use that code snippet to inspect your plugin again when needed (e.g. pressing a button in your dock panel).

@me2beats
Copy link

This is just a node, not a scene, so exported vars won't be saved.
You can create a scene with a script and export vars then add it on the plugin _enter_tree() (scene.instance(); add_child()).

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

4 participants