summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct7
-rw-r--r--core/io/image_loader.h12
-rw-r--r--core/math/transform.cpp5
-rw-r--r--core/math/transform.h1
-rw-r--r--core/os/dir_access.h12
-rw-r--r--core/variant_call.cpp26
-rw-r--r--doc/classes/@GlobalScope.xml4
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp1
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp40
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp2
-rw-r--r--editor/editor_export.cpp38
-rw-r--r--editor/editor_properties.cpp2
-rw-r--r--editor/export_template_manager.cpp12
-rw-r--r--editor/find_in_files.cpp1
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp11
-rw-r--r--editor/plugins/script_editor_plugin.cpp1
-rw-r--r--editor/plugins/script_text_editor.cpp31
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/text_editor.cpp59
-rw-r--r--editor/plugins/text_editor.h3
-rw-r--r--editor/plugins/theme_editor_plugin.cpp12
-rw-r--r--editor/pvrtc_compress.cpp53
-rw-r--r--editor/script_create_dialog.cpp25
-rw-r--r--editor/script_create_dialog.h1
-rw-r--r--main/tests/test_string.cpp5
-rw-r--r--modules/assimp/editor_scene_importer_assimp.cpp9
-rw-r--r--modules/bmp/image_loader_bmp.cpp4
-rw-r--r--modules/bullet/bullet_physics_server.cpp3
-rw-r--r--modules/bullet/cone_twist_joint_bullet.cpp6
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.cpp9
-rw-r--r--modules/bullet/hinge_joint_bullet.cpp6
-rw-r--r--modules/bullet/pin_joint_bullet.cpp3
-rw-r--r--modules/bullet/shape_bullet.cpp3
-rw-r--r--modules/bullet/space_bullet.cpp6
-rw-r--r--modules/dds/texture_loader_dds.cpp10
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp11
-rw-r--r--modules/etc/texture_loader_pkm.cpp3
-rw-r--r--modules/gdnative/gdnative_builders.py2
-rw-r--r--modules/gdscript/register_types.cpp4
-rw-r--r--modules/gridmap/grid_map.cpp6
-rw-r--r--modules/hdr/image_loader_hdr.cpp5
-rw-r--r--modules/mono/.gitignore2
-rw-r--r--modules/mono/glue/Managed/Files/Basis.cs77
-rw-r--r--modules/mono/icons/icon_c_#.svg5
-rw-r--r--modules/opus/audio_stream_opus.cpp3
-rw-r--r--modules/pvr/texture_loader_pvr.cpp3
-rw-r--r--modules/squish/image_compress_squish.cpp3
-rw-r--r--modules/svg/image_loader_svg.cpp6
-rw-r--r--modules/visual_script/visual_script.cpp31
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp3
-rw-r--r--modules/webm/video_stream_webm.cpp3
-rw-r--r--modules/webp/image_loader_webp.cpp3
-rw-r--r--modules/webrtc/webrtc_data_channel_js.cpp6
-rw-r--r--modules/webrtc/webrtc_multiplayer.cpp6
-rw-r--r--modules/webrtc/webrtc_peer_connection_gdnative.cpp6
-rw-r--r--modules/websocket/emws_peer.cpp6
-rw-r--r--modules/websocket/websocket_multiplayer_peer.cpp15
-rw-r--r--modules/websocket/wsl_client.cpp33
-rw-r--r--modules/websocket/wsl_server.cpp30
-rw-r--r--platform/android/export/export.cpp90
-rw-r--r--platform/javascript/export/export.cpp13
-rw-r--r--platform/osx/export/export.cpp21
-rw-r--r--platform/uwp/export/export.cpp57
-rw-r--r--platform/x11/os_x11.cpp9
-rw-r--r--servers/audio/effects/audio_effect_record.cpp2
-rw-r--r--servers/visual/shader_language.cpp1
66 files changed, 496 insertions, 393 deletions
diff --git a/SConstruct b/SConstruct
index aa5e3a98c8..128c5b0e92 100644
--- a/SConstruct
+++ b/SConstruct
@@ -484,6 +484,13 @@ if selected_platform in platform_list:
if env['minizip']:
env.Append(CPPDEFINES=['MINIZIP_ENABLED'])
+ editor_module_list = ['regex']
+ for x in editor_module_list:
+ if not env['module_' + x + '_enabled']:
+ if env['tools']:
+ print("Build option 'module_" + x + "_enabled=no' cannot be used with 'tools=yes' (editor), only with 'tools=no' (export template).")
+ sys.exit(255)
+
if not env['verbose']:
methods.no_verbose(sys, env)
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index ae4b72a534..f1fccc5230 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -41,20 +41,8 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-/**
- * @class ImageScanLineLoader
- * @author Juan Linietsky <reduzio@gmail.com>
- *
-
- */
class ImageLoader;
-/**
- * @class ImageLoader
- * Base Class and singleton for loading images from disk
- * Can load images in one go, or by scanline
- */
-
class ImageFormatLoader {
friend class ImageLoader;
friend class ResourceFormatLoaderImage;
diff --git a/core/math/transform.cpp b/core/math/transform.cpp
index 7ff7cac914..4056975da8 100644
--- a/core/math/transform.cpp
+++ b/core/math/transform.cpp
@@ -213,3 +213,8 @@ Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) :
basis(p_basis),
origin(p_origin) {
}
+
+Transform::Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz) {
+ basis = Basis(xx, xy, xz, yx, yy, yz, zx, zy, zz);
+ origin = Vector3(ox, oy, oz);
+}
diff --git a/core/math/transform.h b/core/math/transform.h
index 2f43f6b035..df0a036218 100644
--- a/core/math/transform.h
+++ b/core/math/transform.h
@@ -108,6 +108,7 @@ public:
operator String() const;
+ Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz);
Transform(const Basis &p_basis, const Vector3 &p_origin = Vector3());
Transform() {}
};
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 704eedae5b..3c0528112b 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -97,6 +97,18 @@ public:
virtual Error rename(String p_from, String p_to) = 0;
virtual Error remove(String p_name) = 0;
+ // Meant for editor code when we want to quickly remove a file without custom
+ // handling (e.g. removing a cache file).
+ static void remove_file_or_error(String p_path) {
+ DirAccess *da = create(ACCESS_FILESYSTEM);
+ if (da->file_exists(p_path)) {
+ if (da->remove(p_path) != OK) {
+ ERR_FAIL_MSG("Cannot remove file or directory: " + p_path);
+ }
+ }
+ memdelete(da);
+ }
+
virtual String get_filesystem_type() const = 0;
static String get_full_path(const String &p_path, AccessType p_access);
static DirAccess *create_for_path(const String &p_path);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 1f6e5bb653..eca5d0567b 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1955,19 +1955,27 @@ void register_variant_methods() {
_VariantCall::add_variant_constant(Variant::VECTOR2, "UP", Vector2(0, -1));
_VariantCall::add_variant_constant(Variant::VECTOR2, "DOWN", Vector2(0, 1));
- _VariantCall::add_variant_constant(Variant::TRANSFORM2D, "IDENTITY", Transform2D(1, 0, 0, 1, 0, 0));
+ _VariantCall::add_variant_constant(Variant::TRANSFORM2D, "IDENTITY", Transform2D());
_VariantCall::add_variant_constant(Variant::TRANSFORM2D, "FLIP_X", Transform2D(-1, 0, 0, 1, 0, 0));
_VariantCall::add_variant_constant(Variant::TRANSFORM2D, "FLIP_Y", Transform2D(1, 0, 0, -1, 0, 0));
- Transform identity_transform, transform_x, transform_y, transform_z;
- identity_transform.set(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
+ Transform identity_transform = Transform();
+ Transform flip_x_transform = Transform(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
+ Transform flip_y_transform = Transform(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0);
+ Transform flip_z_transform = Transform(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0);
_VariantCall::add_variant_constant(Variant::TRANSFORM, "IDENTITY", identity_transform);
- transform_x.set(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
- _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_X", transform_x);
- transform_y.set(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0);
- _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Y", transform_y);
- transform_z.set(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0);
- _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Z", transform_z);
+ _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_X", flip_x_transform);
+ _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Y", flip_y_transform);
+ _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Z", flip_z_transform);
+
+ Basis identity_basis = Basis();
+ Basis flip_x_basis = Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1);
+ Basis flip_y_basis = Basis(1, 0, 0, 0, -1, 0, 0, 0, 1);
+ Basis flip_z_basis = Basis(1, 0, 0, 0, 1, 0, 0, 0, -1);
+ _VariantCall::add_variant_constant(Variant::BASIS, "IDENTITY", identity_basis);
+ _VariantCall::add_variant_constant(Variant::BASIS, "FLIP_X", flip_x_basis);
+ _VariantCall::add_variant_constant(Variant::BASIS, "FLIP_Y", flip_y_basis);
+ _VariantCall::add_variant_constant(Variant::BASIS, "FLIP_Z", flip_z_basis);
_VariantCall::add_variant_constant(Variant::PLANE, "PLANE_YZ", Plane(Vector3(1, 0, 0), 0));
_VariantCall::add_variant_constant(Variant::PLANE, "PLANE_XZ", Plane(Vector3(0, 1, 0), 0));
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 0428140908..b25de3cf99 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1317,10 +1317,10 @@
No hint for the edited property.
</constant>
<constant name="PROPERTY_HINT_RANGE" value="1" enum="PropertyHint">
- Hints that an integer or float property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"allow_greater"[/code] and/or [code]"allow_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"-360,360,1,allow_greater,allow_lesser"[/code].
+ Hints that an integer or float property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"-360,360,1,or_greater,or_lesser"[/code].
</constant>
<constant name="PROPERTY_HINT_EXP_RANGE" value="2" enum="PropertyHint">
- Hints that an integer or float property should be within an exponential range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"allow_greater"[/code] and/or [code]"allow_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"0.01,100,0.01,allow_greater"[/code].
+ Hints that an integer or float property should be within an exponential range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"0.01,100,0.01,or_greater"[/code].
</constant>
<constant name="PROPERTY_HINT_ENUM" value="3" enum="PropertyHint">
Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string such as [code]"Hello,Something,Else"[/code].
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 8a177e32b0..4716b29e03 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -1650,6 +1650,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
//always re-set uniforms, since light parameters changed
_set_uniforms();
+ state.canvas_shader.use_material((void *)material_ptr);
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 4);
RasterizerStorageGLES2::Texture *t = storage->texture_owner.getornull(light->texture);
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index a0188da4f6..a30af87516 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -5691,21 +5691,49 @@ void RasterizerStorageGLES2::initialize() {
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ glBindFramebuffer(GL_FRAMEBUFFER, system_fbo);
+ glDeleteFramebuffers(1, &fbo);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ glDeleteTextures(1, &depth);
+
if (status == GL_FRAMEBUFFER_COMPLETE) {
config.depth_internalformat = GL_DEPTH_COMPONENT;
config.depth_type = GL_UNSIGNED_INT;
} else {
+ // If it fails, test to see if it supports a framebuffer texture using UNSIGNED_SHORT
+ // This is needed because many OSX devices don't support either UNSIGNED_INT or UNSIGNED_SHORT
+
config.depth_internalformat = GL_DEPTH_COMPONENT16;
config.depth_type = GL_UNSIGNED_SHORT;
- }
- glBindFramebuffer(GL_FRAMEBUFFER, system_fbo);
- glDeleteFramebuffers(1, &fbo);
- glBindTexture(GL_TEXTURE_2D, 0);
- glDeleteTextures(1, &depth);
+ glGenFramebuffers(1, &fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glGenTextures(1, &depth);
+ glBindTexture(GL_TEXTURE_2D, depth);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, 32, 32, 0, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, NULL);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth, 0);
+
+ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ //if it fails again depth textures aren't supported, use rgba shadows and renderbuffer for depth
+ config.support_depth_texture = false;
+ config.use_rgba_3d_shadows = true;
+ }
+
+ glBindFramebuffer(GL_FRAMEBUFFER, system_fbo);
+ glDeleteFramebuffers(1, &fbo);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ glDeleteTextures(1, &depth);
+ }
} else {
- // Will use renderbuffer for depth
+ // Will use renderbuffer for depth, on mobile check for 24 bit depth support
if (config.extensions.has("GL_OES_depth24")) {
config.depth_internalformat = _DEPTH_COMPONENT24_OES;
config.depth_type = GL_UNSIGNED_INT;
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index f4faed8736..1a97225e6b 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -200,6 +200,8 @@ void RasterizerCanvasGLES3::canvas_end() {
glBindBufferBase(GL_UNIFORM_BUFFER, 0, 0);
glColorMask(1, 1, 1, 1);
+ glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+
state.using_texture_rect = false;
state.using_ninepatch = false;
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index ed262d9c4f..e1f2635275 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -35,6 +35,7 @@
#include "core/io/resource_saver.h"
#include "core/io/zip_io.h"
#include "core/math/crypto_core.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"
#include "core/script_language.h"
@@ -884,6 +885,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
String engine_cfb = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp" + config_file);
ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list);
Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb);
+ DirAccess::remove_file_or_error(engine_cfb);
p_func(p_udata, "res://" + config_file, data, idx, total);
@@ -916,8 +918,10 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
memdelete(ftmp); //close tmp file
- if (err)
+ if (err != OK) {
+ DirAccess::remove_file_or_error(tmppath);
return err;
+ }
pd.file_ofs.sort(); //do sort, so we can do binary search later
@@ -926,11 +930,17 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
if (!p_embed) {
// Regular output to separate PCK file
f = FileAccess::open(p_path, FileAccess::WRITE);
- ERR_FAIL_COND_V(!f, ERR_CANT_CREATE);
+ if (!f) {
+ DirAccess::remove_file_or_error(tmppath);
+ ERR_FAIL_V(ERR_CANT_CREATE);
+ }
} else {
// Append to executable
f = FileAccess::open(p_path, FileAccess::READ_WRITE);
- ERR_FAIL_COND_V(!f, ERR_FILE_CANT_OPEN);
+ if (!f) {
+ DirAccess::remove_file_or_error(tmppath);
+ ERR_FAIL_V(ERR_FILE_CANT_OPEN);
+ }
f->seek_end();
embed_pos = f->get_position();
@@ -995,13 +1005,13 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
f->store_8(0);
}
- //save the rest of the data
+ // Save the rest of the data.
ftmp = FileAccess::open(tmppath, FileAccess::READ);
if (!ftmp) {
memdelete(f);
- ERR_EXPLAIN("Can't open file to read from path: " + String(tmppath));
- ERR_FAIL_V(ERR_CANT_CREATE);
+ DirAccess::remove_file_or_error(tmppath);
+ ERR_FAIL_V_MSG(ERR_CANT_CREATE, "Can't open file to read from path: " + String(tmppath));
}
const int bufsize = 16384;
@@ -1035,6 +1045,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
}
memdelete(f);
+ DirAccess::remove_file_or_error(tmppath);
return OK;
}
@@ -1043,8 +1054,6 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
EditorProgress ep("savezip", TTR("Packing"), 102, true);
- //FileAccess *tmp = FileAccess::open(tmppath,FileAccess::WRITE);
-
FileAccess *src_f;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io);
@@ -1694,11 +1703,18 @@ void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, con
bool convert = GLOBAL_GET("editor/convert_text_resources_to_binary_on_export");
if (!convert)
return;
- String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("file.res");
+ String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpfile.res");
Error err = ResourceFormatLoaderText::convert_file_to_binary(p_path, tmp_path);
- ERR_FAIL_COND(err != OK);
+ if (err != OK) {
+ DirAccess::remove_file_or_error(tmp_path);
+ ERR_FAIL();
+ }
Vector<uint8_t> data = FileAccess::get_file_as_array(tmp_path);
- ERR_FAIL_COND(data.size() == 0);
+ if (data.size() == 0) {
+ DirAccess::remove_file_or_error(tmp_path);
+ ERR_FAIL();
+ }
+ DirAccess::remove_file_or_error(tmp_path);
add_file(p_path + ".converted.res", data, true);
}
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 3300228921..20ba07c102 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -116,7 +116,7 @@ void EditorPropertyMultilineText::_open_big_text() {
add_child(big_text_dialog);
}
- big_text_dialog->popup_centered_ratio();
+ big_text_dialog->popup_centered_clamped(Size2(1000, 900) * EDSCALE, 0.8);
big_text->set_text(text->get_text());
big_text->grab_focus();
}
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index ecfad4d146..8a5f77c25f 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -422,14 +422,16 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
String path = download_templates->get_download_file();
template_list_state->set_text(TTR("Download Complete."));
template_downloader->hide();
- int ret = _install_from_file(path, false);
+ bool ret = _install_from_file(path, false);
if (ret) {
- Error err = OS::get_singleton()->move_to_trash(path);
+ // Clean up downloaded file.
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ Error err = da->remove(path);
if (err != OK) {
- EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + path + "\n");
+ EditorNode::get_singleton()->add_io_error(TTR("Cannot remove temporary file:") + "\n" + path + "\n");
}
} else {
- WARN_PRINTS(vformat(TTR("Templates installation failed. The problematic templates archives can be found at '%s'."), path));
+ EditorNode::get_singleton()->add_io_error(vformat(TTR("Templates installation failed.\nThe problematic templates archives can be found at '%s'."), path));
}
}
} break;
@@ -458,7 +460,7 @@ void ExportTemplateManager::_begin_template_download(const String &p_url) {
Error err = download_templates->request(p_url);
if (err != OK) {
- EditorNode::get_singleton()->show_warning(TTR("Error requesting url: ") + p_url);
+ EditorNode::get_singleton()->show_warning(TTR("Error requesting URL:") + " " + p_url);
return;
}
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 8665467f2d..cc2efb92ae 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -547,6 +547,7 @@ FindInFilesPanel::FindInFilesPanel() {
_results_display->connect("item_edited", this, "_on_item_edited");
_results_display->set_hide_root(true);
_results_display->set_select_mode(Tree::SELECT_ROW);
+ _results_display->set_allow_rmb_select(true);
_results_display->create_item(); // Root
vbc->add_child(_results_display);
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 4a2295fab2..5679426eb5 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -354,16 +354,16 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
} break;
case HTTPRequest::RESULT_REQUEST_FAILED: {
error_text = TTR("Request failed, return code:") + " " + itos(p_code);
- status->set_text(TTR("Request Failed."));
+ status->set_text(TTR("Request failed."));
} break;
case HTTPRequest::RESULT_DOWNLOAD_FILE_CANT_OPEN:
case HTTPRequest::RESULT_DOWNLOAD_FILE_WRITE_ERROR: {
- error_text = TTR("Cannot save response to") + " " + download->get_download_file();
+ error_text = TTR("Cannot save response to:") + " " + download->get_download_file();
status->set_text(TTR("Write error."));
} break;
case HTTPRequest::RESULT_REDIRECT_LIMIT_REACHED: {
error_text = TTR("Request failed, too many redirects");
- status->set_text(TTR("Redirect Loop."));
+ status->set_text(TTR("Redirect loop."));
} break;
case HTTPRequest::RESULT_TIMEOUT: {
error_text = TTR("Request failed, timeout");
@@ -472,9 +472,8 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) {
}
void EditorAssetLibraryItemDownload::_close() {
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- da->remove(download->get_download_file()); //clean up removed file
- memdelete(da);
+ // Clean up downloaded file.
+ DirAccess::remove_file_or_error(download->get_download_file());
queue_delete();
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index ec391186c3..1072c3cad1 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1072,6 +1072,7 @@ void ScriptEditor::_menu_option(int p_option) {
save_all_scripts();
} break;
case SEARCH_IN_FILES: {
+
_on_find_in_files_requested("");
} break;
case SEARCH_HELP: {
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index ddb87b200d..87248c53b1 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -30,6 +30,7 @@
#include "script_text_editor.h"
+#include "core/math/expression.h"
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
@@ -1147,6 +1148,32 @@ void ScriptTextEditor::_edit_option(int p_op) {
_convert_case(CodeTextEditor::CAPITALIZE);
} break;
+ case EDIT_EVALUATE: {
+
+ Expression expression;
+ Vector<String> lines = code_editor->get_text_edit()->get_selection_text().split("\n");
+ PoolStringArray results;
+
+ for (int i = 0; i < lines.size(); i++) {
+ String line = lines[i];
+ String whitespace = line.substr(0, line.size() - line.strip_edges(true, false).size()); //extract the whitespace at the beginning
+
+ if (expression.parse(line) == OK) {
+ Variant result = expression.execute(Array(), Variant(), false);
+ if (expression.get_error_text() == "") {
+ results.append(whitespace + (String)result);
+ } else {
+ results.append(line);
+ }
+ } else {
+ results.append(line);
+ }
+ }
+
+ code_editor->get_text_edit()->begin_complex_operation(); //prevents creating a two-step undo
+ code_editor->get_text_edit()->insert_text_at_cursor(results.join("\n"));
+ code_editor->get_text_edit()->end_complex_operation();
+ } break;
case SEARCH_FIND: {
code_editor->get_find_replace_bar()->popup_search();
@@ -1170,7 +1197,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
// Yep, because it doesn't make sense to instance this dialog for every single script open...
// So this will be delegated to the ScriptEditor.
emit_signal("search_in_files_requested", selected_text);
-
} break;
case SEARCH_LOCATE_FUNCTION: {
@@ -1650,6 +1676,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
context_menu->add_separator();
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_uppercase"), EDIT_TO_UPPERCASE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_lowercase"), EDIT_TO_LOWERCASE);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/evaluate_selection"), EDIT_EVALUATE);
}
if (p_foldable)
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);
@@ -1750,6 +1777,7 @@ ScriptTextEditor::ScriptTextEditor() {
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/evaluate_selection"), EDIT_EVALUATE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS);
@@ -1875,6 +1903,7 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_D);
ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD | KEY_SPACE);
#endif
+ ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_E);
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent to Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent to Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_I);
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 4b2307555b..38c6da5c33 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -120,6 +120,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_TO_UPPERCASE,
EDIT_TO_LOWERCASE,
EDIT_CAPITALIZE,
+ EDIT_EVALUATE,
EDIT_TOGGLE_FOLD_LINE,
EDIT_FOLD_ALL_LINES,
EDIT_UNFOLD_ALL_LINES,
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index a8fbadb773..89e419ede8 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -221,19 +221,19 @@ void TextEditor::_validate_script() {
void TextEditor::_update_bookmark_list() {
- bookmarks_menu->get_popup()->clear();
+ bookmarks_menu->clear();
- bookmarks_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
- bookmarks_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_bookmarks"), BOOKMARK_REMOVE_ALL);
- bookmarks_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_bookmark"), BOOKMARK_GOTO_NEXT);
- bookmarks_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
+ bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE);
+ bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_bookmarks"), BOOKMARK_REMOVE_ALL);
+ bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_bookmark"), BOOKMARK_GOTO_NEXT);
+ bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
Array bookmark_list = code_editor->get_text_edit()->get_bookmarks_array();
if (bookmark_list.size() == 0) {
return;
}
- bookmarks_menu->get_popup()->add_separator();
+ bookmarks_menu->add_separator();
for (int i = 0; i < bookmark_list.size(); i++) {
String line = code_editor->get_text_edit()->get_line(bookmark_list[i]).strip_edges();
@@ -242,17 +242,17 @@ void TextEditor::_update_bookmark_list() {
line = line.substr(0, 50);
}
- bookmarks_menu->get_popup()->add_item(String::num((int)bookmark_list[i] + 1) + " - \"" + line + "\"");
- bookmarks_menu->get_popup()->set_item_metadata(bookmarks_menu->get_popup()->get_item_count() - 1, bookmark_list[i]);
+ bookmarks_menu->add_item(String::num((int)bookmark_list[i] + 1) + " - \"" + line + "\"");
+ bookmarks_menu->set_item_metadata(bookmarks_menu->get_item_count() - 1, bookmark_list[i]);
}
}
void TextEditor::_bookmark_item_pressed(int p_idx) {
if (p_idx < 4) { // Any item before the separator.
- _edit_option(bookmarks_menu->get_popup()->get_item_id(p_idx));
+ _edit_option(bookmarks_menu->get_item_id(p_idx));
} else {
- code_editor->goto_line(bookmarks_menu->get_popup()->get_item_metadata(p_idx));
+ code_editor->goto_line(bookmarks_menu->get_item_metadata(p_idx));
}
}
@@ -482,6 +482,14 @@ void TextEditor::_edit_option(int p_op) {
code_editor->get_find_replace_bar()->popup_replace();
} break;
+ case SEARCH_IN_FILES: {
+
+ String selected_text = code_editor->get_text_edit()->get_selection_text();
+
+ // Yep, because it doesn't make sense to instance this dialog for every single script open...
+ // So this will be delegated to the ScriptEditor.
+ emit_signal("search_in_files_requested", selected_text);
+ } break;
case SEARCH_GOTO_LINE: {
goto_line_dialog->popup_find_line(tx);
@@ -558,7 +566,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the selected text
+ // Right click is outside the selected text.
tx->deselect();
}
}
@@ -637,17 +645,14 @@ TextEditor::TextEditor() {
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
search_menu->get_popup()->add_separator();
- search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE);
-
- goto_line_dialog = memnew(GotoLineDialog);
- add_child(goto_line_dialog);
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_in_files"), SEARCH_IN_FILES);
edit_menu = memnew(MenuButton);
+ edit_hb->add_child(edit_menu);
edit_menu->set_text(TTR("Edit"));
edit_menu->set_switch_on_hover(true);
edit_menu->get_popup()->connect("id_pressed", this, "_edit_option");
- edit_hb->add_child(edit_menu);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
edit_menu->get_popup()->add_separator();
@@ -689,13 +694,25 @@ TextEditor::TextEditor() {
highlighter_menu->add_radio_check_item(TTR("Standard"));
highlighter_menu->connect("id_pressed", this, "_change_syntax_highlighter");
- bookmarks_menu = memnew(MenuButton);
- edit_hb->add_child(bookmarks_menu);
- bookmarks_menu->set_text(TTR("Bookmarks"));
- bookmarks_menu->set_switch_on_hover(true);
+ MenuButton *goto_menu = memnew(MenuButton);
+ edit_hb->add_child(goto_menu);
+ goto_menu->set_text(TTR("Go To"));
+ goto_menu->set_switch_on_hover(true);
+ goto_menu->get_popup()->connect("id_pressed", this, "_edit_option");
+
+ goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE);
+ goto_menu->get_popup()->add_separator();
+
+ bookmarks_menu = memnew(PopupMenu);
+ bookmarks_menu->set_name(TTR("Bookmarks"));
+ goto_menu->get_popup()->add_child(bookmarks_menu);
+ goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks");
_update_bookmark_list();
bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list");
- bookmarks_menu->get_popup()->connect("index_pressed", this, "_bookmark_item_pressed");
+ bookmarks_menu->connect("index_pressed", this, "_bookmark_item_pressed");
+
+ goto_line_dialog = memnew(GotoLineDialog);
+ add_child(goto_line_dialog);
code_editor->get_text_edit()->set_drag_forwarding(this);
}
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index c0d4052646..c8b49a61e0 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -46,7 +46,7 @@ private:
MenuButton *edit_menu;
PopupMenu *highlighter_menu;
MenuButton *search_menu;
- MenuButton *bookmarks_menu;
+ PopupMenu *bookmarks_menu;
PopupMenu *context_menu;
GotoLineDialog *goto_line_dialog;
@@ -87,6 +87,7 @@ private:
SEARCH_FIND_NEXT,
SEARCH_FIND_PREV,
SEARCH_REPLACE,
+ SEARCH_IN_FILES,
SEARCH_GOTO_LINE,
BOOKMARK_TOGGLE,
BOOKMARK_GOTO_NEXT,
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 5b67d259ba..873b125200 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -631,14 +631,12 @@ ThemeEditor::ThemeEditor() {
scroll = memnew(ScrollContainer);
add_child(scroll);
- scroll->set_theme(Theme::get_default());
scroll->set_enable_v_scroll(true);
scroll->set_enable_h_scroll(false);
scroll->set_v_size_flags(SIZE_EXPAND_FILL);
main_container = memnew(MarginContainer);
scroll->add_child(main_container);
- main_container->set_theme(Theme::get_default());
main_container->set_clip_contents(true);
main_container->set_custom_minimum_size(Size2(700, 0) * EDSCALE);
main_container->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -648,9 +646,11 @@ ThemeEditor::ThemeEditor() {
Panel *panel = memnew(Panel);
main_container->add_child(panel);
+ panel->set_theme(Theme::get_default());
MarginContainer *mc = memnew(MarginContainer);
main_container->add_child(mc);
+ mc->set_theme(Theme::get_default());
mc->add_constant_override("margin_right", 4 * EDSCALE);
mc->add_constant_override("margin_top", 4 * EDSCALE);
mc->add_constant_override("margin_left", 4 * EDSCALE);
@@ -695,19 +695,19 @@ ThemeEditor::ThemeEditor() {
test_menu_button->get_popup()->add_separator();
test_menu_button->get_popup()->add_check_item(TTR("Check Item"));
test_menu_button->get_popup()->add_check_item(TTR("Checked Item"));
- test_menu_button->get_popup()->set_item_checked(3, true);
+ test_menu_button->get_popup()->set_item_checked(4, true);
test_menu_button->get_popup()->add_separator();
test_menu_button->get_popup()->add_radio_check_item(TTR("Radio Item"));
test_menu_button->get_popup()->add_radio_check_item(TTR("Checked Radio Item"));
- test_menu_button->get_popup()->set_item_checked(6, true);
+ test_menu_button->get_popup()->set_item_checked(7, true);
test_menu_button->get_popup()->add_separator(TTR("Named Sep."));
PopupMenu *test_submenu = memnew(PopupMenu);
test_menu_button->get_popup()->add_child(test_submenu);
test_submenu->set_name("submenu");
test_menu_button->get_popup()->add_submenu_item(TTR("Submenu"), "submenu");
- test_submenu->add_item(TTR("Item 1"));
- test_submenu->add_item(TTR("Item 2"));
+ test_submenu->add_item(TTR("Subitem 1"));
+ test_submenu->add_item(TTR("Subitem 2"));
first_vb->add_child(test_menu_button);
OptionButton *test_option_button = memnew(OptionButton);
diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp
index 84cd6da3d9..7cdd900d25 100644
--- a/editor/pvrtc_compress.cpp
+++ b/editor/pvrtc_compress.cpp
@@ -32,6 +32,7 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "editor_settings.h"
@@ -52,57 +53,75 @@ static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
_base_image_compress_pvrtc2_func(p_image);
else if (_base_image_compress_pvrtc4_func)
_base_image_compress_pvrtc4_func(p_image);
-
break;
case Image::COMPRESS_PVRTC4:
if (_base_image_compress_pvrtc4_func)
_base_image_compress_pvrtc4_func(p_image);
-
break;
- default: ERR_FAIL();
+ default:
+ ERR_FAIL_MSG("Unsupported Image compress mode used in PVRTC module.");
}
return;
}
- String tmppath = EditorSettings::get_singleton()->get_cache_dir();
-
- List<String> args;
+ String tmppath = EditorSettings::get_singleton()->get_cache_dir();
String src_img = tmppath.plus_file("_tmp_src_img.png");
String dst_img = tmppath.plus_file("_tmp_dst_img.pvr");
+ List<String> args;
args.push_back("-i");
args.push_back(src_img);
args.push_back("-o");
args.push_back(dst_img);
args.push_back("-f");
- switch (p_mode) {
- case Image::COMPRESS_PVRTC2: args.push_back("PVRTC2"); break;
- case Image::COMPRESS_PVRTC4: args.push_back("PVRTC4"); break;
- case Image::COMPRESS_ETC: args.push_back("ETC"); break;
- default: ERR_FAIL();
+ switch (p_mode) {
+ case Image::COMPRESS_PVRTC2:
+ args.push_back("PVRTC2");
+ break;
+ case Image::COMPRESS_PVRTC4:
+ args.push_back("PVRTC4");
+ break;
+ case Image::COMPRESS_ETC:
+ args.push_back("ETC");
+ break;
+ default:
+ ERR_FAIL_MSG("Unsupported Image compress mode used in PVRTC module.");
}
if (EditorSettings::get_singleton()->get("filesystem/import/pvrtc_fast_conversion").operator bool()) {
args.push_back("-pvrtcfast");
}
- if (p_image->has_mipmaps())
+ if (p_image->has_mipmaps()) {
args.push_back("-m");
+ }
+ // Save source PNG.
Ref<ImageTexture> t = memnew(ImageTexture);
t->create_from_image(Ref<Image>(p_image), 0);
ResourceSaver::save(src_img, t);
Error err = OS::get_singleton()->execute(ttpath, args, true);
- ERR_EXPLAIN(TTR("Could not execute PVRTC tool:") + " " + ttpath);
- ERR_FAIL_COND(err != OK);
+ if (err != OK) {
+ // Clean up generated files.
+ DirAccess::remove_file_or_error(src_img);
+ DirAccess::remove_file_or_error(dst_img);
+ ERR_FAIL_MSG("Could not execute PVRTC tool: " + ttpath);
+ }
t = ResourceLoader::load(dst_img, "Texture");
-
- ERR_EXPLAIN(TTR("Can't load back converted image using PVRTC tool:") + " " + dst_img);
- ERR_FAIL_COND(t.is_null());
+ if (t.is_null()) {
+ // Clean up generated files.
+ DirAccess::remove_file_or_error(src_img);
+ DirAccess::remove_file_or_error(dst_img);
+ ERR_FAIL_MSG("Can't load back converted image using PVRTC tool.");
+ }
p_image->copy_internals_from(t->get_data());
+
+ // Clean up generated files.
+ DirAccess::remove_file_or_error(src_img);
+ DirAccess::remove_file_or_error(dst_img);
}
static void _compress_pvrtc2(Image *p_image) {
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index ed9a24311d..7d0f40fe91 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -44,6 +44,23 @@ void ScriptCreateDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_ENTER_TREE: {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ String lang = ScriptServer::get_language(i)->get_name();
+ Ref<Texture> lang_icon = get_icon(lang, "EditorIcons");
+ if (lang_icon.is_valid()) {
+ language_menu->set_item_icon(i, lang_icon);
+ }
+ }
+ String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
+ Ref<Texture> last_lang_icon;
+ if (!last_lang.empty()) {
+ last_lang_icon = get_icon(last_lang, "EditorIcons");
+ } else {
+ last_lang_icon = language_menu->get_item_icon(default_language);
+ }
+ if (last_lang_icon.is_valid()) {
+ language_menu->set_icon(last_lang_icon);
+ }
path_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_browse_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_search_button->set_icon(get_icon("ClassList", "EditorIcons"));
@@ -671,13 +688,13 @@ ScriptCreateDialog::ScriptCreateDialog() {
gc->add_child(l);
gc->add_child(language_menu);
- int default_lang = 0;
+ default_language = 0;
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
String lang = ScriptServer::get_language(i)->get_name();
language_menu->add_item(lang);
if (lang == "GDScript") {
- default_lang = i;
+ default_language = i;
}
}
@@ -691,8 +708,8 @@ ScriptCreateDialog::ScriptCreateDialog() {
}
}
} else {
- language_menu->select(default_lang);
- current_language = default_lang;
+ language_menu->select(default_language);
+ current_language = default_language;
}
language_menu->connect("item_selected", this, "_lang_changed");
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index 288b8f604b..202846fd3c 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -76,6 +76,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
bool is_built_in;
bool built_in_enabled;
int current_language;
+ int default_language;
bool re_check_path;
String script_template;
Vector<String> template_list;
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index ab5fb64252..7a41880645 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -432,6 +432,10 @@ bool test_26() {
OS::get_singleton()->print("\n\nTest 26: RegEx substitution\n");
+#ifndef MODULE_REGEX_ENABLED
+ OS::get_singleton()->print("\tRegEx module disabled, can't run test.");
+ return false;
+#else
String s = "Double all the vowels.";
OS::get_singleton()->print("\tString: %ls\n", s.c_str());
@@ -443,6 +447,7 @@ bool test_26() {
OS::get_singleton()->print("\tResult: %ls\n", s.c_str());
return (s == "Doouublee aall thee vooweels.");
+#endif
}
struct test_27_data {
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp
index 65fa8b6459..05f9120a07 100644
--- a/modules/assimp/editor_scene_importer_assimp.cpp
+++ b/modules/assimp/editor_scene_importer_assimp.cpp
@@ -150,8 +150,7 @@ Node *EditorSceneImporterAssimp::import_scene(const String &p_path, uint32_t p_f
0;
const aiScene *scene = importer.ReadFile(s_path.c_str(),
post_process_Steps);
- ERR_EXPLAIN(String("Open Asset Import failed to open: ") + String(importer.GetErrorString()));
- ERR_FAIL_COND_V(scene == NULL, NULL);
+ ERR_FAIL_COND_V_MSG(scene == NULL, NULL, String("Open Asset Import failed to open: ") + String(importer.GetErrorString()) + ".");
return _generate_scene(p_path, scene, p_flags, p_bake_fps, max_bone_weights);
}
@@ -348,8 +347,7 @@ void EditorSceneImporterAssimp::_fill_node_relationships(ImportState &state, con
} else if (ownership[name] != p_skeleton_id) {
//oh, it's from another skeleton? fine.. reparent all bones to this skeleton.
int prev_owner = ownership[name];
- ERR_EXPLAIN("A previous skeleton exists for bone '" + name + "', this type of skeleton layout is unsupported.");
- ERR_FAIL_COND(skeleton_map.has(prev_owner));
+ ERR_FAIL_COND_MSG(skeleton_map.has(prev_owner), "A previous skeleton exists for bone '" + name + "', this type of skeleton layout is unsupported.");
for (Map<String, int>::Element *E = ownership.front(); E; E = E->next()) {
if (E->get() == prev_owner) {
E->get() = p_skeleton_id;
@@ -779,8 +777,7 @@ Ref<Texture> EditorSceneImporterAssimp::_load_texture(ImportState &state, String
t->set_storage(ImageTexture::STORAGE_COMPRESS_LOSSY);
return t;
} else if (tex->CheckFormat("dds")) {
- ERR_EXPLAIN("Open Asset Import: Embedded dds not implemented");
- ERR_FAIL_COND_V(true, Ref<Texture>());
+ ERR_FAIL_V_MSG(Ref<Texture>(), "Open Asset Import: Embedded dds not implemented.");
//Ref<Image> img = Image::_dds_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth);
//ERR_FAIL_COND_V(img.is_null(), Ref<Texture>());
//Ref<ImageTexture> t;
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp
index 88732dff33..5a32fa1c2c 100644
--- a/modules/bmp/image_loader_bmp.cpp
+++ b/modules/bmp/image_loader_bmp.cpp
@@ -241,9 +241,9 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f,
case BI_CMYKRLE8:
case BI_CMYKRLE4: {
// Stop parsing
- ERR_EXPLAIN("Compressed BMP files are not supported: " + f->get_path());
+ String bmp_path = f->get_path();
f->close();
- ERR_FAIL_V(ERR_UNAVAILABLE);
+ ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Compressed BMP files are not supported: " + bmp_path + ".");
} break;
}
// Don't rely on sizeof(bmp_file_header) as structure padding
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 038001996d..e01928191a 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -1548,8 +1548,7 @@ void BulletPhysicsServer::free(RID p_rid) {
bulletdelete(space);
} else {
- ERR_EXPLAIN("Invalid ID");
- ERR_FAIL();
+ ERR_FAIL_MSG("Invalid ID.");
}
}
diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp
index bc7fd52cf6..97b9a81f77 100644
--- a/modules/bullet/cone_twist_joint_bullet.cpp
+++ b/modules/bullet/cone_twist_joint_bullet.cpp
@@ -83,8 +83,7 @@ void ConeTwistJointBullet::set_param(PhysicsServer::ConeTwistJointParam p_param,
coneConstraint->setLimit(coneConstraint->getSwingSpan1(), coneConstraint->getSwingSpan2(), coneConstraint->getTwistSpan(), coneConstraint->getLimitSoftness(), coneConstraint->getBiasFactor(), p_value);
break;
default:
- ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("The parameter " + itos(p_param) + " is deprecated.");
break;
}
}
@@ -102,8 +101,7 @@ real_t ConeTwistJointBullet::get_param(PhysicsServer::ConeTwistJointParam p_para
case PhysicsServer::CONE_TWIST_JOINT_RELAXATION:
return coneConstraint->getRelaxationFactor();
default:
- ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("The parameter " + itos(p_param) + " is deprecated.");
return 0;
}
}
diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp
index 0d2c46c579..4aae87c220 100644
--- a/modules/bullet/generic_6dof_joint_bullet.cpp
+++ b/modules/bullet/generic_6dof_joint_bullet.cpp
@@ -174,8 +174,7 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_equilibriumPoint = p_value;
break;
default:
- ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("The parameter " + itos(p_param) + " is deprecated.");
break;
}
}
@@ -216,8 +215,7 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_equilibriumPoint;
default:
- ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("The parameter " + itos(p_param) + " is deprecated.");
return 0;
}
}
@@ -255,8 +253,7 @@ void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOF
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableSpring = p_value;
break;
default:
- ERR_EXPLAIN("This flag " + itos(p_flag) + " is deprecated");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("The flag " + itos(p_flag) + " is deprecated.");
break;
}
}
diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp
index b7e1e1a4c2..4d26e729db 100644
--- a/modules/bullet/hinge_joint_bullet.cpp
+++ b/modules/bullet/hinge_joint_bullet.cpp
@@ -117,8 +117,7 @@ void HingeJointBullet::set_param(PhysicsServer::HingeJointParam p_param, real_t
hingeConstraint->setMaxMotorImpulse(p_value);
break;
default:
- ERR_EXPLAIN("The HingeJoint parameter " + itos(p_param) + " is deprecated.");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("The HingeJoint parameter " + itos(p_param) + " is deprecated.");
break;
}
}
@@ -143,8 +142,7 @@ real_t HingeJointBullet::get_param(PhysicsServer::HingeJointParam p_param) const
case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE:
return hingeConstraint->getMaxMotorImpulse();
default:
- ERR_EXPLAIN("The HingeJoint parameter " + itos(p_param) + " is deprecated.");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("The HingeJoint parameter " + itos(p_param) + " is deprecated.");
return 0;
}
}
diff --git a/modules/bullet/pin_joint_bullet.cpp b/modules/bullet/pin_joint_bullet.cpp
index c9c4d1af7e..8d404e7f04 100644
--- a/modules/bullet/pin_joint_bullet.cpp
+++ b/modules/bullet/pin_joint_bullet.cpp
@@ -85,8 +85,7 @@ real_t PinJointBullet::get_param(PhysicsServer::PinJointParam p_param) const {
case PhysicsServer::PIN_JOINT_IMPULSE_CLAMP:
return p2pConstraint->m_setting.m_impulseClamp;
default:
- ERR_EXPLAIN("This parameter " + itos(p_param) + " is deprecated");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("The parameter " + itos(p_param) + " is deprecated.");
return 0;
}
}
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index f15bcec914..85f47c3bbb 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -505,8 +505,7 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) {
}
} else {
- ERR_EXPLAIN("Expected PoolRealArray or float Image.");
- ERR_FAIL();
+ ERR_FAIL_MSG("Expected PoolRealArray or float Image.");
}
ERR_FAIL_COND(l_width <= 0);
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index f475ba23f6..d2b16b0fd1 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -581,10 +581,8 @@ void SpaceBullet::create_empty_world(bool p_create_soft_world) {
} else {
world_mem = malloc(sizeof(btDiscreteDynamicsWorld));
}
- if (!world_mem) {
- ERR_EXPLAIN("Out of memory");
- ERR_FAIL();
- }
+
+ ERR_FAIL_COND_MSG(!world_mem, "Out of memory.");
if (p_create_soft_world) {
collisionConfiguration = bulletnew(GodotSoftCollisionConfiguration(static_cast<btDiscreteDynamicsWorld *>(world_mem)));
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 4628bd9a5b..0220dcae4a 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -108,8 +108,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
if (r_error)
*r_error = ERR_FILE_CORRUPT;
- ERR_EXPLAIN("Unable to open DDS texture file: " + p_path);
- ERR_FAIL_COND_V(err != OK, RES());
+ ERR_FAIL_COND_V_MSG(err != OK, RES(), "Unable to open DDS texture file: " + p_path + ".");
uint32_t magic = f->get_32();
uint32_t hsize = f->get_32();
@@ -128,8 +127,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
if (magic != DDS_MAGIC || hsize != 124 || !(flags & DDSD_PIXELFORMAT) || !(flags & DDSD_CAPS)) {
- ERR_EXPLAIN("Invalid or Unsupported DDS texture file: " + p_path);
- ERR_FAIL_V(RES());
+ ERR_FAIL_V_MSG(RES(), "Invalid or unsupported DDS texture file: " + p_path + ".");
}
/* uint32_t format_size = */ f->get_32();
@@ -218,9 +216,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
} else {
printf("unrecognized fourcc %x format_flags: %x - rgbbits %i - red_mask %x green mask %x blue mask %x alpha mask %x\n", format_fourcc, format_flags, format_rgb_bits, format_red_mask, format_green_mask, format_blue_mask, format_alpha_mask);
- ERR_EXPLAIN("Unrecognized or Unsupported color layout in DDS: " + p_path);
-
- ERR_FAIL_V(RES());
+ ERR_FAIL_V_MSG(RES(), "Unrecognized or unsupported color layout in DDS: " + p_path + ".");
}
if (!(flags & DDSD_MIPMAPCOUNT))
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index a5a356ced2..44f69ca261 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -543,10 +543,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
if (target_peer != 0) {
E = peer_map.find(ABS(target_peer));
- if (!E) {
- ERR_EXPLAIN("Invalid Target Peer: " + itos(target_peer));
- ERR_FAIL_V(ERR_INVALID_PARAMETER);
- }
+ ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, "Invalid target peer: " + itos(target_peer) + ".");
}
ENetPacket *packet = enet_packet_create(NULL, p_buffer_size + 8, packet_flags);
@@ -794,11 +791,7 @@ int NetworkedMultiplayerENet::get_peer_port(int p_peer_id) const {
void NetworkedMultiplayerENet::set_transfer_channel(int p_channel) {
ERR_FAIL_COND(p_channel < -1 || p_channel >= channel_count);
-
- if (p_channel == SYSCH_CONFIG) {
- ERR_EXPLAIN("Channel " + itos(SYSCH_CONFIG) + " is reserved");
- ERR_FAIL();
- }
+ ERR_FAIL_COND_MSG(p_channel == SYSCH_CONFIG, "Channel " + itos(SYSCH_CONFIG) + " is reserved.");
transfer_channel = p_channel;
}
diff --git a/modules/etc/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp
index ff925480b8..3337460dfc 100644
--- a/modules/etc/texture_loader_pkm.cpp
+++ b/modules/etc/texture_loader_pkm.cpp
@@ -56,8 +56,7 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path,
if (r_error)
*r_error = ERR_FILE_CORRUPT;
- ERR_EXPLAIN("Unable to open PKM texture file: " + p_path);
- ERR_FAIL_COND_V(err != OK, RES());
+ ERR_FAIL_COND_V_MSG(err != OK, RES(), "Unable to open PKM texture file: " + p_path + ".");
// big endian
f->set_endian_swap(true);
diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py
index 7ab0e01108..20c1a2233c 100644
--- a/modules/gdnative/gdnative_builders.py
+++ b/modules/gdnative/gdnative_builders.py
@@ -185,7 +185,7 @@ def _build_gdnative_api_struct_source(api):
'extern const godot_gdnative_core_' + ('{0}_{1}_api_struct api_{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + ' = {',
'\tGDNATIVE_' + core['type'] + ',',
'\t{' + str(core['version']['major']) + ', ' + str(core['version']['minor']) + '},',
- '\t' + ('NULL' if not core['next'] else ('(const godot_gdnative_api_struct *)& api_{0}_{1}'.format(core['version']['major'], core['version']['minor']))) + ','
+ '\t' + ('NULL' if not core['next'] else ('(const godot_gdnative_api_struct *)& api_{0}_{1}'.format(core['next']['version']['major'], core['next']['version']['minor']))) + ','
]
for funcdef in core['api']:
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index b8a13ed91b..62117dcaf3 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -32,6 +32,7 @@
#include "core/io/file_access_encrypted.h"
#include "core/io/resource_loader.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "editor/gdscript_highlighter.h"
#include "gdscript.h"
@@ -117,6 +118,9 @@ public:
file = FileAccess::get_file_as_array(tmp_path);
add_file(p_path.get_basename() + ".gde", file, true);
+ // Clean up temporary file.
+ DirAccess::remove_file_or_error(tmp_path);
+
} else {
add_file(p_path.get_basename() + ".gdc", file, true);
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index bdecbbdbad..b36afd4386 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -196,16 +196,14 @@ bool GridMap::get_collision_layer_bit(int p_bit) const {
#ifndef DISABLE_DEPRECATED
void GridMap::set_theme(const Ref<MeshLibrary> &p_theme) {
- ERR_EXPLAIN("GridMap.theme/set_theme() is deprecated and will be removed in a future version. Use GridMap.mesh_library/set_mesh_library() instead.");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("GridMap.theme/set_theme() is deprecated and will be removed in a future version. Use GridMap.mesh_library/set_mesh_library() instead.");
set_mesh_library(p_theme);
}
Ref<MeshLibrary> GridMap::get_theme() const {
- ERR_EXPLAIN("GridMap.theme/get_theme() is deprecated and will be removed in a future version. Use GridMap.mesh_library/get_mesh_library() instead.");
- WARN_DEPRECATED;
+ WARN_DEPRECATED_MSG("GridMap.theme/get_theme() is deprecated and will be removed in a future version. Use GridMap.mesh_library/get_mesh_library() instead.");
return get_mesh_library();
}
diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp
index f75a4a926a..e610619b54 100644
--- a/modules/hdr/image_loader_hdr.cpp
+++ b/modules/hdr/image_loader_hdr.cpp
@@ -102,10 +102,7 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
len <<= 8;
len |= f->get_8();
- if (len != width) {
- ERR_EXPLAIN("invalid decoded scanline length, corrupt HDR");
- ERR_FAIL_V(ERR_FILE_CORRUPT);
- }
+ ERR_FAIL_COND_V_MSG(len != width, ERR_FILE_CORRUPT, "Invalid decoded scanline length, corrupt HDR.");
for (int k = 0; k < 4; ++k) {
int i = 0;
diff --git a/modules/mono/.gitignore b/modules/mono/.gitignore
new file mode 100644
index 0000000000..fa6d00cbbb
--- /dev/null
+++ b/modules/mono/.gitignore
@@ -0,0 +1,2 @@
+# Do not ignore solution files inside the mono module. Overrides Godot's global gitignore.
+!*.sln
diff --git a/modules/mono/glue/Managed/Files/Basis.cs b/modules/mono/glue/Managed/Files/Basis.cs
index 421532b68f..0eb76e9c63 100644
--- a/modules/mono/glue/Managed/Files/Basis.cs
+++ b/modules/mono/glue/Managed/Files/Basis.cs
@@ -12,40 +12,6 @@ namespace Godot
[StructLayout(LayoutKind.Sequential)]
public struct Basis : IEquatable<Basis>
{
- private static readonly Basis identity = new Basis
- (
- 1f, 0f, 0f,
- 0f, 1f, 0f,
- 0f, 0f, 1f
- );
-
- private static readonly Basis[] orthoBases = {
- new Basis(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f),
- new Basis(0f, -1f, 0f, 1f, 0f, 0f, 0f, 0f, 1f),
- new Basis(-1f, 0f, 0f, 0f, -1f, 0f, 0f, 0f, 1f),
- new Basis(0f, 1f, 0f, -1f, 0f, 0f, 0f, 0f, 1f),
- new Basis(1f, 0f, 0f, 0f, 0f, -1f, 0f, 1f, 0f),
- new Basis(0f, 0f, 1f, 1f, 0f, 0f, 0f, 1f, 0f),
- new Basis(-1f, 0f, 0f, 0f, 0f, 1f, 0f, 1f, 0f),
- new Basis(0f, 0f, -1f, -1f, 0f, 0f, 0f, 1f, 0f),
- new Basis(1f, 0f, 0f, 0f, -1f, 0f, 0f, 0f, -1f),
- new Basis(0f, 1f, 0f, 1f, 0f, 0f, 0f, 0f, -1f),
- new Basis(-1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, -1f),
- new Basis(0f, -1f, 0f, -1f, 0f, 0f, 0f, 0f, -1f),
- new Basis(1f, 0f, 0f, 0f, 0f, 1f, 0f, -1f, 0f),
- new Basis(0f, 0f, -1f, 1f, 0f, 0f, 0f, -1f, 0f),
- new Basis(-1f, 0f, 0f, 0f, 0f, -1f, 0f, -1f, 0f),
- new Basis(0f, 0f, 1f, -1f, 0f, 0f, 0f, -1f, 0f),
- new Basis(0f, 0f, 1f, 0f, 1f, 0f, -1f, 0f, 0f),
- new Basis(0f, -1f, 0f, 0f, 0f, 1f, -1f, 0f, 0f),
- new Basis(0f, 0f, -1f, 0f, -1f, 0f, -1f, 0f, 0f),
- new Basis(0f, 1f, 0f, 0f, 0f, -1f, -1f, 0f, 0f),
- new Basis(0f, 0f, 1f, 0f, -1f, 0f, 1f, 0f, 0f),
- new Basis(0f, 1f, 0f, 0f, 0f, 1f, 1f, 0f, 0f),
- new Basis(0f, 0f, -1f, 0f, 1f, 0f, 1f, 0f, 0f),
- new Basis(0f, -1f, 0f, 0f, 0f, -1f, 1f, 0f, 0f)
- };
-
// NOTE: x, y and z are public-only. Use Column0, Column1 and Column2 internally.
/// <summary>
@@ -64,7 +30,6 @@ namespace Godot
/// </summary>
public Vector3 y
{
-
get => Column1;
set => Column1 = value;
}
@@ -75,7 +40,6 @@ namespace Godot
/// </summary>
public Vector3 z
{
-
get => Column2;
set => Column2 = value;
}
@@ -115,8 +79,6 @@ namespace Godot
}
}
- public static Basis Identity => identity;
-
public Vector3 Scale
{
get
@@ -361,7 +323,7 @@ namespace Godot
for (int i = 0; i < 24; i++)
{
- if (orthoBases[i] == orth)
+ if (orth == _orthoBases[i])
return i;
}
@@ -531,6 +493,43 @@ namespace Godot
}
}
+ private static readonly Basis[] _orthoBases = {
+ new Basis(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f),
+ new Basis(0f, -1f, 0f, 1f, 0f, 0f, 0f, 0f, 1f),
+ new Basis(-1f, 0f, 0f, 0f, -1f, 0f, 0f, 0f, 1f),
+ new Basis(0f, 1f, 0f, -1f, 0f, 0f, 0f, 0f, 1f),
+ new Basis(1f, 0f, 0f, 0f, 0f, -1f, 0f, 1f, 0f),
+ new Basis(0f, 0f, 1f, 1f, 0f, 0f, 0f, 1f, 0f),
+ new Basis(-1f, 0f, 0f, 0f, 0f, 1f, 0f, 1f, 0f),
+ new Basis(0f, 0f, -1f, -1f, 0f, 0f, 0f, 1f, 0f),
+ new Basis(1f, 0f, 0f, 0f, -1f, 0f, 0f, 0f, -1f),
+ new Basis(0f, 1f, 0f, 1f, 0f, 0f, 0f, 0f, -1f),
+ new Basis(-1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, -1f),
+ new Basis(0f, -1f, 0f, -1f, 0f, 0f, 0f, 0f, -1f),
+ new Basis(1f, 0f, 0f, 0f, 0f, 1f, 0f, -1f, 0f),
+ new Basis(0f, 0f, -1f, 1f, 0f, 0f, 0f, -1f, 0f),
+ new Basis(-1f, 0f, 0f, 0f, 0f, -1f, 0f, -1f, 0f),
+ new Basis(0f, 0f, 1f, -1f, 0f, 0f, 0f, -1f, 0f),
+ new Basis(0f, 0f, 1f, 0f, 1f, 0f, -1f, 0f, 0f),
+ new Basis(0f, -1f, 0f, 0f, 0f, 1f, -1f, 0f, 0f),
+ new Basis(0f, 0f, -1f, 0f, -1f, 0f, -1f, 0f, 0f),
+ new Basis(0f, 1f, 0f, 0f, 0f, -1f, -1f, 0f, 0f),
+ new Basis(0f, 0f, 1f, 0f, -1f, 0f, 1f, 0f, 0f),
+ new Basis(0f, 1f, 0f, 0f, 0f, 1f, 1f, 0f, 0f),
+ new Basis(0f, 0f, -1f, 0f, 1f, 0f, 1f, 0f, 0f),
+ new Basis(0f, -1f, 0f, 0f, 0f, -1f, 1f, 0f, 0f)
+ };
+
+ private static readonly Basis _identity = new Basis(1, 0, 0, 0, 1, 0, 0, 0, 1);
+ private static readonly Basis _flipX = new Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1);
+ private static readonly Basis _flipY = new Basis(1, 0, 0, 0, -1, 0, 0, 0, 1);
+ private static readonly Basis _flipZ = new Basis(1, 0, 0, 0, 1, 0, 0, 0, -1);
+
+ public static Basis Identity { get { return _identity; } }
+ public static Basis FlipX { get { return _flipX; } }
+ public static Basis FlipY { get { return _flipY; } }
+ public static Basis FlipZ { get { return _flipZ; } }
+
public Basis(Quat quat)
{
real_t s = 2.0f / quat.LengthSquared;
diff --git a/modules/mono/icons/icon_c_#.svg b/modules/mono/icons/icon_c_#.svg
new file mode 100644
index 0000000000..69664ca553
--- /dev/null
+++ b/modules/mono/icons/icon_c_#.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path d="m6 1046.4c-1.6569 0-3 1.3431-3 3s1.3431 3 3 3h1v-2h-1c-0.55228 0-1-0.4478-1-1 0-0.5523 0.44772-1 1-1h1v-2zm1-9-0.56445 2.2578c-0.23643 0.076-0.46689 0.1692-0.68945 0.2793l-1.9883-1.1933-1.4141 1.414 1.1953 1.9942c-0.11191 0.2211-0.20723 0.4502-0.28516 0.6855l-2.2539 0.5625v2h5.2715c-0.17677-0.3037-0.27041-0.6486-0.27148-1 9.6e-6 -1.1046 0.89543-2 2-2s2 0.8954 2 2c-4.817e-4 0.3512-0.093442 0.6961-0.26953 1h5.2695v-2l-2.2578-0.5645c-0.07594-0.2357-0.1693-0.4655-0.2793-0.6875l1.1934-1.9902-1.4141-1.414-1.9941 1.1953c-0.22113-0.1119-0.45028-0.2073-0.68555-0.2852l-0.5625-2.2539zm4 9c-0.71466-1e-4 -1.3751 0.3811-1.7324 1-0.35727 0.6188-0.35727 1.3812 0 2 0.35733 0.6189 1.0178 1.0001 1.7324 1h-2v2h2c0.71466 1e-4 1.3751-0.3811 1.7324-1 0.35727-0.6188 0.35727-1.3812 0-2-0.35733-0.6189-1.0178-1.0001-1.7324-1h2v-2z" fill="#e0e0e0"/>
+</g>
+</svg>
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index 615081d818..d3e8d3c9bb 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -287,8 +287,7 @@ int AudioStreamPlaybackOpus::mix(int16_t *p_buffer, int p_frames) {
int ret = op_read(opus_file, (opus_int16 *)p_buffer, todo * stream_channels, &current_section);
if (ret < 0) {
playing = false;
- ERR_EXPLAIN("Error reading Opus File: " + file);
- ERR_BREAK(ret < 0);
+ ERR_BREAK_MSG(ret < 0, "Error reading Opus file: " + file + ".");
} else if (ret == 0) { // end of song, reload?
op_free(opus_file);
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 8b1f21d95d..cf6b396180 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -149,8 +149,7 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path,
format = Image::FORMAT_ETC;
break;
default:
- ERR_EXPLAIN("Unsupported format in PVR texture: " + itos(flags & 0xFF));
- ERR_FAIL_V(RES());
+ ERR_FAIL_V_MSG(RES(), "Unsupported format in PVR texture: " + itos(flags & 0xFF) + ".");
}
w.release();
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index 64f4c169cb..9b0a55eae3 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -57,8 +57,7 @@ void image_decompress_squish(Image *p_image) {
} else if (p_image->get_format() == Image::FORMAT_RGTC_RG) {
squish_flags = squish::kBc5;
} else {
- ERR_EXPLAIN("Squish: Can't decompress unknown format: " + itos(p_image->get_format()));
- ERR_FAIL_COND(true);
+ ERR_FAIL_MSG("Squish: Can't decompress unknown format: " + itos(p_image->get_format()) + ".");
return;
}
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index b0cd648734..a2ef88d130 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -109,12 +109,10 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t
float upscale = upsample ? 2.0 : 1.0;
int w = (int)(svg_image->width * p_scale * upscale);
- ERR_EXPLAIN(vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max width.", rtos(p_scale)));
- ERR_FAIL_COND_V(w > Image::MAX_WIDTH, ERR_PARAMETER_RANGE_ERROR);
+ ERR_FAIL_COND_V_MSG(w > Image::MAX_WIDTH, ERR_PARAMETER_RANGE_ERROR, vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max width.", rtos(p_scale)));
int h = (int)(svg_image->height * p_scale * upscale);
- ERR_EXPLAIN(vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max height.", rtos(p_scale)));
- ERR_FAIL_COND_V(h > Image::MAX_HEIGHT, ERR_PARAMETER_RANGE_ERROR);
+ ERR_FAIL_COND_V_MSG(h > Image::MAX_HEIGHT, ERR_PARAMETER_RANGE_ERROR, vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max height.", rtos(p_scale)));
PoolVector<uint8_t> dst_image;
dst_image.resize(w * h * 4);
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 4425565afa..3f8b2b1831 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -328,8 +328,7 @@ void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<Visual
if (Object::cast_to<VisualScriptFunction>(*p_node)) {
//the function indeed
- ERR_EXPLAIN("A function node already has been set here.");
- ERR_FAIL_COND(func.function_id >= 0);
+ ERR_FAIL_COND_MSG(func.function_id >= 0, "A function node has already been set here.");
func.function_id = p_id;
}
@@ -1917,8 +1916,7 @@ Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p
if (!E) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
- ERR_EXPLAIN("No VisualScriptFunction node in function!");
- ERR_FAIL_V(Variant());
+ ERR_FAIL_V_MSG(Variant(), "No VisualScriptFunction node in function.");
}
VisualScriptNodeInstance *node = E->get();
@@ -1974,8 +1972,7 @@ String VisualScriptInstance::to_string(bool *r_valid) {
if (ret.get_type() != Variant::STRING) {
if (r_valid)
*r_valid = false;
- ERR_EXPLAIN("Wrong type for " + CoreStringNames::get_singleton()->_to_string + ", must be a String.");
- ERR_FAIL_V(String());
+ ERR_FAIL_V_MSG(String(), "Wrong type for " + CoreStringNames::get_singleton()->_to_string + ", must be a String.");
}
if (r_valid)
*r_valid = true;
@@ -2262,15 +2259,10 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
ERR_FAIL_COND_V(function == StringName(), Variant());
#ifdef DEBUG_ENABLED
- if (instance_id && !ObjectDB::get_instance(instance_id)) {
- ERR_EXPLAIN("Resumed after yield, but class instance is gone");
- ERR_FAIL_V(Variant());
- }
- if (script_id && !ObjectDB::get_instance(script_id)) {
- ERR_EXPLAIN("Resumed after yield, but script is gone");
- ERR_FAIL_V(Variant());
- }
+ ERR_FAIL_COND_V_MSG(instance_id && !ObjectDB::get_instance(instance_id), Variant(), "Resumed after yield, but class instance is gone.");
+ ERR_FAIL_COND_V_MSG(script_id && !ObjectDB::get_instance(script_id), Variant(), "Resumed after yield, but script is gone.");
+
#endif
r_error.error = Variant::CallError::CALL_OK;
@@ -2329,15 +2321,10 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
ERR_FAIL_COND_V(function == StringName(), Variant());
#ifdef DEBUG_ENABLED
- if (instance_id && !ObjectDB::get_instance(instance_id)) {
- ERR_EXPLAIN("Resumed after yield, but class instance is gone");
- ERR_FAIL_V(Variant());
- }
- if (script_id && !ObjectDB::get_instance(script_id)) {
- ERR_EXPLAIN("Resumed after yield, but script is gone");
- ERR_FAIL_V(Variant());
- }
+ ERR_FAIL_COND_V_MSG(instance_id && !ObjectDB::get_instance(instance_id), Variant(), "Resumed after yield, but class instance is gone.");
+ ERR_FAIL_COND_V_MSG(script_id && !ObjectDB::get_instance(script_id), Variant(), "Resumed after yield, but script is gone.");
+
#endif
Variant::CallError r_error;
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 2f4a45f108..2f56e778b9 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -116,8 +116,7 @@ int AudioStreamPlaybackOGGVorbis::mix(int16_t *p_buffer, int p_frames) {
if (ret < 0) {
playing = false;
- ERR_EXPLAIN("Error reading OGG Vorbis File: " + file);
- ERR_BREAK(ret < 0);
+ ERR_BREAK_MSG(ret < 0, "Error reading OGG Vorbis file: " + file + ".");
} else if (ret == 0) { // end of song, reload?
ov_clear(&vf);
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 3670edc9ea..fa3602ad27 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -53,8 +53,7 @@ public:
file = FileAccess::open(p_file, FileAccess::READ);
- ERR_EXPLAIN("Failed loading resource: '" + p_file + "';");
- ERR_FAIL_COND(!file);
+ ERR_FAIL_COND_MSG(!file, "Failed loading resource: '" + p_file + "'.");
}
~MkvReader() {
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 630c15f140..8986e49cf0 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -84,8 +84,7 @@ static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) {
ERR_FAIL_COND_V(r[0] != 'W' || r[1] != 'E' || r[2] != 'B' || r[3] != 'P', Ref<Image>());
WebPBitstreamFeatures features;
if (WebPGetFeatures(&r[4], size, &features) != VP8_STATUS_OK) {
- ERR_EXPLAIN("Error unpacking WEBP image:");
- ERR_FAIL_V(Ref<Image>());
+ ERR_FAIL_V_MSG(Ref<Image>(), "Error unpacking WEBP image.");
}
/*
diff --git a/modules/webrtc/webrtc_data_channel_js.cpp b/modules/webrtc/webrtc_data_channel_js.cpp
index 069918cc9c..996db35cba 100644
--- a/modules/webrtc/webrtc_data_channel_js.cpp
+++ b/modules/webrtc/webrtc_data_channel_js.cpp
@@ -68,10 +68,8 @@ void WebRTCDataChannelJS::_on_error() {
}
void WebRTCDataChannelJS::_on_message(uint8_t *p_data, uint32_t p_size, bool p_is_string) {
- if (in_buffer.space_left() < (int)(p_size + 5)) {
- ERR_EXPLAIN("Buffer full! Dropping data");
- ERR_FAIL();
- }
+
+ ERR_FAIL_COND_MSG(in_buffer.space_left() < (int)(p_size + 5), "Buffer full! Dropping data.");
uint8_t is_string = p_is_string ? 1 : 0;
in_buffer.write((uint8_t *)&p_size, 4);
diff --git a/modules/webrtc/webrtc_multiplayer.cpp b/modules/webrtc/webrtc_multiplayer.cpp
index 17dafff93a..a759b17b83 100644
--- a/modules/webrtc/webrtc_multiplayer.cpp
+++ b/modules/webrtc/webrtc_multiplayer.cpp
@@ -321,10 +321,8 @@ Error WebRTCMultiplayer::put_packet(const uint8_t *p_buffer, int p_buffer_size)
if (target_peer > 0) {
E = peer_map.find(target_peer);
- if (!E) {
- ERR_EXPLAIN("Invalid Target Peer: " + itos(target_peer));
- ERR_FAIL_V(ERR_INVALID_PARAMETER);
- }
+ ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, "Invalid target peer: " + itos(target_peer) + ".");
+
ERR_FAIL_COND_V(E->value()->channels.size() <= ch, ERR_BUG);
ERR_FAIL_COND_V(!E->value()->channels[ch].is_valid(), ERR_BUG);
return E->value()->channels[ch]->put_packet(p_buffer, p_buffer_size);
diff --git a/modules/webrtc/webrtc_peer_connection_gdnative.cpp b/modules/webrtc/webrtc_peer_connection_gdnative.cpp
index af98aa750a..5e9dcb5366 100644
--- a/modules/webrtc/webrtc_peer_connection_gdnative.cpp
+++ b/modules/webrtc/webrtc_peer_connection_gdnative.cpp
@@ -51,13 +51,11 @@ Error WebRTCPeerConnectionGDNative::set_default_library(const godot_net_webrtc_l
WebRTCPeerConnection *WebRTCPeerConnectionGDNative::_create() {
WebRTCPeerConnectionGDNative *obj = memnew(WebRTCPeerConnectionGDNative);
- ERR_EXPLAIN("Default GDNative WebRTC implementation not defined.");
- ERR_FAIL_COND_V(!default_library, obj);
+ ERR_FAIL_COND_V_MSG(!default_library, obj, "Default GDNative WebRTC implementation not defined.");
// Call GDNative constructor
Error err = (Error)default_library->create_peer_connection(obj);
- ERR_EXPLAIN("GDNative default library constructor returned an error");
- ERR_FAIL_COND_V(err != OK, obj);
+ ERR_FAIL_COND_V_MSG(err != OK, obj, "GDNative default library constructor returned an error.");
return obj;
}
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp
index a9f38f1a82..58d4c52688 100644
--- a/modules/websocket/emws_peer.cpp
+++ b/modules/websocket/emws_peer.cpp
@@ -131,14 +131,12 @@ void EMWSPeer::close(int p_code, String p_reason) {
IP_Address EMWSPeer::get_connected_host() const {
- ERR_EXPLAIN("Not supported in HTML5 export");
- ERR_FAIL_V(IP_Address());
+ ERR_FAIL_V_MSG(IP_Address(), "Not supported in HTML5 export.");
};
uint16_t EMWSPeer::get_connected_port() const {
- ERR_EXPLAIN("Not supported in HTML5 export");
- ERR_FAIL_V(0);
+ ERR_FAIL_V_MSG(0, "Not supported in HTML5 export.");
};
EMWSPeer::EMWSPeer() {
diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp
index e24cb850ec..62f09bfbf9 100644
--- a/modules/websocket/websocket_multiplayer_peer.cpp
+++ b/modules/websocket/websocket_multiplayer_peer.cpp
@@ -98,16 +98,14 @@ void WebSocketMultiplayerPeer::_bind_methods() {
//
int WebSocketMultiplayerPeer::get_available_packet_count() const {
- ERR_EXPLAIN("Please use get_peer(ID).get_available_packet_count to get available packet count from peers when not using the MultiplayerAPI.");
- ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V_MSG(!_is_multiplayer, ERR_UNCONFIGURED, "Please use get_peer(ID).get_available_packet_count to get available packet count from peers when not using the MultiplayerAPI.");
return _incoming_packets.size();
}
Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
- ERR_EXPLAIN("Please use get_peer(ID).get_packet/var to communicate with peers when not using the MultiplayerAPI.");
- ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V_MSG(!_is_multiplayer, ERR_UNCONFIGURED, "Please use get_peer(ID).get_packet/var to communicate with peers when not using the MultiplayerAPI.");
r_buffer_size = 0;
@@ -127,8 +125,7 @@ Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buff
Error WebSocketMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
- ERR_EXPLAIN("Please use get_peer(ID).put_packet/var to communicate with peers when not using the MultiplayerAPI.");
- ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V_MSG(!_is_multiplayer, ERR_UNCONFIGURED, "Please use get_peer(ID).put_packet/var to communicate with peers when not using the MultiplayerAPI.");
PoolVector<uint8_t> buffer = _make_pkt(SYS_NONE, get_unique_id(), _target_peer, p_buffer, p_buffer_size);
@@ -160,8 +157,7 @@ void WebSocketMultiplayerPeer::set_target_peer(int p_target_peer) {
int WebSocketMultiplayerPeer::get_packet_peer() const {
- ERR_EXPLAIN("This function is not available when not using the MultiplayerAPI.");
- ERR_FAIL_COND_V(!_is_multiplayer, 1);
+ ERR_FAIL_COND_V_MSG(!_is_multiplayer, 1, "This function is not available when not using the MultiplayerAPI.");
ERR_FAIL_COND_V(_incoming_packets.size() == 0, 1);
return _incoming_packets.front()->get().source;
@@ -354,8 +350,7 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref<WebSocketPeer> p_peer, u
_peer_id = id;
break;
default:
- ERR_EXPLAIN("Invalid multiplayer message");
- ERR_FAIL();
+ ERR_FAIL_MSG("Invalid multiplayer message.");
break;
}
}
diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp
index af75f2a320..cf2ad55b4a 100644
--- a/modules/websocket/wsl_client.cpp
+++ b/modules/websocket/wsl_client.cpp
@@ -53,8 +53,7 @@ void WSLClient::_do_handshake() {
// Header is too big
disconnect_from_host();
_on_error();
- ERR_EXPLAIN("Response headers too big");
- ERR_FAIL();
+ ERR_FAIL_MSG("Response headers too big.");
}
Error err = _connection->get_partial_data(&_resp_buf[_resp_pos], 1, read);
if (err == ERR_FILE_EOF) {
@@ -81,8 +80,7 @@ void WSLClient::_do_handshake() {
if (!_verify_headers(protocol)) {
disconnect_from_host();
_on_error();
- ERR_EXPLAIN("Invalid response headers");
- ERR_FAIL();
+ ERR_FAIL_MSG("Invalid response headers.");
}
// Create peer.
WSLPeer::PeerData *data = memnew(struct WSLPeer::PeerData);
@@ -103,29 +101,18 @@ bool WSLClient::_verify_headers(String &r_protocol) {
String s = (char *)_resp_buf;
Vector<String> psa = s.split("\r\n");
int len = psa.size();
- if (len < 4) {
- ERR_EXPLAIN("Not enough response headers.");
- ERR_FAIL_V(false);
- }
+ ERR_FAIL_COND_V_MSG(len < 4, false, "Not enough response headers, got: " + itos(len) + ", expected >= 4.");
Vector<String> req = psa[0].split(" ", false);
- if (req.size() < 2) {
- ERR_EXPLAIN("Invalid protocol or status code.");
- ERR_FAIL_V(false);
- }
+ ERR_FAIL_COND_V_MSG(req.size() < 2, false, "Invalid protocol or status code.");
+
// Wrong protocol
- if (req[0] != "HTTP/1.1" || req[1] != "101") {
- ERR_EXPLAIN("Invalid protocol or status code.");
- ERR_FAIL_V(false);
- }
+ ERR_FAIL_COND_V_MSG(req[0] != "HTTP/1.1" || req[1] != "101", false, "Invalid protocol or status code.");
Map<String, String> headers;
for (int i = 1; i < len; i++) {
Vector<String> header = psa[i].split(":", false, 1);
- if (header.size() != 2) {
- ERR_EXPLAIN("Invalid header -> " + psa[i]);
- ERR_FAIL_V(false);
- }
+ ERR_FAIL_COND_V_MSG(header.size() != 2, false, "Invalid header -> " + psa[i] + ".");
String name = header[0].to_lower();
String value = header[1].strip_edges();
if (headers.has(name))
@@ -251,8 +238,7 @@ void WSLClient::poll() {
if (_connection == _tcp) {
// Start SSL handshake
ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create());
- ERR_EXPLAIN("SSL is not available in this build");
- ERR_FAIL_COND(ssl.is_null());
+ ERR_FAIL_COND_MSG(ssl.is_null(), "SSL is not available in this build.");
ssl->set_blocking_handshake_enabled(false);
if (ssl->connect_to_stream(_tcp, verify_ssl, _host) != OK) {
disconnect_from_host();
@@ -332,8 +318,7 @@ uint16_t WSLClient::get_connected_port() const {
}
Error WSLClient::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) {
- ERR_EXPLAIN("Buffers sizes can only be set before listening or connecting");
- ERR_FAIL_COND_V(_connection.is_valid(), FAILED);
+ ERR_FAIL_COND_V_MSG(_connection.is_valid(), FAILED, "Buffers sizes can only be set before listening or connecting.");
_in_buf_size = nearest_shift(p_in_buffer - 1) + 10;
_in_pkt_size = nearest_shift(p_in_packets - 1);
diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp
index 0d09a4d74e..1feae420b9 100644
--- a/modules/websocket/wsl_server.cpp
+++ b/modules/websocket/wsl_server.cpp
@@ -45,29 +45,18 @@ WSLServer::PendingPeer::PendingPeer() {
bool WSLServer::PendingPeer::_parse_request(const PoolStringArray p_protocols) {
Vector<String> psa = String((char *)req_buf).split("\r\n");
int len = psa.size();
- if (len < 4) {
- ERR_EXPLAIN("Not enough response headers.");
- ERR_FAIL_V(false);
- }
+ ERR_FAIL_COND_V_MSG(len < 4, false, "Not enough response headers, got: " + itos(len) + ", expected >= 4.");
Vector<String> req = psa[0].split(" ", false);
- if (req.size() < 2) {
- ERR_EXPLAIN("Invalid protocol or status code.");
- ERR_FAIL_V(false);
- }
+ ERR_FAIL_COND_V_MSG(req.size() < 2, false, "Invalid protocol or status code.");
+
// Wrong protocol
- if (req[0] != "GET" || req[2] != "HTTP/1.1") {
- ERR_EXPLAIN("Invalid method or HTTP version.");
- ERR_FAIL_V(false);
- }
+ ERR_FAIL_COND_V_MSG(req[0] != "GET" || req[2] != "HTTP/1.1", false, "Invalid method or HTTP version.");
Map<String, String> headers;
for (int i = 1; i < len; i++) {
Vector<String> header = psa[i].split(":", false, 1);
- if (header.size() != 2) {
- ERR_EXPLAIN("Invalid header -> " + psa[i]);
- ERR_FAIL_V(false);
- }
+ ERR_FAIL_COND_V_MSG(header.size() != 2, false, "Invalid header -> " + psa[i]);
String name = header[0].to_lower();
String value = header[1].strip_edges();
if (headers.has(name))
@@ -115,11 +104,7 @@ Error WSLServer::PendingPeer::do_handshake(PoolStringArray p_protocols) {
if (!has_request) {
int read = 0;
while (true) {
- if (req_pos >= WSL_MAX_HEADER_SIZE) {
- // Header is too big
- ERR_EXPLAIN("Response headers too big");
- ERR_FAIL_V(ERR_OUT_OF_MEMORY);
- }
+ ERR_FAIL_COND_V_MSG(req_pos >= WSL_MAX_HEADER_SIZE, ERR_OUT_OF_MEMORY, "Response headers too big.");
Error err = connection->get_partial_data(&req_buf[req_pos], 1, read);
if (err != OK) // Got an error
return FAILED;
@@ -277,8 +262,7 @@ void WSLServer::disconnect_peer(int p_peer_id, int p_code, String p_reason) {
}
Error WSLServer::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) {
- ERR_EXPLAIN("Buffers sizes can only be set before listening or connecting");
- ERR_FAIL_COND_V(_server->is_listening(), FAILED);
+ ERR_FAIL_COND_V_MSG(_server->is_listening(), FAILED, "Buffers sizes can only be set before listening or connecting.");
_in_buf_size = nearest_shift(p_in_buffer - 1) + 10;
_in_pkt_size = nearest_shift(p_in_packets - 1);
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index dc0a63d171..16e49e8a38 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -32,6 +32,7 @@
#include "core/io/marshalls.h"
#include "core/io/zip_io.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/project_settings.h"
@@ -1398,8 +1399,9 @@ public:
return ERR_UNCONFIGURED;
}
- //export_temp
+ // Export_temp APK.
if (ep.step("Exporting APK", 0)) {
+ device_lock->unlock();
return ERR_SKIP;
}
@@ -1409,11 +1411,20 @@ public:
if (use_reverse)
p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
- String export_to = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport.apk");
- Error err = export_project(p_preset, true, export_to, p_debug_flags);
- if (err) {
- device_lock->unlock();
- return err;
+ String tmp_export_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport.apk");
+
+#define CLEANUP_AND_RETURN(m_err) \
+ { \
+ DirAccess::remove_file_or_error(tmp_export_path); \
+ device_lock->unlock(); \
+ return m_err; \
+ }
+
+ // Export to temporary APK before sending to device.
+ Error err = export_project(p_preset, true, tmp_export_path, p_debug_flags);
+
+ if (err != OK) {
+ CLEANUP_AND_RETURN(err);
}
List<String> args;
@@ -1425,7 +1436,7 @@ public:
if (remove_prev) {
if (ep.step("Uninstalling...", 1)) {
- return ERR_SKIP;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
print_line("Uninstalling previous version: " + devices[p_device].name);
@@ -1440,7 +1451,7 @@ public:
print_line("Installing to device (please wait...): " + devices[p_device].name);
if (ep.step("Installing to device (please wait...)", 2)) {
- return ERR_SKIP;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
args.clear();
@@ -1448,13 +1459,12 @@ public:
args.push_back(devices[p_device].id);
args.push_back("install");
args.push_back("-r");
- args.push_back(export_to);
+ args.push_back(tmp_export_path);
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
if (err || rv != 0) {
EditorNode::add_io_error("Could not install to device.");
- device_lock->unlock();
- return ERR_CANT_CREATE;
+ CLEANUP_AND_RETURN(ERR_CANT_CREATE);
}
if (use_remote) {
@@ -1508,7 +1518,7 @@ public:
}
if (ep.step("Running on Device...", 3)) {
- return ERR_SKIP;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
args.clear();
args.push_back("-s");
@@ -1528,11 +1538,11 @@ public:
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
if (err || rv != 0) {
EditorNode::add_io_error("Could not execute on device.");
- device_lock->unlock();
- return ERR_CANT_CREATE;
+ CLEANUP_AND_RETURN(ERR_CANT_CREATE);
}
- device_lock->unlock();
- return OK;
+
+ CLEANUP_AND_RETURN(OK);
+#undef CLEANUP_AND_RETURN
}
virtual Ref<Texture> get_run_icon() const {
@@ -2023,8 +2033,16 @@ public:
zlib_filefunc_def io2 = io;
FileAccess *dst_f = NULL;
io2.opaque = &dst_f;
- String unaligned_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport-unaligned.apk");
- zipFile unaligned_apk = zipOpen2(unaligned_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2);
+
+ String tmp_unaligned_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport-unaligned.apk");
+
+#define CLEANUP_AND_RETURN(m_err) \
+ { \
+ DirAccess::remove_file_or_error(tmp_unaligned_path); \
+ return m_err; \
+ }
+
+ zipFile unaligned_apk = zipOpen2(tmp_unaligned_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2);
bool use_32_fb = p_preset->get("graphics/32_bits_framebuffer");
bool immersive = p_preset->get("screen/immersive_mode");
@@ -2152,7 +2170,7 @@ public:
}
if (ep.step("Adding Files...", 1)) {
- return ERR_SKIP;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
Error err = OK;
Vector<String> cl = cmdline.strip_edges().split(" ");
@@ -2184,7 +2202,7 @@ public:
unzClose(pkg);
EditorNode::add_io_error("Could not write expansion package file: " + apkfname);
- return OK;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
cl.push_back("--use_apk_expansion");
@@ -2271,8 +2289,8 @@ public:
zipClose(unaligned_apk, NULL);
unzClose(pkg);
- if (err) {
- return err;
+ if (err != OK) {
+ CLEANUP_AND_RETURN(err);
}
if (_signed) {
@@ -2280,7 +2298,7 @@ public:
String jarsigner = EditorSettings::get_singleton()->get("export/android/jarsigner");
if (!FileAccess::exists(jarsigner)) {
EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the Editor Settings.\nThe resulting APK is unsigned.");
- return OK;
+ CLEANUP_AND_RETURN(OK);
}
String keystore;
@@ -2300,7 +2318,7 @@ public:
}
if (ep.step("Signing debug APK...", 103)) {
- return ERR_SKIP;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
} else {
@@ -2309,13 +2327,13 @@ public:
user = release_username;
if (ep.step("Signing release APK...", 103)) {
- return ERR_SKIP;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
}
if (!FileAccess::exists(keystore)) {
EditorNode::add_io_error("Could not find keystore, unable to export.");
- return ERR_FILE_CANT_OPEN;
+ CLEANUP_AND_RETURN(ERR_FILE_CANT_OPEN);
}
List<String> args;
@@ -2333,30 +2351,30 @@ public:
args.push_back(keystore);
args.push_back("-storepass");
args.push_back(password);
- args.push_back(unaligned_path);
+ args.push_back(tmp_unaligned_path);
args.push_back(user);
int retval;
OS::get_singleton()->execute(jarsigner, args, true, NULL, NULL, &retval);
if (retval) {
EditorNode::add_io_error("'jarsigner' returned with error #" + itos(retval));
- return ERR_CANT_CREATE;
+ CLEANUP_AND_RETURN(ERR_CANT_CREATE);
}
if (ep.step("Verifying APK...", 104)) {
- return ERR_SKIP;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
args.clear();
args.push_back("-verify");
args.push_back("-keystore");
args.push_back(keystore);
- args.push_back(unaligned_path);
+ args.push_back(tmp_unaligned_path);
args.push_back("-verbose");
OS::get_singleton()->execute(jarsigner, args, true, NULL, NULL, &retval);
if (retval) {
EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use a jarsigner from OpenJDK 8.");
- return ERR_CANT_CREATE;
+ CLEANUP_AND_RETURN(ERR_CANT_CREATE);
}
}
@@ -2365,14 +2383,14 @@ public:
static const int ZIP_ALIGNMENT = 4;
if (ep.step("Aligning APK...", 105)) {
- return ERR_SKIP;
+ CLEANUP_AND_RETURN(ERR_SKIP);
}
- unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io);
+ unzFile tmp_unaligned = unzOpen2(tmp_unaligned_path.utf8().get_data(), &io);
if (!tmp_unaligned) {
- EditorNode::add_io_error("Could not find temp unaligned APK.");
- return ERR_FILE_NOT_FOUND;
+ EditorNode::add_io_error("Could not unzip temporary unaligned APK.");
+ CLEANUP_AND_RETURN(ERR_FILE_NOT_FOUND);
}
ret = unzGoToFirstFile(tmp_unaligned);
@@ -2442,7 +2460,7 @@ public:
zipClose(final_apk, NULL);
unzClose(tmp_unaligned);
- return OK;
+ CLEANUP_AND_RETURN(OK);
}
virtual void get_platform_features(List<String> *r_features) {
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index c68b420c61..69dd038709 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -362,12 +362,21 @@ int EditorExportPlatformJavaScript::get_device_count() const {
Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) {
- String path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_export.html");
+ String basepath = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_js_export");
+ String path = basepath + ".html";
Error err = export_project(p_preset, true, path, p_debug_flags);
- if (err) {
+ if (err != OK) {
+ // Export generates several files, clean them up on failure.
+ DirAccess::remove_file_or_error(basepath + ".html");
+ DirAccess::remove_file_or_error(basepath + ".js");
+ DirAccess::remove_file_or_error(basepath + ".pck");
+ DirAccess::remove_file_or_error(basepath + ".png");
+ DirAccess::remove_file_or_error(basepath + ".wasm");
return err;
}
OS::get_singleton()->shell_open(String("file://") + path);
+ // FIXME: Find out how to clean up export files after running the successfully
+ // exported game. Might not be trivial.
return OK;
}
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 8cabc45250..56b0a44dbc 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -29,9 +29,11 @@
/*************************************************************************/
#include "export.h"
+
#include "core/io/marshalls.h"
#include "core/io/resource_saver.h"
#include "core/io/zip_io.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/project_settings.h"
@@ -244,13 +246,17 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
copy->resize(icon_infos[i].size, icon_infos[i].size);
if (icon_infos[i].is_png) {
- //encode png icon
+ // Encode PNG icon.
it->create_from_image(copy);
String path = EditorSettings::get_singleton()->get_cache_dir().plus_file("icon.png");
ResourceSaver::save(path, it);
FileAccess *f = FileAccess::open(path, FileAccess::READ);
- ERR_FAIL_COND(!f);
+ if (!f) {
+ // Clean up generated file.
+ DirAccess::remove_file_or_error(path);
+ ERR_FAIL();
+ }
int ofs = data.size();
uint32_t len = f->get_len();
@@ -261,6 +267,10 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
len = BSWAP32(len);
copymem(&data.write[ofs], icon_infos[i].name, 4);
encode_uint32(len, &data.write[ofs + 4]);
+
+ // Clean up generated file.
+ DirAccess::remove_file_or_error(path);
+
} else {
PoolVector<uint8_t> src_data = copy->get_data();
@@ -561,7 +571,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
}
}
- //bleh?
}
if (data.size() > 0) {
@@ -687,7 +696,8 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
// Clean up temporary .app dir
OS::get_singleton()->move_to_trash(tmp_app_path_name);
- } else {
+
+ } else { // pck
String pack_path = EditorSettings::get_singleton()->get_cache_dir().plus_file(pkg_name + ".pck");
@@ -747,6 +757,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
zipCloseFileInZip(dst_pkg_zip);
}
}
+
+ // Clean up generated file.
+ DirAccess::remove_file_or_error(pack_path);
}
}
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 024e7f1916..662ee49935 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -34,6 +34,7 @@
#include "core/io/zip_io.h"
#include "core/math/crypto_core.h"
#include "core/object.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"
#include "core/version.h"
@@ -133,8 +134,6 @@ class AppxPackager {
String progress_task;
FileAccess *package;
- String tmp_blockmap_file_path;
- String tmp_content_types_file_path;
Set<String> mime_types;
@@ -146,8 +145,8 @@ class AppxPackager {
String hash_block(const uint8_t *p_block_data, size_t p_block_len);
- void make_block_map();
- void make_content_types();
+ void make_block_map(const String &p_path);
+ void make_content_types(const String &p_path);
_FORCE_INLINE_ unsigned int buf_put_int16(uint16_t p_val, uint8_t *p_buf) {
for (int i = 0; i < 2; i++) {
@@ -208,9 +207,9 @@ String AppxPackager::hash_block(const uint8_t *p_block_data, size_t p_block_len)
return String(base64);
}
-void AppxPackager::make_block_map() {
+void AppxPackager::make_block_map(const String &p_path) {
- FileAccess *tmp_file = FileAccess::open(tmp_blockmap_file_path, FileAccess::WRITE);
+ FileAccess *tmp_file = FileAccess::open(p_path, FileAccess::WRITE);
tmp_file->store_string("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
tmp_file->store_string("<BlockMap xmlns=\"http://schemas.microsoft.com/appx/2010/blockmap\" HashMethod=\"http://www.w3.org/2001/04/xmlenc#sha256\">");
@@ -253,9 +252,9 @@ String AppxPackager::content_type(String p_extension) {
return "application/octet-stream";
}
-void AppxPackager::make_content_types() {
+void AppxPackager::make_content_types(const String &p_path) {
- FileAccess *tmp_file = FileAccess::open(tmp_content_types_file_path, FileAccess::WRITE);
+ FileAccess *tmp_file = FileAccess::open(p_path, FileAccess::WRITE);
tmp_file->store_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
tmp_file->store_string("<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">");
@@ -458,8 +457,6 @@ void AppxPackager::init(FileAccess *p_fa) {
package = p_fa;
central_dir_offset = 0;
end_of_central_dir_offset = 0;
- tmp_blockmap_file_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpblockmap.xml");
- tmp_content_types_file_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpcontenttypes.xml");
}
Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) {
@@ -591,7 +588,9 @@ void AppxPackager::finish() {
// Create and add block map file
EditorNode::progress_task_step("export", "Creating block map...", 4);
- make_block_map();
+ const String &tmp_blockmap_file_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpblockmap.xml");
+ make_block_map(tmp_blockmap_file_path);
+
FileAccess *blockmap_file = FileAccess::open(tmp_blockmap_file_path, FileAccess::READ);
Vector<uint8_t> blockmap_buffer;
blockmap_buffer.resize(blockmap_file->get_len());
@@ -604,8 +603,11 @@ void AppxPackager::finish() {
memdelete(blockmap_file);
// Add content types
+
EditorNode::progress_task_step("export", "Setting content types...", 5);
- make_content_types();
+
+ const String &tmp_content_types_file_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpcontenttypes.xml");
+ make_content_types(tmp_content_types_file_path);
FileAccess *types_file = FileAccess::open(tmp_content_types_file_path, FileAccess::READ);
Vector<uint8_t> types_buffer;
@@ -618,6 +620,10 @@ void AppxPackager::finish() {
types_file->close();
memdelete(types_file);
+ // Cleanup generated files.
+ DirAccess::remove_file_or_error(tmp_blockmap_file_path);
+ DirAccess::remove_file_or_error(tmp_content_types_file_path);
+
// Pre-process central directory before signing
for (int i = 0; i < file_metadata.size(); i++) {
store_central_dir_header(file_metadata[i]);
@@ -909,7 +915,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
if (err != OK) {
String err_string = "Couldn't open temp logo file.";
-
+ // Cleanup generated file.
+ DirAccess::remove_file_or_error(tmp_path);
EditorNode::add_io_error(err_string);
ERR_FAIL_V_MSG(data, err_string);
}
@@ -919,29 +926,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
f->close();
memdelete(f);
-
- // Delete temp file
- DirAccess *dir = DirAccess::open(tmp_path.get_base_dir(), &err);
-
- if (err != OK) {
-
- String err_string = "Couldn't open temp path to remove temp logo file.";
-
- EditorNode::add_io_error(err_string);
- ERR_FAIL_V_MSG(data, err_string);
- }
-
- err = dir->remove(tmp_path);
-
- memdelete(dir);
-
- if (err != OK) {
-
- String err_string = "Couldn't remove temp logo file.";
-
- EditorNode::add_io_error(err_string);
- ERR_FAIL_V_MSG(data, err_string);
- }
+ DirAccess::remove_file_or_error(tmp_path);
return data;
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 0d1e702d04..ca72393e43 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1518,9 +1518,12 @@ void OS_X11::set_window_maximized(bool p_enabled) {
XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
- if (is_window_maximize_allowed()) {
- while (p_enabled && !is_window_maximized()) {
- // Wait for effective resizing (so the GLX context is too).
+ if (p_enabled && is_window_maximize_allowed()) {
+ // Wait for effective resizing (so the GLX context is too).
+ // Give up after 0.5s, it's not going to happen on this WM.
+ // https://github.com/godotengine/godot/issues/19978
+ for (int attempt = 0; !is_window_maximized() && attempt < 50; attempt++) {
+ usleep(10000);
}
}
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp
index acf27d2bbf..1390ab55c4 100644
--- a/servers/audio/effects/audio_effect_record.cpp
+++ b/servers/audio/effects/audio_effect_record.cpp
@@ -217,7 +217,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
PoolVector<uint8_t> dst_data;
ERR_FAIL_COND_V(current_instance.is_null(), NULL);
- ERR_FAIL_COND_V(current_instance->recording_data.size(), NULL);
+ ERR_FAIL_COND_V(current_instance->recording_data.size() == 0, NULL);
if (dst_format == AudioStreamSample::FORMAT_8_BITS) {
int data_size = current_instance->recording_data.size();
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 5c28705192..5f39d3ff49 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -961,6 +961,7 @@ bool ShaderLanguage::_find_identifier(const BlockNode *p_block, const Map<String
if (r_type) {
*r_type = IDENTIFIER_FUNCTION;
}
+ return true;
}
}