From 08c3a2241d4b761db3a7e8262bec5ca91848ae8d Mon Sep 17 00:00:00 2001 From: Chris Bradfield Date: Sat, 23 Feb 2019 18:56:10 -0800 Subject: [PATCH] [DOCS] Minor classref updates. --- doc/classes/Array.xml | 64 +++++++++++++++++----------------- doc/classes/SceneTree.xml | 7 ++++ doc/classes/SceneTreeTimer.xml | 11 ++++++ 3 files changed, 50 insertions(+), 32 deletions(-) diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 6bd0ef34219..0b5c0eb0b37 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -4,7 +4,7 @@ Generic array datatype. - Generic array, contains several elements of any type, accessible by a numerical index starting at 0. Negative indices can be used to count from the back, like in Python (-1 is the last element, -2 the second to last, etc.). Example: + Generic array which can contain several elements of any type, accessible by a numerical index starting at 0. Negative indices can be used to count from the back, like in Python (-1 is the last element, -2 the second to last, etc.). Example: [codeblock] var array = ["One", 2, 3, "Four"] print(array[0]) # One @@ -26,7 +26,7 @@ - Construct an array from a [PoolColorArray]. + Constructs an array from a [PoolColorArray]. @@ -35,7 +35,7 @@ - Construct an array from a [PoolVector3Array]. + Constructs an array from a [PoolVector3Array]. @@ -44,7 +44,7 @@ - Construct an array from a [PoolVector2Array]. + Constructs an array from a [PoolVector2Array]. @@ -53,7 +53,7 @@ - Construct an array from a [PoolStringArray]. + Constructs an array from a [PoolStringArray]. @@ -62,7 +62,7 @@ - Construct an array from a [PoolRealArray]. + Constructs an array from a [PoolRealArray]. @@ -71,7 +71,7 @@ - Construct an array from a [PoolIntArray]. + Constructs an array from a [PoolIntArray]. @@ -80,21 +80,21 @@ - Construct an array from a [PoolByteArray]. + Constructs an array from a [PoolByteArray]. - Append an element at the end of the array (alias of [method push_back]). + Appends an element at the end of the array (alias of [method push_back]). - Returns the last element of the array if the array is not empty (size>0). + Returns the last element of the array if the array is not empty. @@ -125,7 +125,7 @@ - Clear the array (resize to 0). + Clears the array (resizes to 0). @@ -134,7 +134,7 @@ - Return the amount of times an element is in the array. + Returns the number of times an element is in the array. @@ -144,21 +144,21 @@ Returns a copy of the array. - If [code]deep[/code] is [code]true[/code], a deep copy is be performed: all nested arrays and dictionaries are duplicated and will not be shared with the original array. If [code]false[/code], a shallow copy is made and references to the original nested arrays and dictionaries are kept, so that modifying a sub-array or dictionary in the copy will also impact those referenced in the source array. + If [code]deep[/code] is [code]true[/code], a deep copy is performed: all nested arrays and dictionaries are duplicated and will not be shared with the original array. If [code]false[/code], a shallow copy is made and references to the original nested arrays and dictionaries are kept, so that modifying a sub-array or dictionary in the copy will also impact those referenced in the source array. - Return true if the array is empty (size==0). + Returns [code]true[/code] if the array is empty. - Remove the first occurrence of a value from the array. + Removes the first occurrence of a value from the array. @@ -185,7 +185,7 @@ - Returns the first element of the array if the array is not empty (size>0). + Returns the first element of the array if the array is not empty. @@ -194,7 +194,7 @@ - Return true if the array contains given value. + Returns [code]true[/code] if the array contains the given value. [codeblock] ["inside", 7].has("inside") == true ["inside", 7].has("outside") == false @@ -207,7 +207,7 @@ - Return a hashed integer value representing the array contents. + Returns a hashed integer value representing the array contents. @@ -216,68 +216,68 @@ - Insert a new element at a given position in the array. The position must be valid, or at the end of the array ([code]pos == size()[/code]). + Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]pos == size()[/code]). - Reverse the order of the elements in the array. + Reverses the order of the elements in the array. - Return maximum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. + Returns the maximum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. - Return minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. + Returns the minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. - Remove the last element of the array. + Removes the last element of the array. - Remove the first element of the array. + Removes the first element of the array. - Append an element at the end of the array. + Appends an element at the end of the array. - Add an element at the beginning of the array. + Adds an element at the beginning of the array. - Remove an element from the array by index. + Removes an element from the array by index. - Resize the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are Null. + Resizes the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are Null. @@ -293,19 +293,19 @@ - Shuffle the array such that the items will have a random order. + Shuffles the array such that the items will have a random order. - Return the amount of elements in the array. + Returns the number of elements in the array. - Sort the array using natural order. + Sorts the array. Note: strings are sorted in alphabetical, not natural order. @@ -314,7 +314,7 @@ - Sort the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. + Sorts the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. [b]Note:[/b] you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior. [codeblock] class MyCustomSorter: diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index f39d221d898..7e696badb26 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -64,6 +64,13 @@ Returns a [SceneTreeTimer] which will [signal SceneTreeTimer.timeout] after the given time in seconds elapsed in this SceneTree. If [code]pause_mode_process[/code] is set to false, pausing the SceneTree will also pause the timer. + Commonly used to create a one-shot delay timer as in the following example: + [codeblock] + func some_function(): + print("start") + yield(get_tree().create_timer(1.0), "timeout") + print("end") + [/codeblock] diff --git a/doc/classes/SceneTreeTimer.xml b/doc/classes/SceneTreeTimer.xml index e1234ce88a6..f3a79a407e9 100644 --- a/doc/classes/SceneTreeTimer.xml +++ b/doc/classes/SceneTreeTimer.xml @@ -1,8 +1,17 @@ + One-shot timer. + A one-shot timer managed by the scene tree, which emits [signal timeout] on completion. See also [method SceneTree.create_timer]. + As opposed to a [class Timer], does not require the instantiation of a node. Commonly used to create a one-shot delay timer as in the following example: + [codeblock] + func some_function(): + print("start") + yield(get_tree().create_timer(1.0), "timeout") + print("end") + [/codeblock] @@ -12,11 +21,13 @@ + The time remaining. + Emitted when the timer reaches 0.