From b80c42ef4e99ee155a98c7a2f17201280612257f Mon Sep 17 00:00:00 2001 From: eska Date: Sat, 30 Jul 2016 20:41:38 +0200 Subject: [PATCH] Document FuncRef, GDFunctionState, InstancePlaceholder, RID, World2D --- core/func_ref.cpp | 2 +- doc/base/classes.xml | 28 ++++++++++++++++++++++++++-- modules/gdscript/gd_editor.cpp | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/core/func_ref.cpp b/core/func_ref.cpp index 29b06ae9a0f..644d8b5b63c 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -65,7 +65,7 @@ void FuncRef::_bind_methods() { mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); defargs.push_back(Variant()); } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_func",&FuncRef::call_func,mi,defargs); + ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_func:Variant",&FuncRef::call_func,mi,defargs); } diff --git a/doc/base/classes.xml b/doc/base/classes.xml index dc24231dd03..b7b0502eaad 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -660,7 +660,7 @@ - Stop the function execution and return the current state. Call resume on the state to resume execution. This makes the state invalid. + Stop the function execution and return the current state. Call [method GDFunctionState.resume] on the state to resume execution. This invalidates the state. Returns anything that was passed to the resume function call. If passed an object and a signal, the execution is resumed when the object's signal is emmited. @@ -13042,8 +13042,11 @@ + Reference to a function in an object. + In GDScript, functions are not [i]first-class objects[/i]. This means it is impossible to store them directly as variables, return them from another function, or pass them as arguments. + However, by creating a [FuncRef] using the [method @GDScript.funcref] function, a reference to a function in a given object can be created, passed around and called. @@ -13068,18 +13071,21 @@ + Call the referenced function with the given arguments. The argument count must correspond to the required number of arguments in the function. Returns the return value of the function call. + Set the name of the function to call on the object, without parentheses or any parameters. + Set the object on which to call the referenced function. This object must be of a type actually inheriting from [Object], not a built-in type such as [int], [Vector2] or [Dictionary]. @@ -13088,15 +13094,17 @@ + State of a function call after yielding. + Calling [method @GDScript.yield] within a function will cause that function to yield and return its current state as an object of this type. The yielded function call can then be resumed later by calling [method resume] on this state object. - Should put children to the top left corner instead of center of the container. + Check whether the function call may be resumed. This is not the case if the function state was already resumed. @@ -13105,6 +13113,9 @@ + Resume execution of the yielded function call. + If handed an argument, return the argument from the [method @GDScript.yield] call in the yielded function call. You can pass e.g. an [Array] to hand multiple arguments. + This function returns what the resumed function call returns, possibly another function state if yielded again. @@ -17235,20 +17246,25 @@ + Placeholder for the root [Node] of a [PackedScene]. + Turning on the option [b]Load As Placeholder[/b] for an instanced scene in the editor causes it to be replaced by an InstacePlaceholder when running the game. This makes it possible to delay actually loading the scene until calling [method replace_by_instance]. This is useful to avoid loading large scenes all at once by loading parts of it selectively. + The InstancePlaceholder does not have a transform. This causes any child nodes to be positioned relatively to the Viewport from point (0,0), rather than their parent as displayed in the editor. Replacing the placeholder with a scene with a transform will transform children relatively to their parent again. + Retrieve the path to the [PackedScene] resource file that is loaded by default when calling [method replace_by_instance]. + Replace this placeholder by the scene handed as an argument, or the original scene if no argument is given. As for all resources, the scene is loaded only if it's not loaded already. By manually loading the scene beforehand, delays caused by this function can be avoided. @@ -30280,8 +30296,10 @@ + Handle for a [Resource]'s unique ID. + The RID type is used to access the unique integer ID of a resource. They are opaque, so they do not grant access to the associated resource by themselves. They are used by and with the low-level Server classes such as [VisualServer]. @@ -30290,12 +30308,14 @@ + Create a new RID instance with the ID of a given resource. When not handed a valid resource, silently stores the unused ID 0. + Retrieve the ID of the referenced resource. @@ -46584,24 +46604,28 @@ + Retrieve the [RID] of this world's canvas resource. Used by the [VisualServer] for 2D drawing. + Retrieve the state of this world's physics space. This allows arbitrary querying for collision. + Retrieve the [RID] of this world's sound space resource. Used by the [SpatialSound2DServer] for 2D spatial audio. + Retrieve the [RID] of this world's physics space resource. Used by the [Physics2DServer] for 2D physics, treating it as both a space and an area. diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 520a8b18d86..b02e55cf9d5 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -297,7 +297,7 @@ void GDScriptLanguage::get_public_functions(List *p_functions) const } { MethodInfo mi; - mi.name="yield"; + mi.name="yield:GDFunctionState"; mi.arguments.push_back(PropertyInfo(Variant::OBJECT,"object")); mi.arguments.push_back(PropertyInfo(Variant::STRING,"signal")); mi.default_arguments.push_back(Variant::NIL);