0 votes

I've been experimenting with inspector plugins to help with some more complex maintenance in my current project.

I've created a test scene to try instanciate it in the inspector with the set_bottom_editor() function, but I keep getting the error for condition p_child->get_parent() != this - that means the scene doesn't have a parent, right?

I got around that by adding the Control test scene as a child of the EditorProperty before setting it as bottom editor. Am I skipping some step here or is this the expected behavior?

Here's my current code:

MyInspectorPlugin.gd:

extends EditorInspectorPlugin

func can_handle(object):
    return true

func parse_property(object, type, path, hint, hint_text, usage):
    if type == TYPE_REAL:
        add_property_editor(path, MyCustomControl.new())
        return true
    else:
        return false

MyCustomControl.gd:

tool
extends EditorProperty
class_name MyCustomControl

var control_teste

func _init():
    control_teste = preload("res://controlTeste.tscn").instance()
    add_child(control_teste)
    set_bottom_editor(control_teste)

The ControlTeste scene is simply a full rect Control with a VBoxContainer and a bunch of labels.

Godot version 3.2.2
in Engine by (14 points)

Please log in or register to answer this question.

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.