From 859d322e960be0999e5cb4d839c4d03a96f05e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 6 Jul 2020 14:32:50 +0200 Subject: [PATCH] Sync classref with 3.2 branch --- classes/class_@gdscript.rst | 16 ++++++++-------- classes/class_editorinterface.rst | 2 ++ classes/class_geometry.rst | 9 +++++++++ classes/class_image.rst | 10 ++++++++++ classes/class_projectsettings.rst | 14 ++++++++++++++ classes/class_string.rst | 2 +- classes/class_textedit.rst | 16 ++++++++++++++++ classes/class_vector2.rst | 2 +- 8 files changed, 61 insertions(+), 10 deletions(-) diff --git a/classes/class_@gdscript.rst b/classes/class_@gdscript.rst index ed3a1c4a5..990299adf 100644 --- a/classes/class_@gdscript.rst +++ b/classes/class_@gdscript.rst @@ -814,14 +814,14 @@ Converts from linear energy to decibels (audio). This can be used to implement v - :ref:`Resource` **load** **(** :ref:`String` path **)** -Loads a resource from the filesystem located at ``path``. +Loads a resource from the filesystem located at ``path``. The resource is loaded on the method call (unless it's referenced already elsewhere, e.g. in another script or in the scene), which might cause slight delay, especially when loading scenes. To avoid unnecessary delays when loading something multiple times, either store the resource in a variable or use :ref:`preload`. -**Note:** Resource paths can be obtained by right-clicking on a resource in the FileSystem dock and choosing **Copy Path**. +**Note:** Resource paths can be obtained by right-clicking on a resource in the FileSystem dock and choosing "Copy Path" or by dragging the file from the FileSystem dock into the script. :: - # Load a scene called main located in the root of the project directory. - var main = load("res://main.tscn") + # Load a scene called main located in the root of the project directory and cache it in a variable. + var main = load("res://main.tscn") # main will contain a PackedScene resource. **Important:** The path must be absolute, a local path will just return ``null``. @@ -986,14 +986,14 @@ Returns the result of ``x`` raised to the power of ``y``. - :ref:`Resource` **preload** **(** :ref:`String` path **)** -Returns a resource from the filesystem that is loaded during script parsing. +Returns a :ref:`Resource` from the filesystem located at ``path``. The resource is loaded during script parsing, i.e. is loaded with the script and :ref:`preload` effectively acts as a reference to that resource. Note that the method requires a constant path. If you want to load a resource from a dynamic/variable path, use :ref:`load`. -**Note:** Resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path". +**Note:** Resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path" or by dragging the file from the FileSystem dock into the script. :: - # Load a scene called main located in the root of the project directory. - var main = preload("res://main.tscn") + # Instance a scene. + var diamond = preload("res://diamond.tscn").instance() ---- diff --git a/classes/class_editorinterface.rst b/classes/class_editorinterface.rst index 3fa1a4e38..551e92017 100644 --- a/classes/class_editorinterface.rst +++ b/classes/class_editorinterface.rst @@ -93,6 +93,8 @@ Property Descriptions | *Getter* | is_distraction_free_mode_enabled() | +----------+------------------------------------+ +If ``true``, enables distraction-free mode which hides side docks to increase the space available for the main view. + Method Descriptions ------------------- diff --git a/classes/class_geometry.rst b/classes/class_geometry.rst index 19112b8d8..ab46e3448 100644 --- a/classes/class_geometry.rst +++ b/classes/class_geometry.rst @@ -367,6 +367,15 @@ Each polygon's vertices will be rounded as determined by ``join_type``, see :ref The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distinguished by calling :ref:`is_polygon_clockwise`. +**Note:** To translate the polygon's vertices specifically, use the :ref:`Transform2D.xform` method: + +:: + + var polygon = PoolVector2Array([Vector2(0, 0), Vector2(100, 0), Vector2(100, 100), Vector2(0, 100)]) + var offset = Vector2(50, 50) + polygon = Transform2D(0, offset).xform(polygon) + print(polygon) # prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)] + ---- .. _class_Geometry_method_offset_polyline_2d: diff --git a/classes/class_image.rst b/classes/class_image.rst index a9ad3e528..12517e543 100644 --- a/classes/class_image.rst +++ b/classes/class_image.rst @@ -105,6 +105,8 @@ Methods +-------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`load_png_from_buffer` **(** :ref:`PoolByteArray` buffer **)** | +-------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| :ref:`Error` | :ref:`load_tga_from_buffer` **(** :ref:`PoolByteArray` buffer **)** | ++-------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`load_webp_from_buffer` **(** :ref:`PoolByteArray` buffer **)** | +-------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`lock` **(** **)** | @@ -734,6 +736,14 @@ Loads an image from the binary contents of a PNG file. ---- +.. _class_Image_method_load_tga_from_buffer: + +- :ref:`Error` **load_tga_from_buffer** **(** :ref:`PoolByteArray` buffer **)** + +Loads an image from the binary contents of a TGA file. + +---- + .. _class_Image_method_load_webp_from_buffer: - :ref:`Error` **load_webp_from_buffer** **(** :ref:`PoolByteArray` buffer **)** diff --git a/classes/class_projectsettings.rst b/classes/class_projectsettings.rst index 75f4f5d95..849d6d185 100644 --- a/classes/class_projectsettings.rst +++ b/classes/class_projectsettings.rst @@ -78,6 +78,8 @@ Properties +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`audio/output_latency` | ``15`` | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+ +| :ref:`int` | :ref:`audio/output_latency.web` | ``50`` | ++-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`audio/video_delay_compensation_ms` | ``0`` | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`compression/formats/gzip/compression_level` | ``-1`` | @@ -1025,6 +1027,18 @@ Output latency in milliseconds for audio. Lower values will result in lower audi ---- +.. _class_ProjectSettings_property_audio/output_latency.web: + +- :ref:`int` **audio/output_latency.web** + ++-----------+--------+ +| *Default* | ``50`` | ++-----------+--------+ + +Safer override for :ref:`audio/output_latency` in the Web platform, to avoid audio issues especially on mobile devices. + +---- + .. _class_ProjectSettings_property_audio/video_delay_compensation_ms: - :ref:`int` **audio/video_delay_compensation_ms** diff --git a/classes/class_string.rst b/classes/class_string.rst index 9c63519e0..6af5d378b 100644 --- a/classes/class_string.rst +++ b/classes/class_string.rst @@ -419,7 +419,7 @@ Returns a copy of the string with escaped characters replaced by their meanings - :ref:`String` **capitalize** **(** **)** -Changes the case of some letters. Replaces underscores with spaces, converts all letters to lowercase, then capitalizes first and every letter following the space character. For ``capitalize camelCase mixed_with_underscores``, it will return ``Capitalize Camelcase Mixed With Underscores``. +Changes the case of some letters. Replaces underscores with spaces, adds spaces before in-word uppercase characters, converts all letters to lowercase, then capitalizes the first letter and every letter following a space character. For ``capitalize camelCase mixed_with_underscores``, it will return ``Capitalize Camel Case Mixed With Underscores``. ---- diff --git a/classes/class_textedit.rst b/classes/class_textedit.rst index dfc69e84f..fe4a775d3 100644 --- a/classes/class_textedit.rst +++ b/classes/class_textedit.rst @@ -582,6 +582,8 @@ If ``true``, the line containing the cursor is highlighted. | *Getter* | is_drawing_minimap() | +-----------+----------------------+ +If ``true``, a minimap is shown, providing an outline of your source code. + ---- .. _class_TextEdit_property_minimap_width: @@ -596,6 +598,8 @@ If ``true``, the line containing the cursor is highlighted. | *Getter* | get_minimap_width() | +-----------+--------------------------+ +The width, in pixels, of the minimap. + ---- .. _class_TextEdit_property_override_selected_font_color: @@ -674,6 +678,10 @@ The current vertical scroll value. | *Getter* | is_selecting_enabled() | +-----------+------------------------------+ +If ``true``, text can be selected. + +If ``false``, text can not be selected by the user or by the :ref:`select` or :ref:`select_all` methods. + ---- .. _class_TextEdit_property_shortcut_keys_enabled: @@ -688,6 +696,8 @@ The current vertical scroll value. | *Getter* | is_shortcut_keys_enabled() | +-----------+----------------------------------+ +If ``true``, shortcut keys for context menu items are enabled, even if the context menu is disabled. + ---- .. _class_TextEdit_property_show_line_numbers: @@ -815,6 +825,8 @@ Returns if the given line is foldable, that is, it has indented lines right belo - void **center_viewport_to_cursor** **(** **)** +Centers the viewport on the line the editing cursor is at. This also resets the :ref:`scroll_horizontal` value to ``0``. + ---- .. _class_TextEdit_method_clear_colors: @@ -1095,6 +1107,8 @@ Returns an empty ``PoolIntArray`` if no result was found. Otherwise, the result Perform selection, from line/column to line/column. +If :ref:`selecting_enabled` is ``false``, no selection will occur. + ---- .. _class_TextEdit_method_select_all: @@ -1103,6 +1117,8 @@ Perform selection, from line/column to line/column. Select all the text. +If :ref:`selecting_enabled` is ``false``, no selection will occur. + ---- .. _class_TextEdit_method_set_line: diff --git a/classes/class_vector2.rst b/classes/class_vector2.rst index 5bed55cd7..df95034b8 100644 --- a/classes/class_vector2.rst +++ b/classes/class_vector2.rst @@ -194,7 +194,7 @@ Returns a new vector with all components in absolute values (i.e. positive). Returns the vector's angle in radians with respect to the X axis, or ``(1, 0)`` vector. -Equivalent to the result of :ref:`@GDScript.atan2` when called with the vector's :ref:`x` and :ref:`y` as parameters: ``atan2(x, y)``. +Equivalent to the result of :ref:`@GDScript.atan2` when called with the vector's :ref:`y` and :ref:`x` as parameters: ``atan2(y, x)``. ----