Error when creating a custom inspector interface

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jpdurigan

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.