summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYRIGHT.txt11
-rw-r--r--doc/classes/@GlobalScope.xml2
-rw-r--r--doc/classes/Area.xml16
-rw-r--r--doc/classes/Area2D.xml16
-rw-r--r--doc/classes/CollisionObject.xml4
-rw-r--r--doc/classes/CollisionObject2D.xml4
-rw-r--r--doc/classes/Control.xml2
-rw-r--r--doc/classes/EditorPlugin.xml4
-rw-r--r--doc/classes/EditorProperty.xml2
-rw-r--r--doc/classes/GraphEdit.xml2
-rw-r--r--doc/classes/ProjectSettings.xml8
-rw-r--r--doc/classes/RigidBody.xml8
-rw-r--r--doc/classes/RigidBody2D.xml8
-rw-r--r--doc/classes/SceneTree.xml6
-rw-r--r--doc/classes/ScriptCreateDialog.xml2
-rw-r--r--doc/classes/ScriptEditor.xml4
-rw-r--r--doc/classes/Tree.xml6
-rw-r--r--doc/classes/VisibilityNotifier.xml4
-rw-r--r--doc/classes/VisibilityNotifier2D.xml4
-rw-r--r--editor/SCsub12
-rw-r--r--editor/create_dialog.cpp6
-rw-r--r--editor/doc/doc_data.cpp6
-rw-r--r--editor/editor_builders.py262
-rw-r--r--editor/editor_help.cpp24
-rw-r--r--editor/project_export.cpp47
-rw-r--r--editor/project_export.h1
-rw-r--r--modules/websocket/emws_client.cpp18
-rw-r--r--modules/websocket/lws_client.cpp15
-rw-r--r--modules/websocket/lws_helper.h47
-rw-r--r--modules/websocket/lws_server.cpp3
-rw-r--r--platform/windows/SCsub11
-rw-r--r--platform/windows/os_windows.cpp8
-rw-r--r--scene/2d/collision_object_2d.cpp2
-rw-r--r--scene/2d/physics_body_2d.cpp12
-rw-r--r--scene/3d/area.cpp10
-rw-r--r--scene/3d/collision_object.cpp2
-rw-r--r--scene/3d/physics_body.cpp10
-rw-r--r--scene/gui/graph_edit.cpp2
-rw-r--r--scene/gui/tree.cpp8
-rw-r--r--scene/main/scene_tree.cpp6
-rw-r--r--scene/resources/tile_set.cpp2
-rw-r--r--servers/visual/shader_language.cpp47
42 files changed, 247 insertions, 427 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 4ba80941e0..49c602eb84 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -10,8 +10,9 @@
# all corresponding files (also recursively in subfolders), apart from those
# with a more explicit copyright statement.
#
-# Licenses are given with their SPDX identifier, and are all included in
-# plain text at the end of this file (in alphabetical order).
+# Licenses are given with their debian/copyright short name (or SPDX identifier
+# if no standard short name exists) and are all included in plain text at the
+# end of this file (in alphabetical order).
#
# Disclaimer for thirdparty libraries:
# ------------------------------------
@@ -139,7 +140,7 @@ Files: ./thirdparty/cvtt/
Comment: Convection Texture Tools Stand-Alone Kernels
Copyright: 2018, Eric Lasota
2018, Microsoft Corp.
-License: MIT
+License: Expat
Files: ./thirdparty/enet/
Comment: ENet
@@ -373,7 +374,7 @@ Files: ./thirdparty/tinyexr/
Comment: TinyEXR
Copyright: 2014-2017, Syoyo Fujita
2002, Industrial Light & Magic, a division of Lucas Digital Ltd. LLC
-License: BSD-3-Clause
+License: BSD-3-clause
Files: ./thirdparty/zlib/
Comment: zlib
@@ -383,7 +384,7 @@ License: Zlib
Files: ./thirdparty/zstd/
Comment: Zstandard
Copyright: 2016-2018, Facebook, Inc.
-License: BSD-3-Clause
+License: BSD-3-clause
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index d2c6a853ad..5a53e7cb05 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -29,6 +29,8 @@
<member name="Geometry" type="Geometry" setter="" getter="">
[Geometry] singleton
</member>
+ <member name="GodotSharp" type="GodotSharp" setter="" getter="">
+ </member>
<member name="IP" type="IP" setter="" getter="">
[IP] singleton
</member>
diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml
index 5c56b5e21b..970d09a2ac 100644
--- a/doc/classes/Area.xml
+++ b/doc/classes/Area.xml
@@ -142,14 +142,14 @@
</members>
<signals>
<signal name="area_entered">
- <argument index="0" name="area" type="Object">
+ <argument index="0" name="area" type="Area">
</argument>
<description>
Emitted when another area enters.
</description>
</signal>
<signal name="area_exited">
- <argument index="0" name="area" type="Object">
+ <argument index="0" name="area" type="Area">
</argument>
<description>
Emitted when another area exits.
@@ -158,7 +158,7 @@
<signal name="area_shape_entered">
<argument index="0" name="area_id" type="int">
</argument>
- <argument index="1" name="area" type="Object">
+ <argument index="1" name="area" type="Area">
</argument>
<argument index="2" name="area_shape" type="int">
</argument>
@@ -171,7 +171,7 @@
<signal name="area_shape_exited">
<argument index="0" name="area_id" type="int">
</argument>
- <argument index="1" name="area" type="Object">
+ <argument index="1" name="area" type="Area">
</argument>
<argument index="2" name="area_shape" type="int">
</argument>
@@ -182,14 +182,14 @@
</description>
</signal>
<signal name="body_entered">
- <argument index="0" name="body" type="Object">
+ <argument index="0" name="body" type="Node">
</argument>
<description>
Emitted when a [PhysicsBody] object enters.
</description>
</signal>
<signal name="body_exited">
- <argument index="0" name="body" type="Object">
+ <argument index="0" name="body" type="Node">
</argument>
<description>
Emitted when a [PhysicsBody] object exits.
@@ -198,7 +198,7 @@
<signal name="body_shape_entered">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="Object">
+ <argument index="1" name="body" type="Node">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
@@ -211,7 +211,7 @@
<signal name="body_shape_exited">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="Object">
+ <argument index="1" name="body" type="Node">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml
index c50ccefc4c..b77a931201 100644
--- a/doc/classes/Area2D.xml
+++ b/doc/classes/Area2D.xml
@@ -130,14 +130,14 @@
</members>
<signals>
<signal name="area_entered">
- <argument index="0" name="area" type="Object">
+ <argument index="0" name="area" type="Area2D">
</argument>
<description>
Emitted when another area enters.
</description>
</signal>
<signal name="area_exited">
- <argument index="0" name="area" type="Object">
+ <argument index="0" name="area" type="Area2D">
</argument>
<description>
Emitted when another area exits.
@@ -146,7 +146,7 @@
<signal name="area_shape_entered">
<argument index="0" name="area_id" type="int">
</argument>
- <argument index="1" name="area" type="Object">
+ <argument index="1" name="area" type="Area2D">
</argument>
<argument index="2" name="area_shape" type="int">
</argument>
@@ -159,7 +159,7 @@
<signal name="area_shape_exited">
<argument index="0" name="area_id" type="int">
</argument>
- <argument index="1" name="area" type="Object">
+ <argument index="1" name="area" type="Area2D">
</argument>
<argument index="2" name="area_shape" type="int">
</argument>
@@ -170,14 +170,14 @@
</description>
</signal>
<signal name="body_entered">
- <argument index="0" name="body" type="Object">
+ <argument index="0" name="body" type="PhysicsBody2D">
</argument>
<description>
Emitted when a [PhysicsBody2D] object enters.
</description>
</signal>
<signal name="body_exited">
- <argument index="0" name="body" type="Object">
+ <argument index="0" name="body" type="PhysicsBody2D">
</argument>
<description>
Emitted when a [PhysicsBody2D] object exits.
@@ -186,7 +186,7 @@
<signal name="body_shape_entered">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="Object">
+ <argument index="1" name="body" type="PhysicsBody2D">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
@@ -199,7 +199,7 @@
<signal name="body_shape_exited">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="Object">
+ <argument index="1" name="body" type="PhysicsBody2D">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject.xml
index 22b9725121..5e4e740498 100644
--- a/doc/classes/CollisionObject.xml
+++ b/doc/classes/CollisionObject.xml
@@ -191,9 +191,9 @@
</members>
<signals>
<signal name="input_event">
- <argument index="0" name="camera" type="Object">
+ <argument index="0" name="camera" type="Node">
</argument>
- <argument index="1" name="event" type="Object">
+ <argument index="1" name="event" type="InputEvent">
</argument>
<argument index="2" name="click_position" type="Vector3">
</argument>
diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml
index 1ef72c0ca2..b507204f0d 100644
--- a/doc/classes/CollisionObject2D.xml
+++ b/doc/classes/CollisionObject2D.xml
@@ -204,9 +204,9 @@
</members>
<signals>
<signal name="input_event">
- <argument index="0" name="viewport" type="Object">
+ <argument index="0" name="viewport" type="Node">
</argument>
- <argument index="1" name="event" type="Object">
+ <argument index="1" name="event" type="InputEvent">
</argument>
<argument index="2" name="shape_idx" type="int">
</argument>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 8575a1f498..bbd0441a0b 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -723,7 +723,7 @@
</description>
</signal>
<signal name="gui_input">
- <argument index="0" name="ev" type="Object">
+ <argument index="0" name="ev" type="InputEvent">
</argument>
<description>
Emitted when the node receives an [InputEvent].
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index 5d2407adce..208780547e 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -445,13 +445,13 @@
</description>
</signal>
<signal name="resource_saved">
- <argument index="0" name="resource" type="Object">
+ <argument index="0" name="resource" type="Resource">
</argument>
<description>
</description>
</signal>
<signal name="scene_changed">
- <argument index="0" name="scene_root" type="Object">
+ <argument index="0" name="scene_root" type="Node">
</argument>
<description>
Emitted when user change scene. The argument is a root node of freshly opened scene.
diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml
index 32d3a2703d..7d09554330 100644
--- a/doc/classes/EditorProperty.xml
+++ b/doc/classes/EditorProperty.xml
@@ -98,7 +98,7 @@
<signal name="resource_selected">
<argument index="0" name="path" type="String">
</argument>
- <argument index="1" name="resource" type="Object">
+ <argument index="1" name="resource" type="Resource">
</argument>
<description>
</description>
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index 48e3c295f1..ce0b619d67 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -247,7 +247,7 @@
</description>
</signal>
<signal name="node_selected">
- <argument index="0" name="node" type="Object">
+ <argument index="0" name="node" type="Node">
</argument>
<description>
Emitted when a GraphNode is selected.
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 0bda5909ed..ad8c5f68da 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -576,6 +576,14 @@
<member name="memory/limits/multithreaded_server/rid_pool_prealloc" type="int" setter="" getter="">
This is used by servers when used in multi threading mode (servers and visual). RIDs are preallocated to avoid stalling the server requesting them on threads. If servers get stalled too often when loading resources in a thread, increase this number.
</member>
+ <member name="mono/debugger_agent/port" type="int" setter="" getter="">
+ </member>
+ <member name="mono/debugger_agent/wait_for_debugger" type="bool" setter="" getter="">
+ </member>
+ <member name="mono/debugger_agent/wait_timeout" type="int" setter="" getter="">
+ </member>
+ <member name="mono/export/include_scripts_content" type="bool" setter="" getter="">
+ </member>
<member name="network/limits/debugger_stdout/max_chars_per_second" type="int" setter="" getter="">
Maximum amount of characters allowed to send as output from the debugger. Over this value, content is dropped. This helps not to stall the debugger connection.
</member>
diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody.xml
index 4ae1ef8e94..eea1e0321b 100644
--- a/doc/classes/RigidBody.xml
+++ b/doc/classes/RigidBody.xml
@@ -168,14 +168,14 @@
</members>
<signals>
<signal name="body_entered">
- <argument index="0" name="body" type="Object">
+ <argument index="0" name="body" type="Node">
</argument>
<description>
Emitted when a body enters into contact with this one. Contact monitor and contacts reported must be enabled for this to work.
</description>
</signal>
<signal name="body_exited">
- <argument index="0" name="body" type="Object">
+ <argument index="0" name="body" type="Node">
</argument>
<description>
Emitted when a body shape exits contact with this one. Contact monitor and contacts reported must be enabled for this to work.
@@ -184,7 +184,7 @@
<signal name="body_shape_entered">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="Object">
+ <argument index="1" name="body" type="Node">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
@@ -198,7 +198,7 @@
<signal name="body_shape_exited">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="Object">
+ <argument index="1" name="body" type="Node">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml
index 2265c777c8..1f6b3934c2 100644
--- a/doc/classes/RigidBody2D.xml
+++ b/doc/classes/RigidBody2D.xml
@@ -173,14 +173,14 @@
</members>
<signals>
<signal name="body_entered">
- <argument index="0" name="body" type="Object">
+ <argument index="0" name="body" type="Node">
</argument>
<description>
Emitted when a body enters into contact with this one. [member contact_monitor] must be [code]true[/code] and [member contacts_reported] greater than [code]0[/code].
</description>
</signal>
<signal name="body_exited">
- <argument index="0" name="body" type="Object">
+ <argument index="0" name="body" type="Node">
</argument>
<description>
Emitted when a body exits contact with this one. [member contact_monitor] must be [code]true[/code] and [member contacts_reported] greater than [code]0[/code].
@@ -189,7 +189,7 @@
<signal name="body_shape_entered">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="Object">
+ <argument index="1" name="body" type="Node">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
@@ -202,7 +202,7 @@
<signal name="body_shape_exited">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="Object">
+ <argument index="1" name="body" type="Node">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index c85bee9b84..11362ee680 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -329,21 +329,21 @@
</description>
</signal>
<signal name="node_added">
- <argument index="0" name="node" type="Object">
+ <argument index="0" name="node" type="Node">
</argument>
<description>
Emitted whenever a node is added to the SceneTree.
</description>
</signal>
<signal name="node_configuration_warning_changed">
- <argument index="0" name="node" type="Object">
+ <argument index="0" name="node" type="Node">
</argument>
<description>
Emitted when a node's configuration changed. Only emitted in tool mode.
</description>
</signal>
<signal name="node_removed">
- <argument index="0" name="node" type="Object">
+ <argument index="0" name="node" type="Node">
</argument>
<description>
Emitted whenever a node is removed from the SceneTree.
diff --git a/doc/classes/ScriptCreateDialog.xml b/doc/classes/ScriptCreateDialog.xml
index a3ad3a778e..3de068dbcb 100644
--- a/doc/classes/ScriptCreateDialog.xml
+++ b/doc/classes/ScriptCreateDialog.xml
@@ -31,7 +31,7 @@
</methods>
<signals>
<signal name="script_created">
- <argument index="0" name="script" type="Object">
+ <argument index="0" name="script" type="Script">
</argument>
<description>
Emitted when the user clicks the OK button.
diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml
index 4bfd07fdad..435ab8aafc 100644
--- a/doc/classes/ScriptEditor.xml
+++ b/doc/classes/ScriptEditor.xml
@@ -70,14 +70,14 @@
</methods>
<signals>
<signal name="editor_script_changed">
- <argument index="0" name="script" type="Object">
+ <argument index="0" name="script" type="Script">
</argument>
<description>
Emitted when user changed active script. Argument is a freshly activated [Script].
</description>
</signal>
<signal name="script_close">
- <argument index="0" name="script" type="Object">
+ <argument index="0" name="script" type="Script">
</argument>
<description>
Emitted when editor is about to close the active script. Argument is a [Script] that is going to be closed.
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index 533df57564..5c24df5be2 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -244,7 +244,7 @@
</members>
<signals>
<signal name="button_pressed">
- <argument index="0" name="item" type="Object">
+ <argument index="0" name="item" type="TreeItem">
</argument>
<argument index="1" name="column" type="int">
</argument>
@@ -286,7 +286,7 @@
</description>
</signal>
<signal name="item_collapsed">
- <argument index="0" name="item" type="Object">
+ <argument index="0" name="item" type="TreeItem">
</argument>
<description>
Emitted when an item is collapsed by a click on the folding arrow.
@@ -324,7 +324,7 @@
</description>
</signal>
<signal name="multi_selected">
- <argument index="0" name="item" type="Object">
+ <argument index="0" name="item" type="TreeItem">
</argument>
<argument index="1" name="column" type="int">
</argument>
diff --git a/doc/classes/VisibilityNotifier.xml b/doc/classes/VisibilityNotifier.xml
index 2f22dc99bf..95da708420 100644
--- a/doc/classes/VisibilityNotifier.xml
+++ b/doc/classes/VisibilityNotifier.xml
@@ -26,14 +26,14 @@
</members>
<signals>
<signal name="camera_entered">
- <argument index="0" name="camera" type="Object">
+ <argument index="0" name="camera" type="Camera">
</argument>
<description>
Emitted when the VisibilityNotifier enters a [Camera]'s view.
</description>
</signal>
<signal name="camera_exited">
- <argument index="0" name="camera" type="Object">
+ <argument index="0" name="camera" type="Camera">
</argument>
<description>
Emitted when the VisibilityNotifier exits a [Camera]'s view.
diff --git a/doc/classes/VisibilityNotifier2D.xml b/doc/classes/VisibilityNotifier2D.xml
index b98f2794d2..aaaa9b63bb 100644
--- a/doc/classes/VisibilityNotifier2D.xml
+++ b/doc/classes/VisibilityNotifier2D.xml
@@ -36,14 +36,14 @@
</description>
</signal>
<signal name="viewport_entered">
- <argument index="0" name="viewport" type="Object">
+ <argument index="0" name="viewport" type="Viewport">
</argument>
<description>
Emitted when the VisibilityNotifier2D enters a [Viewport]'s view.
</description>
</signal>
<signal name="viewport_exited">
- <argument index="0" name="viewport" type="Object">
+ <argument index="0" name="viewport" type="Viewport">
</argument>
<description>
Emitted when the VisibilityNotifier2D exits a [Viewport]'s view.
diff --git a/editor/SCsub b/editor/SCsub
index d9bdf42d6f..6a4b06a97a 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -81,18 +81,6 @@ if env['tools']:
env.Depends('#editor/builtin_fonts.gen.h', flist)
env.CommandNoCache('#editor/builtin_fonts.gen.h', flist, run_in_subprocess(editor_builders.make_fonts_header))
- # Authors
- env.Depends('#editor/authors.gen.h', "../AUTHORS.md")
- env.CommandNoCache('#editor/authors.gen.h', "../AUTHORS.md", run_in_subprocess(editor_builders.make_authors_header))
-
- # Donors
- env.Depends('#editor/donors.gen.h', "../DONORS.md")
- env.CommandNoCache('#editor/donors.gen.h', "../DONORS.md", run_in_subprocess(editor_builders.make_donors_header))
-
- # License
- env.Depends('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"])
- env.CommandNoCache('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], run_in_subprocess(editor_builders.make_license_header))
-
env.add_source_files(env.editor_sources, "*.cpp")
env.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"])
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 8433f4ff7b..fd607e5b63 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -497,7 +497,11 @@ Object *CreateDialog::instance_selected() {
if (custom != String()) {
if (ScriptServer::is_global_class(custom)) {
- return EditorNode::get_editor_data().script_class_instance(custom);
+ Object *obj = EditorNode::get_editor_data().script_class_instance(custom);
+ Node *n = Object::cast_to<Node>(obj);
+ if (n)
+ n->set_name(custom);
+ return obj;
}
return EditorNode::get_editor_data().instance_custom_type(selected->get_text(0), custom);
} else {
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index fe1cf3484e..bbe52bdc76 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -382,7 +382,11 @@ void DocData::generate(bool p_basic_types) {
PropertyInfo arginfo = EV->get().arguments[i];
ArgumentDoc argument;
argument.name = arginfo.name;
- argument.type = Variant::get_type_name(arginfo.type);
+ if (arginfo.type == Variant::OBJECT && arginfo.class_name != StringName()) {
+ argument.type = arginfo.class_name.operator String();
+ } else {
+ argument.type = Variant::get_type_name(arginfo.type);
+ }
signal.arguments.push_back(argument);
}
diff --git a/editor/editor_builders.py b/editor/editor_builders.py
index 6c2f9e298e..fa037980c2 100644
--- a/editor/editor_builders.py
+++ b/editor/editor_builders.py
@@ -146,267 +146,5 @@ def make_translations_header(target, source, env):
g.close()
-
-def make_authors_header(target, source, env):
-
- sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"]
- sections_id = ["dev_founders", "dev_lead", "dev_manager", "dev_names"]
-
- src = source[0]
- dst = target[0]
- f = open_utf8(src, "r")
- g = open_utf8(dst, "w")
-
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _EDITOR_AUTHORS_H\n")
- g.write("#define _EDITOR_AUTHORS_H\n")
-
- current_section = ""
- reading = False
-
- def close_section():
- g.write("\t0\n")
- g.write("};\n")
-
- for line in f:
- if reading:
- if line.startswith(" "):
- g.write("\t\"" + escape_string(line.strip()) + "\",\n")
- continue
- if line.startswith("## "):
- if reading:
- close_section()
- reading = False
- for i in range(len(sections)):
- if line.strip().endswith(sections[i]):
- current_section = escape_string(sections_id[i])
- reading = True
- g.write("static const char *" + current_section + "[] = {\n")
- break
-
- if reading:
- close_section()
-
- g.write("#endif\n")
-
- g.close()
- f.close()
-
-def make_donors_header(target, source, env):
-
- sections = ["Platinum sponsors", "Gold sponsors", "Mini sponsors", "Gold donors", "Silver donors", "Bronze donors"]
- sections_id = ["donor_s_plat", "donor_s_gold", "donor_s_mini", "donor_gold", "donor_silver", "donor_bronze"]
-
- src = source[0]
- dst = target[0]
- f = open_utf8(src, "r")
- g = open_utf8(dst, "w")
-
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _EDITOR_DONORS_H\n")
- g.write("#define _EDITOR_DONORS_H\n")
-
- current_section = ""
- reading = False
-
- def close_section():
- g.write("\t0\n")
- g.write("};\n")
-
- for line in f:
- if reading >= 0:
- if line.startswith(" "):
- g.write("\t\"" + escape_string(line.strip()) + "\",\n")
- continue
- if line.startswith("## "):
- if reading:
- close_section()
- reading = False
- for i in range(len(sections)):
- if line.strip().endswith(sections[i]):
- current_section = escape_string(sections_id[i])
- reading = True
- g.write("static const char *" + current_section + "[] = {\n")
- break
-
- if reading:
- close_section()
-
- g.write("#endif\n")
-
- g.close()
- f.close()
-
-
-def make_license_header(target, source, env):
-
- src_copyright = source[0]
- src_license = source[1]
- dst = target[0]
- f = open_utf8(src_license, "r")
- fc = open_utf8(src_copyright, "r")
- g = open_utf8(dst, "w")
-
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _EDITOR_LICENSE_H\n")
- g.write("#define _EDITOR_LICENSE_H\n")
- g.write("static const char *about_license =")
-
- for line in f:
- escaped_string = escape_string(line.strip())
- g.write("\n\t\"" + escaped_string + "\\n\"")
-
- g.write(";\n")
-
- tp_current = 0
- tp_file = ""
- tp_comment = ""
- tp_copyright = ""
- tp_license = ""
-
- tp_licensename = ""
- tp_licensebody = ""
-
- tp = []
- tp_licensetext = []
- for line in fc:
- if line.startswith("#"):
- continue
-
- if line.startswith("Files:"):
- tp_file = line[6:].strip()
- tp_current = 1
- elif line.startswith("Comment:"):
- tp_comment = line[8:].strip()
- tp_current = 2
- elif line.startswith("Copyright:"):
- tp_copyright = line[10:].strip()
- tp_current = 3
- elif line.startswith("License:"):
- if tp_current != 0:
- tp_license = line[8:].strip()
- tp_current = 4
- else:
- tp_licensename = line[8:].strip()
- tp_current = 5
- elif line.startswith(" "):
- if tp_current == 1:
- tp_file += "\n" + line.strip()
- elif tp_current == 3:
- tp_copyright += "\n" + line.strip()
- elif tp_current == 5:
- if line.strip() == ".":
- tp_licensebody += "\n"
- else:
- tp_licensebody += line[1:]
- else:
- if tp_current != 0:
- if tp_current == 5:
- tp_licensetext.append([tp_licensename, tp_licensebody])
-
- tp_licensename = ""
- tp_licensebody = ""
- else:
- added = False
- for i in tp:
- if i[0] == tp_comment:
- i[1].append([tp_file, tp_copyright, tp_license])
- added = True
- break
- if not added:
- tp.append([tp_comment,[[tp_file, tp_copyright, tp_license]]])
-
- tp_file = []
- tp_comment = ""
- tp_copyright = []
- tp_license = ""
- tp_current = 0
-
- tp_licensetext.append([tp_licensename, tp_licensebody])
-
- about_thirdparty = ""
- about_tp_copyright_count = ""
- about_tp_license = ""
- about_tp_copyright = ""
- about_tp_file = ""
-
- for i in tp:
- about_thirdparty += "\t\"" + i[0] + "\",\n"
- about_tp_copyright_count += str(len(i[1])) + ", "
- for j in i[1]:
- file_body = ""
- copyright_body = ""
- for k in j[0].split("\n"):
- if file_body != "":
- file_body += "\\n\"\n"
- escaped_string = escape_string(k.strip())
- file_body += "\t\"" + escaped_string
- for k in j[1].split("\n"):
- if copyright_body != "":
- copyright_body += "\\n\"\n"
- escaped_string = escape_string(k.strip())
- copyright_body += "\t\"" + escaped_string
-
- about_tp_file += "\t" + file_body + "\",\n"
- about_tp_copyright += "\t" + copyright_body + "\",\n"
- about_tp_license += "\t\"" + j[2] + "\",\n"
-
- about_license_name = ""
- about_license_body = ""
-
- for i in tp_licensetext:
- body = ""
- for j in i[1].split("\n"):
- if body != "":
- body += "\\n\"\n"
- escaped_string = escape_string(j.strip())
- body += "\t\"" + escaped_string
-
- about_license_name += "\t\"" + i[0] + "\",\n"
- about_license_body += "\t" + body + "\",\n"
-
- g.write("static const char *about_thirdparty[] = {\n")
- g.write(about_thirdparty)
- g.write("\t0\n")
- g.write("};\n")
- g.write("#define THIRDPARTY_COUNT " + str(len(tp)) + "\n")
-
- g.write("static const int about_tp_copyright_count[] = {\n\t")
- g.write(about_tp_copyright_count)
- g.write("0\n};\n")
-
- g.write("static const char *about_tp_file[] = {\n")
- g.write(about_tp_file)
- g.write("\t0\n")
- g.write("};\n")
-
- g.write("static const char *about_tp_copyright[] = {\n")
- g.write(about_tp_copyright)
- g.write("\t0\n")
- g.write("};\n")
-
- g.write("static const char *about_tp_license[] = {\n")
- g.write(about_tp_license)
- g.write("\t0\n")
- g.write("};\n")
-
- g.write("static const char *about_license_name[] = {\n")
- g.write(about_license_name)
- g.write("\t0\n")
- g.write("};\n")
- g.write("#define LICENSE_COUNT " + str(len(tp_licensetext)) + "\n")
-
- g.write("static const char *about_license_body[] = {\n")
- g.write(about_license_body)
- g.write("\t0\n")
- g.write("};\n")
-
- g.write("#endif\n")
-
- g.close()
- fc.close()
- f.close()
-
-
if __name__ == '__main__':
subprocess_main(globals())
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 5a0a49d577..d84b9bff91 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -225,7 +225,6 @@ bool EditorHelpSearch::IncrementalSearch::work(uint64_t slot) {
void EditorHelpSearch::_update_search() {
search_options->clear();
- search_options->set_hide_root(true);
String term = search_box->get_text();
if (term.length() < 2)
@@ -307,6 +306,7 @@ EditorHelpSearch::EditorHelpSearch() {
search_box->connect("text_changed", this, "_text_changed");
search_box->connect("gui_input", this, "_sbox_input");
search_options = memnew(Tree);
+ search_options->set_hide_root(true);
vbc->add_margin_child(TTR("Matches:"), search_options, true);
get_ok()->set_text(TTR("Open"));
get_ok()->set_disabled(true);
@@ -397,6 +397,16 @@ void EditorHelpIndex::_notification(int p_what) {
//_update_icons
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
search_box->set_clear_button_enabled(true);
+
+ bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines");
+ Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color");
+
+ if (enable_rl) {
+ class_list->add_constant_override("draw_relationship_lines", 1);
+ class_list->add_color_override("relationship_line_color", rl_color);
+ } else {
+ class_list->add_constant_override("draw_relationship_lines", 0);
+ }
}
}
@@ -410,7 +420,6 @@ void EditorHelpIndex::_update_class_list() {
class_list->clear();
tree_item_map.clear();
TreeItem *root = class_list->create_item();
- class_list->set_hide_root(true);
String filter = search_box->get_text().strip_edges();
String to_select = "";
@@ -489,10 +498,21 @@ EditorHelpIndex::EditorHelpIndex() {
class_list = memnew(Tree);
vbc->add_margin_child(TTR("Class List:") + " ", class_list, true);
+ class_list->set_hide_root(true);
class_list->set_v_size_flags(SIZE_EXPAND_FILL);
class_list->connect("item_activated", this, "_tree_item_selected");
+ bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines");
+ Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color");
+
+ if (enable_rl) {
+ class_list->add_constant_override("draw_relationship_lines", 1);
+ class_list->add_color_override("relationship_line_color", rl_color);
+ } else {
+ class_list->add_constant_override("draw_relationship_lines", 0);
+ }
+
get_ok()->set_text(TTR("Open"));
set_title(TTR("Search Classes"));
}
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 019d5d382c..df79317549 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -723,6 +723,25 @@ void ProjectExportDialog::_open_export_template_manager() {
hide();
}
+void ProjectExportDialog::_validate_export_path(const String &p_path) {
+ // Disable export via OK button or Enter key if LineEdit has an empty filename
+ bool invalid_path = (p_path.get_file().get_basename() == "");
+
+ // Check if state change before needlessly messing with signals
+ if (invalid_path && export_project->get_ok()->is_disabled())
+ return;
+ if (!invalid_path && !export_project->get_ok()->is_disabled())
+ return;
+
+ if (invalid_path) {
+ export_project->get_ok()->set_disabled(true);
+ export_project->get_line_edit()->disconnect("text_entered", export_project, "_file_entered");
+ } else {
+ export_project->get_ok()->set_disabled(false);
+ export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered");
+ }
+}
+
void ProjectExportDialog::_export_project() {
Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current());
@@ -732,12 +751,19 @@ void ProjectExportDialog::_export_project() {
export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
export_project->clear_filters();
- export_project->set_current_file(default_filename);
String extension = platform->get_binary_extension(current);
-
if (extension != String()) {
export_project->add_filter("*." + extension + " ; " + platform->get_name() + " Export");
+ export_project->set_current_file(default_filename + "." + extension);
+ } else {
+ export_project->set_current_file(default_filename);
+ }
+
+ // Ensure that signal is connected if previous attempt left it disconnected with _validate_export_path
+ if (!export_project->get_line_edit()->is_connected("text_entered", export_project, "_file_entered")) {
+ export_project->get_ok()->set_disabled(false);
+ export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered");
}
export_project->set_mode(FileDialog::MODE_SAVE_FILE);
@@ -746,7 +772,7 @@ void ProjectExportDialog::_export_project() {
void ProjectExportDialog::_export_project_to_path(const String &p_path) {
// Save this name for use in future exports (but drop the file extension)
- default_filename = p_path.get_basename().get_file();
+ default_filename = p_path.get_file().get_basename();
EditorSettings::get_singleton()->set_project_metadata("export_options", "default_filename", default_filename);
Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current());
@@ -785,11 +811,13 @@ void ProjectExportDialog::_bind_methods() {
ClassDB::bind_method("_export_pck_zip", &ProjectExportDialog::_export_pck_zip);
ClassDB::bind_method("_export_pck_zip_selected", &ProjectExportDialog::_export_pck_zip_selected);
ClassDB::bind_method("_open_export_template_manager", &ProjectExportDialog::_open_export_template_manager);
+ ClassDB::bind_method("_validate_export_path", &ProjectExportDialog::_validate_export_path);
ClassDB::bind_method("_export_project", &ProjectExportDialog::_export_project);
ClassDB::bind_method("_export_project_to_path", &ProjectExportDialog::_export_project_to_path);
ClassDB::bind_method("_custom_features_changed", &ProjectExportDialog::_custom_features_changed);
ClassDB::bind_method("_tab_changed", &ProjectExportDialog::_tab_changed);
}
+
ProjectExportDialog::ProjectExportDialog() {
set_title(TTR("Export"));
@@ -942,6 +970,9 @@ ProjectExportDialog::ProjectExportDialog() {
get_cancel()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Export PCK/Zip"));
export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
+ export_button->connect("pressed", this, "_export_project");
+ // Disable initially before we select a valid preset
+ export_button->set_disabled(true);
export_pck_zip = memnew(FileDialog);
export_pck_zip->add_filter("*.zip ; ZIP File");
@@ -981,7 +1012,7 @@ ProjectExportDialog::ProjectExportDialog() {
export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
add_child(export_project);
export_project->connect("file_selected", this, "_export_project_to_path");
- export_button->connect("pressed", this, "_export_project");
+ export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path");
export_debug = memnew(CheckButton);
export_debug->set_text(TTR("Export With Debug"));
@@ -997,10 +1028,14 @@ ProjectExportDialog::ProjectExportDialog() {
editor_icons = "EditorIcons";
- default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", String());
-
+ default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", "");
+ // If no default set, use project name
if (default_filename == "") {
+ // If no project name defined, use a sane default
default_filename = ProjectSettings::get_singleton()->get("application/config/name");
+ if (default_filename == "") {
+ default_filename = "UnnamedProject";
+ }
}
}
diff --git a/editor/project_export.h b/editor/project_export.h
index 1f8723febd..552c6d7faf 100644
--- a/editor/project_export.h
+++ b/editor/project_export.h
@@ -136,6 +136,7 @@ private:
void _export_pck_zip();
void _export_pck_zip_selected(const String &p_path);
+ void _validate_export_path(const String &p_path);
void _export_project();
void _export_project_to_path(const String &p_path);
diff --git a/modules/websocket/emws_client.cpp b/modules/websocket/emws_client.cpp
index 00c36ebb47..836b564de8 100644
--- a/modules/websocket/emws_client.cpp
+++ b/modules/websocket/emws_client.cpp
@@ -62,25 +62,23 @@ EMSCRIPTEN_KEEPALIVE void _esws_on_close(void *obj, int code, char *reason, int
Error EMWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port, bool p_ssl, PoolVector<String> p_protocols) {
+ String proto_string = p_protocols.join(",");
String str = "ws://";
- String proto_string = "";
if (p_ssl)
str = "wss://";
str += p_host + ":" + itos(p_port) + p_path;
- for (int i = 0; i < p_protocols.size(); i++) {
- proto_string += p_protocols[i];
- proto_string += ",";
- }
- if (proto_string == "")
- proto_string = "binary,";
-
- proto_string = proto_string.substr(0, proto_string.length() - 1);
_is_connecting = true;
/* clang-format off */
int peer_sock = EM_ASM_INT({
- var socket = new WebSocket(UTF8ToString($1), UTF8ToString($2).split(","));
+ var proto_str = UTF8ToString($2);
+ var socket = null;
+ if (proto_str) {
+ socket = new WebSocket(UTF8ToString($1), proto_str.split(","));
+ } else {
+ socket = new WebSocket(UTF8ToString($1));
+ }
var c_ptr = Module.IDHandler.get($0);
socket.binaryType = "arraybuffer";
diff --git a/modules/websocket/lws_client.cpp b/modules/websocket/lws_client.cpp
index ac31daa108..09f6422058 100644
--- a/modules/websocket/lws_client.cpp
+++ b/modules/websocket/lws_client.cpp
@@ -48,12 +48,10 @@ Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
ERR_FAIL_COND_V(!addr.is_valid(), ERR_INVALID_PARAMETER);
- // prepare protocols
- if (p_protocols.size() == 0) // default to binary protocol
- p_protocols.append("binary");
+ // Prepare protocols
_lws_make_protocols(this, &LWSClient::_lws_gd_callback, p_protocols, &_lws_ref);
- // init lws client
+ // Init lws client
struct lws_context_creation_info info;
struct lws_client_connect_info i;
@@ -87,7 +85,10 @@ Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
strncpy(pbuf, p_path.utf8().get_data(), 2048);
i.context = context;
- i.protocol = _lws_ref->lws_names;
+ if (p_protocols.size() > 0)
+ i.protocol = _lws_ref->lws_names;
+ else
+ i.protocol = NULL;
i.address = abuf;
i.host = hbuf;
i.path = pbuf;
@@ -134,13 +135,13 @@ int LWSClient::_handle_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
_on_error();
destroy_context();
- return -1; // we should close the connection (would probably happen anyway)
+ return -1; // We should close the connection (would probably happen anyway)
case LWS_CALLBACK_CLIENT_CLOSED:
peer->close();
destroy_context();
_on_disconnect();
- return 0; // we can end here
+ return 0; // We can end here
case LWS_CALLBACK_CLIENT_RECEIVE:
peer->read_wsi(in, len);
diff --git a/modules/websocket/lws_helper.h b/modules/websocket/lws_helper.h
index 85a1e3769f..70256ccf16 100644
--- a/modules/websocket/lws_helper.h
+++ b/modules/websocket/lws_helper.h
@@ -105,53 +105,54 @@ static bool _lws_poll(struct lws_context *context, _LWSRef *ref) {
}
/*
- * prepare the protocol_structs to be fed to context
- * also prepare the protocol string used by the client
+ * Prepare the protocol_structs to be fed to context.
+ * Also prepare the protocol string used by the client.
*/
static void _lws_make_protocols(void *p_obj, lws_callback_function *p_callback, PoolVector<String> p_names, _LWSRef **r_lws_ref) {
- /* the input strings might go away after this call,
- * we need to copy them. Will clear them when
- * destroying the context */
+ // The input strings might go away after this call, we need to copy them.
+ // We will clear them when destroying the context.
int i;
int len = p_names.size();
size_t data_size = sizeof(struct LWSPeer::PeerData);
PoolVector<String>::Read pnr = p_names.read();
- /*
- * This is a reference connecting the object with lws
- * keep track of status, mallocs, etc.
- * Must survive as long the context
- * Must be freed manually when context creation fails.
- */
+ // This is a reference connecting the object with lws keep track of status, mallocs, etc.
+ // Must survive as long the context.
+ // Must be freed manually when context creation fails.
_LWSRef *ref = _lws_create_ref(p_obj);
- /* LWS protocol structs */
+ // LWS protocol structs.
ref->lws_structs = (struct lws_protocols *)memalloc(sizeof(struct lws_protocols) * (len + 2));
memset(ref->lws_structs, 0, sizeof(struct lws_protocols) * (len + 2));
CharString strings = p_names.join(",").ascii();
int str_len = strings.length();
- /* Joined string of protocols, double the size: comma separated first, NULL separated last */
- ref->lws_names = (char *)memalloc((str_len + 1) * 2); /* plus the terminator */
+ // Joined string of protocols, double the size: comma separated first, NULL separated last
+ ref->lws_names = (char *)memalloc((str_len + 1) * 2); // Plus the terminator
char *names_ptr = ref->lws_names;
struct lws_protocols *structs_ptr = ref->lws_structs;
- copymem(names_ptr, strings.get_data(), str_len);
- names_ptr[str_len] = '\0'; /* NULL terminator */
- /* NULL terminated strings to be used in protocol structs */
- copymem(&names_ptr[str_len + 1], strings.get_data(), str_len);
- names_ptr[(str_len * 2) + 1] = '\0'; /* NULL terminator */
+ // Comma separated protocols string to be used in client Sec-WebSocket-Protocol header
+ if (str_len > 0)
+ copymem(names_ptr, strings.get_data(), str_len);
+ names_ptr[str_len] = '\0'; // NULL terminator
+
+ // NULL terminated protocol strings to be used in protocol structs
+ if (str_len > 0)
+ copymem(&names_ptr[str_len + 1], strings.get_data(), str_len);
+ names_ptr[(str_len * 2) + 1] = '\0'; // NULL terminator
int pos = str_len + 1;
- /* the first protocol is always http-only */
- structs_ptr[0].name = "http-only";
+ // The first protocol is the default for any http request (before upgrade).
+ // It is also used as the websocket protocol when no subprotocol is specified.
+ structs_ptr[0].name = "default";
structs_ptr[0].callback = p_callback;
structs_ptr[0].per_session_data_size = data_size;
structs_ptr[0].rx_buffer_size = LWS_BUF_SIZE;
structs_ptr[0].tx_packet_size = LWS_PACKET_SIZE;
- /* add user defined protocols */
+ // Add user defined protocols
for (i = 0; i < len; i++) {
structs_ptr[i + 1].name = (const char *)&names_ptr[pos];
structs_ptr[i + 1].callback = p_callback;
@@ -161,7 +162,7 @@ static void _lws_make_protocols(void *p_obj, lws_callback_function *p_callback,
pos += pnr[i].ascii().length() + 1;
names_ptr[pos - 1] = '\0';
}
- /* add protocols terminator */
+ // Add protocols terminator
structs_ptr[len + 1].name = NULL;
structs_ptr[len + 1].callback = NULL;
structs_ptr[len + 1].per_session_data_size = 0;
diff --git a/modules/websocket/lws_server.cpp b/modules/websocket/lws_server.cpp
index bb724bce9c..4a614f6933 100644
--- a/modules/websocket/lws_server.cpp
+++ b/modules/websocket/lws_server.cpp
@@ -41,9 +41,6 @@ Error LWSServer::listen(int p_port, PoolVector<String> p_protocols, bool gd_mp_a
struct lws_context_creation_info info;
memset(&info, 0, sizeof info);
- if (p_protocols.size() == 0) // default to binary protocol
- p_protocols.append(String("binary"));
-
// Prepare lws protocol structs
_lws_make_protocols(this, &LWSServer::_lws_gd_callback, p_protocols, &_lws_ref);
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index 53ed3bf887..586533e817 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -7,6 +7,7 @@ from platform_methods import run_in_subprocess
import platform_windows_builders
common_win = [
+ "godot_win.cpp",
"context_gl_win.cpp",
"crash_handler_win.cpp",
"os_windows.cpp",
@@ -17,17 +18,17 @@ common_win = [
"windows_terminal_logger.cpp"
]
-restarget = "godot_res" + env["OBJSUFFIX"]
+res_file = 'godot_res.rc'
-obj = env.RES(restarget, 'godot_res.rc')
+res_target = "godot_res" + env["OBJSUFFIX"]
-common_win.append(obj)
+res_obj = env.RES(res_target, res_file)
-prog = env.add_program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
+prog = env.add_program('#bin/godot', common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
if env['vsproj']:
- env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
+ env.vs_srcs = env.vs_srcs + ["platform/windows/" + res_file]
for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 7009df8e57..4ca6f36629 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -249,7 +249,11 @@ bool OS_Windows::can_draw() const {
#define MI_WP_SIGNATURE 0xFF515700
#define SIGNATURE_MASK 0xFFFFFF00
+// Keeping the name suggested by Microsoft, but this macro really answers:
+// Is this mouse event emulated from touch or pen input?
#define IsPenEvent(dw) (((dw)&SIGNATURE_MASK) == MI_WP_SIGNATURE)
+// This one tells whether the event comes from touchscreen (and not from pen)
+#define IsTouchEvent(dw) (IsPenEvent(dw) && ((dw)&0x80))
void OS_Windows::_touch_event(bool p_pressed, float p_x, float p_y, int idx) {
@@ -469,7 +473,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (input->is_emulating_mouse_from_touch()) {
// Universal translation enabled; ignore OS translation
LPARAM extra = GetMessageExtraInfo();
- if (IsPenEvent(extra)) {
+ if (IsTouchEvent(extra)) {
break;
}
}
@@ -560,7 +564,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (input->is_emulating_mouse_from_touch()) {
// Universal translation enabled; ignore OS translations for left button
LPARAM extra = GetMessageExtraInfo();
- if (IsPenEvent(extra)) {
+ if (IsTouchEvent(extra)) {
break;
}
}
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 1e2184bd41..7ade74e8a6 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -384,7 +384,7 @@ void CollisionObject2D::_bind_methods() {
BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "viewport"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx")));
- ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "viewport"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx")));
+ ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "viewport", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
ADD_SIGNAL(MethodInfo("mouse_exited"));
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 1ac7799ec5..710ff43252 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -396,13 +396,13 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap
node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree);
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree);
if (in_scene)
- emit_signal(SceneStringNames::get_singleton()->body_exited, obj);
+ emit_signal(SceneStringNames::get_singleton()->body_exited, node);
}
contact_monitor->body_map.erase(E);
}
if (node && in_scene) {
- emit_signal(SceneStringNames::get_singleton()->body_shape_exited, objid, obj, p_body_shape, p_local_shape);
+ emit_signal(SceneStringNames::get_singleton()->body_shape_exited, objid, node, p_body_shape, p_local_shape);
}
}
}
@@ -1046,10 +1046,10 @@ void RigidBody2D::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "applied_force"), "set_applied_force", "get_applied_force");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "applied_torque"), "set_applied_torque", "get_applied_torque");
- ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape")));
- ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape")));
- ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body")));
- ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body")));
+ ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape")));
+ ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape")));
+ ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
+ ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("sleeping_state_changed"));
BIND_ENUM_CONSTANT(MODE_RIGID);
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index 6ea980ec97..40a1029201 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -243,7 +243,7 @@ void Area::_clear_monitoring() {
emit_signal(SceneStringNames::get_singleton()->body_shape_exited, E->key(), node, E->get().shapes[i].body_shape, E->get().shapes[i].area_shape);
}
- emit_signal(SceneStringNames::get_singleton()->body_exited, obj);
+ emit_signal(SceneStringNames::get_singleton()->body_exited, node);
node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree);
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree);
@@ -699,10 +699,10 @@ void Area::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_reverb_uniformity", "amount"), &Area::set_reverb_uniformity);
ClassDB::bind_method(D_METHOD("get_reverb_uniformity"), &Area::get_reverb_uniformity);
- ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "area_shape")));
- ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "area_shape")));
- ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body")));
- ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body")));
+ ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "area_shape")));
+ ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "area_shape")));
+ ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
+ ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("area_shape_entered", PropertyInfo(Variant::INT, "area_id"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area"), PropertyInfo(Variant::INT, "area_shape"), PropertyInfo(Variant::INT, "self_shape")));
ADD_SIGNAL(MethodInfo("area_shape_exited", PropertyInfo(Variant::INT, "area_id"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area"), PropertyInfo(Variant::INT, "area_shape"), PropertyInfo(Variant::INT, "self_shape")));
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index e19e45b263..99b8ce0567 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -148,7 +148,7 @@ void CollisionObject::_bind_methods() {
BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
- ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
+ ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
ADD_SIGNAL(MethodInfo("mouse_exited"));
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 441f2f2549..1cb156ac73 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -407,7 +407,7 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape,
node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree);
node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree);
if (in_tree)
- emit_signal(SceneStringNames::get_singleton()->body_exited, obj);
+ emit_signal(SceneStringNames::get_singleton()->body_exited, node);
}
contact_monitor->body_map.erase(E);
@@ -1011,10 +1011,10 @@ void RigidBody::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "angular_velocity"), "set_angular_velocity", "get_angular_velocity");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_damp", PROPERTY_HINT_RANGE, "-1,128,0.01"), "set_angular_damp", "get_angular_damp");
- ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape")));
- ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape")));
- ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body")));
- ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body")));
+ ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape")));
+ ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape")));
+ ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
+ ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("sleeping_state_changed"));
BIND_ENUM_CONSTANT(MODE_RIGID);
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index a7163adbe6..8797ab6fd3 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -1279,7 +1279,7 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("disconnection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot")));
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2, "p_position")));
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
- ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node")));
+ ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_position")));
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
ADD_SIGNAL(MethodInfo("_begin_node_move"));
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 6f09488b64..eaf7ad7670 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1419,7 +1419,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
while (c) {
- if (cache.draw_relationship_lines == 1) {
+ if (cache.draw_relationship_lines == 1 && (c->get_parent() != root || c->get_parent() == root && !hide_root)) {
int root_ofs = children_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
int parent_ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h / 2) - cache.offset + p_draw_ofs;
@@ -3831,16 +3831,16 @@ void Tree::_bind_methods() {
ADD_SIGNAL(MethodInfo("item_selected"));
ADD_SIGNAL(MethodInfo("cell_selected"));
- ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::OBJECT, "item"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::BOOL, "selected")));
+ ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::BOOL, "selected")));
ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::VECTOR2, "position")));
ADD_SIGNAL(MethodInfo("empty_tree_rmb_selected", PropertyInfo(Variant::VECTOR2, "position")));
ADD_SIGNAL(MethodInfo("item_edited"));
ADD_SIGNAL(MethodInfo("item_rmb_edited"));
ADD_SIGNAL(MethodInfo("item_custom_button_pressed"));
ADD_SIGNAL(MethodInfo("item_double_clicked"));
- ADD_SIGNAL(MethodInfo("item_collapsed", PropertyInfo(Variant::OBJECT, "item")));
+ ADD_SIGNAL(MethodInfo("item_collapsed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem")));
//ADD_SIGNAL( MethodInfo("item_doubleclicked" ) );
- ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::OBJECT, "item"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("custom_popup_edited", PropertyInfo(Variant::BOOL, "arrow_clicked")));
ADD_SIGNAL(MethodInfo("item_activated"));
ADD_SIGNAL(MethodInfo("column_title_pressed", PropertyInfo(Variant::INT, "column")));
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 1d23650a1e..11268cc5c6 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1862,10 +1862,10 @@ void SceneTree::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "multiplayer_poll"), "set_multiplayer_poll_enabled", "is_multiplayer_poll_enabled");
ADD_SIGNAL(MethodInfo("tree_changed"));
- ADD_SIGNAL(MethodInfo("node_added", PropertyInfo(Variant::OBJECT, "node")));
- ADD_SIGNAL(MethodInfo("node_removed", PropertyInfo(Variant::OBJECT, "node")));
+ ADD_SIGNAL(MethodInfo("node_added", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
+ ADD_SIGNAL(MethodInfo("node_removed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("screen_resized"));
- ADD_SIGNAL(MethodInfo("node_configuration_warning_changed", PropertyInfo(Variant::OBJECT, "node")));
+ ADD_SIGNAL(MethodInfo("node_configuration_warning_changed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("idle_frame"));
ADD_SIGNAL(MethodInfo("physics_frame"));
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 8112d6be00..23074b4bae 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -940,6 +940,8 @@ void TileSet::_bind_methods() {
ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile);
ClassDB::bind_method(D_METHOD("autotile_set_bitmask_mode", "id", "mode"), &TileSet::autotile_set_bitmask_mode);
ClassDB::bind_method(D_METHOD("autotile_get_bitmask_mode", "id"), &TileSet::autotile_get_bitmask_mode);
+ ClassDB::bind_method(D_METHOD("autotile_set_size", "id", "size"), &TileSet::autotile_set_size);
+ ClassDB::bind_method(D_METHOD("autotile_get_size", "id"), &TileSet::autotile_get_size);
ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name);
ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name);
ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture);
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index ffb130048f..9500f35732 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -2368,9 +2368,9 @@ int ShaderLanguage::get_cardinality(DataType p_type) {
2,
3,
4,
- 2,
- 3,
4,
+ 9,
+ 16,
1,
1,
1,
@@ -3307,7 +3307,9 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
ERR_FAIL_COND_V(op->arguments[0]->type != Node::TYPE_VARIABLE, p_node);
- DataType base = get_scalar_type(op->get_datatype());
+ DataType type = op->get_datatype();
+ DataType base = get_scalar_type(type);
+ int cardinality = get_cardinality(type);
Vector<ConstantNode::Value> values;
@@ -3318,19 +3320,9 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
ConstantNode *cn = static_cast<ConstantNode *>(op->arguments[i]);
if (get_scalar_type(cn->datatype) == base) {
-
- int cardinality = get_cardinality(op->arguments[i]->get_datatype());
- if (cn->values.size() == cardinality) {
-
- for (int j = 0; j < cn->values.size(); j++) {
- values.push_back(cn->values[j]);
- }
- } else if (cn->values.size() == 1) {
-
- for (int j = 0; j < cardinality; j++) {
- values.push_back(cn->values[0]);
- }
- } // else: should be filtered by the parser as it's an invalid constructor
+ for (int j = 0; j < cn->values.size(); j++) {
+ values.push_back(cn->values[j]);
+ }
} else if (get_scalar_type(cn->datatype) == cn->datatype) {
ConstantNode::Value v;
@@ -3347,6 +3339,29 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
}
}
+ if (values.size() == 1) {
+ if (type >= TYPE_MAT2 && type <= TYPE_MAT4) {
+ ConstantNode::Value value = values[0];
+ ConstantNode::Value zero;
+ zero.real = 0.0f;
+ int size = 2 + (type - TYPE_MAT2);
+
+ values.clear();
+ for (int i = 0; i < size; i++) {
+ for (int j = 0; j < size; j++) {
+ values.push_back(i == j ? value : zero);
+ }
+ }
+ } else {
+ for (int i = 1; i < cardinality; i++) {
+ values.push_back(values[0]);
+ }
+ }
+ } else if (values.size() != cardinality) {
+ ERR_PRINT("Failed to reduce expression, values and cardinality mismatch.");
+ return p_node;
+ }
+
ConstantNode *cn = alloc_node<ConstantNode>();
cn->datatype = op->get_datatype();
cn->values = values;