Skip to content

Commit

Permalink
Merge pull request #9359 from godotengine/classref/sync-2ba22d1
Browse files Browse the repository at this point in the history
classref: Sync with current master branch (2ba22d1)
  • Loading branch information
mhilbrunner committed May 12, 2024
2 parents d404711 + 52e63d3 commit fef0629
Show file tree
Hide file tree
Showing 34 changed files with 626 additions and 111 deletions.
2 changes: 2 additions & 0 deletions classes/class_@globalscope.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6853,6 +6853,8 @@ Maps a ``value`` from range ``[istart, istop]`` to ``[ostart, ostop]``. See also

For complex use cases where multiple ranges are needed, consider using :ref:`Curve<class_Curve>` or :ref:`Gradient<class_Gradient>` instead.

\ **Note:** If ``istart == istop``, the return value is undefined (most likely NaN, INF, or -INF).

.. rst-class:: classref-item-separator

----
Expand Down
2 changes: 1 addition & 1 deletion classes/class_compositor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Compositor
==========

**Experimental:** More customisation of the rendering pipeline will be added in the future.
**Experimental:** More customization of the rendering pipeline will be added in the future.

**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`

Expand Down
105 changes: 53 additions & 52 deletions classes/class_crypto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,67 +28,68 @@ Currently, this includes asymmetric key encryption/decryption, signing/verificat

.. code-tab:: gdscript

extends Node

var crypto = Crypto.new()
var key = CryptoKey.new()
var cert = X509Certificate.new()

func _ready():
# Generate new RSA key.
key = crypto.generate_rsa(4096)
# Generate new self-signed certificate with the given key.
cert = crypto.generate_self_signed_certificate(key, "CN=mydomain.com,O=My Game Company,C=IT")
# Save key and certificate in the user folder.
key.save("user://generated.key")
cert.save("user://generated.crt")
# Encryption
var data = "Some data"
var encrypted = crypto.encrypt(key, data.to_utf8_buffer())
# Decryption
var decrypted = crypto.decrypt(key, encrypted)
# Signing
var signature = crypto.sign(HashingContext.HASH_SHA256, data.sha256_buffer(), key)
# Verifying
var verified = crypto.verify(HashingContext.HASH_SHA256, data.sha256_buffer(), signature, key)
# Checks
assert(verified)
assert(data.to_utf8_buffer() == decrypted)
# Generate new RSA key.
var key = crypto.generate_rsa(4096)

# Generate new self-signed certificate with the given key.
var cert = crypto.generate_self_signed_certificate(key, "CN=mydomain.com,O=My Game Company,C=IT")

# Save key and certificate in the user folder.
key.save("user://generated.key")
cert.save("user://generated.crt")

# Encryption
var data = "Some data"
var encrypted = crypto.encrypt(key, data.to_utf8_buffer())

# Decryption
var decrypted = crypto.decrypt(key, encrypted)

# Signing
var signature = crypto.sign(HashingContext.HASH_SHA256, data.sha256_buffer(), key)

# Verifying
var verified = crypto.verify(HashingContext.HASH_SHA256, data.sha256_buffer(), signature, key)

# Checks
assert(verified)
assert(data.to_utf8_buffer() == decrypted)

.. code-tab:: csharp

using Godot;
using System.Diagnostics;

public partial class MyNode : Node
{
private Crypto _crypto = new Crypto();
private CryptoKey _key = new CryptoKey();
private X509Certificate _cert = new X509Certificate();
Crypto crypto = new Crypto();

// Generate new RSA key.
CryptoKey key = crypto.GenerateRsa(4096);

// Generate new self-signed certificate with the given key.
X509Certificate cert = crypto.GenerateSelfSignedCertificate(key, "CN=mydomain.com,O=My Game Company,C=IT");

// Save key and certificate in the user folder.
key.Save("user://generated.key");
cert.Save("user://generated.crt");

// Encryption
string data = "Some data";
byte[] encrypted = crypto.Encrypt(key, data.ToUtf8Buffer());

// Decryption
byte[] decrypted = crypto.Decrypt(key, encrypted);

// Signing
byte[] signature = crypto.Sign(HashingContext.HashType.Sha256, Data.Sha256Buffer(), key);

// Verifying
bool verified = crypto.Verify(HashingContext.HashType.Sha256, Data.Sha256Buffer(), signature, key);

public override void _Ready()
{
// Generate new RSA key.
_key = _crypto.GenerateRsa(4096);
// Generate new self-signed certificate with the given key.
_cert = _crypto.GenerateSelfSignedCertificate(_key, "CN=mydomain.com,O=My Game Company,C=IT");
// Save key and certificate in the user folder.
_key.Save("user://generated.key");
_cert.Save("user://generated.crt");
// Encryption
string data = "Some data";
byte[] encrypted = _crypto.Encrypt(_key, data.ToUtf8Buffer());
// Decryption
byte[] decrypted = _crypto.Decrypt(_key, encrypted);
// Signing
byte[] signature = _crypto.Sign(HashingContext.HashType.Sha256, Data.Sha256Buffer(), _key);
// Verifying
bool verified = _crypto.Verify(HashingContext.HashType.Sha256, Data.Sha256Buffer(), signature, _key);
// Checks
Debug.Assert(verified);
Debug.Assert(data.ToUtf8Buffer() == decrypted);
}
}
// Checks
Debug.Assert(verified);
Debug.Assert(data.ToUtf8Buffer() == decrypted);



Expand Down
2 changes: 1 addition & 1 deletion classes/class_cryptokey.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CryptoKey

**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`

