Added inspector plugin documentation.

Fixed plugin bindings.
This commit is contained in:
Juan Linietsky 2019-04-23 16:39:09 -03:00
parent f2c26098a9
commit 325f6c6581
15 changed files with 162 additions and 6 deletions

View file

@ -101,6 +101,20 @@
<description>
</description>
</method>
<method name="set_frustum">
<return type="void">
</return>
<argument index="0" name="size" type="float">
</argument>
<argument index="1" name="offset" type="Vector2">
</argument>
<argument index="2" name="z_near" type="float">
</argument>
<argument index="3" name="z_far" type="float">
</argument>
<description>
</description>
</method>
<method name="set_orthogonal">
<return type="void">
</return>
@ -156,6 +170,8 @@
<member name="fov" type="float" setter="set_fov" getter="get_fov">
The camera's field of view angle (in degrees). Only applicable in perspective mode. Since [member keep_aspect] locks one axis, [code]fov[/code] sets the other axis' field of view angle.
</member>
<member name="frustum_offset" type="Vector2" setter="set_frustum_offset" getter="get_frustum_offset">
</member>
<member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset">
The horizontal (X) offset of the Camera viewport.
</member>
@ -182,6 +198,8 @@
<constant name="PROJECTION_ORTHOGONAL" value="1" enum="Projection">
Orthogonal Projection (objects remain the same size on the screen no matter how far away they are).
</constant>
<constant name="PROJECTION_FRUSTUM" value="2" enum="Projection">
</constant>
<constant name="KEEP_WIDTH" value="0" enum="KeepAspect">
Preserves the horizontal aspect ratio.
</constant>

View file

@ -97,6 +97,10 @@
</argument>
<argument index="2" name="normal_map" type="Texture" default="null">
</argument>
<argument index="3" name="transform" type="Transform2D" default="Transform2D( 1, 0, 0, 1, 0, 0 )">
</argument>
<argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<description>
</description>
</method>

View file

@ -1,8 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorInspectorPlugin" inherits="Reference" category="Core" version="3.2">
<brief_description>
Plugin for adding custom property editors on inspector.
</brief_description>
<description>
This plugins allows adding custom property editors to [EditorInspector].
Plugins are registered via [method EditorPlugin.add_inspector_plugin].
When an object is edited, the [method can_handle] function is called and must return true if the object type is supported.
If supported, the function [method parse_begin] will be called, allowing to place custom controls at the beginning of the class.
Subsequently, the [method parse_category] and [method parse_property] are called for every category and property. They offer the ability to add custom controls to the inspector too.
Finally [method parse_end] will be called.
On each of these calls, the "add" functions can be called.
</description>
<tutorials>
</tutorials>
@ -13,6 +21,7 @@
<argument index="0" name="control" type="Control">
</argument>
<description>
Add a custom control, not necesarily a property editor.
</description>
</method>
<method name="add_property_editor">
@ -23,6 +32,7 @@
<argument index="1" name="editor" type="Control">
</argument>
<description>
Add a property editor, this must inherit [EditorProperty].
</description>
</method>
<method name="add_property_editor_for_multiple_properties">
@ -35,6 +45,7 @@
<argument index="2" name="editor" type="Control">
</argument>
<description>
Add am editor that allows modifying multiple properties, this must inherit [EditorProperty].
</description>
</method>
<method name="can_handle" qualifiers="virtual">
@ -43,6 +54,7 @@
<argument index="0" name="object" type="Object">
</argument>
<description>
Return true if this object can be handled by this plugin.
</description>
</method>
<method name="parse_begin" qualifiers="virtual">
@ -51,6 +63,7 @@
<argument index="0" name="object" type="Object">
</argument>
<description>
Called to allow adding controls at the beginning of the list.
</description>
</method>
<method name="parse_category" qualifiers="virtual">
@ -61,12 +74,14 @@
<argument index="1" name="category" type="String">
</argument>
<description>
Called to allow adding controls at the beginning of the category.
</description>
</method>
<method name="parse_end" qualifiers="virtual">
<return type="void">
</return>
<description>
Called to allow adding controls at the end of the list.
</description>
</method>
<method name="parse_property" qualifiers="virtual">
@ -85,6 +100,7 @@
<argument index="5" name="usage" type="int">
</argument>
<description>
Called to allow adding property specific editors to the inspector. Usually these inherit [EditorProperty]
</description>
</method>
</methods>

View file

