MikeSchulze / gdUnit4

A Godot Unit Test Framework. Support for GDScript and C# unit testing
MIT License
565 stars 30 forks source link

GD-508: Revisit the `EditorFileSystemContextMenuHandler` added to the root node #508

Closed MikeSchulze closed 3 months ago

MikeSchulze commented 3 months ago

Describe What The EditorFileSystemContextMenuHandler is added to the root node and removed at plugin exit and results into problems. Instead, we should add it as child to the GdUnit inspector to be managed by this component instead of during manually delete at plugin exit via dispose.

Dev hints res://addons/gdUnit4/src/ui/EditorFileSystemControls.gd

# Register the given context menu to the filesystem dock
# Is called when the plugin is activated
# The filesystem popup is connected to the EditorFileSystemContextMenuHandler
static func register_context_menu(menu: Array[GdUnitContextMenuItem]) -> void:
    Engine.get_main_loop().root.add_child.call_deferred(EditorFileSystemContextMenuHandler.new(menu))

# Unregisteres all registerend context menus and gives the EditorFileSystemContextMenuHandler> free
# Is called when the plugin is deactivated
static func unregister_context_menu() -> void:
    EditorFileSystemContextMenuHandler.dispose()