A cryptographic key (RSA).
A cryptographic key (RSA or elliptic-curve).

.. rst-class:: classref-introduction-group

Expand Down
6 changes: 4 additions & 2 deletions classes/class_displayserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3271,9 +3271,11 @@ To fallback to a default refresh rate if the method fails, try:

Returns the scale factor of the specified screen by index.

\ **Note:** On macOS returned value is ``2.0`` for hiDPI (Retina) screen, and ``1.0`` for all other cases.
\ **Note:** On macOS, the returned value is ``2.0`` for hiDPI (Retina) screens, and ``1.0`` for all other cases.

\ **Note:** This method is implemented only on macOS.
\ **Note:** On Linux (Wayland), the returned value is accurate only when ``screen`` is :ref:`SCREEN_OF_MAIN_WINDOW<class_DisplayServer_constant_SCREEN_OF_MAIN_WINDOW>`. Due to API limitations, passing a direct index will return a rounded-up integer, if the screen has a fractional scale (e.g. ``1.25`` would get rounded up to ``2.0``).

\ **Note:** This method is implemented only on macOS and Linux (Wayland).

.. rst-class:: classref-item-separator

Expand Down
14 changes: 14 additions & 0 deletions classes/class_editorfiledialog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ Methods
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`invalidate<class_EditorFileDialog_method_invalidate>`\ (\ ) |
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`popup_file_dialog<class_EditorFileDialog_method_popup_file_dialog>`\ (\ ) |
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_option_default<class_EditorFileDialog_method_set_option_default>`\ (\ option\: :ref:`int<class_int>`, default_value_index\: :ref:`int<class_int>`\ ) |
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_option_name<class_EditorFileDialog_method_set_option_name>`\ (\ option\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ ) |
Expand Down Expand Up @@ -577,6 +579,18 @@ Notify the **EditorFileDialog** that its view of the data is no longer accurate.

----

.. _class_EditorFileDialog_method_popup_file_dialog:

.. rst-class:: classref-method

|void| **popup_file_dialog**\ (\ )

Shows the **EditorFileDialog** at the default size and position for file dialogs in the editor, and selects the file name if there is a current file.

.. rst-class:: classref-item-separator

----

.. _class_EditorFileDialog_method_set_option_default:

