summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct3
-rw-r--r--core/io/pck_packer.cpp4
-rw-r--r--core/io/pck_packer.h2
-rw-r--r--core/math/basis.cpp12
-rw-r--r--core/math/bsp_tree.cpp4
-rw-r--r--core/message_queue.cpp3
-rw-r--r--core/ustring.cpp2
-rw-r--r--core/variant_call.cpp49
-rw-r--r--doc/classes/CharFXTransform.xml11
-rw-r--r--doc/classes/CollisionShape2D.xml1
-rw-r--r--doc/classes/HTTPClient.xml4
-rw-r--r--doc/classes/KinematicBody.xml2
-rw-r--r--doc/classes/Mesh.xml8
-rw-r--r--doc/classes/PCKPacker.xml15
-rw-r--r--doc/classes/Physics2DShapeQueryParameters.xml12
-rw-r--r--doc/classes/Physics2DShapeQueryResult.xml7
-rw-r--r--doc/classes/PhysicsShapeQueryParameters.xml10
-rw-r--r--doc/classes/PhysicsShapeQueryResult.xml8
-rw-r--r--doc/classes/PlaneShape.xml3
-rw-r--r--doc/classes/ProjectSettings.xml2
-rw-r--r--doc/classes/Shape.xml1
-rw-r--r--doc/classes/Shape2D.xml1
-rw-r--r--drivers/SCsub10
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp15
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp14
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp4
-rw-r--r--drivers/gles2/shaders/canvas.glsl4
-rw-r--r--drivers/gles2/shaders/scene.glsl3
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp18
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp4
-rw-r--r--drivers/gles3/shaders/canvas.glsl2
-rw-r--r--drivers/gles3/shaders/scene.glsl4
-rw-r--r--editor/animation_track_editor.cpp1
-rw-r--r--editor/code_editor.cpp30
-rw-r--r--editor/code_editor.h2
-rw-r--r--editor/collada/collada.cpp2
-rw-r--r--editor/dependency_editor.cpp1
-rw-r--r--editor/editor_data.cpp2
-rw-r--r--editor/editor_folding.cpp3
-rw-r--r--editor/editor_node.cpp27
-rw-r--r--editor/editor_properties.cpp2
-rw-r--r--editor/editor_themes.cpp23
-rw-r--r--editor/export_template_manager.cpp4
-rw-r--r--editor/find_in_files.cpp1
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp14
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp8
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp2
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp58
-rw-r--r--editor/plugins/tile_set_editor_plugin.h2
-rw-r--r--editor/project_export.cpp4
-rw-r--r--editor/project_manager.cpp7
-rw-r--r--editor/settings_config_dialog.cpp11
-rw-r--r--methods.py26
-rw-r--r--modules/SCsub2
-rw-r--r--modules/assimp/editor_scene_importer_assimp.cpp16
-rw-r--r--modules/assimp/import_utils.h8
-rw-r--r--modules/bullet/space_bullet.cpp4
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp1
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml5
-rw-r--r--modules/gdscript/gdscript.cpp3
-rw-r--r--modules/gdscript/gdscript_editor.cpp11
-rw-r--r--modules/gdscript/gdscript_functions.cpp20
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.cpp2
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp2
-rw-r--r--modules/mbedtls/crypto_mbedtls.cpp2
-rwxr-xr-xmodules/mbedtls/stream_peer_mbedtls.cpp5
-rw-r--r--modules/mono/build_scripts/godot_tools_build.py3
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeClient.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeConnection.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotTools.IdeConnection.csproj2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageComposer.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageParser.cs6
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/packages.config4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs24
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs6
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs6
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/BuildManager.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/BuildTab.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/CsProjOperations.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs26
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs3
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs54
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj19
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs3
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeServer.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs416
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs117
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Internals/ScriptClassParser.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs10
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Utils/User32Dll.cs10
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/packages.config5
-rw-r--r--modules/mono/glue/Managed/Files/StringExtensions.cs14
-rw-r--r--modules/mono/glue/Managed/Managed.csproj2
-rw-r--r--modules/recast/navigation_mesh_generator.cpp2
-rw-r--r--modules/visual_script/visual_script_nodes.cpp2
-rw-r--r--platform/osx/os_osx.mm8
-rw-r--r--platform/windows/detect.py9
-rw-r--r--scene/2d/collision_polygon_2d.cpp4
-rw-r--r--scene/2d/collision_shape_2d.cpp4
-rw-r--r--scene/2d/ray_cast_2d.cpp4
-rw-r--r--scene/3d/voxel_light_baker.cpp8
-rw-r--r--scene/animation/tween.cpp12
-rw-r--r--scene/animation/tween.h25
-rw-r--r--scene/gui/button.cpp7
-rw-r--r--scene/gui/item_list.cpp4
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/popup_menu.cpp16
-rw-r--r--scene/gui/rich_text_effect.cpp13
-rw-r--r--scene/gui/rich_text_effect.h2
-rw-r--r--scene/gui/rich_text_label.cpp3
-rw-r--r--scene/gui/spin_box.cpp4
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/text_edit.h59
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/resources/dynamic_font.cpp1
-rw-r--r--scene/resources/mesh.cpp1
-rw-r--r--scene/resources/segment_shape_2d.cpp6
-rw-r--r--scene/resources/texture.cpp1
-rw-r--r--scene/resources/theme.cpp15
-rw-r--r--scene/resources/visual_shader.cpp12
-rw-r--r--scene/resources/visual_shader_nodes.cpp1
-rw-r--r--servers/audio/effects/audio_effect_record.cpp5
-rw-r--r--servers/physics/joints/cone_twist_joint_sw.cpp2
-rw-r--r--servers/physics/joints/hinge_joint_sw.cpp2
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp2
-rw-r--r--servers/visual/shader_language.cpp2
-rw-r--r--thirdparty/vhacd/0003-fix-musl-build.patch15
-rw-r--r--thirdparty/vhacd/inc/vhacdMutex.h4
138 files changed, 1207 insertions, 413 deletions
diff --git a/SConstruct b/SConstruct
index 0e282a1f12..ce13c8bd2e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -68,8 +68,6 @@ env_base.AppendENVPath('PATH', os.getenv('PATH'))
env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
env_base.disabled_modules = []
env_base.use_ptrcall = False
-env_base.split_drivers = False
-env_base.split_modules = False
env_base.module_version_string = ""
env_base.msvc = False
@@ -129,6 +127,7 @@ opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=extra werro
opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
opts.Add(BoolVariable('vsproj', "Generate a Visual Studio solution", False))
opts.Add(EnumVariable('macports_clang', "Build using Clang from MacPorts", 'no', ('no', '5.0', 'devel')))
+opts.Add(BoolVariable('split_libmodules', "Split intermediate libmodules.a in smaller chunks to prevent exceeding linker command line size (forced to True when using MinGW)", False))
opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for a smaller executable", False))
opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced GUI nodes and behaviors", False))
opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 443f390bb7..011ebb1812 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -55,9 +55,9 @@ static void _pad(FileAccess *p_file, int p_bytes) {
void PCKPacker::_bind_methods() {
- ClassDB::bind_method(D_METHOD("pck_start", "pck_name", "alignment"), &PCKPacker::pck_start);
+ ClassDB::bind_method(D_METHOD("pck_start", "pck_name", "alignment"), &PCKPacker::pck_start, DEFVAL(0));
ClassDB::bind_method(D_METHOD("add_file", "pck_path", "source_path"), &PCKPacker::add_file);
- ClassDB::bind_method(D_METHOD("flush", "verbose"), &PCKPacker::flush);
+ ClassDB::bind_method(D_METHOD("flush", "verbose"), &PCKPacker::flush, DEFVAL(false));
};
Error PCKPacker::pck_start(const String &p_file, int p_alignment) {
diff --git a/core/io/pck_packer.h b/core/io/pck_packer.h
index 4df495b11f..f5661c55a1 100644
--- a/core/io/pck_packer.h
+++ b/core/io/pck_packer.h
@@ -54,7 +54,7 @@ class PCKPacker : public Reference {
Vector<File> files;
public:
- Error pck_start(const String &p_file, int p_alignment);
+ Error pck_start(const String &p_file, int p_alignment = 0);
Error add_file(const String &p_file, const String &p_src);
Error flush(bool p_verbose = false);
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index d77501c0f6..09d04a8a2a 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -739,8 +739,8 @@ void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
if ((xx > yy) && (xx > zz)) { // elements[0][0] is the largest diagonal term
if (xx < epsilon) {
x = 0;
- y = 0.7071;
- z = 0.7071;
+ y = Math_SQRT12;
+ z = Math_SQRT12;
} else {
x = Math::sqrt(xx);
y = xy / x;
@@ -748,9 +748,9 @@ void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
}
} else if (yy > zz) { // elements[1][1] is the largest diagonal term
if (yy < epsilon) {
- x = 0.7071;
+ x = Math_SQRT12;
y = 0;
- z = 0.7071;
+ z = Math_SQRT12;
} else {
y = Math::sqrt(yy);
x = xy / y;
@@ -758,8 +758,8 @@ void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
}
} else { // elements[2][2] is the largest diagonal term so base result on this
if (zz < epsilon) {
- x = 0.7071;
- y = 0.7071;
+ x = Math_SQRT12;
+ y = Math_SQRT12;
z = 0;
} else {
z = Math::sqrt(zz);
diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp
index ece293d036..f1d4505c35 100644
--- a/core/math/bsp_tree.cpp
+++ b/core/math/bsp_tree.cpp
@@ -192,14 +192,14 @@ int BSP_Tree::get_points_inside(const Vector3 *p_points, int p_point_count) cons
#ifdef DEBUG_ENABLED
int plane_count = planes.size();
uint16_t plane = nodesptr[idx].plane;
- ERR_FAIL_UNSIGNED_INDEX_V(plane, plane_count, false);
+ ERR_FAIL_UNSIGNED_INDEX_V(plane, plane_count, 0);
#endif
idx = planesptr[nodesptr[idx].plane].is_point_over(point) ? nodes[idx].over : nodes[idx].under;
#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V(idx < MAX_NODES && idx >= node_count, false);
+ ERR_FAIL_COND_V(idx < MAX_NODES && idx >= node_count, 0);
#endif
}
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index a76b5167b6..a254da89c6 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -129,9 +129,6 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) {
uint8_t room_needed = sizeof(Message);
if ((buffer_end + room_needed) >= buffer_size) {
- String type;
- if (ObjectDB::get_instance(p_id))
- type = ObjectDB::get_instance(p_id)->get_class();
print_line("Failed notification: " + itos(p_notification) + " target ID: " + itos(p_id));
statistics();
ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings.");
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 25930db201..6a1dc2295f 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -1917,7 +1917,7 @@ static double built_in_strtod(const C *string, /* A decimal ASCII floating-point
1.0e256
};
- int sign, expSign = false;
+ bool sign, expSign = false;
double fraction, dblExp;
const double *d;
const C *p;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 6e593a308d..f6ecc506a4 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1187,31 +1187,6 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
default: return Variant();
}
- } else if (p_argcount > 1) {
-
- _VariantCall::ConstructFunc &c = _VariantCall::construct_funcs[p_type];
-
- for (List<_VariantCall::ConstructData>::Element *E = c.constructors.front(); E; E = E->next()) {
- const _VariantCall::ConstructData &cd = E->get();
-
- if (cd.arg_count != p_argcount)
- continue;
-
- //validate parameters
- for (int i = 0; i < cd.arg_count; i++) {
- if (!Variant::can_convert(p_args[i]->type, cd.arg_types[i])) {
- r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; //no such constructor
- r_error.argument = i;
- r_error.expected = cd.arg_types[i];
- return Variant();
- }
- }
-
- Variant v;
- cd.func(v, p_args);
- return v;
- }
-
} else if (p_argcount == 1 && p_args[0]->type == p_type) {
return *p_args[0]; //copy construct
} else if (p_argcount == 1 && (!p_strict || Variant::can_convert(p_args[0]->type, p_type))) {
@@ -1268,6 +1243,30 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
case POOL_COLOR_ARRAY: return (PoolColorArray(*p_args[0]));
default: return Variant();
}
+ } else if (p_argcount >= 1) {
+
+ _VariantCall::ConstructFunc &c = _VariantCall::construct_funcs[p_type];
+
+ for (List<_VariantCall::ConstructData>::Element *E = c.constructors.front(); E; E = E->next()) {
+ const _VariantCall::ConstructData &cd = E->get();
+
+ if (cd.arg_count != p_argcount)
+ continue;
+
+ //validate parameters
+ for (int i = 0; i < cd.arg_count; i++) {
+ if (!Variant::can_convert(p_args[i]->type, cd.arg_types[i])) {
+ r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; //no such constructor
+ r_error.argument = i;
+ r_error.expected = cd.arg_types[i];
+ return Variant();
+ }
+ }
+
+ Variant v;
+ cd.func(v, p_args);
+ return v;
+ }
}
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; //no such constructor
return Variant();
diff --git a/doc/classes/CharFXTransform.xml b/doc/classes/CharFXTransform.xml
index 399530bb5d..ef9a366c86 100644
--- a/doc/classes/CharFXTransform.xml
+++ b/doc/classes/CharFXTransform.xml
@@ -11,17 +11,6 @@
<link>https://github.com/Eoin-ONeill-Yokai/Godot-Rich-Text-Effect-Test-Project</link>
</tutorials>
<methods>
- <method name="get_value_or">
- <return type="Variant">
- </return>
- <argument index="0" name="key" type="String">
- </argument>
- <argument index="1" name="default_value" type="Variant">
- </argument>
- <description>
- Returns the value for [code]key[/code] in the [member env] [Dictionary], or [code]default_value[/code] if [code]key[/code] isn't defined in [member env]. If the value's type doesn't match [code]default_value[/code]'s type, this method will return [code]default_value[/code].
- </description>
- </method>
</methods>
<members>
<member name="absolute_index" type="int" setter="set_absolute_index" getter="get_absolute_index" default="0">
diff --git a/doc/classes/CollisionShape2D.xml b/doc/classes/CollisionShape2D.xml
index 5fd8826a98..4166ee31d3 100644
--- a/doc/classes/CollisionShape2D.xml
+++ b/doc/classes/CollisionShape2D.xml
@@ -19,6 +19,7 @@
Sets whether this collision shape should only detect collision on one side (top or bottom).
</member>
<member name="one_way_collision_margin" type="float" setter="set_one_way_collision_margin" getter="get_one_way_collision_margin" default="1.0">
+ The margin used for one-way collision (in pixels).
</member>
<member name="shape" type="Shape2D" setter="set_shape" getter="get_shape">
The actual shape owned by this collision shape.
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index 57d2c6ff96..3a63b2dc07 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -112,13 +112,13 @@
Generates a GET/POST application/x-www-form-urlencoded style query string from a provided dictionary, e.g.:
[codeblock]
var fields = {"username": "user", "password": "pass"}
- String query_string = http_client.query_string_from_dict(fields)
+ var query_string = http_client.query_string_from_dict(fields)
# Returns "username=user&amp;password=pass"
[/codeblock]
Furthermore, if a key has a [code]null[/code] value, only the key itself is added, without equal sign and value. If the value is an array, for each value in it a pair with the same key is added.
[codeblock]
var fields = {"single": 123, "not_valued": null, "multiple": [22, 33, 44]}
- String query_string = http_client.query_string_from_dict(fields)
+ var query_string = http_client.query_string_from_dict(fields)
# Returns "single=123&amp;not_valued&amp;multiple=22&amp;multiple=33&amp;multiple=44"
[/codeblock]
</description>
diff --git a/doc/classes/KinematicBody.xml b/doc/classes/KinematicBody.xml
index 8404c7429c..164932749f 100644
--- a/doc/classes/KinematicBody.xml
+++ b/doc/classes/KinematicBody.xml
@@ -18,6 +18,7 @@
<argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis">
</argument>
<description>
+ Returns [code]true[/code] if the specified [code]axis[/code] is locked. See also [member move_lock_x], [member move_lock_y] and [member move_lock_z].
</description>
</method>
<method name="get_floor_velocity" qualifiers="const">
@@ -136,6 +137,7 @@
<argument index="1" name="lock" type="bool">
</argument>
<description>
+ Locks or unlocks the specified [code]axis[/code] depending on the value of [code]lock[/code]. See also [member move_lock_x], [member move_lock_y] and [member move_lock_z].
</description>
</method>
<method name="test_move">
diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml
index f7b3b0d7ea..d4804930e1 100644
--- a/doc/classes/Mesh.xml
+++ b/doc/classes/Mesh.xml
@@ -40,6 +40,14 @@
Generate a [TriangleMesh] from the mesh.
</description>
</method>
+ <method name="get_aabb" qualifiers="const">
+ <return type="AABB">
+ </return>
+ <description>
+ Returns the smallest [AABB] enclosing this mesh. Not affected by [code]custom_aabb[/code].
+ [b]Note:[/b] This is only implemented for [ArrayMesh] and [PrimitiveMesh].
+ </description>
+ </method>
<method name="get_faces" qualifiers="const">
<return type="PoolVector3Array">
</return>
diff --git a/doc/classes/PCKPacker.xml b/doc/classes/PCKPacker.xml
index ff45ca925c..e9ff2c0916 100644
--- a/doc/classes/PCKPacker.xml
+++ b/doc/classes/PCKPacker.xml
@@ -1,16 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PCKPacker" inherits="Reference" category="Core" version="3.2">
<brief_description>
+ Creates packages that can be loaded into a running project.
</brief_description>
<description>
- The [PCKPacker] is used to create packages in application runtime.
+ The [PCKPacker] is used to create packages that can be loaded into a running project using [method ProjectSettings.load_resource_pack].
[codeblock]
var packer = PCKPacker.new()
- packer.pck_start("test.pck", 0)
+ packer.pck_start("test.pck")
packer.add_file("res://text.txt", "text.txt")
- packer.flush(false)
+ packer.flush()
[/codeblock]
- The above [PCKPacker] creates package [b]test.pck[/b], then adds a file named [b]text.txt[/b] in the root of the package.
+ The above [PCKPacker] creates package [code]test.pck[/code], then adds a file named [code]text.txt[/code] at the root of the package.
</description>
<tutorials>
</tutorials>
@@ -29,9 +30,10 @@
<method name="flush">
<return type="int" enum="Error">
</return>
- <argument index="0" name="verbose" type="bool">
+ <argument index="0" name="verbose" type="bool" default="false">
</argument>
<description>
+ Writes the files specified using all [method add_file] calls since the last flush. If [code]verbose[/code] is [code]true[/code], a list of files added will be printed to the console for easier debugging.
</description>
</method>
<method name="pck_start">
@@ -39,9 +41,10 @@
</return>
<argument index="0" name="pck_name" type="String">
</argument>
- <argument index="1" name="alignment" type="int">
+ <argument index="1" name="alignment" type="int" default="0">
</argument>
<description>
+ Creates a new PCK file with the name [code]pck_name[/code]. The [code].pck[/code] file extension isn't added automatically, so it should be part of [code]pck_name[/code] (even though it's not required).
</description>
</method>
</methods>
diff --git a/doc/classes/Physics2DShapeQueryParameters.xml b/doc/classes/Physics2DShapeQueryParameters.xml
index 7d46dd2876..7ea00cbddc 100644
--- a/doc/classes/Physics2DShapeQueryParameters.xml
+++ b/doc/classes/Physics2DShapeQueryParameters.xml
@@ -4,7 +4,7 @@
Parameters to be sent to a 2D shape physics query.
</brief_description>
<description>
- This class contains the shape and other parameters for intersection/collision queries.
+ This class contains the shape and other parameters for 2D intersection/collision queries. See also [Physics2DShapeQueryResult].
</description>
<tutorials>
</tutorials>
@@ -21,14 +21,16 @@
</methods>
<members>
<member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
+ If [code]true[/code], the query will take [Area2D]s into account.
</member>
<member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
+ If [code]true[/code], the query will take [PhysicsBody2D]s into account.
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="2147483647">
- The physics layer the query should be made on.
+ The physics layer(s) the query will take into account (as a bitmask).
</member>
<member name="exclude" type="Array" setter="set_exclude" getter="get_exclude" default="[ ]">
- The list of objects or object [RID]s, that will be excluded from collisions.
+ The list of objects or object [RID]s that will be excluded from collisions.
</member>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.0">
The collision margin for the shape.
@@ -37,10 +39,10 @@
The motion of the shape being queried for.
</member>
<member name="shape_rid" type="RID" setter="set_shape_rid" getter="get_shape_rid">
- The [RID] of the queried shape. See also [method set_shape].
+ The queried shape's [RID]. See also [method set_shape].
</member>
<member name="transform" type="Transform2D" setter="set_transform" getter="get_transform" default="Transform2D( 1, 0, 0, 1, 0, 0 )">
- the transform matrix of the queried shape.
+ The queried shape's transform matrix.
</member>
</members>
<constants>
diff --git a/doc/classes/Physics2DShapeQueryResult.xml b/doc/classes/Physics2DShapeQueryResult.xml
index dd38b488f5..06f943cb6d 100644
--- a/doc/classes/Physics2DShapeQueryResult.xml
+++ b/doc/classes/Physics2DShapeQueryResult.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Physics2DShapeQueryResult" inherits="Reference" category="Core" version="3.2">
<brief_description>
+ Result of a 2D shape query in [Physics2DServer].
</brief_description>
<description>
+ The result of a 2D shape query in [Physics2DServer]. See also [Physics2DShapeQueryParameters].
</description>
<tutorials>
</tutorials>
@@ -11,6 +13,7 @@
<return type="int">
</return>
<description>
+ Returns the number of objects that intersected with the shape.
</description>
</method>
<method name="get_result_object" qualifiers="const">
@@ -19,6 +22,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the [Object] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_object_id" qualifiers="const">
@@ -27,6 +31,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the instance ID of the [Object] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_object_shape" qualifiers="const">
@@ -35,6 +40,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the child index of the object's [Shape] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_rid" qualifiers="const">
@@ -43,6 +49,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the [RID] of the object that intersected with the shape at index [code]idx[/code].
</description>
</method>
</methods>
diff --git a/doc/classes/PhysicsShapeQueryParameters.xml b/doc/classes/PhysicsShapeQueryParameters.xml
index 7d7307592e..d56247fcaf 100644
--- a/doc/classes/PhysicsShapeQueryParameters.xml
+++ b/doc/classes/PhysicsShapeQueryParameters.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PhysicsShapeQueryParameters" inherits="Reference" category="Core" version="3.2">
<brief_description>
+ Parameters to be sent to a 3D shape physics query.
</brief_description>
<description>
+ This class contains the shape and other parameters for 3D intersection/collision queries. See also [PhysicsShapeQueryResult].
</description>
<tutorials>
</tutorials>
@@ -13,23 +15,31 @@
<argument index="0" name="shape" type="Resource">
</argument>
<description>
+ Sets the [Shape] that will be used for collision/intersection queries.
</description>
</method>
</methods>
<members>
<member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
+ If [code]true[/code], the query will take [Area]s into account.
</member>
<member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
+ If [code]true[/code], the query will take [PhysicsBody]s into account.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="2147483647">
+ The physics layer(s) the query will take into account (as a bitmask).
</member>
<member name="exclude" type="Array" setter="set_exclude" getter="get_exclude" default="[ ]">
+ The list of objects or object [RID]s that will be excluded from collisions.
</member>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.0">
+ The collision margin for the shape.
</member>
<member name="shape_rid" type="RID" setter="set_shape_rid" getter="get_shape_rid">
+ The queried shape's [RID]. See also [method set_shape].
</member>
<member name="transform" type="Transform" setter="set_transform" getter="get_transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
+ The queried shape's transform matrix.
</member>
</members>
<constants>
diff --git a/doc/classes/PhysicsShapeQueryResult.xml b/doc/classes/PhysicsShapeQueryResult.xml
index 92a4393979..1f151ebb1a 100644
--- a/doc/classes/PhysicsShapeQueryResult.xml
+++ b/doc/classes/PhysicsShapeQueryResult.xml
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PhysicsShapeQueryResult" inherits="Reference" category="Core" version="3.2">
<brief_description>
- Result of a shape query in Physics2DServer.
+ Result of a 3D shape query in [PhysicsServer].
</brief_description>
<description>
+ The result of a 3D shape query in [PhysicsServer]. See also [PhysicsShapeQueryParameters].
</description>
<tutorials>
</tutorials>
@@ -12,6 +13,7 @@
<return type="int">
</return>
<description>
+ Returns the number of objects that intersected with the shape.
</description>
</method>
<method name="get_result_object" qualifiers="const">
@@ -20,6 +22,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the [Object] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_object_id" qualifiers="const">
@@ -28,6 +31,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the instance ID of the [Object] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_object_shape" qualifiers="const">
@@ -36,6 +40,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the child index of the object's [Shape] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_rid" qualifiers="const">
@@ -44,6 +49,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the [RID] of the object that intersected with the shape at index [code]idx[/code].
</description>
</method>
</methods>
diff --git a/doc/classes/PlaneShape.xml b/doc/classes/PlaneShape.xml
index b94bb8e613..ee841a3cff 100644
--- a/doc/classes/PlaneShape.xml
+++ b/doc/classes/PlaneShape.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaneShape" inherits="Shape" category="Core" version="3.2">
<brief_description>
+ Infinite plane shape for 3D collisions.
</brief_description>
<description>
+ An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [PlaneShape] is used in a [PhysicsBody], it will cause colliding objects placed "below" it to teleport "above" the plane.
</description>
<tutorials>
</tutorials>
@@ -10,6 +12,7 @@
</methods>
<members>
<member name="plane" type="Plane" setter="set_plane" getter="get_plane" default="Plane( 0, 1, 0, 0 )">
+ The [Plane] used by the [PlaneShape] for collision.
</member>
</members>
<constants>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 1d00bb5712..57940a2507 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -348,7 +348,7 @@
<member name="debug/gdscript/warnings/unused_argument" type="bool" setter="" getter="" default="true">
If [code]true[/code], enables warnings when a function parameter is unused.
</member>
- <member name="debug/gdscript/warnings/unused_class_variable" type="bool" setter="" getter="" default="true">
+ <member name="debug/gdscript/warnings/unused_class_variable" type="bool" setter="" getter="" default="false">
If [code]true[/code], enables warnings when a member variable is unused.
</member>
<member name="debug/gdscript/warnings/unused_signal" type="bool" setter="" getter="" default="true">
diff --git a/doc/classes/Shape.xml b/doc/classes/Shape.xml
index ce5947bc06..123353b59a 100644
--- a/doc/classes/Shape.xml
+++ b/doc/classes/Shape.xml
@@ -13,6 +13,7 @@
</methods>
<members>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.04">
+ The collision margin for the shape.
</member>
</members>
<constants>
diff --git a/doc/classes/Shape2D.xml b/doc/classes/Shape2D.xml
index 2c3120f04d..70d55344ca 100644
--- a/doc/classes/Shape2D.xml
+++ b/doc/classes/Shape2D.xml
@@ -77,6 +77,7 @@
</methods>
<members>
<member name="custom_solver_bias" type="float" setter="set_custom_solver_bias" getter="get_custom_solver_bias" default="0.0">
+ The shape's custom solver bias.
</member>
</members>
<constants>
diff --git a/drivers/SCsub b/drivers/SCsub
index 583973c025..d7003a07ce 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -46,9 +46,7 @@ if env['vsproj']:
env.AddToVSProject(env.drivers_sources)
os.chdir(path)
-if env.split_drivers:
- env.split_lib("drivers")
-else:
- env.add_source_files(env.drivers_sources, "*.cpp")
- lib = env.add_library("drivers", env.drivers_sources)
- env.Prepend(LIBS=[lib])
+env.add_source_files(env.drivers_sources, "*.cpp")
+
+lib = env.add_library("drivers", env.drivers_sources)
+env.Prepend(LIBS=[lib])
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 1db1625194..3b2851fbcd 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -1898,9 +1898,20 @@ void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, cons
}
state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES2::WORLD_MATRIX, instance->xform_cache);
- if (cull != instance->cull_cache) {
- cull = instance->cull_cache;
+ VS::CanvasOccluderPolygonCullMode transformed_cull_cache = instance->cull_cache;
+
+ if (transformed_cull_cache != VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED &&
+ (p_light_xform.basis_determinant() * instance->xform_cache.basis_determinant()) < 0) {
+ transformed_cull_cache =
+ transformed_cull_cache == VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE ?
+ VS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE :
+ VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE;
+ }
+
+ if (cull != transformed_cull_cache) {
+
+ cull = transformed_cull_cache;
switch (cull) {
case VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: {
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 40e7f0c441..388a8423a0 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -4914,7 +4914,11 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
bool used_depth = false;
if (j == 0 && i == 0) { //use always
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
+ if (config.support_depth_texture) {
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
+ } else {
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
+ }
used_depth = true;
}
@@ -5807,6 +5811,13 @@ void RasterizerStorageGLES2::initialize() {
config.pvrtc_supported = config.extensions.has("IMG_texture_compression_pvrtc") || config.extensions.has("WEBGL_compressed_texture_pvrtc");
config.support_npot_repeat_mipmap = config.extensions.has("GL_OES_texture_npot");
+#ifdef JAVASCRIPT_ENABLED
+ // no way of detecting 32 or 16 bit support for renderbuffer, so default to 32
+ // if the implementation doesn't support 32, it should just quietly use 16 instead
+ // https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/
+ config.depth_buffer_internalformat = GL_DEPTH_COMPONENT;
+ config.depth_type = GL_UNSIGNED_INT;
+#else
// on mobile check for 24 bit depth support for RenderBufferStorage
if (config.extensions.has("GL_OES_depth24")) {
config.depth_buffer_internalformat = _DEPTH_COMPONENT24_OES;
@@ -5816,6 +5827,7 @@ void RasterizerStorageGLES2::initialize() {
config.depth_type = GL_UNSIGNED_SHORT;
}
#endif
+#endif
#ifndef GLES_OVER_GL
//Manually load extensions for android and ios
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 7e9b6fdb82..94cb286b0e 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -911,7 +911,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
- actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "gl_PointSize";
+ actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "point_size";
actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
@@ -986,7 +986,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
- actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "gl_PointSize";
+ actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "point_size";
// gl_InstanceID is not available in OpenGL ES 2.0
actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "0";
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 08548ded17..afce403a9f 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -149,6 +149,8 @@ void main() {
uv = uv_attrib;
#endif
+ float point_size = 1.0;
+
{
vec2 src_vtx = outvec.xy;
/* clang-format off */
@@ -158,6 +160,8 @@ VERTEX_SHADER_CODE
/* clang-format on */
}
+ gl_PointSize = point_size;
+
#if !defined(SKIP_TRANSFORM_USED)
outvec = extra_matrix_instance * outvec;
outvec = modelview_matrix * outvec;
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 930d3cd9d4..63eee4eb87 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -423,6 +423,8 @@ void main() {
#define projection_matrix local_projection_matrix
#define world_transform world_matrix
+ float point_size = 1.0;
+
{
/* clang-format off */
@@ -431,6 +433,7 @@ VERTEX_SHADER_CODE
/* clang-format on */
}
+ gl_PointSize = point_size;
vec4 outvec = vertex;
// use local coordinates
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index b3263ce41c..1803a3dbbe 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -419,6 +419,7 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
}
glBindVertexArray(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void RasterizerCanvasGLES3::_draw_generic(GLuint p_primitive, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor) {
@@ -471,6 +472,7 @@ void RasterizerCanvasGLES3::_draw_generic(GLuint p_primitive, int p_vertex_count
storage->frame.canvas_draw_commands++;
glBindVertexArray(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void RasterizerCanvasGLES3::_draw_generic_indices(GLuint p_primitive, const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor) {
@@ -543,6 +545,7 @@ void RasterizerCanvasGLES3::_draw_generic_indices(GLuint p_primitive, const int
storage->frame.canvas_draw_commands++;
glBindVertexArray(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void RasterizerCanvasGLES3::_draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs) {
@@ -1884,9 +1887,20 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons
}
state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::WORLD_MATRIX, instance->xform_cache);
- if (cull != instance->cull_cache) {
- cull = instance->cull_cache;
+ VS::CanvasOccluderPolygonCullMode transformed_cull_cache = instance->cull_cache;
+
+ if (transformed_cull_cache != VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED &&
+ (p_light_xform.basis_determinant() * instance->xform_cache.basis_determinant()) < 0) {
+ transformed_cull_cache =
+ transformed_cull_cache == VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE ?
+ VS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE :
+ VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE;
+ }
+
+ if (cull != transformed_cull_cache) {
+
+ cull = transformed_cull_cache;
switch (cull) {
case VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: {
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index 7499962da3..e78ecbae34 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -913,7 +913,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
- actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "gl_PointSize";
+ actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "point_size";
actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
@@ -970,7 +970,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
- actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "gl_PointSize";
+ actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "point_size";
actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "gl_InstanceID";
//builtins
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index 7255b0425c..53f84abf51 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -150,6 +150,7 @@ void main() {
#define extra_matrix extra_matrix_instance
+ float point_size = 1.0;
//for compatibility with the fragment shader we need to use uv here
vec2 uv = uv_interp;
{
@@ -160,6 +161,7 @@ VERTEX_SHADER_CODE
/* clang-format on */
}
+ gl_PointSize = point_size;
uv_interp = uv;
#ifdef USE_NINEPATCH
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index b4ceb7dcfd..549a36817e 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -432,6 +432,8 @@ void main() {
}
#endif
+ float point_size = 1.0;
+
highp mat4 modelview = camera_inverse_matrix * world_matrix;
{
/* clang-format off */
@@ -441,6 +443,8 @@ VERTEX_SHADER_CODE
/* clang-format on */
}
+ gl_PointSize = point_size;
+
// using local coordinates (default)
#if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 40aa9a28b2..4ec245eacf 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -266,7 +266,6 @@ public:
else
undo_redo->create_action(TTR("Anim Change Call"));
- Variant prev = animation->track_get_key_value(track, key);
setting = true;
undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, d_new);
undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, d_old);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index e3138dc1e5..db44edcfcb 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1182,6 +1182,19 @@ void CodeTextEditor::move_lines_down() {
text_editor->update();
}
+void CodeTextEditor::_delete_line(int p_line) {
+ // this is currently intended to be called within delete_lines()
+ // so `begin_complex_operation` is ommitted here
+ text_editor->set_line(p_line, "");
+ if (p_line == 0 && text_editor->get_line_count() > 1) {
+ text_editor->cursor_set_line(1);
+ text_editor->cursor_set_column(0);
+ }
+ text_editor->backspace_at_cursor();
+ text_editor->unfold_line(p_line);
+ text_editor->cursor_set_line(p_line);
+}
+
void CodeTextEditor::delete_lines() {
text_editor->begin_complex_operation();
if (text_editor->is_selection_active()) {
@@ -1189,22 +1202,13 @@ void CodeTextEditor::delete_lines() {
int from_line = text_editor->get_selection_from_line();
int count = Math::abs(to_line - from_line) + 1;
- text_editor->cursor_set_line(to_line, false);
- while (count) {
- text_editor->set_line(text_editor->cursor_get_line(), "");
- text_editor->backspace_at_cursor();
- count--;
- if (count)
- text_editor->unfold_line(from_line);
+ text_editor->cursor_set_line(from_line, false);
+ for (int i = 0; i < count; i++) {
+ _delete_line(from_line);
}
- text_editor->cursor_set_line(from_line - 1);
text_editor->deselect();
} else {
- int line = text_editor->cursor_get_line();
- text_editor->set_line(text_editor->cursor_get_line(), "");
- text_editor->backspace_at_cursor();
- text_editor->unfold_line(line);
- text_editor->cursor_set_line(line);
+ _delete_line(text_editor->cursor_get_line());
}
text_editor->end_complex_operation();
}
diff --git a/editor/code_editor.h b/editor/code_editor.h
index f2a55cfb70..a4cd521afa 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -185,6 +185,8 @@ class CodeTextEditor : public VBoxContainer {
void _set_show_warnings_panel(bool p_show);
void _error_pressed(const Ref<InputEvent> &p_event);
+ void _delete_line(int p_line);
+
protected:
virtual void _load_theme_settings() {}
virtual void _validate_script() {}
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index 843d1006d7..745e31e18d 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -1488,7 +1488,6 @@ Collada::Node *Collada::_parse_visual_instance_geometry(XMLParser &parser) {
Collada::Node *Collada::_parse_visual_instance_camera(XMLParser &parser) {
- String type = parser.get_node_name();
NodeCamera *cam = memnew(NodeCamera);
cam->camera = _uri_to_id(parser.get_attribute_value_safe("url"));
@@ -1509,7 +1508,6 @@ Collada::Node *Collada::_parse_visual_instance_camera(XMLParser &parser) {
Collada::Node *Collada::_parse_visual_instance_light(XMLParser &parser) {
- String type = parser.get_node_name();
NodeLight *cam = memnew(NodeLight);
cam->light = _uri_to_id(parser.get_attribute_value_safe("url"));
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 1f58eda396..c6046f7e19 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -49,7 +49,6 @@ void DependencyEditor::_searched(const String &p_path) {
void DependencyEditor::_load_pressed(Object *p_item, int p_cell, int p_button) {
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
- String fname = ti->get_text(0);
replacing = ti->get_text(1);
search->set_title(TTR("Search Replacement For:") + " " + replacing.get_file());
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 1cafd1d1f4..0ac7b66ae4 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -727,7 +727,7 @@ uint64_t EditorData::get_edited_scene_version() const {
return edited_scene[current_edited_scene].version;
}
uint64_t EditorData::get_scene_version(int p_idx) const {
- ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), false);
+ ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), 0);
return edited_scene[p_idx].version;
}
diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp
index 9f13049a6b..9ed74b0d84 100644
--- a/editor/editor_folding.cpp
+++ b/editor/editor_folding.cpp
@@ -55,7 +55,6 @@ void EditorFolding::save_resource_folding(const RES &p_resource, const String &p
PoolVector<String> unfolds = _get_unfolds(p_resource.ptr());
config->set_value("folding", "sections_unfolded", unfolds);
- String path = EditorSettings::get_singleton()->get_project_settings_dir();
String file = p_path.get_file() + "-folding-" + p_path.md5_text() + ".cfg";
file = EditorSettings::get_singleton()->get_project_settings_dir().plus_file(file);
config->save(file);
@@ -76,7 +75,6 @@ void EditorFolding::load_resource_folding(RES p_resource, const String &p_path)
Ref<ConfigFile> config;
config.instance();
- String path = EditorSettings::get_singleton()->get_project_settings_dir();
String file = p_path.get_file() + "-folding-" + p_path.md5_text() + ".cfg";
file = EditorSettings::get_singleton()->get_project_settings_dir().plus_file(file);
@@ -151,7 +149,6 @@ void EditorFolding::save_scene_folding(const Node *p_scene, const String &p_path
config->set_value("folding", "resource_unfolds", res_unfolds);
config->set_value("folding", "nodes_folded", nodes_folded);
- String path = EditorSettings::get_singleton()->get_project_settings_dir();
String file = p_path.get_file() + "-folding-" + p_path.md5_text() + ".cfg";
file = EditorSettings::get_singleton()->get_project_settings_dir().plus_file(file);
config->save(file);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ab41019ac3..05f029f3c4 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -630,7 +630,7 @@ void EditorNode::_editor_select_next() {
} else {
editor++;
}
- } while (main_editor_buttons[editor]->is_visible());
+ } while (!main_editor_buttons[editor]->is_visible());
_editor_select(editor);
}
@@ -645,7 +645,7 @@ void EditorNode::_editor_select_prev() {
} else {
editor--;
}
- } while (main_editor_buttons[editor]->is_visible());
+ } while (!main_editor_buttons[editor]->is_visible());
_editor_select(editor);
}
@@ -963,7 +963,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
int len = varray.size();
for (int i = 0; i < len; i++) {
- Variant v = varray.get(i);
+ const Variant &v = varray.get(i);
RES res = v;
if (_find_and_save_resource(res, processed, flags))
ret_changed = true;
@@ -1027,13 +1027,10 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
int c3d = 0;
_find_node_types(editor_data.get_edited_scene_root(), c2d, c3d);
- RID viewport;
bool is2d;
if (c3d < c2d) {
- viewport = scene_root->get_viewport_rid();
is2d = true;
} else {
- viewport = SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_viewport_rid();
is2d = false;
}
save.step(TTR("Creating Thumbnail"), 1);
@@ -1282,7 +1279,6 @@ void EditorNode::restart_editor() {
}
_exit_editor();
- String exec = OS::get_singleton()->get_executable_path();
List<String> args;
args.push_back("--path");
@@ -2049,14 +2045,17 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER:
case FILE_CLOSE: {
- if (!p_confirmed && (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER)) {
+ if (!p_confirmed) {
tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene(false);
- String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename();
- save_confirmation->get_ok()->set_text(TTR("Save & Close"));
- save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene"));
- save_confirmation->popup_centered_minsize();
- break;
- } else {
+
+ if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
+ String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename();
+ save_confirmation->get_ok()->set_text(TTR("Save & Close"));
+ save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene"));
+ save_confirmation->popup_centered_minsize();
+ break;
+ }
+ } else if (p_option == FILE_CLOSE) {
tab_closing = editor_data.get_edited_scene();
}
if (!editor_data.get_edited_scene_root(tab_closing)) {
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index e14beabfa2..4bce6f34d3 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -979,8 +979,6 @@ void EditorPropertyEasing::_draw_easing() {
RID ci = easing_draw->get_canvas_item();
Size2 s = easing_draw->get_size();
- Rect2 r(Point2(), s);
- r = r.grow(3);
const int points = 48;
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index f05c7709d4..6b71ee14d5 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -587,11 +587,24 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("icon_color_pressed", "Button", icon_color_pressed);
// OptionButton
- theme->set_stylebox("normal", "OptionButton", style_widget);
- theme->set_stylebox("hover", "OptionButton", style_widget_hover);
- theme->set_stylebox("pressed", "OptionButton", style_widget_pressed);
- theme->set_stylebox("focus", "OptionButton", style_widget_focus);
- theme->set_stylebox("disabled", "OptionButton", style_widget_disabled);
+ Ref<StyleBoxFlat> style_option_button_normal = style_widget->duplicate();
+ Ref<StyleBoxFlat> style_option_button_hover = style_widget_hover->duplicate();
+ Ref<StyleBoxFlat> style_option_button_pressed = style_widget_pressed->duplicate();
+ Ref<StyleBoxFlat> style_option_button_focus = style_widget_focus->duplicate();
+ Ref<StyleBoxFlat> style_option_button_disabled = style_widget_disabled->duplicate();
+
+ int option_button_arrow_margin = theme->get_icon("GuiOptionArrow", "EditorIcons")->get_size().width + (default_margin_size + 4) * EDSCALE;
+ style_option_button_normal->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin);
+ style_option_button_hover->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin);
+ style_option_button_pressed->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin);
+ style_option_button_focus->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin);
+ style_option_button_disabled->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin);
+
+ theme->set_stylebox("normal", "OptionButton", style_option_button_normal);
+ theme->set_stylebox("hover", "OptionButton", style_option_button_hover);
+ theme->set_stylebox("pressed", "OptionButton", style_option_button_pressed);
+ theme->set_stylebox("focus", "OptionButton", style_option_button_focus);
+ theme->set_stylebox("disabled", "OptionButton", style_option_button_disabled);
theme->set_color("font_color", "OptionButton", font_color);
theme->set_color("font_color_hover", "OptionButton", font_color_hl);
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index f47f9b8b92..68ce709090 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -172,7 +172,7 @@ void ExportTemplateManager::_uninstall_template_confirm() {
ERR_FAIL_COND_MSG(err != OK, "Could not remove all templates in '" + templates_dir.plus_file(to_remove) + "'.");
da->change_dir("..");
- da->remove(to_remove);
+ err = da->remove(to_remove);
ERR_FAIL_COND_MSG(err != OK, "Could not remove templates directory at '" + templates_dir.plus_file(to_remove) + "'.");
_update_template_list();
@@ -691,7 +691,7 @@ ExportTemplateManager::ExportTemplateManager() {
template_open = memnew(FileDialog);
template_open->set_title(TTR("Select Template File"));
- template_open->add_filter("*.tpz ; Godot Export Templates");
+ template_open->add_filter("*.tpz ; " + TTR("Godot Export Templates"));
template_open->set_access(FileDialog::ACCESS_FILESYSTEM);
template_open->set_mode(FileDialog::MODE_OPEN_FILE);
template_open->connect("file_selected", this, "_install_from_file", varray(true));
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 752e49a932..01d645e231 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -889,7 +889,6 @@ String FindInFilesPanel::get_replace_text() {
void FindInFilesPanel::update_replace_buttons() {
- String text = get_replace_text();
bool disabled = _finder->is_searching();
_replace_all_button->set_disabled(disabled);
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index d604a95320..2eef0a07b5 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1015,8 +1015,6 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
Path *path = Object::cast_to<Path>(node);
- String curve = ng->source;
-
if (curve_cache.has(ng->source)) {
path->set_curve(curve_cache[ng->source]);
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 718156f12a..1480cc6ac4 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1092,8 +1092,6 @@ void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_drag)
if (!player->has_animation(player->get_assigned_animation()))
return;
- Ref<Animation> anim = player->get_animation(player->get_assigned_animation());
-
updating = true;
frame->set_value(Math::stepify(p_pos, _get_editor_step()));
updating = false;
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 95767a96d8..b261ca4712 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -652,12 +652,12 @@ const char *EditorAssetLibrary::sort_key[SORT_MAX] = {
};
const char *EditorAssetLibrary::sort_text[SORT_MAX] = {
- "Recently Updated",
- "Least Recently Updated",
- "Name (A-Z)",
- "Name (Z-A)",
- "License (A-Z)", // "cost" stores the SPDX license name in the Godot Asset Library.
- "License (Z-A)", // "cost" stores the SPDX license name in the Godot Asset Library.
+ TTRC("Recently Updated"),
+ TTRC("Least Recently Updated"),
+ TTRC("Name (A-Z)"),
+ TTRC("Name (Z-A)"),
+ TTRC("License (A-Z)"), // "cost" stores the SPDX license name in the Godot Asset Library.
+ TTRC("License (Z-A)"), // "cost" stores the SPDX license name in the Godot Asset Library.
};
const char *EditorAssetLibrary::support_key[SUPPORT_MAX] = {
@@ -1383,7 +1383,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
search_hb2->add_child(memnew(Label(TTR("Sort:") + " ")));
sort = memnew(OptionButton);
for (int i = 0; i < SORT_MAX; i++) {
- sort->add_item(sort_text[i]);
+ sort->add_item(TTRGET(sort_text[i]));
}
search_hb2->add_child(sort);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index de9efaf8ba..544e0b69f1 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -54,7 +54,7 @@
#define MIN_ZOOM 0.01
#define MAX_ZOOM 100
-#define RULER_WIDTH 15 * EDSCALE
+#define RULER_WIDTH (15 * EDSCALE)
#define SCALE_HANDLE_DISTANCE 25
class SnapDialog : public ConfirmationDialog {
@@ -3210,7 +3210,7 @@ void CanvasItemEditor::_draw_selection() {
int next = (i + 1) % 4;
Vector2 ofs = ((endpoints[i] - endpoints[prev]).normalized() + ((endpoints[i] - endpoints[next]).normalized())).normalized();
- ofs *= 1.4144 * (select_handle->get_size().width / 2);
+ ofs *= Math_SQRT2 * (select_handle->get_size().width / 2);
select_handle->draw(ci, (endpoints[i] + ofs - (select_handle->get_size() / 2)).floor());
@@ -4938,8 +4938,8 @@ void CanvasItemEditor::_focus_selection(int p_op) {
center = rect.position + rect.size / 2;
Vector2 offset = viewport->get_size() / 2 - editor->get_scene_root()->get_global_canvas_transform().xform(center);
- view_offset.x -= offset.x / zoom;
- view_offset.y -= offset.y / zoom;
+ view_offset.x -= Math::round(offset.x / zoom);
+ view_offset.y -= Math::round(offset.y / zoom);
update_viewport();
} else { // VIEW_FRAME_TO_SELECTION
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 34780af59e..a4c3ff5dcd 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -403,7 +403,6 @@ void SpriteFramesEditor::_up_pressed() {
sel = to_move;
sel -= 1;
- Ref<Texture> r = frames->get_frame(edited_anim, to_move);
undo_redo->create_action(TTR("Delete Resource"));
undo_redo->add_do_method(frames, "set_frame", edited_anim, to_move, frames->get_frame(edited_anim, to_move - 1));
undo_redo->add_do_method(frames, "set_frame", edited_anim, to_move - 1, frames->get_frame(edited_anim, to_move));
@@ -428,7 +427,6 @@ void SpriteFramesEditor::_down_pressed() {
sel = to_move;
sel += 1;
- Ref<Texture> r = frames->get_frame(edited_anim, to_move);
undo_redo->create_action(TTR("Delete Resource"));
undo_redo->add_do_method(frames, "set_frame", edited_anim, to_move, frames->get_frame(edited_anim, to_move + 1));
undo_redo->add_do_method(frames, "set_frame", edited_anim, to_move + 1, frames->get_frame(edited_anim, to_move));
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index a2f4040152..8e49bba7b2 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -150,7 +150,7 @@ void TextureRegionEditor::_region_draw() {
int next = (i + 1) % 4;
Vector2 ofs = ((endpoints[i] - endpoints[prev]).normalized() + ((endpoints[i] - endpoints[next]).normalized())).normalized();
- ofs *= 1.4144 * (select_handle->get_size().width / 2);
+ ofs *= Math_SQRT2 * (select_handle->get_size().width / 2);
edit_draw->draw_line(endpoints[i] - draw_ofs * draw_zoom, endpoints[next] - draw_ofs * draw_zoom, color, 2);
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index a8cf5b46e1..66935d047b 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -1176,6 +1176,31 @@ void TileSetEditor::_on_workspace_overlay_draw() {
}
}
+int TileSetEditor::get_grabbed_point(const Vector2 &p_mouse_pos, real_t p_grab_threshold) {
+ Transform2D xform = workspace->get_transform();
+
+ int grabbed_point = -1;
+ real_t min_distance = 1e10;
+
+ for (int i = 0; i < current_shape.size(); i++) {
+ const real_t distance = xform.xform(current_shape[i]).distance_to(xform.xform(p_mouse_pos));
+ if (distance < p_grab_threshold && distance < min_distance) {
+ min_distance = distance;
+ grabbed_point = i;
+ }
+ }
+
+ return grabbed_point;
+}
+
+bool TileSetEditor::is_within_grabbing_distance_of_first_point(const Vector2 &p_pos, real_t p_grab_threshold) {
+ Transform2D xform = workspace->get_transform();
+
+ const real_t distance = xform.xform(current_shape[0]).distance_to(xform.xform(p_pos));
+
+ return distance < p_grab_threshold;
+}
+
void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
if (tileset.is_null() || !get_current_texture().is_valid())
@@ -1528,18 +1553,19 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
shape_anchor.x *= (size.x + spacing);
shape_anchor.y *= (size.y + spacing);
}
+
const real_t grab_threshold = EDITOR_GET("editors/poly_editor/point_grab_radius");
shape_anchor += current_tile_region.position;
if (tools[TOOL_SELECT]->is_pressed()) {
if (mb.is_valid()) {
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
if (edit_mode != EDITMODE_PRIORITY && current_shape.size() > 0) {
- for (int i = 0; i < current_shape.size(); i++) {
- if ((current_shape[i] - mb->get_position()).length_squared() <= grab_threshold) {
- dragging_point = i;
- workspace->update();
- return;
- }
+ int grabbed_point = get_grabbed_point(mb->get_position(), grab_threshold);
+
+ if (grabbed_point >= 0) {
+ dragging_point = grabbed_point;
+ workspace->update();
+ return;
}
}
if ((tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) && current_tile_region.has_point(mb->get_position())) {
@@ -1633,13 +1659,12 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
Vector2 pos = mb->get_position();
pos = snap_point(pos);
if (creating_shape) {
- if (current_shape.size() > 0) {
- if ((pos - current_shape[0]).length_squared() <= grab_threshold) {
- if (current_shape.size() > 2) {
- close_shape(shape_anchor);
- workspace->update();
- return;
- }
+ if (current_shape.size() > 2) {
+
+ if (is_within_grabbing_distance_of_first_point(mb->get_position(), grab_threshold)) {
+ close_shape(shape_anchor);
+ workspace->update();
+ return;
}
}
current_shape.push_back(pos);
@@ -1685,12 +1710,15 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
}
} else if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
if (creating_shape) {
- if ((current_shape[0] - current_shape[1]).length_squared() <= grab_threshold) {
+
+ // if the first two corners are within grabbing distance of one another, expand the rect to fill the tile
+ if (is_within_grabbing_distance_of_first_point(current_shape[1], grab_threshold)) {
current_shape.set(0, snap_point(shape_anchor));
current_shape.set(1, snap_point(shape_anchor + Vector2(current_tile_region.size.x, 0)));
current_shape.set(2, snap_point(shape_anchor + current_tile_region.size));
current_shape.set(3, snap_point(shape_anchor + Vector2(0, current_tile_region.size.y)));
}
+
close_shape(shape_anchor);
workspace->update();
return;
@@ -2535,7 +2563,7 @@ void TileSetEditor::draw_grid_snap() {
if (i == 0 && snap_offset.y != 0) {
last_p = snap_offset.y;
}
- if (snap_separation.x != 0) {
+ if (snap_separation.y != 0) {
if (i != 0) {
workspace->draw_rect(Rect2(0, last_p, s.width, snap_separation.y), grid_color);
last_p += snap_separation.y;
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index 944dc04e4e..5ff86000c5 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -244,6 +244,8 @@ private:
void update_workspace_tile_mode();
void update_workspace_minsize();
void update_edited_region(const Vector2 &end_point);
+ int get_grabbed_point(const Vector2 &p_mouse_pos, real_t grab_threshold);
+ bool is_within_grabbing_distance_of_first_point(const Vector2 &p_pos, real_t p_grab_threshold);
int get_current_tile() const;
void set_current_tile(int p_id);
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 617ad62d4a..0a9ecca79c 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -253,9 +253,9 @@ void ProjectExportDialog::_edit_preset(int p_index) {
TreeItem *patch_add = patches->create_item(patch_root);
patch_add->set_metadata(0, patchlist.size());
if (patchlist.size() == 0)
- patch_add->set_text(0, "Add initial export...");
+ patch_add->set_text(0, TTR("Add initial export..."));
else
- patch_add->set_text(0, "Add previous patches...");
+ patch_add->set_text(0, TTR("Add previous patches..."));
patch_add->add_button(0, get_icon("folder", "FileDialog"), 1);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index d3bab64ccf..8de4fda662 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -349,16 +349,15 @@ private:
void _path_selected(const String &p_path) {
- String p = p_path;
- String sp = p.simplify_path();
+ String sp = p_path.simplify_path();
project_path->set_text(sp);
_path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
}
void _install_path_selected(const String &p_path) {
- String p = p_path;
- String sp = p.simplify_path();
+
+ String sp = p_path.simplify_path();
install_path->set_text(sp);
_path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index a38c6b98cc..a780b117e1 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -233,14 +233,23 @@ void EditorSettingsDialog::_update_shortcuts() {
section->set_custom_bg_color(1, get_color("prop_subsection", "Editor"));
}
- if (shortcut_filter.is_subsequence_ofi(sc->get_name()) || shortcut_filter.is_subsequence_ofi(sc->get_as_text())) {
+ // Don't match unassigned shortcuts when searching for assigned keys in search results.
+ // This prevents all unassigned shortcuts from appearing when searching a string like "no".
+ if (shortcut_filter.is_subsequence_ofi(sc->get_name()) || (sc->get_as_text() != "None" && shortcut_filter.is_subsequence_ofi(sc->get_as_text()))) {
TreeItem *item = shortcuts->create_item(section);
item->set_text(0, sc->get_name());
item->set_text(1, sc->get_as_text());
+
if (!sc->is_shortcut(original) && !(sc->get_shortcut().is_null() && original.is_null())) {
item->add_button(1, get_icon("Reload", "EditorIcons"), 2);
}
+
+ if (sc->get_as_text() == "None") {
+ // Fade out unassigned shortcut labels for easier visual grepping.
+ item->set_custom_color(1, get_color("font_color", "Label") * Color(1, 1, 1, 0.5));
+ }
+
item->add_button(1, get_icon("Edit", "EditorIcons"), 0);
item->add_button(1, get_icon("Close", "EditorIcons"), 1);
item->set_tooltip(0, E->get());
diff --git a/methods.py b/methods.py
index 86ab7cd9af..84074db0eb 100644
--- a/methods.py
+++ b/methods.py
@@ -307,7 +307,7 @@ def split_lib(self, libname, src_list = None, env_lib = None):
else:
fname = env.File(f)[0].path
fname = fname.replace("\\", "/")
- base = string.join(fname.split("/")[:2], "/")
+ base = "/".join(fname.split("/")[:2])
if base != cur_base and len(list) > max_src:
if num > 0:
lib = env_lib.add_library(libname + str(num), list)
@@ -320,12 +320,6 @@ def split_lib(self, libname, src_list = None, env_lib = None):
lib = env_lib.add_library(libname + str(num), list)
lib_list.append(lib)
- if len(lib_list) > 0:
- if os.name == 'posix' and sys.platform == 'msys':
- env.Replace(ARFLAGS=['rcsT'])
- lib = env_lib.add_library(libname + "_collated", lib_list)
- lib_list = [lib]
-
lib_base = []
env_lib.add_source_files(lib_base, "*.cpp")
lib = env_lib.add_library(libname, lib_base)
@@ -333,6 +327,24 @@ def split_lib(self, libname, src_list = None, env_lib = None):
env.Prepend(LIBS=lib_list)
+ # When we split modules into arbitrary chunks, we end up with linking issues
+ # due to symbol dependencies split over several libs, which may not be linked
+ # in the required order. We use --start-group and --end-group to tell the
+ # linker that those archives should be searched repeatedly to resolve all
+ # undefined references.
+ # As SCons doesn't give us much control over how inserting libs in LIBS
+ # impacts the linker call, we need to hack our way into the linking commands
+ # LINKCOM and SHLINKCOM to set those flags.
+
+ if '-Wl,--start-group' in env['LINKCOM'] and '-Wl,--start-group' in env['SHLINKCOM']:
+ # Already added by a previous call, skip.
+ return
+
+ env['LINKCOM'] = str(env['LINKCOM']).replace('$_LIBFLAGS',
+ '-Wl,--start-group $_LIBFLAGS -Wl,--end-group')
+ env['SHLINKCOM'] = str(env['LINKCOM']).replace('$_LIBFLAGS',
+ '-Wl,--start-group $_LIBFLAGS -Wl,--end-group')
+
def save_active_platforms(apnames, ap):
diff --git a/modules/SCsub b/modules/SCsub
index 42d89d6ce2..dc0420616c 100644
--- a/modules/SCsub
+++ b/modules/SCsub
@@ -16,7 +16,7 @@ for x in env.module_list:
env_modules.Append(CPPDEFINES=["MODULE_" + x.upper() + "_ENABLED"])
SConscript(x + "/SCsub")
-if env.split_modules:
+if env['split_libmodules']:
env.split_lib("modules", env_lib = env_modules)
else:
lib = env_modules.add_library("modules", env.modules_sources)
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp
index 2cb2a71f1e..752b74b9f2 100644
--- a/modules/assimp/editor_scene_importer_assimp.cpp
+++ b/modules/assimp/editor_scene_importer_assimp.cpp
@@ -364,8 +364,6 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
}
} else if (bone != NULL) {
continue;
- } else if (element_assimp_node->mNumMeshes > 0) {
- spatial = memnew(Spatial);
} else {
spatial = memnew(Spatial);
}
@@ -393,16 +391,11 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
ERR_FAIL_COND_V_MSG(parent_node == NULL, state.root,
"Parent node invalid even though lookup successful, out of ram?")
- if (parent_node && spatial != state.root) {
+ if (spatial != state.root) {
parent_node->add_child(spatial);
spatial->set_owner(state.root);
- } else if (spatial == state.root) {
+ } else {
// required - think about it root never has a parent yet is valid, anything else without a parent is not valid.
- } else // Safety for instances
- {
- WARN_PRINT(
- "Failed to find parent node instance after lookup, serious warning report to godot with model");
- memdelete(spatial); // this node is broken
}
} else if (spatial != state.root) {
// if the ainode is not in the tree
@@ -477,11 +470,12 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
for (Map<const aiNode *, Spatial *>::Element *key_value_pair = state.flat_node_map.front(); key_value_pair; key_value_pair = key_value_pair->next()) {
const aiNode *assimp_node = key_value_pair->key();
Spatial *mesh_template = key_value_pair->value();
- Node *parent_node = mesh_template->get_parent();
ERR_CONTINUE(assimp_node == NULL);
ERR_CONTINUE(mesh_template == NULL);
+ Node *parent_node = mesh_template->get_parent();
+
if (mesh_template == state.root) {
continue;
}
@@ -1009,7 +1003,6 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
}
}
- const String mesh_name = AssimpUtils::get_assimp_string(ai_mesh->mName);
aiString mat_name;
if (AI_SUCCESS == ai_material->Get(AI_MATKEY_NAME, mat_name)) {
mat->set_name(AssimpUtils::get_assimp_string(mat_name));
@@ -1495,7 +1488,6 @@ void EditorSceneImporterAssimp::_generate_node(
ERR_FAIL_COND(assimp_node == NULL);
state.nodes.push_back(assimp_node);
- String node_name = AssimpUtils::get_assimp_string(assimp_node->mName);
String parent_name = AssimpUtils::get_assimp_string(assimp_node->mParent->mName);
// please note
diff --git a/modules/assimp/import_utils.h b/modules/assimp/import_utils.h
index 8135b352c6..bf7552e7db 100644
--- a/modules/assimp/import_utils.h
+++ b/modules/assimp/import_utils.h
@@ -309,9 +309,7 @@ public:
if (r_found) {
return;
}
- if (r_found == false) {
- find_texture_path(r_p_path, dir, r_path, r_found, "." + exts[i]);
- }
+ find_texture_path(r_p_path, dir, r_path, r_found, "." + exts[i]);
}
}
@@ -322,9 +320,7 @@ public:
static void set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref<ImageTexture> texture) {
ERR_FAIL_COND(texture.is_null());
ERR_FAIL_COND(map_mode == NULL);
- aiTextureMapMode tex_mode = aiTextureMapMode::aiTextureMapMode_Wrap;
-
- tex_mode = map_mode[0];
+ aiTextureMapMode tex_mode = map_mode[0];
int32_t flags = Texture::FLAGS_DEFAULT;
if (tex_mode == aiTextureMapMode_Wrap) {
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index e74c29769f..d73930775d 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -945,8 +945,8 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
btVector3 motion;
G_TO_B(p_motion, motion);
-
- { /// phase two - sweep test, from a secure position without margin
+ if (!motion.fuzzyZero()) {
+ // Phase two - sweep test, from a secure position without margin
const int shape_count(p_body->get_shape_count());
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index 5d272a6cdc..5c84222797 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -224,7 +224,6 @@ void GDNativeLibraryEditor::_erase_entry(const String &platform, const String &e
if (List<String>::Element *E = platforms[platform].entries.find(entry)) {
String target = platform + "." + entry;
- Ref<ConfigFile> config = library->get_config_file();
platforms[platform].entries.erase(E);
_set_target_value("entry", target, "");
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index d1f52d2422..502a68cd61 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -616,9 +616,10 @@
Loads a resource from the filesystem located at [code]path[/code].
[b]Note:[/b] Resource paths can be obtained by right-clicking on a resource in the FileSystem dock and choosing [b]Copy Path[/b].
[codeblock]
- # Load a scene called main located in the root of the project directory
+ # Load a scene called main located in the root of the project directory.
var main = load("res://main.tscn")
[/codeblock]
+ [b]Important:[/b] The path must be absolute, a local path will just return [code]null[/code].
</description>
</method>
<method name="log">
@@ -786,7 +787,7 @@
Returns a resource from the filesystem that is loaded during script parsing.
[b]Note:[/b] Resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path".
[codeblock]
- # Load a scene called main located in the root of the project directory
+ # Load a scene called main located in the root of the project directory.
var main = preload("res://main.tscn")
[/codeblock]
</description>
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 563f7e2471..2f620df8fb 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -2143,7 +2143,8 @@ GDScriptLanguage::GDScriptLanguage() {
GLOBAL_DEF("debug/gdscript/completion/autocomplete_setters_and_getters", false);
for (int i = 0; i < (int)GDScriptWarning::WARNING_MAX; i++) {
String warning = GDScriptWarning::get_name_from_code((GDScriptWarning::Code)i).to_lower();
- GLOBAL_DEF("debug/gdscript/warnings/" + warning, !warning.begins_with("unsafe_"));
+ bool default_enabled = !warning.begins_with("unsafe_") && i != GDScriptWarning::UNUSED_CLASS_VARIABLE;
+ GLOBAL_DEF("debug/gdscript/warnings/" + warning, default_enabled);
}
#endif // DEBUG_ENABLED
}
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 280bc37dc0..97b8dda6d0 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -744,6 +744,14 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
r_type.type.kind = GDScriptParser::DataType::BUILTIN;
r_type.type.builtin_type = Variant::ARRAY;
} break;
+ case GDScriptParser::Node::TYPE_CAST: {
+ const GDScriptParser::CastNode *cn = static_cast<const GDScriptParser::CastNode *>(p_expression);
+ GDScriptCompletionIdentifier value;
+ if (_guess_expression_type(p_context, cn->source_node, r_type)) {
+ r_type.type = cn->get_datatype();
+ found = true;
+ }
+ } break;
case GDScriptParser::Node::TYPE_OPERATOR: {
const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(p_expression);
switch (op->op) {
@@ -1232,6 +1240,9 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S
c.line = last_assign_line;
r_type.assigned_expression = last_assigned_expression;
if (_guess_expression_type(c, last_assigned_expression, r_type)) {
+ if (var_type.has_type) {
+ r_type.type = var_type;
+ }
return true;
}
}
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index bbafef68ed..9e05c7b574 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -1128,25 +1128,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
d["@subpath"] = cp;
d["@path"] = p->get_path();
- p = base.ptr();
-
- while (p) {
-
- for (Set<StringName>::Element *E = p->members.front(); E; E = E->next()) {
-
- Variant value;
- if (ins->get(E->get(), value)) {
-
- String k = E->get();
- if (!d.has(k)) {
- d[k] = value;
- }
- }
+ for (Map<StringName, GDScript::MemberInfo>::Element *E = base->member_indices.front(); E; E = E->next()) {
+ if (!d.has(E->key())) {
+ d[E->key()] = ins->members[E->get().index];
}
-
- p = p->_base;
}
-
r_ret = d;
}
}
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index 6b5c26ec81..d63f786fcb 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -115,7 +115,7 @@ void ExtendGDScriptParser::update_document_links(const String &p_code) {
if (tokenizer.get_token() == GDScriptTokenizer::TK_EOF) {
break;
} else if (tokenizer.get_token() == GDScriptTokenizer::TK_CONSTANT) {
- Variant const_val = tokenizer.get_token_constant();
+ const Variant &const_val = tokenizer.get_token_constant();
if (const_val.get_type() == Variant::STRING) {
String path = const_val;
bool exists = fs->file_exists(path);
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index b83db718b8..1ca2a50c21 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -281,8 +281,6 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
}
Array GDScriptTextDocument::foldingRange(const Dictionary &p_params) {
- Dictionary params = p_params["textDocument"];
- String path = params["uri"];
Array arr;
return arr;
}
diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp
index 204f4e8905..62912d1459 100644
--- a/modules/mbedtls/crypto_mbedtls.cpp
+++ b/modules/mbedtls/crypto_mbedtls.cpp
@@ -203,8 +203,6 @@ void CryptoMbedTLS::load_default_certificates(String p_path) {
default_certs = memnew(X509CertificateMbedTLS);
ERR_FAIL_COND(default_certs == NULL);
- String certs_path = GLOBAL_DEF("network/ssl/certificates", "");
-
if (p_path != "") {
// Use certs defined in project settings.
default_certs->load(p_path);
diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp
index a2e342e219..78e99a3a65 100755
--- a/modules/mbedtls/stream_peer_mbedtls.cpp
+++ b/modules/mbedtls/stream_peer_mbedtls.cpp
@@ -111,7 +111,6 @@ Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida
ERR_FAIL_COND_V(p_base.is_null(), ERR_INVALID_PARAMETER);
base = p_base;
- int ret = 0;
int authmode = p_validate_certs ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE;
Error err = ssl_ctx->init_client(MBEDTLS_SSL_TRANSPORT_STREAM, authmode, p_ca_certs);
@@ -122,7 +121,7 @@ Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida
status = STATUS_HANDSHAKING;
- if ((ret = _do_handshake()) != OK) {
+ if (_do_handshake() != OK) {
status = STATUS_ERROR_HOSTNAME_MISMATCH;
return FAILED;
}
@@ -143,7 +142,7 @@ Error StreamPeerMbedTLS::accept_stream(Ref<StreamPeer> p_base, Ref<CryptoKey> p_
status = STATUS_HANDSHAKING;
- if ((err = _do_handshake()) != OK) {
+ if (_do_handshake() != OK) {
return FAILED;
}
diff --git a/modules/mono/build_scripts/godot_tools_build.py b/modules/mono/build_scripts/godot_tools_build.py
index 03aaa925f0..6e5273f5e0 100644
--- a/modules/mono/build_scripts/godot_tools_build.py
+++ b/modules/mono/build_scripts/godot_tools_build.py
@@ -82,7 +82,8 @@ def build(env_mono, api_sln_cmd):
target_filenames = [
'GodotTools.dll', 'GodotTools.IdeConnection.dll', 'GodotTools.BuildLogger.dll',
- 'GodotTools.ProjectEditor.dll', 'DotNet.Glob.dll', 'GodotTools.Core.dll'
+ 'GodotTools.ProjectEditor.dll', 'DotNet.Glob.dll', 'GodotTools.Core.dll',
+ 'JetBrains.Annotations.dll', 'Newtonsoft.Json.dll'
]
if env_mono['target'] == 'debug':
diff --git a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs
index a0f6f1ff32..6015cb22b6 100644
--- a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs
@@ -18,7 +18,7 @@ namespace GodotTools.BuildLogger
if (null == Parameters)
throw new LoggerException("Log directory was not set.");
- var parameters = Parameters.Split(new[] {';'});
+ var parameters = Parameters.Split(new[] { ';' });
string logDir = parameters[0];
diff --git a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj
index dcfdd83831..1eaa36c1aa 100644
--- a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
diff --git a/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj b/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj
index 24c7cb1573..1974220f2f 100644
--- a/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
diff --git a/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs b/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs
index 8cd7e76303..b531b6aeee 100644
--- a/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs
@@ -26,7 +26,7 @@ namespace GodotTools.Core
path = path.Replace('\\', '/');
- string[] parts = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
+ string[] parts = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
path = string.Join(Path.DirectorySeparatorChar.ToString(), parts).Trim();
@@ -44,7 +44,7 @@ namespace GodotTools.Core
public static string CsvEscape(this string value, char delimiter = ',')
{
- bool hasSpecialChar = value.IndexOfAny(new char[] {'\"', '\n', '\r', delimiter}) != -1;
+ bool hasSpecialChar = value.IndexOfAny(new char[] { '\"', '\n', '\r', delimiter }) != -1;
if (hasSpecialChar)
return "\"" + value.Replace("\"", "\"\"") + "\"";
@@ -54,8 +54,8 @@ namespace GodotTools.Core
public static string ToSafeDirName(this string dirName, bool allowDirSeparator)
{
- var invalidChars = new List<string> {":", "*", "?", "\"", "<", ">", "|"};
-
+ var invalidChars = new List<string> { ":", "*", "?", "\"", "<", ">", "|" };
+
if (allowDirSeparator)
{
// Directory separators are allowed, but disallow ".." to avoid going up the filesystem
diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeClient.cs b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeClient.cs
index 4f56a8d71b..2bf3b83c75 100644
--- a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeClient.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeClient.cs
@@ -106,7 +106,7 @@ namespace GodotTools.IdeConnection
try
{
Logger.LogInfo("Connecting to Godot Ide Server");
-
+
tcpClient.Connect(IPAddress.Loopback, GodotIdeMetadata.Port);
Logger.LogInfo("Connection open with Godot Ide Server");
@@ -130,7 +130,7 @@ namespace GodotTools.IdeConnection
public void Start()
{
Logger.LogInfo("Starting Godot Ide Client");
-
+
fsWatcher.Changed += OnMetaFileChanged;
fsWatcher.Deleted += OnMetaFileDeleted;
fsWatcher.EnableRaisingEvents = true;
diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeConnection.cs b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeConnection.cs
index e7e81f175e..6441be8d6e 100644
--- a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeConnection.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotIdeConnection.cs
@@ -149,7 +149,7 @@ namespace GodotTools.IdeConnection
public bool WriteMessage(Message message)
{
Logger.LogDebug($"Sending message {message}");
-
+
var messageComposer = new MessageComposer();
messageComposer.AddArgument(message.Id);
@@ -201,7 +201,7 @@ namespace GodotTools.IdeConnection
clientReader?.Dispose();
clientWriter?.Dispose();
- ((IDisposable) tcpClient)?.Dispose();
+ ((IDisposable)tcpClient)?.Dispose();
}
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotTools.IdeConnection.csproj b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotTools.IdeConnection.csproj
index 94e525715b..427a26508f 100644
--- a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotTools.IdeConnection.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/GodotTools.IdeConnection.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageComposer.cs b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageComposer.cs
index 9e4cd6ec1a..30ffe7a06e 100644
--- a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageComposer.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageComposer.cs
@@ -22,14 +22,14 @@ namespace GodotTools.IdeConnection
if (quoted)
{
stringBuilder.Append('"');
-
+
foreach (char @char in argument)
{
if (CharsToEscape.Contains(@char))
stringBuilder.Append('\\');
stringBuilder.Append(@char);
}
-
+
stringBuilder.Append('"');
}
else
diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageParser.cs b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageParser.cs
index ed691e481f..4365d69989 100644
--- a/modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageParser.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.IdeConnection/MessageParser.cs
@@ -37,7 +37,7 @@ namespace GodotTools.IdeConnection
while (i < messageLine.Length)
{
@char = messageLine[i];
-
+
if (quoted && @char == '"')
{
i++;
@@ -60,10 +60,10 @@ namespace GodotTools.IdeConnection
{
stringBuilder.Append(@char);
}
-
+
i++;
}
-
+
arguments.Add(stringBuilder.ToString());
stringBuilder.Clear();
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
index 4f21871f1a..b40d985d51 100644
--- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
@@ -26,8 +26,8 @@ namespace GodotTools.ProjectEditor
mainGroup.SetProperty("BaseIntermediateOutputPath", "obj");
GenAssemblyInfoFile(root, dir, CoreApiProjectName,
- new[] {"[assembly: InternalsVisibleTo(\"" + EditorApiProjectName + "\")]"},
- new[] {"System.Runtime.CompilerServices"});
+ new[] { "[assembly: InternalsVisibleTo(\"" + EditorApiProjectName + "\")]" },
+ new[] { "System.Runtime.CompilerServices" });
foreach (var item in compileItems)
{
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/packages.config b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/packages.config
index 13915000e4..2db030f9d8 100644
--- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/packages.config
+++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/packages.config
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNet.Glob" version="2.1.1" targetFramework="net45" />
-</packages> \ No newline at end of file
+</packages>
diff --git a/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs b/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs
index 44813f962c..4c76d2abf1 100644
--- a/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs
@@ -34,7 +34,7 @@ namespace GodotTools
for (int i = 0; i < buildTabs.GetChildCount(); i++)
{
- var tab = (BuildTab) buildTabs.GetChild(i);
+ var tab = (BuildTab)buildTabs.GetChild(i);
if (tab == null)
continue;
@@ -120,7 +120,7 @@ namespace GodotTools
if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
throw new InvalidOperationException("No tab selected");
- var buildTab = (BuildTab) buildTabs.GetChild(currentTab);
+ var buildTab = (BuildTab)buildTabs.GetChild(currentTab);
buildTab.WarningsVisible = pressed;
buildTab.UpdateIssuesList();
}
@@ -132,7 +132,7 @@ namespace GodotTools
if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
throw new InvalidOperationException("No tab selected");
- var buildTab = (BuildTab) buildTabs.GetChild(currentTab);
+ var buildTab = (BuildTab)buildTabs.GetChild(currentTab);
buildTab.ErrorsVisible = pressed;
buildTab.UpdateIssuesList();
}
@@ -193,7 +193,7 @@ namespace GodotTools
int selectedItem = selectedItems[0];
- var buildTab = (BuildTab) buildTabs.GetTabControl(selectedItem);
+ var buildTab = (BuildTab)buildTabs.GetTabControl(selectedItem);
OS.ShellOpen(Path.Combine(buildTab.BuildInfo.LogsDirPath, BuildManager.MsBuildLogFileName));
}
@@ -249,14 +249,14 @@ namespace GodotTools
var editorBaseControl = editorInterface.GetBaseControl();
- SizeFlagsVertical = (int) SizeFlags.ExpandFill;
+ SizeFlagsVertical = (int)SizeFlags.ExpandFill;
SetAnchorsAndMarginsPreset(LayoutPreset.Wide);
panelTabs = new TabContainer
{
TabAlign = TabContainer.TabAlignEnum.Left,
RectMinSize = new Vector2(0, 228) * EditorScale,
- SizeFlagsVertical = (int) SizeFlags.ExpandFill
+ SizeFlagsVertical = (int)SizeFlags.ExpandFill
};
panelTabs.AddStyleboxOverride("panel", editorBaseControl.GetStylebox("DebuggerPanel", "EditorStyles"));
panelTabs.AddStyleboxOverride("tab_fg", editorBaseControl.GetStylebox("DebuggerTabFG", "EditorStyles"));
@@ -268,11 +268,11 @@ namespace GodotTools
panelBuildsTab = new VBoxContainer
{
Name = "Builds".TTR(),
- SizeFlagsHorizontal = (int) SizeFlags.ExpandFill
+ SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
};
panelTabs.AddChild(panelBuildsTab);
- var toolBarHBox = new HBoxContainer {SizeFlagsHorizontal = (int) SizeFlags.ExpandFill};
+ var toolBarHBox = new HBoxContainer { SizeFlagsHorizontal = (int)SizeFlags.ExpandFill };
panelBuildsTab.AddChild(toolBarHBox);
var buildProjectBtn = new Button
@@ -320,12 +320,12 @@ namespace GodotTools
var hsc = new HSplitContainer
{
- SizeFlagsHorizontal = (int) SizeFlags.ExpandFill,
- SizeFlagsVertical = (int) SizeFlags.ExpandFill
+ SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
+ SizeFlagsVertical = (int)SizeFlags.ExpandFill
};
panelBuildsTab.AddChild(hsc);
- buildTabsList = new ItemList {SizeFlagsHorizontal = (int) SizeFlags.ExpandFill};
+ buildTabsList = new ItemList { SizeFlagsHorizontal = (int)SizeFlags.ExpandFill };
buildTabsList.Connect("item_selected", this, nameof(_BuildTabsItemSelected));
buildTabsList.Connect("nothing_selected", this, nameof(_BuildTabsNothingSelected));
hsc.AddChild(buildTabsList);
@@ -333,7 +333,7 @@ namespace GodotTools
buildTabs = new TabContainer
{
TabAlign = TabContainer.TabAlignEnum.Left,
- SizeFlagsHorizontal = (int) SizeFlags.ExpandFill,
+ SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
TabsVisible = false
};
hsc.AddChild(buildTabs);
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
index da90c960e5..43c96d2e30 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
@@ -46,7 +46,7 @@ namespace GodotTools.Build
{
if (OS.IsWindows)
{
- return (BuildManager.BuildTool) EditorSettings.GetSetting("mono/builds/build_tool")
+ return (BuildManager.BuildTool)EditorSettings.GetSetting("mono/builds/build_tool")
== BuildManager.BuildTool.MsBuildMono;
}
@@ -55,7 +55,7 @@ namespace GodotTools.Build
}
private static bool PrintBuildOutput =>
- (bool) EditorSettings.GetSetting("mono/builds/print_build_output");
+ (bool)EditorSettings.GetSetting("mono/builds/print_build_output");
private static Process LaunchBuild(string solution, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
{
@@ -90,7 +90,7 @@ namespace GodotTools.Build
// Needed when running from Developer Command Prompt for VS
RemovePlatformVariable(startInfo.EnvironmentVariables);
- var process = new Process {StartInfo = startInfo};
+ var process = new Process { StartInfo = startInfo };
process.Start();
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
index ad8a6516ab..c3db52aa9e 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
@@ -19,7 +19,7 @@ namespace GodotTools.Build
public static string FindMsBuild()
{
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
- var buildTool = (BuildManager.BuildTool) editorSettings.GetSetting("mono/builds/build_tool");
+ var buildTool = (BuildManager.BuildTool)editorSettings.GetSetting("mono/builds/build_tool");
if (OS.IsWindows)
{
@@ -136,11 +136,11 @@ namespace GodotTools.Build
string vsWherePath = Environment.GetEnvironmentVariable(Internal.GodotIs32Bits() ? "ProgramFiles" : "ProgramFiles(x86)");
vsWherePath += "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
- var vsWhereArgs = new[] {"-latest", "-products", "*", "-requires", "Microsoft.Component.MSBuild"};
+ var vsWhereArgs = new[] { "-latest", "-products", "*", "-requires", "Microsoft.Component.MSBuild" };
var outputArray = new Godot.Collections.Array<string>();
int exitCode = Godot.OS.Execute(vsWherePath, vsWhereArgs,
- blocking: true, output: (Godot.Collections.Array) outputArray);
+ blocking: true, output: (Godot.Collections.Array)outputArray);
if (exitCode != 0)
return string.Empty;
diff --git a/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs b/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs
index 217bf5c144..fa6bf4dafd 100644
--- a/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs
@@ -172,7 +172,7 @@ namespace GodotTools
}
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
- var buildTool = (BuildTool) editorSettings.GetSetting("mono/builds/build_tool");
+ var buildTool = (BuildTool)editorSettings.GetSetting("mono/builds/build_tool");
using (var pr = new EditorProgress("mono_project_debug_build", "Building project solution...", 1))
{
diff --git a/modules/mono/editor/GodotTools/GodotTools/BuildTab.cs b/modules/mono/editor/GodotTools/GodotTools/BuildTab.cs
index 807a20d9a1..727581daab 100644
--- a/modules/mono/editor/GodotTools/GodotTools/BuildTab.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/BuildTab.cs
@@ -113,7 +113,7 @@ namespace GodotTools
throw new IndexOutOfRangeException("Item list index out of range");
// Get correct issue idx from issue list
- int issueIndex = (int) issuesList.GetItemMetadata(idx);
+ int issueIndex = (int)issuesList.GetItemMetadata(idx);
if (idx < 0 || idx >= issues.Count)
throw new IndexOutOfRangeException("Issue index out of range");
@@ -134,7 +134,7 @@ namespace GodotTools
if (file.StartsWith("res://"))
{
- var script = (Script) ResourceLoader.Load(file, typeHint: Internal.CSharpLanguageType);
+ var script = (Script)ResourceLoader.Load(file, typeHint: Internal.CSharpLanguageType);
if (script != null && Internal.ScriptEditorEdit(script, issue.Line, issue.Column))
Internal.EditorNodeShowScriptScreen();
@@ -220,7 +220,7 @@ namespace GodotTools
issuesList.Clear();
- var issue = new BuildIssue {Message = cause, Warning = false};
+ var issue = new BuildIssue { Message = cause, Warning = false };
ErrorCount += 1;
issues.Add(issue);
@@ -250,7 +250,7 @@ namespace GodotTools
{
base._Ready();
- issuesList = new ItemList {SizeFlagsVertical = (int) SizeFlags.ExpandFill};
+ issuesList = new ItemList { SizeFlagsVertical = (int)SizeFlags.ExpandFill };
issuesList.Connect("item_activated", this, nameof(_IssueActivated));
AddChild(issuesList);
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/CsProjOperations.cs b/modules/mono/editor/GodotTools/GodotTools/CsProjOperations.cs
index c021a9051e..174509dc5b 100644
--- a/modules/mono/editor/GodotTools/GodotTools/CsProjOperations.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/CsProjOperations.cs
@@ -26,7 +26,7 @@ namespace GodotTools
public static void AddItem(string projectPath, string itemType, string include)
{
- if (!(bool) GlobalDef("mono/project/auto_update_project", true))
+ if (!(bool)GlobalDef("mono/project/auto_update_project", true))
return;
ProjectUtils.AddItemToProjectChecked(projectPath, itemType, include);
@@ -49,7 +49,7 @@ namespace GodotTools
private static ulong ConvertToTimestamp(this DateTime value)
{
TimeSpan elapsedTime = value - Epoch;
- return (ulong) elapsedTime.TotalSeconds;
+ return (ulong)elapsedTime.TotalSeconds;
}
public static void GenerateScriptsMetadata(string projectPath, string outputPath)
@@ -68,7 +68,7 @@ namespace GodotTools
if (oldDict.TryGetValue(projectIncludeFile, out var oldFileVar))
{
- var oldFileDict = (Dictionary) oldFileVar;
+ var oldFileDict = (Dictionary)oldFileVar;
if (ulong.TryParse(oldFileDict["modified_time"] as string, out ulong storedModifiedTime))
{
@@ -108,7 +108,7 @@ namespace GodotTools
if (classDict.Count == 0)
continue; // Not found
- newDict[projectIncludeFile] = new Dictionary {["modified_time"] = $"{modifiedTime}", ["class"] = classDict};
+ newDict[projectIncludeFile] = new Dictionary { ["modified_time"] = $"{modifiedTime}", ["class"] = classDict };
}
if (newDict.Count > 0)
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
index c7e8ea511a..b17a3f4491 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
@@ -54,7 +54,7 @@ namespace GodotTools.Export
// TODO What if the source file is not part of the game's C# project
- bool includeScriptsContent = (bool) ProjectSettings.GetSetting("mono/export/include_scripts_content");
+ bool includeScriptsContent = (bool)ProjectSettings.GetSetting("mono/export/include_scripts_content");
if (!includeScriptsContent)
{
@@ -114,7 +114,7 @@ namespace GodotTools.Export
var dependencies = new Godot.Collections.Dictionary<string, string>();
- var projectDllName = (string) ProjectSettings.GetSetting("application/config/name");
+ var projectDllName = (string)ProjectSettings.GetSetting("application/config/name");
if (projectDllName.Empty())
{
projectDllName = "UnnamedProject";
@@ -147,7 +147,7 @@ namespace GodotTools.Export
string apiConfig = isDebug ? "Debug" : "Release";
string resAssembliesDir = Path.Combine(GodotSharpDirs.ResAssembliesBaseDir, apiConfig);
- bool assembliesInsidePck = (bool) ProjectSettings.GetSetting("mono/export/export_assemblies_inside_pck") || outputDataDir == null;
+ bool assembliesInsidePck = (bool)ProjectSettings.GetSetting("mono/export/export_assemblies_inside_pck") || outputDataDir == null;
if (!assembliesInsidePck)
{
@@ -174,7 +174,7 @@ namespace GodotTools.Export
// AOT
- if ((bool) ProjectSettings.GetSetting("mono/export/aot/enabled"))
+ if ((bool)ProjectSettings.GetSetting("mono/export/aot/enabled"))
{
AotCompileDependencies(features, platform, isDebug, outputDir, outputDataDir, dependencies);
}
@@ -336,7 +336,7 @@ namespace GodotTools.Export
AotCompileAssembly(platform, isDebug, data, assemblyPath, outputFilePathForThisAbi);
- AddSharedObject(outputFilePathForThisAbi, tags: new[] {abi});
+ AddSharedObject(outputFilePathForThisAbi, tags: new[] { abi });
}
}
else
@@ -377,7 +377,7 @@ namespace GodotTools.Export
string compilerCommand = Path.Combine(monoCrossBin, $"{toolPrefix}{monoExeName}{exeExt}");
- bool fullAot = (bool) ProjectSettings.GetSetting("mono/export/aot/full_aot");
+ bool fullAot = (bool)ProjectSettings.GetSetting("mono/export/aot/full_aot");
string EscapeOption(string option) => option.Contains(',') ? $"\"{option}\"" : option;
string OptionsToString(IEnumerable<string> options) => string.Join(",", options.Select(EscapeOption));
@@ -394,7 +394,7 @@ namespace GodotTools.Export
{
string abi = data["abi"];
- string androidToolchain = (string) ProjectSettings.GetSetting("mono/export/aot/android_toolchain_path");
+ string androidToolchain = (string)ProjectSettings.GetSetting("mono/export/aot/android_toolchain_path");
if (string.IsNullOrEmpty(androidToolchain))
{
@@ -419,13 +419,13 @@ namespace GodotTools.Export
aotOptions.Add("tool-prefix=" + Path.Combine(androidToolchain, "bin", androidToolPrefixes[abi]));
string triple = GetAndroidTriple(abi);
- aotOptions.Add ($"mtriple={triple}");
+ aotOptions.Add($"mtriple={triple}");
}
aotOptions.Add($"outfile={outputFilePath}");
- var extraAotOptions = (string[]) ProjectSettings.GetSetting("mono/export/aot/extra_aot_options");
- var extraOptimizerOptions = (string[]) ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options");
+ var extraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options");
+ var extraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options");
if (extraAotOptions.Length > 0)
aotOptions.AddRange(extraAotOptions);
@@ -575,7 +575,7 @@ namespace GodotTools.Export
private static bool PlatformHasTemplateDir(string platform)
{
// OSX export templates are contained in a zip, so we place our custom template inside it and let Godot do the rest.
- return !new[] {OS.Platforms.OSX, OS.Platforms.Android, OS.Platforms.HTML5}.Contains(platform);
+ return !new[] { OS.Platforms.OSX, OS.Platforms.Android, OS.Platforms.HTML5 }.Contains(platform);
}
private static string DeterminePlatformFromFeatures(IEnumerable<string> features)
@@ -623,7 +623,7 @@ namespace GodotTools.Export
/// </summary>
private static bool PlatformRequiresCustomBcl(string platform)
{
- if (new[] {OS.Platforms.Android, OS.Platforms.HTML5}.Contains(platform))
+ if (new[] { OS.Platforms.Android, OS.Platforms.HTML5 }.Contains(platform))
return true;
// The 'net_4_x' BCL is not compatible between Windows and the other platforms.
@@ -663,7 +663,7 @@ namespace GodotTools.Export
{
get
{
- var appName = (string) ProjectSettings.GetSetting("application/config/name");
+ var appName = (string)ProjectSettings.GetSetting("application/config/name");
string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false);
return $"data_{appNameSafe}";
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs b/modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs
index 4312ca0230..bb218c2f19 100644
--- a/modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs
@@ -6,6 +6,7 @@ namespace GodotTools
VisualStudio, // TODO (Windows-only)
VisualStudioForMac, // Mac-only
MonoDevelop,
- VsCode
+ VsCode,
+ Rider
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
index 2a5d3de126..147bc95bb8 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
@@ -6,8 +6,10 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using GodotTools.Ides;
+using GodotTools.Ides.Rider;
using GodotTools.Internals;
using GodotTools.ProjectEditor;
+using JetBrains.Annotations;
using static GodotTools.Internals.Globals;
using File = GodotTools.Utils.File;
using OS = GodotTools.Utils.OS;
@@ -42,7 +44,7 @@ namespace GodotTools
string resourceDir = ProjectSettings.GlobalizePath("res://");
string path = resourceDir;
- string name = (string) ProjectSettings.GetSetting("application/config/name");
+ string name = (string)ProjectSettings.GetSetting("application/config/name");
if (name.Empty())
name = "UnnamedProject";
@@ -59,7 +61,7 @@ namespace GodotTools
{
Guid = guid,
PathRelativeToSolution = name + ".csproj",
- Configs = new List<string> {"Debug", "Release", "Tools"}
+ Configs = new List<string> { "Debug", "Release", "Tools" }
};
solution.AddNewProject(name, projectInfo);
@@ -108,20 +110,20 @@ namespace GodotTools
private void _RemoveCreateSlnMenuOption()
{
- menuPopup.RemoveItem(menuPopup.GetItemIndex((int) MenuOptions.CreateSln));
+ menuPopup.RemoveItem(menuPopup.GetItemIndex((int)MenuOptions.CreateSln));
bottomPanelBtn.Show();
}
private void _ShowAboutDialog()
{
- bool showOnStart = (bool) editorSettings.GetSetting("mono/editor/show_info_on_start");
+ bool showOnStart = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start");
aboutDialogCheckBox.Pressed = showOnStart;
aboutDialog.PopupCenteredMinsize();
}
private void _ToggleAboutDialogOnStart(bool enabled)
{
- bool showOnStart = (bool) editorSettings.GetSetting("mono/editor/show_info_on_start");
+ bool showOnStart = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start");
if (showOnStart != enabled)
editorSettings.SetSetting("mono/editor/show_info_on_start", enabled);
}
@@ -158,7 +160,7 @@ namespace GodotTools
if (what == NotificationReady)
{
- bool showInfoDialog = (bool) editorSettings.GetSetting("mono/editor/show_info_on_start");
+ bool showInfoDialog = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start");
if (showInfoDialog)
{
aboutDialog.PopupExclusive = true;
@@ -189,9 +191,10 @@ namespace GodotTools
"code", "code-oss", "vscode", "vscode-oss", "visual-studio-code", "visual-studio-code-oss"
};
+ [UsedImplicitly]
public Error OpenInExternalEditor(Script script, int line, int col)
{
- var editor = (ExternalEditorId) editorSettings.GetSetting("mono/editor/external_editor");
+ var editor = (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor");
switch (editor)
{
@@ -202,6 +205,12 @@ namespace GodotTools
throw new NotSupportedException();
case ExternalEditorId.VisualStudioForMac:
goto case ExternalEditorId.MonoDevelop;
+ case ExternalEditorId.Rider:
+ {
+ string scriptPath = ProjectSettings.GlobalizePath(script.ResourcePath);
+ RiderPathManager.OpenFile(GodotSharpDirs.ProjectSlnPath, scriptPath, line);
+ return Error.Ok;
+ }
case ExternalEditorId.MonoDevelop:
{
string scriptPath = ProjectSettings.GlobalizePath(script.ResourcePath);
@@ -306,9 +315,10 @@ namespace GodotTools
return Error.Ok;
}
+ [UsedImplicitly]
public bool OverridesExternalEditor()
{
- return (ExternalEditorId) editorSettings.GetSetting("mono/editor/external_editor") != ExternalEditorId.None;
+ return (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor") != ExternalEditorId.None;
}
public override bool Build()
@@ -336,7 +346,7 @@ namespace GodotTools
bottomPanelBtn = AddControlToBottomPanel(BottomPanel, "Mono".TTR());
- AddChild(new HotReloadAssemblyWatcher {Name = "HotReloadAssemblyWatcher"});
+ AddChild(new HotReloadAssemblyWatcher { Name = "HotReloadAssemblyWatcher" });
menuPopup = new PopupMenu();
menuPopup.Hide();
@@ -346,7 +356,7 @@ namespace GodotTools
// TODO: Remove or edit this info dialog once Mono support is no longer in alpha
{
- menuPopup.AddItem("About C# support".TTR(), (int) MenuOptions.AboutCSharp);
+ menuPopup.AddItem("About C# support".TTR(), (int)MenuOptions.AboutCSharp);
aboutDialog = new AcceptDialog();
editorBaseControl.AddChild(aboutDialog);
aboutDialog.WindowTitle = "Important: C# support is not feature-complete";
@@ -369,7 +379,7 @@ namespace GodotTools
var aboutLabel = new Label();
aboutHBox.AddChild(aboutLabel);
aboutLabel.RectMinSize = new Vector2(600, 150) * EditorScale;
- aboutLabel.SizeFlagsVertical = (int) Control.SizeFlags.ExpandFill;
+ aboutLabel.SizeFlagsVertical = (int)Control.SizeFlags.ExpandFill;
aboutLabel.Autowrap = true;
aboutLabel.Text =
"C# support in Godot Engine is in late alpha stage and, while already usable, " +
@@ -384,7 +394,7 @@ namespace GodotTools
EditorDef("mono/editor/show_info_on_start", true);
// CheckBox in main container
- aboutDialogCheckBox = new CheckBox {Text = "Show this warning when starting the editor"};
+ aboutDialogCheckBox = new CheckBox { Text = "Show this warning when starting the editor" };
aboutDialogCheckBox.Connect("toggled", this, nameof(_ToggleAboutDialogOnStart));
aboutVBox.AddChild(aboutDialogCheckBox);
}
@@ -397,7 +407,7 @@ namespace GodotTools
else
{
bottomPanelBtn.Hide();
- menuPopup.AddItem("Create C# solution".TTR(), (int) MenuOptions.CreateSln);
+ menuPopup.AddItem("Create C# solution".TTR(), (int)MenuOptions.CreateSln);
}
menuPopup.Connect("id_pressed", this, nameof(_MenuOptionPressed));
@@ -418,19 +428,22 @@ namespace GodotTools
if (OS.IsWindows)
{
- settingsHintStr += $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
- $",Visual Studio Code:{(int) ExternalEditorId.VsCode}";
+ settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
+ $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
+ $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
}
else if (OS.IsOSX)
{
- settingsHintStr += $",Visual Studio:{(int) ExternalEditorId.VisualStudioForMac}" +
- $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
- $",Visual Studio Code:{(int) ExternalEditorId.VsCode}";
+ settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" +
+ $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
+ $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
+ $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
}
else if (OS.IsUnixLike())
{
- settingsHintStr += $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
- $",Visual Studio Code:{(int) ExternalEditorId.VsCode}";
+ settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
+ $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
+ $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
}
editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
@@ -448,6 +461,7 @@ namespace GodotTools
exportPluginWeak = WeakRef(exportPlugin);
BuildManager.Initialize();
+ RiderPathManager.Initialize();
GodotIdeManager = new GodotIdeManager();
AddChild(GodotIdeManager);
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
index fb2cbabc8e..dbd774a66a 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -30,7 +30,15 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="JetBrains.Annotations, Version=2019.1.3.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325">
+ <HintPath>..\packages\JetBrains.Annotations.2019.1.3\lib\net20\JetBrains.Annotations.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="Mono.Posix" />
+ <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
+ <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="GodotSharp">
<HintPath>$(GodotSourceRootPath)/bin/GodotSharp/Api/$(GodotApiConfiguration)/GodotSharp.dll</HintPath>
@@ -47,6 +55,8 @@
<Compile Include="Ides\GodotIdeServer.cs" />
<Compile Include="Ides\MonoDevelop\EditorId.cs" />
<Compile Include="Ides\MonoDevelop\Instance.cs" />
+ <Compile Include="Ides\Rider\RiderPathLocator.cs" />
+ <Compile Include="Ides\Rider\RiderPathManager.cs" />
<Compile Include="Internals\BindingsGenerator.cs" />
<Compile Include="Internals\EditorProgress.cs" />
<Compile Include="Internals\GodotSharpDirs.cs" />
@@ -67,6 +77,7 @@
<Compile Include="BottomPanel.cs" />
<Compile Include="CsProjOperations.cs" />
<Compile Include="Utils\CollectionExtensions.cs" />
+ <Compile Include="Utils\User32Dll.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GodotTools.BuildLogger\GodotTools.BuildLogger.csproj">
@@ -86,5 +97,11 @@
<Name>GodotTools.Core</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Ides\Rider\.editorconfig" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs b/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs
index 0f6f5ffadc..0ed567afd1 100644
--- a/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs
@@ -38,7 +38,7 @@ namespace GodotTools
watchTimer = new Timer
{
OneShot = false,
- WaitTime = (float) EditorDef("mono/assembly_watch_interval_sec", 0.5)
+ WaitTime = (float)EditorDef("mono/assembly_watch_interval_sec", 0.5)
};
watchTimer.Connect("timeout", this, nameof(TimerTimeout));
AddChild(watchTimer);
diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs
index f94d6f998c..54f0ffab96 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs
@@ -64,7 +64,7 @@ namespace GodotTools.Ides
private void LaunchIde()
{
- var editor = (ExternalEditorId) GodotSharpEditor.Instance.GetEditorInterface()
+ var editor = (ExternalEditorId)GodotSharpEditor.Instance.GetEditorInterface()
.GetEditorSettings().GetSetting("mono/editor/external_editor");
switch (editor)
@@ -72,6 +72,7 @@ namespace GodotTools.Ides
case ExternalEditorId.None:
case ExternalEditorId.VisualStudio:
case ExternalEditorId.VsCode:
+ case ExternalEditorId.Rider:
throw new NotSupportedException();
case ExternalEditorId.VisualStudioForMac:
goto case ExternalEditorId.MonoDevelop;
diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeServer.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeServer.cs
index 309b917c71..72676a8b24 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeServer.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeServer.cs
@@ -45,7 +45,7 @@ namespace GodotTools.Ides
listener = new TcpListener(new IPEndPoint(IPAddress.Loopback, port: 0));
listener.Start();
- int port = ((IPEndPoint) listener.Server.LocalEndPoint).Port;
+ int port = ((IPEndPoint)listener.Server.LocalEndPoint).Port;
using (var metaFileWriter = new StreamWriter(metaFile, Encoding.UTF8))
{
metaFileWriter.WriteLine(port);
@@ -57,7 +57,7 @@ namespace GodotTools.Ides
public void StartServer()
{
- var serverThread = new Thread(RunServerThread) {Name = "Godot Ide Connection Server"};
+ var serverThread = new Thread(RunServerThread) { Name = "Godot Ide Connection Server" };
serverThread.Start();
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs
new file mode 100644
index 0000000000..b752535dcb
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs
@@ -0,0 +1,416 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Godot;
+using JetBrains.Annotations;
+using Microsoft.Win32;
+using Newtonsoft.Json;
+using Directory = System.IO.Directory;
+using Environment = System.Environment;
+using File = System.IO.File;
+using Path = System.IO.Path;
+using OS = GodotTools.Utils.OS;
+
+namespace GodotTools.Ides.Rider
+{
+ /// <summary>
+ /// This code is a modified version of the JetBrains resharper-unity plugin listed under Apache License 2.0 license:
+ /// https://github.com/JetBrains/resharper-unity/blob/master/unity/JetBrains.Rider.Unity.Editor/EditorPlugin/RiderPathLocator.cs
+ /// </summary>
+ public static class RiderPathLocator
+ {
+ public static RiderInfo[] GetAllRiderPaths()
+ {
+ try
+ {
+ if (OS.IsWindows)
+ {
+ return CollectRiderInfosWindows();
+ }
+ if (OS.IsOSX)
+ {
+ return CollectRiderInfosMac();
+ }
+ if (OS.IsUnixLike())
+ {
+ return CollectAllRiderPathsLinux();
+ }
+ throw new Exception("Unexpected OS.");
+ }
+ catch (Exception e)
+ {
+ GD.PushWarning(e.Message);
+ }
+
+ return new RiderInfo[0];
+ }
+
+ private static RiderInfo[] CollectAllRiderPathsLinux()
+ {
+ var installInfos = new List<RiderInfo>();
+ var home = Environment.GetEnvironmentVariable("HOME");
+ if (!string.IsNullOrEmpty(home))
+ {
+ var toolboxRiderRootPath = GetToolboxBaseDir();
+ installInfos.AddRange(CollectPathsFromToolbox(toolboxRiderRootPath, "bin", "rider.sh", false)
+ .Select(a => new RiderInfo(a, true)).ToList());
+
+ //$Home/.local/share/applications/jetbrains-rider.desktop
+ var shortcut = new FileInfo(Path.Combine(home, @".local/share/applications/jetbrains-rider.desktop"));
+
+ if (shortcut.Exists)
+ {
+ var lines = File.ReadAllLines(shortcut.FullName);
+ foreach (var line in lines)
+ {
+ if (!line.StartsWith("Exec=\""))
+ continue;
+ var path = line.Split('"').Where((item, index) => index == 1).SingleOrDefault();
+ if (string.IsNullOrEmpty(path))
+ continue;
+
+ if (installInfos.Any(a => a.Path == path)) // avoid adding similar build as from toolbox
+ continue;
+ installInfos.Add(new RiderInfo(path, false));
+ }
+ }
+ }
+
+ // snap install
+ var snapInstallPath = "/snap/rider/current/bin/rider.sh";
+ if (new FileInfo(snapInstallPath).Exists)
+ installInfos.Add(new RiderInfo(snapInstallPath, false));
+
+ return installInfos.ToArray();
+ }
+
+ private static RiderInfo[] CollectRiderInfosMac()
+ {
+ var installInfos = new List<RiderInfo>();
+ // "/Applications/*Rider*.app"
+ var folder = new DirectoryInfo("/Applications");
+ if (folder.Exists)
+ {
+ installInfos.AddRange(folder.GetDirectories("*Rider*.app")
+ .Select(a => new RiderInfo(a.FullName, false))
+ .ToList());
+ }
+
+ // /Users/user/Library/Application Support/JetBrains/Toolbox/apps/Rider/ch-1/181.3870.267/Rider EAP.app
+ var toolboxRiderRootPath = GetToolboxBaseDir();
+ var paths = CollectPathsFromToolbox(toolboxRiderRootPath, "", "Rider*.app", true)
+ .Select(a => new RiderInfo(a, true));
+ installInfos.AddRange(paths);
+
+ return installInfos.ToArray();
+ }
+
+ private static RiderInfo[] CollectRiderInfosWindows()
+ {
+ var installInfos = new List<RiderInfo>();
+ var toolboxRiderRootPath = GetToolboxBaseDir();
+ var installPathsToolbox = CollectPathsFromToolbox(toolboxRiderRootPath, "bin", "rider64.exe", false).ToList();
+ installInfos.AddRange(installPathsToolbox.Select(a => new RiderInfo(a, true)).ToList());
+
+ var installPaths = new List<string>();
+ const string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
+ CollectPathsFromRegistry(registryKey, installPaths);
+ const string wowRegistryKey = @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
+ CollectPathsFromRegistry(wowRegistryKey, installPaths);
+
+ installInfos.AddRange(installPaths.Select(a => new RiderInfo(a, false)).ToList());
+
+ return installInfos.ToArray();
+ }
+
+ private static string GetToolboxBaseDir()
+ {
+ if (OS.IsWindows)
+ {
+ var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+ return Path.Combine(localAppData, @"JetBrains\Toolbox\apps\Rider");
+ }
+
+ if (OS.IsOSX)
+ {
+ var home = Environment.GetEnvironmentVariable("HOME");
+ if (!string.IsNullOrEmpty(home))
+ {
+ return Path.Combine(home, @"Library/Application Support/JetBrains/Toolbox/apps/Rider");
+ }
+ }
+
+ if (OS.IsUnixLike())
+ {
+ var home = Environment.GetEnvironmentVariable("HOME");
+ if (!string.IsNullOrEmpty(home))
+ {
+ return Path.Combine(home, @".local/share/JetBrains/Toolbox/apps/Rider");
+ }
+ }
+
+ throw new Exception("Unexpected OS.");
+ }
+
+ internal static ProductInfo GetBuildVersion(string path)
+ {
+ var buildTxtFileInfo = new FileInfo(Path.Combine(path, GetRelativePathToBuildTxt()));
+ var dir = buildTxtFileInfo.DirectoryName;
+ if (!Directory.Exists(dir))
+ return null;
+ var buildVersionFile = new FileInfo(Path.Combine(dir, "product-info.json"));
+ if (!buildVersionFile.Exists)
+ return null;
+ var json = File.ReadAllText(buildVersionFile.FullName);
+ return ProductInfo.GetProductInfo(json);
+ }
+
+ internal static Version GetBuildNumber(string path)
+ {
+ var file = new FileInfo(Path.Combine(path, GetRelativePathToBuildTxt()));
+ if (!file.Exists)
+ return null;
+ var text = File.ReadAllText(file.FullName);
+ if (text.Length <= 3)
+ return null;
+
+ var versionText = text.Substring(3);
+ return Version.TryParse(versionText, out var v) ? v : null;
+ }
+
+ internal static bool IsToolbox(string path)
+ {
+ return path.StartsWith(GetToolboxBaseDir());
+ }
+
+ private static string GetRelativePathToBuildTxt()
+ {
+ if (OS.IsWindows || OS.IsUnixLike())
+ return "../../build.txt";
+ if (OS.IsOSX)
+ return "Contents/Resources/build.txt";
+ throw new Exception("Unknown OS.");
+ }
+
+ private static void CollectPathsFromRegistry(string registryKey, List<string> installPaths)
+ {
+ using (var key = Registry.LocalMachine.OpenSubKey(registryKey))
+ {
+ if (key == null) return;
+ foreach (var subkeyName in key.GetSubKeyNames().Where(a => a.Contains("Rider")))
+ {
+ using (var subkey = key.OpenSubKey(subkeyName))
+ {
+ var folderObject = subkey?.GetValue("InstallLocation");
+ if (folderObject == null) continue;
+ var folder = folderObject.ToString();
+ var possiblePath = Path.Combine(folder, @"bin\rider64.exe");
+ if (File.Exists(possiblePath))
+ installPaths.Add(possiblePath);
+ }
+ }
+ }
+ }
+
+ private static string[] CollectPathsFromToolbox(string toolboxRiderRootPath, string dirName, string searchPattern,
+ bool isMac)
+ {
+ if (!Directory.Exists(toolboxRiderRootPath))
+ return new string[0];
+
+ var channelDirs = Directory.GetDirectories(toolboxRiderRootPath);
+ var paths = channelDirs.SelectMany(channelDir =>
+ {
+ try
+ {
+ // use history.json - last entry stands for the active build https://jetbrains.slack.com/archives/C07KNP99D/p1547807024066500?thread_ts=1547731708.057700&cid=C07KNP99D
+ var historyFile = Path.Combine(channelDir, ".history.json");
+ if (File.Exists(historyFile))
+ {
+ var json = File.ReadAllText(historyFile);
+ var build = ToolboxHistory.GetLatestBuildFromJson(json);
+ if (build != null)
+ {
+ var buildDir = Path.Combine(channelDir, build);
+ var executablePaths = GetExecutablePaths(dirName, searchPattern, isMac, buildDir);
+ if (executablePaths.Any())
+ return executablePaths;
+ }
+ }
+
+ var channelFile = Path.Combine(channelDir, ".channel.settings.json");
+ if (File.Exists(channelFile))
+ {
+ var json = File.ReadAllText(channelFile).Replace("active-application", "active_application");
+ var build = ToolboxInstallData.GetLatestBuildFromJson(json);
+ if (build != null)
+ {
+ var buildDir = Path.Combine(channelDir, build);
+ var executablePaths = GetExecutablePaths(dirName, searchPattern, isMac, buildDir);
+ if (executablePaths.Any())
+ return executablePaths;
+ }
+ }
+
+ // changes in toolbox json files format may brake the logic above, so return all found Rider installations
+ return Directory.GetDirectories(channelDir)
+ .SelectMany(buildDir => GetExecutablePaths(dirName, searchPattern, isMac, buildDir));
+ }
+ catch (Exception e)
+ {
+ // do not write to Debug.Log, just log it.
+ Logger.Warn($"Failed to get RiderPath from {channelDir}", e);
+ }
+
+ return new string[0];
+ })
+ .Where(c => !string.IsNullOrEmpty(c))
+ .ToArray();
+ return paths;
+ }
+
+ private static string[] GetExecutablePaths(string dirName, string searchPattern, bool isMac, string buildDir)
+ {
+ var folder = new DirectoryInfo(Path.Combine(buildDir, dirName));
+ if (!folder.Exists)
+ return new string[0];
+
+ if (!isMac)
+ return new[] { Path.Combine(folder.FullName, searchPattern) }.Where(File.Exists).ToArray();
+ return folder.GetDirectories(searchPattern).Select(f => f.FullName)
+ .Where(Directory.Exists).ToArray();
+ }
+
+ // Disable the "field is never assigned" compiler warning. We never assign it, but Unity does.
+ // Note that Unity disable this warning in the generated C# projects
+#pragma warning disable 0649
+
+ [Serializable]
+ class ToolboxHistory
+ {
+ public List<ItemNode> history;
+
+ public static string GetLatestBuildFromJson(string json)
+ {
+ try
+ {
+ return JsonConvert.DeserializeObject<ToolboxHistory>(json).history.LastOrDefault()?.item.build;
+ }
+ catch (Exception)
+ {
+ Logger.Warn($"Failed to get latest build from json {json}");
+ }
+
+ return null;
+ }
+ }
+
+ [Serializable]
+ class ItemNode
+ {
+ public BuildNode item;
+ }
+
+ [Serializable]
+ class BuildNode
+ {
+ public string build;
+ }
+
+ [Serializable]
+ public class ProductInfo
+ {
+ public string version;
+ public string versionSuffix;
+
+ [CanBeNull]
+ internal static ProductInfo GetProductInfo(string json)
+ {
+ try
+ {
+ var productInfo = JsonConvert.DeserializeObject<ProductInfo>(json);
+ return productInfo;
+ }
+ catch (Exception)
+ {
+ Logger.Warn($"Failed to get version from json {json}");
+ }
+
+ return null;
+ }
+ }
+
+ // ReSharper disable once ClassNeverInstantiated.Global
+ [Serializable]
+ class ToolboxInstallData
+ {
+ // ReSharper disable once InconsistentNaming
+ public ActiveApplication active_application;
+
+ [CanBeNull]
+ public static string GetLatestBuildFromJson(string json)
+ {
+ try
+ {
+ var toolbox = JsonConvert.DeserializeObject<ToolboxInstallData>(json);
+ var builds = toolbox.active_application.builds;
+ if (builds != null && builds.Any())
+ return builds.First();
+ }
+ catch (Exception)
+ {
+ Logger.Warn($"Failed to get latest build from json {json}");
+ }
+
+ return null;
+ }
+ }
+
+ [Serializable]
+ class ActiveApplication
+ {
+ // ReSharper disable once InconsistentNaming
+ public List<string> builds;
+ }
+
+#pragma warning restore 0649
+
+ public struct RiderInfo
+ {
+ public bool IsToolbox;
+ public string Presentation;
+ public Version BuildNumber;
+ public ProductInfo ProductInfo;
+ public string Path;
+
+ public RiderInfo(string path, bool isToolbox)
+ {
+ BuildNumber = GetBuildNumber(path);
+ ProductInfo = GetBuildVersion(path);
+ Path = new FileInfo(path).FullName; // normalize separators
+ var presentation = $"Rider {BuildNumber}";
+
+ if (ProductInfo != null && !string.IsNullOrEmpty(ProductInfo.version))
+ {
+ var suffix = string.IsNullOrEmpty(ProductInfo.versionSuffix) ? "" : $" {ProductInfo.versionSuffix}";
+ presentation = $"Rider {ProductInfo.version}{suffix}";
+ }
+
+ if (isToolbox)
+ presentation += " (JetBrains Toolbox)";
+
+ Presentation = presentation;
+ IsToolbox = isToolbox;
+ }
+ }
+
+ private static class Logger
+ {
+ internal static void Warn(string message, Exception e = null)
+ {
+ throw new Exception(message, e);
+ }
+ }
+ }
+}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs
new file mode 100644
index 0000000000..558a242bf9
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs
@@ -0,0 +1,117 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Godot;
+using GodotTools.Internals;
+
+namespace GodotTools.Ides.Rider
+{
+ public static class RiderPathManager
+ {
+ private static readonly string editorPathSettingName = "mono/editor/editor_path_optional";
+
+ private static string GetRiderPathFromSettings()
+ {
+ var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
+ if (editorSettings.HasSetting(editorPathSettingName))
+ return (string)editorSettings.GetSetting(editorPathSettingName);
+ return null;
+ }
+
+ public static void Initialize()
+ {
+ var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
+ var editor = (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor");
+ if (editor == ExternalEditorId.Rider)
+ {
+ if (!editorSettings.HasSetting(editorPathSettingName))
+ {
+ Globals.EditorDef(editorPathSettingName, "Optional");
+ editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
+ {
+ ["type"] = Variant.Type.String,
+ ["name"] = editorPathSettingName,
+ ["hint"] = PropertyHint.File,
+ ["hint_string"] = ""
+ });
+ }
+
+ var riderPath = (string)editorSettings.GetSetting(editorPathSettingName);
+ if (IsRiderAndExists(riderPath))
+ {
+ Globals.EditorDef(editorPathSettingName, riderPath);
+ return;
+ }
+
+ var paths = RiderPathLocator.GetAllRiderPaths();
+
+ if (!paths.Any())
+ return;
+
+ var newPath = paths.Last().Path;
+ Globals.EditorDef(editorPathSettingName, newPath);
+ editorSettings.SetSetting(editorPathSettingName, newPath);
+ }
+ }
+
+ private static bool IsRider(string path)
+ {
+ if (string.IsNullOrEmpty(path))
+ {
+ return false;
+ }
+
+ var fileInfo = new FileInfo(path);
+ var filename = fileInfo.Name.ToLowerInvariant();
+ return filename.StartsWith("rider", StringComparison.Ordinal);
+ }
+
+ private static string CheckAndUpdatePath(string riderPath)
+ {
+ if (IsRiderAndExists(riderPath))
+ {
+ return riderPath;
+ }
+
+ var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
+ var paths = RiderPathLocator.GetAllRiderPaths();
+
+ if (!paths.Any())
+ return null;
+
+ var newPath = paths.Last().Path;
+ editorSettings.SetSetting(editorPathSettingName, newPath);
+ Globals.EditorDef(editorPathSettingName, newPath);
+ return newPath;
+ }
+
+ private static bool IsRiderAndExists(string riderPath)
+ {
+ return !string.IsNullOrEmpty(riderPath) && IsRider(riderPath) && new FileInfo(riderPath).Exists;
+ }
+
+ public static void OpenFile(string slnPath, string scriptPath, int line)
+ {
+ var pathFromSettings = GetRiderPathFromSettings();
+ var path = CheckAndUpdatePath(pathFromSettings);
+
+ var args = new List<string>();
+ args.Add(slnPath);
+ if (line >= 0)
+ {
+ args.Add("--line");
+ args.Add(line.ToString());
+ }
+ args.Add(scriptPath);
+ try
+ {
+ Utils.OS.RunProcess(path, args);
+ }
+ catch (Exception e)
+ {
+ GD.PushError($"Error when trying to run code editor: JetBrains Rider. Exception message: '{e.Message}'");
+ }
+ }
+ }
+}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs
index ddf3b829b5..6893bc1974 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs
@@ -33,10 +33,10 @@ namespace GodotTools.Internals
#region Windows-only
public static string DataMonoBinDir => internal_DataMonoBinDir();
#endregion
-
-
+
+
#region Internal
-
+
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern string internal_ResDataDir();
[MethodImpl(MethodImplOptions.InternalCall)]
@@ -85,7 +85,7 @@ namespace GodotTools.Internals
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern string internal_DataMonoBinDir();
#endregion
-
+
#endregion
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/ScriptClassParser.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/ScriptClassParser.cs
index 2497d276a9..80e45b3a3c 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Internals/ScriptClassParser.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Internals/ScriptClassParser.cs
@@ -39,10 +39,10 @@ namespace GodotTools.Internals
foreach (var classDeclDict in classesArray)
{
classesList.Add(new ClassDecl(
- (string) classDeclDict["name"],
- (string) classDeclDict["namespace"],
- (bool) classDeclDict["nested"],
- (int) classDeclDict["base_count"]
+ (string)classDeclDict["name"],
+ (string)classDeclDict["namespace"],
+ (bool)classDeclDict["nested"],
+ (int)classDeclDict["base_count"]
));
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
index e89ea0c476..5a867b7f8b 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
@@ -75,7 +75,7 @@ namespace GodotTools.Utils
public static bool IsHTML5 => _isHTML5.Value;
private static bool? _isUnixCache;
- private static readonly string[] UnixLikePlatforms = {Names.OSX, Names.X11, Names.Server, Names.Haiku, Names.Android};
+ private static readonly string[] UnixLikePlatforms = { Names.OSX, Names.X11, Names.Server, Names.Haiku, Names.Android };
public static bool IsUnixLike()
{
@@ -113,10 +113,10 @@ namespace GodotTools.Utils
return searchDirs.Select(dir => Path.Combine(dir, name)).FirstOrDefault(File.Exists);
return (from dir in searchDirs
- select Path.Combine(dir, name)
+ select Path.Combine(dir, name)
into path
- from ext in windowsExts
- select path + ext).FirstOrDefault(File.Exists);
+ from ext in windowsExts
+ select path + ext).FirstOrDefault(File.Exists);
}
private static string PathWhichUnix(string name)
@@ -157,6 +157,8 @@ namespace GodotTools.Utils
process.BeginOutputReadLine();
process.BeginErrorReadLine();
+ if (IsWindows && process.Id > 0)
+ User32Dll.AllowSetForegroundWindow(process.Id); // allows application to focus itself
}
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/User32Dll.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/User32Dll.cs
new file mode 100644
index 0000000000..6810a991b3
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/Utils/User32Dll.cs
@@ -0,0 +1,10 @@
+using System.Runtime.InteropServices;
+
+namespace GodotTools.Utils
+{
+ public static class User32Dll
+ {
+ [DllImport("user32.dll")]
+ public static extern bool AllowSetForegroundWindow(int dwProcessId);
+ }
+}
diff --git a/modules/mono/editor/GodotTools/GodotTools/packages.config b/modules/mono/editor/GodotTools/GodotTools/packages.config
new file mode 100644
index 0000000000..dd3de2865a
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="JetBrains.Annotations" version="2019.1.3" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
+</packages>
diff --git a/modules/mono/glue/Managed/Files/StringExtensions.cs b/modules/mono/glue/Managed/Files/StringExtensions.cs
index 6045c83e95..079e9912d6 100644
--- a/modules/mono/glue/Managed/Files/StringExtensions.cs
+++ b/modules/mono/glue/Managed/Files/StringExtensions.cs
@@ -18,7 +18,7 @@ namespace Godot
int pos = 0;
int slices = 1;
- while ((pos = instance.Find(splitter, pos)) >= 0)
+ while ((pos = instance.Find(splitter, true, pos)) >= 0)
{
slices++;
pos += splitter.Length;
@@ -325,17 +325,17 @@ namespace Godot
// <summary>
// Find the first occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
// </summary>
- public static int Find(this string instance, string what, int from = 0)
+ public static int Find(this string instance, string what, bool caseSensitive = true, int from = 0)
{
- return instance.IndexOf(what, StringComparison.OrdinalIgnoreCase);
+ return instance.IndexOf(what, from, caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
}
// <summary>
// Find the last occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
// </summary>
- public static int FindLast(this string instance, string what)
+ public static int FindLast(this string instance, string what, bool caseSensitive = true, int from = 0)
{
- return instance.LastIndexOf(what, StringComparison.OrdinalIgnoreCase);
+ return instance.LastIndexOf(what, from, caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
}
// <summary>
@@ -343,7 +343,7 @@ namespace Godot
// </summary>
public static int FindN(this string instance, string what, int from = 0)
{
- return instance.IndexOf(what, StringComparison.Ordinal);
+ return instance.IndexOf(what, from, StringComparison.OrdinalIgnoreCase);
}
// <summary>
@@ -928,7 +928,7 @@ namespace Godot
while (true)
{
- int end = instance.Find(divisor, from);
+ int end = instance.Find(divisor, true, from);
if (end < 0)
end = len;
if (allowEmpty || end > from)
diff --git a/modules/mono/glue/Managed/Managed.csproj b/modules/mono/glue/Managed/Managed.csproj
index c8eca71199..8bde3b6d22 100644
--- a/modules/mono/glue/Managed/Managed.csproj
+++ b/modules/mono/glue/Managed/Managed.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
diff --git a/modules/recast/navigation_mesh_generator.cpp b/modules/recast/navigation_mesh_generator.cpp
index 320591cf7c..b668085f90 100644
--- a/modules/recast/navigation_mesh_generator.cpp
+++ b/modules/recast/navigation_mesh_generator.cpp
@@ -62,7 +62,7 @@ void EditorNavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<fl
}
void EditorNavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices) {
- int current_vertex_count = 0;
+ int current_vertex_count;
for (int i = 0; i < p_mesh->get_surface_count(); i++) {
current_vertex_count = p_verticies.size() / 3;
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 857d640b43..2a8d67d403 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1290,7 +1290,7 @@ public:
if (!instance->get_variable(variable, p_outputs[0])) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str = RTR("VariableGet not found in script: ") + "'" + String(variable) + "'";
- return false;
+ return 0;
}
return 0;
}
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 4dfb93568f..122e8274b9 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -340,12 +340,8 @@ static Vector2 get_mouse_pos(NSPoint locationInWindow, CGFloat backingScaleFacto
//Update context
if (OS_OSX::singleton->main_loop) {
- [OS_OSX::singleton->context update];
-
- //Force window resize ???
- NSRect frame = [OS_OSX::singleton->window_object frame];
- [OS_OSX::singleton->window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, 1, 1) display:YES];
- [OS_OSX::singleton->window_object setFrame:frame display:YES];
+ //Force window resize event
+ [self windowDidResize:notification];
}
}
}
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index b37a21f37f..500736bd3f 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -151,14 +151,14 @@ def setup_msvc_auto(env):
env['bits'] = '64'
else:
env['bits'] = '32'
- print(" Found MSVC version %s, arch %s, bits=%s" % (env['MSVC_VERSION'], env['TARGET_ARCH'], env['bits']))
+ print("Found MSVC version %s, arch %s, bits=%s" % (env['MSVC_VERSION'], env['TARGET_ARCH'], env['bits']))
if env['TARGET_ARCH'] in ('amd64', 'x86_64'):
env["x86_libtheora_opt_vc"] = False
def setup_mingw(env):
"""Set up env for use with mingw"""
# Nothing to do here
- print("Using Mingw")
+ print("Using MinGW")
pass
def configure_msvc(env, manual_msvc_config):
@@ -294,7 +294,10 @@ def configure_mingw(env):
## Compiler configuration
if (os.name == "nt"):
- env['ENV']['TMP'] = os.environ['TMP'] # way to go scons, you can be so stupid sometimes
+ # Force splitting libmodules.a in multiple chunks to work around
+ # issues reaching the linker command line size limit, which also
+ # seem to induce huge slowdown for 'ar' (GH-30892).
+ env['split_libmodules'] = True
else:
env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index bb144dda96..766a8a6de4 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -169,8 +169,8 @@ void CollisionPolygon2D::_notification(int p_what) {
Vector<Vector2> pts;
float tsize = 8;
pts.push_back(line_to + (Vector2(0, tsize)));
- pts.push_back(line_to + (Vector2(0.707 * tsize, 0)));
- pts.push_back(line_to + (Vector2(-0.707 * tsize, 0)));
+ pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0)));
+ pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0)));
Vector<Color> cols;
for (int i = 0; i < 3; i++)
cols.push_back(dcol);
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index f79d79d039..d9c1d69b53 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -134,8 +134,8 @@ void CollisionShape2D::_notification(int p_what) {
Vector<Vector2> pts;
float tsize = 8;
pts.push_back(line_to + (Vector2(0, tsize)));
- pts.push_back(line_to + (Vector2(0.707 * tsize, 0)));
- pts.push_back(line_to + (Vector2(-0.707 * tsize, 0)));
+ pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0)));
+ pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0)));
Vector<Color> cols;
for (int i = 0; i < 3; i++)
cols.push_back(draw_col);
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index bf8d008bb2..4f6f410bdc 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -180,8 +180,8 @@ void RayCast2D::_notification(int p_what) {
Vector<Vector2> pts;
float tsize = 8;
pts.push_back(xf.xform(Vector2(tsize, 0)));
- pts.push_back(xf.xform(Vector2(0, 0.707 * tsize)));
- pts.push_back(xf.xform(Vector2(0, -0.707 * tsize)));
+ pts.push_back(xf.xform(Vector2(0, Math_SQRT12 * tsize)));
+ pts.push_back(xf.xform(Vector2(0, -Math_SQRT12 * tsize)));
Vector<Color> cols;
for (int i = 0; i < 3; i++)
cols.push_back(draw_col);
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index 8e09930aed..3235953730 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -1594,10 +1594,10 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const
case BAKE_QUALITY_LOW: {
//default quality
static const Vector3 dirs[4] = {
- Vector3(0.707107, 0, 0.707107),
- Vector3(0, 0.707107, 0.707107),
- Vector3(-0.707107, 0, 0.707107),
- Vector3(0, -0.707107, 0.707107)
+ Vector3(Math_SQRT12, 0, Math_SQRT12),
+ Vector3(0, Math_SQRT12, Math_SQRT12),
+ Vector3(-Math_SQRT12, 0, Math_SQRT12),
+ Vector3(0, -Math_SQRT12, Math_SQRT12)
};
static const float weights[4] = { 0.25, 0.25, 0.25, 0.25 };
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index ce3f2b3b1a..72e8ae1b26 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -239,14 +239,14 @@ void Tween::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_runtime"), &Tween::get_runtime);
// Bind interpolation and follow methods
- ClassDB::bind_method(D_METHOD("interpolate_property", "object", "property", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::interpolate_property, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("interpolate_method", "object", "method", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::interpolate_method, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("interpolate_property", "object", "property", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::interpolate_property, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("interpolate_method", "object", "method", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::interpolate_method, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
ClassDB::bind_method(D_METHOD("interpolate_callback", "object", "duration", "callback", "arg1", "arg2", "arg3", "arg4", "arg5"), &Tween::interpolate_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("interpolate_deferred_callback", "object", "duration", "callback", "arg1", "arg2", "arg3", "arg4", "arg5"), &Tween::interpolate_deferred_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("follow_property", "object", "property", "initial_val", "target", "target_property", "duration", "trans_type", "ease_type", "delay"), &Tween::follow_property, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("follow_method", "object", "method", "initial_val", "target", "target_method", "duration", "trans_type", "ease_type", "delay"), &Tween::follow_method, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("targeting_property", "object", "property", "initial", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::targeting_property, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("targeting_method", "object", "method", "initial", "initial_method", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::targeting_method, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("follow_property", "object", "property", "initial_val", "target", "target_property", "duration", "trans_type", "ease_type", "delay"), &Tween::follow_property, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("follow_method", "object", "method", "initial_val", "target", "target_method", "duration", "trans_type", "ease_type", "delay"), &Tween::follow_method, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("targeting_property", "object", "property", "initial", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::targeting_property, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("targeting_method", "object", "method", "initial", "initial_method", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::targeting_method, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
// Add the Tween signals
ADD_SIGNAL(MethodInfo("tween_started", PropertyInfo(Variant::OBJECT, "object"), PropertyInfo(Variant::NODE_PATH, "key")));
diff --git a/scene/animation/tween.h b/scene/animation/tween.h
index 574238f5c9..f301d8d76b 100644
--- a/scene/animation/tween.h
+++ b/scene/animation/tween.h
@@ -101,6 +101,12 @@ private:
int args;
Variant arg[5];
int uid;
+ InterpolateData() {
+ active = false;
+ finish = false;
+ call_deferred = false;
+ uid = 0;
+ }
};
String autoplay;
@@ -173,21 +179,14 @@ public:
real_t tell() const;
real_t get_runtime() const;
- bool interpolate_property(Object *p_object, NodePath p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
- bool interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
+ bool interpolate_property(Object *p_object, NodePath p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
+ bool interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
bool interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE);
-
bool interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE);
-
- bool follow_property(Object *p_object, NodePath p_property, Variant p_initial_val, Object *p_target, NodePath p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
- bool follow_method(Object *p_object, StringName p_method, Variant p_initial_val, Object *p_target, StringName p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
- bool targeting_property(Object *p_object, NodePath p_property, Object *p_initial, NodePath p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
- bool targeting_method(Object *p_object, StringName p_method, Object *p_initial, StringName p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
+ bool follow_property(Object *p_object, NodePath p_property, Variant p_initial_val, Object *p_target, NodePath p_target_property, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
+ bool follow_method(Object *p_object, StringName p_method, Variant p_initial_val, Object *p_target, StringName p_target_method, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
+ bool targeting_property(Object *p_object, NodePath p_property, Object *p_initial, NodePath p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
+ bool targeting_method(Object *p_object, StringName p_method, Object *p_initial, StringName p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
Tween();
~Tween();
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index ca4c255855..a68462f4d4 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -190,6 +190,13 @@ void Button::_notification(int p_what) {
Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_constant("hseparation"), 0) : Point2();
int text_clip = size.width - style->get_minimum_size().width - icon_ofs.width;
+ if (_internal_margin[MARGIN_LEFT] > 0) {
+ text_clip -= _internal_margin[MARGIN_LEFT] + get_constant("hseparation");
+ }
+ if (_internal_margin[MARGIN_RIGHT] > 0) {
+ text_clip -= _internal_margin[MARGIN_RIGHT] + get_constant("hseparation");
+ }
+
Point2 text_ofs = (size - style->get_minimum_size() - icon_ofs - font->get_string_size(xl_text) - Point2(_internal_margin[MARGIN_RIGHT] - _internal_margin[MARGIN_LEFT], 0)) / 2.0;
switch (align) {
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 3884622942..20bbcbde80 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -973,12 +973,12 @@ void ItemList::_notification(int p_what) {
float max = MAX(page, ofs.y + max_h);
if (auto_height)
auto_height_value = ofs.y + max_h + bg->get_minimum_size().height;
+ scroll_bar->set_max(max);
+ scroll_bar->set_page(page);
if (max <= page) {
scroll_bar->set_value(0);
scroll_bar->hide();
} else {
- scroll_bar->set_max(max);
- scroll_bar->set_page(page);
scroll_bar->show();
if (do_autoscroll_to_bottom)
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index e6a27aa63f..d96ca69c87 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -704,7 +704,7 @@ void LineEdit::_notification(int p_what) {
}
int x_ofs = 0;
- bool using_placeholder = text.empty();
+ bool using_placeholder = text.empty() && ime_text.empty();
int cached_text_width = using_placeholder ? cached_placeholder_width : cached_width;
switch (align) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 08faaf7d45..cffea527a5 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -191,16 +191,20 @@ void PopupMenu::_submenu_timeout() {
void PopupMenu::_scroll(float p_factor, const Point2 &p_over) {
- const float global_y = get_global_position().y;
-
int vseparation = get_constant("vseparation");
Ref<Font> font = get_font("font");
float dy = (vseparation + font->get_height()) * 3 * p_factor * get_global_transform().get_scale().y;
- if (dy > 0 && global_y < 0)
- dy = MIN(dy, -global_y - 1);
- else if (dy < 0 && global_y + get_size().y * get_global_transform().get_scale().y > get_viewport_rect().size.y)
- dy = -MIN(-dy, global_y + get_size().y * get_global_transform().get_scale().y - get_viewport_rect().size.y - 1);
+ if (dy > 0) {
+ const float global_top = get_global_position().y;
+ const float limit = global_top < 0 ? -global_top : 0;
+ dy = MIN(dy, limit);
+ } else if (dy < 0) {
+ const float global_bottom = get_global_position().y + get_size().y * get_global_transform().get_scale().y;
+ const float viewport_height = get_viewport_rect().size.y;
+ const float limit = global_bottom > viewport_height ? global_bottom - viewport_height: 0;
+ dy = -MIN(-dy, limit);
+ }
set_position(get_position() + Vector2(0, dy));
Ref<InputEventMouseMotion> ie;
diff --git a/scene/gui/rich_text_effect.cpp b/scene/gui/rich_text_effect.cpp
index f9e0be5b31..ab2f8d2172 100644
--- a/scene/gui/rich_text_effect.cpp
+++ b/scene/gui/rich_text_effect.cpp
@@ -89,8 +89,6 @@ void CharFXTransform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_character"), &CharFXTransform::get_character);
ClassDB::bind_method(D_METHOD("set_character", "character"), &CharFXTransform::set_character);
- ClassDB::bind_method(D_METHOD("get_value_or", "key", "default_value"), &CharFXTransform::get_value_or);
-
ADD_PROPERTY(PropertyInfo(Variant::INT, "relative_index"), "set_relative_index", "get_relative_index");
ADD_PROPERTY(PropertyInfo(Variant::INT, "absolute_index"), "set_absolute_index", "get_absolute_index");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "elapsed_time"), "set_elapsed_time", "get_elapsed_time");
@@ -101,17 +99,6 @@ void CharFXTransform::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "character"), "set_character", "get_character");
}
-Variant CharFXTransform::get_value_or(String p_key, Variant p_default_value) {
- if (!this->environment.has(p_key))
- return p_default_value;
-
- Variant r = environment[p_key];
- if (r.get_type() != p_default_value.get_type())
- return p_default_value;
-
- return r;
-}
-
CharFXTransform::CharFXTransform() {
relative_index = 0;
absolute_index = 0;
diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h
index 4330cebfe6..9e0065b199 100644
--- a/scene/gui/rich_text_effect.h
+++ b/scene/gui/rich_text_effect.h
@@ -82,8 +82,6 @@ public:
void set_character(int p_char) { character = (CharType)p_char; }
Dictionary get_environment() { return environment; }
void set_environment(Dictionary p_environment) { environment = p_environment; }
-
- Variant get_value_or(String p_key, Variant p_default_value);
};
#endif // RICH_TEXT_EFFECT_H
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 0331046492..abca865ae0 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1701,6 +1701,9 @@ bool RichTextLabel::remove_line(const int p_line) {
if (!was_newline) {
current_frame->lines.remove(p_line);
+ if (current_frame->lines.size() == 0) {
+ current_frame->lines.resize(1);
+ }
}
if (p_line == 0 && current->subitems.size() > 0)
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index bf067898e6..de25d6a63d 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -211,6 +211,10 @@ void SpinBox::_notification(int p_what) {
_adjust_width_for_icon(get_icon("updown"));
_value_changed(0);
+ } else if (p_what == NOTIFICATION_THEME_CHANGED) {
+
+ call_deferred("minimum_size_changed");
+ get_line_edit()->call_deferred("minimum_size_changed");
}
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 2558a930b6..bf3ec9b05b 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4438,7 +4438,6 @@ int TextEdit::get_line_wrap_index_at_col(int p_line, int p_column) const {
}
void TextEdit::cursor_set_column(int p_col, bool p_adjust_viewport) {
-
if (p_col < 0)
p_col = 0;
@@ -7141,6 +7140,7 @@ TextEdit::TextEdit() {
max_chars = 0;
clear();
wrap_enabled = false;
+ wrap_at = 0;
wrap_right_offset = 10;
set_focus_mode(FOCUS_ALL);
syntax_highlighter = NULL;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 594366de7d..4f11e9bb50 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -69,6 +69,10 @@ public:
int region;
bool end;
+ ColorRegionInfo() {
+ region = 0;
+ end = false;
+ }
};
struct Line {
@@ -84,6 +88,16 @@ public:
Ref<Texture> info_icon;
String info;
String data;
+ Line() {
+ width_cache = 0;
+ marked = false;
+ breakpoint = false;
+ bookmark = false;
+ hidden = false;
+ safe = false;
+ has_info = false;
+ wrap_amount_cache = 0;
+ }
};
private:
@@ -143,6 +157,14 @@ private:
int last_fit_x;
int line, column; ///< cursor
int x_ofs, line_ofs, wrap_ofs;
+ Cursor() {
+ last_fit_x = 0;
+ line = 0;
+ column = 0; ///< cursor
+ x_ofs = 0;
+ line_ofs = 0;
+ wrap_ofs = 0;
+ }
} cursor;
struct Selection {
@@ -167,7 +189,21 @@ private:
int to_line, to_column;
bool shiftclick_left;
-
+ Selection() {
+ selecting_mode = MODE_NONE;
+ selecting_line = 0;
+ selecting_column = 0;
+ selected_word_beg = 0;
+ selected_word_end = 0;
+ selected_word_origin = 0;
+ selecting_text = false;
+ active = false;
+ from_line = 0;
+ from_column = 0;
+ to_line = 0;
+ to_column = 0;
+ shiftclick_left = false;
+ }
} selection;
struct Cache {
@@ -219,6 +255,16 @@ private:
int fold_gutter_width;
int info_gutter_width;
int minimap_width;
+ Cache() {
+
+ row_height = 0;
+ line_spacing = 0;
+ line_number_w = 0;
+ breakpoint_gutter_width = 0;
+ fold_gutter_width = 0;
+ info_gutter_width = 0;
+ minimap_width = 0;
+ }
} cache;
Map<int, int> color_region_cache;
@@ -240,6 +286,17 @@ private:
uint32_t version;
bool chain_forward;
bool chain_backward;
+ TextOperation() {
+ type = TYPE_NONE;
+ from_line = 0;
+ from_column = 0;
+ to_line = 0;
+ to_column = 0;
+ prev_version = 0;
+ version = 0;
+ chain_forward = false;
+ chain_backward = false;
+ }
};
String ime_text;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 3a6fff45c5..48f6a0cc95 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -423,7 +423,7 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) {
input_handled = false;
- Ref<InputEvent> ev = p_event;
+ const Ref<InputEvent> &ev = p_event;
MainLoop::input_event(ev);
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 99a2881d58..7524571956 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -657,6 +657,7 @@ void DynamicFont::_reload_cache() {
if (!data.is_valid()) {
data_at_size.unref();
outline_data_at_size.unref();
+ fallbacks.resize(0);
fallback_data_at_size.resize(0);
fallback_outline_data_at_size.resize(0);
return;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 4afb07cb6f..0d94d4dbf4 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -483,6 +483,7 @@ void Mesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lightmap_size_hint", "size"), &Mesh::set_lightmap_size_hint);
ClassDB::bind_method(D_METHOD("get_lightmap_size_hint"), &Mesh::get_lightmap_size_hint);
+ ClassDB::bind_method(D_METHOD("get_aabb"), &Mesh::get_aabb);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "lightmap_size_hint"), "set_lightmap_size_hint", "get_lightmap_size_hint");
diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp
index 62c5f9bab3..cc6ec93d74 100644
--- a/scene/resources/segment_shape_2d.cpp
+++ b/scene/resources/segment_shape_2d.cpp
@@ -120,8 +120,8 @@ void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Vector<Vector2> pts;
float tsize = 4;
pts.push_back(tip + Vector2(0, tsize));
- pts.push_back(tip + Vector2(0.707 * tsize, 0));
- pts.push_back(tip + Vector2(-0.707 * tsize, 0));
+ pts.push_back(tip + Vector2(Math_SQRT12 * tsize, 0));
+ pts.push_back(tip + Vector2(-Math_SQRT12 * tsize, 0));
Vector<Color> cols;
for (int i = 0; i < 3; i++)
cols.push_back(p_color);
@@ -134,7 +134,7 @@ Rect2 RayShape2D::get_rect() const {
Rect2 rect;
rect.position = Vector2();
rect.expand_to(Vector2(0, length));
- rect = rect.grow(0.707 * 4);
+ rect = rect.grow(Math_SQRT12 * 4);
return rect;
}
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 593c399f62..b21546af2f 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1333,6 +1333,7 @@ void LargeTexture::set_piece_offset(int p_idx, const Point2 &p_offset) {
void LargeTexture::set_piece_texture(int p_idx, const Ref<Texture> &p_texture) {
ERR_FAIL_COND(p_texture == this);
+ ERR_FAIL_COND(p_texture.is_null());
ERR_FAIL_INDEX(p_idx, pieces.size());
pieces.write[p_idx].texture = p_texture;
};
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index c897365b21..bf9079c9f4 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -720,7 +720,10 @@ void Theme::clear() {
while ((K = icon_map.next(K))) {
const StringName *L = NULL;
while ((L = icon_map[*K].next(L))) {
- icon_map[*K][*L]->disconnect("changed", this, "_emit_theme_changed");
+ Ref<Texture> icon = icon_map[*K][*L];
+ if (icon.is_valid()) {
+ icon->disconnect("changed", this, "_emit_theme_changed");
+ }
}
}
}
@@ -730,7 +733,10 @@ void Theme::clear() {
while ((K = style_map.next(K))) {
const StringName *L = NULL;
while ((L = style_map[*K].next(L))) {
- style_map[*K][*L]->disconnect("changed", this, "_emit_theme_changed");
+ Ref<StyleBox> style = style_map[*K][*L];
+ if (style.is_valid()) {
+ style->disconnect("changed", this, "_emit_theme_changed");
+ }
}
}
}
@@ -740,7 +746,10 @@ void Theme::clear() {
while ((K = font_map.next(K))) {
const StringName *L = NULL;
while ((L = font_map[*K].next(L))) {
- font_map[*K][*L]->disconnect("changed", this, "_emit_theme_changed");
+ Ref<Font> font = font_map[*K][*L];
+ if (font.is_valid()) {
+ font->disconnect("changed", this, "_emit_theme_changed");
+ }
}
}
}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 9f99732714..797de1d863 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -2259,6 +2259,8 @@ void VisualShaderNodeGroupBase::set_input_port_type(int p_id, int p_type) {
int index = 0;
for (int i = 0; i < inputs_strings.size(); i++) {
Vector<String> arr = inputs_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
if (arr[0].to_int() == p_id) {
index += arr[0].size();
count = arr[1].size() - 1;
@@ -2292,6 +2294,8 @@ void VisualShaderNodeGroupBase::set_input_port_name(int p_id, const String &p_na
int index = 0;
for (int i = 0; i < inputs_strings.size(); i++) {
Vector<String> arr = inputs_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
if (arr[0].to_int() == p_id) {
index += arr[0].size() + arr[1].size();
count = arr[2].size() - 1;
@@ -2325,6 +2329,8 @@ void VisualShaderNodeGroupBase::set_output_port_type(int p_id, int p_type) {
int index = 0;
for (int i = 0; i < output_strings.size(); i++) {
Vector<String> arr = output_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
if (arr[0].to_int() == p_id) {
index += arr[0].size();
count = arr[1].size() - 1;
@@ -2358,6 +2364,8 @@ void VisualShaderNodeGroupBase::set_output_port_name(int p_id, const String &p_n
int index = 0;
for (int i = 0; i < output_strings.size(); i++) {
Vector<String> arr = output_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
if (arr[0].to_int() == p_id) {
index += arr[0].size() + arr[1].size();
count = arr[2].size() - 1;
@@ -2405,6 +2413,8 @@ void VisualShaderNodeGroupBase::_apply_port_changes() {
for (int i = 0; i < inputs_strings.size(); i++) {
Vector<String> arr = inputs_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
Port port;
port.type = (PortType)arr[1].to_int();
port.name = arr[2];
@@ -2412,6 +2422,8 @@ void VisualShaderNodeGroupBase::_apply_port_changes() {
}
for (int i = 0; i < outputs_strings.size(); i++) {
Vector<String> arr = outputs_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
Port port;
port.type = (PortType)arr[1].to_int();
port.name = arr[2];
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index a94fdd9d7b..6e4b5d9af0 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -715,6 +715,7 @@ void VisualShaderNodeTexture::_bind_methods() {
BIND_ENUM_CONSTANT(SOURCE_2D_TEXTURE);
BIND_ENUM_CONSTANT(SOURCE_2D_NORMAL);
BIND_ENUM_CONSTANT(SOURCE_DEPTH);
+ BIND_ENUM_CONSTANT(SOURCE_PORT);
BIND_ENUM_CONSTANT(TYPE_DATA);
BIND_ENUM_CONSTANT(TYPE_COLOR);
BIND_ENUM_CONSTANT(TYPE_NORMALMAP);
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp
index 83d78daff4..3b6b1de806 100644
--- a/servers/audio/effects/audio_effect_record.cpp
+++ b/servers/audio/effects/audio_effect_record.cpp
@@ -192,10 +192,11 @@ void AudioEffectRecord::set_recording_active(bool p_record) {
}
ensure_thread_stopped();
+ recording_active = true;
current_instance->init();
+ } else {
+ recording_active = false;
}
-
- recording_active = p_record;
}
bool AudioEffectRecord::is_recording_active() const {
diff --git a/servers/physics/joints/cone_twist_joint_sw.cpp b/servers/physics/joints/cone_twist_joint_sw.cpp
index 1b3de3e913..cd86128dc3 100644
--- a/servers/physics/joints/cone_twist_joint_sw.cpp
+++ b/servers/physics/joints/cone_twist_joint_sw.cpp
@@ -53,7 +53,7 @@ Written by: Marcus Hennix
static void plane_space(const Vector3 &n, Vector3 &p, Vector3 &q) {
- if (Math::abs(n.z) > 0.707106781186547524400844362) {
+ if (Math::abs(n.z) > Math_SQRT12) {
// choose p in y-z plane
real_t a = n[1] * n[1] + n[2] * n[2];
real_t k = 1.0 / Math::sqrt(a);
diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics/joints/hinge_joint_sw.cpp
index 209cddda5e..633f0b4921 100644
--- a/servers/physics/joints/hinge_joint_sw.cpp
+++ b/servers/physics/joints/hinge_joint_sw.cpp
@@ -51,7 +51,7 @@ subject to the following restrictions:
static void plane_space(const Vector3 &n, Vector3 &p, Vector3 &q) {
- if (Math::abs(n.z) > 0.707106781186547524400844362) {
+ if (Math::abs(n.z) > Math_SQRT12) {
// choose p in y-z plane
real_t a = n[1] * n[1] + n[2] * n[2];
real_t k = 1.0 / Math::sqrt(a);
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index 80e204087a..73baab2dd6 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -174,7 +174,7 @@ void Physics2DServerSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &
}
Vector2 rel_dir = (p_point_A - p_point_B).normalized();
- if (cbk->valid_dir.dot(rel_dir) < 0.7071) { //sqrt(2)/2.0 - 45 degrees
+ if (cbk->valid_dir.dot(rel_dir) < Math_SQRT12) { //sqrt(2)/2.0 - 45 degrees
cbk->invalid_by_dir++;
/*
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index a7ff4f35db..1aceb8dcd8 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -2912,7 +2912,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
tk = _get_token();
if (tk.type == TK_PARENTHESIS_OPEN) {
//a function
- StringName name = identifier;
+ const StringName &name = identifier;
OperatorNode *func = alloc_node<OperatorNode>();
func->op = OP_CALL;
diff --git a/thirdparty/vhacd/0003-fix-musl-build.patch b/thirdparty/vhacd/0003-fix-musl-build.patch
new file mode 100644
index 0000000000..67af8546f3
--- /dev/null
+++ b/thirdparty/vhacd/0003-fix-musl-build.patch
@@ -0,0 +1,15 @@
+diff --git a/thirdparty/vhacd/inc/vhacdMutex.h b/thirdparty/vhacd/inc/vhacdMutex.h
+index 6b09259200..d587dd6387 100644
+--- a/thirdparty/vhacd/inc/vhacdMutex.h
++++ b/thirdparty/vhacd/inc/vhacdMutex.h
+@@ -71,7 +71,9 @@
+ #include <pthread.h>
+ #endif
+
+-#if defined(__APPLE__)
++// -- GODOT start --
++#if defined(__APPLE__) || !defined(__GLIBC__)
++// -- GODOT end --
+ #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
+ #endif
+
diff --git a/thirdparty/vhacd/inc/vhacdMutex.h b/thirdparty/vhacd/inc/vhacdMutex.h
index 6b09259200..d587dd6387 100644
--- a/thirdparty/vhacd/inc/vhacdMutex.h
+++ b/thirdparty/vhacd/inc/vhacdMutex.h
@@ -71,7 +71,9 @@
#include <pthread.h>
#endif
-#if defined(__APPLE__)
+// -- GODOT start --
+#if defined(__APPLE__) || !defined(__GLIBC__)
+// -- GODOT end --
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif