diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 22ec0179aa8..240f396a933 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -267,15 +267,27 @@ - + + Override this method in your plugin to return a [Texture] in order to give it an icon. + For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons. + Ideally, the plugin icon should be white with a transparent background and 16x16 pixels in size. + [codeblock] + func get_plugin_icon(): + # You can use a custom icon: + return preload("res://addons/my_plugin/my_plugin_icon.svg") + # Or use a built-in icon: + return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons") + [/codeblock] + Override this method in your plugin to provide the name of the plugin when displayed in the Godot editor. + For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons. diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index b5f63dcd438..2ae41da187b 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -863,7 +863,7 @@ void EditorPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_plugin_name")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::OBJECT, "get_plugin_icon")); + ClassDB::add_virtual_method(get_class_static(), MethodInfo(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "get_plugin_icon")); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "has_main_screen")); ClassDB::add_virtual_method(get_class_static(), MethodInfo("make_visible", PropertyInfo(Variant::BOOL, "visible"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("edit", PropertyInfo(Variant::OBJECT, "object")));