.. rst-class:: classref-method
Expand Down
14 changes: 14 additions & 0 deletions classes/class_editorplugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ Methods
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_undo_redo_inspector_hook_callback<class_EditorPlugin_method_remove_undo_redo_inspector_hook_callback>`\ (\ callable\: :ref:`Callable<class_Callable>`\ ) |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_dock_tab_icon<class_EditorPlugin_method_set_dock_tab_icon>`\ (\ control\: :ref:`Control<class_Control>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_force_draw_over_forwarding_enabled<class_EditorPlugin_method_set_force_draw_over_forwarding_enabled>`\ (\ ) |
+-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_input_event_forwarding_always_enabled<class_EditorPlugin_method_set_input_event_forwarding_always_enabled>`\ (\ ) |
Expand Down Expand Up @@ -1631,6 +1633,18 @@ Removes a callback previously added by :ref:`add_undo_redo_inspector_hook_callba

----

.. _class_EditorPlugin_method_set_dock_tab_icon:

.. rst-class:: classref-method

|void| **set_dock_tab_icon**\ (\ control\: :ref:`Control<class_Control>`, icon\: :ref:`Texture2D<class_Texture2D>`\ )

Sets the tab icon for the given control in a dock slot. Setting to ``null`` removes the icon.

.. rst-class:: classref-item-separator

----

.. _class_EditorPlugin_method_set_force_draw_over_forwarding_enabled:

.. rst-class:: classref-method
Expand Down
28 changes: 14 additions & 14 deletions classes/class_editorsettings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ Properties
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Color<class_Color>` | :ref:`editors/3d_gizmos/gizmo_colors/joint<class_EditorSettings_property_editors/3d_gizmos/gizmo_colors/joint>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Color<class_Color>` | :ref:`editors/3d_gizmos/gizmo_colors/shape<class_EditorSettings_property_editors/3d_gizmos/gizmo_colors/shape>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`editors/animation/autorename_animation_tracks<class_EditorSettings_property_editors/animation/autorename_animation_tracks>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`editors/animation/default_create_bezier_tracks<class_EditorSettings_property_editors/animation/default_create_bezier_tracks>` |
Expand Down Expand Up @@ -327,6 +325,8 @@ Properties
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`interface/editor/display_scale<class_EditorSettings_property_interface/editor/display_scale>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`interface/editor/dock_tab_style<class_EditorSettings_property_interface/editor/dock_tab_style>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`interface/editor/editor_language<class_EditorSettings_property_interface/editor/editor_language>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`interface/editor/editor_screen<class_EditorSettings_property_interface/editor/editor_screen>` |
Expand Down Expand Up @@ -1579,18 +1579,6 @@ The 3D editor gizmo color for :ref:`Joint3D<class_Joint3D>`\ s and :ref:`Physica

----

.. _class_EditorSettings_property_editors/3d_gizmos/gizmo_colors/shape:

.. rst-class:: classref-property

:ref:`Color<class_Color>` **editors/3d_gizmos/gizmo_colors/shape**

The 3D editor gizmo color for :ref:`CollisionShape3D<class_CollisionShape3D>`\ s, :ref:`VehicleWheel3D<class_VehicleWheel3D>`\ s, :ref:`RayCast3D<class_RayCast3D>`\ s and :ref:`SpringArm3D<class_SpringArm3D>`\ s.

.. rst-class:: classref-item-separator

----

.. _class_EditorSettings_property_editors/animation/autorename_animation_tracks:

.. rst-class:: classref-property
Expand Down Expand Up @@ -2489,6 +2477,18 @@ If set to **Custom**, the scaling value in :ref:`interface/editor/custom_display

----

.. _class_EditorSettings_property_interface/editor/dock_tab_style:

.. rst-class:: classref-property

:ref:`int<class_int>` **interface/editor/dock_tab_style**

Tab style of editor docks.

.. rst-class:: classref-item-separator

----

.. _class_EditorSettings_property_interface/editor/editor_language:

.. rst-class:: classref-property
Expand Down
2 changes: 1 addition & 1 deletion classes/class_enetconnection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ Call this function regularly to handle connections, disconnections, and to recei

|void| **socket_send**\ (\ destination_address\: :ref:`String<class_String>`, destination_port\: :ref:`int<class_int>`, packet\: :ref:`PackedByteArray<class_PackedByteArray>`\ )

Sends a ``packet`` toward a destination from the address and port currently bound by this ENetConnection instance.
Sends a ``packet`` toward a destination from the address and port currently bound by this ENetConnection instance.

This is useful as it serves to establish entries in NAT routing tables on all devices between this bound instance and the public facing internet, allowing a prospective client's connection packets to be routed backward through the NAT device(s) between the public internet and this host.

Expand Down

0 comments on commit fef0629

Please sign in to comment.