Skip to content

Commit

Permalink
Merge pull request #10441 from godotengine/classref/sync-99a8ab7
Browse files Browse the repository at this point in the history
classref: Sync with current master branch (99a8ab7)
  • Loading branch information
mhilbrunner authored Dec 28, 2024
2 parents 1cfa7d8 + 7704954 commit a330baa
Show file tree
Hide file tree
Showing 22 changed files with 146 additions and 88 deletions.
4 changes: 2 additions & 2 deletions classes/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -2329,7 +2329,7 @@ Key Code mask.

.. rst-class:: classref-enumeration-constant

:ref:`KeyModifierMask<enum_@GlobalScope_KeyModifierMask>` **KEY_MODIFIER_MASK** = ``532676608``
:ref:`KeyModifierMask<enum_@GlobalScope_KeyModifierMask>` **KEY_MODIFIER_MASK** = ``2130706432``

Modifier key mask.

Expand Down Expand Up @@ -6452,7 +6452,7 @@ Converts one or more arguments of any type to string in the best way possible an

.. code-tab:: csharp

var a = new Godot.Collections.Array { 1, 2, 3 };
Godot.Collections.Array a = [1, 2, 3];
GD.Print("a", "b", a); // Prints ab[1, 2, 3]


Expand Down
20 changes: 10 additions & 10 deletions classes/class_array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ An array data structure that can contain a sequence of elements of any :ref:`Var

.. code-tab:: csharp

var array = new Godot.Collections.Array{"First", 2, 3, "Last"};
Godot.Collections.Array array = ["First", 2, 3, "Last"];
GD.Print(array[0]); // Prints "First"
GD.Print(array[2]); // Prints 3
GD.Print(array[array.Count - 1]); // Prints "Last"
GD.Print(array[^1]); // Prints "Last"

array[2] = "Second";
array[1] = "Second";
GD.Print(array[1]); // Prints "Second"
GD.Print(array[array.Count - 3]); // Prints "Second"
GD.Print(array[^3]); // Prints "Second"



Expand Down Expand Up @@ -707,7 +707,7 @@ This method can often be combined with :ref:`resize<class_Array_method_resize>`

.. code-tab:: csharp

var array = new Godot.Collections.Array();
Godot.Collections.Array array = [];
array.Resize(5);
array.Fill(2);
GD.Print(array); // Prints [2, 2, 2, 2, 2]
Expand Down Expand Up @@ -874,7 +874,7 @@ Returns ``true`` if the array contains the given ``value``.

.. code-tab:: csharp

var arr = new Godot.Collections.Array { "inside", 7 };
Godot.Collections.Array arr = ["inside", 7];
// By C# convention, this method is renamed to `Contains`.
GD.Print(arr.Contains("inside")); // Prints True
GD.Print(arr.Contains("outside")); // Prints False
Expand Down Expand Up @@ -1068,7 +1068,7 @@ Returns a random element from the array. Generates an error and returns ``null``

.. code-tab:: csharp

var array = new Godot.Collections.Array { 1, 2, 3.25f, "Hi" };
Godot.Collections.Array array = [1, 2, 3.25f, "Hi"];
GD.Print(array.PickRandom()); // May print 1, 2, 3.25, or "Hi".


Expand Down Expand Up @@ -1355,7 +1355,7 @@ Sorts the array in ascending order. The final order is dependent on the "less th

.. code-tab:: csharp

var numbers = new Godot.Collections.Array { 10, 5, 2.5, 8 };
Godot.Collections.Array numbers = [10, 5, 2.5, 8];
numbers.Sort();
GD.Print(numbers); // Prints [2.5, 5, 8, 10]

Expand Down Expand Up @@ -1448,8 +1448,8 @@ Appends the ``right`` array to the left operand, creating a new **Array**. This
.. code-tab:: csharp

// Note that concatenation is not possible with C#'s native Array type.
var array1 = new Godot.Collections.Array{"One", 2};
var array2 = new Godot.Collections.Array{3, "Four"};
Godot.Collections.Array array1 = ["One", 2];
Godot.Collections.Array array2 = [3, "Four"];
GD.Print(array1 + array2); // Prints ["One", 2, 3, "Four"]


Expand Down
8 changes: 4 additions & 4 deletions classes/class_arraymesh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ The most basic example is the creation of a single triangle:

.. code-tab:: csharp

var vertices = new Vector3[]
{
Vector3[] vertices =
[
new Vector3(0, 1, 0),
new Vector3(1, 0, 0),
new Vector3(0, 0, 1),
};
];

// Initialize the ArrayMesh.
var arrMesh = new ArrayMesh();
var arrays = new Godot.Collections.Array();
Godot.Collections.Array arrays = [];
arrays.Resize((int)Mesh.ArrayType.Max);
arrays[(int)Mesh.ArrayType.Vertex] = vertices;

Expand Down
2 changes: 1 addition & 1 deletion classes/class_displayserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4440,7 +4440,7 @@ Passing an empty array will disable passthrough support (all mouse events will b
DisplayServer.WindowSetMousePassthrough(GetNode<Polygon2D>("Polygon2D").Polygon);

// Reset region to default.
DisplayServer.WindowSetMousePassthrough(new Vector2[] {});
DisplayServer.WindowSetMousePassthrough([]);



Expand Down
8 changes: 4 additions & 4 deletions classes/class_dtlsserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Below a small example of how to use it:
server.listen(4242)
var key = load("key.key") # Your private key.
var cert = load("cert.crt") # Your X509 certificate.
dtls.setup(key, cert)
dtls.setup(TlsOptions.server(key, cert))

func _process(delta):
while server.is_connection_available():
Expand All @@ -66,19 +66,19 @@ Below a small example of how to use it:
{
private DtlsServer _dtls = new DtlsServer();
private UdpServer _server = new UdpServer();
private Godot.Collections.Array<PacketPeerDtls> _peers = new Godot.Collections.Array<PacketPeerDtls>();
private Godot.Collections.Array<PacketPeerDtls> _peers = [];

public override void _Ready()
{
_server.Listen(4242);
var key = GD.Load<CryptoKey>("key.key"); // Your private key.
var cert = GD.Load<X509Certificate>("cert.crt"); // Your X509 certificate.
_dtls.Setup(key, cert);
_dtls.Setup(TlsOptions.Server(key, cert));
}

public override void _Process(double delta)
{
while (Server.IsConnectionAvailable())
while (_server.IsConnectionAvailable())
{
PacketPeerUdp peer = _server.TakeConnection();
PacketPeerDtls dtlsPeer = _dtls.TakeConnection(peer);
Expand Down
10 changes: 5 additions & 5 deletions classes/class_editorimportplugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Below is an example EditorImportPlugin that imports a :ref:`Mesh<class_Mesh>` fr

public override string[] _GetRecognizedExtensions()
{
return new string[] { "special", "spec" };
return ["special", "spec"];
}

public override string _GetSaveExtension()
Expand All @@ -110,14 +110,14 @@ Below is an example EditorImportPlugin that imports a :ref:`Mesh<class_Mesh>` fr

public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetImportOptions(string path, int presetIndex)
{
return new Godot.Collections.Array<Godot.Collections.Dictionary>
{
return
[
new Godot.Collections.Dictionary
{
{ "name", "myOption" },
{ "default_value", false },
}
};
},
];
}

public override Error _Import(string sourceFile, string savePath, Godot.Collections.Dictionary options, Godot.Collections.Array<string> platformVariants, Godot.Collections.Array<string> genFiles)
Expand Down
2 changes: 2 additions & 0 deletions classes/class_editorinterface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ Plays the main scene.

|void| **popup_create_dialog**\ (\ callback\: :ref:`Callable<class_Callable>`, base_type\: :ref:`StringName<class_StringName>` = "", current_type\: :ref:`String<class_String>` = "", dialog_title\: :ref:`String<class_String>` = "", type_blocklist\: :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] = [], type_suffixes\: :ref:`Dictionary<class_Dictionary>` = {}\ ) :ref:`🔗<class_EditorInterface_method_popup_create_dialog>`

**Experimental:** This method may be changed or removed in future versions.

Pops up an editor dialog for creating an object.

The ``callback`` must take a single argument of type :ref:`StringName<class_StringName>` which will contain the type name of the selected object or be empty if no item is selected.
Expand Down
14 changes: 0 additions & 14 deletions classes/class_editorsettings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@ Properties
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Color<class_Color>` | :ref:`editors/bone_mapper/handle_colors/unset<class_EditorSettings_property_editors/bone_mapper/handle_colors/unset>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`editors/grid_map/editor_side<class_EditorSettings_property_editors/grid_map/editor_side>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`editors/grid_map/palette_min_width<class_EditorSettings_property_editors/grid_map/palette_min_width>` |
+---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`editors/grid_map/pick_distance<class_EditorSettings_property_editors/grid_map/pick_distance>` |
Expand Down Expand Up @@ -2275,18 +2273,6 @@ The modulate color to use for "past" frames displayed in the animation editor's

