Open
Description
Godot version
v4.2.beta5.official [4c96e96]
System information
Godot v4.2.beta5 - Manjaro Linux #1 SMP PREEMPT_DYNAMIC Sun Jul 16 16:48:53 UTC 2023 - Wayland - GLES3 (Compatibility) - Mesa Intel(R) UHD Graphics 600 (GLK 2) () - Intel(R) Celeron(R) N4020 CPU @ 1.10GHz (2 Threads)
Issue description
Accordding to EditorPlugin
documentation, returning true
on _handles
will call _edit
and _make_visible
, which is partially true.
Editor will not call _edit
for:
- Subresources inspected in a collection (
EditorPlugin.edit
is not called whenEditorPlugin.handles()
returnstrue
for objects inside collections #56797) - A resource inspected in another object property (this at least worked back before in Godot 3)
Even if _handles
is true
.
This is true for all Godot 4 versions (I'm working on Godot 4.0 and tested with all releases)
Steps to reproduce
- Handle
Resource
- Print something on
_edit
callback - Create a node that export
Resource
variable - Enable plugin
- Select the resource on the exported variable.
Minimal reproduction project
Just in case you can't download the project
extends Node
# Scene script
@export var resource:Resource
@export var array_of_resources:Array[Resource]
@tool
extends EditorPlugin
# Plugin Script
class FakeMainScreen extends PanelContainer:
pass
var fake_screen := FakeMainScreen.new()
func _enter_tree() -> void:
get_editor_interface().get_editor_main_screen().add_child(fake_screen)
pass
func _handles(object: Object) -> bool:
prints("Handles %s?"%object, object is Resource)
return object is Resource
func _edit(object: Object) -> void:
prints("Editing:", object)
func _make_visible(visible: bool) -> void:
prints("Make main screen visible?", visible)
if is_instance_valid(fake_screen): fake_screen.visible = visible
func _has_main_screen() -> bool: return true
func _get_plugin_name() -> String: return "FakeMainScreen"
func _get_plugin_icon() -> Texture2D:
return get_editor_interface().get_base_control().get_theme_icon("Node", "EditorIcons")
func _exit_tree() -> void:
fake_screen.queue_free()
pass