0 votes

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

in Engine by (168 points)

I don't know what should happen when you click the button,
but you should not need to call addchild again, it should already be called in addcontroltobottom_panel

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?

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)

1 Answer

+2 votes
Best answer

Set rect_min_size.y.

Try this:

var editor_viewport = get_editor_interface().get_editor_viewport()
yield(get_tree(), 'idle_frame')
a_new_control.rect_min_size.y = editor_viewport.rect_size.y * 0.49
by (4,077 points)
selected by

Thanks , this is exactly what I wanted. though I don't understand it.

Same, it must have something to do with how Godot UI system works.

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.