----

.. _class_EditorSettings_property_editors/grid_map/editor_side:

.. rst-class:: classref-property

:ref:`int<class_int>` **editors/grid_map/editor_side** :ref:`🔗<class_EditorSettings_property_editors/grid_map/editor_side>`

Specifies the side of 3D editor's viewport where GridMap's mesh palette will appear.

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

----

.. _class_EditorSettings_property_editors/grid_map/palette_min_width:

.. rst-class:: classref-property
Expand Down
10 changes: 5 additions & 5 deletions classes/class_editortranslationparserplugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Below shows an example of a custom parser that extracts strings from a CSV file

public override string[] _GetRecognizedExtensions()
{
return new string[] { "csv" };
return ["csv"];
}
}

Expand All @@ -92,11 +92,11 @@ To add a translatable string associated with context or plural, add it to ``msgi
.. code-tab:: csharp

// This will add a message with msgid "Test 1", msgctxt "context", and msgid_plural "test 1 plurals".
msgidsContextPlural.Add(new Godot.Collections.Array{"Test 1", "context", "test 1 Plurals"});
msgidsContextPlural.Add(["Test 1", "context", "test 1 Plurals"]);
// This will add a message with msgid "A test without context" and msgid_plural "plurals".
msgidsContextPlural.Add(new Godot.Collections.Array{"A test without context", "", "plurals"});
msgidsContextPlural.Add(["A test without context", "", "plurals"]);
// This will add a message with msgid "Only with context" and msgctxt "a friendly context".
msgidsContextPlural.Add(new Godot.Collections.Array{"Only with context", "a friendly context", ""});
msgidsContextPlural.Add(["Only with context", "a friendly context", ""]);



