0 votes

Is anybody aware of a convenient way to convert a scene to an EditorPlugin/custom node? Right now I'm just adding the code, that's needed to instance all the nodes in the scene, but I wondered if there is something more convenient?

in Engine by (840 points)

1 Answer

+1 vote

Take a look at my Snippet Editor Plugin Code.
https://github.com/gswashburn/Snippets-EditorPlugin

I used a scene in my editor plugin. The only issue I had, was accessing certain Editor Only settings, but I passed values to the scene from editorplugin script. (see Below) You can ref variables in other scenes.

func _enter_tree(): 
    # First load the dock scene and instance it:
    dock = preload("res://addons/snippets_plugin/snippets_dock.tscn").instance()
    # Add the loaded scene to the docks:
    add_control_to_dock( EditorPlugin.DOCK_SLOT_LEFT_BR, dock)

func get_ext_editor():
    # Check for external editor in Editor Settings
    var ext_editor = ed.get_setting("text_editor/external/exec_path")
    if not ext_editor == "":
        dock.ext_editor_path = ext_editor
    else:
        dock.ext_editor_path = ""
by (204 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.