summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/Makefile2
-rw-r--r--doc/classes/ARVRInterface.xml2
-rw-r--r--doc/classes/ARVRServer.xml2
-rw-r--r--doc/classes/AudioEffectDistortion.xml2
-rw-r--r--doc/classes/AudioStreamPlayer3D.xml4
-rw-r--r--doc/classes/CheckBox.xml2
-rw-r--r--doc/classes/EditorImportPlugin.xml2
-rw-r--r--doc/classes/EditorResourcePreview.xml2
-rw-r--r--doc/classes/EditorSelection.xml2
-rw-r--r--doc/classes/EditorSpatialGizmo.xml2
-rw-r--r--doc/classes/FileDialog.xml6
-rw-r--r--doc/classes/HTTPRequest.xml2
-rw-r--r--doc/classes/Input.xml16
-rw-r--r--doc/classes/ItemList.xml4
-rw-r--r--doc/classes/JSONParseResult.xml2
-rw-r--r--doc/classes/NinePatchRect.xml2
-rw-r--r--doc/classes/Object.xml4
-rw-r--r--doc/classes/Physics2DShapeQueryParameters.xml2
-rw-r--r--doc/classes/RayCast.xml2
-rw-r--r--doc/classes/RayCast2D.xml2
-rw-r--r--doc/classes/Spatial.xml8
-rw-r--r--doc/classes/StyleBoxFlat.xml6
-rw-r--r--doc/classes/Transform.xml4
-rw-r--r--doc/classes/Transform2D.xml2
-rw-r--r--doc/classes/Tween.xml8
-rw-r--r--doc/classes/VideoPlayer.xml4
-rw-r--r--doc/classes/Viewport.xml4
-rw-r--r--doc/classes/VisualScript.xml2
-rw-r--r--doc/classes/VisualServer.xml14
-rw-r--r--doc/classes/WeakRef.xml2
-rw-r--r--doc/tools/makerst.py20
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp1
-rw-r--r--drivers/gles3/shaders/scene.glsl8
-rw-r--r--editor/project_export.cpp12
-rw-r--r--editor/project_export.h1
-rw-r--r--modules/gdnative/gdnative.cpp65
-rw-r--r--modules/gdnative/gdnative.h12
-rw-r--r--modules/gdnative/gdnative_api.json8
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h4
-rw-r--r--modules/gdnative/include/nativearvr/godot_nativearvr.h22
-rw-r--r--modules/gdnative/nativearvr/arvr_interface_gdnative.cpp191
-rw-r--r--modules/gdnative/nativearvr/arvr_interface_gdnative.h6
-rw-r--r--modules/gdnative/nativearvr/register_types.cpp381
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp42
-rw-r--r--modules/gdnative/nativescript/register_types.cpp50
-rw-r--r--modules/gdnative/register_types.cpp70
-rw-r--r--scene/resources/style_box.cpp2
-rw-r--r--servers/visual_server.cpp1
48 files changed, 301 insertions, 713 deletions
diff --git a/doc/Makefile b/doc/Makefile
index d68c66f8eb..2f9fefe794 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -24,5 +24,5 @@ rst:
rm -rf $(OUTPUTDIR)/rst
mkdir -p $(OUTPUTDIR)/rst
pushd $(OUTPUTDIR)/rst
- python2 $(TOOLSDIR)/makerst.py $(CLASSES)
+ python $(TOOLSDIR)/makerst.py $(CLASSES)
popd
diff --git a/doc/classes/ARVRInterface.xml b/doc/classes/ARVRInterface.xml
index 1c2e761b57..9aed6c96ef 100644
--- a/doc/classes/ARVRInterface.xml
+++ b/doc/classes/ARVRInterface.xml
@@ -94,7 +94,7 @@
<argument index="0" name="initialized" type="bool">
</argument>
<description>
- Initialise/uninitilise this interface (same effect as calling intialize/uninitialize).
+ Initialize/uninitialize this interface (same effect as calling initialize/uninitialize).
</description>
</method>
<method name="set_is_primary">
diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml
index 86bfe88ea9..5e1055d568 100644
--- a/doc/classes/ARVRServer.xml
+++ b/doc/classes/ARVRServer.xml
@@ -178,7 +178,7 @@
Used internally to filter trackers of any known type.
</constant>
<constant name="TRACKER_ANY" value="255">
- Used interally to select all trackers.
+ Used internally to select all trackers.
</constant>
</constants>
</class>
diff --git a/doc/classes/AudioEffectDistortion.xml b/doc/classes/AudioEffectDistortion.xml
index 1a6aa1d2b6..8b970e675e 100644
--- a/doc/classes/AudioEffectDistortion.xml
+++ b/doc/classes/AudioEffectDistortion.xml
@@ -5,7 +5,7 @@
Modify the sound to make it dirty.
</brief_description>
<description>
- Modify the sound and make it dirty. Differents types available : clip, tan, lofi (bit crushing), overdrive, or waveshape.
+ Modify the sound and make it dirty. Different types are available : clip, tan, lofi (bit crushing), overdrive, or waveshape.
By distorting the waveform the frequency content change, which will often make the sound "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or speaker very efficiently.
</description>
<tutorials>
diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml
index 52914af9fc..84f6792ef0 100644
--- a/doc/classes/AudioStreamPlayer3D.xml
+++ b/doc/classes/AudioStreamPlayer3D.xml
@@ -310,7 +310,7 @@
Sets the absolute maximum of the soundlevel, in dB.
</member>
<member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance">
- Sets the distance from wich the 'out_of_range_mode' takes effect. Has no effect if set to 0.
+ Sets the distance from which the 'out_of_range_mode' takes effect. Has no effect if set to 0.
</member>
<member name="out_of_range_mode" type="int" setter="set_out_of_range_mode" getter="get_out_of_range_mode" enum="AudioStreamPlayer3D.OutOfRangeMode">
Decides if audio should pause when source is outside of 'max_distance' range.
@@ -355,7 +355,7 @@
Disables doppler tracking.
</constant>
<constant name="DOPPLER_TRACKING_IDLE_STEP" value="1">
- Executes doppler trackin in idle step.
+ Executes doppler tracking in idle step.
</constant>
<constant name="DOPPLER_TRACKING_PHYSICS_STEP" value="2">
Executes doppler tracking in physics step.
diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml
index 6258eb503f..50b431e00c 100644
--- a/doc/classes/CheckBox.xml
+++ b/doc/classes/CheckBox.xml
@@ -4,7 +4,7 @@
Binary choice user interface widget
</brief_description>
<description>
- A checkbox allows the user to make a binary choice (choosing only one of two posible options), for example Answer 'yes' or 'no'.
+ A checkbox allows the user to make a binary choice (choosing only one of two possible options), for example Answer 'yes' or 'no'.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml
index 05319e926c..da8f0f235b 100644
--- a/doc/classes/EditorImportPlugin.xml
+++ b/doc/classes/EditorImportPlugin.xml
@@ -35,7 +35,7 @@
func get_preset_name(i):
return "Default"
- func get_import_optons(i):
+ func get_import_options(i):
return [{"name": "my_option", "default_value": false}]
func load(src, dst, opts, r_platform_variants, r_gen_files):
diff --git a/doc/classes/EditorResourcePreview.xml b/doc/classes/EditorResourcePreview.xml
index acf36b6a08..5174d9243b 100644
--- a/doc/classes/EditorResourcePreview.xml
+++ b/doc/classes/EditorResourcePreview.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorResourcePreview" inherits="Node" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Helper to generate previews of reources or files.
+ Helper to generate previews of resources or files.
</brief_description>
<description>
This object is used to generate previews for resources of files.
diff --git a/doc/classes/EditorSelection.xml b/doc/classes/EditorSelection.xml
index 8d9bdd2c05..a6dc60ee7b 100644
--- a/doc/classes/EditorSelection.xml
+++ b/doc/classes/EditorSelection.xml
@@ -31,7 +31,7 @@
<return type="Array">
</return>
<description>
- Get the list of selectes nodes.
+ Get the list of selected nodes.
</description>
</method>
<method name="get_transformable_selected_nodes">
diff --git a/doc/classes/EditorSpatialGizmo.xml b/doc/classes/EditorSpatialGizmo.xml
index baab995fab..545eadeed2 100644
--- a/doc/classes/EditorSpatialGizmo.xml
+++ b/doc/classes/EditorSpatialGizmo.xml
@@ -96,7 +96,7 @@
<argument index="2" name="cancel" type="bool" default="false">
</argument>
<description>
- Commit a handle being edited (handles must have been prevously added by [method add_handles]).
+ Commit a handle being edited (handles must have been previously added by [method add_handles]).
If the cancel parameter is true, an option to restore the edited value to the original is provided.
</description>
</method>
diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml
index d7a08368a5..b3d131ca40 100644
--- a/doc/classes/FileDialog.xml
+++ b/doc/classes/FileDialog.xml
@@ -86,7 +86,7 @@
<return type="bool">
</return>
<description>
- Return true if the diaog allows show hidden files.
+ Return true if the dialog allows show hidden files.
</description>
</method>
<method name="set_access">
@@ -205,10 +205,10 @@
The dialog allows the selection of file and directory.
</constant>
<constant name="ACCESS_USERDATA" value="1">
- The dialog allows ascess files under [Resource] path(res://) .
+ The dialog allows access files under [Resource] path(res://) .
</constant>
<constant name="ACCESS_FILESYSTEM" value="2">
- The dialog allows ascess files in whole file system.
+ The dialog allows access files in whole file system.
</constant>
</constants>
<theme_items>
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml
index c2839890cf..b780d29d0e 100644
--- a/doc/classes/HTTPRequest.xml
+++ b/doc/classes/HTTPRequest.xml
@@ -166,7 +166,7 @@
Request does not have a response(yet).
</constant>
<constant name="RESULT_BODY_SIZE_LIMIT_EXCEEDED" value="7">
- Request exceded its maximum size limit, see [method set_body_size_limit].
+ Request exceeded its maximum size limit, see [method set_body_size_limit].
</constant>
<constant name="RESULT_REQUEST_FAILED" value="8">
Request failed. (unused)
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index e56200f63d..d2d01dacb4 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -4,7 +4,7 @@
A Singleton that deals with inputs.
</brief_description>
<description>
- A Singleton that deals with inputs. This includes key presses, mouse buttons and movement, joypads, and input actions.
+ A Singleton that deals with inputs. This includes key presses, mouse buttons and movement, joypads, and input actions. Actions and their events can be set in the Project Settings / Input Map tab. Or be set with [InputMap].
</description>
<tutorials>
</tutorials>
@@ -75,7 +75,7 @@
<argument index="1" name="axis" type="int">
</argument>
<description>
- Returns the current value of the joypad axis at given index (see JOY_* constants in [@Global Scope])
+ Returns the current value of the joypad axis at given index (see [code]JOY_*[/code] constants in [@Global Scope])
</description>
</method>
<method name="get_joy_axis_index_from_string">
@@ -180,6 +180,7 @@
<argument index="0" name="action" type="String">
</argument>
<description>
+ Returns [code]true[/code] when you start pressing the action event.
</description>
</method>
<method name="is_action_just_released" qualifiers="const">
@@ -188,6 +189,7 @@
<argument index="0" name="action" type="String">
</argument>
<description>
+ Returns [code]true[/code] when you stop pressing the action event.
</description>
</method>
<method name="is_action_pressed" qualifiers="const">
@@ -196,7 +198,7 @@
<argument index="0" name="action" type="String">
</argument>
<description>
- Returns true or false depending on whether the action event is pressed. Actions and their events can be set in the Project Settings / Input Map tab. Or be set with [InputMap].
+ Returns [code]true[/code] if you are pressing the action event.
</description>
</method>
<method name="is_joy_button_pressed" qualifiers="const">
@@ -207,7 +209,7 @@
<argument index="1" name="button" type="int">
</argument>
<description>
- Returns if the joypad button at the given index is currently pressed. (see JOY_* constants in [@Global Scope])
+ Returns [code]true[/code] if you are pressing the joypad button. (see [code]JOY_*[/code] constants in [@Global Scope])
</description>
</method>
<method name="is_joy_known">
@@ -216,7 +218,7 @@
<argument index="0" name="device" type="int">
</argument>
<description>
- Returns if the specified device is known by the system. This means that it sets all button and axis indices exactly as defined in the JOY_* constants (see [@Global Scope]). Unknown joypads are not expected to match these constants, but you can still retrieve events from them.
+ Returns [code]true[/code] if the system knows the specified device. This means that it sets all button and axis indices exactly as defined in the [code]JOY_*[/code] constants (see [@Global Scope]). Unknown joypads are not expected to match these constants, but you can still retrieve events from them.
</description>
</method>
<method name="is_key_pressed" qualifiers="const">
@@ -225,7 +227,7 @@
<argument index="0" name="scancode" type="int">
</argument>
<description>
- Returns true or false depending on whether the key is pressed or not. You can pass KEY_*, which are pre-defined constants listed in [@Global Scope].
+ Returns [code]true[/code] if you are pressing the key. You can pass [code]KEY_*[/code], which are pre-defined constants listed in [@Global Scope].
</description>
</method>
<method name="is_mouse_button_pressed" qualifiers="const">
@@ -234,7 +236,7 @@
<argument index="0" name="button" type="int">
</argument>
<description>
- Returns true or false depending on whether mouse button is pressed or not. You can pass BUTTON_*, which are pre-defined constants listed in [@Global Scope].
+ Returns [code]true[/code] if you are pressing the mouse button. You can pass [code]BUTTON_*[/code], which are pre-defined constants listed in [@Global Scope].
</description>
</method>
<method name="joy_connection_changed">
diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml
index a8d879888f..37c1db51f5 100644
--- a/doc/classes/ItemList.xml
+++ b/doc/classes/ItemList.xml
@@ -217,7 +217,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Returns whether the tooptip is enabled for specified item index.
+ Returns whether the tooltip is enabled for specified item index.
</description>
</method>
<method name="is_same_column_width" qualifiers="const">
@@ -511,7 +511,7 @@
<argument index="1" name="selected" type="bool">
</argument>
<description>
- Fired when a multiple selection is altered on a list allowing mutliple selection.
+ Fired when a multiple selection is altered on a list allowing multiple selection.
</description>
</signal>
</signals>
diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml
index 86edaaf1e6..db9a681896 100644
--- a/doc/classes/JSONParseResult.xml
+++ b/doc/classes/JSONParseResult.xml
@@ -79,7 +79,7 @@
The error message if JSON source was not successfully parsed. See [@Global Scope]ERR_* constants.
</member>
<member name="result" type="Variant" setter="set_result" getter="get_result">
- A [Variant] containing the parsed JSON. Use typeof() to check if it is what you expect. For exemple, if JSON source starts with braces [code]{}[/code] a [Dictionary] will be returned, if JSON source starts with array braces [code][][/code] an [Array] will be returned.
+ A [Variant] containing the parsed JSON. Use typeof() to check if it is what you expect. For example, if JSON source starts with braces [code]{}[/code] a [Dictionary] will be returned, if JSON source starts with array braces [code][][/code] an [Array] will be returned.
[i]Be aware that the JSON specification does not define integer or float types, but only a number type. Therefore, parsing a JSON text will convert all numerical values to float types.[/i]
[codeblock]
p = JSON.parse('["hello", "world", "!"]')
diff --git a/doc/classes/NinePatchRect.xml b/doc/classes/NinePatchRect.xml
index 6829b36e14..c74f3c5a68 100644
--- a/doc/classes/NinePatchRect.xml
+++ b/doc/classes/NinePatchRect.xml
@@ -111,7 +111,7 @@
If [code]true[/code], draw the panel's center. Else, only draw the 9-slice's borders. Default value: [code]true[/code]
</member>
<member name="patch_margin_bottom" type="int" setter="set_patch_margin" getter="get_patch_margin">
- The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values indivually to create panels with non-uniform borders.
+ The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
</member>
<member name="patch_margin_left" type="int" setter="set_patch_margin" getter="get_patch_margin">
The height of the 9-slice's left column.
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index 67421487f1..d30ebfaef8 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -6,7 +6,7 @@
<description>
Base class for all non built-in types. Everything not a built-in type starts the inheritance chain from this class.
Objects do not manage memory, if inheriting from one the object will most likely have to be deleted manually (call the [method free] function from the script or delete from C++).
- Some derivates add memory management, such as [Reference] (which keeps a reference count and deletes itself automatically when no longer referenced) and [Node], which deletes the children tree when deleted.
+ Some derivatives add memory management, such as [Reference] (which keeps a reference count and deletes itself automatically when no longer referenced) and [Node], which deletes the children tree when deleted.
Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them.
Objects also receive notifications ([method _notification]). Notifications are a simple way to notify the object about simple events, so they can all be handled together.
</description>
@@ -165,7 +165,7 @@
<return type="Array">
</return>
<description>
- Returns an [Array] of dictionaries with informations about signals that are connected to this object.
+ Returns an [Array] of dictionaries with information about signals that are connected to this object.
Inside each [Dictionary] there are 3 fields:
- "source" is a reference to signal emitter.
- "signal_name" is name of connected signal.
diff --git a/doc/classes/Physics2DShapeQueryParameters.xml b/doc/classes/Physics2DShapeQueryParameters.xml
index 78d12e0b73..d838ff2317 100644
--- a/doc/classes/Physics2DShapeQueryParameters.xml
+++ b/doc/classes/Physics2DShapeQueryParameters.xml
@@ -129,7 +129,7 @@
<argument index="0" name="transform" type="Transform2D">
</argument>
<description>
- Set the transormation matrix of the shape. This is necessary to set its position/rotation/scale.
+ Set the transformation matrix of the shape. This is necessary to set its position/rotation/scale.
</description>
</method>
</methods>
diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast.xml
index b75b72b218..3782a98e3e 100644
--- a/doc/classes/RayCast.xml
+++ b/doc/classes/RayCast.xml
@@ -180,7 +180,7 @@
The ray's destination point, relative to the RayCast's [code]position[/code].
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
- The RayCast's collison layer(s). Only bodies in the same collision layer(s) will be detected.
+ The RayCast's collision layer(s). Only bodies in the same collision layer(s) will be detected.
</member>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled">
If [code]true[/code], collisions will be reported. Default value: [code]false[/code].
diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml
index a42d2ab587..74ee0a8911 100644
--- a/doc/classes/RayCast2D.xml
+++ b/doc/classes/RayCast2D.xml
@@ -195,7 +195,7 @@
The ray's destination point, relative to the RayCast's [code]position[/code].
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
- The RayCast2D's collison layer(s). Only bodies in the same collision layer(s) will be detected.
+ The RayCast2D's collision layer(s). Only bodies in the same collision layer(s) will be detected.
</member>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled">
If [code]true[/code], collisions will be reported. Default value: [code]false[/code].
diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml
index 54eb82fbff..abb0bfa246 100644
--- a/doc/classes/Spatial.xml
+++ b/doc/classes/Spatial.xml
@@ -209,7 +209,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Makes the node ignore its parents tranformations. Node tranformations are only in global space.
+ Makes the node ignore its parents transformations. Node transformations are only in global space.
</description>
</method>
<method name="set_gizmo">
@@ -234,7 +234,7 @@
<return type="void">
</return>
<description>
- Reset all tranformations for this node. Set its [Transform3D] to identity matrix.
+ Reset all transformations for this node. Set its [Transform3D] to identity matrix.
</description>
</method>
<method name="set_ignore_transform_notification">
@@ -329,7 +329,7 @@
<argument index="0" name="local_point" type="Vector3">
</argument>
<description>
- Tranforms [Vector3] "local_point" from this node's local space to world space.
+ Transforms [Vector3] "local_point" from this node's local space to world space.
</description>
</method>
<method name="to_local" qualifiers="const">
@@ -338,7 +338,7 @@
<argument index="0" name="global_point" type="Vector3">
</argument>
<description>
- Tranforms [Vector3] "global_point" from world space to this node's local space.
+ Transforms [Vector3] "global_point" from world space to this node's local space.
</description>
</method>
<method name="translate">
diff --git a/doc/classes/StyleBoxFlat.xml b/doc/classes/StyleBoxFlat.xml
index b09b9f0679..756b7f9225 100644
--- a/doc/classes/StyleBoxFlat.xml
+++ b/doc/classes/StyleBoxFlat.xml
@@ -14,12 +14,12 @@
[codeblock]
height = 30
corner_radius_top_left = 50
- corner_raidus_bottom_left = 100
+ corner_radius_bottom_left = 100
[/codeblock]
The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will [b]never[/b] be more than the height. Result:
[codeblock]
corner_radius_top_left: 10
- corner_raidus_bottom_left: 20
+ corner_radius_bottom_left: 20
[/codeblock]
</description>
<tutorials>
@@ -268,7 +268,7 @@
</methods>
<members>
<member name="anti_aliasing" type="bool" setter="set_anti_aliased" getter="is_anti_aliased">
- Anti Aliasing draws a small ring around edges. This ring fades to transparent. As a result edges look much smoother. This is only noticable when using rounded corners.
+ Anti Aliasing draws a small ring around edges. This ring fades to transparent. As a result edges look much smoother. This is only noticeable when using rounded corners.
</member>
<member name="anti_aliasing_size" type="int" setter="set_aa_size" getter="get_aa_size">
This changes the size of the faded ring. Higher values can be used to achieve a "blurry" effect.
diff --git a/doc/classes/Transform.xml b/doc/classes/Transform.xml
index 6780de1943..cd80d568e7 100644
--- a/doc/classes/Transform.xml
+++ b/doc/classes/Transform.xml
@@ -68,7 +68,7 @@
<return type="Transform">
</return>
<description>
- Returns the inverse of the transfrom, under the assumption that the transformation is composed of rotation, scaling and translation.
+ Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
</description>
</method>
<method name="interpolate_with">
@@ -104,7 +104,7 @@
<return type="Transform">
</return>
<description>
- Returns the transfrom with the basis orthogonal (90 degrees), and normalized axis vectors.
+ Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
</description>
</method>
<method name="rotated">
diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml
index 0e39505ac3..76b9b0e845 100644
--- a/doc/classes/Transform2D.xml
+++ b/doc/classes/Transform2D.xml
@@ -112,7 +112,7 @@
<return type="Transform2D">
</return>
<description>
- Returns the transfrom with the basis orthogonal (90 degrees), and normalized axis vectors.
+ Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
</description>
</method>
<method name="rotated">
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index c90ac09557..23229aec4a 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -12,7 +12,7 @@
tween.start()
[/codeblock]
Some of the methods of this class require a property name. You can get the property name by hovering over the property in the inspector of the editor.
- Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an TRANS_* constant, and refers to the way the timing of the animation is handled (you might want to see [code]http://easings.net/[/code] for some examples). The second accepts an EASE_* constant, and controls the where [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transision and easing to pick, you can try different TRANS_* constants with EASE_IN_OUT, and use the one that looks best.
+ Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an TRANS_* constant, and refers to the way the timing of the animation is handled (you might want to see [code]http://easings.net/[/code] for some examples). The second accepts an EASE_* constant, and controls the where [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different TRANS_* constants with EASE_IN_OUT, and use the one that looks best.
</description>
<tutorials>
</tutorials>
@@ -135,7 +135,7 @@
<argument index="7" name="arg5" type="Variant" default="null">
</argument>
<description>
- Call [code]callback[/code] of [code]object[/code] after [code]duration[/code] on the main thread (similar to [methog Object.call_deferred). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback.
+ Call [code]callback[/code] of [code]object[/code] after [code]duration[/code] on the main thread (similar to [method Object.call_deferred]). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback.
</description>
</method>
<method name="interpolate_method">
@@ -158,7 +158,7 @@
<argument index="7" name="delay" type="float" default="0">
</argument>
<description>
- Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive values.
+ Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values.
[code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
</description>
</method>
@@ -346,7 +346,7 @@
<argument index="8" name="delay" type="float" default="0">
</argument>
<description>
- Animate [code]method[/code] of [code]object[/code] from the value returned by [code]initial.initial_method[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive values.
+ Animate [code]method[/code] of [code]object[/code] from the value returned by [code]initial.initial_method[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values.
[code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
</description>
</method>
diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml
index bac7d1e3b0..5387ec30b3 100644
--- a/doc/classes/VideoPlayer.xml
+++ b/doc/classes/VideoPlayer.xml
@@ -22,7 +22,7 @@
<return type="int">
</return>
<description>
- Get the amount of miliseconds to store in buffer while playing.
+ Get the amount of milliseconds to store in buffer while playing.
</description>
</method>
<method name="get_stream" qualifiers="const">
@@ -126,7 +126,7 @@
<argument index="0" name="msec" type="int">
</argument>
<description>
- Set the amount of miliseconds to buffer during playback.
+ Set the amount of milliseconds to buffer during playback.
</description>
</method>
<method name="set_expand">
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 2cf36ba69b..58626356bf 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -192,14 +192,14 @@
<return type="Variant">
</return>
<description>
- Returs the drag data from the GUI, that was previously returned by [method Control.get_drag_data].
+ Returns the drag data from the GUI, that was previously returned by [method Control.get_drag_data].
</description>
</method>
<method name="gui_has_modal_stack" qualifiers="const">
<return type="bool">
</return>
<description>
- Returs whether there are shown modals on-screen.
+ Returns whether there are shown modals on-screen.
</description>
</method>
<method name="has_transparent_background" qualifiers="const">
diff --git a/doc/classes/VisualScript.xml b/doc/classes/VisualScript.xml
index e44547cd8f..8961ff1564 100644
--- a/doc/classes/VisualScript.xml
+++ b/doc/classes/VisualScript.xml
@@ -4,7 +4,7 @@
A script implemented in the Visual Script programming environment.
</brief_description>
<description>
- A script implemented in the Visual Script programming environment. The script exends the functionality of all objects that instance it.
+ A script implemented in the Visual Script programming environment. The script extends the functionality of all objects that instance it.
[method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
You are most likely to use this class via the Visual Script editor or when writing plugins for it.
</description>
diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml
index 85e6207d3f..4bc6a49e91 100644
--- a/doc/classes/VisualServer.xml
+++ b/doc/classes/VisualServer.xml
@@ -24,6 +24,20 @@
<description>
</description>
</method>
+ <method name="request_frame_drawn_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="where" type="Object">
+ </argument>
+ <argument index="1" name="method" type="String">
+ </argument>
+ <argument index="2" name="userdata" type="Variant">
+ </argument>
+ <description>
+ Schedules a callback to the corresponding named 'method' on 'where' after a frame has been drawn.
+ The callback method must use only 1 argument which will be called with 'userdata'.
+ </description>
+ </method>
<method name="texture_create">
<return type="RID">
</return>
diff --git a/doc/classes/WeakRef.xml b/doc/classes/WeakRef.xml
index 1071a40c3b..23629881d3 100644
--- a/doc/classes/WeakRef.xml
+++ b/doc/classes/WeakRef.xml
@@ -4,7 +4,7 @@
Holds an [Object], but does not contribute to the reference count if the object is a reference.
</brief_description>
<description>
- A weakref can hold a [Reference], without contributing to the reference counter. A weakref can be created from an [Object] using [method @GDScript.weakref]. If this object is not a reference, weakref still works, however, it does not have any effect on the object. Weakrefs are useful in cases where multiple classes have variables that refer to eachother. Without weakrefs, using these classes could lead to memory leaks, since both references keep eachother from being released. Making part of the variables a weakref can prevent this cyclic dependency, and allows the references to be released.
+ A weakref can hold a [Reference], without contributing to the reference counter. A weakref can be created from an [Object] using [method @GDScript.weakref]. If this object is not a reference, weakref still works, however, it does not have any effect on the object. Weakrefs are useful in cases where multiple classes have variables that refer to each other. Without weakrefs, using these classes could lead to memory leaks, since both references keep each other from being released. Making part of the variables a weakref can prevent this cyclic dependency, and allows the references to be released.
</description>
<tutorials>
</tutorials>
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index c4dff588b0..0c67e3be4c 100644
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -14,14 +14,14 @@ for arg in sys.argv[1:]:
input_list.append(arg)
if len(input_list) < 1:
- print 'usage: makerst.py <path to folders> and/or <path to .xml files> (order of arguments irrelevant)'
- print 'example: makerst.py "../../modules/" "../classes" path_to/some_class.xml'
+ print('usage: makerst.py <path to folders> and/or <path to .xml files> (order of arguments irrelevant)')
+ print('example: makerst.py "../../modules/" "../classes" path_to/some_class.xml')
sys.exit(0)
def validate_tag(elem, tag):
if elem.tag != tag:
- print "Tag mismatch, expected '" + tag + "', got " + elem.tag
+ print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
sys.exit(255)
@@ -41,7 +41,7 @@ def make_class_list(class_list, columns):
f = codecs.open('class_list.rst', 'wb', 'utf-8')
prev = 0
col_max = len(class_list) / columns + 1
- print ('col max is ', col_max)
+ print(('col max is ', col_max))
col_count = 0
row_count = 0
last_initial = ''
@@ -300,11 +300,6 @@ def make_method(
if declare or pp == None:
- # span.attrib["class"]="funcdecl"
- # a=ET.SubElement(span,"a")
- # a.attrib["name"]=name+"_"+m.attrib["name"]
- # a.text=name+"::"+m.attrib["name"]
-
s = ' **' + m.attrib['name'] + '** '
else:
s = ':ref:`' + m.attrib['name'] + '<class_' + cname + "_" + m.attrib['name'] + '>` '
@@ -446,6 +441,7 @@ def make_rst_class(node):
f.write(make_heading('Signals', '-'))
for m in list(events):
make_method(f, node.attrib['name'], m, True, name, True)
+ f.write('\n')
d = m.find('description')
if d == None or d.text.strip() == '':
continue
@@ -507,8 +503,8 @@ for path in input_list:
for subdir, dirs, _ in os.walk(path):
if 'doc_classes' in dirs:
doc_dir = os.path.join(subdir, 'doc_classes')
- class_file_name = [f for f in os.listdir(doc_dir) if f.endswith('.xml')][0]
- file_list.append(os.path.join(doc_dir, class_file_name))
+ class_file_names = [f for f in os.listdir(doc_dir) if f.endswith('.xml')]
+ file_list += [os.path.join(doc_dir, f) for f in class_file_names]
elif not os.path.isfile(path):
file_list += [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.xml')]
elif os.path.isfile(path) and path.endswith('.xml'):
@@ -519,7 +515,7 @@ for file in file_list:
doc = tree.getroot()
if 'version' not in doc.attrib:
- print "Version missing from 'doc'"
+ print("Version missing from 'doc'")
sys.exit(255)
version = doc.attrib['version']
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index 91159e3381..5fe7b53a7d 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -838,6 +838,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index b322a4c957..2c6dd5552e 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -895,7 +895,7 @@ float G_GGX_2cos(float cos_theta_m, float alpha) {
// return 1.0 /( cos_theta_m + sqrt(cos2 + alpha*alpha*sin2) );
}
-float D_GXX(float cos_theta_m, float alpha) {
+float D_GGX(float cos_theta_m, float alpha) {
float alpha2 = alpha*alpha;
float d = 1.0 + (alpha2-1.0)*cos_theta_m*cos_theta_m;
return alpha2/(M_PI * d * d);
@@ -909,7 +909,7 @@ float G_GGX_anisotropic_2cos(float cos_theta_m, float alpha_x, float alpha_y, fl
return 1.0 / (cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 ));
}
-float D_GXX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) {
+float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) {
float cos2 = cos_theta_m * cos_theta_m;
float sin2 = (1.0-cos2);
float r_x = cos_phi/alpha_x;
@@ -1080,7 +1080,7 @@ LIGHT_SHADER_CODE
float ay = ry*ry;
float XdotH = dot( T, H );
float YdotH = dot( B, H );
- float D = D_GXX_anisotropic(cNdotH, ax, ay, XdotH, YdotH);
+ float D = D_GGX_anisotropic(cNdotH, ax, ay, XdotH, YdotH);
float G = G_GGX_anisotropic_2cos(cNdotL, ax, ay, XdotH, YdotH) * G_GGX_anisotropic_2cos(cNdotV, ax, ay, XdotH, YdotH);
#else
@@ -2104,5 +2104,3 @@ FRAGMENT_SHADER_CODE
}
-
-
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index e5b6f8e406..d8a87e738f 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -733,8 +733,12 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
ERR_FAIL_COND(platform.is_null());
Error err = platform->export_project(current, export_debug->is_pressed(), p_path, 0);
- if (err != OK)
+ if (err != OK) {
+ error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted: ") + platform->get_name());
+ error_dialog->show();
+ error_dialog->popup_centered_minsize(Size2(300, 80));
ERR_PRINT("Failed to export project");
+ }
}
void ProjectExportDialog::_bind_methods() {
@@ -940,6 +944,12 @@ ProjectExportDialog::ProjectExportDialog() {
export_error2->add_color_override("font_color", get_color("error_color", "Editor"));
export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " ");
+ error_dialog = memnew(AcceptDialog);
+ error_dialog->set_title("Error");
+ error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted:") + " ");
+ main_vb->add_child(error_dialog);
+ error_dialog->hide();
+
LinkButton *download_templates = memnew(LinkButton);
download_templates->set_text(TTR("Manage Export Templates"));
export_templates_error->add_child(download_templates);
diff --git a/editor/project_export.h b/editor/project_export.h
index 61de0f739a..288b0c290f 100644
--- a/editor/project_export.h
+++ b/editor/project_export.h
@@ -72,6 +72,7 @@ private:
Button *button_export;
bool updating;
+ AcceptDialog *error_dialog;
ConfirmationDialog *delete_confirm;
OptionButton *export_filter;
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 373b98dc8b..3fc04a5498 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -199,10 +199,7 @@ void GDNative::_bind_methods() {
ClassDB::bind_method(D_METHOD("initialize"), &GDNative::initialize);
ClassDB::bind_method(D_METHOD("terminate"), &GDNative::terminate);
- // TODO(karroffel): get_native_(raw_)call_types binding?
-
- // TODO(karroffel): make this a varargs function?
- ClassDB::bind_method(D_METHOD("call_native", "procedure_name", "arguments"), &GDNative::call_native);
+ ClassDB::bind_method(D_METHOD("call_native", "calling_type", "procedure_name", "arguments"), &GDNative::call_native);
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library");
}
@@ -239,10 +236,7 @@ bool GDNative::initialize() {
}
void *library_init;
- err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- native_handle,
- init_symbol,
- library_init);
+ err = get_symbol(init_symbol, library_init);
if (err || !library_init) {
OS::get_singleton()->close_dynamic_library(native_handle);
@@ -277,11 +271,8 @@ bool GDNative::terminate() {
}
void *library_terminate;
- Error error = OS::get_singleton()->get_dynamic_library_symbol_handle(
- native_handle,
- terminate_symbol,
- library_terminate);
- if (error) {
+ Error error = get_symbol(terminate_symbol, library_terminate);
+ if (error || !library_terminate) {
OS::get_singleton()->close_dynamic_library(native_handle);
native_handle = NULL;
return true;
@@ -313,10 +304,6 @@ void GDNativeCallRegistry::register_native_call_type(StringName p_call_type, nat
native_calls.insert(p_call_type, p_callback);
}
-void GDNativeCallRegistry::register_native_raw_call_type(StringName p_raw_call_type, native_raw_call_cb p_callback) {
- native_raw_calls.insert(p_raw_call_type, p_callback);
-}
-
Vector<StringName> GDNativeCallRegistry::get_native_call_types() {
Vector<StringName> call_types;
call_types.resize(native_calls.size());
@@ -329,18 +316,6 @@ Vector<StringName> GDNativeCallRegistry::get_native_call_types() {
return call_types;
}
-Vector<StringName> GDNativeCallRegistry::get_native_raw_call_types() {
- Vector<StringName> call_types;
- call_types.resize(native_raw_calls.size());
-
- size_t idx = 0;
- for (Map<StringName, native_raw_call_cb>::Element *E = native_raw_calls.front(); E; E = E->next(), idx++) {
- call_types[idx] = E->key();
- }
-
- return call_types;
-}
-
Variant GDNative::call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments) {
Map<StringName, native_call_cb>::Element *E = GDNativeCallRegistry::singleton->native_calls.find(p_native_call_type);
@@ -349,20 +324,34 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced
return Variant();
}
- String procedure_name = p_procedure_name;
- godot_variant result = E->get()(native_handle, (godot_string *)&procedure_name, (godot_array *)&p_arguments);
+ void *procedure_handle;
+
+ Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
+ native_handle,
+ p_procedure_name,
+ procedure_handle);
+
+ if (err != OK || procedure_handle == NULL) {
+ return Variant();
+ }
+
+ godot_variant result = E->get()(procedure_handle, (godot_array *)&p_arguments);
return *(Variant *)&result;
}
-void GDNative::call_native_raw(StringName p_raw_call_type, StringName p_procedure_name, void *data, int num_args, void **args, void *r_return) {
+Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle) {
- Map<StringName, native_raw_call_cb>::Element *E = GDNativeCallRegistry::singleton->native_raw_calls.find(p_raw_call_type);
- if (!E) {
- ERR_PRINT((String("No handler for native raw call type \"" + p_raw_call_type) + "\" found").utf8().get_data());
- return;
+ if (native_handle == NULL) {
+ ERR_PRINT("No valid library handle, can't get symbol from GDNative object");
+ return ERR_CANT_OPEN;
}
- String procedure_name = p_procedure_name;
- E->get()(native_handle, (godot_string *)&procedure_name, data, num_args, args, r_return);
+ Error result = OS::get_singleton()->get_dynamic_library_symbol_handle(
+ native_handle,
+ p_procedure_name,
+ r_handle,
+ true);
+
+ return result;
}
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 7bbad842eb..e44cc55a79 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -100,8 +100,7 @@ public:
_FORCE_INLINE_ void set_singleton_gdnative(bool p_singleton) { singleton_gdnative = p_singleton; }
};
-typedef godot_variant (*native_call_cb)(void *, godot_string *, godot_array *);
-typedef void (*native_raw_call_cb)(void *, godot_string *, void *, int, void **, void *);
+typedef godot_variant (*native_call_cb)(void *, godot_array *);
struct GDNativeCallRegistry {
static GDNativeCallRegistry *singleton;
@@ -111,17 +110,13 @@ struct GDNativeCallRegistry {
}
inline GDNativeCallRegistry()
- : native_calls(),
- native_raw_calls() {}
+ : native_calls() {}
Map<StringName, native_call_cb> native_calls;
- Map<StringName, native_raw_call_cb> native_raw_calls;
void register_native_call_type(StringName p_call_type, native_call_cb p_callback);
- void register_native_raw_call_type(StringName p_raw_call_type, native_raw_call_cb p_callback);
Vector<StringName> get_native_call_types();
- Vector<StringName> get_native_raw_call_types();
};
class GDNative : public Reference {
@@ -149,7 +144,8 @@ public:
bool terminate();
Variant call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments = Array());
- void call_native_raw(StringName p_raw_call_type, StringName p_procedure_name, void *data, int num_args, void **args, void *r_return);
+
+ Error get_symbol(StringName p_procedure_name, void *&r_handle);
};
#endif // GDNATIVE_H
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 5ebf26cbf7..459ca12ae9 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -5231,6 +5231,14 @@
]
},
{
+ "name": "godot_arvr_register_interface",
+ "return_type": "void",
+ "arguments": [
+ ["const char *", "p_name"],
+ ["const godot_arvr_interface_gdnative *", "p_interface"]
+ ]
+ },
+ {
"name": "godot_arvr_get_worldscale",
"return_type": "godot_real",
"arguments": []
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index 2d8726e5db..25d45db306 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -47,7 +47,7 @@ extern "C" {
#define GDAPI GDCALLINGCONV
#endif
#else
-#define GDCALLINGCONV __attribute__((sysv_abi, visibility("default")))
+#define GDCALLINGCONV __attribute__((sysv_abi))
#define GDAPI GDCALLINGCONV
#endif
@@ -255,7 +255,7 @@ godot_dictionary GDAPI godot_get_global_constants();
////// GDNative procedure types
typedef void (*godot_gdnative_init_fn)(godot_gdnative_init_options *);
typedef void (*godot_gdnative_terminate_fn)(godot_gdnative_terminate_options *);
-typedef godot_variant (*godot_gdnative_procedure_fn)(void *, godot_array *);
+typedef godot_variant (*godot_gdnative_procedure_fn)(godot_array *);
////// System Functions
diff --git a/modules/gdnative/include/nativearvr/godot_nativearvr.h b/modules/gdnative/include/nativearvr/godot_nativearvr.h
index f86919f33a..ee557843c6 100644
--- a/modules/gdnative/include/nativearvr/godot_nativearvr.h
+++ b/modules/gdnative/include/nativearvr/godot_nativearvr.h
@@ -36,6 +36,26 @@
extern "C" {
#endif
+typedef struct {
+ void *(*constructor)(godot_object *);
+ void (*destructor)(void *);
+ godot_string (*get_name)(const void *);
+ godot_int (*get_capabilities)(const void *);
+ godot_bool (*get_anchor_detection_is_enabled)(const void *);
+ void (*set_anchor_detection_is_enabled)(void *, godot_bool);
+ godot_bool (*is_stereo)(const void *);
+ godot_bool (*is_initialized)(const void *);
+ godot_bool (*initialize)(void *);
+ void (*uninitialize)(void *);
+ godot_vector2 (*get_recommended_render_targetsize)(const void *);
+ godot_transform (*get_transform_for_eye)(void *, godot_int, godot_transform *);
+ void (*fill_projection_for_eye)(void *, godot_real *, godot_int, godot_real, godot_real, godot_real);
+ void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *);
+ void (*process)(void *);
+} godot_arvr_interface_gdnative;
+
+void GDAPI godot_arvr_register_interface(const char *p_name, const godot_arvr_interface_gdnative *p_interface);
+
// helper functions to access ARVRServer data
godot_real GDAPI godot_arvr_get_worldscale();
godot_transform GDAPI godot_arvr_get_reference_frame();
@@ -55,4 +75,4 @@ void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p
}
#endif
-#endif /* !GODOT_NATIVEARVR_H */ \ No newline at end of file
+#endif /* !GODOT_NATIVEARVR_H */
diff --git a/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp b/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp
index 78b0d1eadd..2f60339afa 100644
--- a/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp
+++ b/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp
@@ -33,12 +33,18 @@
#include "servers/arvr/arvr_positional_tracker.h"
#include "servers/visual/visual_server_global.h"
+#include "oa_hash_map.h"
+
+extern OAHashMap<StringName, godot_arvr_interface_gdnative *> *_registered_interfaces;
+
ARVRInterfaceGDNative::ARVRInterfaceGDNative() {
// testing
printf("Construct gdnative interface\n");
// we won't have our data pointer until our library gets set
data = NULL;
+
+ interface = NULL;
}
ARVRInterfaceGDNative::~ARVRInterfaceGDNative() {
@@ -53,38 +59,42 @@ ARVRInterfaceGDNative::~ARVRInterfaceGDNative() {
}
void ARVRInterfaceGDNative::cleanup() {
- if (data != NULL) {
- library->call_native_raw("arvr_call_destructor", "godot_arvr_destructor", data, 0, NULL, NULL);
+ if (interface != NULL) {
+ interface->destructor(data);
data = NULL;
- };
+ interface = NULL;
+ }
+}
- if (library.is_valid()) {
- library->terminate();
- };
-};
+void ARVRInterfaceGDNative::set_interface(StringName p_name) {
-void ARVRInterfaceGDNative::set_gdnative_library(Ref<GDNativeLibrary> p_library) {
- if (library.is_null()) {
- library.instance();
- } else {
+ godot_arvr_interface_gdnative *new_interface;
+
+ if (!_registered_interfaces->lookup(p_name, &new_interface)) {
+ ERR_PRINT((String("ARVR interface \"") + p_name + "\" does not exist.").utf8().get_data());
+ return;
+ }
+
+ if (interface) {
cleanup();
- };
+ }
- library->set_library(p_library);
- library->initialize();
+ interface = new_interface;
// Now we do our constructing...
- void *parameters[1];
- parameters[0] = (void *)this;
- library->call_native_raw("arvr_call_constructor", "godot_arvr_constructor", NULL, 1, parameters, &data);
+
+ data = interface->constructor((godot_object *)this);
}
StringName ARVRInterfaceGDNative::get_name() const {
- StringName name;
- ERR_FAIL_COND_V(data == NULL, StringName());
+ ERR_FAIL_COND_V(interface == NULL, StringName());
+
+ godot_string result = interface->get_name(data);
- const_cast<GDNative *>(library.ptr())->call_native_raw("arvr_return_string", "godot_arvr_get_name", data, 0, NULL, &name);
+ StringName name = *(String *)&result;
+
+ godot_string_destroy(&result);
return name;
}
@@ -92,58 +102,56 @@ StringName ARVRInterfaceGDNative::get_name() const {
int ARVRInterfaceGDNative::get_capabilities() const {
int capabilities;
- ERR_FAIL_COND_V(data == NULL, 0); // 0 = None
+ ERR_FAIL_COND_V(interface == NULL, 0); // 0 = None
- const_cast<GDNative *>(library.ptr())->call_native_raw("arvr_return_int", "godot_arvr_get_capabilities", data, 0, NULL, &capabilities);
+ capabilities = interface->get_capabilities(data);
return capabilities;
-};
+}
bool ARVRInterfaceGDNative::get_anchor_detection_is_enabled() const {
bool enabled;
- ERR_FAIL_COND_V(data == NULL, false);
+ ERR_FAIL_COND_V(interface == NULL, false);
- const_cast<GDNative *>(library.ptr())->call_native_raw("arvr_return_bool", "godot_arvr_get_anchor_detection_is_enabled", data, 0, NULL, &enabled);
+ enabled = interface->get_anchor_detection_is_enabled(data);
return enabled;
-};
+}
void ARVRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) {
- void *parameters[1];
- ERR_FAIL_COND(data == NULL);
+ ERR_FAIL_COND(interface == NULL);
- parameters[0] = (void *)&p_enable;
- library->call_native_raw("arvr_set_bool", "godot_arvr_set_anchor_detection_is_enabled", data, 1, parameters, NULL);
-};
+ interface->set_anchor_detection_is_enabled(data, p_enable);
+}
bool ARVRInterfaceGDNative::is_stereo() {
bool stereo;
- ERR_FAIL_COND_V(data == NULL, false);
+ ERR_FAIL_COND_V(interface == NULL, false);
- library->call_native_raw("arvr_return_bool", "godot_arvr_is_stereo", data, 0, NULL, &stereo);
+ stereo = interface->is_stereo(data);
return stereo;
-};
+}
bool ARVRInterfaceGDNative::is_initialized() {
bool initialized;
- ERR_FAIL_COND_V(data == NULL, false);
+ ERR_FAIL_COND_V(interface == NULL, false);
- library->call_native_raw("arvr_return_bool", "godot_arvr_is_initialized", data, 0, NULL, &initialized);
+ initialized = interface->is_initialized(data);
return initialized;
-};
+}
bool ARVRInterfaceGDNative::initialize() {
bool initialized;
- ERR_FAIL_COND_V(data == NULL, false);
+ ERR_FAIL_COND_V(interface == NULL, false);
- library->call_native_raw("arvr_return_bool", "godot_arvr_initialize", data, 0, NULL, &initialized);
+ initialized = interface->initialize(data);
if (initialized) {
// if we successfully initialize our interface and we don't have a primary interface yet, this becomes our primary interface
@@ -158,7 +166,7 @@ bool ARVRInterfaceGDNative::initialize() {
}
void ARVRInterfaceGDNative::uninitialize() {
- ERR_FAIL_COND(data == NULL);
+ ERR_FAIL_COND(interface == NULL);
ARVRServer *arvr_server = ARVRServer::get_singleton();
if (arvr_server != NULL) {
@@ -166,78 +174,76 @@ void ARVRInterfaceGDNative::uninitialize() {
arvr_server->clear_primary_interface_if(this);
}
- library->call_native_raw("arvr_call_method", "godot_arvr_uninitialize", data, 0, NULL, NULL);
+ interface->uninitialize(data);
}
Size2 ARVRInterfaceGDNative::get_recommended_render_targetsize() {
- Size2 size;
- ERR_FAIL_COND_V(data == NULL, Size2());
+ ERR_FAIL_COND_V(interface == NULL, Size2());
- library->call_native_raw("arvr_return_vector2", "godot_arvr_get_recommended_render_targetsize", data, 0, NULL, &size);
+ godot_vector2 result = interface->get_recommended_render_targetsize(data);
+ Vector2 *vec = (Vector2 *)&result;
- return size;
+ return *vec;
}
Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) {
- void *parameters[2];
- Transform ret;
+ Transform *ret;
- ERR_FAIL_COND_V(data == NULL, Transform());
+ ERR_FAIL_COND_V(interface == NULL, Transform());
- parameters[0] = (void *)&p_eye;
- parameters[1] = (void *)&p_cam_transform;
- library->call_native_raw("arvr_return_transform_for_eye", "godot_arvr_get_transform_for_eye", data, 2, parameters, &ret);
+ godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform);
- return ret;
+ ret = (Transform *)&t;
+
+ return *ret;
}
CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
- void *parameters[5];
CameraMatrix cm;
- ERR_FAIL_COND_V(data == NULL, CameraMatrix());
+ ERR_FAIL_COND_V(interface == NULL, CameraMatrix());
- parameters[0] = (void *)cm.matrix;
- parameters[1] = (void *)&p_eye;
- parameters[2] = (void *)&p_aspect;
- parameters[3] = (void *)&p_z_near;
- parameters[4] = (void *)&p_z_far;
- library->call_native_raw("arvr_call_fill_projection_for_eye", "godot_arvr_fill_projection_for_eye", data, 5, parameters, NULL);
+ interface->fill_projection_for_eye(data, (godot_real *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far);
return cm;
}
void ARVRInterfaceGDNative::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) {
- void *parameters[3];
- ERR_FAIL_COND(data == NULL);
+ ERR_FAIL_COND(interface == NULL);
- parameters[0] = (void *)&p_eye;
- parameters[1] = (void *)&p_render_target;
- parameters[2] = (void *)&p_screen_rect;
- library->call_native_raw("arvr_call_commit_for_eye", "godot_arvr_commit_for_eye", data, 3, parameters, NULL);
+ interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect);
}
void ARVRInterfaceGDNative::process() {
- ERR_FAIL_COND(data == NULL);
+ ERR_FAIL_COND(interface == NULL);
- library->call_native_raw("arvr_call_method", "godot_arvr_process", data, 0, NULL, NULL);
+ interface->process(data);
}
void ARVRInterfaceGDNative::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_gdnative_library", "library"), &ARVRInterfaceGDNative::set_gdnative_library);
+ ClassDB::bind_method(D_METHOD("set_interface", "name"), &ARVRInterfaceGDNative::set_interface);
}
/////////////////////////////////////////////////////////////////////////////////////
// some helper callbacks
+extern "C" {
+
+void GDAPI godot_arvr_register_interface(const char *p_name, const godot_arvr_interface_gdnative *p_interface) {
+ // this method is supposed to only be called by GDNative singletons
+ // which are initialized in a thread safe way, so using a global map is fine here
+
+ _registered_interfaces->set(StringName(p_name), (godot_arvr_interface_gdnative * const)p_interface);
+}
+
godot_real GDAPI godot_arvr_get_worldscale() {
ARVRServer *arvr_server = ARVRServer::get_singleton();
ERR_FAIL_NULL_V(arvr_server, 1.0);
return arvr_server->get_world_scale();
-};
+}
godot_transform GDAPI godot_arvr_get_reference_frame() {
godot_transform reference_frame;
@@ -248,10 +254,10 @@ godot_transform GDAPI godot_arvr_get_reference_frame() {
*reference_frame_ptr = arvr_server->get_reference_frame();
} else {
godot_transform_new_identity(&reference_frame);
- };
+ }
return reference_frame;
-};
+}
void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect) {
// blits out our texture as is, handy for preview display of one of the eyes that is already rendered with lens distortion on an external HMD
@@ -268,7 +274,7 @@ void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_re
VSG::rasterizer->set_current_render_target(RID());
VSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0);
-};
+}
godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target) {
// In order to send off our textures to display on our hardware we need the opengl texture ID instead of the render target RID
@@ -279,7 +285,7 @@ godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target) {
uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture);
return texid;
-};
+}
godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position) {
ARVRServer *arvr_server = ARVRServer::get_singleton();
@@ -295,30 +301,30 @@ godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand,
new_tracker->set_hand(ARVRPositionalTracker::TRACKER_LEFT_HAND);
} else if (p_hand == 2) {
new_tracker->set_hand(ARVRPositionalTracker::TRACKER_RIGHT_HAND);
- };
+ }
// also register as joystick...
int joyid = input->get_unused_joy_id();
if (joyid != -1) {
new_tracker->set_joy_id(joyid);
input->joy_connection_changed(joyid, true, p_device_name, "");
- };
+ }
if (p_tracks_orientation) {
Basis orientation;
new_tracker->set_orientation(orientation);
- };
+ }
if (p_tracks_position) {
Vector3 position;
new_tracker->set_position(position);
- };
+ }
// add our tracker to our server and remember its pointer
arvr_server->add_tracker(new_tracker);
// note, this ID is only unique within controllers!
return new_tracker->get_tracker_id();
-};
+}
void GDAPI godot_arvr_remove_controller(godot_int p_controller_id) {
ARVRServer *arvr_server = ARVRServer::get_singleton();
@@ -334,13 +340,13 @@ void GDAPI godot_arvr_remove_controller(godot_int p_controller_id) {
if (joyid != -1) {
input->joy_connection_changed(joyid, false, "", "");
remove_tracker->set_joy_id(-1);
- };
+ }
// remove our tracker from our server
arvr_server->remove_tracker(remove_tracker);
memdelete(remove_tracker);
- };
-};
+ }
+}
void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) {
ARVRServer *arvr_server = ARVRServer::get_singleton();
@@ -351,12 +357,12 @@ void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_
Transform *transform = (Transform *)p_transform;
if (p_tracks_orientation) {
tracker->set_orientation(transform->basis);
- };
+ }
if (p_tracks_position) {
tracker->set_position(transform->origin);
- };
- };
-};
+ }
+ }
+}
void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed) {
ARVRServer *arvr_server = ARVRServer::get_singleton();
@@ -370,9 +376,9 @@ void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int
int joyid = tracker->get_joy_id();
if (joyid != -1) {
input->joy_button(joyid, p_button, p_is_pressed);
- };
- };
-};
+ }
+ }
+}
void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative) {
ARVRServer *arvr_server = ARVRServer::get_singleton();
@@ -389,6 +395,7 @@ void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p
jx.min = p_can_be_negative ? -1 : 0;
jx.value = p_value;
input->joy_axis(joyid, p_axis, jx);
- };
- };
-};
+ }
+ }
+}
+}
diff --git a/modules/gdnative/nativearvr/arvr_interface_gdnative.h b/modules/gdnative/nativearvr/arvr_interface_gdnative.h
index 6995e85c73..04730571b7 100644
--- a/modules/gdnative/nativearvr/arvr_interface_gdnative.h
+++ b/modules/gdnative/nativearvr/arvr_interface_gdnative.h
@@ -41,12 +41,12 @@
*/
class ARVRInterfaceGDNative : public ARVRInterface {
- GDCLASS(ARVRInterfaceGDNative, ARVRInterface);
+ GDCLASS(ARVRInterfaceGDNative, ARVRInterface)
void cleanup();
protected:
- Ref<GDNative> library;
+ godot_arvr_interface_gdnative *interface;
void *data;
static void _bind_methods();
@@ -56,7 +56,7 @@ public:
ARVRInterfaceGDNative();
~ARVRInterfaceGDNative();
- void set_gdnative_library(Ref<GDNativeLibrary> p_library);
+ void set_interface(StringName p_name);
virtual StringName get_name() const;
virtual int get_capabilities() const;
diff --git a/modules/gdnative/nativearvr/register_types.cpp b/modules/gdnative/nativearvr/register_types.cpp
index f4dc13ed55..09debe2550 100644
--- a/modules/gdnative/nativearvr/register_types.cpp
+++ b/modules/gdnative/nativearvr/register_types.cpp
@@ -33,382 +33,25 @@
#include "arvr_interface_gdnative.h"
#include "core/os/os.h"
-void arvr_call_constructor(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
+#include "oa_hash_map.h"
+#include "ustring.h"
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
+// what is this?? I can't memnew(OAHashMap<String, godot_arvr_interface_gdnative *>)
+// but with this typedef it's working just fine...
+// C++ grammar can be a joy.
+typedef OAHashMap<StringName, godot_arvr_interface_gdnative *> InterfaceMap;
- void *(*proc)(godot_object *);
- proc = (void *(*)(godot_object *))library_proc;
-
- godot_object *this_object = (godot_object *)p_args[0];
- void *p = proc(this_object);
-
- void **return_ptr = (void **)r_return;
-
- *return_ptr = p;
-};
-
-void arvr_call_destructor(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- void (*proc)(void *);
- proc = (void (*)(void *))library_proc;
-
- proc(p_data);
-};
-
-void arvr_return_string(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- godot_string (*proc)(void *);
- proc = (godot_string(*)(void *))library_proc;
-
- godot_string s = proc(p_data);
-
- StringName *return_ptr = (StringName *)r_return;
-
- String *returned_string = (String *)&s;
-
- *return_ptr = *returned_string;
-
- godot_string_destroy(&s);
-};
-
-void arvr_return_int(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- godot_int (*proc)(void *);
- proc = (godot_int(*)(void *))library_proc;
-
- godot_int i = proc(p_data);
-
- int *return_ptr = (int *)r_return;
-
- *return_ptr = i;
-};
-
-void arvr_return_bool(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- godot_bool (*proc)(void *);
- proc = (godot_bool(*)(void *))library_proc;
-
- godot_bool b = proc(p_data);
-
- int *return_ptr = (int *)r_return;
-
- *return_ptr = b;
-};
-
-void arvr_set_bool(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- void (*proc)(void *, bool);
- proc = (void (*)(void *, bool))library_proc;
-
- bool *set_bool = (bool *)p_args[0];
- proc(p_data, *set_bool);
-};
-
-void arvr_call_method(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- godot_bool (*proc)(void *);
- proc = (godot_bool(*)(void *))library_proc;
-
- proc(p_data);
-};
-
-void arvr_return_vector2(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- godot_vector2 (*proc)(void *);
- proc = (godot_vector2(*)(void *))library_proc;
-
- godot_vector2 v = proc(p_data);
-
- godot_vector2 *return_ptr = (godot_vector2 *)r_return;
-
- *return_ptr = v;
-};
-
-void arvr_return_transform_for_eye(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- godot_transform (*proc)(void *, int, godot_transform *);
- proc = (godot_transform(*)(void *, int, godot_transform *))library_proc;
-
- int *eye = (int *)p_args[0];
- godot_transform *camera_transform = (godot_transform *)p_args[1];
- godot_transform t = proc(p_data, *eye, camera_transform);
-
- godot_transform *return_ptr = (godot_transform *)r_return;
-
- *return_ptr = t;
-};
-
-void arvr_call_fill_projection_for_eye(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- void (*proc)(void *, real_t *, int, real_t, real_t, real_t);
- proc = (void (*)(void *, real_t *, int, real_t, real_t, real_t))library_proc;
-
- real_t *projection = (real_t *)p_args[0]; // <-- we'll be writing into this buffer, must have enough space for 16 floats!
- int *eye = (int *)p_args[1];
- real_t *aspect = (real_t *)p_args[2];
- real_t *zn = (real_t *)p_args[3];
- real_t *zf = (real_t *)p_args[4];
-
- proc(p_data, projection, *eye, *aspect, *zn, *zf);
-};
-
-void arvr_call_commit_for_eye(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- void (*proc)(void *, int, godot_rid *, godot_rect2 *);
- proc = (void (*)(void *, int, godot_rid *, godot_rect2 *))library_proc;
-
- int *eye = (int *)p_args[0];
- godot_rid *rid = (godot_rid *)p_args[1];
- godot_rect2 *screen_rect = (godot_rect2 *)p_args[2];
-
- proc(p_data, *eye, rid, screen_rect);
-};
+InterfaceMap *_registered_interfaces;
void register_nativearvr_types() {
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_call_constructor", arvr_call_constructor);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_call_destructor", arvr_call_destructor);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_return_string", arvr_return_string);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_return_int", arvr_return_int);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_return_bool", arvr_return_bool);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_set_bool", arvr_set_bool);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_call_method", arvr_call_method);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_return_vector2", arvr_return_vector2);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_return_transform_for_eye", arvr_return_transform_for_eye);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_call_fill_projection_for_eye", arvr_call_fill_projection_for_eye);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("arvr_call_commit_for_eye", arvr_call_commit_for_eye);
+
+ _registered_interfaces = memnew(InterfaceMap);
ClassDB::register_class<ARVRInterfaceGDNative>();
}
void unregister_nativearvr_types() {
+ memdelete(_registered_interfaces);
+
+ _registered_interfaces = NULL;
}
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index b9bd65af53..7e3a7c8e9e 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -1010,17 +1010,12 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) {
if (!library_script_users.has(lib_path))
library_script_users.insert(lib_path, Set<NativeScript *>());
- void *args[1] = {
- (void *)&lib_path
- };
+ void *proc_ptr;
+
+ gdn->get_symbol(_init_call_name, proc_ptr);
+
+ ((void (*)(godot_string *))proc_ptr)((godot_string *)&lib_path);
- // here the library registers all the classes and stuff.
- gdn->call_native_raw(_init_call_type,
- _init_call_name,
- NULL,
- 1,
- args,
- NULL);
} else {
// already initialized. Nice.
}
@@ -1053,13 +1048,15 @@ void NativeScriptLanguage::call_libraries_cb(const StringName &name) {
// library_gdnatives is modified only from the main thread, so it's safe not to use mutex here
for (Map<String, Ref<GDNative> >::Element *L = library_gdnatives.front(); L; L = L->next()) {
if (L->get()->is_initialized()) {
- L->get()->call_native_raw(
- _noarg_call_type,
- name,
- NULL,
- 0,
- NULL,
- NULL);
+
+ void *proc_ptr;
+ Error err = L->get()->get_symbol(name, proc_ptr);
+
+ if (err != OK) {
+ ERR_PRINT((String("No godot_gdnative_init in \"" + L->get()->get_library()->get_active_library_path()) + "\" found").utf8().get_data());
+ } else {
+ ((void (*)())proc_ptr)();
+ }
}
}
}
@@ -1142,12 +1139,11 @@ void NativeReloadNode::_notification(int p_what) {
};
// here the library registers all the classes and stuff.
- L->get()->call_native_raw(NSL->_init_call_type,
- NSL->_init_call_name,
- NULL,
- 1,
- args,
- NULL);
+
+ void *proc_ptr;
+ L->get()->get_symbol("godot_nativescript_init", proc_ptr);
+
+ ((void (*)(void *))proc_ptr)((void *)&L->key());
for (Map<String, Set<NativeScript *> >::Element *U = NSL->library_script_users.front(); U; U = U->next()) {
for (Set<NativeScript *>::Element *S = U->get().front(); S; S = S->next()) {
diff --git a/modules/gdnative/nativescript/register_types.cpp b/modules/gdnative/nativescript/register_types.cpp
index b846710ab8..d734bba810 100644
--- a/modules/gdnative/nativescript/register_types.cpp
+++ b/modules/gdnative/nativescript/register_types.cpp
@@ -38,53 +38,6 @@
NativeScriptLanguage *native_script_language;
-typedef void (*native_script_init_fn)(void *);
-
-void init_call_cb(void *p_handle, godot_string *p_proc_name, void *p_data, int p_num_args, void **args, void *r_ret) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call nativescript init procedure");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true); // we print our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_proc_name) + "\" does not exists and can't be called").utf8().get_data());
- return;
- }
-
- native_script_init_fn fn = (native_script_init_fn)library_proc;
-
- fn(args[0]);
-}
-
-typedef void (*native_script_empty_callback)();
-
-void noarg_call_cb(void *p_handle, godot_string *p_proc_name, void *p_data, int p_num_args, void **args, void *r_ret) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call nativescript callback");
- return;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- library_proc,
- true);
- if (err != OK) {
- // it's fine if thread callbacks are not present in the library.
- return;
- }
-
- native_script_empty_callback fn = (native_script_empty_callback)library_proc;
- fn();
-}
-
ResourceFormatLoaderNativeScript *resource_loader_gdns = NULL;
ResourceFormatSaverNativeScript *resource_saver_gdns = NULL;
@@ -95,9 +48,6 @@ void register_nativescript_types() {
ScriptServer::register_language(native_script_language);
- GDNativeCallRegistry::singleton->register_native_raw_call_type(native_script_language->_init_call_type, init_call_cb);
- GDNativeCallRegistry::singleton->register_native_raw_call_type(native_script_language->_noarg_call_type, noarg_call_cb);
-
resource_saver_gdns = memnew(ResourceFormatSaverNativeScript);
ResourceSaver::add_resource_format_saver(resource_saver_gdns);
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 8f4eed091f..8e5f58524b 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -128,57 +128,12 @@ static void editor_init_callback() {
#endif
-godot_variant cb_standard_varcall(void *handle, godot_string *p_procedure, godot_array *p_args) {
- if (handle == NULL) {
- ERR_PRINT("No valid library handle, can't call standard varcall procedure");
- godot_variant ret;
- godot_variant_new_nil(&ret);
- return ret;
- }
-
- void *library_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- handle,
- *(String *)p_procedure,
- library_proc,
- true); // we roll our own message
- if (err != OK) {
- ERR_PRINT((String("GDNative procedure \"" + *(String *)p_procedure) + "\" does not exists and can't be called").utf8().get_data());
- godot_variant ret;
- godot_variant_new_nil(&ret);
- return ret;
- }
+godot_variant cb_standard_varcall(void *p_procedure_handle, godot_array *p_args) {
godot_gdnative_procedure_fn proc;
- proc = (godot_gdnative_procedure_fn)library_proc;
-
- return proc(NULL, p_args);
-}
-
-void cb_singleton_call(
- void *p_handle,
- godot_string *p_proc_name,
- void *p_data,
- int p_num_args,
- void **p_args,
- void *r_return) {
- if (p_handle == NULL) {
- ERR_PRINT("No valid library handle, can't call singleton procedure");
- return;
- }
+ proc = (godot_gdnative_procedure_fn)p_procedure_handle;
- void *singleton_proc;
- Error err = OS::get_singleton()->get_dynamic_library_symbol_handle(
- p_handle,
- *(String *)p_proc_name,
- singleton_proc);
-
- if (err != OK) {
- return;
- }
-
- void (*singleton_procedure_ptr)() = (void (*)())singleton_proc;
- singleton_procedure_ptr();
+ return proc(p_args);
}
GDNativeCallRegistry *GDNativeCallRegistry::singleton;
@@ -201,8 +156,6 @@ void register_gdnative_types() {
GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall);
- GDNativeCallRegistry::singleton->register_native_raw_call_type("gdnative_singleton_call", cb_singleton_call);
-
register_nativearvr_types();
register_nativescript_types();
@@ -225,13 +178,16 @@ void register_gdnative_types() {
continue;
}
- singleton_gdnatives[i]->call_native_raw(
- "gdnative_singleton_call",
+ void *proc_ptr;
+ Error err = singleton_gdnatives[i]->get_symbol(
"godot_gdnative_singleton",
- NULL,
- 0,
- NULL,
- NULL);
+ proc_ptr);
+
+ if (err != OK) {
+ ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton_gdnatives[i]->get_library()->get_active_library_path()) + "\" found").utf8().get_data());
+ } else {
+ ((void (*)())proc_ptr)();
+ }
}
}
@@ -283,4 +239,4 @@ void unregister_gdnative_types() {
print_line(String("vector2:\t") + itos(sizeof(Vector2)));
print_line(String("vector3:\t") + itos(sizeof(Vector3)));
*/
-} \ No newline at end of file
+}
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index b8a0a7864e..f4a9abc1ea 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -765,7 +765,7 @@ void StyleBoxFlat::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_border_blend", "blend"), &StyleBoxFlat::set_border_blend);
ClassDB::bind_method(D_METHOD("get_border_blend"), &StyleBoxFlat::get_border_blend);
- ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_botton_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual);
+ ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_bottom_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual);
ClassDB::bind_method(D_METHOD("set_corner_radius_all", "radius"), &StyleBoxFlat::set_corner_radius_all);
ClassDB::bind_method(D_METHOD("set_corner_radius", "corner", "radius"), &StyleBoxFlat::set_corner_radius);
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 2b34aa0e42..979b2ed8ec 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -1447,6 +1447,7 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("force_sync"), &VisualServer::sync);
ClassDB::bind_method(D_METHOD("force_draw"), &VisualServer::draw);
+ ClassDB::bind_method(D_METHOD("request_frame_drawn_callback", "where", "method", "userdata"), &VisualServer::request_frame_drawn_callback);
ClassDB::bind_method(D_METHOD("texture_create"), &VisualServer::texture_create);
ClassDB::bind_method(D_METHOD("texture_create_from_image", "image", "flags"), &VisualServer::texture_create_from_image, DEFVAL(TEXTURE_FLAGS_DEFAULT));
//ClassDB::bind_method(D_METHOD("texture_allocate"),&VisualServer::texture_allocate,DEFVAL( TEXTURE_FLAGS_DEFAULT ) );