Expand Down Expand Up @@ -126,7 +126,7 @@ To add a translatable string associated with context or plural, add it to ``msgi

public override string[] _GetRecognizedExtensions()
{
return new string[] { "gd" };
return ["gd"];
}


Expand Down
2 changes: 1 addition & 1 deletion classes/class_geometry2d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ The operation may result in an outer polygon (boundary) and inner polygon (hole)

.. code-tab:: csharp

var polygon = new Vector2[] { new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100) };
Vector2[] polygon = [new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100)];
var offset = new Vector2(50, 50);
polygon = new Transform2D(0, offset) * polygon;
GD.Print((Variant)polygon); // Prints [(50, 50), (150, 50), (150, 150), (50, 150)]
Expand Down
2 changes: 1 addition & 1 deletion classes/class_httpclient.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ To create a POST request with query strings to push to the server, do:

var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } };
string queryString = new HttpClient().QueryStringFromDict(fields);
string[] headers = { "Content-Type: application/x-www-form-urlencoded", $"Content-Length: {queryString.Length}" };
string[] headers = ["Content-Type: application/x-www-form-urlencoded", $"Content-Length: {queryString.Length}"];
var result = new HttpClient().Request(HttpClient.Method.Post, "index.php", headers, queryString);


Expand Down
6 changes: 3 additions & 3 deletions classes/class_navigationpolygon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To bake a navigation mesh at least one outline needs to be added that defines th
.. code-tab:: csharp

var newNavigationMesh = new NavigationPolygon();
var boundingOutline = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) };
Vector2[] boundingOutline = [new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0)];
newNavigationMesh.AddOutline(boundingOutline);
NavigationServer2D.BakeFromSourceGeometryData(newNavigationMesh, new NavigationMeshSourceGeometryData2D());
GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
Expand All @@ -63,9 +63,9 @@ Adding vertices and polygon indices manually.
.. code-tab:: csharp

var newNavigationMesh = new NavigationPolygon();
var newVertices = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) };
Vector2[] newVertices = [new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0)];
newNavigationMesh.Vertices = newVertices;
var newPolygonIndices = new int[] { 0, 1, 2, 3 };
int[] newPolygonIndices = [0, 1, 2, 3];
newNavigationMesh.AddPolygon(newPolygonIndices);
GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh;

Expand Down
Loading

0 comments on commit a330baa

Please sign in to comment.