项目作者: Xrayez

项目描述 :
Plugin to preview all available icons in Godot Editor.
高级语言: GDScript
项目地址: git://github.com/Xrayez/godot-editor-icons-previewer.git
创建时间: 2019-07-30T16:47:17Z
项目社区:https://github.com/Xrayez/godot-editor-icons-previewer

开源协议:MIT License

下载


Godot Editor Icons Previewer

Godot plugin which adds ability to preview all available icons in Godot Editor.
Can be used to facilitate the process of developing neat user interfaces for
Godot editor plugins without the need to import any custom icons.

Compatibility

Godot 3.0+ compatible. Note that in version 3.0, there’s no menu option, but the
plugin is still accesible via a shortcut (see below).
For the Godot 4 version, see here : latest version

Usage

To read the full documentation, which will be kept updated as more features come in, read the documentation

Navigate to Project > Tools and click Show Editor Icons menu option
(Alt+I shortcut is also available for this):

Show Editor Icons

A window shall popup listing all available editor icons which Godot uses natively
(can also show icons from any custom C++ module):

Editor Icons

Hovering on icons will show their internal name to be used when developing plugins.
In order to use the icon in your plugins, you can fetch it via code like so:

  1. button.icon = get_icon('Add', 'EditorIcons')

To simplify the process even further, you can also get the above snippet by
right-clicking on an icon and it will be copied to your clipboard. Left-clicking
just copies the raw icon’s name.

Caveats

  1. In some cases, a control might not have a theme inherited from Godot’s base
    control as it can be overriden. For a more sophisticated way on how to get an
    icon from Godot’s base control, see
    editor_plugin_utils.gd.

  2. The get_icon() method is meant to be used in EditorPlugins. If you really
    want to use this in plain tool scripts from within the editor, an icon can
    be fetched with the following snippet:

    1. tool
    2. extends Node2D # This can be anything.
    3. func _draw():
    4. if Engine.editor_hint:
    5. # Find internal `EditorNode` class.
    6. var editor_node = get_tree().get_root().get_child(0)
    7. # Get internal GUI base.
    8. # This is equivalent to `EditorInterface.get_base_control()`.
    9. var gui_base = editor_node.get_gui_base()
    10. # Get icon from the base control.
    11. var icon_add = gui_base.get_icon("Add", "EditorIcons")
    12. # Draw the icon.
    13. draw_texture(icon_add, Vector2())

    This approach may not always work across Godot versions as this relies on
    internal functionality behind EditorNode.

  3. This won’t work for outside the editor.