From 33ce099dda4c9da5d1295a3b544c5be7a51abfae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 10 Feb 2019 13:20:15 +0100 Subject: [PATCH] Sync classref with current source --- classes/class_animatedtexture.rst | 43 ++++++++++- classes/class_camera.rst | 6 ++ classes/class_csgshape.rst | 28 ++++--- classes/class_editorspatialgizmo.rst | 86 ++++++++++++++-------- classes/class_editorspatialgizmoplugin.rst | 50 ++++++++++++- classes/class_expression.rst | 6 +- classes/class_image.rst | 13 +++- classes/class_multimesh.rst | 34 ++++++--- classes/class_node.rst | 8 ++ classes/class_physicsdirectbodystate.rst | 2 +- classes/class_physicsdirectspacestate.rst | 2 +- classes/class_popupmenu.rst | 2 +- classes/class_resourcepreloader.rst | 14 ++-- classes/class_rigidbody.rst | 2 +- classes/class_rigidbody2d.rst | 2 +- classes/class_websocketclient.rst | 4 +- classes/class_websocketserver.rst | 4 +- 17 files changed, 234 insertions(+), 72 deletions(-) diff --git a/classes/class_animatedtexture.rst b/classes/class_animatedtexture.rst index ae9cca530..21cb72a7e 100644 --- a/classes/class_animatedtexture.rst +++ b/classes/class_animatedtexture.rst @@ -14,7 +14,7 @@ AnimatedTexture Brief Description ----------------- - +Proxy texture for simple frame-based animations. Properties ---------- @@ -38,6 +38,22 @@ Methods | void | :ref:`set_frame_texture` **(** :ref:`int` frame, :ref:`Texture` texture **)** | +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +Constants +--------- + +.. _class_AnimatedTexture_constant_MAX_FRAMES: + +- **MAX_FRAMES** = **256** --- The maximum number of frames supported by ``AnimatedTexture``. If you need more frames in your animation, use :ref:`AnimationPlayer` or :ref:`AnimatedSprite`. + +Description +----------- + +``AnimatedTexture`` is a resource format for simple frame-based animations, where multiple frames textures can be chained automatically with a predefined delay for each frame. It's not a :ref:`Node`, contrarily to :ref:`AnimationPlayer` or :ref:`AnimatedSprite`, but has the advantage of being usable at any place where a :ref:`Texture` resource can be used, e.g. in a :ref:`TileSet`. + +The playback of the animation is controlled by the :ref:`fps` property as well as each frame's optional delay (see :ref:`set_frame_delay`). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame. + +``AnimatedTexture`` currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one. + Property Descriptions --------------------- @@ -51,6 +67,10 @@ Property Descriptions | *Getter* | get_fps() | +----------+----------------+ +Number of frames per second. This value defines the default time interval between two frames of the animation, and thus the overall duration of the animation loop based on the :ref:`frames` property. A value of 0 means no predefined number of frames per second, the animation will play according to each frame's frame delay (see :ref:`set_frame_delay`). Default value: 4. + +For example, an animation with 8 frames, no frame delay and a ``fps`` value of 2 will run over 4 seconds, with one frame each 0.5 seconds. + .. _class_AnimatedTexture_property_frames: - :ref:`int` **frames** @@ -61,6 +81,8 @@ Property Descriptions | *Getter* | get_frames() | +----------+-------------------+ +Number of frames to use in the animation. While you can create the frames independently with :ref:`set_frame_texture`, you need to set this value for the animation to take new frames into account. The maximum number of frames is :ref:`MAX_FRAMES`. Default value: 1. + Method Descriptions ------------------- @@ -68,15 +90,34 @@ Method Descriptions - :ref:`float` **get_frame_delay** **(** :ref:`int` frame **)** const +Retrieves the delayed assigned to the given ``frame`` ID. + .. _class_AnimatedTexture_method_get_frame_texture: - :ref:`Texture` **get_frame_texture** **(** :ref:`int` frame **)** const +Retrieves the :ref:`Texture` assigned to the given ``frame`` ID. + .. _class_AnimatedTexture_method_set_frame_delay: - void **set_frame_delay** **(** :ref:`int` frame, :ref:`float` delay **)** +Defines an additional delay (in seconds) between this frame and the next one, that will be added to the time interval defined by :ref:`fps`. By default, frames have no delay defined. If a delay value is defined, the final time interval between this frame and the next will be ``1.0 / fps + delay``. + +For example, for an animation with 3 frames, 2 FPS and a frame delay on the second frame of 1.2, the resulting playback will be: + +:: + + Frame 0: 0.5 s (1 / fps) + Frame 1: 1.7 s (1 / fps + 1.2) + Frame 2: 0.5 s (1 / fps) + Total duration: 2.7 s + .. _class_AnimatedTexture_method_set_frame_texture: - void **set_frame_texture** **(** :ref:`int` frame, :ref:`Texture` texture **)** +Assigns a :ref:`Texture` to the given ``frame`` ID. IDs start at 0 (so the first frame has ID 0, and the last frame of the animation has ID :ref:`frames` - 1). + +You can define any frame texture up to :ref:`MAX_FRAMES`, but keep in mind that only frames from 0 to :ref:`frames` - 1 will be part of the animation. + diff --git a/classes/class_camera.rst b/classes/class_camera.rst index 9667f9829..326b07904 100644 --- a/classes/class_camera.rst +++ b/classes/class_camera.rst @@ -57,6 +57,8 @@ Methods +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_cull_mask_bit` **(** :ref:`int` layer **)** const | +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`Array` | :ref:`get_frustum` **(** **)** const | ++-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_position_behind` **(** :ref:`Vector3` world_point **)** const | +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`make_current` **(** **)** | @@ -292,6 +294,10 @@ Gets the camera transform. Subclassed cameras (such as CharacterCamera) may prov - :ref:`bool` **get_cull_mask_bit** **(** :ref:`int` layer **)** const +.. _class_Camera_method_get_frustum: + +- :ref:`Array` **get_frustum** **(** **)** const + .. _class_Camera_method_is_position_behind: - :ref:`bool` **is_position_behind** **(** :ref:`Vector3` world_point **)** const diff --git a/classes/class_csgshape.rst b/classes/class_csgshape.rst index b03b65a74..c380d55cf 100644 --- a/classes/class_csgshape.rst +++ b/classes/class_csgshape.rst @@ -38,17 +38,19 @@ Properties Methods ------- -+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`bool` | :ref:`get_collision_layer_bit` **(** :ref:`int` bit **)** const | -+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`bool` | :ref:`get_collision_mask_bit` **(** :ref:`int` bit **)** const | -+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`bool` | :ref:`is_root_shape` **(** **)** const | -+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`set_collision_layer_bit` **(** :ref:`int` bit, :ref:`bool` value **)** | -+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`set_collision_mask_bit` **(** :ref:`int` bit, :ref:`bool` value **)** | -+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ ++---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`bool` | :ref:`get_collision_layer_bit` **(** :ref:`int` bit **)** const | ++---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`bool` | :ref:`get_collision_mask_bit` **(** :ref:`int` bit **)** const | ++---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`Array` | :ref:`get_meshes` **(** **)** const | ++---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`bool` | :ref:`is_root_shape` **(** **)** const | ++---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`set_collision_layer_bit` **(** :ref:`int` bit, :ref:`bool` value **)** | ++---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`set_collision_mask_bit` **(** :ref:`int` bit, :ref:`bool` value **)** | ++---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ Enumerations ------------ @@ -166,6 +168,10 @@ Returns an individual bit on the collision mask. Returns an individual bit on the collision mask. +.. _class_CSGShape_method_get_meshes: + +- :ref:`Array` **get_meshes** **(** **)** const + .. _class_CSGShape_method_is_root_shape: - :ref:`bool` **is_root_shape** **(** **)** const diff --git a/classes/class_editorspatialgizmo.rst b/classes/class_editorspatialgizmo.rst index 43a639482..25cdace74 100644 --- a/classes/class_editorspatialgizmo.rst +++ b/classes/class_editorspatialgizmo.rst @@ -19,40 +19,46 @@ Custom gizmo for editing Spatial objects. Methods ------- -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`add_collision_segments` **(** :ref:`PoolVector3Array` segments **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`add_collision_triangles` **(** :ref:`TriangleMesh` triangles **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`add_handles` **(** :ref:`PoolVector3Array` handles, :ref:`Material` material, :ref:`bool` billboard=false, :ref:`bool` secondary=false **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`add_lines` **(** :ref:`PoolVector3Array` lines, :ref:`Material` material, :ref:`bool` billboard=false **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`add_mesh` **(** :ref:`ArrayMesh` mesh, :ref:`bool` billboard=false, :ref:`RID` skeleton **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`add_unscaled_billboard` **(** :ref:`Material` material, :ref:`float` default_scale=1 **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`clear` **(** **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`commit_handle` **(** :ref:`int` index, :ref:`Variant` restore, :ref:`bool` cancel=false **)** virtual | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`String` | :ref:`get_handle_name` **(** :ref:`int` index **)** virtual | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`Variant` | :ref:`get_handle_value` **(** :ref:`int` index **)** virtual | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`redraw` **(** **)** virtual | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`set_handle` **(** :ref:`int` index, :ref:`Camera` camera, :ref:`Vector2` point **)** virtual | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`set_hidden` **(** :ref:`bool` hidden **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| void | :ref:`set_spatial_node` **(** :ref:`Node` node **)** | -+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`add_collision_segments` **(** :ref:`PoolVector3Array` segments **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`add_collision_triangles` **(** :ref:`TriangleMesh` triangles **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`add_handles` **(** :ref:`PoolVector3Array` handles, :ref:`Material` material, :ref:`bool` billboard=false, :ref:`bool` secondary=false **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`add_lines` **(** :ref:`PoolVector3Array` lines, :ref:`Material` material, :ref:`bool` billboard=false **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`add_mesh` **(** :ref:`ArrayMesh` mesh, :ref:`bool` billboard=false, :ref:`RID` skeleton **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`add_unscaled_billboard` **(** :ref:`Material` material, :ref:`float` default_scale=1 **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`clear` **(** **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`commit_handle` **(** :ref:`int` index, :ref:`Variant` restore, :ref:`bool` cancel=false **)** virtual | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`String` | :ref:`get_handle_name` **(** :ref:`int` index **)** virtual | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`Variant` | :ref:`get_handle_value` **(** :ref:`int` index **)** virtual | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`EditorSpatialGizmoPlugin` | :ref:`get_plugin` **(** **)** const | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`Spatial` | :ref:`get_spatial_node` **(** **)** const | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`bool` | :ref:`is_handle_highlighted` **(** :ref:`int` index **)** virtual | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`redraw` **(** **)** virtual | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`set_handle` **(** :ref:`int` index, :ref:`Camera` camera, :ref:`Vector2` point **)** virtual | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`set_hidden` **(** :ref:`bool` hidden **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| void | :ref:`set_spatial_node` **(** :ref:`Node` node **)** | ++-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Description ----------- -Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. These are created by :ref:`EditorSpatialGizmoPlugin.create_gizmo`. +Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. See :ref:`EditorSpatialGizmoPlugin` for more information. Method Descriptions ------------------- @@ -115,7 +121,25 @@ Handles can be named for reference to the user when editing. - :ref:`Variant` **get_handle_value** **(** :ref:`int` index **)** virtual -Get actual value of a handle. This value can be anything and used for eventually undoing the motion when calling :ref:`commit_handle` +Get actual value of a handle. This value can be anything and used for eventually undoing the motion when calling :ref:`commit_handle`. + +.. _class_EditorSpatialGizmo_method_get_plugin: + +- :ref:`EditorSpatialGizmoPlugin` **get_plugin** **(** **)** const + +Return the :ref:`EditorSpatialGizmoPlugin` that owns this gizmo. It's useful to retrieve materials using :ref:`EditorSpatialGizmoPlugin.get_material`. + +.. _class_EditorSpatialGizmo_method_get_spatial_node: + +- :ref:`Spatial` **get_spatial_node** **(** **)** const + +Returns the Spatial node associated with this gizmo. + +.. _class_EditorSpatialGizmo_method_is_handle_highlighted: + +- :ref:`bool` **is_handle_highlighted** **(** :ref:`int` index **)** virtual + +Get whether a handle is highlighted or not. .. _class_EditorSpatialGizmo_method_redraw: diff --git a/classes/class_editorspatialgizmoplugin.rst b/classes/class_editorspatialgizmoplugin.rst index 7fde85315..acd0de269 100644 --- a/classes/class_editorspatialgizmoplugin.rst +++ b/classes/class_editorspatialgizmoplugin.rst @@ -14,7 +14,7 @@ EditorSpatialGizmoPlugin Brief Description ----------------- - +Used by the editor to define Spatial gizmo types. Methods ------- @@ -44,7 +44,7 @@ Methods +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_gizmo` **(** :ref:`Spatial` spatial **)** virtual | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`bool` | :ref:`is_gizmo_handle_highlighted` **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index **)** virtual | +| :ref:`bool` | :ref:`is_handle_highlighted` **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index **)** virtual | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_selectable_when_hidden` **(** **)** virtual | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -53,6 +53,16 @@ Methods | void | :ref:`set_handle` **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index, :ref:`Camera` camera, :ref:`Vector2` point **)** virtual | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +Description +----------- + +EditorSpatialGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending :ref:`EditorSpatialGizmoPlugin` for the simpler gizmos, or creating a new :ref:`EditorSpatialGizmo` type. See the tutorial in the documentation for more info. + +Tutorials +--------- + +- :doc:`../tutorials/plugins/editor/spatial_gizmos` + Method Descriptions ------------------- @@ -60,63 +70,95 @@ Method Descriptions - void **add_material** **(** :ref:`String` name, :ref:`SpatialMaterial` material **)** +Adds a new material to the internal material list for the plugin. It can then be accessed with :ref:`get_material`. Should not be overridden. + .. _class_EditorSpatialGizmoPlugin_method_can_be_hidden: - :ref:`bool` **can_be_hidden** **(** **)** virtual +Override this method to define whether the gizmo can be hidden or not. Defaults to true. + .. _class_EditorSpatialGizmoPlugin_method_commit_handle: - void **commit_handle** **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index, :ref:`Variant` restore, :ref:`bool` cancel=false **)** virtual +Override this method to commit gizmo handles. Called for this plugin's active gizmos. + .. _class_EditorSpatialGizmoPlugin_method_create_gizmo: - :ref:`EditorSpatialGizmo` **create_gizmo** **(** :ref:`Spatial` spatial **)** virtual +Override this method to return a custom :ref:`EditorSpatialGizmo` for the spatial nodes of your choice, return ``null`` for the rest of nodes. (See also :ref:`has_gizmo`) + .. _class_EditorSpatialGizmoPlugin_method_create_handle_material: - void **create_handle_material** **(** :ref:`String` name, :ref:`bool` billboard=false **)** +Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with :ref:`get_material` and used in :ref:`EditorSpatialGizmo.add_handles`. Should not be overridden. + .. _class_EditorSpatialGizmoPlugin_method_create_icon_material: - void **create_icon_material** **(** :ref:`String` name, :ref:`Texture` texture, :ref:`bool` on_top=false, :ref:`Color` color=Color( 1, 1, 1, 1 ) **)** +Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with :ref:`get_material` and used in :ref:`EditorSpatialGizmo.add_unscaled_billboard`. Should not be overridden. + .. _class_EditorSpatialGizmoPlugin_method_create_material: - void **create_material** **(** :ref:`String` name, :ref:`Color` color, :ref:`bool` billboard=false, :ref:`bool` on_top=false, :ref:`bool` use_vertex_color=false **)** +Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with :ref:`get_material` and used in :ref:`EditorSpatialGizmo.add_mesh` and :ref:`EditorSpatialGizmo.add_lines`. Should not be overridden. + .. _class_EditorSpatialGizmoPlugin_method_get_handle_name: - :ref:`String` **get_handle_name** **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index **)** virtual +Override this method to provide gizmo's handle names. Called for this plugin's active gizmos. + .. _class_EditorSpatialGizmoPlugin_method_get_handle_value: - :ref:`Variant` **get_handle_value** **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index **)** virtual +Get actual value of a handle from gizmo. Called for this plugin's active gizmos. + .. _class_EditorSpatialGizmoPlugin_method_get_material: - :ref:`SpatialMaterial` **get_material** **(** :ref:`String` name, :ref:`EditorSpatialGizmo` gizmo **)** +Get material from the internal list of materials. If an :ref:`EditorSpatialGizmo` is provided it will try to get the corresponding variant (selected and/or editable). + .. _class_EditorSpatialGizmoPlugin_method_get_name: - :ref:`String` **get_name** **(** **)** virtual +Override this method to provide the name that will appear in teh gizmo visibility menu. + .. _class_EditorSpatialGizmoPlugin_method_has_gizmo: - :ref:`bool` **has_gizmo** **(** :ref:`Spatial` spatial **)** virtual -.. _class_EditorSpatialGizmoPlugin_method_is_gizmo_handle_highlighted: +Override this method to define which Spatial nodes have a gizmo from this plugin. Whenever a :ref:`Spatial` node is added to a scene this method is called, if it returns ``true`` the node gets a generic :ref:`EditorSpatialGizmo` assigned and is added to this plugin's list of active gizmos. -- :ref:`bool` **is_gizmo_handle_highlighted** **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index **)** virtual +.. _class_EditorSpatialGizmoPlugin_method_is_handle_highlighted: + +- :ref:`bool` **is_handle_highlighted** **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index **)** virtual + +Get whether a handle is highlighted or not. Called for this plugin's active gizmos. .. _class_EditorSpatialGizmoPlugin_method_is_selectable_when_hidden: - :ref:`bool` **is_selectable_when_hidden** **(** **)** virtual +Override this method to define whether Spatial with this gizmo should be selecteble even when the gizmo is hidden. + .. _class_EditorSpatialGizmoPlugin_method_redraw: - void **redraw** **(** :ref:`EditorSpatialGizmo` gizmo **)** virtual +Callback to redraw the provided gizmo. Called for this plugin's active gizmos. + .. _class_EditorSpatialGizmoPlugin_method_set_handle: - void **set_handle** **(** :ref:`EditorSpatialGizmo` gizmo, :ref:`int` index, :ref:`Camera` camera, :ref:`Vector2` point **)** virtual +Update the value of a handle after it has been updated. Called for this plugin's active gizmos. + diff --git a/classes/class_expression.rst b/classes/class_expression.rst index 19cc9d3c4..17d35a246 100644 --- a/classes/class_expression.rst +++ b/classes/class_expression.rst @@ -48,7 +48,7 @@ In the following example we use a :ref:`LineEdit` node to write func _on_text_entered(command): var error = expression.parse(command, []) if error != OK: - print(get_error_text()) + print(expression.get_error_text()) return var result = expression.execute([], null, true) if not expression.has_execute_failed(): @@ -63,6 +63,8 @@ Method Descriptions Executes the expression that was previously parsed by :ref:`parse` and returns the result. Before you use the returned object, you should check if the method failed by calling :ref:`has_execute_failed`. +If you defined input variables in :ref:`parse`, you can specify their values in the inputs array, in the same order. + .. _class_Expression_method_get_error_text: - :ref:`String` **get_error_text** **(** **)** const @@ -81,3 +83,5 @@ Returns ``true`` if :ref:`execute` has failed. Parses the expression and returns a :ref:`Error`. +You can optionally specify names of variables that may appear in the expression with ``input_names``, so that you can bind them when it gets executed. + diff --git a/classes/class_image.rst b/classes/class_image.rst index e3f9bba60..06aca4e4b 100644 --- a/classes/class_image.rst +++ b/classes/class_image.rst @@ -369,10 +369,21 @@ enum **CompressSource**: - **COMPRESS_SOURCE_NORMAL** = **2** +Constants +--------- + +.. _class_Image_constant_MAX_WIDTH: + +.. _class_Image_constant_MAX_HEIGHT: + +- **MAX_WIDTH** = **16384** --- The maximal width allowed for ``Image`` resources. + +- **MAX_HEIGHT** = **16384** --- The maximal height allowed for ``Image`` resources. + Description ----------- -Native image datatype. Contains image data, which can be converted to a :ref:`Texture`, and several functions to interact with it. The maximum width and height for an ``Image`` is 16384 pixels. +Native image datatype. Contains image data, which can be converted to a :ref:`Texture`, and several functions to interact with it. The maximum width and height for an ``Image`` are :ref:`MAX_WIDTH` and :ref:`MAX_HEIGHT`. Property Descriptions --------------------- diff --git a/classes/class_multimesh.rst b/classes/class_multimesh.rst index 7337718ee..08947a7d5 100644 --- a/classes/class_multimesh.rst +++ b/classes/class_multimesh.rst @@ -61,9 +61,9 @@ Enumerations enum **TransformFormat**: -- **TRANSFORM_2D** = **0** +- **TRANSFORM_2D** = **0** --- Use this when using 2D transforms. -- **TRANSFORM_3D** = **1** +- **TRANSFORM_3D** = **1** --- Use this when using 3D transforms. .. _enum_MultiMesh_ColorFormat: @@ -75,11 +75,11 @@ enum **TransformFormat**: enum **ColorFormat**: -- **COLOR_NONE** = **0** +- **COLOR_NONE** = **0** --- Use when you are not using per-instance :ref:`Color`\ s. -- **COLOR_8BIT** = **1** +- **COLOR_8BIT** = **1** --- Compress :ref:`Color` data into 8 bits when passing to shader. This uses less memory and can be faster, but the :ref:`Color` loses precision. -- **COLOR_FLOAT** = **2** +- **COLOR_FLOAT** = **2** --- The :ref:`Color` passed into :ref:`set_instance_color` will use 4 floats. Use this for highest precision :ref:`Color`. .. _enum_MultiMesh_CustomDataFormat: @@ -91,18 +91,18 @@ enum **ColorFormat**: enum **CustomDataFormat**: -- **CUSTOM_DATA_NONE** = **0** +- **CUSTOM_DATA_NONE** = **0** --- Use when you are not using per-instance custom data. -- **CUSTOM_DATA_8BIT** = **1** +- **CUSTOM_DATA_8BIT** = **1** --- Compress custom_data into 8 bits when passing to shader. This uses less memory and can be faster, but loses precision. -- **CUSTOM_DATA_FLOAT** = **2** +- **CUSTOM_DATA_FLOAT** = **2** --- The :ref:`Color` passed into :ref:`set_instance_custom_data` will use 4 floats. Use this for highest precision. Description ----------- -MultiMesh provides low level mesh instancing. If the amount of :ref:`Mesh` instances needed goes from hundreds to thousands (and most need to be visible at close proximity) creating such a large amount of :ref:`MeshInstance` nodes may affect performance by using too much CPU or video memory. +MultiMesh provides low level mesh instancing. Drawing thousands of :ref:`MeshInstance` nodes can be slow because each object is submitted to the GPU to be drawn individually. -For this case a MultiMesh becomes very useful, as it can draw thousands of instances with little API overhead. +MultiMesh is much faster because it can draw thousands of instances with a single draw call, resulting in less API overhead. As a drawback, if the instances are too far away of each other, performance may be reduced as every single instance will always rendered (they are spatially indexed as one, for the whole object). @@ -121,6 +121,8 @@ Property Descriptions | *Getter* | get_color_format() | +----------+-------------------------+ +Format of colors in color array that gets passed to shader. + .. _class_MultiMesh_property_custom_data_format: - :ref:`CustomDataFormat` **custom_data_format** @@ -131,6 +133,8 @@ Property Descriptions | *Getter* | get_custom_data_format() | +----------+-------------------------------+ +Format of custom data in custom data array that gets passed to shader. + .. _class_MultiMesh_property_instance_count: - :ref:`int` **instance_count** @@ -141,6 +145,8 @@ Property Descriptions | *Getter* | get_instance_count() | +----------+---------------------------+ +Number of instances that will get drawn. + .. _class_MultiMesh_property_mesh: - :ref:`Mesh` **mesh** @@ -151,6 +157,8 @@ Property Descriptions | *Getter* | get_mesh() | +----------+-----------------+ +Mesh to be drawn. + .. _class_MultiMesh_property_transform_format: - :ref:`TransformFormat` **transform_format** @@ -161,6 +169,8 @@ Property Descriptions | *Getter* | get_transform_format() | +----------+-----------------------------+ +Format of transform used to transform mesh, either 2D or 3D. + Method Descriptions ------------------- @@ -180,6 +190,8 @@ Get the color of a specific instance. - :ref:`Color` **get_instance_custom_data** **(** :ref:`int` instance **)** const +Return the custom data that has been set for a specific instance. + .. _class_MultiMesh_method_get_instance_transform: - :ref:`Transform` **get_instance_transform** **(** :ref:`int` instance **)** const @@ -196,6 +208,8 @@ Set the color of a specific instance. - void **set_instance_custom_data** **(** :ref:`int` instance, :ref:`Color` custom_data **)** +Set custom data for a specific instance. Although :ref:`Color` is used, it is just a container for 4 numbers. + .. _class_MultiMesh_method_set_instance_transform: - void **set_instance_transform** **(** :ref:`int` instance, :ref:`Transform` transform **)** diff --git a/classes/class_node.rst b/classes/class_node.rst index 841da12cd..8a2df9d07 100644 --- a/classes/class_node.rst +++ b/classes/class_node.rst @@ -87,6 +87,8 @@ Methods +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_node_and_resource` **(** :ref:`NodePath` path **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`Node` | :ref:`get_node_or_null` **(** :ref:`NodePath` path **)** const | ++-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Node` | :ref:`get_parent` **(** **)** const | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`NodePath` | :ref:`get_path` **(** **)** const | @@ -661,6 +663,12 @@ Possible paths are: - :ref:`Array` **get_node_and_resource** **(** :ref:`NodePath` path **)** +.. _class_Node_method_get_node_or_null: + +- :ref:`Node` **get_node_or_null** **(** :ref:`NodePath` path **)** const + +Similar to :ref:`get_node`, but does not raise an error when ``path`` does not point to a valid ``Node``. + .. _class_Node_method_get_parent: - :ref:`Node` **get_parent** **(** **)** const diff --git a/classes/class_physicsdirectbodystate.rst b/classes/class_physicsdirectbodystate.rst index 88e1d0ec0..152725a9e 100644 --- a/classes/class_physicsdirectbodystate.rst +++ b/classes/class_physicsdirectbodystate.rst @@ -252,7 +252,7 @@ This is equivalent to ``apply_impulse(Vector3(0, 0, 0), impulse)``. - void **apply_impulse** **(** :ref:`Vector3` position, :ref:`Vector3` j **)** -Apply a positioned impulse (which will be affected by the body mass and shape). This is the equivalent of hitting a billiard ball with a cue: a force that is applied once, and only once. Both the impulse and the position are in global coordinates, and the position is relative to the object's origin. +Applies a positioned impulse to the body. An impulse is time independent! Applying an impulse every frame would result in a framerate dependent force. For this reason it should only be used when simulating one-time impacts. The position uses the rotation of the global coordinate system, but is centered at the object's origin. .. _class_PhysicsDirectBodyState_method_apply_torque_impulse: diff --git a/classes/class_physicsdirectspacestate.rst b/classes/class_physicsdirectspacestate.rst index 14242ec0e..f7d69c07f 100644 --- a/classes/class_physicsdirectspacestate.rst +++ b/classes/class_physicsdirectspacestate.rst @@ -50,7 +50,7 @@ Method Descriptions Checks whether the shape can travel to a point. The method will return an array with two floats between 0 and 1, both representing a fraction of ``motion``. The first is how far the shape can move without triggering a collision, and the second is the point at which a collision will occur. If no collision is detected, the returned array will be ``[1, 1]``. -If the shape can not move, the returned array will be ``[0, 0]``. +If the shape can not move, the returned array will be ``[0, 0]`` under Bullet, and empty under GodotPhysics. .. _class_PhysicsDirectSpaceState_method_collide_shape: diff --git a/classes/class_popupmenu.rst b/classes/class_popupmenu.rst index dec305336..9acdcd981 100644 --- a/classes/class_popupmenu.rst +++ b/classes/class_popupmenu.rst @@ -445,7 +445,7 @@ Remember this is just cosmetic and you have to add the logic for checking/unchec - void **set_item_as_separator** **(** :ref:`int` idx, :ref:`bool` enable **)** -Mark the item at index "idx" as a separator, which means that it would be displayed as just a line. +Mark the item at index "idx" as a separator, which means that it would be displayed as a mere line. .. _class_PopupMenu_method_set_item_checked: diff --git a/classes/class_resourcepreloader.rst b/classes/class_resourcepreloader.rst index 4e5b77d75..fd064d740 100644 --- a/classes/class_resourcepreloader.rst +++ b/classes/class_resourcepreloader.rst @@ -36,7 +36,7 @@ Methods Description ----------- -Resource Preloader Node. This node is used to preload sub-resources inside a scene, so when the scene is loaded all the resources are ready to use and be retrieved from here. +This node is used to preload sub-resources inside a scene, so when the scene is loaded, all the resources are ready to use and can be retrieved from the preloader. Method Descriptions ------------------- @@ -45,33 +45,35 @@ Method Descriptions - void **add_resource** **(** :ref:`String` name, :ref:`Resource` resource **)** +Adds a resource to the preloader with the given ``name``. If a resource with the given ``name`` already exists, the new resource will be renamed to "``name`` N" where N is an incrementing number starting from 2. + .. _class_ResourcePreloader_method_get_resource: - :ref:`Resource` **get_resource** **(** :ref:`String` name **)** const -Return the resource given a text-id. +Returns the resource associated to ``name``. .. _class_ResourcePreloader_method_get_resource_list: - :ref:`PoolStringArray` **get_resource_list** **(** **)** const -Return the list of resources inside the preloader. +Returns the list of resources inside the preloader. .. _class_ResourcePreloader_method_has_resource: - :ref:`bool` **has_resource** **(** :ref:`String` name **)** const -Return true if the preloader has a given resource. +Returns true if the preloader contains a resource associated to ``name``. .. _class_ResourcePreloader_method_remove_resource: - void **remove_resource** **(** :ref:`String` name **)** -Remove a resource from the preloader by text id. +Removes the resource associated to ``name`` from the preloader. .. _class_ResourcePreloader_method_rename_resource: - void **rename_resource** **(** :ref:`String` name, :ref:`String` newname **)** -Rename a resource inside the preloader, from a text-id to a new text-id. +Renames a resource inside the preloader from ``name`` to ``newname``. diff --git a/classes/class_rigidbody.rst b/classes/class_rigidbody.rst index 32d58f0c4..c140c07c8 100644 --- a/classes/class_rigidbody.rst +++ b/classes/class_rigidbody.rst @@ -488,7 +488,7 @@ This is equivalent to ``apply_impulse(Vector3(0,0,0), impulse)``. - void **apply_impulse** **(** :ref:`Vector3` position, :ref:`Vector3` impulse **)** -Applies a positioned impulse which will be affected by the body mass and shape. This is the equivalent of hitting a billiard ball with a cue: a force that is applied once, and only once. Both the impulse and the position are in global coordinates, and the position is relative to the object's origin. +Applies a positioned impulse to the body. An impulse is time independent! Applying an impulse every frame would result in a framerate dependent force. For this reason it should only be used when simulating one-time impacts. The position uses the rotation of the global coordinate system, but is centered at the object's origin. .. _class_RigidBody_method_apply_torque_impulse: diff --git a/classes/class_rigidbody2d.rst b/classes/class_rigidbody2d.rst index bd5dd0113..a68da841c 100644 --- a/classes/class_rigidbody2d.rst +++ b/classes/class_rigidbody2d.rst @@ -449,7 +449,7 @@ Applies a directional impulse without affecting rotation. - void **apply_impulse** **(** :ref:`Vector2` offset, :ref:`Vector2` impulse **)** -Applies a positioned impulse to the body (which will be affected by the body mass and shape). This is the equivalent of hitting a billiard ball with a cue: a force that is applied instantaneously. Both the impulse and the offset from the body origin are in global coordinates. +Applies a positioned impulse to the body. An impulse is time independent! Applying an impulse every frame would result in a framerate dependent force. For this reason it should only be used when simulating one-time impacts (use the "_force" functions otherwise). The position uses the rotation of the global coordinate system, but is centered at the object's origin. .. _class_RigidBody2D_method_apply_torque_impulse: diff --git a/classes/class_websocketclient.rst b/classes/class_websocketclient.rst index 5da053849..2308d9e17 100644 --- a/classes/class_websocketclient.rst +++ b/classes/class_websocketclient.rst @@ -100,7 +100,9 @@ Method Descriptions Connect to the given URL requesting one of the given ``protocols`` as sub-protocol. -If ``true``, is passed as ``gd_mp_api``, the client will behave like a network peer for the :ref:`MultiplayerAPI`. Note: connections to non Godot servers will not work, and :ref:`data_received` will not be emitted when this option is true. +If ``true`` is passed as ``gd_mp_api``, the client will behave like a network peer for the :ref:`MultiplayerAPI`, connections to non Godot servers will not work, and :ref:`data_received` will not be emitted. + +If ``false`` is passed instead (default), you must call :ref:`PacketPeer` functions (``put_packet``, ``get_packet``, etc.) on the :ref:`WebSocketPeer` returned via ``get_peer(1)`` and not on this object directly (e.g. ``get_peer(1).put_packet(data)``). .. _class_WebSocketClient_method_disconnect_from_host: diff --git a/classes/class_websocketserver.rst b/classes/class_websocketserver.rst index dcdf64c89..604e76b56 100644 --- a/classes/class_websocketserver.rst +++ b/classes/class_websocketserver.rst @@ -112,7 +112,9 @@ Start listening on the given port. You can specify the desired subprotocols via the "protocols" array. If the list empty (default), "binary" will be used. -You can use this server as a network peer for :ref:`MultiplayerAPI` by passing ``true`` as ``gd_mp_api``. Note: :ref:`data_received` will not be fired and clients other than Godot will not work in this case. +If ``true`` is passed as ``gd_mp_api``, the server will behave like a network peer for the :ref:`MultiplayerAPI`, connections from non Godot clients will not work, and :ref:`data_received` will not be emitted. + +If ``false`` is passed instead (default), you must call :ref:`PacketPeer` functions (``put_packet``, ``get_packet``, etc.), on the :ref:`WebSocketPeer` returned via ``get_peer(ID)`` to communicate with the peer with given ``ID`` (e.g. ``get_peer(ID).get_available_packet_count``). .. _class_WebSocketServer_method_stop: