Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | lowpolygon |
According to doc I need a control so I have a scene with a Control node , under the control node I have a panel and a label with the text “Test”
In my script I have the following code:
tool
extends EditorPlugin
var a_panel = preload("res://addons/add_bottom_menu/bottom_test.tscn")
var a_new_control := Control.new()
func _ready():
a_new_control = a_panel.instance()
add_control_to_bottom_panel(a_new_control,"My Plugin")
call_deferred("add_child",a_new_control)
I did see a new button appears at the bottom menu with the name MY Plugin. But when I click on it ,nothing happens.
I searched google and found nothing. And doc is really not helping
I don’t know what should happen when you click the button,
but you should not need to call add_child again, it should already be called in add_control_to_bottom_panel
ATom 1 | 2020-01-09 09:42
ok, I took out the line . And I also noticed that that test panel did appear, but it shows up at the bottom of the screen where I can’t see. How would I go about setting the position?
lowpolygon | 2020-01-09 09:48
Should the position of the panel be above the button? Or, you did n’t actively set the panel position at all. If changing the position does not work, I think it should be limited by the layout?
But I don’t know much about layout. The most common way to set the position is to use transform.origin (relative to the position of the parent node)
ATom 1 | 2020-01-09 10:40
About position : Size and anchors — Godot Engine (3.1) documentation in English
About layout : Containers — Godot Engine (3.1) documentation in English
ATom 1 | 2020-01-09 10:49