Skip to content

EditorPlugin._edit is not called always when EditorPlugin._handles returns true #84673

Open
@AnidemDex

Description

@AnidemDex

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:

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

  1. Handle Resource
  2. Print something on _edit callback
  3. Create a node that export Resource variable
  4. Enable plugin
  5. Select the resource on the exported variable.

image
image

image

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

editorplugin_bug.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions