Improve EditorPlugin.xml and EditorInterface.xml

(cherry picked from commit a0efe25c9e)
This commit is contained in:
char0xff 2018-09-18 16:38:19 +02:00 committed by Rémi Verschelde
parent 5d7a22e6d9
commit 51317569f9
3 changed files with 34 additions and 22 deletions

View File

@ -48,7 +48,7 @@
[/codeblock] [/codeblock]
</description> </description>
<tutorials> <tutorials>
<link>http://docs.godotengine.org/en/3.0/tutorials/plugins/editor/import_plugins.html</link> http://docs.godotengine.org/en/3.0/tutorials/plugins/editor/import_plugins.html
</tutorials> </tutorials>
<demos> <demos>
</demos> </demos>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorInterface" inherits="Node" category="Core" version="3.0.7"> <class name="EditorInterface" inherits="Node" category="Core" version="3.0.7">
<brief_description> <brief_description>
Editor interface and main components. Godot editor's interface.
</brief_description> </brief_description>
<description> <description>
Editor interface. Allows saving and (re-)loading scenes, rendering mesh previews, inspecting and editing resources and objects and provides access to [EditorSettings], [EditorFileSystem], [EditorResourcePreview]\ er, [ScriptEditor], the editor viewport, as well as information about scenes. Also see [EditorPlugin] and [EditorScript]. EditorInterface gives you control over Godot editor's window. It allows customizing the window, saving and (re-)loading scenes, rendering mesh previews, inspecting and editing resources and objects, and provides access to [EditorSettings], [EditorFileSystem], [EditorResourcePreview], [ScriptEditor], the editor viewport, and information about scenes.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -24,14 +24,14 @@
<return type="Control"> <return type="Control">
</return> </return>
<description> <description>
Returns the main container of Godot's editor window. You can use it, for example, to retrieve the size of the container and place your controls accordingly. Returns the main container of Godot editor's window. You can use it, for example, to retrieve the size of the container and place your controls accordingly.
</description> </description>
</method> </method>
<method name="get_edited_scene_root"> <method name="get_edited_scene_root">
<return type="Node"> <return type="Node">
</return> </return>
<description> <description>
Returns the edited scene's root [Node]. Returns the edited (current) scene's root [Node].
</description> </description>
</method> </method>
<method name="get_editor_settings"> <method name="get_editor_settings">
@ -52,7 +52,7 @@
<return type="Array"> <return type="Array">
</return> </return>
<description> <description>
Returns an [Array] of the currently opened scenes. Returns an [Array] with the file paths of the currently opened scenes.
</description> </description>
</method> </method>
<method name="get_resource_filesystem"> <method name="get_resource_filesystem">
@ -66,7 +66,7 @@
<return type="EditorResourcePreview"> <return type="EditorResourcePreview">
</return> </return>
<description> <description>
Returns the [EditorResourcePreview]\ er. Returns the [EditorResourcePreview].
</description> </description>
</method> </method>
<method name="get_script_editor"> <method name="get_script_editor">

View File

