aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/SCsub1
-rw-r--r--modules/bullet/config.py10
-rw-r--r--modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml15
-rw-r--r--modules/bullet/doc_classes/BulletPhysicsServer.xml15
-rw-r--r--modules/dds/config.py2
-rw-r--r--modules/enet/config.py10
-rw-r--r--modules/enet/doc_classes/NetworkedMultiplayerENet.xml85
-rw-r--r--modules/etc/config.py2
-rw-r--r--modules/freetype/config.py2
-rw-r--r--modules/gdnative/SCsub6
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.cpp4
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.h2
-rw-r--r--modules/gdnative/config.py11
-rw-r--r--modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml2
-rw-r--r--modules/gdnative/doc_classes/GDNative.xml2
-rw-r--r--modules/gdnative/doc_classes/GDNativeLibrary.xml56
-rw-r--r--modules/gdnative/doc_classes/NativeScript.xml2
-rw-r--r--modules/gdnative/doc_classes/PluginScript.xml15
-rw-r--r--modules/gdnative/gd_native_library_editor.cpp2
-rw-r--r--modules/gdnative/gdnative.cpp373
-rw-r--r--modules/gdnative/gdnative.h111
-rw-r--r--modules/gdnative/gdnative/array.cpp3
-rw-r--r--modules/gdnative/gdnative/basis.cpp2
-rw-r--r--modules/gdnative/gdnative/color.cpp2
-rw-r--r--modules/gdnative/gdnative/dictionary.cpp2
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp53
-rw-r--r--modules/gdnative/gdnative/node_path.cpp2
-rw-r--r--modules/gdnative/gdnative/plane.cpp2
-rw-r--r--modules/gdnative/gdnative/pool_arrays.cpp3
-rw-r--r--modules/gdnative/gdnative/quat.cpp2
-rw-r--r--modules/gdnative/gdnative/rect2.cpp2
-rw-r--r--modules/gdnative/gdnative/rect3.cpp2
-rw-r--r--modules/gdnative/gdnative/rid.cpp2
-rw-r--r--modules/gdnative/gdnative/string.cpp3
-rw-r--r--modules/gdnative/gdnative/string_name.cpp3
-rw-r--r--modules/gdnative/gdnative/transform.cpp2
-rw-r--r--modules/gdnative/gdnative/transform2d.cpp2
-rw-r--r--modules/gdnative/gdnative/variant.cpp2
-rw-r--r--modules/gdnative/gdnative/vector2.cpp2
-rw-r--r--modules/gdnative/gdnative/vector3.cpp2
-rw-r--r--modules/gdnative/include/arvr/godot_arvr.h2
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h2
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp4
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp46
-rw-r--r--modules/gdnative/nativescript/nativescript.h8
-rw-r--r--modules/gdnative/register_types.cpp151
-rw-r--r--modules/gdscript/config.py13
-rw-r--r--modules/gdscript/doc_classes/GDFunctionState.xml46
-rw-r--r--modules/gdscript/doc_classes/GDNativeClass.xml21
-rw-r--r--modules/gdscript/doc_classes/GDScript.xml38
-rw-r--r--modules/gdscript/gd_editor.cpp49
-rw-r--r--modules/gdscript/gd_parser.cpp7
-rw-r--r--modules/gdscript/gd_script.cpp14
-rw-r--r--modules/gdscript/gd_tokenizer.cpp8
-rw-r--r--modules/gdscript/gd_tokenizer.h1
-rw-r--r--modules/gridmap/config.py9
-rw-r--r--modules/gridmap/doc_classes/GridMap.xml2
-rw-r--r--modules/hdr/config.py2
-rw-r--r--modules/jpg/config.py2
-rw-r--r--modules/mobile_vr/config.py12
-rw-r--r--modules/mobile_vr/doc_classes/MobileVRInterface.xml2
-rw-r--r--modules/mobile_vr/mobile_interface.cpp13
-rw-r--r--modules/mobile_vr/mobile_interface.h2
-rw-r--r--modules/mono/config.py6
-rw-r--r--modules/mono/doc_classes/@C#.xml2
-rw-r--r--modules/mono/doc_classes/CSharpScript.xml2
-rw-r--r--modules/mono/doc_classes/GodotSharp.xml2
-rw-r--r--modules/mono/editor/bindings_generator.cpp10
-rw-r--r--modules/mono/glue/glue_header.h2
-rw-r--r--modules/mono/register_types.cpp4
-rw-r--r--modules/ogg/config.py5
-rw-r--r--modules/openssl/config.py2
-rw-r--r--modules/opus/SCsub11
-rw-r--r--modules/opus/config.py13
-rw-r--r--modules/opus/stub/register_types.cpp36
-rw-r--r--modules/opus/stub/register_types.h31
-rw-r--r--modules/pbm/config.py2
-rw-r--r--modules/pvr/config.py2
-rw-r--r--modules/recast/config.py2
-rw-r--r--modules/regex/config.py13
-rw-r--r--modules/regex/doc_classes/RegEx.xml134
-rw-r--r--modules/regex/doc_classes/RegExMatch.xml75
-rw-r--r--modules/regex/regex.cpp16
-rw-r--r--modules/regex/regex.h1
-rw-r--r--modules/squish/config.py2
-rw-r--r--modules/stb_vorbis/config.py11
-rw-r--r--modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml70
-rw-r--r--modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml15
-rw-r--r--modules/svg/config.py2
-rw-r--r--modules/tga/config.py2
-rw-r--r--modules/theora/config.py14
-rw-r--r--modules/theora/doc_classes/ResourceImporterTheora.xml15
-rw-r--r--modules/theora/doc_classes/VideoStreamTheora.xml33
-rw-r--r--modules/theora/register_types.cpp13
-rw-r--r--modules/theora/resource_importer_theora.cpp89
-rw-r--r--modules/theora/resource_importer_theora.h57
-rw-r--r--modules/theora/video_stream_theora.cpp46
-rw-r--r--modules/theora/video_stream_theora.h16
-rw-r--r--modules/tinyexr/config.py2
-rw-r--r--modules/visual_script/config.py55
-rw-r--r--modules/visual_script/doc_classes/VisualScript.xml515
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml53
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml219
-rw-r--r--modules/visual_script/doc_classes/VisualScriptClassConstant.xml57
-rw-r--r--modules/visual_script/doc_classes/VisualScriptComment.xml71
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCondition.xml24
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstant.xml57
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstructor.xml69
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCustomNode.xml165
-rw-r--r--modules/visual_script/doc_classes/VisualScriptDeconstruct.xml38
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEditor.xml46
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEmitSignal.xml40
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml36
-rw-r--r--modules/visual_script/doc_classes/VisualScriptExpression.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunction.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionCall.xml199
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionState.xml41
-rw-r--r--modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml33
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIndexGet.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIndexSet.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptInputAction.xml57
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIterator.xml24
-rw-r--r--modules/visual_script/doc_classes/VisualScriptLocalVar.xml57
-rw-r--r--modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml59
-rw-r--r--modules/visual_script/doc_classes/VisualScriptMathConstant.xml66
-rw-r--r--modules/visual_script/doc_classes/VisualScriptNode.xml62
-rw-r--r--modules/visual_script/doc_classes/VisualScriptOperator.xml54
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPreload.xml40
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertyGet.xml137
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertySet.xml177
-rw-r--r--modules/visual_script/doc_classes/VisualScriptResourcePath.xml33
-rw-r--r--modules/visual_script/doc_classes/VisualScriptReturn.xml58
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSceneNode.xml40
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSceneTree.xml15
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSelect.xml42
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSelf.xml21
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSequence.xml42
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSubCall.xml23
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSwitch.xml26
-rw-r--r--modules/visual_script/doc_classes/VisualScriptTypeCast.xml49
-rw-r--r--modules/visual_script/doc_classes/VisualScriptVariableGet.xml40
-rw-r--r--modules/visual_script/doc_classes/VisualScriptVariableSet.xml41
-rw-r--r--modules/visual_script/doc_classes/VisualScriptWhile.xml23
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYield.xml55
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYieldSignal.xml87
-rw-r--r--modules/visual_script/register_types.cpp11
-rw-r--r--modules/visual_script/visual_script.cpp5
-rw-r--r--modules/visual_script/visual_script.h1
-rw-r--r--modules/visual_script/visual_script_editor.cpp60
-rw-r--r--modules/visual_script/visual_script_editor.h23
-rw-r--r--modules/visual_script/visual_script_expression.cpp3
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp16
-rw-r--r--modules/visual_script/visual_script_nodes.cpp17
-rw-r--r--modules/visual_script/visual_script_nodes.h2
-rw-r--r--modules/vorbis/SCsub10
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp4
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h2
-rw-r--r--modules/vorbis/config.py5
-rw-r--r--modules/vorbis/stub/register_types.cpp36
-rw-r--r--modules/vorbis/stub/register_types.h31
-rw-r--r--modules/webm/config.py14
-rw-r--r--modules/webm/doc_classes/ResourceImporterWebm.xml15
-rw-r--r--modules/webm/doc_classes/VideoStreamWebm.xml33
-rw-r--r--modules/webm/libvpx/SCsub4
-rw-r--r--modules/webm/register_types.cpp13
-rw-r--r--modules/webm/resource_importer_webm.cpp95
-rw-r--r--modules/webm/resource_importer_webm.h55
-rw-r--r--modules/webm/video_stream_webm.cpp153
-rw-r--r--modules/webm/video_stream_webm.h23
-rw-r--r--modules/webp/config.py2
170 files changed, 5122 insertions, 650 deletions
diff --git a/modules/SCsub b/modules/SCsub
index d1c0cdc05..c1cf5a6c1 100644
--- a/modules/SCsub
+++ b/modules/SCsub
@@ -9,7 +9,6 @@ Export('env_modules')
env.modules_sources = [
"register_module_types.gen.cpp",
]
-# env.add_source_files(env.modules_sources,"*.cpp")
Export('env')
for x in env.module_list:
diff --git a/modules/bullet/config.py b/modules/bullet/config.py
index b00ea1832..0a31c2e50 100644
--- a/modules/bullet/config.py
+++ b/modules/bullet/config.py
@@ -3,4 +3,12 @@ def can_build(platform):
def configure(env):
pass
-
+
+def get_doc_classes():
+ return [
+ "BulletPhysicsDirectBodyState",
+ "BulletPhysicsServer",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
new file mode 100644
index 000000000..831b34694
--- /dev/null
+++ b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/bullet/doc_classes/BulletPhysicsServer.xml b/modules/bullet/doc_classes/BulletPhysicsServer.xml
new file mode 100644
index 000000000..4b5c2e6d8
--- /dev/null
+++ b/modules/bullet/doc_classes/BulletPhysicsServer.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="BulletPhysicsServer" inherits="PhysicsServer" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/dds/config.py b/modules/dds/config.py
index fb920482f..5f133eba9 100644
--- a/modules/dds/config.py
+++ b/modules/dds/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/enet/config.py b/modules/enet/config.py
index fb920482f..8031fbb4b 100644
--- a/modules/enet/config.py
+++ b/modules/enet/config.py
@@ -1,7 +1,13 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "NetworkedMultiplayerENet",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
new file mode 100644
index 000000000..70ef6aef2
--- /dev/null
+++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.0-alpha">
+ <brief_description>
+ PacketPeer implementation using the ENet library.
+ </brief_description>
+ <description>
+ A connection (or a listening server) that should be passed to [method SceneTree.set_network_peer]. Socket events can be handled by connecting to [SceneTree] signals.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="close_connection">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="create_client">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="ip" type="String">
+ </argument>
+ <argument index="1" name="port" type="int">
+ </argument>
+ <argument index="2" name="in_bandwidth" type="int" default="0">
+ </argument>
+ <argument index="3" name="out_bandwidth" type="int" default="0">
+ </argument>
+ <description>
+ Create client that connects to a server at address [code]ip[/code] using specified [code]port[/code].
+ </description>
+ </method>
+ <method name="create_server">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="port" type="int">
+ </argument>
+ <argument index="1" name="max_clients" type="int" default="32">
+ </argument>
+ <argument index="2" name="in_bandwidth" type="int" default="0">
+ </argument>
+ <argument index="3" name="out_bandwidth" type="int" default="0">
+ </argument>
+ <description>
+ Create server that listens to connections via [code]port[/code].
+ </description>
+ </method>
+ <method name="get_compression_mode" qualifiers="const">
+ <return type="int" enum="NetworkedMultiplayerENet.CompressionMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_bind_ip">
+ <return type="void">
+ </return>
+ <argument index="0" name="ip" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_compression_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="NetworkedMultiplayerENet.CompressionMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ <constant name="COMPRESS_NONE" value="0">
+ </constant>
+ <constant name="COMPRESS_RANGE_CODER" value="1">
+ </constant>
+ <constant name="COMPRESS_FASTLZ" value="2">
+ </constant>
+ <constant name="COMPRESS_ZLIB" value="3">
+ </constant>
+ <constant name="COMPRESS_ZSTD" value="4">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/etc/config.py b/modules/etc/config.py
index 7dc2cb59c..395fc1bb0 100644
--- a/modules/etc/config.py
+++ b/modules/etc/config.py
@@ -1,8 +1,6 @@
-
def can_build(platform):
return True
-
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
diff --git a/modules/freetype/config.py b/modules/freetype/config.py
index fb920482f..5f133eba9 100644
--- a/modules/freetype/config.py
+++ b/modules/freetype/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index 88588417d..2755930a5 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -40,11 +40,13 @@ def _build_gdnative_api_struct_header(api):
'\tunsigned int minor;',
'} godot_gdnative_api_version;',
'',
- 'typedef struct godot_gdnative_api_struct {',
+ 'typedef struct godot_gdnative_api_struct godot_gdnative_api_struct;',
+ '',
+ 'struct godot_gdnative_api_struct {',
'\tunsigned int type;',
'\tgodot_gdnative_api_version version;',
'\tconst godot_gdnative_api_struct *next;',
- '} godot_gdnative_api_struct;',
+ '};',
'',
'enum GDNATIVE_API_TYPES {',
'\tGDNATIVE_' + api['core']['type'] + ','
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
index e2a7019fa..02f2ee742 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
@@ -166,11 +166,11 @@ void ARVRInterfaceGDNative::uninitialize() {
interface->uninitialize(data);
}
-Size2 ARVRInterfaceGDNative::get_recommended_render_targetsize() {
+Size2 ARVRInterfaceGDNative::get_render_targetsize() {
ERR_FAIL_COND_V(interface == NULL, Size2());
- godot_vector2 result = interface->get_recommended_render_targetsize(data);
+ godot_vector2 result = interface->get_render_targetsize(data);
Vector2 *vec = (Vector2 *)&result;
return *vec;
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.h b/modules/gdnative/arvr/arvr_interface_gdnative.h
index e45b51e07..96f7b580d 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.h
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.h
@@ -68,7 +68,7 @@ public:
virtual void set_anchor_detection_is_enabled(bool p_enable);
/** rendering and internal **/
- virtual Size2 get_recommended_render_targetsize();
+ virtual Size2 get_render_targetsize();
virtual bool is_stereo();
virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform);
diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py
index df3556249..68148c4d8 100644
--- a/modules/gdnative/config.py
+++ b/modules/gdnative/config.py
@@ -1,4 +1,3 @@
-
def can_build(platform):
return True
@@ -6,7 +5,13 @@ def configure(env):
env.use_ptrcall = True
def get_doc_classes():
- return ["GDNative", "GDNativeLibrary", "NativeScript", "ARVRInterfaceGDNative"]
+ return [
+ "ARVRInterfaceGDNative",
+ "GDNative",
+ "GDNativeLibrary",
+ "NativeScript",
+ "PluginScript",
+ ]
def get_doc_path():
- return "doc_classes"
+ return "doc_classes"
diff --git a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
index 308a7d594..10957a339 100644
--- a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
+++ b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.0.alpha.custom_build">
+<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.0-alpha">
<brief_description>
GDNative wrapper for an ARVR interface
</brief_description>
diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml
index 83a1cf06f..7a36d09ae 100644
--- a/modules/gdnative/doc_classes/GDNative.xml
+++ b/modules/gdnative/doc_classes/GDNative.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNative" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
+<class name="GDNative" inherits="Reference" category="Core" version="3.0-alpha">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml
index 361c89e6b..e271665fd 100644
--- a/modules/gdnative/doc_classes/GDNativeLibrary.xml
+++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
+<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.0-alpha">
<brief_description>
</brief_description>
<description>
@@ -9,37 +9,51 @@
<demos>
</demos>
<methods>
- <method name="get_active_library_path" qualifiers="const">
+ <method name="get_config_file">
+ <return type="ConfigFile">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_current_dependencies" qualifiers="const">
+ <return type="PoolStringArray">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_current_library_path" qualifiers="const">
<return type="String">
</return>
<description>
</description>
</method>
- <method name="get_library_path" qualifiers="const">
+ <method name="get_symbol_prefix" qualifiers="const">
<return type="String">
</return>
- <argument index="0" name="platform" type="String">
- </argument>
<description>
</description>
</method>
- <method name="is_singleton_gdnative" qualifiers="const">
+ <method name="is_current_library_statically_linked" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_singleton" qualifiers="const">
<return type="bool">
</return>
<description>
</description>
</method>
- <method name="set_library_path">
+ <method name="set_load_once">
<return type="void">
</return>
- <argument index="0" name="platform" type="String">
- </argument>
- <argument index="1" name="path" type="String">
+ <argument index="0" name="load_once" type="bool">
</argument>
<description>
</description>
</method>
- <method name="set_singleton_gdnative">
+ <method name="set_singleton">
<return type="void">
</return>
<argument index="0" name="singleton" type="bool">
@@ -47,9 +61,27 @@
<description>
</description>
</method>
+ <method name="set_symbol_prefix">
+ <return type="void">
+ </return>
+ <argument index="0" name="symbol_prefix" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="should_load_once" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
</methods>
<members>
- <member name="singleton_gdnative" type="bool" setter="set_singleton_gdnative" getter="is_singleton_gdnative">
+ <member name="load_once" type="bool" setter="set_load_once" getter="should_load_once">
+ </member>
+ <member name="singleton" type="bool" setter="set_singleton" getter="is_singleton">
+ </member>
+ <member name="symbol_prefix" type="String" setter="set_symbol_prefix" getter="get_symbol_prefix">
</member>
</members>
<constants>
diff --git a/modules/gdnative/doc_classes/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml
index b040cfd96..eb4e13f74 100644
--- a/modules/gdnative/doc_classes/NativeScript.xml
+++ b/modules/gdnative/doc_classes/NativeScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NativeScript" inherits="Script" category="Core" version="3.0.alpha.custom_build">
+<class name="NativeScript" inherits="Script" category="Core" version="3.0-alpha">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdnative/doc_classes/PluginScript.xml b/modules/gdnative/doc_classes/PluginScript.xml
new file mode 100644
index 000000000..a5ab422d3
--- /dev/null
+++ b/modules/gdnative/doc_classes/PluginScript.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="PluginScript" inherits="Script" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/gdnative/gd_native_library_editor.cpp b/modules/gdnative/gd_native_library_editor.cpp
index c37b7f473..fda5dcdca 100644
--- a/modules/gdnative/gd_native_library_editor.cpp
+++ b/modules/gdnative/gd_native_library_editor.cpp
@@ -44,7 +44,7 @@ void GDNativeLibraryEditor::_find_gdnative_singletons(EditorFileSystemDirectory
}
Ref<GDNativeLibrary> lib = ResourceLoader::load(p_dir->get_file_path(i));
- if (lib.is_valid() && lib->is_singleton_gdnative()) {
+ if (lib.is_valid() && lib->is_singleton()) {
String path = p_dir->get_file_path(i);
TreeItem *ti = libraries->create_item(libraries->get_root());
ti->set_text(0, path.get_file());
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 832a0cb85..44d6dffc8 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -37,161 +37,56 @@
#include "scene/main/scene_tree.h"
-const String init_symbol = "godot_gdnative_init";
-const String terminate_symbol = "godot_gdnative_terminate";
+const String init_symbol = "gdnative_init";
+const String terminate_symbol = "gdnative_terminate";
+const String default_symbol_prefix = "godot_";
// Defined in gdnative_api_struct.gen.cpp
extern const godot_gdnative_core_api_struct api_struct;
-String GDNativeLibrary::platform_names[NUM_PLATFORMS + 1] = {
- "X11_32bit",
- "X11_64bit",
- "Windows_32bit",
- "Windows_64bit",
- "OSX",
+Map<String, Vector<Ref<GDNative> > > *GDNativeLibrary::loaded_libraries = NULL;
- "Android",
+GDNativeLibrary::GDNativeLibrary() {
+ config_file.instance();
- "iOS_32bit",
- "iOS_64bit",
+ symbol_prefix = default_symbol_prefix;
- "WebAssembly",
-
- ""
-};
-String GDNativeLibrary::platform_lib_ext[NUM_PLATFORMS + 1] = {
- "so",
- "so",
- "dll",
- "dll",
- "dylib",
-
- "so",
-
- "dylib",
- "dylib",
-
- "wasm",
-
- ""
-};
-
-GDNativeLibrary::Platform GDNativeLibrary::current_platform =
-#if defined(X11_ENABLED)
- (sizeof(void *) == 8 ? X11_64BIT : X11_32BIT);
-#elif defined(WINDOWS_ENABLED)
- (sizeof(void *) == 8 ? WINDOWS_64BIT : WINDOWS_32BIT);
-#elif defined(OSX_ENABLED)
- OSX;
-#elif defined(IPHONE_ENABLED)
- (sizeof(void *) == 8 ? IOS_64BIT : IOS_32BIT);
-#elif defined(ANDROID_ENABLED)
- ANDROID;
-#elif defined(JAVASCRIPT_ENABLED)
- WASM;
-#else
- NUM_PLATFORMS;
-#endif
-
-GDNativeLibrary::GDNativeLibrary()
- : library_paths(), singleton_gdnative(false) {
+ if (GDNativeLibrary::loaded_libraries == NULL) {
+ GDNativeLibrary::loaded_libraries = memnew((Map<String, Vector<Ref<GDNative> > >));
+ }
}
GDNativeLibrary::~GDNativeLibrary() {
}
void GDNativeLibrary::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_library_path", "platform", "path"), &GDNativeLibrary::set_library_path);
- ClassDB::bind_method(D_METHOD("get_library_path", "platform"), &GDNativeLibrary::get_library_path);
- ClassDB::bind_method(D_METHOD("get_active_library_path"), &GDNativeLibrary::get_active_library_path);
-
- ClassDB::bind_method(D_METHOD("is_singleton_gdnative"), &GDNativeLibrary::is_singleton_gdnative);
- ClassDB::bind_method(D_METHOD("set_singleton_gdnative", "singleton"), &GDNativeLibrary::set_singleton_gdnative);
-
- ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "singleton_gdnative"), "set_singleton_gdnative", "is_singleton_gdnative");
-}
-
-bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
- if (name.begins_with("platform/")) {
- set_library_path(name.get_slice("/", 1), p_value);
- return true;
- }
- return false;
-}
-
-bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
- if (name.begins_with("platform/")) {
- r_ret = get_library_path(name.get_slice("/", 1));
- return true;
- }
- return false;
-}
-
-void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
- for (int i = 0; i < NUM_PLATFORMS; i++) {
- p_list->push_back(PropertyInfo(Variant::STRING,
- "platform/" + platform_names[i],
- PROPERTY_HINT_FILE,
- "*." + platform_lib_ext[i]));
- }
-}
-
-void GDNativeLibrary::set_library_path(StringName p_platform, String p_path) {
- int i;
- for (i = 0; i <= NUM_PLATFORMS; i++) {
- if (i == NUM_PLATFORMS) break;
- if (platform_names[i] == p_platform) {
- break;
- }
- }
-
- if (i == NUM_PLATFORMS) {
- ERR_EXPLAIN(String("No such platform: ") + p_platform);
- ERR_FAIL();
- }
+ ClassDB::bind_method(D_METHOD("get_config_file"), &GDNativeLibrary::get_config_file);
- library_paths[i] = p_path;
-}
+ ClassDB::bind_method(D_METHOD("get_current_library_path"), &GDNativeLibrary::get_current_library_path);
+ ClassDB::bind_method(D_METHOD("get_current_dependencies"), &GDNativeLibrary::get_current_dependencies);
+ ClassDB::bind_method(D_METHOD("is_current_library_statically_linked"), &GDNativeLibrary::is_current_library_statically_linked);
-String GDNativeLibrary::get_library_path(StringName p_platform) const {
- int i;
- for (i = 0; i <= NUM_PLATFORMS; i++) {
- if (i == NUM_PLATFORMS) break;
- if (platform_names[i] == p_platform) {
- break;
- }
- }
+ ClassDB::bind_method(D_METHOD("should_load_once"), &GDNativeLibrary::should_load_once);
+ ClassDB::bind_method(D_METHOD("is_singleton"), &GDNativeLibrary::is_singleton);
+ ClassDB::bind_method(D_METHOD("get_symbol_prefix"), &GDNativeLibrary::get_symbol_prefix);
- if (i == NUM_PLATFORMS) {
- ERR_EXPLAIN(String("No such platform: ") + p_platform);
- ERR_FAIL_V("");
- }
+ ClassDB::bind_method(D_METHOD("set_load_once", "load_once"), &GDNativeLibrary::set_load_once);
+ ClassDB::bind_method(D_METHOD("set_singleton", "singleton"), &GDNativeLibrary::set_singleton);
+ ClassDB::bind_method(D_METHOD("set_symbol_prefix", "symbol_prefix"), &GDNativeLibrary::set_symbol_prefix);
- return library_paths[i];
-}
-
-String GDNativeLibrary::get_active_library_path() const {
- if (GDNativeLibrary::current_platform != NUM_PLATFORMS) {
- return library_paths[GDNativeLibrary::current_platform];
- }
- return "";
+ ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "load_once"), "set_load_once", "should_load_once");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "singleton"), "set_singleton", "is_singleton");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "symbol_prefix"), "set_symbol_prefix", "get_symbol_prefix");
}
GDNative::GDNative() {
native_handle = NULL;
+ initialized = false;
}
GDNative::~GDNative() {
}
-extern "C" void _api_anchor();
-
-void GDNative::_compile_dummy_for_api() {
- _api_anchor();
-}
-
void GDNative::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNative::set_library);
ClassDB::bind_method(D_METHOD("get_library"), &GDNative::get_library);
@@ -220,8 +115,8 @@ bool GDNative::initialize() {
return false;
}
- String lib_path = library->get_active_library_path();
- if (lib_path.empty()) {
+ String lib_path = library->get_current_library_path();
+ if (lib_path.empty() && !library->is_current_library_statically_linked()) {
ERR_PRINT("No library set for this platform");
return false;
}
@@ -230,16 +125,34 @@ bool GDNative::initialize() {
#else
String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
#endif
+
+ if (library->should_load_once()) {
+ if (GDNativeLibrary::loaded_libraries->has(lib_path)) {
+ // already loaded. Don't load again.
+ // copy some of the stuff instead
+ this->native_handle = (*GDNativeLibrary::loaded_libraries)[lib_path][0]->native_handle;
+ initialized = true;
+ return true;
+ }
+ }
+
Error err = OS::get_singleton()->open_dynamic_library(path, native_handle);
- if (err != OK) {
+ if (err != OK && !library->is_current_library_statically_linked()) {
return false;
}
void *library_init;
- err = get_symbol(init_symbol, library_init);
+
+ // we cheat here a little bit. you saw nothing
+ initialized = true;
+
+ err = get_symbol(library->get_symbol_prefix() + init_symbol, library_init);
+
+ initialized = false;
if (err || !library_init) {
- OS::get_singleton()->close_dynamic_library(native_handle);
+ if (!library->is_current_library_statically_linked())
+ OS::get_singleton()->close_dynamic_library(native_handle);
native_handle = NULL;
ERR_PRINT("Failed to obtain godot_gdnative_init symbol");
return false;
@@ -260,18 +173,42 @@ bool GDNative::initialize() {
library_init_fpointer(&options);
+ initialized = true;
+
+ if (library->should_load_once() && !GDNativeLibrary::loaded_libraries->has(lib_path)) {
+ Vector<Ref<GDNative> > gdnatives;
+ gdnatives.resize(1);
+ gdnatives[0] = Ref<GDNative>(this);
+ GDNativeLibrary::loaded_libraries->insert(lib_path, gdnatives);
+ }
+
return true;
}
bool GDNative::terminate() {
- if (native_handle == NULL) {
+ if (!initialized) {
ERR_PRINT("No valid library handle, can't terminate GDNative object");
return false;
}
+ if (library->should_load_once()) {
+ Vector<Ref<GDNative> > *gdnatives = &(*GDNativeLibrary::loaded_libraries)[library->get_current_library_path()];
+ if (gdnatives->size() > 1) {
+ // there are other GDNative's still using this library, so we actually don't terminte
+ gdnatives->erase(Ref<GDNative>(this));
+ initialized = false;
+ return true;
+ } else if (gdnatives->size() == 1) {
+ // we're the last one, terminate!
+ gdnatives->clear();
+ // wew this looks scary, but all it does is remove the entry completely
+ GDNativeLibrary::loaded_libraries->erase(GDNativeLibrary::loaded_libraries->find(library->get_current_library_path()));
+ }
+ }
+
void *library_terminate;
- Error error = get_symbol(terminate_symbol, library_terminate);
+ Error error = get_symbol(library->get_symbol_prefix() + terminate_symbol, library_terminate);
if (error || !library_terminate) {
OS::get_singleton()->close_dynamic_library(native_handle);
native_handle = NULL;
@@ -281,13 +218,13 @@ bool GDNative::terminate() {
godot_gdnative_terminate_fn library_terminate_pointer;
library_terminate_pointer = (godot_gdnative_terminate_fn)library_terminate;
- // TODO(karroffel): remove this? Should be part of NativeScript, not
- // GDNative IMO
godot_gdnative_terminate_options options;
options.in_editor = Engine::get_singleton()->is_editor_hint();
library_terminate_pointer(&options);
+ initialized = false;
+
// GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path);
OS::get_singleton()->close_dynamic_library(native_handle);
@@ -297,7 +234,7 @@ bool GDNative::terminate() {
}
bool GDNative::is_initialized() {
- return (native_handle != NULL);
+ return initialized;
}
void GDNativeCallRegistry::register_native_call_type(StringName p_call_type, native_call_cb p_callback) {
@@ -342,7 +279,7 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced
Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle) {
- if (native_handle == NULL) {
+ if (!initialized) {
ERR_PRINT("No valid library handle, can't get symbol from GDNative object");
return ERR_CANT_OPEN;
}
@@ -355,3 +292,159 @@ Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle) {
return result;
}
+
+RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error) {
+ Ref<GDNativeLibrary> lib;
+ lib.instance();
+
+ Ref<ConfigFile> config = lib->get_config_file();
+
+ Error err = config->load(p_path);
+
+ if (r_error) {
+ *r_error = err;
+ }
+
+ lib->set_singleton(config->get_value("general", "singleton", false));
+ lib->set_load_once(config->get_value("general", "load_once", true));
+ lib->set_symbol_prefix(config->get_value("general", "symbol_prefix", default_symbol_prefix));
+
+ String entry_lib_path;
+ {
+
+ List<String> entry_keys;
+ config->get_section_keys("entry", &entry_keys);
+
+ for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) {
+ String key = E->get();
+
+ Vector<String> tags = key.split(".");
+
+ bool skip = false;
+ for (int i = 0; i < tags.size(); i++) {
+ bool has_feature = OS::get_singleton()->has_feature(tags[i]);
+
+ if (!has_feature) {
+ skip = true;
+ break;
+ }
+ }
+
+ if (skip) {
+ continue;
+ }
+
+ entry_lib_path = config->get_value("entry", key);
+ break;
+ }
+ }
+
+ Vector<String> dependency_paths;
+ {
+
+ List<String> dependency_keys;
+ config->get_section_keys("dependencies", &dependency_keys);
+
+ for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) {
+ String key = E->get();
+
+ Vector<String> tags = key.split(".");
+
+ bool skip = false;
+ for (int i = 0; i < tags.size(); i++) {
+ bool has_feature = OS::get_singleton()->has_feature(tags[i]);
+
+ if (!has_feature) {
+ skip = true;
+ break;
+ }
+ }
+
+ if (skip) {
+ continue;
+ }
+
+ dependency_paths = config->get_value("dependencies", key);
+ break;
+ }
+ }
+
+ bool is_statically_linked = false;
+ {
+
+ List<String> static_linking_keys;
+ config->get_section_keys("static_linking", &static_linking_keys);
+
+ for (List<String>::Element *E = static_linking_keys.front(); E; E = E->next()) {
+ String key = E->get();
+
+ Vector<String> tags = key.split(".");
+
+ bool skip = false;
+
+ for (int i = 0; i < tags.size(); i++) {
+ bool has_feature = OS::get_singleton()->has_feature(tags[i]);
+
+ if (!has_feature) {
+ skip = true;
+ break;
+ }
+ }
+
+ if (skip) {
+ continue;
+ }
+
+ is_statically_linked = config->get_value("static_linking", key);
+ break;
+ }
+ }
+
+ lib->current_library_path = entry_lib_path;
+ lib->current_dependencies = dependency_paths;
+ lib->current_library_statically_linked = is_statically_linked;
+
+ return lib;
+}
+
+void GDNativeLibraryResourceLoader::get_recognized_extensions(List<String> *p_extensions) const {
+ p_extensions->push_back("gdnlib");
+}
+
+bool GDNativeLibraryResourceLoader::handles_type(const String &p_type) const {
+ return p_type == "GDNativeLibrary";
+}
+
+String GDNativeLibraryResourceLoader::get_resource_type(const String &p_path) const {
+ String el = p_path.get_extension().to_lower();
+ if (el == "gdnlib")
+ return "GDNativeLibrary";
+ return "";
+}
+
+Error GDNativeLibraryResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
+
+ Ref<GDNativeLibrary> lib = p_resource;
+
+ if (lib.is_null()) {
+ return ERR_INVALID_DATA;
+ }
+
+ Ref<ConfigFile> config = lib->get_config_file();
+
+ config->set_value("general", "singleton", lib->is_singleton());
+ config->set_value("general", "load_once", lib->should_load_once());
+ config->set_value("general", "symbol_prefix", lib->get_symbol_prefix());
+
+ return config->save(p_path);
+}
+
+bool GDNativeLibraryResourceSaver::recognize(const RES &p_resource) const {
+ return Object::cast_to<GDNativeLibrary>(*p_resource) != NULL;
+}
+
+void GDNativeLibraryResourceSaver::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
+ if (Object::cast_to<GDNativeLibrary>(*p_resource) != NULL) {
+ p_extensions->push_back("gdnlib");
+ }
+}
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index e44cc55a7..061dff926 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -38,66 +38,69 @@
#include "gdnative/gdnative.h"
#include "gdnative_api_struct.gen.h"
-class GDNativeLibrary : public Resource {
- GDCLASS(GDNativeLibrary, Resource)
-
- enum Platform {
- X11_32BIT,
- X11_64BIT,
- WINDOWS_32BIT,
- WINDOWS_64BIT,
- // NOTE(karroffel): I heard OSX 32 bit is dead, so 64 only
- OSX,
-
- // Android .so files must be located in directories corresponding to Android ABI names:
- // https://developer.android.com/ndk/guides/abis.html
- // Android runtime will select the matching library depending on the device.
- // The value here must simply point to the .so name, for example:
- // "res://libmy_gdnative.so" or "libmy_gdnative.so",
- // while in the project the actual paths can be "lib/android/armeabi-v7a/libmy_gdnative.so",
- // "lib/android/arm64-v8a/libmy_gdnative.so".
- ANDROID,
-
- IOS_32BIT,
- IOS_64BIT,
-
- // TODO(karroffel): figure out how to deal with web stuff at all...
- WASM,
-
- // TODO(karroffel): does UWP have different libs??
- // UWP,
+#include "io/config_file.h"
- NUM_PLATFORMS
+class GDNativeLibraryResourceLoader;
+class GDNative;
- };
+class GDNativeLibrary : public Resource {
+ GDCLASS(GDNativeLibrary, Resource)
- static String platform_names[NUM_PLATFORMS + 1];
- static String platform_lib_ext[NUM_PLATFORMS + 1];
+ static Map<String, Vector<Ref<GDNative> > > *loaded_libraries;
- static Platform current_platform;
+ friend class GDNativeLibraryResourceLoader;
+ friend class GDNative;
- String library_paths[NUM_PLATFORMS];
+ Ref<ConfigFile> config_file;
- bool singleton_gdnative;
+ String current_library_path;
+ Vector<String> current_dependencies;
+ bool current_library_statically_linked;
-protected:
- bool _set(const StringName &p_name, const Variant &p_value);
- bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const;
+ bool singleton;
+ bool load_once;
+ String symbol_prefix;
public:
GDNativeLibrary();
~GDNativeLibrary();
- static void _bind_methods();
+ _FORCE_INLINE_ Ref<ConfigFile> get_config_file() { return config_file; }
+
+ // things that change per-platform
+ // so there are no setters for this
+ _FORCE_INLINE_ String get_current_library_path() const {
+ return current_library_path;
+ }
+ _FORCE_INLINE_ Vector<String> get_current_dependencies() const {
+ return current_dependencies;
+ }
+ _FORCE_INLINE_ bool is_current_library_statically_linked() const {
+ return current_library_statically_linked;
+ }
- void set_library_path(StringName p_platform, String p_path);
- String get_library_path(StringName p_platform) const;
+ // things that are a property of the library itself, not platform specific
+ _FORCE_INLINE_ bool should_load_once() const {
+ return load_once;
+ }
+ _FORCE_INLINE_ bool is_singleton() const {
+ return singleton;
+ }
+ _FORCE_INLINE_ String get_symbol_prefix() const {
+ return symbol_prefix;
+ }
- String get_active_library_path() const;
+ _FORCE_INLINE_ void set_load_once(bool p_load_once) {
+ load_once = p_load_once;
+ }
+ _FORCE_INLINE_ void set_singleton(bool p_singleton) {
+ singleton = p_singleton;
+ }
+ _FORCE_INLINE_ void set_symbol_prefix(String p_symbol_prefix) {
+ symbol_prefix = p_symbol_prefix;
+ }
- _FORCE_INLINE_ bool is_singleton_gdnative() const { return singleton_gdnative; }
- _FORCE_INLINE_ void set_singleton_gdnative(bool p_singleton) { singleton_gdnative = p_singleton; }
+ static void _bind_methods();
};
typedef godot_variant (*native_call_cb)(void *, godot_array *);
@@ -124,10 +127,9 @@ class GDNative : public Reference {
Ref<GDNativeLibrary> library;
- // TODO(karroffel): different platforms? WASM????
void *native_handle;
- void _compile_dummy_for_api();
+ bool initialized;
public:
GDNative();
@@ -148,4 +150,19 @@ public:
Error get_symbol(StringName p_procedure_name, void *&r_handle);
};
+class GDNativeLibraryResourceLoader : public ResourceFormatLoader {
+public:
+ virtual RES load(const String &p_path, const String &p_original_path, Error *r_error);
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual bool handles_type(const String &p_type) const;
+ virtual String get_resource_type(const String &p_path) const;
+};
+
+class GDNativeLibraryResourceSaver : public ResourceFormatSaver {
+public:
+ virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags);
+ virtual bool recognize(const RES &p_resource) const;
+ virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
+};
+
#endif // GDNATIVE_H
diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp
index 90bc4dc03..e0d951498 100644
--- a/modules/gdnative/gdnative/array.cpp
+++ b/modules/gdnative/gdnative/array.cpp
@@ -41,9 +41,6 @@
extern "C" {
#endif
-void _array_api_anchor() {
-}
-
void GDAPI godot_array_new(godot_array *r_dest) {
Array *dest = (Array *)r_dest;
memnew_placement(dest, Array);
diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp
index 28af93f94..39ca754dc 100644
--- a/modules/gdnative/gdnative/basis.cpp
+++ b/modules/gdnative/gdnative/basis.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _basis_api_anchor() {}
-
void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) {
const Vector3 *x_axis = (const Vector3 *)p_x_axis;
const Vector3 *y_axis = (const Vector3 *)p_y_axis;
diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp
index 2a5c0887a..281a4c416 100644
--- a/modules/gdnative/gdnative/color.cpp
+++ b/modules/gdnative/gdnative/color.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _color_api_anchor() {}
-
void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) {
Color *dest = (Color *)r_dest;
diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp
index 7f8320622..836341694 100644
--- a/modules/gdnative/gdnative/dictionary.cpp
+++ b/modules/gdnative/gdnative/dictionary.cpp
@@ -38,8 +38,6 @@
extern "C" {
#endif
-void _dictionary_api_anchor() {}
-
void GDAPI godot_dictionary_new(godot_dictionary *r_dest) {
Dictionary *dest = (Dictionary *)r_dest;
memnew_placement(dest, Dictionary);
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index 64a7c33cf..6dfa7ec20 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -30,57 +30,16 @@
#include "gdnative/gdnative.h"
#include "class_db.h"
+#include "engine.h"
#include "error_macros.h"
#include "global_constants.h"
#include "os/os.h"
-#include "project_settings.h"
#include "variant.h"
#ifdef __cplusplus
extern "C" {
#endif
-extern "C" void _string_api_anchor();
-extern "C" void _string_name_api_anchor();
-extern "C" void _vector2_api_anchor();
-extern "C" void _rect2_api_anchor();
-extern "C" void _vector3_api_anchor();
-extern "C" void _transform2d_api_anchor();
-extern "C" void _plane_api_anchor();
-extern "C" void _quat_api_anchor();
-extern "C" void _basis_api_anchor();
-extern "C" void _rect3_api_anchor();
-extern "C" void _transform_api_anchor();
-extern "C" void _color_api_anchor();
-extern "C" void _node_path_api_anchor();
-extern "C" void _rid_api_anchor();
-extern "C" void _dictionary_api_anchor();
-extern "C" void _array_api_anchor();
-extern "C" void _pool_arrays_api_anchor();
-extern "C" void _variant_api_anchor();
-
-void _api_anchor() {
-
- _string_api_anchor();
- _string_name_api_anchor();
- _vector2_api_anchor();
- _rect2_api_anchor();
- _vector3_api_anchor();
- _transform2d_api_anchor();
- _plane_api_anchor();
- _quat_api_anchor();
- _rect3_api_anchor();
- _basis_api_anchor();
- _transform_api_anchor();
- _color_api_anchor();
- _node_path_api_anchor();
- _rid_api_anchor();
- _dictionary_api_anchor();
- _array_api_anchor();
- _pool_arrays_api_anchor();
- _variant_api_anchor();
-}
-
void GDAPI godot_object_destroy(godot_object *p_o) {
memdelete((Object *)p_o);
}
@@ -88,7 +47,7 @@ void GDAPI godot_object_destroy(godot_object *p_o) {
// Singleton API
godot_object GDAPI *godot_global_get_singleton(char *p_name) {
- return (godot_object *)ProjectSettings::get_singleton()->get_singleton_object(String(p_name));
+ return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name));
} // result shouldn't be freed
void GDAPI *godot_get_stack_bottom() {
@@ -133,14 +92,6 @@ godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, god
return ret;
}
-// @Todo
-/*
-void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind)
-{
-
-}
-*/
-
godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname) {
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname));
if (class_info)
diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp
index 50fade5b9..2bd278e05 100644
--- a/modules/gdnative/gdnative/node_path.cpp
+++ b/modules/gdnative/gdnative/node_path.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _node_path_api_anchor() {}
-
void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) {
NodePath *dest = (NodePath *)r_dest;
const String *from = (const String *)p_from;
diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp
index a5e05ffa6..c92efb8d9 100644
--- a/modules/gdnative/gdnative/plane.cpp
+++ b/modules/gdnative/gdnative/plane.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _plane_api_anchor() {}
-
void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) {
Plane *dest = (Plane *)r_dest;
diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp
index 731e93090..562cc344a 100644
--- a/modules/gdnative/gdnative/pool_arrays.cpp
+++ b/modules/gdnative/gdnative/pool_arrays.cpp
@@ -41,9 +41,6 @@
extern "C" {
#endif
-void _pool_arrays_api_anchor() {
-}
-
#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
// byte
diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp
index 7db7847da..2d012c069 100644
--- a/modules/gdnative/gdnative/quat.cpp
+++ b/modules/gdnative/gdnative/quat.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _quat_api_anchor() {}
-
void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) {
Quat *dest = (Quat *)r_dest;
diff --git a/modules/gdnative/gdnative/rect2.cpp b/modules/gdnative/gdnative/rect2.cpp
index ecd8cce9c..b0b0e2813 100644
--- a/modules/gdnative/gdnative/rect2.cpp
+++ b/modules/gdnative/gdnative/rect2.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _rect2_api_anchor() {}
-
void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
const Vector2 *position = (const Vector2 *)p_pos;
const Vector2 *size = (const Vector2 *)p_size;
diff --git a/modules/gdnative/gdnative/rect3.cpp b/modules/gdnative/gdnative/rect3.cpp
index d34d964db..8e088743b 100644
--- a/modules/gdnative/gdnative/rect3.cpp
+++ b/modules/gdnative/gdnative/rect3.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _rect3_api_anchor() {}
-
void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
const Vector3 *pos = (const Vector3 *)p_pos;
const Vector3 *size = (const Vector3 *)p_size;
diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp
index f05c39906..c6e8d8249 100644
--- a/modules/gdnative/gdnative/rid.cpp
+++ b/modules/gdnative/gdnative/rid.cpp
@@ -37,8 +37,6 @@
extern "C" {
#endif
-void _rid_api_anchor() {}
-
void GDAPI godot_rid_new(godot_rid *r_dest) {
RID *dest = (RID *)r_dest;
memnew_placement(dest, RID);
diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp
index 619003083..781b8754b 100644
--- a/modules/gdnative/gdnative/string.cpp
+++ b/modules/gdnative/gdnative/string.cpp
@@ -39,9 +39,6 @@
extern "C" {
#endif
-void _string_api_anchor() {
-}
-
void GDAPI godot_string_new(godot_string *r_dest) {
String *dest = (String *)r_dest;
memnew_placement(dest, String);
diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp
index 5c00fdfc2..5c79e0acb 100644
--- a/modules/gdnative/gdnative/string_name.cpp
+++ b/modules/gdnative/gdnative/string_name.cpp
@@ -38,9 +38,6 @@
extern "C" {
#endif
-void _string_name_api_anchor() {
-}
-
void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) {
StringName *dest = (StringName *)r_dest;
const String *name = (const String *)p_name;
diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp
index d7a3e78d3..96b2ec8a7 100644
--- a/modules/gdnative/gdnative/transform.cpp
+++ b/modules/gdnative/gdnative/transform.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _transform_api_anchor() {}
-
void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) {
const Vector3 *x_axis = (const Vector3 *)p_x_axis;
const Vector3 *y_axis = (const Vector3 *)p_y_axis;
diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp
index dcb54f7a5..0a6334516 100644
--- a/modules/gdnative/gdnative/transform2d.cpp
+++ b/modules/gdnative/gdnative/transform2d.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _transform2d_api_anchor() {}
-
void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) {
const Vector2 *pos = (const Vector2 *)p_pos;
Transform2D *dest = (Transform2D *)r_dest;
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 9ba4166c1..0c31bc643 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _variant_api_anchor() {}
-
#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
// Constructors
diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp
index 67f858997..7a5b29e0c 100644
--- a/modules/gdnative/gdnative/vector2.cpp
+++ b/modules/gdnative/gdnative/vector2.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _vector2_api_anchor() {}
-
void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) {
Vector2 *dest = (Vector2 *)r_dest;
diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp
index c85a3f1c0..11ffb3320 100644
--- a/modules/gdnative/gdnative/vector3.cpp
+++ b/modules/gdnative/gdnative/vector3.cpp
@@ -36,8 +36,6 @@
extern "C" {
#endif
-void _vector3_api_anchor() {}
-
void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) {
Vector3 *dest = (Vector3 *)r_dest;
diff --git a/modules/gdnative/include/arvr/godot_arvr.h b/modules/gdnative/include/arvr/godot_arvr.h
index c12251439..be13ac954 100644
--- a/modules/gdnative/include/arvr/godot_arvr.h
+++ b/modules/gdnative/include/arvr/godot_arvr.h
@@ -47,7 +47,7 @@ typedef struct {
godot_bool (*is_initialized)(const void *);
godot_bool (*initialize)(void *);
void (*uninitialize)(void *);
- godot_vector2 (*get_recommended_render_targetsize)(const void *);
+ godot_vector2 (*get_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 *);
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index 8fa96fd3a..a479eced1 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -53,7 +53,7 @@ extern "C" {
// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!!
#ifdef _WIN32
-#define GDN_EXPORT __declspec(dllexport)
+#define GDN_EXPORT
#else
#define GDN_EXPORT
#endif
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 63fb71feb..f9d699fb5 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -32,9 +32,9 @@
#ifdef TOOLS_ENABLED
#include "core/class_db.h"
+#include "core/engine.h"
#include "core/global_constants.h"
#include "core/pair.h"
-#include "core/project_settings.h"
#include "os/file_access.h"
// helper stuff
@@ -177,7 +177,7 @@ List<ClassAPI> generate_c_api_classes() {
if (name.begins_with("_")) {
name.remove(0);
}
- class_api.is_singleton = ProjectSettings::get_singleton()->has_singleton(name);
+ class_api.is_singleton = Engine::get_singleton()->has_singleton(name);
}
class_api.is_instanciable = !class_api.is_singleton && ClassDB::can_instance(class_name);
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index c1df7def2..c2c7c27f2 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -40,6 +40,8 @@
#include "scene/main/scene_tree.h"
#include "scene/resources/scene_format_text.h"
+#include <stdlib.h>
+
#ifndef NO_THREADS
#include "os/thread.h"
#endif
@@ -52,7 +54,11 @@
#include "editor/editor_node.h"
#endif
-////// Script stuff
+//
+//
+// Script stuff
+//
+//
void NativeScript::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_class_name", "class_name"), &NativeScript::set_class_name);
@@ -108,7 +114,7 @@ void NativeScript::set_library(Ref<GDNativeLibrary> p_library) {
return;
}
library = p_library;
- lib_path = library->get_active_library_path();
+ lib_path = library->get_current_library_path();
#ifndef NO_THREADS
if (Thread::get_caller_id() != Thread::get_main_id()) {
@@ -414,7 +420,6 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Variant::Call
}
}
-// TODO(karroffel): implement this
NativeScript::NativeScript() {
library = Ref<GDNative>();
lib_path = "";
@@ -424,7 +429,6 @@ NativeScript::NativeScript() {
#endif
}
-// TODO(karroffel): implement this
NativeScript::~NativeScript() {
NSL->unregister_script(this);
@@ -433,7 +437,11 @@ NativeScript::~NativeScript() {
#endif
}
-////// ScriptInstance stuff
+//
+//
+// ScriptInstance stuff
+//
+//
#define GET_SCRIPT_DESC() script->get_script_desc()
@@ -691,7 +699,6 @@ NativeScriptInstance::RPCMode NativeScriptInstance::get_rpc_mode(const StringNam
return RPC_MODE_DISABLED;
}
-// TODO(karroffel): implement this
NativeScriptInstance::RPCMode NativeScriptInstance::get_rset_mode(const StringName &p_variable) const {
NativeScriptDesc *script_data = GET_SCRIPT_DESC();
@@ -774,15 +781,14 @@ NativeScriptInstance::~NativeScriptInstance() {
}
}
-////// ScriptingLanguage stuff
+//
+//
+// ScriptingLanguage stuff
+//
+//
NativeScriptLanguage *NativeScriptLanguage::singleton;
-extern "C" void _native_script_hook();
-void NativeScriptLanguage::_hacky_api_anchor() {
- _native_script_hook();
-}
-
void NativeScriptLanguage::_unload_stuff() {
for (Map<String, Map<StringName, NativeScriptDesc> >::Element *L = library_classes.front(); L; L = L->next()) {
for (Map<StringName, NativeScriptDesc>::Element *C = L->get().front(); C; C = C->next()) {
@@ -819,9 +825,7 @@ NativeScriptLanguage::NativeScriptLanguage() {
#endif
}
-// TODO(karroffel): implement this
NativeScriptLanguage::~NativeScriptLanguage() {
- // _unload_stuff(); // NOTE(karroffel): This gets called in ::finish()
for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
@@ -847,7 +851,6 @@ void _add_reload_node() {
#endif
}
-// TODO(karroffel): implement this
void NativeScriptLanguage::init() {
#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
@@ -860,6 +863,7 @@ void NativeScriptLanguage::init() {
if (generate_c_api(E->next()->get()) != OK) {
ERR_PRINT("Failed to generate C API\n");
}
+ exit(0);
}
#endif
@@ -886,11 +890,9 @@ void NativeScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) co
void NativeScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const {
}
-// TODO(karroffel): implement this
Ref<Script> NativeScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
NativeScript *s = memnew(NativeScript);
s->set_class_name(p_class_name);
- // TODO(karroffel): use p_base_class_name
return Ref<NativeScript>(s);
}
bool NativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
@@ -988,7 +990,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) {
MutexLock lock(mutex);
#endif
// See if this library was "registered" already.
- const String &lib_path = lib->get_active_library_path();
+ const String &lib_path = lib->get_current_library_path();
ERR_EXPLAIN(lib->get_name() + " does not have a library for the current platform");
ERR_FAIL_COND(lib_path.length() == 0);
Map<String, Ref<GDNative> >::Element *E = library_gdnatives.find(lib_path);
@@ -998,7 +1000,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) {
gdn.instance();
gdn->set_library(lib);
- // TODO(karroffel): check the return value?
+ // TODO check the return value?
gdn->initialize();
library_gdnatives.insert(lib_path, gdn);
@@ -1010,7 +1012,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) {
void *proc_ptr;
- Error err = gdn->get_symbol(_init_call_name, proc_ptr);
+ Error err = gdn->get_symbol(lib->get_symbol_prefix() + _init_call_name, proc_ptr);
if (err != OK) {
ERR_PRINT(String("No " + _init_call_name + " in \"" + lib_path + "\" found").utf8().get_data());
@@ -1051,7 +1053,7 @@ void NativeScriptLanguage::call_libraries_cb(const StringName &name) {
if (L->get()->is_initialized()) {
void *proc_ptr;
- Error err = L->get()->get_symbol(name, proc_ptr);
+ Error err = L->get()->get_symbol(L->get()->get_library()->get_symbol_prefix() + name, proc_ptr);
if (!err) {
((void (*)())proc_ptr)();
@@ -1140,7 +1142,7 @@ void NativeReloadNode::_notification(int p_what) {
// here the library registers all the classes and stuff.
void *proc_ptr;
- Error err = L->get()->get_symbol("godot_nativescript_init", proc_ptr);
+ Error err = L->get()->get_symbol(L->get()->get_library()->get_symbol_prefix() + "nativescript_init", proc_ptr);
if (err != OK) {
ERR_PRINT(String("No godot_nativescript_init in \"" + L->key() + "\" found").utf8().get_data());
} else {
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index e8fc9e688..f0f14e2f3 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -229,15 +229,15 @@ public:
Map<String, Set<NativeScript *> > library_script_users;
const StringName _init_call_type = "nativescript_init";
- const StringName _init_call_name = "godot_nativescript_init";
+ const StringName _init_call_name = "nativescript_init";
const StringName _noarg_call_type = "nativescript_no_arg";
- const StringName _frame_call_name = "godot_nativescript_frame";
+ const StringName _frame_call_name = "nativescript_frame";
#ifndef NO_THREADS
- const StringName _thread_enter_call_name = "godot_nativescript_thread_enter";
- const StringName _thread_exit_call_name = "godot_nativescript_thread_exit";
+ const StringName _thread_enter_call_name = "nativescript_thread_enter";
+ const StringName _thread_exit_call_name = "nativescript_thread_exit";
#endif
NativeScriptLanguage();
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 19a62b9c4..29b0a6719 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -48,7 +48,7 @@
#include "gd_native_library_editor.h"
// Class used to discover singleton gdnative files
-void actual_discoverer_handler();
+static void actual_discoverer_handler();
class GDNativeSingletonDiscover : public Object {
// GDCLASS(GDNativeSingletonDiscover, Object)
@@ -66,7 +66,7 @@ class GDNativeSingletonDiscover : public Object {
}
};
-Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
+static Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
Set<String> file_paths;
@@ -81,7 +81,7 @@ Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
}
Ref<GDNativeLibrary> lib = ResourceLoader::load(p_dir->get_file_path(i));
- if (lib.is_valid() && lib->is_singleton_gdnative()) {
+ if (lib.is_valid() && lib->is_singleton()) {
file_paths.insert(p_dir->get_file_path(i));
}
}
@@ -98,7 +98,7 @@ Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
return file_paths;
}
-void actual_discoverer_handler() {
+static void actual_discoverer_handler() {
EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
Set<String> file_paths = get_gdnative_singletons(dir);
@@ -115,7 +115,125 @@ void actual_discoverer_handler() {
ProjectSettings::get_singleton()->save();
}
-GDNativeSingletonDiscover *discoverer = NULL;
+static GDNativeSingletonDiscover *discoverer = NULL;
+
+class GDNativeExportPlugin : public EditorExportPlugin {
+
+protected:
+ virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features);
+};
+
+void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_type, const Set<String> &p_features) {
+ if (p_type != "GDNativeLibrary") {
+ return;
+ }
+
+ Ref<GDNativeLibrary> lib = ResourceLoader::load(p_path);
+
+ if (lib.is_null()) {
+ return;
+ }
+
+ Ref<ConfigFile> config = lib->get_config_file();
+
+ String entry_lib_path;
+ {
+
+ List<String> entry_keys;
+ config->get_section_keys("entry", &entry_keys);
+
+ for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) {
+ String key = E->get();
+
+ Vector<String> tags = key.split(".");
+
+ bool skip = false;
+ for (int i = 0; i < tags.size(); i++) {
+ bool has_feature = p_features.has(tags[i]);
+
+ if (!has_feature) {
+ skip = true;
+ break;
+ }
+ }
+
+ if (skip) {
+ continue;
+ }
+
+ entry_lib_path = config->get_value("entry", key);
+ break;
+ }
+ }
+
+ Vector<String> dependency_paths;
+ {
+
+ List<String> dependency_keys;
+ config->get_section_keys("dependencies", &dependency_keys);
+
+ for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) {
+ String key = E->get();
+
+ Vector<String> tags = key.split(".");
+
+ bool skip = false;
+ for (int i = 0; i < tags.size(); i++) {
+ bool has_feature = p_features.has(tags[i]);
+
+ if (!has_feature) {
+ skip = true;
+ break;
+ }
+ }
+
+ if (skip) {
+ continue;
+ }
+
+ dependency_paths = config->get_value("dependencies", key);
+ break;
+ }
+ }
+
+ bool is_statically_linked = false;
+ {
+
+ List<String> static_linking_keys;
+ config->get_section_keys("static_linking", &static_linking_keys);
+
+ for (List<String>::Element *E = static_linking_keys.front(); E; E = E->next()) {
+ String key = E->get();
+
+ Vector<String> tags = key.split(".");
+
+ bool skip = false;
+
+ for (int i = 0; i < tags.size(); i++) {
+ bool has_feature = p_features.has(tags[i]);
+
+ if (!has_feature) {
+ skip = true;
+ break;
+ }
+ }
+
+ if (skip) {
+ continue;
+ }
+
+ is_statically_linked = config->get_value("static_linking", key);
+ break;
+ }
+ }
+
+ if (!is_statically_linked)
+ add_shared_object(entry_lib_path);
+
+ for (int i = 0; i < dependency_paths.size(); i++) {
+ add_shared_object(dependency_paths[i]);
+ }
+}
static void editor_init_callback() {
@@ -125,11 +243,16 @@ static void editor_init_callback() {
discoverer = memnew(GDNativeSingletonDiscover);
EditorFileSystem::get_singleton()->connect("filesystem_changed", discoverer, "get_class");
+
+ Ref<GDNativeExportPlugin> export_plugin;
+ export_plugin.instance();
+
+ EditorExport::get_singleton()->add_export_plugin(export_plugin);
}
#endif
-godot_variant cb_standard_varcall(void *p_procedure_handle, godot_array *p_args) {
+static godot_variant cb_standard_varcall(void *p_procedure_handle, godot_array *p_args) {
godot_gdnative_procedure_fn proc;
proc = (godot_gdnative_procedure_fn)p_procedure_handle;
@@ -141,6 +264,9 @@ GDNativeCallRegistry *GDNativeCallRegistry::singleton;
Vector<Ref<GDNative> > singleton_gdnatives;
+GDNativeLibraryResourceLoader *resource_loader_gdnlib = NULL;
+GDNativeLibraryResourceSaver *resource_saver_gdnlib = NULL;
+
void register_gdnative_types() {
#ifdef TOOLS_ENABLED
@@ -153,6 +279,12 @@ void register_gdnative_types() {
ClassDB::register_class<GDNativeLibrary>();
ClassDB::register_class<GDNative>();
+ resource_loader_gdnlib = memnew(GDNativeLibraryResourceLoader);
+ resource_saver_gdnlib = memnew(GDNativeLibraryResourceSaver);
+
+ ResourceLoader::add_resource_format_loader(resource_loader_gdnlib);
+ ResourceSaver::add_resource_format_saver(resource_saver_gdnlib);
+
GDNativeCallRegistry::singleton = memnew(GDNativeCallRegistry);
GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall);
@@ -185,11 +317,11 @@ void register_gdnative_types() {
void *proc_ptr;
Error err = singleton_gdnatives[i]->get_symbol(
- "godot_gdnative_singleton",
+ lib->get_symbol_prefix() + "gdnative_singleton",
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());
+ ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton_gdnatives[i]->get_library()->get_current_library_path()) + "\" found").utf8().get_data());
} else {
((void (*)())proc_ptr)();
}
@@ -224,6 +356,9 @@ void unregister_gdnative_types() {
}
#endif
+ memdelete(resource_loader_gdnlib);
+ memdelete(resource_saver_gdnlib);
+
// This is for printing out the sizes of the core types
/*
diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py
index 5698a3729..6e8994d64 100644
--- a/modules/gdscript/config.py
+++ b/modules/gdscript/config.py
@@ -1,8 +1,15 @@
-
-
def can_build(platform):
return True
-
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "GDFunctionState",
+ "GDNativeClass",
+ "GDScript",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/gdscript/doc_classes/GDFunctionState.xml b/modules/gdscript/doc_classes/GDFunctionState.xml
new file mode 100644
index 000000000..e1aafa8a5
--- /dev/null
+++ b/modules/gdscript/doc_classes/GDFunctionState.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="GDFunctionState" inherits="Reference" category="Core" version="3.0-alpha">
+ <brief_description>
+ State of a function call after yielding.
+ </brief_description>
+ <description>
+ 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.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="is_valid" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="extended_check" type="bool" default="false">
+ </argument>
+ <description>
+ Check whether the function call may be resumed. This is not the case if the function state was already resumed.
+ If [code]extended_check[/code] is enabled, it also checks if the associated script and object still exist. The extended check is done in debug mode as part of [method GDFunctionState.resume], but you can use this if you know you may be trying to resume without knowing for sure the object and/or script have survived up to that point.
+ </description>
+ </method>
+ <method name="resume">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="arg" type="Variant" default="null">
+ </argument>
+ <description>
+ 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.
+ </description>
+ </method>
+ </methods>
+ <signals>
+ <signal name="completed">
+ <argument index="0" name="result" type="Nil">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/gdscript/doc_classes/GDNativeClass.xml b/modules/gdscript/doc_classes/GDNativeClass.xml
new file mode 100644
index 000000000..95789e1b6
--- /dev/null
+++ b/modules/gdscript/doc_classes/GDNativeClass.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="GDNativeClass" inherits="Reference" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="new">
+ <return type="Variant">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/gdscript/doc_classes/GDScript.xml b/modules/gdscript/doc_classes/GDScript.xml
new file mode 100644
index 000000000..13d45aa52
--- /dev/null
+++ b/modules/gdscript/doc_classes/GDScript.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="GDScript" inherits="Script" category="Core" version="3.0-alpha">
+ <brief_description>
+ A script implemented in the GDScript programming language.
+ </brief_description>
+ <description>
+ A script implemented in the GDScript programming language. The script exends the functionality of all objects that instance it.
+ [method new] creates a new instance of the script. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_as_byte_code" qualifiers="const">
+ <return type="PoolByteArray">
+ </return>
+ <description>
+ Returns byte code for the script source code.
+ </description>
+ </method>
+ <method name="new" qualifiers="vararg">
+ <return type="Object">
+ </return>
+ <description>
+ Returns a new instance of the script.
+ For example:
+ [codeblock]
+ var MyClass = load("myclass.gd")
+ var instance = MyClass.new()
+ assert(instance.get_script() == MyClass)
+ [/codeblock]
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index de8e35c40..9b7201f5f 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -337,6 +337,11 @@ void GDScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_cons
pi.second = Math_PI;
p_constants->push_back(pi);
+ Pair<String, Variant> tau;
+ tau.first = "TAU";
+ tau.second = Math_TAU;
+ p_constants->push_back(tau);
+
Pair<String, Variant> infinity;
infinity.first = "INF";
infinity.second = Math_INF;
@@ -360,7 +365,7 @@ String GDScriptLanguage::make_function(const String &p_class, const String &p_na
}
s += " ";
}
- s += "):\n\tpass # replace with function body\n";
+ s += "):\n" + _get_indentation() + "pass # replace with function body\n";
return s;
}
@@ -2771,31 +2776,31 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
}
//global
- for (Map<StringName, int>::Element *E = GDScriptLanguage::get_singleton()->get_global_map().front(); E; E = E->next()) {
- if (E->key() == p_symbol) {
-
- Variant value = GDScriptLanguage::get_singleton()->get_global_array()[E->get()];
- if (value.get_type() == Variant::OBJECT) {
- Object *obj = value;
- if (obj) {
-
- if (Object::cast_to<GDNativeClass>(obj)) {
- r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
- r_result.class_name = Object::cast_to<GDNativeClass>(obj)->get_name();
-
- } else {
- r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
- r_result.class_name = obj->get_class();
- }
- return OK;
+ Map<StringName, int> classes = GDScriptLanguage::get_singleton()->get_global_map();
+ if (classes.has(p_symbol)) {
+ Variant value = GDScriptLanguage::get_singleton()->get_global_array()[classes[p_symbol]];
+ if (value.get_type() == Variant::OBJECT) {
+ Object *obj = value;
+ if (obj) {
+ if (Object::cast_to<GDNativeClass>(obj)) {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
+ r_result.class_name = Object::cast_to<GDNativeClass>(obj)->get_name();
+ } else {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
+ r_result.class_name = obj->get_class();
}
- } else {
- r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
- r_result.class_name = "@Global Scope";
- r_result.class_member = p_symbol;
+ // proxy class remove the underscore.
+ if (r_result.class_name.begins_with("_")) {
+ r_result.class_name = r_result.class_name.right(1);
+ }
return OK;
}
+ } else {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
+ r_result.class_name = "@GlobalScope";
+ r_result.class_member = p_symbol;
+ return OK;
}
}
}
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 94385dc0d..d7e83c3a3 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -362,6 +362,13 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool
constant->value = Math_PI;
tokenizer->advance();
expr = constant;
+ } else if (tokenizer->get_token() == GDTokenizer::TK_CONST_TAU) {
+
+ //constant defined by tokenizer
+ ConstantNode *constant = alloc_node<ConstantNode>();
+ constant->value = Math_TAU;
+ tokenizer->advance();
+ expr = constant;
} else if (tokenizer->get_token() == GDTokenizer::TK_CONST_INF) {
//constant defined by tokenizer
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 3f3818ffb..e5d834c9e 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "gd_script.h"
+#include "engine.h"
#include "gd_compiler.h"
#include "global_constants.h"
#include "io/file_access_encrypted.h"
@@ -1324,6 +1325,7 @@ void GDScriptLanguage::init() {
}
_add_global(StaticCString::create("PI"), Math_PI);
+ _add_global(StaticCString::create("TAU"), Math_TAU);
_add_global(StaticCString::create("INF"), Math_INF);
_add_global(StaticCString::create("NAN"), Math_NAN);
@@ -1346,9 +1348,9 @@ void GDScriptLanguage::init() {
//populate singletons
- List<ProjectSettings::Singleton> singletons;
- ProjectSettings::get_singleton()->get_singletons(&singletons);
- for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
+ List<Engine::Singleton> singletons;
+ Engine::get_singleton()->get_singletons(&singletons);
+ for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
_add_global(E->get().name, E->get().ptr);
}
@@ -1597,17 +1599,18 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so
Object *obj = E->get()->placeholders.front()->get()->get_owner();
//save instance info
- List<Pair<StringName, Variant> > state;
if (obj->get_script_instance()) {
+ map.insert(obj->get_instance_id(), List<Pair<StringName, Variant> >());
+ List<Pair<StringName, Variant> > &state = map[obj->get_instance_id()];
obj->get_script_instance()->get_property_state(state);
- map[obj->get_instance_id()] = state;
obj->set_script(RefPtr());
} else {
// no instance found. Let's remove it so we don't loop forever
E->get()->placeholders.erase(E->get()->placeholders.front()->get());
}
}
+
#endif
for (Map<ObjectID, List<Pair<StringName, Variant> > >::Element *F = E->get()->pending_reload_state.front(); F; F = F->next()) {
@@ -1700,6 +1703,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"bool",
"null",
"PI",
+ "TAU",
"INF",
"NAN",
"self",
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp
index 5f8515823..e241eacd4 100644
--- a/modules/gdscript/gd_tokenizer.cpp
+++ b/modules/gdscript/gd_tokenizer.cpp
@@ -123,6 +123,7 @@ const char *GDTokenizer::token_names[TK_MAX] = {
"'$'",
"'\\n'",
"PI",
+ "TAU",
"_",
"INF",
"NAN",
@@ -217,6 +218,7 @@ static const _kws _keyword_list[] = {
{ GDTokenizer::TK_CF_PASS, "pass" },
{ GDTokenizer::TK_SELF, "self" },
{ GDTokenizer::TK_CONST_PI, "PI" },
+ { GDTokenizer::TK_CONST_TAU, "TAU" },
{ GDTokenizer::TK_WILDCARD, "_" },
{ GDTokenizer::TK_CONST_INF, "INF" },
{ GDTokenizer::TK_CONST_NAN, "NAN" },
@@ -280,6 +282,7 @@ bool GDTokenizer::is_token_literal(int p_offset, bool variable_safe) const {
case TK_CF_PASS:
case TK_SELF:
case TK_CONST_PI:
+ case TK_CONST_TAU:
case TK_WILDCARD:
case TK_CONST_INF:
case TK_CONST_NAN:
@@ -882,6 +885,9 @@ void GDTokenizerText::_advance() {
return;
}
sign_found = true;
+ } else if (GETCHAR(i) == '_') {
+ i++;
+ continue; // Included for readability, shouldn't be a part of the string
} else
break;
@@ -894,7 +900,7 @@ void GDTokenizerText::_advance() {
return;
}
- INCPOS(str.length());
+ INCPOS(i);
if (hexa_found) {
int64_t val = str.hex_to_int64();
_make_constant(val);
diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h
index c935ce45a..f4b579def 100644
--- a/modules/gdscript/gd_tokenizer.h
+++ b/modules/gdscript/gd_tokenizer.h
@@ -128,6 +128,7 @@ public:
TK_DOLLAR,
TK_NEWLINE,
TK_CONST_PI,
+ TK_CONST_TAU,
TK_WILDCARD,
TK_CONST_INF,
TK_CONST_NAN,
diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py
index b3dbb9f46..a93f4edb8 100644
--- a/modules/gridmap/config.py
+++ b/modules/gridmap/config.py
@@ -1,14 +1,13 @@
-
-
def can_build(platform):
return True
-
def configure(env):
pass
def get_doc_classes():
- return ["GridMap"]
+ return [
+ "GridMap",
+ ]
def get_doc_path():
- return "doc_classes"
+ return "doc_classes"
diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml
index 5b0fe56f2..ee8ecfff6 100644
--- a/modules/gridmap/doc_classes/GridMap.xml
+++ b/modules/gridmap/doc_classes/GridMap.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GridMap" inherits="Spatial" category="Core" version="3.0.alpha.custom_build">
+<class name="GridMap" inherits="Spatial" category="Core" version="3.0-alpha">
<brief_description>
Node for 3D tile-based maps.
</brief_description>
diff --git a/modules/hdr/config.py b/modules/hdr/config.py
index fb920482f..5f133eba9 100644
--- a/modules/hdr/config.py
+++ b/modules/hdr/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/jpg/config.py b/modules/jpg/config.py
index fb920482f..5f133eba9 100644
--- a/modules/jpg/config.py
+++ b/modules/jpg/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/mobile_vr/config.py b/modules/mobile_vr/config.py
index cf96c6612..4e1155f0c 100644
--- a/modules/mobile_vr/config.py
+++ b/modules/mobile_vr/config.py
@@ -1,12 +1,14 @@
def can_build(platform):
- # should probably change this to only be true on iOS and Android
- return True
+ # should probably change this to only be true on iOS and Android
+ return True
def configure(env):
- pass
+ pass
def get_doc_classes():
- return ["MobileVRInterface"]
+ return [
+ "MobileVRInterface",
+ ]
def get_doc_path():
- return "doc_classes"
+ return "doc_classes"
diff --git a/modules/mobile_vr/doc_classes/MobileVRInterface.xml b/modules/mobile_vr/doc_classes/MobileVRInterface.xml
index c945a99a9..c99934aea 100644
--- a/modules/mobile_vr/doc_classes/MobileVRInterface.xml
+++ b/modules/mobile_vr/doc_classes/MobileVRInterface.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.0.alpha.custom_build">
+<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.0-alpha">
<brief_description>
Generic mobile VR implementation
</brief_description>
diff --git a/modules/mobile_vr/mobile_interface.cpp b/modules/mobile_vr/mobile_interface.cpp
index 93d5c22ef..3a0b83d53 100644
--- a/modules/mobile_vr/mobile_interface.cpp
+++ b/modules/mobile_vr/mobile_interface.cpp
@@ -156,17 +156,6 @@ void MobileVRInterface::set_position_from_sensors() {
has_gyro = true;
};
-#ifdef ANDROID_ENABLED
- ///@TODO needs testing, i don't have a gyro, potentially can be removed depending on what comes out of issue #8101
- // On Android x and z axis seem inverted
- gyro.x = -gyro.x;
- gyro.z = -gyro.z;
- grav.x = -grav.x;
- grav.z = -grav.z;
- magneto.x = -magneto.x;
- magneto.z = -magneto.z;
-#endif
-
if (has_gyro) {
// start with applying our gyro (do NOT smooth our gyro!)
Basis rotate;
@@ -334,7 +323,7 @@ void MobileVRInterface::uninitialize() {
};
};
-Size2 MobileVRInterface::get_recommended_render_targetsize() {
+Size2 MobileVRInterface::get_render_targetsize() {
_THREAD_SAFE_METHOD_
// we use half our window size
diff --git a/modules/mobile_vr/mobile_interface.h b/modules/mobile_vr/mobile_interface.h
index 747377ae4..b652edc1c 100644
--- a/modules/mobile_vr/mobile_interface.h
+++ b/modules/mobile_vr/mobile_interface.h
@@ -137,7 +137,7 @@ public:
virtual bool initialize();
virtual void uninitialize();
- virtual Size2 get_recommended_render_targetsize();
+ virtual Size2 get_render_targetsize();
virtual bool is_stereo();
virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform);
virtual CameraMatrix get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far);
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 7ad135e0b..b4e643325 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -177,7 +177,11 @@ def configure(env):
def get_doc_classes():
- return ["@C#", "CSharpScript", "GodotSharp"]
+ return [
+ "@C#",
+ "CSharpScript",
+ "GodotSharp",
+ ]
def get_doc_path():
diff --git a/modules/mono/doc_classes/@C#.xml b/modules/mono/doc_classes/@C#.xml
index 487ba9835..5d27b3220 100644
--- a/modules/mono/doc_classes/@C#.xml
+++ b/modules/mono/doc_classes/@C#.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="@C#" category="Core" version="3.0.alpha.custom_build">
+<class name="@C#" category="Core" version="3.0-alpha">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/doc_classes/CSharpScript.xml b/modules/mono/doc_classes/CSharpScript.xml
index 5f21c9774..ccc24b832 100644
--- a/modules/mono/doc_classes/CSharpScript.xml
+++ b/modules/mono/doc_classes/CSharpScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSharpScript" inherits="Script" category="Core" version="3.0.alpha.custom_build">
+<class name="CSharpScript" inherits="Script" category="Core" version="3.0-alpha">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/doc_classes/GodotSharp.xml b/modules/mono/doc_classes/GodotSharp.xml
index e7e06ddd8..9edbd18fc 100644
--- a/modules/mono/doc_classes/GodotSharp.xml
+++ b/modules/mono/doc_classes/GodotSharp.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GodotSharp" inherits="Object" category="Core" version="3.0.alpha.custom_build">
+<class name="GodotSharp" inherits="Object" category="Core" version="3.0-alpha">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index eb504ec02..a293cc2c5 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -31,12 +31,12 @@
#ifdef DEBUG_METHODS_ENABLED
+#include "engine.h"
#include "global_constants.h"
#include "io/compression.h"
#include "os/dir_access.h"
#include "os/file_access.h"
#include "os/os.h"
-#include "project_settings.h"
#include "ucaps.h"
#include "../glue/cs_compressed.gen.h"
@@ -320,9 +320,9 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
int global_constants_count = GlobalConstants::get_global_constant_count();
if (global_constants_count > 0) {
- Map<String, DocData::ClassDoc>::Element *match = EditorHelp::get_doc_data()->class_list.find("@Global Scope");
+ Map<String, DocData::ClassDoc>::Element *match = EditorHelp::get_doc_data()->class_list.find("@GlobalScope");
- ERR_EXPLAIN("Could not find `@Global Scope` in DocData");
+ ERR_EXPLAIN("Could not find `@GlobalScope` in DocData");
ERR_FAIL_COND_V(!match, ERR_BUG);
const DocData::ClassDoc &global_scope_doc = match->value();
@@ -1169,7 +1169,7 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
output.push_back("Object* ");
output.push_back(singleton_icall_name);
- output.push_back("() " OPEN_BLOCK "\treturn ProjectSettings::get_singleton()->get_singleton_object(\"");
+ output.push_back("() " OPEN_BLOCK "\treturn Engine::get_singleton()->get_singleton_object(\"");
output.push_back(itype.proxy_name);
output.push_back("\");\n" CLOSE_BLOCK "\n");
}
@@ -1505,7 +1505,7 @@ void BindingsGenerator::_populate_object_type_interfaces() {
TypeInterface itype = TypeInterface::create_object_type(type_cname, api_type);
itype.base_name = ClassDB::get_parent_class(type_cname);
- itype.is_singleton = ProjectSettings::get_singleton()->has_singleton(itype.proxy_name);
+ itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name);
itype.is_instantiable = ClassDB::can_instance(type_cname) && !itype.is_singleton;
itype.is_reference = ClassDB::is_parent_class(type_cname, refclass_name);
itype.memory_own = itype.is_reference;
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h
index 0751a0160..75a4eb2b4 100644
--- a/modules/mono/glue/glue_header.h
+++ b/modules/mono/glue/glue_header.h
@@ -35,10 +35,10 @@
#include "bind/core_bind.h"
#include "class_db.h"
+#include "engine.h"
#include "io/marshalls.h"
#include "object.h"
#include "os/os.h"
-#include "project_settings.h"
#include "reference.h"
#include "variant_parser.h"
diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp
index 2656de5b1..217460a43 100644
--- a/modules/mono/register_types.cpp
+++ b/modules/mono/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "project_settings.h"
+#include "engine.h"
#include "csharp_script.h"
@@ -45,7 +45,7 @@ void register_mono_types() {
_godotsharp = memnew(_GodotSharp);
ClassDB::register_class<_GodotSharp>();
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("GodotSharp", _GodotSharp::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("GodotSharp", _GodotSharp::get_singleton()));
script_language_cs = memnew(CSharpLanguage);
script_language_cs->set_language_index(ScriptServer::get_language_count());
diff --git a/modules/ogg/config.py b/modules/ogg/config.py
index ef5daca05..5f133eba9 100644
--- a/modules/ogg/config.py
+++ b/modules/ogg/config.py
@@ -1,8 +1,5 @@
-
def can_build(platform):
-# return True
- return False
-
+ return True
def configure(env):
pass
diff --git a/modules/openssl/config.py b/modules/openssl/config.py
index fb920482f..5f133eba9 100644
--- a/modules/openssl/config.py
+++ b/modules/openssl/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index fee06bd26..6f643ef08 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -3,6 +3,9 @@
Import('env')
Import('env_modules')
+
+stub = True
+
env_opus = env_modules.Clone()
# Thirdparty source files
@@ -212,5 +215,9 @@ if env['builtin_opus']:
if env['builtin_libogg']:
env_opus.Append(CPPPATH=["#thirdparty/libogg"])
-# Module files
-env_opus.add_source_files(env.modules_sources, "*.cpp")
+if not stub:
+ # Module files
+ env_opus.add_source_files(env.modules_sources, "*.cpp")
+else:
+ # Module files
+ env_opus.add_source_files(env.modules_sources, "stub/register_types.cpp")
diff --git a/modules/opus/config.py b/modules/opus/config.py
index ef5daca05..60f8d838d 100644
--- a/modules/opus/config.py
+++ b/modules/opus/config.py
@@ -1,8 +1,13 @@
-
def can_build(platform):
-# return True
- return False
-
+ return True
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "AudioStreamOpus",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/opus/stub/register_types.cpp b/modules/opus/stub/register_types.cpp
new file mode 100644
index 000000000..c5ae3e274
--- /dev/null
+++ b/modules/opus/stub/register_types.cpp
@@ -0,0 +1,36 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+// Dummy module as libvorbis is needed by other modules (theora ...)
+
+void register_opus_types() {}
+
+void unregister_opus_types() {}
diff --git a/modules/opus/stub/register_types.h b/modules/opus/stub/register_types.h
new file mode 100644
index 000000000..4517dc5df
--- /dev/null
+++ b/modules/opus/stub/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_opus_types();
+void unregister_opus_types();
diff --git a/modules/pbm/config.py b/modules/pbm/config.py
index fb920482f..5f133eba9 100644
--- a/modules/pbm/config.py
+++ b/modules/pbm/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/pvr/config.py b/modules/pvr/config.py
index fb920482f..5f133eba9 100644
--- a/modules/pvr/config.py
+++ b/modules/pvr/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/recast/config.py b/modules/recast/config.py
index d42f07b2a..fc074cf66 100644
--- a/modules/recast/config.py
+++ b/modules/recast/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return platform != "android"
-
def configure(env):
pass
diff --git a/modules/regex/config.py b/modules/regex/config.py
index 5347cfd24..cb2da2673 100644
--- a/modules/regex/config.py
+++ b/modules/regex/config.py
@@ -1,9 +1,14 @@
-#!/usr/bin/env python
-
-
def can_build(platform):
return True
-
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "RegEx",
+ "RegExMatch",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml
new file mode 100644
index 000000000..4cf272fe8
--- /dev/null
+++ b/modules/regex/doc_classes/RegEx.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="RegEx" inherits="Reference" category="Core" version="3.0-alpha">
+ <brief_description>
+ Class for searching text for patterns using regular expressions.
+ </brief_description>
+ <description>
+ Regular Expression (or regex) is a compact programming language that can be used to recognise strings that follow a specific pattern, such as URLs, email addresses, complete sentences, etc. For instance, a regex of [code]ab[0-9][/code] would find any string that is [code]ab[/code] followed by any number from [code]0[/code] to [code]9[/code]. For a more in-depth look, you can easily find various tutorials and detailed explainations on the Internet.
+ To begin, the RegEx object needs to be compiled with the search pattern using [method compile] before it can be used.
+ [codeblock]
+ var regex = RegEx.new()
+ regex.compile("\\w-(\\d+)")
+ [/codeblock]
+ The search pattern must be escaped first for gdscript before it is escaped for the expression. For example, [code]compile("\\d+")[/code] would be read by RegEx as [code]\d+[/code]. Similarly, [code]compile("\"(?:\\\\.|[^\"])*\"")[/code] would be read as [code]"(?:\\.|[^"])*"[/code]
+ Using [method search] you can find the pattern within the given text. If a pattern is found, [RegExMatch] is returned and you can retrieve details of the results using fuctions such as [method RegExMatch.get_string] and [method RegExMatch.get_start].
+ [codeblock]
+ var regex = RegEx.new()
+ regex.compile("\\w-(\\d+)")
+ var result = regex.search("abc n-0123")
+ if result:
+ print(result.get_string()) # Would print n-0123
+ [/codeblock]
+ The results of capturing groups [code]()[/code] can be retrieved by passing the group number to the various functions in [RegExMatch]. Group 0 is the default and would always refer to the entire pattern. In the above example, calling [code]result.get_string(1)[/code] would give you [code]0123[/code].
+ This version of RegEx also supports named capturing groups, and the names can be used to retrieve the results. If two or more groups have the same name, the name would only refer to the first one with a match.
+ [codeblock]
+ var regex = RegEx.new()
+ regex.compile("d(?&lt;digit&gt;[0-9]+)|x(?&lt;digit&gt;[0-9a-f]+)")
+ var result = regex.search("the number is x2f")
+ if result:
+ print(result.get_string("digit")) # Would print 2f
+ [/codeblock]
+ If you need to process multiple results, [method search_all] generates a list of all non-overlapping results. This can be combined with a for-loop for convenience.
+ [codeblock]
+ for result in regex.search_all("d01, d03, d0c, x3f and x42"):
+ print(result.get_string("digit"))
+ # Would print 01 03 3f 42
+ # Note that d0c would not match
+ [/codeblock]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="clear">
+ <return type="void">
+ </return>
+ <description>
+ This method resets the state of the object, as it was freshly created. Namely, it unassigns the regular expression of this object.
+ </description>
+ </method>
+ <method name="compile">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="pattern" type="String">
+ </argument>
+ <description>
+ Compiles and assign the search pattern to use. Returns OK if the compilation is successful. If an error is encountered the details are printed to STDOUT and FAILED is returned.
+ </description>
+ </method>
+ <method name="get_group_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the number of capturing groups in compiled pattern.
+ </description>
+ </method>
+ <method name="get_names" qualifiers="const">
+ <return type="Array">
+ </return>
+ <description>
+ Returns an array of names of named capturing groups in the compiled pattern. They are ordered by appearance.
+ </description>
+ </method>
+ <method name="get_pattern" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns the original search pattern that was compiled.
+ </description>
+ </method>
+ <method name="is_valid" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns whether this object has a valid search pattern assigned.
+ </description>
+ </method>
+ <method name="search" qualifiers="const">
+ <return type="RegExMatch">
+ </return>
+ <argument index="0" name="subject" type="String">
+ </argument>
+ <argument index="1" name="offset" type="int" default="0">
+ </argument>
+ <argument index="2" name="end" type="int" default="-1">
+ </argument>
+ <description>
+ Searches the text for the compiled pattern. Returns a [RegExMatch] container of the first matching result if found, otherwise null. The region to search within can be specified without modifying where the start and end anchor would be.
+ </description>
+ </method>
+ <method name="search_all" qualifiers="const">
+ <return type="Array">
+ </return>
+ <argument index="0" name="subject" type="String">
+ </argument>
+ <argument index="1" name="offset" type="int" default="0">
+ </argument>
+ <argument index="2" name="end" type="int" default="-1">
+ </argument>
+ <description>
+ Searches the text for the compiled pattern. Returns an array of [RegExMatch] containers for each non-overlapping result. If no results were found an empty array is returned instead. The region to search within can be specified without modifying where the start and end anchor would be.
+ </description>
+ </method>
+ <method name="sub" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="subject" type="String">
+ </argument>
+ <argument index="1" name="replacement" type="String">
+ </argument>
+ <argument index="2" name="all" type="bool" default="false">
+ </argument>
+ <argument index="3" name="offset" type="int" default="0">
+ </argument>
+ <argument index="4" name="end" type="int" default="-1">
+ </argument>
+ <description>
+ Searches the text for the compiled pattern and replaces it with the specified string. Escapes and backreferences such as [code]\1[/code] and [code]\g&lt;name&gt;[/code] expanded and resolved. By default only the first instance is replaced but it can be changed for all instances (global replacement). The region to search within can be specified without modifying where the start and end anchor would be.
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml
new file mode 100644
index 000000000..354febf89
--- /dev/null
+++ b/modules/regex/doc_classes/RegExMatch.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="RegExMatch" inherits="Reference" category="Core" version="3.0-alpha">
+ <brief_description>
+ Contains the results of a regex search.
+ </brief_description>
+ <description>
+ Contains the results of a single regex match returned by [method RegEx.search] and [method.RegEx.search_all]. It can be used to find the position and range of the match and its capturing groups, and it can extract its sub-string for you.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_end" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="name" type="Variant" default="0">
+ </argument>
+ <description>
+ Returns the end position of the match within the source string. The end position of capturing groups can be retrieved by providing its group number as an integer or its string name (if it's a named group). The default value of 0 refers to the whole pattern.
+ Returns -1 if the group did not match or doesn't exist.
+ </description>
+ </method>
+ <method name="get_group_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the number of capturing groups.
+ </description>
+ </method>
+ <method name="get_names" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <description>
+ Returns a dictionary of named groups and its corresponding group number. Only groups with that were matched are included. If multiple groups have the same name, that name would refer to the first matching one.
+ </description>
+ </method>
+ <method name="get_start" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="name" type="Variant" default="0">
+ </argument>
+ <description>
+ Returns the starting position of the match within the source string. The starting position of capturing groups can be retrieved by providing its group number as an integer or its string name (if it's a named group). The default value of 0 refers to the whole pattern.
+ Returns -1 if the group did not match or doesn't exist.
+ </description>
+ </method>
+ <method name="get_string" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="name" type="Variant" default="0">
+ </argument>
+ <description>
+ Returns the substring of the match from the source string. Capturing groups can be retrieved by providing its group number as an integer or its string name (if it's a named group). The default value of 0 refers to the whole pattern.
+ Returns an empty string if the group did not match or doesn't exist.
+ </description>
+ </method>
+ <method name="get_strings" qualifiers="const">
+ <return type="Array">
+ </return>
+ <description>
+ Returns an [Array] of the match and its capturing groups.
+ </description>
+ </method>
+ <method name="get_subject" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns the source string used with the search pattern to find this matching result.
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp
index 00e8ce0f5..daadfcc65 100644
--- a/modules/regex/regex.cpp
+++ b/modules/regex/regex.cpp
@@ -324,6 +324,21 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)
return result;
}
+Array RegEx::search_all(const String &p_subject, int p_offset, int p_end) const {
+
+ int last_end = -1;
+ Array result;
+ Ref<RegExMatch> match = search(p_subject, p_offset, p_end);
+ while (match.is_valid()) {
+ if (last_end == match->get_end(0))
+ break;
+ result.push_back(match);
+ last_end = match->get_end(0);
+ match = search(p_subject, match->get_end(0), p_end);
+ }
+ return result;
+}
+
String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_all, int p_offset, int p_end) const {
ERR_FAIL_COND_V(!is_valid(), String());
@@ -489,6 +504,7 @@ void RegEx::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear"), &RegEx::clear);
ClassDB::bind_method(D_METHOD("compile", "pattern"), &RegEx::compile);
ClassDB::bind_method(D_METHOD("search", "subject", "offset", "end"), &RegEx::search, DEFVAL(0), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("search_all", "subject", "offset", "end"), &RegEx::search_all, DEFVAL(0), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("sub", "subject", "replacement", "all", "offset", "end"), &RegEx::sub, DEFVAL(false), DEFVAL(0), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("is_valid"), &RegEx::is_valid);
ClassDB::bind_method(D_METHOD("get_pattern"), &RegEx::get_pattern);
diff --git a/modules/regex/regex.h b/modules/regex/regex.h
index bfa9c8404..21387222f 100644
--- a/modules/regex/regex.h
+++ b/modules/regex/regex.h
@@ -88,6 +88,7 @@ public:
void _init(const String &p_pattern = "");
Ref<RegExMatch> search(const String &p_subject, int p_offset = 0, int p_end = -1) const;
+ Array search_all(const String &p_subject, int p_offset = 0, int p_end = -1) const;
String sub(const String &p_subject, const String &p_replacement, bool p_all = false, int p_offset = 0, int p_end = -1) const;
bool is_valid() const;
diff --git a/modules/squish/config.py b/modules/squish/config.py
index 9b7729bda..97c95999c 100644
--- a/modules/squish/config.py
+++ b/modules/squish/config.py
@@ -1,8 +1,6 @@
-
def can_build(platform):
return True
-
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
diff --git a/modules/stb_vorbis/config.py b/modules/stb_vorbis/config.py
index fb920482f..defe8d0c9 100644
--- a/modules/stb_vorbis/config.py
+++ b/modules/stb_vorbis/config.py
@@ -1,7 +1,14 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "AudioStreamOGGVorbis",
+ "ResourceImporterOGGVorbis",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
new file mode 100644
index 000000000..ee6c28c36
--- /dev/null
+++ b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="AudioStreamOGGVorbis" inherits="AudioStream" category="Core" version="3.0-alpha">
+ <brief_description>
+ OGG Vorbis audio stream driver.
+ </brief_description>
+ <description>
+ OGG Vorbis audio stream driver.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_data" qualifiers="const">
+ <return type="PoolByteArray">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_loop_offset" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="has_loop" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_data">
+ <return type="void">
+ </return>
+ <argument index="0" name="data" type="PoolByteArray">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_loop">
+ <return type="void">
+ </return>
+ <argument index="0" name="enable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_loop_offset">
+ <return type="void">
+ </return>
+ <argument index="0" name="seconds" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="data" type="PoolByteArray" setter="set_data" getter="get_data">
+ Raw audio data.
+ </member>
+ <member name="loop" type="bool" setter="set_loop" getter="has_loop">
+ If [code]true[/code], audio will loop continuously. Default value: [code]false[/code].
+ </member>
+ <member name="loop_offset" type="float" setter="set_loop_offset" getter="get_loop_offset">
+ If loop is [code]true[/code], loop starts from this position, in seconds.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
new file mode 100644
index 000000000..ce16632d6
--- /dev/null
+++ b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/svg/config.py b/modules/svg/config.py
index fb920482f..5f133eba9 100644
--- a/modules/svg/config.py
+++ b/modules/svg/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/tga/config.py b/modules/tga/config.py
index fb920482f..5f133eba9 100644
--- a/modules/tga/config.py
+++ b/modules/tga/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass
diff --git a/modules/theora/config.py b/modules/theora/config.py
index 8eefe8128..34d34f8be 100644
--- a/modules/theora/config.py
+++ b/modules/theora/config.py
@@ -1,8 +1,14 @@
-
def can_build(platform):
-# return True
- return False
-
+ return True
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "ResourceImporterTheora",
+ "VideoStreamTheora",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/theora/doc_classes/ResourceImporterTheora.xml b/modules/theora/doc_classes/ResourceImporterTheora.xml
new file mode 100644
index 000000000..497c93882
--- /dev/null
+++ b/modules/theora/doc_classes/ResourceImporterTheora.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="ResourceImporterTheora" inherits="ResourceImporter" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/theora/doc_classes/VideoStreamTheora.xml b/modules/theora/doc_classes/VideoStreamTheora.xml
new file mode 100644
index 000000000..8f155b786
--- /dev/null
+++ b/modules/theora/doc_classes/VideoStreamTheora.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VideoStreamTheora" inherits="VideoStream" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_file">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_file">
+ <return type="void">
+ </return>
+ <argument index="0" name="file" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="file" type="String" setter="set_file" getter="get_file">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp
index ae6961b3d..c51b87b8f 100644
--- a/modules/theora/register_types.cpp
+++ b/modules/theora/register_types.cpp
@@ -28,19 +28,18 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
-
+#include "resource_importer_theora.h"
#include "video_stream_theora.h"
-static ResourceFormatLoaderVideoStreamTheora *theora_stream_loader = NULL;
-
void register_theora_types() {
- theora_stream_loader = memnew(ResourceFormatLoaderVideoStreamTheora);
- ResourceLoader::add_resource_format_loader(theora_stream_loader);
+#ifdef TOOLS_ENABLED
+ Ref<ResourceImporterTheora> theora_import;
+ theora_import.instance();
+ ResourceFormatImporter::get_singleton()->add_importer(theora_import);
+#endif
ClassDB::register_class<VideoStreamTheora>();
}
void unregister_theora_types() {
-
- memdelete(theora_stream_loader);
}
diff --git a/modules/theora/resource_importer_theora.cpp b/modules/theora/resource_importer_theora.cpp
new file mode 100644
index 000000000..c25c0e742
--- /dev/null
+++ b/modules/theora/resource_importer_theora.cpp
@@ -0,0 +1,89 @@
+/*************************************************************************/
+/* resource_importer_theora.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "resource_importer_theora.h"
+
+#include "io/resource_saver.h"
+#include "os/file_access.h"
+#include "scene/resources/texture.h"
+
+String ResourceImporterTheora::get_importer_name() const {
+
+ return "Theora";
+}
+
+String ResourceImporterTheora::get_visible_name() const {
+
+ return "Theora";
+}
+void ResourceImporterTheora::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("ogv");
+ p_extensions->push_back("ogm");
+}
+
+String ResourceImporterTheora::get_save_extension() const {
+ return "ogvstr";
+}
+
+String ResourceImporterTheora::get_resource_type() const {
+
+ return "VideoStreamTheora";
+}
+
+bool ResourceImporterTheora::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
+
+ return true;
+}
+
+int ResourceImporterTheora::get_preset_count() const {
+ return 0;
+}
+String ResourceImporterTheora::get_preset_name(int p_idx) const {
+
+ return String();
+}
+
+void ResourceImporterTheora::get_import_options(List<ImportOption> *r_options, int p_preset) const {
+
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true));
+}
+
+Error ResourceImporterTheora::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) {
+
+ VideoStreamTheora *stream = memnew(VideoStreamTheora);
+ stream->set_file(p_source_file);
+
+ Ref<VideoStreamTheora> ogv_stream = Ref<VideoStreamTheora>(stream);
+
+ return ResourceSaver::save(p_save_path + ".ogvstr", ogv_stream);
+}
+
+ResourceImporterTheora::ResourceImporterTheora() {
+}
diff --git a/modules/theora/resource_importer_theora.h b/modules/theora/resource_importer_theora.h
new file mode 100644
index 000000000..8bf0ad38c
--- /dev/null
+++ b/modules/theora/resource_importer_theora.h
@@ -0,0 +1,57 @@
+/*************************************************************************/
+/* resource_importer_theora.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef RESOURCEIMPORTEROGGTHEORA_H
+#define RESOURCEIMPORTEROGGTHEORA_H
+
+#include "video_stream_theora.h"
+
+#include "core/io/resource_import.h"
+
+class ResourceImporterTheora : public ResourceImporter {
+ GDCLASS(ResourceImporterTheora, ResourceImporter)
+public:
+ virtual String get_importer_name() const;
+ virtual String get_visible_name() const;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual String get_save_extension() const;
+ virtual String get_resource_type() const;
+
+ virtual int get_preset_count() const;
+ virtual String get_preset_name(int p_idx) const;
+
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL);
+
+ ResourceImporterTheora();
+};
+
+#endif // RESOURCEIMPORTEROGGTHEORA_H
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index c75bec31d..bc8ca23d6 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -406,20 +406,19 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
ogg_packet op;
bool no_theora = false;
+ bool buffer_full = false;
- while (vorbis_p) {
+ while (vorbis_p && !audio_done && !buffer_full) {
int ret;
float **pcm;
- bool buffer_full = false;
-
/* if there's pending, decoded audio, grab it */
ret = vorbis_synthesis_pcmout(&vd, &pcm);
if (ret > 0) {
const int AUXBUF_LEN = 4096;
int to_read = ret;
- int16_t aux_buffer[AUXBUF_LEN];
+ float aux_buffer[AUXBUF_LEN];
while (to_read) {
@@ -429,11 +428,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
for (int j = 0; j < m; j++) {
for (int i = 0; i < vi.channels; i++) {
-
- int val = Math::fast_ftoi(pcm[i][j] * 32767.f);
- if (val > 32767) val = 32767;
- if (val < -32768) val = -32768;
- aux_buffer[count++] = val;
+ aux_buffer[count++] = pcm[i][j];
}
}
@@ -602,10 +597,9 @@ bool VideoStreamPlaybackTheora::is_playing() const {
void VideoStreamPlaybackTheora::set_paused(bool p_paused) {
paused = p_paused;
- //pau = !p_paused;
};
-bool VideoStreamPlaybackTheora::is_paused(bool p_paused) const {
+bool VideoStreamPlaybackTheora::is_paused() const {
return paused;
};
@@ -733,32 +727,10 @@ VideoStreamPlaybackTheora::~VideoStreamPlaybackTheora() {
memdelete(file);
};
-RES ResourceFormatLoaderVideoStreamTheora::load(const String &p_path, const String &p_original_path, Error *r_error) {
- if (r_error)
- *r_error = ERR_FILE_CANT_OPEN;
-
- VideoStreamTheora *stream = memnew(VideoStreamTheora);
- stream->set_file(p_path);
-
- if (r_error)
- *r_error = OK;
-
- return Ref<VideoStreamTheora>(stream);
-}
+void VideoStreamTheora::_bind_methods() {
-void ResourceFormatLoaderVideoStreamTheora::get_recognized_extensions(List<String> *p_extensions) const {
+ ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamTheora::set_file);
+ ClassDB::bind_method(D_METHOD("get_file"), &VideoStreamTheora::get_file);
- p_extensions->push_back("ogm");
- p_extensions->push_back("ogv");
-}
-bool ResourceFormatLoaderVideoStreamTheora::handles_type(const String &p_type) const {
- return (p_type == "VideoStream" || p_type == "VideoStreamTheora");
-}
-
-String ResourceFormatLoaderVideoStreamTheora::get_resource_type(const String &p_path) const {
-
- String exl = p_path.get_extension().to_lower();
- if (exl == "ogm" || exl == "ogv")
- return "VideoStreamTheora";
- return "";
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_file", "get_file");
}
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 484a1a7fb..ec0e5aa34 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -36,6 +36,7 @@
#include "os/thread.h"
#include "ring_buffer.h"
#include "scene/resources/video_stream.h"
+#include "servers/audio_server.h"
#include <theora/theoradec.h>
#include <vorbis/codec.h>
@@ -129,7 +130,7 @@ public:
virtual bool is_playing() const;
virtual void set_paused(bool p_paused);
- virtual bool is_paused(bool p_paused) const;
+ virtual bool is_paused() const;
virtual void set_loop(bool p_enable);
virtual bool has_loop() const;
@@ -161,10 +162,14 @@ public:
class VideoStreamTheora : public VideoStream {
GDCLASS(VideoStreamTheora, VideoStream);
+ RES_BASE_EXTENSION("ogvstr");
String file;
int audio_track;
+protected:
+ static void _bind_methods();
+
public:
Ref<VideoStreamPlayback> instance_playback() {
Ref<VideoStreamPlaybackTheora> pb = memnew(VideoStreamPlaybackTheora);
@@ -174,17 +179,10 @@ public:
}
void set_file(const String &p_file) { file = p_file; }
+ String get_file() { return file; }
void set_audio_track(int p_track) { audio_track = p_track; }
VideoStreamTheora() { audio_track = 0; }
};
-class ResourceFormatLoaderVideoStreamTheora : public ResourceFormatLoader {
-public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
-};
-
#endif
diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py
index 3e16fd725..e12bb398c 100644
--- a/modules/tinyexr/config.py
+++ b/modules/tinyexr/config.py
@@ -1,8 +1,6 @@
-
def can_build(platform):
return True
-
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py
index 5698a3729..6b1ce4101 100644
--- a/modules/visual_script/config.py
+++ b/modules/visual_script/config.py
@@ -1,8 +1,57 @@
-
-
def can_build(platform):
return True
-
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "VisualScriptBasicTypeConstant",
+ "VisualScriptBuiltinFunc",
+ "VisualScriptClassConstant",
+ "VisualScriptComment",
+ "VisualScriptCondition",
+ "VisualScriptConstant",
+ "VisualScriptConstructor",
+ "VisualScriptCustomNode",
+ "VisualScriptDeconstruct",
+ "VisualScriptEditor",
+ "VisualScriptEmitSignal",
+ "VisualScriptEngineSingleton",
+ "VisualScriptExpression",
+ "VisualScriptFunctionCall",
+ "VisualScriptFunctionState",
+ "VisualScriptFunction",
+ "VisualScriptGlobalConstant",
+ "VisualScriptIndexGet",
+ "VisualScriptIndexSet",
+ "VisualScriptInputAction",
+ "VisualScriptIterator",
+ "VisualScriptLocalVarSet",
+ "VisualScriptLocalVar",
+ "VisualScriptMathConstant",
+ "VisualScriptNode",
+ "VisualScriptOperator",
+ "VisualScriptPreload",
+ "VisualScriptPropertyGet",
+ "VisualScriptPropertySet",
+ "VisualScriptResourcePath",
+ "VisualScriptReturn",
+ "VisualScriptSceneNode",
+ "VisualScriptSceneTree",
+ "VisualScriptSelect",
+ "VisualScriptSelf",
+ "VisualScriptSequence",
+ "VisualScriptSubCall",
+ "VisualScriptSwitch",
+ "VisualScriptTypeCast",
+ "VisualScriptVariableGet",
+ "VisualScriptVariableSet",
+ "VisualScriptWhile",
+ "VisualScript",
+ "VisualScriptYieldSignal",
+ "VisualScriptYield",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/visual_script/doc_classes/VisualScript.xml b/modules/visual_script/doc_classes/VisualScript.xml
new file mode 100644
index 000000000..80b1ed86d
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScript.xml
@@ -0,0 +1,515 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScript" inherits="Script" category="Core" version="3.0-alpha">
+ <brief_description>
+ A script implemented in the Visual Script programming environment.
+ </brief_description>
+ <description>
+ 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>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="add_custom_signal">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Add a custom signal with the specified name to the VisualScript.
+ </description>
+ </method>
+ <method name="add_function">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Add a function with the specified name to the VisualScript.
+ </description>
+ </method>
+ <method name="add_node">
+ <return type="void">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="id" type="int">
+ </argument>
+ <argument index="2" name="node" type="VisualScriptNode">
+ </argument>
+ <argument index="3" name="position" type="Vector2" default="Vector2( 0, 0 )">
+ </argument>
+ <description>
+ Add a node to a function of the VisualScript.
+ </description>
+ </method>
+ <method name="add_variable">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="default_value" type="Variant" default="null">
+ </argument>
+ <argument index="2" name="export" type="bool" default="false">
+ </argument>
+ <description>
+ Add a variable to the VisualScript, optionally giving it a default value or marking it as exported.
+ </description>
+ </method>
+ <method name="custom_signal_add_argument">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <argument index="2" name="argname" type="String">
+ </argument>
+ <argument index="3" name="index" type="int" default="-1">
+ </argument>
+ <description>
+ Add an argument to a custom signal added with [method add_custom_signal].
+ </description>
+ </method>
+ <method name="custom_signal_get_argument_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Get the count of a custom signal's arguments.
+ </description>
+ </method>
+ <method name="custom_signal_get_argument_name" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="argidx" type="int">
+ </argument>
+ <description>
+ Get the name of a custom signal's argument.
+ </description>
+ </method>
+ <method name="custom_signal_get_argument_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="argidx" type="int">
+ </argument>
+ <description>
+ Get the type of a custom signal's argument.
+ </description>
+ </method>
+ <method name="custom_signal_remove_argument">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="argidx" type="int">
+ </argument>
+ <description>
+ Remove a specific custom signal's argument.
+ </description>
+ </method>
+ <method name="custom_signal_set_argument_name">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="argidx" type="int">
+ </argument>
+ <argument index="2" name="argname" type="String">
+ </argument>
+ <description>
+ Rename a custom signal's argument.
+ </description>
+ </method>
+ <method name="custom_signal_set_argument_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="argidx" type="int">
+ </argument>
+ <argument index="2" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ Change the type of a custom signal's argument.
+ </description>
+ </method>
+ <method name="custom_signal_swap_argument">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="argidx" type="int">
+ </argument>
+ <argument index="2" name="withidx" type="int">
+ </argument>
+ <description>
+ Swap two of the arguments of a custom signal.
+ </description>
+ </method>
+ <method name="data_connect">
+ <return type="void">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="from_node" type="int">
+ </argument>
+ <argument index="2" name="from_port" type="int">
+ </argument>
+ <argument index="3" name="to_node" type="int">
+ </argument>
+ <argument index="4" name="to_port" type="int">
+ </argument>
+ <description>
+ Connect two data ports. The value of [code]from_node[/code]'s [code]from_port[/code] would be fed into [code]to_node[/code]'s [code]to_port[/code].
+ </description>
+ </method>
+ <method name="data_disconnect">
+ <return type="void">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="from_node" type="int">
+ </argument>
+ <argument index="2" name="from_port" type="int">
+ </argument>
+ <argument index="3" name="to_node" type="int">
+ </argument>
+ <argument index="4" name="to_port" type="int">
+ </argument>
+ <description>
+ Disconnect two data ports previously connected with [method data_connect].
+ </description>
+ </method>
+ <method name="get_function_node_id" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Returns the id of a function's entry point node.
+ </description>
+ </method>
+ <method name="get_function_scroll" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Returns the position of the center of the screen for a given function.
+ </description>
+ </method>
+ <method name="get_node" qualifiers="const">
+ <return type="VisualScriptNode">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="id" type="int">
+ </argument>
+ <description>
+ Returns a node given its id and its function.
+ </description>
+ </method>
+ <method name="get_node_position" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="id" type="int">
+ </argument>
+ <description>
+ Returns a node's position in pixels.
+ </description>
+ </method>
+ <method name="get_variable_default_value" qualifiers="const">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Returns the default (initial) value of a variable.
+ </description>
+ </method>
+ <method name="get_variable_export" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Returns whether a variable is exported.
+ </description>
+ </method>
+ <method name="get_variable_info" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Returns the info for a given variable as a dictionary. The information includes its name, type, hint and usage.
+ </description>
+ </method>
+ <method name="has_custom_signal" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Returns whether a signal exists with the specified name.
+ </description>
+ </method>
+ <method name="has_data_connection" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="from_node" type="int">
+ </argument>
+ <argument index="2" name="from_port" type="int">
+ </argument>
+ <argument index="3" name="to_node" type="int">
+ </argument>
+ <argument index="4" name="to_port" type="int">
+ </argument>
+ <description>
+ Returns whether the specified data ports are connected.
+ </description>
+ </method>
+ <method name="has_function" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Returns whether a function exists with the specified name.
+ </description>
+ </method>
+ <method name="has_node" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="id" type="int">
+ </argument>
+ <description>
+ Returns whether a node exists with the given id.
+ </description>
+ </method>
+ <method name="has_sequence_connection" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="from_node" type="int">
+ </argument>
+ <argument index="2" name="from_output" type="int">
+ </argument>
+ <argument index="3" name="to_node" type="int">
+ </argument>
+ <description>
+ Returns whether the specified sequence ports are connected.
+ </description>
+ </method>
+ <method name="has_variable" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Returns whether a variable exists with the specified name.
+ </description>
+ </method>
+ <method name="remove_custom_signal">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Remove a custom signal with the given name.
+ </description>
+ </method>
+ <method name="remove_function">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Remove a specific function and its nodes from the script.
+ </description>
+ </method>
+ <method name="remove_node">
+ <return type="void">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="id" type="int">
+ </argument>
+ <description>
+ Remove a specific node.
+ </description>
+ </method>
+ <method name="remove_variable">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Remove a variable with the given name.
+ </description>
+ </method>
+ <method name="rename_custom_signal">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="new_name" type="String">
+ </argument>
+ <description>
+ Change the name of a custom signal.
+ </description>
+ </method>
+ <method name="rename_function">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="new_name" type="String">
+ </argument>
+ <description>
+ Change the name of a function.
+ </description>
+ </method>
+ <method name="rename_variable">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="new_name" type="String">
+ </argument>
+ <description>
+ Change the name of a variable.
+ </description>
+ </method>
+ <method name="sequence_connect">
+ <return type="void">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="from_node" type="int">
+ </argument>
+ <argument index="2" name="from_output" type="int">
+ </argument>
+ <argument index="3" name="to_node" type="int">
+ </argument>
+ <description>
+ Connect two sequence ports. The execution will flow from of [code]from_node[/code]'s [code]from_output[/code] into [code]to_node[/code].
+ Unlike [method data_connect], there isn't a [code]to_port[/code], since the target node can have only one sequence port.
+ </description>
+ </method>
+ <method name="sequence_disconnect">
+ <return type="void">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="from_node" type="int">
+ </argument>
+ <argument index="2" name="from_output" type="int">
+ </argument>
+ <argument index="3" name="to_node" type="int">
+ </argument>
+ <description>
+ Disconnect two sequence ports previously connected with [method sequence_connect].
+ </description>
+ </method>
+ <method name="set_function_scroll">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="ofs" type="Vector2">
+ </argument>
+ <description>
+ Position the center of the screen for a function.
+ </description>
+ </method>
+ <method name="set_instance_base_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="String">
+ </argument>
+ <description>
+ Set the base type of the script.
+ </description>
+ </method>
+ <method name="set_node_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="func" type="String">
+ </argument>
+ <argument index="1" name="id" type="int">
+ </argument>
+ <argument index="2" name="position" type="Vector2">
+ </argument>
+ <description>
+ Position a node on the screen.
+ </description>
+ </method>
+ <method name="set_variable_default_value">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="value" type="Variant">
+ </argument>
+ <description>
+ Change the default (initial) value of a variable.
+ </description>
+ </method>
+ <method name="set_variable_export">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="enable" type="bool">
+ </argument>
+ <description>
+ Change whether a variable is exported.
+ </description>
+ </method>
+ <method name="set_variable_info">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="value" type="Dictionary">
+ </argument>
+ <description>
+ Set a variable's info, using the same format as [method get_variable_info].
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="data" type="Dictionary" setter="_set_data" getter="_get_data">
+ </member>
+ </members>
+ <signals>
+ <signal name="node_ports_changed">
+ <argument index="0" name="function" type="String">
+ </argument>
+ <argument index="1" name="id" type="int">
+ </argument>
+ <description>
+ Emitted when the ports of a node are changed.
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
new file mode 100644
index 000000000..6c028e5f2
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ A Visual Script node representing a constant from the base types.
+ </brief_description>
+ <description>
+ A Visual Script node representing a constant from base types, such as [Vector3.AXIS_X].
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_basic_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_basic_type_constant" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_basic_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_basic_type_constant">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type">
+ The type to get the constant from.
+ </member>
+ <member name="constant" type="String" setter="set_basic_type_constant" getter="get_basic_type_constant">
+ The name of the constant to return.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
new file mode 100644
index 000000000..27231574d
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ A Visual Script node used to call built-in functions.
+ </brief_description>
+ <description>
+ A built-in function used inside a [VisualScript]. It is usually a math function or an utility function.
+ See also [@GDScript], for the same functions in the GDScript language.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_func">
+ <return type="int" enum="VisualScriptBuiltinFunc.BuiltinFunc">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_func">
+ <return type="void">
+ </return>
+ <argument index="0" name="which" type="int" enum="VisualScriptBuiltinFunc.BuiltinFunc">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="function" type="int" setter="set_func" getter="get_func" enum="VisualScriptBuiltinFunc.BuiltinFunc">
+ The function to be executed.
+ </member>
+ </members>
+ <constants>
+ <constant name="MATH_SIN" value="0">
+ Return the sine of the input.
+ </constant>
+ <constant name="MATH_COS" value="1">
+ Return the cosine of the input.
+ </constant>
+ <constant name="MATH_TAN" value="2">
+ Return the tangent of the input.
+ </constant>
+ <constant name="MATH_SINH" value="3">
+ Return the hyperbolic sine of the input.
+ </constant>
+ <constant name="MATH_COSH" value="4">
+ Return the hyperbolic cosine of the input.
+ </constant>
+ <constant name="MATH_TANH" value="5">
+ Return the hyperbolic tangent of the input.
+ </constant>
+ <constant name="MATH_ASIN" value="6">
+ Return the arc sine of the input.
+ </constant>
+ <constant name="MATH_ACOS" value="7">
+ Return the arc cosine of the input.
+ </constant>
+ <constant name="MATH_ATAN" value="8">
+ Return the arc tangent of the input.
+ </constant>
+ <constant name="MATH_ATAN2" value="9">
+ Return the arc tangent of the input, using the signs of both parameters to determine the exact angle.
+ </constant>
+ <constant name="MATH_SQRT" value="10">
+ Return the square root of the input.
+ </constant>
+ <constant name="MATH_FMOD" value="11">
+ Return the remainder of one input divided by the other, using floating-point numbers.
+ </constant>
+ <constant name="MATH_FPOSMOD" value="12">
+ Return the positive remainder of one input divided by the other, using floating-point numbers.
+ </constant>
+ <constant name="MATH_FLOOR" value="13">
+ Return the input rounded down.
+ </constant>
+ <constant name="MATH_CEIL" value="14">
+ Return the input rounded up.
+ </constant>
+ <constant name="MATH_ROUND" value="15">
+ Return the input rounded to the nearest integer.
+ </constant>
+ <constant name="MATH_ABS" value="16">
+ Return the absolute value of the input.
+ </constant>
+ <constant name="MATH_SIGN" value="17">
+ Return the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative.
+ </constant>
+ <constant name="MATH_POW" value="18">
+ Return the input raised to a given power.
+ </constant>
+ <constant name="MATH_LOG" value="19">
+ Return the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
+ </constant>
+ <constant name="MATH_EXP" value="20">
+ Return [b]e[/b] raised to the power of the input. [b]e[/b] sometimes called "Euler's number" is a mathematical constant whose value is approximately 2.71828.
+ </constant>
+ <constant name="MATH_ISNAN" value="21">
+ Return whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist.
+ </constant>
+ <constant name="MATH_ISINF" value="22">
+ Return whether the input is an infinite floating-point number or not. Infinity is usually produced by dividing a number by 0, though other ways exist.
+ </constant>
+ <constant name="MATH_EASE" value="23">
+ Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
+ </constant>
+ <constant name="MATH_DECIMALS" value="24">
+ Return the number of digit places after the decimal that the first non-zero digit occurs.
+ </constant>
+ <constant name="MATH_STEPIFY" value="25">
+ Return the input snapped to a given step.
+ </constant>
+ <constant name="MATH_LERP" value="26">
+ Return a number linearly interpolated between the first two inputs, based on the third input. Uses the formula [code]a + (a - b) * t[/code].
+ </constant>
+ <constant name="MATH_INVERSE_LERP" value="27">
+ </constant>
+ <constant name="MATH_RANGE_LERP" value="28">
+ </constant>
+ <constant name="MATH_DECTIME" value="29">
+ Return the result of 'value' decreased by 'step' * 'amount'.
+ </constant>
+ <constant name="MATH_RANDOMIZE" value="30">
+ Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
+ </constant>
+ <constant name="MATH_RAND" value="31">
+ Return a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use it with the remainder function.
+ </constant>
+ <constant name="MATH_RANDF" value="32">
+ Return a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication.
+ </constant>
+ <constant name="MATH_RANDOM" value="33">
+ Return a random floating-point value between the two inputs.
+ </constant>
+ <constant name="MATH_SEED" value="34">
+ Set the seed for the random number generator.
+ </constant>
+ <constant name="MATH_RANDSEED" value="35">
+ Return a random value from the given seed, along with the new seed.
+ </constant>
+ <constant name="MATH_DEG2RAD" value="36">
+ Convert the input from degrees to radians.
+ </constant>
+ <constant name="MATH_RAD2DEG" value="37">
+ Convert the input from radians to degrees.
+ </constant>
+ <constant name="MATH_LINEAR2DB" value="38">
+ Convert the input from linear volume to decibel volume.
+ </constant>
+ <constant name="MATH_DB2LINEAR" value="39">
+ Convert the input from decibel volume to linear volume.
+ </constant>
+ <constant name="MATH_WRAP" value="40">
+ </constant>
+ <constant name="MATH_WRAPF" value="41">
+ </constant>
+ <constant name="LOGIC_MAX" value="42">
+ Return the greater of the two numbers, also known as their maximum.
+ </constant>
+ <constant name="LOGIC_MIN" value="43">
+ Return the lesser of the two numbers, also known as their minimum.
+ </constant>
+ <constant name="LOGIC_CLAMP" value="44">
+ Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to `min(max(input, range_low), range_high)`
+ </constant>
+ <constant name="LOGIC_NEAREST_PO2" value="45">
+ Return the nearest power of 2 to the input.
+ </constant>
+ <constant name="OBJ_WEAKREF" value="46">
+ Create a [WeakRef] from the input.
+ </constant>
+ <constant name="FUNC_FUNCREF" value="47">
+ Create a [FuncRef] from the input.
+ </constant>
+ <constant name="TYPE_CONVERT" value="48">
+ Convert between types.
+ </constant>
+ <constant name="TYPE_OF" value="49">
+ Return the type of the input as an integer. Check [enum Variant.Type] for the integers that might be returned.
+ </constant>
+ <constant name="TYPE_EXISTS" value="50">
+ Checks if a type is registered in the [ClassDB].
+ </constant>
+ <constant name="TEXT_CHAR" value="51">
+ Return a character with the given ascii value.
+ </constant>
+ <constant name="TEXT_STR" value="52">
+ Convert the input to a string.
+ </constant>
+ <constant name="TEXT_PRINT" value="53">
+ Print the given string to the output window.
+ </constant>
+ <constant name="TEXT_PRINTERR" value="54">
+ Print the given string to the standard error output.
+ </constant>
+ <constant name="TEXT_PRINTRAW" value="55">
+ Print the given string to the standard output, without adding a newline.
+ </constant>
+ <constant name="VAR_TO_STR" value="56">
+ Serialize a [Variant] to a string.
+ </constant>
+ <constant name="STR_TO_VAR" value="57">
+ Deserialize a [Variant] from a string serialized using [VAR_TO_STR].
+ </constant>
+ <constant name="VAR_TO_BYTES" value="58">
+ Serialize a [Variant] to a [PoolByteArray].
+ </constant>
+ <constant name="BYTES_TO_VAR" value="59">
+ Deserialize a [Variant] from a [PoolByteArray] serialized using [VAR_TO_BYTES].
+ </constant>
+ <constant name="COLORN" value="60">
+ Return the [Color] with the given name and alpha ranging from 0 to 1. Note: names are defined in color_names.inc.
+ </constant>
+ <constant name="FUNC_MAX" value="61">
+ The maximum value the [member function] property can have.
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
new file mode 100644
index 000000000..e6498e92a
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Gets a constant from a given class.
+ </brief_description>
+ <description>
+ This node returns a constant from a given class, such as [@GlobalScope.TYPE_INT]. See the given class' documentation for available constants.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data (variant): [code]value[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_base_type">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_class_constant">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_class_constant">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
+ The constant's parent class.
+ </member>
+ <member name="constant" type="String" setter="set_class_constant" getter="get_class_constant">
+ The constant to return. See the given class for its available constants.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptComment.xml b/modules/visual_script/doc_classes/VisualScriptComment.xml
new file mode 100644
index 000000000..ea4545f8e
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptComment.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ A Visual Script node used to annotate the script.
+ </brief_description>
+ <description>
+ A Visual Script node used to display annotations in the script, so that code may be documented.
+ Comment nodes can be resized so they encompass a group of nodes.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_description" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_size" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_title" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_description">
+ <return type="void">
+ </return>
+ <argument index="0" name="description" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_size">
+ <return type="void">
+ </return>
+ <argument index="0" name="size" type="Vector2">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_title">
+ <return type="void">
+ </return>
+ <argument index="0" name="title" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="description" type="String" setter="set_description" getter="get_description">
+ The text inside the comment node.
+ </member>
+ <member name="size" type="Vector2" setter="set_size" getter="get_size">
+ The comment node's size (in pixels).
+ </member>
+ <member name="title" type="String" setter="set_title" getter="get_title">
+ The comment node's title.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptCondition.xml b/modules/visual_script/doc_classes/VisualScriptCondition.xml
new file mode 100644
index 000000000..2a30c604a
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptCondition.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ A Visual Script node which branches the flow.
+ </brief_description>
+ <description>
+ A Visual Script node that checks a [bool] input port. If [code]true[/code] it will exit via the “true” sequence port. If [code]false[/code] it will exit via the "false" sequence port. After exiting either, it exits via the “done” port. Sequence ports may be left disconnected.
+ [b]Input Ports:[/b]
+ - Sequence: [code]if (cond) is[/code]
+ - Data (boolean): [code]cond[/code]
+ [b]Output Ports:[/b]
+ - Sequence: [code]true[/code]
+ - Sequence: [code]false[/code]
+ - Sequence: [code]done[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptConstant.xml b/modules/visual_script/doc_classes/VisualScriptConstant.xml
new file mode 100644
index 000000000..51c6d1923
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptConstant.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Gets a contant's value.
+ </brief_description>
+ <description>
+ This node returns a constant's value.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data (variant): [code]get[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_constant_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_constant_value" qualifiers="const">
+ <return type="Variant">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_constant_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_constant_value">
+ <return type="void">
+ </return>
+ <argument index="0" name="value" type="Variant">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="type" type="int" setter="set_constant_type" getter="get_constant_type" enum="Variant.Type">
+ The constant's type.
+ </member>
+ <member name="value" type="Variant" setter="set_constant_value" getter="get_constant_value">
+ The constant's value.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptConstructor.xml b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
new file mode 100644
index 000000000..91df52e89
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ A Visual Script node which calls a base type constructor.
+ </brief_description>
+ <description>
+ A Visual Script node which calls a base type constructor. It can be used for type conversion as well.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_constructor" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_constructor_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_constructor">
+ <return type="void">
+ </return>
+ <argument index="0" name="constructor" type="Dictionary">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_constructor_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="constructor" type="Dictionary" setter="set_constructor" getter="get_constructor">
+ The constructor function's method info. Has roughly the following structure:
+ [codeblock]
+ {
+ name = "string",
+ args = [{
+ name = "string"
+ class_name = "string"
+ type = TYPE_*
+ hint = PROPERTY_HINT_*
+ hint_string = "string"
+ }]
+ default_args = [] # Array of variants
+ flags = METHOD_FLAG_*
+ id = 0
+ return = {type = TYPE_*}
+ }
+ [/codeblock]
+ </member>
+ <member name="type" type="int" setter="set_constructor_type" getter="get_constructor_type" enum="Variant.Type">
+ The type to be constructed.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
new file mode 100644
index 000000000..38c325cfb
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ A scripted Visual Script node.
+ </brief_description>
+ <description>
+ A custom Visual Script node which can be scripted in powerful ways.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="_get_caption" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <description>
+ Return the node's title.
+ </description>
+ </method>
+ <method name="_get_category" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <description>
+ Return the node's category.
+ </description>
+ </method>
+ <method name="_get_input_value_port_count" qualifiers="virtual">
+ <return type="int">
+ </return>
+ <description>
+ Return the count of input value ports.
+ </description>
+ </method>
+ <method name="_get_input_value_port_name" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <description>
+ Return the specified input port's name.
+ </description>
+ </method>
+ <method name="_get_input_value_port_type" qualifiers="virtual">
+ <return type="int">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <description>
+ Return the specified input port's type. See the TYPE_* enum in [@GlobalScope].
+ </description>
+ </method>
+ <method name="_get_output_sequence_port_count" qualifiers="virtual">
+ <return type="int">
+ </return>
+ <description>
+ Return the amount of output [b]sequence[/b] ports.
+ </description>
+ </method>
+ <method name="_get_output_sequence_port_text" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <description>
+ Return the specified [b]sequence[/b] output's name.
+ </description>
+ </method>
+ <method name="_get_output_value_port_count" qualifiers="virtual">
+ <return type="int">
+ </return>
+ <description>
+ Return the amount of output value ports.
+ </description>
+ </method>
+ <method name="_get_output_value_port_name" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <description>
+ Return the specified output's name.
+ </description>
+ </method>
+ <method name="_get_output_value_port_type" qualifiers="virtual">
+ <return type="int">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <description>
+ Return the specified output's type. See the TYPE_* enum in [@GlobalScope].
+ </description>
+ </method>
+ <method name="_get_text" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <description>
+ Return the custom node's text, which is shown right next to the input [b]sequence[/b] port (if there is none, on the place that is usually taken by it).
+ </description>
+ </method>
+ <method name="_get_working_memory_size" qualifiers="virtual">
+ <return type="int">
+ </return>
+ <description>
+ Return the size of the custom node's working memory. See [method _step] for more details.
+ </description>
+ </method>
+ <method name="_has_input_sequence_port" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <description>
+ Return whether the custom node has an input [b]sequence[/b] port.
+ </description>
+ </method>
+ <method name="_step" qualifiers="virtual">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="inputs" type="Array">
+ </argument>
+ <argument index="1" name="outputs" type="Array">
+ </argument>
+ <argument index="2" name="start_mode" type="int">
+ </argument>
+ <argument index="3" name="working_mem" type="Array">
+ </argument>
+ <description>
+ Execute the custom node's logic, returning the index of the output sequence port to use or a [String] when there is an error.
+
+ The [code]inputs[/code] array contains the values of the input ports.
+ [code]outputs[/code] is an array whose indices should be set to the respective outputs.
+ The [code]start_mode[/code] is usually [code]START_MODE_BEGIN_SEQUENCE[/code], unless you have used the STEP_* constants.
+ [code]working_mem[/code] is an array which can be used to persist information between runs of the custom node.
+
+ When returning, you can mask the returned value with one of the STEP_* constants.
+ </description>
+ </method>
+ </methods>
+ <constants>
+ <constant name="START_MODE_BEGIN_SEQUENCE" value="0">
+ The start mode used the first time when [method _step] is called.
+ </constant>
+ <constant name="START_MODE_CONTINUE_SEQUENCE" value="1">
+ The start mode used when [method _step] is called after coming back from a STEP_PUSH_STACK_BIT.
+ </constant>
+ <constant name="START_MODE_RESUME_YIELD" value="2">
+ The start mode used when [method _step] is called after resuming from STEP_YIELD_BIT.
+ </constant>
+ <constant name="STEP_PUSH_STACK_BIT" value="16777216" enum="">
+ Hint used by [method _step] to tell that control should return to it when there is no other node left to execute.
+ This is used by [VisualScriptCondition] to redirect the sequence to the "Done" port after the true/false branch has finished execution.
+ </constant>
+ <constant name="STEP_GO_BACK_BIT" value="33554432" enum="">
+ Hint used by [method _step] to tell that control should return back, either hitting a previous STEP_PUSH_STACK_BIT or exiting the function.
+ </constant>
+ <constant name="STEP_NO_ADVANCE_BIT" value="67108864" enum="">
+ </constant>
+ <constant name="STEP_EXIT_FUNCTION_BIT" value="134217728" enum="">
+ Hint used by [method _step] to tell that control should stop and exit the function.
+ </constant>
+ <constant name="STEP_YIELD_BIT" value="268435456" enum="">
+ Hint used by [method _step] to tell that the function should be yielded.
+ Using this requires you to have at least one working memory slot, which is used for the [VisualScriptFunctionState].
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
new file mode 100644
index 000000000..cbed3ba22
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ A Visual Script node which deconstructs a base type instance into its parts.
+ </brief_description>
+ <description>
+ A Visual Script node which deconstructs a base type instance into its parts.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_deconstruct_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_deconstruct_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="elem_cache" type="Array" setter="_set_elem_cache" getter="_get_elem_cache">
+ </member>
+ <member name="type" type="int" setter="set_deconstruct_type" getter="get_deconstruct_type" enum="Variant.Type">
+ The type to deconstruct.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptEditor.xml b/modules/visual_script/doc_classes/VisualScriptEditor.xml
new file mode 100644
index 000000000..70d52b2bd
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptEditor.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptEditor" inherits="Object" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="add_custom_node">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="category" type="String">
+ </argument>
+ <argument index="2" name="script" type="Script">
+ </argument>
+ <description>
+ Add a custom Visual Script node to the editor. It'll be placed under "Custom Nodes" with the [code]category[/code] as the parameter.
+ </description>
+ </method>
+ <method name="remove_custom_node">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="category" type="String">
+ </argument>
+ <description>
+ Remove a custom Visual Script node from the editor. Custom nodes already placed on scripts won't be removed.
+ </description>
+ </method>
+ </methods>
+ <signals>
+ <signal name="custom_nodes_updated">
+ <description>
+ Emitted when a custom Visual Script node is added or removed.
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
new file mode 100644
index 000000000..669276f0d
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Emits a specified signal.
+ </brief_description>
+ <description>
+ Emits a specified signal when it is executed.
+ [b]Input Ports:[/b]
+ - Sequence: [code]emit[/code]
+ [b]Output Ports:[/b]
+ - Sequence
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_signal" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_signal">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="signal" type="String" setter="set_signal" getter="get_signal">
+ The signal to emit.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
new file mode 100644
index 000000000..6703ff4ed
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ A Visual Script node returning a singleton from [@GlobalScope]
+ </brief_description>
+ <description>
+ A Visual Script node returning a singleton from [@GlobalScope]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_singleton">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_singleton">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="constant" type="String" setter="set_singleton" getter="get_singleton">
+ The singleton's name.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptExpression.xml b/modules/visual_script/doc_classes/VisualScriptExpression.xml
new file mode 100644
index 000000000..fb3b6ef19
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptExpression.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunction.xml b/modules/visual_script/doc_classes/VisualScriptFunction.xml
new file mode 100644
index 000000000..d77169679
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptFunction.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
new file mode 100644
index 000000000..7a0a7c9f5
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_base_path" qualifiers="const">
+ <return type="NodePath">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_script" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_type" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_basic_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_call_mode" qualifiers="const">
+ <return type="int" enum="VisualScriptFunctionCall.CallMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_function" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_rpc_call_mode" qualifiers="const">
+ <return type="int" enum="VisualScriptFunctionCall.RPCCallMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_singleton" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_use_default_args" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_validate" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_path">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_path" type="NodePath">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_script">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_script" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_type" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_basic_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="basic_type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_call_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="VisualScriptFunctionCall.CallMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_function">
+ <return type="void">
+ </return>
+ <argument index="0" name="function" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_rpc_call_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="VisualScriptFunctionCall.RPCCallMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_singleton">
+ <return type="void">
+ </return>
+ <argument index="0" name="singleton" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_use_default_args">
+ <return type="void">
+ </return>
+ <argument index="0" name="amount" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_validate">
+ <return type="void">
+ </return>
+ <argument index="0" name="enable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="argument_cache" type="Dictionary" setter="_set_argument_cache" getter="_get_argument_cache">
+ </member>
+ <member name="base_script" type="String" setter="set_base_script" getter="get_base_script">
+ </member>
+ <member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
+ </member>
+ <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type">
+ </member>
+ <member name="call_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptFunctionCall.CallMode">
+ </member>
+ <member name="function" type="String" setter="set_function" getter="get_function">
+ </member>
+ <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path">
+ </member>
+ <member name="rpc_call_mode" type="int" setter="set_rpc_call_mode" getter="get_rpc_call_mode" enum="VisualScriptFunctionCall.RPCCallMode">
+ </member>
+ <member name="singleton" type="String" setter="set_singleton" getter="get_singleton">
+ </member>
+ <member name="use_default_args" type="int" setter="set_use_default_args" getter="get_use_default_args">
+ </member>
+ <member name="validate" type="bool" setter="set_validate" getter="get_validate">
+ </member>
+ </members>
+ <constants>
+ <constant name="CALL_MODE_SELF" value="0">
+ </constant>
+ <constant name="CALL_MODE_NODE_PATH" value="1">
+ </constant>
+ <constant name="CALL_MODE_INSTANCE" value="2">
+ </constant>
+ <constant name="CALL_MODE_BASIC_TYPE" value="3">
+ </constant>
+ <constant name="CALL_MODE_SINGLETON" value="4">
+ </constant>
+ <constant name="RPC_DISABLED" value="0">
+ </constant>
+ <constant name="RPC_RELIABLE" value="1">
+ </constant>
+ <constant name="RPC_UNRELIABLE" value="2">
+ </constant>
+ <constant name="RPC_RELIABLE_TO_ID" value="3">
+ </constant>
+ <constant name="RPC_UNRELIABLE_TO_ID" value="4">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
new file mode 100644
index 000000000..9b30f6223
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptFunctionState" inherits="Reference" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="connect_to_signal">
+ <return type="void">
+ </return>
+ <argument index="0" name="obj" type="Object">
+ </argument>
+ <argument index="1" name="signals" type="String">
+ </argument>
+ <argument index="2" name="args" type="Array">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="is_valid" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="resume">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="args" type="Array" default="null">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
new file mode 100644
index 000000000..961244fe8
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_global_constant">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_global_constant">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="constant" type="int" setter="set_global_constant" getter="get_global_constant">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptIndexGet.xml b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml
new file mode 100644
index 000000000..c5229f767
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptIndexGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptIndexSet.xml b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml
new file mode 100644
index 000000000..27646b4a5
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptIndexSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptInputAction.xml b/modules/visual_script/doc_classes/VisualScriptInputAction.xml
new file mode 100644
index 000000000..7f6d13264
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptInputAction.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_action_mode" qualifiers="const">
+ <return type="int" enum="VisualScriptInputAction.Mode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_action_name" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_action_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="VisualScriptInputAction.Mode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_action_name">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="action" type="String" setter="set_action_name" getter="get_action_name">
+ </member>
+ <member name="mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="VisualScriptInputAction.Mode">
+ </member>
+ </members>
+ <constants>
+ <constant name="MODE_PRESSED" value="0">
+ </constant>
+ <constant name="MODE_RELEASED" value="1">
+ </constant>
+ <constant name="MODE_JUST_PRESSED" value="2">
+ </constant>
+ <constant name="MODE_JUST_RELEASED" value="3">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptIterator.xml b/modules/visual_script/doc_classes/VisualScriptIterator.xml
new file mode 100644
index 000000000..fc905d6c3
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptIterator.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Steps through items in a given input.
+ </brief_description>
+ <description>
+ This node steps through each item in a given input. Input can be any sequence data type, such as an [Array] or [String]. When each item has been processed, execution passed out the [code]exit[/code] Sequence port.
+ [b]Input Ports:[/b]
+ - Sequence: [code]for (elem) in (input)[/code]
+ - Data (variant): [code]input[/code]
+ [b]Output Ports:[/b]
+ - Sequence: [code]each[/code]
+ - Sequence: [code]exit[/code]
+ - Data (variant): [code]elem[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
new file mode 100644
index 000000000..ff77dfac0
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Gets a local variable's value.
+ </brief_description>
+ <description>
+ Returns a local variable's value. "Var Name" must be supplied, with an optional type.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data (variant): [code]get[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_var_name" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_var_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_var_name">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_var_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type">
+ The local variable's type.
+ </member>
+ <member name="var_name" type="String" setter="set_var_name" getter="get_var_name">
+ The local variable's name.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
new file mode 100644
index 000000000..07b01d457
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Changes a local variable's value.
+ </brief_description>
+ <description>
+ Changes a local variable's value to the given input. The new value is also provided on an output Data port.
+ [b]Input Ports:[/b]
+ - Sequence
+ - Data (variant): [code]set[/code]
+ [b]Output Ports:[/b]
+ - Sequence
+ - Data (variant): [code]get[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_var_name" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_var_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_var_name">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_var_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type">
+ The local variable's type.
+ </member>
+ <member name="var_name" type="String" setter="set_var_name" getter="get_var_name">
+ The local variable's name.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptMathConstant.xml b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
new file mode 100644
index 000000000..817bcb5ce
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Commonly used mathematical constants.
+ </brief_description>
+ <description>
+ Provides common math constants, such as Pi or Euler's constant, on an output Data port.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data (variant): [code]get[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_math_constant">
+ <return type="int" enum="VisualScriptMathConstant.MathConstant">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_math_constant">
+ <return type="void">
+ </return>
+ <argument index="0" name="which" type="int" enum="VisualScriptMathConstant.MathConstant">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="constant" type="int" setter="set_math_constant" getter="get_math_constant" enum="VisualScriptMathConstant.MathConstant">
+ The math constant.
+ </member>
+ </members>
+ <constants>
+ <constant name="MATH_CONSTANT_ONE" value="0">
+ Unity: [code]1[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_PI" value="1">
+ Pi: [code]3.141593[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_HALF_PI" value="2">
+ Pi divided by two: [code]1.570796[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_TAU" value="3">
+ Tau: [code]6.283185[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_E" value="4">
+ Natural log: [code]2.718282[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_SQRT2" value="5">
+ Square root of two: [code]1.414214[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_INF" value="6">
+ Infinity: [code]inf[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_NAN" value="7">
+ Not a number: [code]nan[/code]
+ </constant>
+ <constant name="MATH_CONSTANT_MAX" value="8">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptNode.xml b/modules/visual_script/doc_classes/VisualScriptNode.xml
new file mode 100644
index 000000000..f6f286717
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptNode.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.0-alpha">
+ <brief_description>
+ A node which is part of a [VisualScript].
+ </brief_description>
+ <description>
+ A node which is part of a [VisualScript]. Not to be confused with [Node], which is a part of a [SceneTree].
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_default_input_value" qualifiers="const">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="port_idx" type="int">
+ </argument>
+ <description>
+ Returns the default value of a given port. The default value is used when nothing is connected to the port.
+ </description>
+ </method>
+ <method name="get_visual_script" qualifiers="const">
+ <return type="VisualScript">
+ </return>
+ <description>
+ Returns the [VisualScript] instance the node is bound to.
+ </description>
+ </method>
+ <method name="ports_changed_notify">
+ <return type="void">
+ </return>
+ <description>
+ Notify that the node's ports have changed. Usually used in conjunction with [VisualScriptCustomNode] .
+ </description>
+ </method>
+ <method name="set_default_input_value">
+ <return type="void">
+ </return>
+ <argument index="0" name="port_idx" type="int">
+ </argument>
+ <argument index="1" name="value" type="Variant">
+ </argument>
+ <description>
+ Change the default value of a given port.
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="_default_input_values" type="Array" setter="_set_default_input_values" getter="_get_default_input_values">
+ </member>
+ </members>
+ <signals>
+ <signal name="ports_changed">
+ <description>
+ Emitted when the available input/output ports are changed.
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptOperator.xml b/modules/visual_script/doc_classes/VisualScriptOperator.xml
new file mode 100644
index 000000000..bf4032c09
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptOperator.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ [b]Input Ports:[/b]
+ - Data (variant): [code]A[/code]
+ - Data (variant): [code]B[/code]
+ [b]Output Ports:[/b]
+ - Data (variant): [code]result[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_operator" qualifiers="const">
+ <return type="int" enum="Variant.Operator">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_typed" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_operator">
+ <return type="void">
+ </return>
+ <argument index="0" name="op" type="int" enum="Variant.Operator">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_typed">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="operator" type="int" setter="set_operator" getter="get_operator" enum="Variant.Operator">
+ </member>
+ <member name="type" type="int" setter="set_typed" getter="get_typed" enum="Variant.Type">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptPreload.xml b/modules/visual_script/doc_classes/VisualScriptPreload.xml
new file mode 100644
index 000000000..4a71e2380
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptPreload.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Creates a new [Resource] or loads one from the filesystem.
+ </brief_description>
+ <description>
+ Creates a new [Resource] or loads one from the filesystem.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data (object): [code]res[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_preload" qualifiers="const">
+ <return type="Resource">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_preload">
+ <return type="void">
+ </return>
+ <argument index="0" name="resource" type="Resource">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="resource" type="Resource" setter="set_preload" getter="get_preload">
+ The [Resource] to load.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
new file mode 100644
index 000000000..eb5c52f4b
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_base_path" qualifiers="const">
+ <return type="NodePath">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_script" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_type" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_basic_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_call_mode" qualifiers="const">
+ <return type="int" enum="VisualScriptPropertyGet.CallMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_index" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_property" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_path">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_path" type="NodePath">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_script">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_script" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_type" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_basic_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="basic_type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_call_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="VisualScriptPropertyGet.CallMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_index">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_property">
+ <return type="void">
+ </return>
+ <argument index="0" name="property" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="base_script" type="String" setter="set_base_script" getter="get_base_script">
+ </member>
+ <member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
+ </member>
+ <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type">
+ </member>
+ <member name="index" type="String" setter="set_index" getter="get_index">
+ </member>
+ <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path">
+ </member>
+ <member name="property" type="String" setter="set_property" getter="get_property">
+ </member>
+ <member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertyGet.CallMode">
+ </member>
+ <member name="type_cache" type="int" setter="_set_type_cache" getter="_get_type_cache" enum="Variant.Type">
+ </member>
+ </members>
+ <constants>
+ <constant name="CALL_MODE_SELF" value="0">
+ </constant>
+ <constant name="CALL_MODE_NODE_PATH" value="1">
+ </constant>
+ <constant name="CALL_MODE_INSTANCE" value="2">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
new file mode 100644
index 000000000..794caa251
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_assign_op" qualifiers="const">
+ <return type="int" enum="VisualScriptPropertySet.AssignOp">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_path" qualifiers="const">
+ <return type="NodePath">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_script" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_type" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_basic_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_call_mode" qualifiers="const">
+ <return type="int" enum="VisualScriptPropertySet.CallMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_index" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_property" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_assign_op">
+ <return type="void">
+ </return>
+ <argument index="0" name="assign_op" type="int" enum="VisualScriptPropertySet.AssignOp">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_path">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_path" type="NodePath">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_script">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_script" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_type" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_basic_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="basic_type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_call_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="VisualScriptPropertySet.CallMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_index">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_property">
+ <return type="void">
+ </return>
+ <argument index="0" name="property" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="assign_op" type="int" setter="set_assign_op" getter="get_assign_op" enum="VisualScriptPropertySet.AssignOp">
+ </member>
+ <member name="base_script" type="String" setter="set_base_script" getter="get_base_script">
+ </member>
+ <member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
+ </member>
+ <member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type">
+ </member>
+ <member name="index" type="String" setter="set_index" getter="get_index">
+ </member>
+ <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path">
+ </member>
+ <member name="property" type="String" setter="set_property" getter="get_property">
+ </member>
+ <member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertySet.CallMode">
+ </member>
+ <member name="type_cache" type="Dictionary" setter="_set_type_cache" getter="_get_type_cache">
+ </member>
+ </members>
+ <constants>
+ <constant name="CALL_MODE_SELF" value="0">
+ </constant>
+ <constant name="CALL_MODE_NODE_PATH" value="1">
+ </constant>
+ <constant name="CALL_MODE_INSTANCE" value="2">
+ </constant>
+ <constant name="CALL_MODE_BASIC_TYPE" value="3">
+ </constant>
+ <constant name="ASSIGN_OP_NONE" value="0">
+ </constant>
+ <constant name="ASSIGN_OP_ADD" value="1">
+ </constant>
+ <constant name="ASSIGN_OP_SUB" value="2">
+ </constant>
+ <constant name="ASSIGN_OP_MUL" value="3">
+ </constant>
+ <constant name="ASSIGN_OP_DIV" value="4">
+ </constant>
+ <constant name="ASSIGN_OP_MOD" value="5">
+ </constant>
+ <constant name="ASSIGN_OP_SHIFT_LEFT" value="6">
+ </constant>
+ <constant name="ASSIGN_OP_SHIFT_RIGHT" value="7">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_AND" value="8">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_OR" value="9">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_XOR" value="10">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptResourcePath.xml b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
new file mode 100644
index 000000000..274a852c3
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_resource_path">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_resource_path">
+ <return type="void">
+ </return>
+ <argument index="0" name="path" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="path" type="String" setter="set_resource_path" getter="get_resource_path">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptReturn.xml b/modules/visual_script/doc_classes/VisualScriptReturn.xml
new file mode 100644
index 000000000..4ac586a02
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptReturn.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Exits a function and returns an optional value.
+ </brief_description>
+ <description>
+ Ends the execution of a function and returns control to the calling function. Optionally, it can return a [Variant] value.
+ [b]Input Ports:[/b]
+ - Sequence
+ - Data (variant): [code]result[/code] (optional)
+ [b]Output Ports:[/b]
+ none
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_return_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_return_value_enabled" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_enable_return_value">
+ <return type="void">
+ </return>
+ <argument index="0" name="enable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_return_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="return_enabled" type="bool" setter="set_enable_return_value" getter="is_return_value_enabled">
+ If [code]true[/code] the [code]return[/code] input port is available.
+ </member>
+ <member name="return_type" type="int" setter="set_return_type" getter="get_return_type" enum="Variant.Type">
+ The return value's data type.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptSceneNode.xml b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
new file mode 100644
index 000000000..e8fdb69c6
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Node reference.
+ </brief_description>
+ <description>
+ A direct reference to a node.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data: [code]node[/code] (obj)
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_node_path">
+ <return type="NodePath">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_node_path">
+ <return type="void">
+ </return>
+ <argument index="0" name="path" type="NodePath">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="node_path" type="NodePath" setter="set_node_path" getter="get_node_path">
+ The node's path in the scene tree.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptSceneTree.xml b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml
new file mode 100644
index 000000000..e74c33062
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSceneTree" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptSelect.xml b/modules/visual_script/doc_classes/VisualScriptSelect.xml
new file mode 100644
index 000000000..6a62e364f
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSelect.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Chooses between two input values.
+ </brief_description>
+ <description>
+ Chooses between two input values based on a Boolean condition.
+ [b]Input Ports:[/b]
+ - Data (boolean): [code]cond[/code]
+ - Data (variant): [code]a[/code]
+ - Data (variant): [code]b[/code]
+ [b]Output Ports:[/b]
+ - Data (variant): [code]out[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_typed" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_typed">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="type" type="int" setter="set_typed" getter="get_typed" enum="Variant.Type">
+ The input variables' type.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptSelf.xml b/modules/visual_script/doc_classes/VisualScriptSelf.xml
new file mode 100644
index 000000000..f39a02bf8
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSelf.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Outputs a reference to the current instance.
+ </brief_description>
+ <description>
+ Provides a reference to the node running the visual script.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data (object): [code]instance[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptSequence.xml b/modules/visual_script/doc_classes/VisualScriptSequence.xml
new file mode 100644
index 000000000..51238070d
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSequence.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Executes a series of Sequence ports.
+ </brief_description>
+ <description>
+ Steps through a series of one or more output Sequence ports. The [code]current[/code] data port outputs the currently executing item.
+ [b]Input Ports:[/b]
+ - Sequence: [code]in order[/code]
+ [b]Output Ports:[/b]
+ - Sequence: [code]1[/code]
+ - Sequence: [code]2 - n[/code] (optional)
+ - Data (int): [code]current[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_steps" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_steps">
+ <return type="void">
+ </return>
+ <argument index="0" name="steps" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="steps" type="int" setter="set_steps" getter="get_steps">
+ The number of steps in the sequence.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptSubCall.xml b/modules/visual_script/doc_classes/VisualScriptSubCall.xml
new file mode 100644
index 000000000..381095f49
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSubCall.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSubCall" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="_subcall" qualifiers="virtual">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="arguments" type="Variant">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptSwitch.xml b/modules/visual_script/doc_classes/VisualScriptSwitch.xml
new file mode 100644
index 000000000..3c8a79f68
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptSwitch.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Branches program flow based on a given input's value.
+ </brief_description>
+ <description>
+ Branches the flow based on an input's value. Use "Case Count" in the Inspector to set the number of branches and each comparison's optional type.
+ [b]Input Ports:[/b]
+ - Sequence: [code]'input' is[/code]
+ - Data (variant): [code]=[/code]
+ - Data (variant): [code]=[/code] (optional)
+ - Data (variant): [code]input[/code]
+ [b]Output Ports:[/b]
+ - Sequence
+ - Sequence (optional)
+ - Sequence: [code]done[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
new file mode 100644
index 000000000..417c0a515
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_base_script" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_type" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_script">
+ <return type="void">
+ </return>
+ <argument index="0" name="path" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="base_script" type="String" setter="set_base_script" getter="get_base_script">
+ </member>
+ <member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
new file mode 100644
index 000000000..1cad4480a
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Gets a variable's value.
+ </brief_description>
+ <description>
+ Returns a variable's value. "Var Name" must be supplied, with an optional type.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data (variant): [code]value[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_variable" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_variable">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="var_name" type="String" setter="set_variable" getter="get_variable">
+ The variable's name.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
new file mode 100644
index 000000000..fa3befa21
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Changes a variable's value.
+ </brief_description>
+ <description>
+ Changes a variable's value to the given input.
+ [b]Input Ports:[/b]
+ - Sequence
+ - Data (variant): [code]set[/code]
+ [b]Output Ports:[/b]
+ - Sequence
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_variable" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_variable">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="var_name" type="String" setter="set_variable" getter="get_variable">
+ The variable's name.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptWhile.xml b/modules/visual_script/doc_classes/VisualScriptWhile.xml
new file mode 100644
index 000000000..f94866099
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptWhile.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptWhile" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ Conditional loop.
+ </brief_description>
+ <description>
+ Loops while a condition is [code]true[/code]. Execution continues out the [code]exit[/code] Sequence port when the loop terminates.
+ [b]Input Ports:[/b]
+ - Sequence: [code]while(cond)[/code]
+ - Data (bool): [code]cond[/code]
+ [b]Output Ports:[/b]
+ - Sequence: [code]repeat[/code]
+ - Sequence: [code]exit[/code]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml
new file mode 100644
index 000000000..5474ee8b7
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptYield.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_wait_time">
+ <return type="float">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_yield_mode">
+ <return type="int" enum="VisualScriptYield.YieldMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_wait_time">
+ <return type="void">
+ </return>
+ <argument index="0" name="sec" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_yield_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="VisualScriptYield.YieldMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="mode" type="int" setter="set_yield_mode" getter="get_yield_mode" enum="VisualScriptYield.YieldMode">
+ </member>
+ <member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time">
+ </member>
+ </members>
+ <constants>
+ <constant name="YIELD_FRAME" value="1">
+ </constant>
+ <constant name="YIELD_PHYSICS_FRAME" value="2">
+ </constant>
+ <constant name="YIELD_WAIT" value="3">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
new file mode 100644
index 000000000..a3b698207
--- /dev/null
+++ b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_base_path" qualifiers="const">
+ <return type="NodePath">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_base_type" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_call_mode" qualifiers="const">
+ <return type="int" enum="VisualScriptYieldSignal.CallMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_signal" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_path">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_path" type="NodePath">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_base_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="base_type" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_call_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="VisualScriptYieldSignal.CallMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_signal">
+ <return type="void">
+ </return>
+ <argument index="0" name="signal" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
+ </member>
+ <member name="call_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptYieldSignal.CallMode">
+ </member>
+ <member name="node_path" type="NodePath" setter="set_base_path" getter="get_base_path">
+ </member>
+ <member name="signal" type="String" setter="set_signal" getter="get_signal">
+ </member>
+ </members>
+ <constants>
+ <constant name="CALL_MODE_SELF" value="0">
+ </constant>
+ <constant name="CALL_MODE_NODE_PATH" value="1">
+ </constant>
+ <constant name="CALL_MODE_INSTANCE" value="2">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index c50ba17c3..b6ce10381 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "register_types.h"
+#include "core/engine.h"
#include "io/resource_loader.h"
#include "visual_script.h"
#include "visual_script_builtin_funcs.h"
@@ -40,6 +41,9 @@
#include "visual_script_yield_nodes.h"
VisualScriptLanguage *visual_script_language = NULL;
+#ifdef TOOLS_ENABLED
+static _VisualScriptEditor *vs_editor_singleton = NULL;
+#endif
void register_visual_script_types() {
@@ -107,6 +111,10 @@ void register_visual_script_types() {
register_visual_script_expression_node();
#ifdef TOOLS_ENABLED
+ ClassDB::register_class<_VisualScriptEditor>();
+ vs_editor_singleton = memnew(_VisualScriptEditor);
+ Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", _VisualScriptEditor::get_singleton()));
+
VisualScriptEditor::register_editor();
#endif
}
@@ -119,6 +127,9 @@ void unregister_visual_script_types() {
#ifdef TOOLS_ENABLED
VisualScriptEditor::free_clipboard();
+ if (vs_editor_singleton) {
+ memdelete(vs_editor_singleton);
+ }
#endif
if (visual_script_language)
memdelete(visual_script_language);
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 765fe4c2f..0834bc81d 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -2644,6 +2644,11 @@ void VisualScriptLanguage::add_register_func(const String &p_name, VisualScriptN
register_funcs[p_name] = p_func;
}
+void VisualScriptLanguage::remove_register_func(const String &p_name) {
+ ERR_FAIL_COND(!register_funcs.has(p_name));
+ register_funcs.erase(p_name);
+}
+
Ref<VisualScriptNode> VisualScriptLanguage::create_node_from_name(const String &p_name) {
ERR_FAIL_COND_V(!register_funcs.has(p_name), Ref<VisualScriptNode>());
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 0f60b103c..3e3187694 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -600,6 +600,7 @@ public:
virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max);
void add_register_func(const String &p_name, VisualScriptNodeRegisterFunc p_func);
+ void remove_register_func(const String &p_name);
Ref<VisualScriptNode> create_node_from_name(const String &p_name);
void get_registered_node_names(List<String> *r_names);
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 03015df84..86cf5b27e 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "visual_script_editor.h"
+#include "core/script_language.h"
#include "editor/editor_node.h"
#include "editor/editor_resource_preview.h"
#include "os/input.h"
@@ -2764,6 +2765,23 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i
default_value_edit->set_position(Object::cast_to<Control>(p_button)->get_global_position() + Vector2(0, Object::cast_to<Control>(p_button)->get_size().y));
default_value_edit->set_size(Size2(1, 1));
+
+ if (pinfo.type == Variant::NODE_PATH) {
+
+ Node *edited_scene = get_tree()->get_edited_scene_root();
+ Node *script_node = _find_script_node(edited_scene, edited_scene, script);
+
+ if (script_node) {
+ //pick a node relative to the script, IF the script exists
+ pinfo.hint = PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE;
+ pinfo.hint_string = script_node->get_path();
+ } else {
+ //pick a path relative to edited scene
+ pinfo.hint = PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE;
+ pinfo.hint_string = get_tree()->get_edited_scene_root()->get_path();
+ }
+ }
+
if (default_value_edit->edit(NULL, pinfo.name, pinfo.type, existing, pinfo.hint, pinfo.hint_string)) {
if (pinfo.hint == PROPERTY_HINT_MULTILINE_TEXT)
default_value_edit->popup_centered_ratio();
@@ -3241,6 +3259,8 @@ void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("_member_rmb_selected", &VisualScriptEditor::_member_rmb_selected);
ClassDB::bind_method("_member_option", &VisualScriptEditor::_member_option);
+
+ ClassDB::bind_method("_update_available_nodes", &VisualScriptEditor::_update_available_nodes);
}
VisualScriptEditor::VisualScriptEditor() {
@@ -3425,6 +3445,8 @@ VisualScriptEditor::VisualScriptEditor() {
members->connect("item_rmb_selected", this, "_member_rmb_selected");
members->set_allow_rmb_select(true);
member_popup->connect("id_pressed", this, "_member_option");
+
+ _VisualScriptEditor::get_singleton()->connect("custom_nodes_updated", this, "_update_available_nodes");
}
VisualScriptEditor::~VisualScriptEditor() {
@@ -3468,4 +3490,42 @@ void VisualScriptEditor::register_editor() {
EditorNode::add_plugin_init_callback(register_editor_callback);
}
+Ref<VisualScriptNode> _VisualScriptEditor::create_node_custom(const String &p_name) {
+
+ Ref<VisualScriptCustomNode> node;
+ node.instance();
+ node->set_script(singleton->custom_nodes[p_name]);
+ return node;
+}
+
+_VisualScriptEditor *_VisualScriptEditor::singleton = NULL;
+Map<String, RefPtr> _VisualScriptEditor::custom_nodes;
+
+_VisualScriptEditor::_VisualScriptEditor() {
+ singleton = this;
+}
+
+_VisualScriptEditor::~_VisualScriptEditor() {
+ custom_nodes.clear();
+}
+
+void _VisualScriptEditor::add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script) {
+ String node_name = "custom/" + p_category + "/" + p_name;
+ custom_nodes.insert(node_name, p_script.get_ref_ptr());
+ VisualScriptLanguage::singleton->add_register_func(node_name, &_VisualScriptEditor::create_node_custom);
+ emit_signal("custom_nodes_updated");
+}
+
+void _VisualScriptEditor::remove_custom_node(const String &p_name, const String &p_category) {
+ String node_name = "custom/" + p_category + "/" + p_name;
+ custom_nodes.erase(node_name);
+ VisualScriptLanguage::singleton->remove_register_func(node_name);
+ emit_signal("custom_nodes_updated");
+}
+
+void _VisualScriptEditor::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("add_custom_node", "name", "category", "script"), &_VisualScriptEditor::add_custom_node);
+ ClassDB::bind_method(D_METHOD("remove_custom_node", "name", "category"), &_VisualScriptEditor::remove_custom_node);
+ ADD_SIGNAL(MethodInfo("custom_nodes_updated"));
+}
#endif
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index db54d1030..3d037e82e 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -278,6 +278,29 @@ public:
VisualScriptEditor();
~VisualScriptEditor();
};
+
+// Singleton
+class _VisualScriptEditor : public Object {
+ GDCLASS(_VisualScriptEditor, Object);
+
+ friend class VisualScriptLanguage;
+
+protected:
+ static void _bind_methods();
+ static _VisualScriptEditor *singleton;
+
+ static Map<String, RefPtr> custom_nodes;
+ static Ref<VisualScriptNode> create_node_custom(const String &p_name);
+
+public:
+ static _VisualScriptEditor *get_singleton() { return singleton; }
+
+ void add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script);
+ void remove_custom_node(const String &p_name, const String &p_category);
+
+ _VisualScriptEditor();
+ ~_VisualScriptEditor();
+};
#endif
#endif // VISUALSCRIPT_EDITOR_H
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index 897e910f2..07dca4b90 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -564,6 +564,9 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
} else if (id == "PI") {
r_token.type = TK_CONSTANT;
r_token.value = Math_PI;
+ } else if (id == "TAU") {
+ r_token.type = TK_CONSTANT;
+ r_token.value = Math_TAU;
} else if (id == "INF") {
r_token.type = TK_CONSTANT;
r_token.value = Math_INF;
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index a5dc6ffc1..cbe4438cd 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "visual_script_func_nodes.h"
+#include "engine.h"
#include "io/resource_loader.h"
#include "os/os.h"
-#include "project_settings.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
#include "visual_script_nodes.h"
@@ -344,7 +344,7 @@ void VisualScriptFunctionCall::set_singleton(const StringName &p_type) {
return;
singleton = p_type;
- Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
if (obj) {
base_type = obj->get_class();
}
@@ -380,7 +380,7 @@ void VisualScriptFunctionCall::_update_method_cache() {
} else if (call_mode == CALL_MODE_SINGLETON) {
- Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
if (obj) {
type = obj->get_class();
script = obj->get_script();
@@ -565,11 +565,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
if (call_mode != CALL_MODE_SINGLETON) {
property.usage = 0;
} else {
- List<ProjectSettings::Singleton> names;
- ProjectSettings::get_singleton()->get_singletons(&names);
+ List<Engine::Singleton> names;
+ Engine::get_singleton()->get_singletons(&names);
property.hint = PROPERTY_HINT_ENUM;
String sl;
- for (List<ProjectSettings::Singleton>::Element *E = names.front(); E; E = E->next()) {
+ for (List<Engine::Singleton>::Element *E = names.front(); E; E = E->next()) {
if (sl != String())
sl += ",";
sl += E->get().name;
@@ -603,7 +603,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
property.hint_string = itos(get_visual_script()->get_instance_id());
} else if (call_mode == CALL_MODE_SINGLETON) {
- Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
if (obj) {
property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE;
property.hint_string = itos(obj->get_instance_id());
@@ -879,7 +879,7 @@ public:
} break;
case VisualScriptFunctionCall::CALL_MODE_SINGLETON: {
- Object *object = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *object = Engine::get_singleton()->get_singleton_object(singleton);
if (!object) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str = "Invalid singleton name: '" + String(singleton) + "'";
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index d3cd839cf..05ff629d1 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "visual_script_nodes.h"
+#include "engine.h"
#include "global_constants.h"
#include "os/input.h"
#include "os/os.h"
@@ -1776,8 +1777,8 @@ VisualScriptBasicTypeConstant::VisualScriptBasicTypeConstant() {
const char *VisualScriptMathConstant::const_name[MATH_CONSTANT_MAX] = {
"One",
"PI",
- "PIx2",
"PI/2",
+ "TAU",
"E",
"Sqrt2",
"INF",
@@ -1787,8 +1788,8 @@ const char *VisualScriptMathConstant::const_name[MATH_CONSTANT_MAX] = {
double VisualScriptMathConstant::const_value[MATH_CONSTANT_MAX] = {
1.0,
Math_PI,
- Math_PI * 2,
Math_PI * 0.5,
+ Math_TAU,
2.71828182845904523536,
Math::sqrt(2.0),
Math_INF,
@@ -1886,8 +1887,8 @@ void VisualScriptMathConstant::_bind_methods() {
BIND_ENUM_CONSTANT(MATH_CONSTANT_ONE);
BIND_ENUM_CONSTANT(MATH_CONSTANT_PI);
- BIND_ENUM_CONSTANT(MATH_CONSTANT_2PI);
BIND_ENUM_CONSTANT(MATH_CONSTANT_HALF_PI);
+ BIND_ENUM_CONSTANT(MATH_CONSTANT_TAU);
BIND_ENUM_CONSTANT(MATH_CONSTANT_E);
BIND_ENUM_CONSTANT(MATH_CONSTANT_SQRT2);
BIND_ENUM_CONSTANT(MATH_CONSTANT_INF);
@@ -1976,13 +1977,13 @@ public:
VisualScriptNodeInstance *VisualScriptEngineSingleton::instance(VisualScriptInstance *p_instance) {
VisualScriptNodeInstanceEngineSingleton *instance = memnew(VisualScriptNodeInstanceEngineSingleton);
- instance->singleton = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ instance->singleton = Engine::get_singleton()->get_singleton_object(singleton);
return instance;
}
VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess *p_inputs, int p_output) const {
- Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
TypeGuess tg;
tg.type = Variant::OBJECT;
if (obj) {
@@ -2000,11 +2001,11 @@ void VisualScriptEngineSingleton::_bind_methods() {
String cc;
- List<ProjectSettings::Singleton> singletons;
+ List<Engine::Singleton> singletons;
- ProjectSettings::get_singleton()->get_singletons(&singletons);
+ Engine::get_singleton()->get_singletons(&singletons);
- for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
+ for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
if (E->get().name == "VS" || E->get().name == "PS" || E->get().name == "PS2D" || E->get().name == "AS" || E->get().name == "TS" || E->get().name == "SS" || E->get().name == "SS2D")
continue; //skip these, too simple named
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index 421409b26..6648f57e7 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -474,8 +474,8 @@ public:
enum MathConstant {
MATH_CONSTANT_ONE,
MATH_CONSTANT_PI,
- MATH_CONSTANT_2PI,
MATH_CONSTANT_HALF_PI,
+ MATH_CONSTANT_TAU,
MATH_CONSTANT_E,
MATH_CONSTANT_SQRT2,
MATH_CONSTANT_INF,
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
index 9d2d0feb9..55a112585 100644
--- a/modules/vorbis/SCsub
+++ b/modules/vorbis/SCsub
@@ -5,6 +5,8 @@ Import('env_modules')
env_vorbis = env_modules.Clone()
+stub = True
+
# Thirdparty source files
if env['builtin_libvorbis']:
thirdparty_dir = "#thirdparty/libvorbis/"
@@ -45,5 +47,9 @@ if env['builtin_libvorbis']:
if env['builtin_libogg']:
env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
-# Godot source files
-env_vorbis.add_source_files(env.modules_sources, "*.cpp")
+if not stub:
+ # Module files
+ env_vorbis.add_source_files(env.modules_sources, "*.cpp")
+else:
+ # Module files
+ env_vorbis.add_source_files(env.modules_sources, "stub/register_types.cpp")
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 6235799fc..9fb6fa819 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -106,8 +106,6 @@ int AudioStreamPlaybackOGGVorbis::mix(int16_t *p_buffer, int p_frames) {
break;
}
-//printf("to mix %i - mix me %i bytes\n",to_mix,to_mix*stream_channels*sizeof(int16_t));
-
#ifdef BIG_ENDIAN_ENABLED
long ret = ov_read(&vf, (char *)p_buffer, todo * stream_channels * sizeof(int16_t), 1, 2, 1, &current_section);
#else
@@ -359,7 +357,7 @@ void AudioStreamPlaybackOGGVorbis::set_paused(bool p_paused) {
paused = p_paused;
}
-bool AudioStreamPlaybackOGGVorbis::is_paused(bool p_paused) const {
+bool AudioStreamPlaybackOGGVorbis::is_paused() const {
return paused;
}
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index 79eadec56..5000d03fd 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -85,7 +85,7 @@ public:
virtual void set_loop_restart_time(float p_time) { loop_restart_time = p_time; }
virtual void set_paused(bool p_paused);
- virtual bool is_paused(bool p_paused) const;
+ virtual bool is_paused() const;
virtual void set_loop(bool p_enable);
virtual bool has_loop() const;
diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py
index ef5daca05..5f133eba9 100644
--- a/modules/vorbis/config.py
+++ b/modules/vorbis/config.py
@@ -1,8 +1,5 @@
-
def can_build(platform):
-# return True
- return False
-
+ return True
def configure(env):
pass
diff --git a/modules/vorbis/stub/register_types.cpp b/modules/vorbis/stub/register_types.cpp
new file mode 100644
index 000000000..b93d89043
--- /dev/null
+++ b/modules/vorbis/stub/register_types.cpp
@@ -0,0 +1,36 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+// Dummy module as libvorbis is needed by other modules (theora ...)
+
+void register_vorbis_types() {}
+
+void unregister_vorbis_types() {}
diff --git a/modules/vorbis/stub/register_types.h b/modules/vorbis/stub/register_types.h
new file mode 100644
index 000000000..e7cde7a66
--- /dev/null
+++ b/modules/vorbis/stub/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_vorbis_types();
+void unregister_vorbis_types();
diff --git a/modules/webm/config.py b/modules/webm/config.py
index ef5daca05..0374bb36f 100644
--- a/modules/webm/config.py
+++ b/modules/webm/config.py
@@ -1,8 +1,14 @@
-
def can_build(platform):
-# return True
- return False
-
+ return True
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "ResourceImporterWebm",
+ "VideoStreamWebm",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/webm/doc_classes/ResourceImporterWebm.xml b/modules/webm/doc_classes/ResourceImporterWebm.xml
new file mode 100644
index 000000000..dcba351e3
--- /dev/null
+++ b/modules/webm/doc_classes/ResourceImporterWebm.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="ResourceImporterWebm" inherits="ResourceImporter" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/webm/doc_classes/VideoStreamWebm.xml b/modules/webm/doc_classes/VideoStreamWebm.xml
new file mode 100644
index 000000000..9a430f6b0
--- /dev/null
+++ b/modules/webm/doc_classes/VideoStreamWebm.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VideoStreamWebm" inherits="VideoStream" category="Core" version="3.0-alpha">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_file">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_file">
+ <return type="void">
+ </return>
+ <argument index="0" name="file" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="file" type="String" setter="set_file" getter="get_file">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index fd8d762a5..73ba17d18 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -298,7 +298,7 @@ if webm_cpu_x86:
if not yasm_found:
webm_cpu_x86 = False
- print "YASM is necessary for WebM SIMD optimizations."
+ print("YASM is necessary for WebM SIMD optimizations.")
webm_simd_optimizations = False
@@ -345,7 +345,7 @@ if webm_cpu_arm:
webm_simd_optimizations = True
if webm_simd_optimizations == False:
- print "WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!"
+ print("WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!")
env_libvpx.add_source_files(env.modules_sources, libvpx_sources)
diff --git a/modules/webm/register_types.cpp b/modules/webm/register_types.cpp
index 892d1b842..669c9997f 100644
--- a/modules/webm/register_types.cpp
+++ b/modules/webm/register_types.cpp
@@ -28,19 +28,18 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
-
+#include "resource_importer_webm.h"
#include "video_stream_webm.h"
-static ResourceFormatLoaderVideoStreamWebm *webm_stream_loader = NULL;
-
void register_webm_types() {
- webm_stream_loader = memnew(ResourceFormatLoaderVideoStreamWebm);
- ResourceLoader::add_resource_format_loader(webm_stream_loader);
+#ifdef TOOLS_ENABLED
+ Ref<ResourceImporterWebm> webm_import;
+ webm_import.instance();
+ ResourceFormatImporter::get_singleton()->add_importer(webm_import);
+#endif
ClassDB::register_class<VideoStreamWebm>();
}
void unregister_webm_types() {
-
- memdelete(webm_stream_loader);
}
diff --git a/modules/webm/resource_importer_webm.cpp b/modules/webm/resource_importer_webm.cpp
new file mode 100644
index 000000000..5db3d4df2
--- /dev/null
+++ b/modules/webm/resource_importer_webm.cpp
@@ -0,0 +1,95 @@
+/*************************************************************************/
+/* resource_importer_webm.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "resource_importer_webm.h"
+
+#include "io/resource_saver.h"
+#include "os/file_access.h"
+#include "scene/resources/texture.h"
+#include "video_stream_webm.h"
+
+String ResourceImporterWebm::get_importer_name() const {
+
+ return "Webm";
+}
+
+String ResourceImporterWebm::get_visible_name() const {
+
+ return "Webm";
+}
+void ResourceImporterWebm::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("webm");
+}
+
+String ResourceImporterWebm::get_save_extension() const {
+ return "webmstr";
+}
+
+String ResourceImporterWebm::get_resource_type() const {
+
+ return "VideoStreamWebm";
+}
+
+bool ResourceImporterWebm::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
+
+ return true;
+}
+
+int ResourceImporterWebm::get_preset_count() const {
+ return 0;
+}
+String ResourceImporterWebm::get_preset_name(int p_idx) const {
+
+ return String();
+}
+
+void ResourceImporterWebm::get_import_options(List<ImportOption> *r_options, int p_preset) const {
+
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true));
+}
+
+Error ResourceImporterWebm::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) {
+
+ FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ);
+ if (!f) {
+ ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
+ }
+ memdelete(f);
+
+ VideoStreamWebm *stream = memnew(VideoStreamWebm);
+ stream->set_file(p_source_file);
+
+ Ref<VideoStreamWebm> webm_stream = Ref<VideoStreamWebm>(stream);
+
+ return ResourceSaver::save(p_save_path + ".webmstr", webm_stream);
+}
+
+ResourceImporterWebm::ResourceImporterWebm() {
+}
diff --git a/modules/webm/resource_importer_webm.h b/modules/webm/resource_importer_webm.h
new file mode 100644
index 000000000..4cedd1598
--- /dev/null
+++ b/modules/webm/resource_importer_webm.h
@@ -0,0 +1,55 @@
+/*************************************************************************/
+/* resource_importer_webm.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef RESOURCEIMPORTERWEBM_H
+#define RESOURCEIMPORTERWEBM_H
+
+#include "io/resource_import.h"
+
+class ResourceImporterWebm : public ResourceImporter {
+ GDCLASS(ResourceImporterWebm, ResourceImporter)
+public:
+ virtual String get_importer_name() const;
+ virtual String get_visible_name() const;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual String get_save_extension() const;
+ virtual String get_resource_type() const;
+
+ virtual int get_preset_count() const;
+ virtual String get_preset_name(int p_idx) const;
+
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL);
+
+ ResourceImporterWebm();
+};
+
+#endif // RESOURCEIMPORTERWEBM_H
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 2ec6b2747..0fc9df5b5 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -35,10 +35,13 @@
#include "mkvparser/mkvparser.h"
#include "os/file_access.h"
+#include "os/os.h"
#include "project_settings.h"
#include "thirdparty/misc/yuv2rgb.h"
+#include "servers/audio_server.h"
+
#include <string.h>
class MkvReader : public mkvparser::IMkvReader {
@@ -47,6 +50,8 @@ public:
MkvReader(const String &p_file) {
file = FileAccess::open(p_file, FileAccess::READ);
+
+ ERR_EXPLAIN("Failed loading resource: '" + p_file + "';");
ERR_FAIL_COND(!file);
}
~MkvReader() {
@@ -113,14 +118,14 @@ bool VideoStreamPlaybackWebm::open_file(const String &p_file) {
webm = memnew(WebMDemuxer(new MkvReader(file_name), 0, audio_track));
if (webm->isOpen()) {
- video = memnew(VPXDecoder(*webm, 8)); //TODO: Detect CPU threads
+ video = memnew(VPXDecoder(*webm, OS::get_singleton()->get_processor_count()));
if (video->isOpen()) {
audio = memnew(OpusVorbisDecoder(*webm));
if (audio->isOpen()) {
audio_frame = memnew(WebMFrame);
- pcm = (int16_t *)memalloc(sizeof(int16_t) * audio->getBufferSamples() * webm->getChannels());
+ pcm = (float *)memalloc(sizeof(float) * audio->getBufferSamples() * webm->getChannels());
} else {
memdelete(audio);
@@ -183,7 +188,7 @@ void VideoStreamPlaybackWebm::set_paused(bool p_paused) {
paused = p_paused;
}
-bool VideoStreamPlaybackWebm::is_paused(bool p_paused) const {
+bool VideoStreamPlaybackWebm::is_paused() const {
return paused;
}
@@ -222,11 +227,18 @@ Ref<Texture> VideoStreamPlaybackWebm::get_texture() {
return texture;
}
+
void VideoStreamPlaybackWebm::update(float p_delta) {
if ((!playing || paused) || !video)
return;
+ time += p_delta;
+
+ if (time < video_pos) {
+ return;
+ }
+
bool audio_buffer_full = false;
if (samples_offset > -1) {
@@ -245,13 +257,15 @@ void VideoStreamPlaybackWebm::update(float p_delta) {
}
const bool hasAudio = (audio && mix_callback);
- while ((hasAudio && (!audio_buffer_full || !has_enough_video_frames())) || (!hasAudio && video_frames_pos == 0)) {
+ while ((hasAudio && !audio_buffer_full && !has_enough_video_frames()) ||
+ (!hasAudio && video_frames_pos == 0)) {
- if (hasAudio && !audio_buffer_full && audio_frame->isValid() && audio->getPCMS16(*audio_frame, pcm, num_decoded_samples) && num_decoded_samples > 0) {
+ if (hasAudio && !audio_buffer_full && audio_frame->isValid() &&
+ audio->getPCMF(*audio_frame, pcm, num_decoded_samples) && num_decoded_samples > 0) {
const int mixed = mix_callback(mix_udata, pcm, num_decoded_samples);
- if (mixed != num_decoded_samples) {
+ if (mixed != num_decoded_samples) {
samples_offset = mixed;
audio_buffer_full = true;
}
@@ -273,72 +287,61 @@ void VideoStreamPlaybackWebm::update(float p_delta) {
++video_frames_pos;
};
- const double video_delay = video->getFramesDelay() * video_frame_delay;
-
- bool want_this_frame = false;
- while (video_frames_pos > 0 && !want_this_frame) {
+ bool video_frame_done = false;
+ while (video_frames_pos > 0 && !video_frame_done) {
WebMFrame *video_frame = video_frames[0];
- if (video_frame->time <= time + video_delay) {
- if (video->decode(*video_frame)) {
+ // It seems VPXDecoder::decode has to be executed even though we might skip this frame
+ if (video->decode(*video_frame)) {
- VPXDecoder::IMAGE_ERROR err;
- VPXDecoder::Image image;
+ VPXDecoder::IMAGE_ERROR err;
+ VPXDecoder::Image image;
- while ((err = video->getImage(image)) != VPXDecoder::NO_FRAME) {
+ if (should_process(*video_frame)) {
- want_this_frame = (time - video_frame->time <= video_frame_delay);
+ if ((err = video->getImage(image)) != VPXDecoder::NO_FRAME) {
- if (want_this_frame) {
+ if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) {
- if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) {
+ PoolVector<uint8_t>::Write w = frame_data.write();
+ bool converted = false;
- PoolVector<uint8_t>::Write w = frame_data.write();
- bool converted = false;
+ if (image.chromaShiftW == 1 && image.chromaShiftH == 1) {
- if (image.chromaShiftW == 1 && image.chromaShiftH == 1) {
+ yuv420_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
+ // libyuv::I420ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
+ converted = true;
+ } else if (image.chromaShiftW == 1 && image.chromaShiftH == 0) {
- yuv420_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
- // libyuv::I420ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
- converted = true;
- } else if (image.chromaShiftW == 1 && image.chromaShiftH == 0) {
+ yuv422_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
+ // libyuv::I422ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
+ converted = true;
+ } else if (image.chromaShiftW == 0 && image.chromaShiftH == 0) {
- yuv422_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
- // libyuv::I422ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
- converted = true;
- } else if (image.chromaShiftW == 0 && image.chromaShiftH == 0) {
+ yuv444_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
+ // libyuv::I444ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
+ converted = true;
+ } else if (image.chromaShiftW == 2 && image.chromaShiftH == 0) {
- yuv444_2_rgb8888(w.ptr(), image.planes[0], image.planes[2], image.planes[1], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2, 0);
- // libyuv::I444ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
- converted = true;
- } else if (image.chromaShiftW == 2 && image.chromaShiftH == 0) {
-
- // libyuv::I411ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
- // converted = true;
- }
-
- if (converted)
- texture->set_data(Image(image.w, image.h, 0, Image::FORMAT_RGBA8, frame_data)); //Zero copy send to visual server
+ // libyuv::I411ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h);
+ // converted = true;
}
- break;
+ if (converted) {
+ Ref<Image> img = memnew(Image(image.w, image.h, 0, Image::FORMAT_RGBA8, frame_data));
+ texture->set_data(img); //Zero copy send to visual server
+ video_frame_done = true;
+ }
}
}
}
-
- video_frame_delay = video_frame->time - video_pos;
- video_pos = video_frame->time;
-
- memmove(video_frames, video_frames + 1, (--video_frames_pos) * sizeof(void *));
- video_frames[video_frames_pos] = video_frame;
- } else {
-
- break;
}
- }
- time += p_delta;
+ video_pos = video_frame->time;
+ memmove(video_frames, video_frames + 1, (--video_frames_pos) * sizeof(void *));
+ video_frames[video_frames_pos] = video_frame;
+ }
if (video_frames_pos == 0 && webm->isEOS())
stop();
@@ -372,6 +375,11 @@ inline bool VideoStreamPlaybackWebm::has_enough_video_frames() const {
return false;
}
+bool VideoStreamPlaybackWebm::should_process(WebMFrame &video_frame) {
+ const double audio_delay = AudioServer::get_singleton()->get_output_delay();
+ return video_frame.time >= time + audio_delay + delay_compensation;
+}
+
void VideoStreamPlaybackWebm::delete_pointers() {
if (pcm)
@@ -395,34 +403,6 @@ void VideoStreamPlaybackWebm::delete_pointers() {
/**/
-RES ResourceFormatLoaderVideoStreamWebm::load(const String &p_path, const String &p_original_path, Error *r_error) {
-
- Ref<VideoStreamWebm> stream = memnew(VideoStreamWebm);
- stream->set_file(p_path);
- if (r_error)
- *r_error = OK;
- return stream;
-}
-
-void ResourceFormatLoaderVideoStreamWebm::get_recognized_extensions(List<String> *p_extensions) const {
-
- p_extensions->push_back("webm");
-}
-bool ResourceFormatLoaderVideoStreamWebm::handles_type(const String &p_type) const {
-
- return (p_type == "VideoStream" || p_type == "VideoStreamWebm");
-}
-
-String ResourceFormatLoaderVideoStreamWebm::get_resource_type(const String &p_path) const {
-
- const String exl = p_path.get_extension().to_lower();
- if (exl == "webm")
- return "VideoStreamWebm";
- return "";
-}
-
-/**/
-
VideoStreamWebm::VideoStreamWebm()
: audio_track(0) {}
@@ -439,6 +419,19 @@ void VideoStreamWebm::set_file(const String &p_file) {
file = p_file;
}
+String VideoStreamWebm::get_file() {
+
+ return file;
+}
+
+void VideoStreamWebm::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamWebm::set_file);
+ ClassDB::bind_method(D_METHOD("get_file"), &VideoStreamWebm::get_file);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_file", "get_file");
+}
+
void VideoStreamWebm::set_audio_track(int p_track) {
audio_track = p_track;
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index fc0720967..f7dd16a38 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -60,7 +60,7 @@ class VideoStreamPlaybackWebm : public VideoStreamPlayback {
PoolVector<uint8_t> frame_data;
Ref<ImageTexture> texture;
- int16_t *pcm;
+ float *pcm;
public:
VideoStreamPlaybackWebm();
@@ -74,7 +74,7 @@ public:
virtual bool is_playing() const;
virtual void set_paused(bool p_paused);
- virtual bool is_paused(bool p_paused) const;
+ virtual bool is_paused() const;
virtual void set_loop(bool p_enable);
virtual bool has_loop() const;
@@ -95,6 +95,7 @@ public:
private:
inline bool has_enough_video_frames() const;
+ bool should_process(WebMFrame &video_frame);
void delete_pointers();
};
@@ -103,27 +104,21 @@ private:
class VideoStreamWebm : public VideoStream {
- GDCLASS(VideoStreamWebm, VideoStream)
+ GDCLASS(VideoStreamWebm, VideoStream);
+ RES_BASE_EXTENSION("webmstr");
String file;
int audio_track;
+protected:
+ static void _bind_methods();
+
public:
VideoStreamWebm();
virtual Ref<VideoStreamPlayback> instance_playback();
virtual void set_file(const String &p_file);
+ String get_file();
virtual void set_audio_track(int p_track);
};
-
-/**/
-
-class ResourceFormatLoaderVideoStreamWebm : public ResourceFormatLoader {
-
-public:
- virtual RES load(const String &p_path, const String &p_original_path, Error *r_error);
- virtual void get_recognized_extensions(List<String> *p_extensions) const;
- virtual bool handles_type(const String &p_type) const;
- virtual String get_resource_type(const String &p_path) const;
-};
diff --git a/modules/webp/config.py b/modules/webp/config.py
index fb920482f..5f133eba9 100644
--- a/modules/webp/config.py
+++ b/modules/webp/config.py
@@ -1,7 +1,5 @@
-
def can_build(platform):
return True
-
def configure(env):
pass