diff --git a/classes/class_@gdscript.rst b/classes/class_@gdscript.rst index 0500ab328..125e19355 100644 --- a/classes/class_@gdscript.rst +++ b/classes/class_@gdscript.rst @@ -66,9 +66,9 @@ Methods +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`floor` **(** :ref:`float` s **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`float` | :ref:`fmod` **(** :ref:`float` x, :ref:`float` y **)** | +| :ref:`float` | :ref:`fmod` **(** :ref:`float` a, :ref:`float` b **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`float` | :ref:`fposmod` **(** :ref:`float` x, :ref:`float` y **)** | +| :ref:`float` | :ref:`fposmod` **(** :ref:`float` a, :ref:`float` b **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`FuncRef` | :ref:`funcref` **(** :ref:`Object` instance, :ref:`String` funcname **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -96,6 +96,8 @@ Methods +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`lerp` **(** :ref:`Variant` from, :ref:`Variant` to, :ref:`float` weight **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`float` | :ref:`lerp_angle` **(** :ref:`float` from, :ref:`float` to, :ref:`float` weight **)** | ++-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`linear2db` **(** :ref:`float` nrg **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Resource` | :ref:`load` **(** :ref:`String` path **)** | @@ -114,7 +116,9 @@ Methods +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`polar2cartesian` **(** :ref:`float` r, :ref:`float` th **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| :ref:`float` | :ref:`pow` **(** :ref:`float` x, :ref:`float` y **)** | +| :ref:`int` | :ref:`posmod` **(** :ref:`int` a, :ref:`int` b **)** | ++-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`float` | :ref:`pow` **(** :ref:`float` base, :ref:`float` exp **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Resource` | :ref:`preload` **(** :ref:`String` path **)** | +-----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -492,42 +496,45 @@ Rounds ``s`` to the closest smaller integer and returns it. .. _class_@GDScript_method_fmod: -- :ref:`float` **fmod** **(** :ref:`float` x, :ref:`float` y **)** +- :ref:`float` **fmod** **(** :ref:`float` a, :ref:`float` b **)** -Returns the floating-point remainder of ``x/y``. +Returns the floating-point remainder of ``a/b``, keeping the sign of ``a``. :: # Remainder is 1.5 var remainder = fmod(7, 5.5) +For the integer remainder operation, use the % operator. + .. _class_@GDScript_method_fposmod: -- :ref:`float` **fposmod** **(** :ref:`float` x, :ref:`float` y **)** +- :ref:`float` **fposmod** **(** :ref:`float` a, :ref:`float` b **)** -Returns the floating-point remainder of ``x/y`` that wraps equally in positive and negative. +Returns the floating-point modulus of ``a/b`` that wraps equally in positive and negative. :: - var i = -10 - while i < 0: - prints(i, fposmod(i, 10)) + var i = -6 + while i < 5: + prints(i, fposmod(i, 3)) i += 1 Produces: :: - -10 10 - -9 1 - -8 2 - -7 3 - -6 4 - -5 5 - -4 6 - -3 7 - -2 8 - -1 9 + -6 0 + -5 1 + -4 2 + -3 0 + -2 1 + -1 2 + 0 0 + 1 1 + 2 2 + 3 0 + 4 1 .. _class_@GDScript_method_funcref: @@ -679,6 +686,24 @@ If both are of the same vector type (:ref:`Vector2`, :ref:`Vector lerp(0, 4, 0.75) # Returns 3.0 lerp(Vector2(1, 5), Vector2(3, 2), 0.5) # Returns Vector2(2, 3.5) +.. _class_@GDScript_method_lerp_angle: + +- :ref:`float` **lerp_angle** **(** :ref:`float` from, :ref:`float` to, :ref:`float` weight **)** + +Linearly interpolates between two angles (in radians) by a normalized value. + +Similar to :ref:`lerp` but interpolate correctly when the angles wrap around :ref:`TAU`. + +:: + + extends Sprite + var elapsed = 0.0 + func _process(delta): + var min_angle = deg2rad(0.0) + var max_angle = deg2rad(90.0) + rotation = lerp_angle(min_angle, max_angle, elapsed) + elapsed += delta + .. _class_@GDScript_method_linear2db: - :ref:`float` **linear2db** **(** :ref:`float` nrg **)** @@ -780,9 +805,38 @@ Note that JSON objects do not preserve key order like Godot dictionaries, thus y Converts a 2D point expressed in the polar coordinate system (a distance from the origin ``r`` and an angle ``th``) to the cartesian coordinate system (X and Y axis). +.. _class_@GDScript_method_posmod: + +- :ref:`int` **posmod** **(** :ref:`int` a, :ref:`int` b **)** + +Returns the integer modulus of ``a/b`` that wraps equally in positive and negative. + +:: + + var i = -6 + while i < 5: + prints(i, posmod(i, 3)) + i += 1 + +Produces: + +:: + + -6 0 + -5 1 + -4 2 + -3 0 + -2 1 + -1 2 + 0 0 + 1 1 + 2 2 + 3 0 + 4 1 + .. _class_@GDScript_method_pow: -- :ref:`float` **pow** **(** :ref:`float` x, :ref:`float` y **)** +- :ref:`float` **pow** **(** :ref:`float` base, :ref:`float` exp **)** Returns the result of ``x`` raised to the power of ``y``. diff --git a/classes/class_astar.rst b/classes/class_astar.rst index 70483fc54..6ca4868ce 100644 --- a/classes/class_astar.rst +++ b/classes/class_astar.rst @@ -95,8 +95,8 @@ Adds a new point at the given position with the given identifier. The algorithm :: - var as = AStar.new() - as.add_point(1, Vector3(1, 0, 0), 4) # Adds the point (1, 0, 0) with weight_scale 4 and id 1 + var astar = AStar.new() + astar.add_point(1, Vector3(1, 0, 0), 4) # Adds the point (1, 0, 0) with weight_scale 4 and id 1 If there already exists a point for the given ``id``, its position and weight scale are updated to the given values. @@ -120,10 +120,10 @@ Creates a segment between the given points. If ``bidirectional`` is ``false``, o :: - var as = AStar.new() - as.add_point(1, Vector3(1, 1, 0)) - as.add_point(2, Vector3(0, 5, 0)) - as.connect_points(1, 2, false) + var astar = AStar.new() + astar.add_point(1, Vector3(1, 1, 0)) + astar.add_point(2, Vector3(0, 5, 0)) + astar.connect_points(1, 2, false) .. _class_AStar_method_disconnect_points: @@ -151,11 +151,11 @@ Returns the closest position to ``to_position`` that resides inside a segment be :: - var as = AStar.new() - as.add_point(1, Vector3(0, 0, 0)) - as.add_point(2, Vector3(0, 5, 0)) - as.connect_points(1, 2) - var res = as.get_closest_position_in_segment(Vector3(3, 3, 0)) # Returns (0, 3, 0) + var astar = AStar.new() + astar.add_point(1, Vector3(0, 0, 0)) + astar.add_point(2, Vector3(0, 5, 0)) + astar.connect_points(1, 2) + var res = astar.get_closest_position_in_segment(Vector3(3, 3, 0)) # Returns (0, 3, 0) The result is in the segment that goes from ``y = 0`` to ``y = 5``. It's the closest position in the segment to the given point. @@ -167,19 +167,18 @@ Returns an array with the IDs of the points that form the path found by AStar be :: - var as = AStar.new() - as.add_point(1, Vector3(0, 0, 0)) - as.add_point(2, Vector3(0, 1, 0), 1) # Default weight is 1 - as.add_point(3, Vector3(1, 1, 0)) - as.add_point(4, Vector3(2, 0, 0)) + var astar = AStar.new() + astar.add_point(1, Vector3(0, 0, 0)) + astar.add_point(2, Vector3(0, 1, 0), 1) # Default weight is 1 + astar.add_point(3, Vector3(1, 1, 0)) + astar.add_point(4, Vector3(2, 0, 0)) - as.connect_points(1, 2, false) - as.connect_points(2, 3, false) - as.connect_points(4, 3, false) - as.connect_points(1, 4, false) - as.connect_points(5, 4, false) + astar.connect_points(1, 2, false) + astar.connect_points(2, 3, false) + astar.connect_points(4, 3, false) + astar.connect_points(1, 4, false) - var res = as.get_id_path(1, 3) # Returns [1, 2, 3] + var res = astar.get_id_path(1, 3) # Returns [1, 2, 3] If you change the 2nd point's weight to 3, then the result will be ``[1, 4, 3]`` instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2. @@ -191,16 +190,16 @@ Returns an array with the IDs of the points that form the connection with the gi :: - var as = AStar.new() - as.add_point(1, Vector3(0, 0, 0)) - as.add_point(2, Vector3(0, 1, 0)) - as.add_point(3, Vector3(1, 1, 0)) - as.add_point(4, Vector3(2, 0, 0)) + var astar = AStar.new() + astar.add_point(1, Vector3(0, 0, 0)) + astar.add_point(2, Vector3(0, 1, 0)) + astar.add_point(3, Vector3(1, 1, 0)) + astar.add_point(4, Vector3(2, 0, 0)) - as.connect_points(1, 2, true) - as.connect_points(1, 3, true) + astar.connect_points(1, 2, true) + astar.connect_points(1, 3, true) - var neighbors = as.get_point_connections(1) # Returns [2, 3] + var neighbors = astar.get_point_connections(1) # Returns [2, 3] .. _class_AStar_method_get_point_path: diff --git a/classes/class_astar2d.rst b/classes/class_astar2d.rst index 84590b69c..218278061 100644 --- a/classes/class_astar2d.rst +++ b/classes/class_astar2d.rst @@ -77,8 +77,8 @@ Adds a new point at the given position with the given identifier. The algorithm :: - var as = AStar2D.new() - as.add_point(1, Vector2(1, 0), 4) # Adds the point (1, 0) with weight_scale 4 and id 1 + var astar = AStar2D.new() + astar.add_point(1, Vector2(1, 0), 4) # Adds the point (1, 0) with weight_scale 4 and id 1 If there already exists a point for the given ``id``, its position and weight scale are updated to the given values. @@ -102,10 +102,10 @@ Creates a segment between the given points. If ``bidirectional`` is ``false``, o :: - var as = AStar2D.new() - as.add_point(1, Vector2(1, 1)) - as.add_point(2, Vector2(0, 5)) - as.connect_points(1, 2, false) + var astar = AStar2D.new() + astar.add_point(1, Vector2(1, 1)) + astar.add_point(2, Vector2(0, 5)) + astar.connect_points(1, 2, false) .. _class_AStar2D_method_disconnect_points: @@ -133,11 +133,11 @@ Returns the closest position to ``to_position`` that resides inside a segment be :: - var as = AStar2D.new() - as.add_point(1, Vector2(0, 0)) - as.add_point(2, Vector2(0, 5)) - as.connect_points(1, 2) - var res = as.get_closest_position_in_segment(Vector2(3, 3)) # Returns (0, 3) + var astar = AStar2D.new() + astar.add_point(1, Vector2(0, 0)) + astar.add_point(2, Vector2(0, 5)) + astar.connect_points(1, 2) + var res = astar.get_closest_position_in_segment(Vector2(3, 3)) # Returns (0, 3) The result is in the segment that goes from ``y = 0`` to ``y = 5``. It's the closest position in the segment to the given point. @@ -149,19 +149,18 @@ Returns an array with the IDs of the points that form the path found by AStar2D :: - var as = AStar2D.new() - as.add_point(1, Vector2(0, 0)) - as.add_point(2, Vector2(0, 1), 1) # Default weight is 1 - as.add_point(3, Vector2(1, 1)) - as.add_point(4, Vector2(2, 0)) + var astar = AStar2D.new() + astar.add_point(1, Vector2(0, 0)) + astar.add_point(2, Vector2(0, 1), 1) # Default weight is 1 + astar.add_point(3, Vector2(1, 1)) + astar.add_point(4, Vector2(2, 0)) - as.connect_points(1, 2, false) - as.connect_points(2, 3, false) - as.connect_points(4, 3, false) - as.connect_points(1, 4, false) - as.connect_points(5, 4, false) + astar.connect_points(1, 2, false) + astar.connect_points(2, 3, false) + astar.connect_points(4, 3, false) + astar.connect_points(1, 4, false) - var res = as.get_id_path(1, 3) # Returns [1, 2, 3] + var res = astar.get_id_path(1, 3) # Returns [1, 2, 3] If you change the 2nd point's weight to 3, then the result will be ``[1, 4, 3]`` instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2. @@ -173,16 +172,16 @@ Returns an array with the IDs of the points that form the connection with the gi :: - var as = AStar2D.new() - as.add_point(1, Vector2(0, 0)) - as.add_point(2, Vector2(0, 1)) - as.add_point(3, Vector2(1, 1)) - as.add_point(4, Vector2(2, 0)) + var astar = AStar2D.new() + astar.add_point(1, Vector2(0, 0)) + astar.add_point(2, Vector2(0, 1)) + astar.add_point(3, Vector2(1, 1)) + astar.add_point(4, Vector2(2, 0)) - as.connect_points(1, 2, true) - as.connect_points(1, 3, true) + astar.connect_points(1, 2, true) + astar.connect_points(1, 3, true) - var neighbors = as.get_point_connections(1) # Returns [2, 3] + var neighbors = astar.get_point_connections(1) # Returns [2, 3] .. _class_AStar2D_method_get_point_path: diff --git a/classes/class_directionallight.rst b/classes/class_directionallight.rst index b71f233cb..8fbb87146 100644 --- a/classes/class_directionallight.rst +++ b/classes/class_directionallight.rst @@ -26,7 +26,7 @@ Properties +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------+ | :ref:`ShadowDepthRange` | :ref:`directional_shadow_depth_range` | 0 | +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------+ -| :ref:`float` | :ref:`directional_shadow_max_distance` | 200.0 | +| :ref:`float` | :ref:`directional_shadow_max_distance` | 100.0 | +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------+ | :ref:`ShadowMode` | :ref:`directional_shadow_mode` | 2 | +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------+ @@ -130,7 +130,7 @@ Optimizes shadow rendering for detail versus movement. See :ref:`ShadowDepthRang - :ref:`float` **directional_shadow_max_distance** +-----------+------------------+ -| *Default* | 200.0 | +| *Default* | 100.0 | +-----------+------------------+ | *Setter* | set_param(value) | +-----------+------------------+ diff --git a/classes/class_editorinterface.rst b/classes/class_editorinterface.rst index c8c901b42..4d10ba0fd 100644 --- a/classes/class_editorinterface.rst +++ b/classes/class_editorinterface.rst @@ -185,6 +185,8 @@ Saves the scene as a file at ``path``. - void **select_file** **(** :ref:`String` file **)** +Selects the file, with the path provided by ``file``, in the FileSystem dock. + .. _class_EditorInterface_method_set_plugin_enabled: - void **set_plugin_enabled** **(** :ref:`String` plugin, :ref:`bool` enabled **)** diff --git a/classes/class_editorplugin.rst b/classes/class_editorplugin.rst index fed713f88..18597efb5 100644 --- a/classes/class_editorplugin.rst +++ b/classes/class_editorplugin.rst @@ -270,27 +270,27 @@ Adds a script at ``path`` to the Autoload list as ``name``. - :ref:`ToolButton` **add_control_to_bottom_panel** **(** :ref:`Control` control, :ref:`String` title **)** -Adds 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 :ref:`remove_control_from_bottom_panel` and free it with ``queue_free()``. +Adds 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 :ref:`remove_control_from_bottom_panel` and free it with :ref:`Node.queue_free`. .. _class_EditorPlugin_method_add_control_to_container: - void **add_control_to_container** **(** :ref:`CustomControlContainer` container, :ref:`Control` control **)** -Adds a custom control to a container (see ``CONTAINER_*`` enum). There are many locations where custom controls can be added in the editor UI. +Adds a custom control to a container (see :ref:`CustomControlContainer`). 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). -When your plugin is deactivated, make sure to remove your custom control with :ref:`remove_control_from_container` and free it with ``queue_free()``. +When your plugin is deactivated, make sure to remove your custom control with :ref:`remove_control_from_container` and free it with :ref:`Node.queue_free`. .. _class_EditorPlugin_method_add_control_to_dock: - void **add_control_to_dock** **(** :ref:`DockSlot` slot, :ref:`Control` control **)** -Adds the control to a specific dock slot (see ``DOCK_*`` enum for options). +Adds the control to a specific dock slot (see :ref:`DockSlot` 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. -When your plugin is deactivated, make sure to remove your custom control with :ref:`remove_control_from_docks` and free it with ``queue_free()``. +When your plugin is deactivated, make sure to remove your custom control with :ref:`remove_control_from_docks` and free it with :ref:`Node.queue_free`. .. _class_EditorPlugin_method_add_custom_type: @@ -358,6 +358,8 @@ Clear all the state and reset the object being edited to zero. This ensures your - void **disable_plugin** **(** **)** virtual +Called by the engine when the user disables the ``EditorPlugin`` in the Plugin tab of the project settings window. + .. _class_EditorPlugin_method_edit: - void **edit** **(** :ref:`Object` object **)** virtual @@ -368,19 +370,12 @@ This function is used for plugins that edit specific object types (nodes or reso - void **enable_plugin** **(** **)** virtual +Called by the engine when the user enables the ``EditorPlugin`` in the Plugin tab of the project settings window. + .. _class_EditorPlugin_method_forward_canvas_draw_over_viewport: - void **forward_canvas_draw_over_viewport** **(** :ref:`Control` overlay **)** virtual -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 :ref:`handles` so the editor knows that you want to work with the workspace: - -:: - - func handles(object): - return true - -Also note that the edited scene must have a root node. - .. _class_EditorPlugin_method_forward_canvas_force_draw_over_viewport: - void **forward_canvas_force_draw_over_viewport** **(** :ref:`Control` overlay **)** virtual @@ -389,18 +384,49 @@ Also note that the edited scene must have a root node. - :ref:`bool` **forward_canvas_gui_input** **(** :ref:`InputEvent` event **)** virtual +Called when there is a root node in the current edited scene, :ref:`handles` is implemented and an :ref:`InputEvent` happens in the 2D viewport. Intercepts the :ref:`InputEvent`, if ``return true`` ``EditorPlugin`` consumes the ``event``, otherwise forwards ``event`` to other Editor classes. Example: + +:: + + # Prevents the InputEvent to reach other Editor classes + func forward_canvas_gui_input(event): + var forward = true + return forward + +Must ``return false`` in order to forward the :ref:`InputEvent` to other Editor classes. Example: + +:: + + # Consumes InputEventMouseMotion and forwards other InputEvent types + func forward_canvas_gui_input(event): + var forward = false + if event is InputEventMouseMotion: + forward = true + return forward + .. _class_EditorPlugin_method_forward_spatial_gui_input: - :ref:`bool` **forward_spatial_gui_input** **(** :ref:`Camera` camera, :ref:`InputEvent` event **)** virtual -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 :ref:`handles` so the editor knows that you want to work with the workspace: +Called when there is a root node in the current edited scene, :ref:`handles` is implemented and an :ref:`InputEvent` happens in the 3D viewport. Intercepts the :ref:`InputEvent`, if ``return true`` ``EditorPlugin`` consumes the ``event``, otherwise forwards ``event`` to other Editor classes. Example: :: - func handles(object): - return true + # Prevents the InputEvent to reach other Editor classes + func forward_spatial_gui_input(camera, event): + var forward = true + return forward -Also note that the edited scene must have a root node. +Must ``return false`` in order to forward the :ref:`InputEvent` to other Editor classes. Example: + +:: + + # Consumes InputEventMouseMotion and forwards other InputEvent types + func forward_spatial_gui_input(camera, event): + var forward = false + if event is InputEventMouseMotion: + forward = true + return forward .. _class_EditorPlugin_method_get_breakpoints: @@ -492,19 +518,19 @@ Removes an Autoload ``name`` from the list. - void **remove_control_from_bottom_panel** **(** :ref:`Control` control **)** -Removes the control from the bottom panel. You have to manually ``queue_free()`` the control. +Removes the control from the bottom panel. You have to manually :ref:`Node.queue_free` the control. .. _class_EditorPlugin_method_remove_control_from_container: - void **remove_control_from_container** **(** :ref:`CustomControlContainer` container, :ref:`Control` control **)** -Removes the control from the specified container. You have to manually ``queue_free()`` the control. +Removes the control from the specified container. You have to manually :ref:`Node.queue_free` the control. .. _class_EditorPlugin_method_remove_control_from_docks: - void **remove_control_from_docks** **(** :ref:`Control` control **)** -Removes the control from the dock. You have to manually ``queue_free()`` the control. +Removes the control from the dock. You have to manually :ref:`Node.queue_free` the control. .. _class_EditorPlugin_method_remove_custom_type: diff --git a/classes/class_editorsceneimporter.rst b/classes/class_editorsceneimporter.rst index 2f0d5eae8..dc0456c08 100644 --- a/classes/class_editorsceneimporter.rst +++ b/classes/class_editorsceneimporter.rst @@ -16,7 +16,7 @@ EditorSceneImporter Brief Description ----------------- - +Imports scenes from third-parties' 3D files. Methods ------- diff --git a/classes/class_engine.rst b/classes/class_engine.rst index 5f46db3be..d2e0644b3 100644 --- a/classes/class_engine.rst +++ b/classes/class_engine.rst @@ -34,31 +34,33 @@ Properties Methods ------- -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`Dictionary` | :ref:`get_author_info` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`Array` | :ref:`get_copyright_info` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`Dictionary` | :ref:`get_donor_info` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`int` | :ref:`get_frames_drawn` **(** **)** | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`float` | :ref:`get_frames_per_second` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`Dictionary` | :ref:`get_license_info` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`String` | :ref:`get_license_text` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`MainLoop` | :ref:`get_main_loop` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`Object` | :ref:`get_singleton` **(** :ref:`String` name **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`Dictionary` | :ref:`get_version_info` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`bool` | :ref:`has_singleton` **(** :ref:`String` name **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ -| :ref:`bool` | :ref:`is_in_physics_frame` **(** **)** const | -+-------------------------------------+------------------------------------------------------------------------------------------------------------+ ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`Dictionary` | :ref:`get_author_info` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`Array` | :ref:`get_copyright_info` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`Dictionary` | :ref:`get_donor_info` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`int` | :ref:`get_frames_drawn` **(** **)** | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`float` | :ref:`get_frames_per_second` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`Dictionary` | :ref:`get_license_info` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`String` | :ref:`get_license_text` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`MainLoop` | :ref:`get_main_loop` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`float` | :ref:`get_physics_interpolation_fraction` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`Object` | :ref:`get_singleton` **(** :ref:`String` name **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`Dictionary` | :ref:`get_version_info` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`bool` | :ref:`has_singleton` **(** :ref:`String` name **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ +| :ref:`bool` | :ref:`is_in_physics_frame` **(** **)** const | ++-------------------------------------+---------------------------------------------------------------------------------------------------------------------+ Description ----------- @@ -201,6 +203,12 @@ Returns Godot license text. Returns the main loop object (see :ref:`MainLoop` and :ref:`SceneTree`). +.. _class_Engine_method_get_physics_interpolation_fraction: + +- :ref:`float` **get_physics_interpolation_fraction** **(** **)** const + +Returns the fraction through the current physics tick we are at the time of rendering the frame. This can be used to implement fixed timestep interpolation. + .. _class_Engine_method_get_singleton: - :ref:`Object` **get_singleton** **(** :ref:`String` name **)** const diff --git a/classes/class_inputevent.rst b/classes/class_inputevent.rst index a8735488a..df2d36e02 100644 --- a/classes/class_inputevent.rst +++ b/classes/class_inputevent.rst @@ -88,6 +88,10 @@ Method Descriptions - :ref:`bool` **accumulate** **(** :ref:`InputEvent` with_event **)** +Returns ``true`` if the given input event and this input event can be added together (only for events of type :ref:`InputEventMouseMotion`). + +The given input event's position, global position and speed will be copied. The resulting ``relative`` is a sum of both events. Both events' modifiers have to be identical. + .. _class_InputEvent_method_as_text: - :ref:`String` **as_text** **(** **)** const @@ -98,6 +102,8 @@ Returns a :ref:`String` representation of the event. - :ref:`float` **get_action_strength** **(** :ref:`String` action **)** const +Returns a value between 0.0 and 1.0 depending on the given actions' state. Useful for getting the value of events of type :ref:`InputEventJoypadMotion`. + .. _class_InputEvent_method_is_action: - :ref:`bool` **is_action** **(** :ref:`String` action **)** const @@ -138,7 +144,11 @@ Returns ``true`` if this input event is pressed. Not relevant for events of type - :ref:`bool` **shortcut_match** **(** :ref:`InputEvent` event **)** const +Returns ``true`` if the given input event is checking for the same key (:ref:`InputEventKey`), button (:ref:`InputEventJoypadButton`) or action (:ref:`InputEventAction`). + .. _class_InputEvent_method_xformed_by: - :ref:`InputEvent` **xformed_by** **(** :ref:`Transform2D` xform, :ref:`Vector2` local_ofs=Vector2( 0, 0 ) **)** const +Returns a copy of the given input event which has been offset by ``local_ofs`` and transformed by ``xform``. Relevant for events of type :ref:`InputEventMouseButton`, :ref:`InputEventMouseMotion`, :ref:`InputEventScreenTouch`, :ref:`InputEventScreenDrag`, :ref:`InputEventMagnifyGesture` and :ref:`InputEventPanGesture`. + diff --git a/classes/class_spatialmaterial.rst b/classes/class_spatialmaterial.rst index 7c5765ba0..f45b8baec 100644 --- a/classes/class_spatialmaterial.rst +++ b/classes/class_spatialmaterial.rst @@ -124,7 +124,7 @@ Properties +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------+ | :ref:`Texture` | :ref:`metallic_texture` | | +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------+ -| :ref:`TextureChannel` | :ref:`metallic_texture_channel` | 2 | +| :ref:`TextureChannel` | :ref:`metallic_texture_channel` | 0 | +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------+ | :ref:`bool` | :ref:`normal_enabled` | false | +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------+ @@ -188,7 +188,7 @@ Properties +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------+ | :ref:`Texture` | :ref:`roughness_texture` | | +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------+ -| :ref:`TextureChannel` | :ref:`roughness_texture_channel` | 1 | +| :ref:`TextureChannel` | :ref:`roughness_texture_channel` | 0 | +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------+ | :ref:`bool` | :ref:`subsurf_scatter_enabled` | false | +----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------+ @@ -1273,7 +1273,7 @@ General reflectivity amount. - :ref:`TextureChannel` **metallic_texture_channel** +-----------+-------------------------------------+ -| *Default* | 2 | +| *Default* | 0 | +-----------+-------------------------------------+ | *Setter* | set_metallic_texture_channel(value) | +-----------+-------------------------------------+ @@ -1669,7 +1669,7 @@ Surface reflection. A value of ``0`` represents a perfect mirror while a value o - :ref:`TextureChannel` **roughness_texture_channel** +-----------+--------------------------------------+ -| *Default* | 1 | +| *Default* | 0 | +-----------+--------------------------------------+ | *Setter* | set_roughness_texture_channel(value) | +-----------+--------------------------------------+ diff --git a/classes/class_tree.rst b/classes/class_tree.rst index 4deb5b441..d476716e5 100644 --- a/classes/class_tree.rst +++ b/classes/class_tree.rst @@ -539,13 +539,13 @@ Returns the current selection's column. - void **set_column_expand** **(** :ref:`int` column, :ref:`bool` expand **)** -If ``true``, the column will have the "Expand" flag of :ref:`Control`. +If ``true``, the column will have the "Expand" flag of :ref:`Control`. Columns that have the "Expand" flag will use their "min_width" in a similar fashion to :ref:`Control.size_flags_stretch_ratio`. .. _class_Tree_method_set_column_min_width: - void **set_column_min_width** **(** :ref:`int` column, :ref:`int` min_width **)** -Sets the minimum width of a column. +Sets the minimum width of a column. Columns that have the "Expand" flag will use their "min_width" in a similar fashion to :ref:`Control.size_flags_stretch_ratio`. .. _class_Tree_method_set_column_title: diff --git a/classes/class_treeitem.rst b/classes/class_treeitem.rst index 992403f7b..8c8339372 100644 --- a/classes/class_treeitem.rst +++ b/classes/class_treeitem.rst @@ -448,6 +448,8 @@ Sets the given column's button :ref:`Texture` at index ``button_i - void **set_button_disabled** **(** :ref:`int` column, :ref:`int` button_idx, :ref:`bool` disabled **)** +If ``true``, disables the button at index ``button_idx`` in column ``column``. + .. _class_TreeItem_method_set_cell_mode: - void **set_cell_mode** **(** :ref:`int` column, :ref:`TreeCellMode` mode **)** diff --git a/classes/class_variant.rst b/classes/class_variant.rst index b6a8d0457..3d1b32073 100644 --- a/classes/class_variant.rst +++ b/classes/class_variant.rst @@ -19,3 +19,29 @@ Description A Variant takes up only 20 bytes and can store almost any engine datatype inside of it. Variants are rarely used to hold information for long periods of time. Instead, they are used mainly for communication, editing, serialization and moving data around. +A Variant: + +- Can store almost any datatype. + +- Can perform operations between many variants. GDScript uses Variant as its atomic/native datatype. + +- Can be hashed, so it can be compared quickly to other variants. + +- Can be used to convert safely between datatypes. + +- Can be used to abstract calling methods and their arguments. Godot exports all its functions through variants. + +- Can be used to defer calls or move data between threads. + +- Can be serialized as binary and stored to disk, or transferred via network. + +- Can be serialized to text and use it for printing values and editable settings. + +- Can work as an exported property, so the editor can edit it universally. + +- Can be used for dictionaries, arrays, parsers, etc. + +**Containers (:ref:`Array` and :ref:`Dictionary`):** Both are implemented using variants. A :ref:`Dictionary` can match any datatype used as key to any other datatype. An :ref:`Array` just holds an array of Variants. Of course, a Variant can also hold a :ref:`Dictionary` and an :ref:`Array` inside, making it even more flexible. + +Modifications to a container will modify all references to it. A :ref:`Mutex` should be created to lock it if multi-threaded access is desired. + diff --git a/classes/class_visualscriptbuiltinfunc.rst b/classes/class_visualscriptbuiltinfunc.rst index d9212dec2..69c493727 100644 --- a/classes/class_visualscriptbuiltinfunc.rst +++ b/classes/class_visualscriptbuiltinfunc.rst @@ -158,6 +158,10 @@ Enumerations .. _class_VisualScriptBuiltinFunc_constant_MATH_SMOOTHSTEP: +.. _class_VisualScriptBuiltinFunc_constant_MATH_POSMOD: + +.. _class_VisualScriptBuiltinFunc_constant_MATH_LERP_ANGLE: + .. _class_VisualScriptBuiltinFunc_constant_FUNC_MAX: enum **BuiltinFunc**: @@ -299,7 +303,11 @@ enum **BuiltinFunc**: var t = clamp((weight - from) / (to - from), 0.0, 1.0) return t * t * (3.0 - 2.0 * t) -- **FUNC_MAX** = **65** --- Represents the size of the :ref:`BuiltinFunc` enum. +- **MATH_POSMOD** = **65** + +- **MATH_LERP_ANGLE** = **66** + +- **FUNC_MAX** = **67** --- Represents the size of the :ref:`BuiltinFunc` enum. Description -----------