@ -1,12 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorProperty" inherits="Container" category="Core" version="3.2">
<brief_description>
Custom control to edit properties for adding into the inspector
</brief_description>
<description>
This control allows property editing for one or multiple properties into [EditorInspector]. It is added via [EditorInspectorPlugin].
</description>
<tutorials>
</tutorials>
<methods>
<method name="add_focusable">
<return type="void">
</return>
<argument index="0" name="control" type="Control">
</argument>
<description>
If any of the controls added can gain keyboard focus, add it here. This ensures that focus will be restored if the inspector is refreshed.
</description>
</method>
<method name="emit_changed">
<return type="void">
</return>
@ -19,45 +30,65 @@
<argument index="3" name="changing" type="bool" default="false">
</argument>
<description>
If one (or many properties) changed, this must be called. "Field" is used in case your editor can modify fields separately (as an example, Vector3.x). The "changing" argument avoids the editor requesting this property to be refreshed (leave as false if unsure).
</description>
</method>
<method name="get_edited_object">
<return type="Object">
</return>
<description>
Get the edited object.
</description>
</method>
<method name="get_edited_property">
<return type="String">
</return>
<description>
Get the edited property. If your editor is for a single property (added via [method EditorInspectorPlugin.parse_property]), then this will return it..
</description>
</method>
<method name="get_tooltip_text" qualifiers="const">
<return type="String">
</return>
<description>
Override if you want to allow a custom tooltip over your property.
</description>
</method>
<method name="set_bottom_editor">
<return type="void">
</return>
<argument index="0" name="editor" type="Control">
</argument>
<description>
Add controls with this function if you want them on the bottom (below the label).
</description>
</method>
<method name="update_property" qualifiers="virtual">
<return type="void">
</return>
<description>
When this virtual function is called, you must update your editor.
</description>
</method>
</methods>
<members>
<member name="checkable" type="bool" setter="set_checkable" getter="is_checkable">
Used by the inspector, set when property is checkable.
</member>
<member name="checked" type="bool" setter="set_checked" getter="is_checked">
Used by the inspector, when the property is checked.
</member>
<member name="draw_red" type="bool" setter="set_draw_red" getter="is_draw_red">
Used by the inspector, when the property must draw with error color.
</member>
<member name="keying" type="bool" setter="set_keying" getter="is_keying">
Used by the inspector, when the property can add keys for animation/
</member>
<member name="label" type="String" setter="set_label" getter="get_label">
Set this property to change the label (if you want to show one)
</member>
<member name="read_only" type="bool" setter="set_read_only" getter="is_read_only">
Used by the inspector, when the property is read-only.
</member>
</members>
<signals>
@ -67,6 +98,7 @@
<argument index="1" name="value" type="Array">
</argument>
<description>
Emit yourself if you want multiple properties modified at the same time. Do not use if added via [method EditorInspectorPlugin.parse_property]
</description>
</signal>
<signal name="object_id_selected">
@ -75,6 +107,7 @@
<argument index="1" name="id" type="int">
</argument>
<description>
Used by sub-inspectors. Emit if what was selected was an Object ID.
</description>
</signal>
<signal name="property_changed">
@ -83,6 +116,7 @@
<argument index="1" name="value" type="Nil">
</argument>
<description>
Do not emit this manually, use the [method emit_changed] method instead.
</description>
</signal>
<signal name="property_checked">
@ -91,12 +125,14 @@
<argument index="1" name="bool" type="String">
</argument>
<description>
Used internally, when a property was checked.
</description>
</signal>
<signal name="property_keyed">
<argument index="0" name="property" type="String">
</argument>
<description>
Emit if you want to add this value as an animation key (check keying being enabled first).
</description>
</signal>
<signal name="property_keyed_with_value">
@ -105,6 +141,7 @@
<argument index="1" name="value" type="Nil">
</argument>
<description>
Emit if you want to key a property with a single value.
</description>
</signal>
<signal name="resource_selected">
@ -113,6 +150,7 @@
<argument index="1" name="resource" type="Resource">
</argument>
<description>
If you want a sub-resource to be edited, emit this signal with the resource.
</description>
</signal>
<signal name="selected">
@ -121,6 +159,7 @@
<argument index="1" name="focusable_idx" type="int">
</argument>
<description>
Internal, used when selected.
</description>
</signal>
</signals>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="MeshTexture" inherits="Texture" category="Core" version="3.2">
<brief_description>
Simple texture that uses a mesh to draw itself.
</brief_description>
<description>
Simple texture that uses a mesh to draw itself. It's limited because flags can't be changed and region drawing is not supported.
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<members>
<member name="base_texture" type="Texture" setter="set_base_texture" getter="get_base_texture">
Set the base texture that the Mesh will use to draw.
</member>
<member name="image_size" type="Vector2" setter="set_image_size" getter="get_image_size">
Set the size of the image, needed for reference.
</member>
<member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
Set the mesh used to draw. It must be a mesh using 2D vertices.
</member>
</members>
<constants>
</constants>
</class>

