Topic was automatically imported from the old Question2Answer platform.
Asked By
lowpolygon
Hi , I have added a bottom menu item by using add_control_to_bottom_panel
and I am wondering if there is a way I can know if this menu item is currently open .
Because I need to add some conditions to check but only when this editor plugin /bottom menu item is being opened. But I can’t seem to find a way to know if this bottom menu is being opened
I see add_control_to_bottom_panel will return a button so I connected a signal on pressed which will call a function where it will change a boolean variable . But issue is that
instead of click on the menu item to close, when I clicked on another bottom menu item, script will not know this menu item is now closed
Edit : seems like I am not very clear on what I was asking. I apologize . Here is a screen grab , hopefully it helped
I was just dealing with this issue, and I’m positive there’s a better way of doing it, but this is what I did.
In your EditorPlugin class
func _process(delta):
var nodes = get_editor_interface().get_selection().get_selected_nodes()
var node
if nodes.size() == 1:
node = nodes[0]
if node.get_class() == "custom_node":
# now we know the editor is selecting your custom node, hide() or show() your button or dialogue
And then in your custom_node class
func get_class(): return "custom_node"
I’d also like someone else’s input, because this method doesn’t seem like the best way of doing it.
Thanks for the help.but it seems only works if I am opening the scene file of custom node and have it selected. I have attached a screen shot on what I was actually asking. Hope it clears up the confusion