@ -4,7 +4,7 @@
Used by the editor to extend its functionality. Used by the editor to extend its functionality.
</brief_description> </brief_description>
<description> <description>
Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins. Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins. Also see [EditorScript] to add functions to the editor.
</description> </description>
<tutorials> <tutorials>
http://docs.godotengine.org/en/3.0/development/plugins/index.html http://docs.godotengine.org/en/3.0/development/plugins/index.html
@ -20,7 +20,7 @@
<argument index="1" name="title" type="String"> <argument index="1" name="title" type="String">
</argument> </argument>
<description> <description>
Add a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. If your plugin is being removed, also make sure to remove your control by calling [method remove_control_from_bottom_panel]. Add a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_bottom_panel] and free it with [code]queue_free()[/code].
</description> </description>
</method> </method>
<method name="add_control_to_container"> <method name="add_control_to_container">
@ -33,7 +33,7 @@
<description> <description>
Add a custom control to a container (see CONTAINER_* enum). There are many locations where custom controls can be added in the editor UI. Add a custom control to a container (see CONTAINER_* enum). There are many locations where custom controls can be added in the editor UI.
Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it). Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
If your plugin is being removed, also make sure to remove your custom controls too. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_container] and free it with [code]queue_free()[/code].
</description> </description>
</method> </method>
<method name="add_control_to_dock"> <method name="add_control_to_dock">
@ -46,7 +46,7 @@
<description> <description>
Add the control to a specific dock slot (see DOCK_* enum for options). Add the control to a specific dock slot (see DOCK_* enum for options).
If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions. If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
If your plugin is being removed, also make sure to remove your control by calling [method remove_control_from_docks]. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_docks] and free it with [code]queue_free()[/code].
</description> </description>
</method> </method>
<method name="add_custom_type"> <method name="add_custom_type">
@ -63,7 +63,7 @@
<description> <description>
Add a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed. Add a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
When given node or resource is selected, the base type will be instanced (ie, "Spatial", "Control", "Resource"), then the script will be loaded and set to this object. When given node or resource is selected, the base type will be instanced (ie, "Spatial", "Control", "Resource"), then the script will be loaded and set to this object.
You can use the [method EditorPlugin.handles] to check if your custom object is being edited by checking the script or using 'is' keyword. You can use the virtual method [method handles] to check if your custom object is being edited by checking the script or using 'is' keyword.
During run-time, this will be a simple object with a script so this function does not need to be called then. During run-time, this will be a simple object with a script so this function does not need to be called then.
</description> </description>
</method> </method>
@ -99,6 +99,7 @@
<argument index="1" name="submenu" type="Object"> <argument index="1" name="submenu" type="Object">
</argument> </argument>
<description> <description>
Like [method add_tool_menu_item] but adds the [code]submenu[/code] item inside the [code]name[/code] menu.
</description> </description>
</method> </method>
<method name="apply_changes" qualifiers="virtual"> <method name="apply_changes" qualifiers="virtual">
@ -140,6 +141,12 @@
<argument index="0" name="event" type="InputEvent"> <argument index="0" name="event" type="InputEvent">
</argument> </argument>
<description> <description>
This method is called when there is an input event in the 2D viewport, e.g. the user clicks with the mouse in the 2D space (canvas GUI). Keep in mind that for this method to be called you have to first declare the virtual method [method handles] so the editor knows that you want to work with the workspace:
[codeblock]
func handles(object):
return true
[/codeblock]
Also note that the edited scene must have a root node.
</description> </description>
</method> </method>
<method name="forward_draw_over_viewport" qualifiers="virtual"> <method name="forward_draw_over_viewport" qualifiers="virtual">
@ -166,8 +173,12 @@
<argument index="1" name="event" type="InputEvent"> <argument index="1" name="event" type="InputEvent">
</argument> </argument>
<description> <description>
Implement this function if you are interested in 3D view screen input events. It will be called only if currently selected node is handled by your plugin. This method is called when there is an input event in the 3D viewport, e.g. the user clicks with the mouse in the 3D space (spatial GUI). Keep in mind that for this method to be called you have to first declare the virtual method [method handles] so the editor knows that you want to work with the workspace:
If you would like to always gets those input events then additionally use [method set_input_forwarding_always_enabled]. [codeblock]
func handles(object):
return true
[/codeblock]
Also note that the edited scene must have a root node.
</description> </description>
</method> </method>
<method name="get_breakpoints" qualifiers="virtual"> <method name="get_breakpoints" qualifiers="virtual">
@ -181,6 +192,7 @@
<return type="EditorInterface"> <return type="EditorInterface">
</return> </return>
<description> <description>
Return the [EditorInterface] object that gives you control over Godot editor's window and its functionalities.
</description> </description>
</method> </method>
<method name="get_plugin_icon" qualifiers="virtual"> <method name="get_plugin_icon" qualifiers="virtual">
@ -215,7 +227,7 @@
<argument index="0" name="layout" type="ConfigFile"> <argument index="0" name="layout" type="ConfigFile">
</argument> </argument>
<description> <description>
Get the GUI layout of the plugin. This is used to save the project's editor layout when the [method EditorPlugin.queue_save_layout] is called or the editor layout was changed(For example changing the position of a dock). Get the GUI layout of the plugin. This is used to save the project's editor layout when [method queue_save_layout] is called or the editor layout was changed(For example changing the position of a dock).
</description> </description>
</method> </method>
<method name="handles" qualifiers="virtual"> <method name="handles" qualifiers="virtual">
@ -224,14 +236,14 @@
<argument index="0" name="object" type="Object"> <argument index="0" name="object" type="Object">
</argument> </argument>
<description> <description>
Implement this function if your plugin edits a specific type of object (Resource or Node). If you return true, then you will get the functions [method EditorPlugin.edit] and [method EditorPlugin.make_visible] called when the editor requests them. Implement this function if your plugin edits a specific type of object (Resource or Node). If you return true, then you will get the functions [method EditorPlugin.edit] and [method EditorPlugin.make_visible] called when the editor requests them. If you have declared the methods [method forward_canvas_gui_input] and [method forward_spatial_gui_input] these will be called too.
</description> </description>
</method> </method>
<method name="has_main_screen" qualifiers="virtual"> <method name="has_main_screen" qualifiers="virtual">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Return true if this is a main screen editor plugin (it goes in the main screen selector together with 2D, 3D, Script). Return true if this is a main screen editor plugin (it goes in the workspaces selector together with '2D', '3D', and 'Script').
</description> </description>
</method> </method>
<method name="hide_bottom_panel"> <method name="hide_bottom_panel">
@ -271,7 +283,7 @@
<argument index="0" name="control" type="Control"> <argument index="0" name="control" type="Control">
</argument> </argument>
<description> <description>
Remove the control from the bottom panel. Don't forget to call this if you added one, so the editor can remove it cleanly. Remove the control from the bottom panel. You have to manually [code]queue_free()[/code] the control.
</description> </description>
</method> </method>
<method name="remove_control_from_container"> <method name="remove_control_from_container">
@ -282,7 +294,7 @@
<argument index="1" name="control" type="Control"> <argument index="1" name="control" type="Control">
</argument> </argument>
<description> <description>
Remove the control from the specified container. Use it when cleaning up after adding a control with [method add_control_to_container]. Note that you can simply free the control if you won't use it anymore. Remove the control from the specified container. You have to manually [code]queue_free()[/code] the control.
</description> </description>
</method> </method>
<method name="remove_control_from_docks"> <method name="remove_control_from_docks">
@ -291,7 +303,7 @@
<argument index="0" name="control" type="Control"> <argument index="0" name="control" type="Control">
</argument> </argument>
<description> <description>
Remove the control from the dock. Don't forget to call this if you added one, so the editor can save the layout and remove it cleanly. Remove the control from the dock. You have to manually [code]queue_free()[/code] the control.
</description> </description>
</method> </method>
<method name="remove_custom_type"> <method name="remove_custom_type">
@ -300,7 +312,7 @@
<argument index="0" name="type" type="String"> <argument index="0" name="type" type="String">
</argument> </argument>
<description> <description>
Remove a custom type added by [method EditorPlugin.add_custom_type] Remove a custom type added by [method add_custom_type]
</description> </description>
</method> </method>
<method name="remove_export_plugin"> <method name="remove_export_plugin">
@ -377,7 +389,7 @@
<argument index="0" name="screen_name" type="String"> <argument index="0" name="screen_name" type="String">
</argument> </argument>
<description> <description>
Emitted when user change main screen view (2D, 3D, Script, AssetLib). Works also with screens which are defined by plugins. Emitted when user change the workspace (2D, 3D, Script, AssetLib). Also works with custom screens defined by plugins.
</description> </description>
</signal> </signal>
<signal name="scene_changed"> <signal name="scene_changed">