View file

@ -116,6 +116,8 @@
<member name="transform_format" type="int" setter="set_transform_format" getter="get_transform_format" enum="MultiMesh.TransformFormat">
Format of transform used to transform mesh, either 2D or 3D.
</member>
<member name="visible_instance_count" type="int" setter="set_visible_instance_count" getter="get_visible_instance_count">
</member>
</members>
<constants>
<constant name="TRANSFORM_2D" value="0" enum="TransformFormat">

View file

@ -57,8 +57,7 @@
<constant name="OBJECT_NODE_COUNT" value="10" enum="Monitor">
Number of nodes currently instanced in the scene tree. This also includes the root node.
</constant>
<constant name="OBJECT_ORPHANS_NODE_COUNT" value="11" enum="Monitor">
Number of instanced nodes that aren't included in the scene tree.
<constant name="OBJECT_ORPHAN_NODE_COUNT" value="11" enum="Monitor">
</constant>
<constant name="RENDER_OBJECTS_IN_FRAME" value="12" enum="Monitor">
3D objects drawn per frame.

View file

@ -113,6 +113,8 @@
</description>
</method>
<method name="sha256_string">
<return type="String">
</return>
<description>
Return SHA256 string of the PoolByteArray.
</description>

View file

@ -134,6 +134,12 @@
<description>
</description>
</method>
<method name="localize_rests">
<return type="void">
</return>
<description>
</description>
</method>
<method name="physical_bones_add_collision_exception">
<return type="void">
</return>

View file

@ -418,6 +418,14 @@
Emitted when the cursor changes.
</description>
</signal>
<signal name="info_clicked">
<argument index="0" name="row" type="int">
</argument>
<argument index="1" name="info" type="String">
</argument>
<description>
</description>
</signal>
<signal name="request_completion">
<description>
</description>

View file

@ -14,6 +14,18 @@
Returns the [AABB] (also known as the bounding box) for this VisualInstance.
</description>
</method>
<method name="get_base" qualifiers="const">
<return type="RID">
</return>
<description>
</description>
</method>
<method name="get_instance" qualifiers="const">
<return type="RID">
</return>
<description>
</description>
</method>
<method name="get_layer_mask_bit" qualifiers="const">
<return type="bool">
</return>

View file

@ -66,6 +66,22 @@
<description>
</description>
</method>
<method name="camera_set_frustum">
<return type="void">
</return>
<argument index="0" name="camera" type="RID">
</argument>
<argument index="1" name="size" type="float">
</argument>
<argument index="2" name="offset" type="Vector2">
</argument>
<argument index="3" name="z_near" type="float">
</argument>
<argument index="4" name="z_far" type="float">
</argument>
<description>
</description>
</method>
<method name="camera_set_orthogonal">
<return type="void">
</return>
@ -173,12 +189,15 @@
</argument>
<argument index="1" name="mesh" type="RID">
</argument>
<argument index="2" name="texture" type="RID">
<argument index="2" name="texture" type="Transform2D">
</argument>
<argument index="3" name="normal_map" type="RID">
<argument index="3" name="normal_map" type="Color">
</argument>
<argument index="4" name="arg4" type="RID">
</argument>
<argument index="5" name="arg5" type="RID">
</argument>
<description>
Adds a [Mesh] to the [CanvasItem]'s draw commands. Only affects its aabb at the moment.
</description>
</method>
<method name="canvas_item_add_multimesh">

View file

@ -805,6 +805,9 @@ void EditorProperty::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tooltip_text"), &EditorProperty::get_tooltip_text);
ClassDB::bind_method(D_METHOD("add_focusable", "control"), &EditorProperty::add_focusable);
ClassDB::bind_method(D_METHOD("set_bottom_editor", "editor"), &EditorProperty::set_bottom_editor);
ClassDB::bind_method(D_METHOD("emit_changed", "property", "value", "field", "changing"), &EditorProperty::emit_changed, DEFVAL(StringName()), DEFVAL(false));
ADD_PROPERTY(PropertyInfo(Variant::STRING, "label"), "set_label", "get_label");

View file

@ -11,6 +11,8 @@
<methods>
</methods>
<members>
<member name="material" type="Material" setter="set_material" getter="get_material">
</member>
<member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
The mesh resource to use as a CSG shape.
</member>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CSGShape" inherits="VisualInstance" category="Core" version="3.2">
<class name="CSGShape" inherits="GeometryInstance" category="Core" version="3.2">
<brief_description>
The CSG base class.
</brief_description>