summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp2
-rw-r--r--core/class_db.cpp2
-rw-r--r--core/color.h2
-rw-r--r--core/error_macros.h36
-rw-r--r--core/image.cpp4
-rw-r--r--core/image.h2
-rw-r--r--core/input_map.cpp2
-rw-r--r--core/io/file_access_network.cpp1
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/marshalls.cpp7
-rw-r--r--core/io/multiplayer_api.h2
-rw-r--r--core/io/pck_packer.cpp5
-rw-r--r--core/io/resource_format_binary.cpp4
-rw-r--r--core/io/stream_peer_tcp.cpp1
-rw-r--r--core/io/tcp_server.cpp6
-rw-r--r--core/math/expression.cpp2
-rw-r--r--core/math/random_number_generator.cpp3
-rw-r--r--core/math/triangle_mesh.h2
-rw-r--r--core/node_path.cpp10
-rw-r--r--core/object.cpp13
-rw-r--r--core/os/dir_access.cpp2
-rw-r--r--core/os/file_access.cpp6
-rw-r--r--core/os/input_event.cpp8
-rw-r--r--core/os/os.cpp3
-rw-r--r--core/pool_allocator.cpp7
-rw-r--r--core/project_settings.cpp2
-rw-r--r--core/safe_refcount.h6
-rw-r--r--core/ustring.cpp7
-rw-r--r--core/ustring.h2
-rw-r--r--core/variant.cpp2
-rw-r--r--core/variant.h24
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp2
-rw-r--r--drivers/gles2/shader_gles2.cpp4
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp4
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp2
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp2
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h2
-rw-r--r--drivers/gles3/shader_gles3.cpp2
-rw-r--r--drivers/unix/dir_access_unix.cpp5
-rw-r--r--drivers/unix/net_socket_posix.cpp5
-rw-r--r--drivers/unix/net_socket_posix.h2
-rw-r--r--editor/animation_track_editor.cpp8
-rw-r--r--editor/animation_track_editor.h2
-rw-r--r--editor/array_property_edit.cpp6
-rw-r--r--editor/audio_stream_preview.h2
-rw-r--r--editor/collada/collada.cpp4
-rw-r--r--editor/connections_dialog.cpp2
-rw-r--r--editor/dictionary_property_edit.cpp5
-rw-r--r--editor/editor_audio_buses.cpp38
-rw-r--r--editor/editor_autoload_settings.cpp11
-rw-r--r--editor/editor_dir_dialog.cpp2
-rw-r--r--editor/editor_export.cpp8
-rw-r--r--editor/editor_file_system.cpp12
-rw-r--r--editor/editor_help.cpp2
-rw-r--r--editor/editor_inspector.h4
-rw-r--r--editor/editor_plugin.cpp2
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/editor_profiler.cpp4
-rw-r--r--editor/editor_properties.cpp12
-rw-r--r--editor/editor_properties_array_dict.cpp2
-rw-r--r--editor/editor_run.cpp6
-rw-r--r--editor/editor_run_native.h2
-rw-r--r--editor/editor_settings.cpp9
-rw-r--r--editor/editor_settings.h5
-rw-r--r--editor/export_template_manager.cpp7
-rw-r--r--editor/filesystem_dock.cpp4
-rw-r--r--editor/filesystem_dock.h2
-rw-r--r--editor/import/editor_import_plugin.h2
-rw-r--r--editor/import/resource_importer_scene.cpp8
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/resource_importer_texture.cpp6
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp2
-rw-r--r--editor/import/resource_importer_wav.cpp6
-rw-r--r--editor/multi_node_edit.cpp2
-rw-r--r--editor/node_dock.cpp4
-rw-r--r--editor/plugin_config_dialog.h2
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp4
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp4
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp8
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp8
-rw-r--r--editor/plugins/animation_tree_player_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp15
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h2
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.cpp2
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp5
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp2
-rw-r--r--editor/plugins/skeleton_editor_plugin.h2
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp2
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp12
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp5
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h6
-rw-r--r--editor/project_export.cpp4
-rw-r--r--editor/project_settings_editor.cpp2
-rw-r--r--editor/property_editor.cpp2
-rw-r--r--editor/rename_dialog.cpp18
-rw-r--r--editor/scene_tree_editor.cpp6
-rw-r--r--editor/spatial_editor_gizmos.cpp18
-rw-r--r--main/input_default.cpp40
-rw-r--r--main/main.cpp4
-rw-r--r--main/tests/test_gdscript.cpp4
-rw-r--r--main/tests/test_physics.cpp1
-rw-r--r--main/tests/test_string.cpp6
-rw-r--r--modules/bmp/image_loader_bmp.cpp2
-rw-r--r--modules/csg/csg_shape.h2
-rw-r--r--modules/gdscript/gdscript.cpp2
-rw-r--r--modules/gdscript/gdscript_compiler.cpp2
-rw-r--r--modules/gdscript/gdscript_parser.cpp9
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp4
-rw-r--r--modules/mono/csharp_script.cpp5
-rw-r--r--modules/mono/csharp_script.h2
-rw-r--r--modules/mono/editor/csharp_project.h2
-rw-r--r--modules/mono/editor/godotsharp_editor.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp2
-rw-r--r--modules/mono/utils/thread_local.h2
-rw-r--r--modules/opensimplex/noise_texture.h4
-rw-r--r--modules/visual_script/visual_script_expression.cpp2
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp7
-rw-r--r--modules/websocket/websocket_multiplayer_peer.h2
-rw-r--r--platform/x11/joypad_linux.cpp1
-rw-r--r--platform/x11/os_x11.cpp8
-rw-r--r--platform/x11/power_x11.cpp5
-rw-r--r--scene/2d/animated_sprite.cpp5
-rw-r--r--scene/2d/audio_stream_player_2d.cpp4
-rw-r--r--scene/2d/canvas_item.h2
-rw-r--r--scene/2d/cpu_particles_2d.h2
-rw-r--r--scene/2d/line_2d.cpp3
-rw-r--r--scene/2d/physics_body_2d.h4
-rw-r--r--scene/2d/sprite.cpp5
-rw-r--r--scene/3d/audio_stream_player_3d.cpp6
-rw-r--r--scene/3d/camera.h2
-rw-r--r--scene/3d/cpu_particles.h2
-rw-r--r--scene/3d/soft_body.cpp1
-rw-r--r--scene/3d/vehicle_body.cpp5
-rw-r--r--scene/3d/voxel_light_baker.cpp4
-rw-r--r--scene/animation/animation_node_state_machine.cpp114
-rw-r--r--scene/animation/root_motion_view.h2
-rw-r--r--scene/animation/skeleton_ik.cpp1
-rw-r--r--scene/animation/skeleton_ik.h4
-rw-r--r--scene/animation/tween.cpp4
-rw-r--r--scene/audio/audio_stream_player.cpp2
-rw-r--r--scene/gui/box_container.cpp1
-rw-r--r--scene/gui/control.cpp35
-rw-r--r--scene/gui/control.h4
-rw-r--r--scene/gui/file_dialog.cpp7
-rw-r--r--scene/gui/label.cpp1
-rw-r--r--scene/gui/line_edit.cpp5
-rw-r--r--scene/gui/rich_text_label.cpp109
-rw-r--r--scene/gui/scroll_container.cpp22
-rw-r--r--scene/gui/text_edit.cpp11
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/main/node.cpp2
-rw-r--r--scene/main/viewport.cpp2
-rw-r--r--scene/resources/multimesh.cpp8
-rw-r--r--scene/resources/primitive_meshes.cpp2
-rw-r--r--scene/resources/resource_format_text.cpp4
-rw-r--r--scene/resources/visual_shader_nodes.h8
-rw-r--r--servers/audio/audio_filter_sw.cpp2
-rw-r--r--servers/audio/audio_stream.cpp2
-rw-r--r--servers/audio/audio_stream.h2
-rw-r--r--servers/audio/effects/audio_effect_spectrum_analyzer.cpp4
-rw-r--r--servers/physics/broad_phase_octree.cpp2
-rw-r--r--servers/physics/collision_solver_sat.cpp12
-rw-r--r--servers/physics/joints/generic_6dof_joint_sw.cpp1
-rw-r--r--servers/physics/space_sw.cpp4
-rw-r--r--servers/physics_2d/space_2d_sw.cpp2
-rw-r--r--servers/visual/visual_server_canvas.cpp2
-rw-r--r--servers/visual/visual_server_canvas.h4
-rw-r--r--servers/visual/visual_server_scene.cpp6
-rw-r--r--servers/visual/visual_server_viewport.cpp2
-rw-r--r--servers/visual/visual_server_viewport.h3
-rw-r--r--servers/visual_server.cpp11
175 files changed, 455 insertions, 662 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 8a898f3b53..21cf395b14 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -76,7 +76,7 @@ RES _ResourceLoader::load(const String &p_path, const String &p_type_hint, bool
if (err != OK) {
ERR_EXPLAIN("Error loading resource: '" + p_path + "'");
- ERR_FAIL_COND_V(err != OK, ret);
+ ERR_FAIL_V(ret);
}
return ret;
}
diff --git a/core/class_db.cpp b/core/class_db.cpp
index ec07ee98e2..c9527e3c8f 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -552,7 +552,7 @@ void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherit
OBJTYPE_WLOCK;
- StringName name = p_class;
+ const StringName &name = p_class;
ERR_FAIL_COND(classes.has(name));
diff --git a/core/color.h b/core/color.h
index b2148e1357..77f95b5dc9 100644
--- a/core/color.h
+++ b/core/color.h
@@ -195,7 +195,7 @@ struct Color {
static Color named(const String &p_name);
String to_html(bool p_alpha = true) const;
Color from_hsv(float p_h, float p_s, float p_v, float p_a) const;
- static Color from_rgbe9995(uint32_t p_color);
+ static Color from_rgbe9995(uint32_t p_rgbe);
_FORCE_INLINE_ bool operator<(const Color &p_color) const; //used in set keys
operator String() const;
diff --git a/core/error_macros.h b/core/error_macros.h
index f72e987e23..69874e280b 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -136,8 +136,8 @@ extern bool _err_error_exists;
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
} while (0); // (*)
/** An index has failed if m_index<0 or m_index >=m_size, the function exits.
@@ -150,8 +150,8 @@ extern bool _err_error_exists;
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return m_retval; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
} while (0); // (*)
/** An index has failed if m_index >=m_size, the function exits.
@@ -164,8 +164,8 @@ extern bool _err_error_exists;
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return m_retval; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
} while (0); // (*)
/** Use this one if there is no sensible fallback, that is, the error is unrecoverable.
@@ -188,8 +188,8 @@ extern bool _err_error_exists;
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null."); \
return; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
}
#define ERR_FAIL_NULL_V(m_param, m_retval) \
@@ -197,8 +197,8 @@ extern bool _err_error_exists;
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null."); \
return m_retval; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
}
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
@@ -210,8 +210,8 @@ extern bool _err_error_exists;
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true."); \
return; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
}
/** Use this one if there is no sensible fallback, that is, the error is unrecoverable.
@@ -236,8 +236,8 @@ extern bool _err_error_exists;
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. returned: " _STR(m_retval)); \
return m_retval; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
}
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
@@ -249,8 +249,8 @@ extern bool _err_error_exists;
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Continuing..:"); \
continue; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
}
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
@@ -262,8 +262,8 @@ extern bool _err_error_exists;
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Breaking..:"); \
break; \
- } else \
- _err_error_exists = false; \
+ } \
+ _err_error_exists = false; \
}
/** Print an error string and return
diff --git a/core/image.cpp b/core/image.cpp
index c85d7f6bcc..dd8f2b9bac 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -2402,7 +2402,7 @@ Color Image::get_pixel(int p_x, int p_y) const {
#ifdef DEBUG_ENABLED
if (!ptr) {
ERR_EXPLAIN("Image must be locked with 'lock()' before using get_pixel()");
- ERR_FAIL_COND_V(!ptr, Color());
+ ERR_FAIL_V(Color());
}
ERR_FAIL_INDEX_V(p_x, width, Color());
@@ -2541,7 +2541,7 @@ void Image::set_pixel(int p_x, int p_y, const Color &p_color) {
#ifdef DEBUG_ENABLED
if (!ptr) {
ERR_EXPLAIN("Image must be locked with 'lock()' before using set_pixel()");
- ERR_FAIL_COND(!ptr);
+ ERR_FAIL();
}
ERR_FAIL_INDEX(p_x, width);
diff --git a/core/image.h b/core/image.h
index 752ef20208..cc796789cd 100644
--- a/core/image.h
+++ b/core/image.h
@@ -350,7 +350,7 @@ public:
Color get_pixelv(const Point2 &p_src) const;
Color get_pixel(int p_x, int p_y) const;
- void set_pixelv(const Point2 &p_dest, const Color &p_color);
+ void set_pixelv(const Point2 &p_dst, const Color &p_color);
void set_pixel(int p_x, int p_y, const Color &p_color);
void copy_internals_from(const Ref<Image> &p_image) {
diff --git a/core/input_map.cpp b/core/input_map.cpp
index 012c6a7c4f..04911787a8 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -194,7 +194,7 @@ bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const Str
Map<StringName, Action>::Element *E = input_map.find(p_action);
if (!E) {
ERR_EXPLAIN("Request for nonexistent InputMap action: " + String(p_action));
- ERR_FAIL_COND_V(!E, false);
+ ERR_FAIL_V(false);
}
Ref<InputEventAction> input_event_action = p_event;
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 5dd167c581..d1c7f5c334 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -435,7 +435,6 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const {
_queue_page(page + j);
}
- buff = pages.write[page].buffer.ptrw();
//queue pages
buffer_mutex->unlock();
}
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 891fb7b0ca..c3626bfe31 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -775,7 +775,7 @@ Dictionary HTTPClient::_get_response_headers_as_dictionary() {
get_response_headers(&rh);
Dictionary ret;
for (const List<String>::Element *E = rh.front(); E; E = E->next()) {
- String s = E->get();
+ const String &s = E->get();
int sp = s.find(":");
if (sp == -1)
continue;
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 7494603462..6a954a07de 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -681,8 +681,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
if (r_len)
(*r_len) += adv;
- len -= adv;
- buf += adv;
}
r_variant = varray;
@@ -719,8 +717,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
if (r_len)
(*r_len) += adv;
- len -= adv;
- buf += adv;
}
r_variant = varray;
@@ -758,8 +754,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
if (r_len)
(*r_len) += adv;
- len -= adv;
- buf += adv;
}
r_variant = carray;
@@ -1092,7 +1086,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (!obj) {
if (buf) {
encode_uint32(0, buf);
- buf += 4;
}
r_len += 4;
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index 779dd043bd..5258dde5d7 100644
--- a/core/io/multiplayer_api.h
+++ b/core/io/multiplayer_api.h
@@ -77,7 +77,7 @@ protected:
void _process_raw(int p_from, const uint8_t *p_packet, int p_packet_len);
void _send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount);
- bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_from);
+ bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_target);
public:
enum NetworkCommands {
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 8920bbfb81..55685a2d9a 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -109,10 +109,7 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src) {
Error PCKPacker::flush(bool p_verbose) {
- if (!file) {
- ERR_FAIL_COND_V(!file, ERR_INVALID_PARAMETER);
- return ERR_INVALID_PARAMETER;
- };
+ ERR_FAIL_COND_V(!file, ERR_INVALID_PARAMETER);
// write the index
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index aef2dcfff3..688dfc21e5 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -720,7 +720,7 @@ Error ResourceInteractiveLoaderBinary::poll() {
error = ERR_FILE_CORRUPT;
memdelete(obj); //bye
ERR_EXPLAIN(local_path + ":Resource type in resource field not a resource, type is: " + obj->get_class());
- ERR_FAIL_COND_V(!r, ERR_FILE_CORRUPT);
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
}
RES res = RES(r);
@@ -1694,7 +1694,7 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
int len = varray.size();
for (int i = 0; i < len; i++) {
- Variant v = varray.get(i);
+ const Variant &v = varray.get(i);
_find_resources(v);
}
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 45f3e46e35..bcdae343b8 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -352,7 +352,6 @@ void StreamPeerTCP::_bind_methods() {
StreamPeerTCP::StreamPeerTCP() :
_sock(Ref<NetSocket>(NetSocket::create())),
status(STATUS_NONE),
- peer_host(IP_Address()),
peer_port(0) {
}
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index 6599c4eb5b..be87f47d50 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -83,11 +83,7 @@ bool TCP_Server::is_connection_available() const {
return false;
Error err = _sock->poll(NetSocket::POLL_TYPE_IN, 0);
- if (err != OK) {
- return false;
- }
-
- return true;
+ return (err == OK);
}
Ref<StreamPeerTCP> TCP_Server::take_connection() {
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index e484e9194d..b52658e2cf 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -1794,7 +1794,7 @@ Expression::ENode *Expression::_parse_expression() {
if (next_op == -1) {
_set_error("Yet another parser bug....");
- ERR_FAIL_COND_V(next_op == -1, NULL);
+ ERR_FAIL_V(NULL);
}
// OK! create operator..
diff --git a/core/math/random_number_generator.cpp b/core/math/random_number_generator.cpp
index 6add00c1d8..54a88d5cd8 100644
--- a/core/math/random_number_generator.cpp
+++ b/core/math/random_number_generator.cpp
@@ -30,8 +30,7 @@
#include "random_number_generator.h"
-RandomNumberGenerator::RandomNumberGenerator() :
- randbase() {}
+RandomNumberGenerator::RandomNumberGenerator() {}
void RandomNumberGenerator::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_seed", "seed"), &RandomNumberGenerator::set_seed);
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index ee7bf0f6b5..8b01080852 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -97,7 +97,7 @@ public:
PoolVector<Triangle> get_triangles() const { return triangles; }
PoolVector<Vector3> get_vertices() const { return vertices; }
- void get_indices(PoolVector<int> *p_triangles_indices) const;
+ void get_indices(PoolVector<int> *r_triangles_indices) const;
void create(const PoolVector<Vector3> &p_faces);
TriangleMesh();
diff --git a/core/node_path.cpp b/core/node_path.cpp
index 07ff765516..a4b7cbe2eb 100644
--- a/core/node_path.cpp
+++ b/core/node_path.cpp
@@ -357,7 +357,7 @@ NodePath::NodePath(const String &p_path) {
String path = p_path;
Vector<StringName> subpath;
- int absolute = (path[0] == '/') ? 1 : 0;
+ bool absolute = (path[0] == '/');
bool last_is_slash = true;
bool has_slashes = false;
int slices = 0;
@@ -387,7 +387,7 @@ NodePath::NodePath(const String &p_path) {
path = path.substr(0, subpath_pos);
}
- for (int i = absolute; i < path.length(); i++) {
+ for (int i = (int)absolute; i < path.length(); i++) {
if (path[i] == '/') {
@@ -407,7 +407,7 @@ NodePath::NodePath(const String &p_path) {
data = memnew(Data);
data->refcount.init();
- data->absolute = absolute ? true : false;
+ data->absolute = absolute;
data->has_slashes = has_slashes;
data->subpath = subpath;
data->hash_cache_valid = false;
@@ -416,10 +416,10 @@ NodePath::NodePath(const String &p_path) {
return;
data->path.resize(slices);
last_is_slash = true;
- int from = absolute;
+ int from = (int)absolute;
int slice = 0;
- for (int i = absolute; i < path.length() + 1; i++) {
+ for (int i = (int)absolute; i < path.length() + 1; i++) {
if (path[i] == '/' || path[i] == 0) {
diff --git a/core/object.cpp b/core/object.cpp
index 64f55f08a9..5dbf36940e 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -474,7 +474,6 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
if (r_valid)
*r_valid = false;
- return;
}
Variant Object::get(const StringName &p_name, bool *r_valid) const {
@@ -810,11 +809,7 @@ bool Object::has_method(const StringName &p_method) const {
MethodBind *method = ClassDB::get_method(get_class_name(), p_method);
- if (method) {
- return true;
- }
-
- return false;
+ return method != NULL;
}
Variant Object::getvar(const Variant &p_key, bool *r_valid) const {
@@ -1485,7 +1480,7 @@ Error Object::connect(const StringName &p_signal, Object *p_to_object, const Str
return OK;
} else {
ERR_EXPLAIN("Signal '" + p_signal + "' is already connected to given method '" + p_to_method + "' in that object.");
- ERR_FAIL_COND_V(s->slot_map.has(target), ERR_INVALID_PARAMETER);
+ ERR_FAIL_V(ERR_INVALID_PARAMETER);
}
}
@@ -1542,11 +1537,11 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const
Signal *s = signal_map.getptr(p_signal);
if (!s) {
ERR_EXPLAIN("Nonexistent signal: " + p_signal);
- ERR_FAIL_COND(!s);
+ ERR_FAIL();
}
if (s->lock > 0) {
ERR_EXPLAIN("Attempt to disconnect signal '" + p_signal + "' while emitting (locks: " + itos(s->lock) + ")");
- ERR_FAIL_COND(s->lock > 0);
+ ERR_FAIL();
}
Signal::Target target(p_to_object->get_instance_id(), p_to_method);
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index d81c30f33a..1c57bfdf3d 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -373,7 +373,7 @@ Error DirAccess::_copy_dir(DirAccess *p_target_da, String p_to, int p_chmod_flag
if (current_is_dir())
dirs.push_back(n);
else {
- String rel_path = n;
+ const String &rel_path = n;
if (!n.is_rel_path()) {
list_dir_end();
return ERR_BUG;
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 913caf6584..b5580b5c6e 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -601,7 +601,8 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_err
if (r_error) { // if error requested, do not throw error
return Vector<uint8_t>();
}
- ERR_FAIL_COND_V(!f, Vector<uint8_t>());
+ ERR_EXPLAIN("Can't open file from path: " + String(p_path));
+ ERR_FAIL_V(Vector<uint8_t>());
}
Vector<uint8_t> data;
data.resize(f->get_len());
@@ -621,7 +622,8 @@ String FileAccess::get_file_as_string(const String &p_path, Error *r_error) {
if (r_error) {
return String();
}
- ERR_FAIL_COND_V(err != OK, String());
+ ERR_EXPLAIN("Can't get file as string from path: " + String(p_path));
+ ERR_FAIL_V(String());
}
String ret;
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 9c5066da3d..a40a50cfce 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -314,7 +314,7 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed
if (p_pressed != NULL)
*p_pressed = key->is_pressed();
if (p_strength != NULL)
- *p_strength = (*p_pressed) ? 1.0f : 0.0f;
+ *p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
}
return match;
}
@@ -483,7 +483,7 @@ bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event, bool *p
if (p_pressed != NULL)
*p_pressed = mb->is_pressed();
if (p_strength != NULL)
- *p_strength = (*p_pressed) ? 1.0f : 0.0f;
+ *p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
}
return match;
@@ -795,7 +795,7 @@ bool InputEventJoypadButton::action_match(const Ref<InputEvent> &p_event, bool *
if (p_pressed != NULL)
*p_pressed = jb->is_pressed();
if (p_strength != NULL)
- *p_strength = (*p_pressed) ? 1.0f : 0.0f;
+ *p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
}
return match;
@@ -1041,7 +1041,7 @@ bool InputEventAction::action_match(const Ref<InputEvent> &p_event, bool *p_pres
if (p_pressed != NULL)
*p_pressed = act->pressed;
if (p_strength != NULL)
- *p_strength = (*p_pressed) ? 1.0f : 0.0f;
+ *p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
}
return match;
}
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 1a3c9ac5f8..027740c6a9 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -239,7 +239,8 @@ void OS::print_all_resources(String p_to_file) {
_OSPRF = FileAccess::open(p_to_file, FileAccess::WRITE, &err);
if (err != OK) {
_OSPRF = NULL;
- ERR_FAIL_COND(err != OK);
+ ERR_EXPLAIN("Can't print all resources to file: " + String(p_to_file));
+ ERR_FAIL();
}
}
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index 11a3be89bd..094352b5cc 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -206,8 +206,8 @@ PoolAllocator::ID PoolAllocator::alloc(int p_size) {
if (!find_hole(&new_entry_indices_pos, size_to_alloc)) {
mt_unlock();
- ERR_PRINT("memory can't be compacted further");
- return POOL_ALLOCATOR_INVALID_ID;
+ ERR_EXPLAIN("Memory can't be compacted further");
+ ERR_FAIL_V(POOL_ALLOCATOR_INVALID_ID);
}
}
@@ -217,7 +217,8 @@ PoolAllocator::ID PoolAllocator::alloc(int p_size) {
if (!found_free_entry) {
mt_unlock();
- ERR_FAIL_COND_V(!found_free_entry, POOL_ALLOCATOR_INVALID_ID);
+ ERR_EXPLAIN("No free entry found in PoolAllocator");
+ ERR_FAIL_V(POOL_ALLOCATOR_INVALID_ID);
}
/* move all entry indices up, make room for this one */
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 0508806a35..983b2a2576 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -566,7 +566,7 @@ Error ProjectSettings::_load_settings_text(const String p_path) {
if (config_version > CONFIG_VERSION) {
memdelete(f);
ERR_EXPLAIN(vformat("Can't open project at '%s', its `config_version` (%d) is from a more recent and incompatible version of the engine. Expected config version: %d.", p_path, config_version, CONFIG_VERSION));
- ERR_FAIL_COND_V(config_version > CONFIG_VERSION, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_V(ERR_FILE_CANT_OPEN);
}
} else {
if (section == String()) {
diff --git a/core/safe_refcount.h b/core/safe_refcount.h
index f6b8f80271..54f540b0c7 100644
--- a/core/safe_refcount.h
+++ b/core/safe_refcount.h
@@ -189,11 +189,7 @@ public:
_ALWAYS_INLINE_ bool unref() { // true if must be disposed of
- if (atomic_decrement(&count) == 0) {
- return true;
- }
-
- return false;
+ return atomic_decrement(&count) == 0;
}
_ALWAYS_INLINE_ uint32_t get() const { // nothrow
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 686aa6f8e3..ff28fa420d 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3799,11 +3799,7 @@ bool String::is_valid_filename() const {
return false;
}
- if (find(":") != -1 || find("/") != -1 || find("\\") != -1 || find("?") != -1 || find("*") != -1 || find("\"") != -1 || find("|") != -1 || find("%") != -1 || find("<") != -1 || find(">") != -1) {
- return false;
- } else {
- return true;
- }
+ return !(find(":") != -1 || find("/") != -1 || find("\\") != -1 || find("?") != -1 || find("*") != -1 || find("\"") != -1 || find("|") != -1 || find("%") != -1 || find("<") != -1 || find(">") != -1);
}
bool String::is_valid_ip_address() const {
@@ -3941,7 +3937,6 @@ String String::percent_decode() const {
uint8_t a = LOWERCASE(cs[i + 1]);
uint8_t b = LOWERCASE(cs[i + 2]);
- c = 0;
if (a >= '0' && a <= '9')
c = (a - '0') << 4;
else if (a >= 'a' && a <= 'f')
diff --git a/core/ustring.h b/core/ustring.h
index ecf934a26b..a32daabb91 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -404,8 +404,6 @@ _FORCE_INLINE_ bool is_str_less(const L *l_ptr, const R *r_ptr) {
l_ptr++;
r_ptr++;
}
-
- CRASH_COND(true); // unreachable
}
/* end of namespace */
diff --git a/core/variant.cpp b/core/variant.cpp
index 6eadf59fce..9306867ac7 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -709,7 +709,7 @@ bool Variant::is_zero() const {
// atomic types
case BOOL: {
- return _data._bool == false;
+ return !(_data._bool);
} break;
case INT: {
diff --git a/core/variant.h b/core/variant.h
index 5151262f27..a8e99c13f1 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -248,8 +248,8 @@ public:
Variant(unsigned short p_short);
Variant(signed char p_char); // real one
Variant(unsigned char p_char);
- Variant(int64_t p_char); // real one
- Variant(uint64_t p_char);
+ Variant(int64_t p_int); // real one
+ Variant(uint64_t p_int);
Variant(float p_float);
Variant(double p_double);
Variant(const String &p_string);
@@ -262,11 +262,11 @@ public:
Variant(const Plane &p_plane);
Variant(const ::AABB &p_aabb);
Variant(const Quat &p_quat);
- Variant(const Basis &p_transform);
+ Variant(const Basis &p_matrix);
Variant(const Transform2D &p_transform);
Variant(const Transform &p_transform);
Variant(const Color &p_color);
- Variant(const NodePath &p_path);
+ Variant(const NodePath &p_node_path);
Variant(const RefPtr &p_resource);
Variant(const RID &p_rid);
Variant(const Object *p_object);
@@ -283,17 +283,17 @@ public:
Variant(const PoolVector<Face3> &p_face_array);
Variant(const Vector<Variant> &p_array);
- Variant(const Vector<uint8_t> &p_raw_array);
- Variant(const Vector<int> &p_int_array);
- Variant(const Vector<real_t> &p_real_array);
- Variant(const Vector<String> &p_string_array);
- Variant(const Vector<StringName> &p_string_array);
- Variant(const Vector<Vector3> &p_vector3_array);
- Variant(const Vector<Color> &p_color_array);
+ Variant(const Vector<uint8_t> &p_array);
+ Variant(const Vector<int> &p_array);
+ Variant(const Vector<real_t> &p_array);
+ Variant(const Vector<String> &p_array);
+ Variant(const Vector<StringName> &p_array);
+ Variant(const Vector<Vector3> &p_array);
+ Variant(const Vector<Color> &p_array);
Variant(const Vector<Plane> &p_array); // helper
Variant(const Vector<RID> &p_array); // helper
Variant(const Vector<Vector2> &p_array); // helper
- Variant(const PoolVector<Vector2> &p_array); // helper
+ Variant(const PoolVector<Vector2> &p_vector2_array); // helper
Variant(const IP_Address &p_address);
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 9fe7e43b43..b08202ae45 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -811,7 +811,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
data.resize(data_size);
- Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1 ? true : false, real_format, data));
+ Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1, real_format, data));
return Ref<Image>(img);
#else
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index df7b170bf4..58eff791ca 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -182,14 +182,11 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
#endif
- int define_line_ofs = 1;
-
for (int j = 0; j < conditional_count; j++) {
bool enable = (conditional_version.version & (1 << j)) > 0;
if (enable) {
strings.push_back(conditional_defines[j]);
- define_line_ofs++;
DEBUG_PRINT(conditional_defines[j]);
}
}
@@ -206,7 +203,6 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
ERR_FAIL_COND_V(!cc, NULL);
v.code_version = cc->version;
- define_line_ofs += 2;
}
// program
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 1f3af2f885..eb5ab53421 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -691,7 +691,7 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
state.canvas_shader.set_uniform(CanvasShaderGLES3::DST_RECT, Color(dst_rect.position.x, dst_rect.position.y, dst_rect.size.x, dst_rect.size.y));
state.canvas_shader.set_uniform(CanvasShaderGLES3::SRC_RECT, Color(src_rect.position.x, src_rect.position.y, src_rect.size.x, src_rect.size.y));
- state.canvas_shader.set_uniform(CanvasShaderGLES3::CLIP_RECT_UV, (rect->flags & CANVAS_RECT_CLIP_UV) ? true : false);
+ state.canvas_shader.set_uniform(CanvasShaderGLES3::CLIP_RECT_UV, rect->flags & CANVAS_RECT_CLIP_UV);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
@@ -1932,7 +1932,7 @@ void RasterizerCanvasGLES3::draw_window_margins(int *black_margin, RID *black_im
int window_h = window_size.height;
int window_w = window_size.width;
- glBindFramebuffer(GL_FRAMEBUFFER, storage->system_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
glViewport(0, 0, window_size.width, window_size.height);
canvas_begin();
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index b3a1d32bf4..91c0693538 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -2426,7 +2426,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
e->sort_key |= SORT_KEY_LIGHTMAP_CAPTURE_FLAG;
}
- e->sort_key |= uint64_t(p_material->render_priority + 128) << RenderList::SORT_KEY_PRIORITY_SHIFT;
+ e->sort_key |= (uint64_t(p_material->render_priority) + 128) << RenderList::SORT_KEY_PRIORITY_SHIFT;
}
/*
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 0840717d68..ea3fff41ea 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1252,7 +1252,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
data.resize(data_size);
- Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1 ? true : false, img_format, data));
+ Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1, img_format, data));
return Ref<Image>(img);
#else
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index badb656e96..0a7e47e304 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -816,7 +816,7 @@ public:
virtual void multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform &p_transform);
virtual void multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform);
virtual void multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color);
- virtual void multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color);
+ virtual void multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_custom_data);
virtual RID multimesh_get_mesh(RID p_multimesh) const;
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index fa7cc00230..ac911993be 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -478,7 +478,7 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
glDeleteShader(v.vert_id);
glDeleteProgram(v.id);
v.id = 0;
- ERR_FAIL_COND_V(iloglen <= 0, NULL);
+ ERR_FAIL_COND_V(iloglen < 0, NULL);
}
if (iloglen == 0) {
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index e011176806..950979a78e 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -100,10 +100,7 @@ bool DirAccessUnix::dir_exists(String p_dir) {
struct stat flags;
bool success = (stat(p_dir.utf8().get_data(), &flags) == 0);
- if (success && S_ISDIR(flags.st_mode))
- return true;
-
- return false;
+ return (success && S_ISDIR(flags.st_mode));
}
uint64_t DirAccessUnix::get_modified_time(String p_file) {
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
index fcd1c3be4b..a2df61ddaa 100644
--- a/drivers/unix/net_socket_posix.cpp
+++ b/drivers/unix/net_socket_posix.cpp
@@ -221,10 +221,7 @@ bool NetSocketPosix::_can_use_ip(const IP_Address p_ip, const bool p_for_bind) c
}
// Check if socket support this IP type.
IP::Type type = p_ip.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
- if (_ip_type != IP::TYPE_ANY && !p_ip.is_wildcard() && _ip_type != type) {
- return false;
- }
- return true;
+ return !(_ip_type != IP::TYPE_ANY && !p_ip.is_wildcard() && _ip_type != type);
}
void NetSocketPosix::_set_socket(SOCKET_TYPE p_sock, IP::Type p_ip_type, bool p_is_stream) {
diff --git a/drivers/unix/net_socket_posix.h b/drivers/unix/net_socket_posix.h
index b7fb3fdc94..dd7597eb6d 100644
--- a/drivers/unix/net_socket_posix.h
+++ b/drivers/unix/net_socket_posix.h
@@ -76,7 +76,7 @@ public:
virtual void close();
virtual Error bind(IP_Address p_addr, uint16_t p_port);
virtual Error listen(int p_max_pending);
- virtual Error connect_to_host(IP_Address p_addr, uint16_t p_port);
+ virtual Error connect_to_host(IP_Address p_host, uint16_t p_port);
virtual Error poll(PollType p_type, int timeout) const;
virtual Error recv(uint8_t *p_buffer, int p_len, int &r_read);
virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port);
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 6e47fadb20..4d48beed0a 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -286,7 +286,7 @@ public:
if (name == "value") {
- Variant value = p_value;
+ const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@@ -302,7 +302,7 @@ public:
}
if (name == "in_handle") {
- Variant value = p_value;
+ const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@@ -318,7 +318,7 @@ public:
}
if (name == "out_handle") {
- Variant value = p_value;
+ const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@@ -4887,7 +4887,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
continue;
}
- if (!prop_exists || p_animation->track_get_type(i) != Animation::TYPE_VALUE || cleanup_keys->is_pressed() == false)
+ if (!prop_exists || p_animation->track_get_type(i) != Animation::TYPE_VALUE || !cleanup_keys->is_pressed())
continue;
for (int j = 0; j < p_animation->track_get_key_count(i); j++) {
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 1452d5519c..61a2cf02b3 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -332,7 +332,7 @@ class AnimationTrackEditor : public VBoxContainer {
void _update_scroll(double);
void _update_step(double p_new_step);
- void _update_length(double p_new_step);
+ void _update_length(double p_new_len);
void _dropped_track(int p_from_track, int p_to_track);
void _add_track(int p_type);
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp
index 72beeaaf45..f2471e80d4 100644
--- a/editor/array_property_edit.cpp
+++ b/editor/array_property_edit.cpp
@@ -93,7 +93,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
if (newsize == size)
return true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Resize Array"));
ur->add_do_method(this, "_set_size", newsize);
ur->add_undo_method(this, "_set_size", size);
@@ -141,7 +141,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) {
Variant::CallError ce;
Variant new_value = Variant::construct(Variant::Type(type), NULL, 0, ce);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Array Value Type"));
ur->add_do_method(this, "_set_value", idx, new_value);
@@ -157,7 +157,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
Variant arr = get_array();
Variant value = arr.get(idx);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Array Value"));
ur->add_do_method(this, "_set_value", idx, p_value);
diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h
index fca0aabac1..90b59cf8c1 100644
--- a/editor/audio_stream_preview.h
+++ b/editor/audio_stream_preview.h
@@ -78,7 +78,7 @@ protected:
public:
static AudioStreamPreviewGenerator *get_singleton() { return singleton; }
- Ref<AudioStreamPreview> generate_preview(const Ref<AudioStream> &p_preview);
+ Ref<AudioStreamPreview> generate_preview(const Ref<AudioStream> &p_stream);
AudioStreamPreviewGenerator();
};
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index a0d319c81b..4bc9dff26c 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -48,7 +48,7 @@
String Collada::Effect::get_texture_path(const String &p_source, Collada &state) const {
- String image = p_source;
+ const String &image = p_source;
ERR_FAIL_COND_V(!state.state.image_map.has(image), "");
return state.state.image_map[image].path;
}
@@ -1101,6 +1101,7 @@ void Collada::_parse_mesh_geometry(XMLParser &parser, String p_id, String p_name
Vector<float> values = _read_float_array(parser);
if (polygons) {
+ ERR_CONTINUE(prim.vertex_size == 0);
prim.polygons.push_back(values.size() / prim.vertex_size);
int from = prim.indices.size();
prim.indices.resize(from + values.size());
@@ -2522,7 +2523,6 @@ Error Collada::load(const String &p_path, int p_flags) {
state.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
state.import_flags = p_flags;
/* Skip headers */
- err = OK;
while ((err = parser.read()) == OK) {
if (parser.get_node_type() == XMLParser::NODE_ELEMENT) {
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 6d3603f31b..d04392dabf 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -649,7 +649,7 @@ Open connection dialog with TreeItem data to CREATE a brand-new connection.
void ConnectionsDock::_open_connection_dialog(TreeItem &item) {
String signal = item.get_metadata(0).operator Dictionary()["name"];
- String signalname = signal;
+ const String &signalname = signal;
String midname = selectedNode->get_name();
for (int i = 0; i < midname.length(); i++) { //TODO: Regex filter may be cleaner.
CharType c = midname[i];
diff --git a/editor/dictionary_property_edit.cpp b/editor/dictionary_property_edit.cpp
index 9f4096ca02..62b50b16f2 100644
--- a/editor/dictionary_property_edit.cpp
+++ b/editor/dictionary_property_edit.cpp
@@ -42,7 +42,6 @@ void DictionaryPropertyEdit::_notif_changev(const String &p_v) {
void DictionaryPropertyEdit::_set_key(const Variant &p_old_key, const Variant &p_new_key) {
// TODO: Set key of a dictionary is not allowed yet
- return;
}
void DictionaryPropertyEdit::_set_value(const Variant &p_key, const Variant &p_value) {
@@ -129,7 +128,7 @@ bool DictionaryPropertyEdit::_set(const StringName &p_name, const Variant &p_val
if (type == "key" && index < keys.size()) {
const Variant &key = keys[index];
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Dictionary Key"));
ur->add_do_method(this, "_set_key", key, p_value);
@@ -144,7 +143,7 @@ bool DictionaryPropertyEdit::_set(const StringName &p_name, const Variant &p_val
if (dict.has(key)) {
Variant value = dict[key];
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Dictionary Value"));
ur->add_do_method(this, "_set_value", key, p_value);
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 57fac241b0..b9fb532c4a 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -288,7 +288,7 @@ void EditorAudioBus::_name_changed(const String &p_new_name) {
}
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
StringName current = AudioServer::get_singleton()->get_bus_name(get_index());
ur->create_action(TTR("Rename Audio Bus"));
@@ -323,7 +323,7 @@ void EditorAudioBus::_volume_changed(float p_normalized) {
float p_db = this->_normalized_volume_to_scaled_db(p_normalized);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Audio Bus Volume"), UndoRedo::MERGE_ENDS);
ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), p_db);
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), AudioServer::get_singleton()->get_bus_volume_db(get_index()));
@@ -400,7 +400,7 @@ void EditorAudioBus::_solo_toggled() {
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Solo"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_solo", get_index(), solo->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_solo", get_index(), AudioServer::get_singleton()->is_bus_solo(get_index()));
@@ -414,7 +414,7 @@ void EditorAudioBus::_mute_toggled() {
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Mute"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_mute", get_index(), mute->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_mute", get_index(), AudioServer::get_singleton()->is_bus_mute(get_index()));
@@ -428,7 +428,7 @@ void EditorAudioBus::_bypass_toggled() {
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Bypass Effects"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), bypass->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), AudioServer::get_singleton()->is_bus_bypassing_effects(get_index()));
@@ -443,7 +443,7 @@ void EditorAudioBus::_send_selected(int p_which) {
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Select Audio Bus Send"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_send", get_index(), send->get_item_text(p_which));
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_send", get_index(), AudioServer::get_singleton()->get_bus_send(get_index()));
@@ -492,7 +492,7 @@ void EditorAudioBus::_effect_edited() {
int index = effect->get_metadata(0);
updating_bus = true;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Select Audio Bus Send"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, effect->is_checked(0));
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, AudioServer::get_singleton()->is_bus_effect_enabled(get_index(), index));
@@ -519,7 +519,7 @@ void EditorAudioBus::_effect_add(int p_which) {
afxr->set_name(effect_options->get_item_text(p_which));
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Add Audio Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), afxr, -1);
ur->add_undo_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect_count(get_index()));
@@ -671,7 +671,7 @@ void EditorAudioBus::drop_data_fw(const Point2 &p_point, const Variant &p_data,
bool enabled = AudioServer::get_singleton()->is_bus_effect_enabled(bus, effect);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Move Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", bus, effect);
ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(bus, effect), paste_at);
@@ -712,7 +712,7 @@ void EditorAudioBus::_delete_effect_pressed(int p_option) {
int index = item->get_metadata(0);
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Delete Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), index);
ur->add_undo_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(get_index(), index), index);
@@ -980,11 +980,7 @@ void EditorAudioBusDrop::_notification(int p_what) {
bool EditorAudioBusDrop::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
Dictionary d = p_data;
- if (d.has("type") && String(d["type"]) == "move_audio_bus") {
- return true;
- }
-
- return false;
+ return (d.has("type") && String(d["type"]) == "move_audio_bus");
}
void EditorAudioBusDrop::drop_data(const Point2 &p_point, const Variant &p_data) {
@@ -1013,7 +1009,7 @@ void EditorAudioBuses::_update_buses() {
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
- bool is_master = i == 0 ? true : false;
+ bool is_master = (i == 0);
EditorAudioBus *audio_bus = memnew(EditorAudioBus(this, is_master));
bus_hb->add_child(audio_bus);
audio_bus->connect("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED);
@@ -1075,7 +1071,7 @@ void EditorAudioBuses::_notification(int p_what) {
void EditorAudioBuses::_add_bus() {
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Add Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_count", AudioServer::get_singleton()->get_bus_count() + 1);
@@ -1109,7 +1105,7 @@ void EditorAudioBuses::_delete_bus(Object *p_which) {
return;
}
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Delete Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus", index);
@@ -1133,7 +1129,7 @@ void EditorAudioBuses::_delete_bus(Object *p_which) {
void EditorAudioBuses::_duplicate_bus(int p_which) {
int add_at_pos = p_which + 1;
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Duplicate Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "add_bus", add_at_pos);
ur->add_do_method(AudioServer::get_singleton(), "set_bus_name", add_at_pos, AudioServer::get_singleton()->get_bus_name(p_which) + " Copy");
@@ -1158,7 +1154,7 @@ void EditorAudioBuses::_reset_bus_volume(Object *p_which) {
EditorAudioBus *bus = Object::cast_to<EditorAudioBus>(p_which);
int index = bus->get_index();
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Reset Bus Volume"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", index, 0.f);
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", index, AudioServer::get_singleton()->get_bus_volume_db(index));
@@ -1180,7 +1176,7 @@ void EditorAudioBuses::_request_drop_end() {
void EditorAudioBuses::_drop_at_index(int p_bus, int p_index) {
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Move Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "move_bus", p_bus, p_index);
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 913eb35f8a..0be7db3236 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -545,10 +545,7 @@ bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Varia
int section = tree->get_drop_section_at_position(p_point);
- if (section < -1)
- return false;
-
- return true;
+ return section >= -1;
}
return false;
@@ -650,7 +647,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
return false;
}
- String path = p_path;
+ const String &path = p_path;
if (!FileAccess::exists(path)) {
EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("File does not exist."));
return false;
@@ -663,7 +660,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
name = "autoload/" + name;
- UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add AutoLoad"));
// Singleton autoloads are represented with a leading "*" in their path.
@@ -690,7 +687,7 @@ void EditorAutoloadSettings::autoload_remove(const String &p_name) {
String name = "autoload/" + p_name;
- UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *undo_redo = EditorNode::get_undo_redo();
int order = ProjectSettings::get_singleton()->get_order(name);
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index e04bca2a9e..7733ecb9da 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -186,7 +186,7 @@ EditorDirDialog::EditorDirDialog() {
tree->connect("item_activated", this, "_ok");
- makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel() ? true : false, "makedir");
+ makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel(), "makedir");
makedir->connect("pressed", this, "_make_dir");
makedialog = memnew(ConfirmationDialog);
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index b5325a07a5..bebd5b2412 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -977,7 +977,8 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
ftmp = FileAccess::open(tmppath, FileAccess::READ);
if (!ftmp) {
memdelete(f);
- ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE);
+ ERR_EXPLAIN("Can't open file to read from path: " + String(tmppath));
+ ERR_FAIL_V(ERR_CANT_CREATE);
}
const int bufsize = 16384;
@@ -1455,10 +1456,7 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset,
err += TTR("Custom release template not found.") + "\n";
}
- if (dvalid || rvalid)
- valid = true;
- else
- valid = false;
+ valid = dvalid || rvalid;
if (!err.empty())
r_error = err;
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 4ddb28b440..3c7c6ec9ed 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -1290,13 +1290,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector
r_file_pos = cpos;
*r_d = fs;
- if (cpos != -1) {
-
- return true;
- } else {
-
- return false;
- }
+ return cpos != -1;
}
String EditorFileSystem::get_file_type(const String &p_file) const {
@@ -1604,7 +1598,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
//all went well, overwrite config files with proper remaps and md5s
for (Map<String, Map<StringName, Variant> >::Element *E = source_file_options.front(); E; E = E->next()) {
- String file = E->key();
+ const String &file = E->key();
String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(file);
FileAccessRef f = FileAccess::open(file + ".import", FileAccess::WRITE);
ERR_FAIL_COND_V(!f, ERR_FILE_CANT_OPEN);
@@ -1939,7 +1933,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
if (err) {
memdelete(da);
ERR_EXPLAIN("Failed to create 'res://.import' folder.");
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL();
}
}
memdelete(da);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 26d793cf65..790a70a3cc 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -389,7 +389,6 @@ void EditorHelp::_update_doc() {
if (prev) {
class_desc->add_text(" , ");
- prev = false;
}
_add_type(E->get().name);
@@ -540,7 +539,6 @@ void EditorHelp::_update_doc() {
class_desc->pop(); //cell
class_desc->push_cell();
class_desc->pop(); //cell
- any_previous = false;
}
String group_prefix;
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 0550509ba2..117a63699e 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -139,7 +139,7 @@ public:
bool is_selected() const;
void set_label_reference(Control *p_control);
- void set_bottom_editor(Control *p_editor);
+ void set_bottom_editor(Control *p_control);
void set_use_folding(bool p_use_folding);
bool is_using_folding() const;
@@ -317,7 +317,7 @@ class EditorInspector : public ScrollContainer {
void _node_removed(Node *p_node);
void _changed_callback(Object *p_changed, const char *p_prop);
- void _edit_request_change(Object *p_changed, const String &p_prop);
+ void _edit_request_change(Object *p_object, const String &p_prop);
void _filter_changed(const String &p_text);
void _parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped);
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 055e1338dd..78c38af555 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -184,7 +184,7 @@ Node *EditorInterface::get_edited_scene_root() {
Array EditorInterface::get_open_scenes() const {
Array ret;
- Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes();
+ Vector<EditorData::EditedScene> scenes = EditorNode::get_editor_data().get_edited_scenes();
int scns_amount = scenes.size();
for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) {
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 0d700cd9b6..ec369bbdbb 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -101,7 +101,7 @@ public:
Error save_scene();
void save_scene_as(const String &p_scene, bool p_with_preview = true);
- Vector<Ref<Texture> > make_mesh_previews(const Vector<Ref<Mesh> > &p_meshes, Vector<Transform> *p_trnasforms, int p_preview_size);
+ Vector<Ref<Texture> > make_mesh_previews(const Vector<Ref<Mesh> > &p_meshes, Vector<Transform> *p_transforms, int p_preview_size);
EditorInterface();
};
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index f73cd0beb5..9cf36f162d 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -227,8 +227,6 @@ void EditorProfiler::_update_plot() {
Map<StringName, int> plot_prev;
//Map<StringName,int> plot_max;
- uint64_t time = OS::get_singleton()->get_ticks_usec();
-
for (int i = 0; i < w; i++) {
for (int j = 0; j < h * 4; j++) {
@@ -340,8 +338,6 @@ void EditorProfiler::_update_plot() {
wr[widx + 3] = 255;
}
}
-
- time = OS::get_singleton()->get_ticks_usec() - time;
}
wr = PoolVector<uint8_t>::Write();
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index d5f4d54e5c..8e4ec47435 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2303,7 +2303,7 @@ void EditorPropertyResource::_update_menu_items() {
}
for (Set<String>::Element *F = valid_inheritors.front(); F; F = F->next()) {
- String t = F->get();
+ const String &t = F->get();
bool is_custom_resource = false;
Ref<Texture> icon;
@@ -2469,8 +2469,8 @@ void EditorPropertyResource::_fold_other_editors(Object *p_self) {
if (!res.is_valid())
return;
bool use_editor = false;
- for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) {
- EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i);
+ for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) {
+ EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i);
if (ep->handles(res.ptr())) {
use_editor = true;
}
@@ -2516,7 +2516,7 @@ void EditorPropertyResource::update_property() {
sub_inspector->set_keying(is_keying());
sub_inspector->set_read_only(is_read_only());
sub_inspector->set_use_folding(is_using_folding());
- sub_inspector->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
+ sub_inspector->set_undo_redo(EditorNode::get_undo_redo());
sub_inspector_vbox = memnew(VBoxContainer);
add_child(sub_inspector_vbox);
@@ -2526,8 +2526,8 @@ void EditorPropertyResource::update_property() {
assign->set_pressed(true);
bool use_editor = false;
- for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) {
- EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i);
+ for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) {
+ EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i);
if (ep->handles(res.ptr())) {
use_editor = true;
}
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 5f18959689..a49f9489e1 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -791,7 +791,7 @@ void EditorPropertyDictionary::update_property() {
} break;
case Variant::_RID: {
- prop = memnew(EditorPropertyNil);
+ prop = memnew(EditorPropertyRID);
} break;
case Variant::OBJECT: {
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 0ba32395ec..4bd68a593f 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -50,10 +50,8 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
args.push_back(resource_path.replace(" ", "%20"));
}
- if (true) {
- args.push_back("--remote-debug");
- args.push_back(remote_host + ":" + String::num(remote_port));
- }
+ args.push_back("--remote-debug");
+ args.push_back(remote_host + ":" + String::num(remote_port));
args.push_back("--allow_focus_steal_pid");
args.push_back(itos(OS::get_singleton()->get_process_id()));
diff --git a/editor/editor_run_native.h b/editor/editor_run_native.h
index d62c982725..a5c28b0cb4 100644
--- a/editor/editor_run_native.h
+++ b/editor/editor_run_native.h
@@ -36,7 +36,7 @@
class EditorRunNative : public HBoxContainer {
- GDCLASS(EditorRunNative, BoxContainer);
+ GDCLASS(EditorRunNative, HBoxContainer);
Map<int, MenuButton *> menus;
bool first;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 58e3cc6fc1..8dfac3ce52 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -107,7 +107,7 @@ bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value)
}
if (save_changed_setting) {
- if (props[p_name].save != true) {
+ if (!props[p_name].save) {
props[p_name].save = true;
changed = true;
}
@@ -690,7 +690,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
keys.sort();
for (const List<String>::Element *E = keys.front(); E; E = E->next()) {
- String key = E->get();
+ const String &key = E->get();
if (key.begins_with("text_editor/highlighting/") && key.find("color") >= 0) {
cf->set_value(theme_section, key.replace("text_editor/highlighting/", ""), ((Color)props[key].variant).to_html());
}
@@ -698,10 +698,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
Error err = cf->save(p_file);
- if (err == OK) {
- return true;
- }
- return false;
+ return err == OK;
}
bool EditorSettings::_is_default_text_editor_theme(String p_theme_name) {
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 2ee8dd805b..890850629e 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -73,8 +73,6 @@ private:
bool restart_if_changed;
VariantContainer() :
order(0),
- variant(Variant()),
- initial(Variant()),
has_default_value(false),
hide_from_editor(false),
save(false),
@@ -83,7 +81,6 @@ private:
VariantContainer(const Variant &p_variant, int p_order) :
order(p_order),
variant(p_variant),
- initial(Variant()),
has_default_value(false),
hide_from_editor(false),
save(false),
@@ -123,7 +120,7 @@ private:
void _load_defaults(Ref<ConfigFile> p_extra_config = NULL);
void _load_default_text_editor_theme();
bool _save_text_editor_theme(String p_file);
- bool _is_default_text_editor_theme(String p_file);
+ bool _is_default_text_editor_theme(String p_theme_name);
protected:
static void _bind_methods();
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 4e499021f9..bd61e6182c 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -314,7 +314,8 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
if (!f) {
ret = unzGoToNextFile(pkg);
fc++;
- ERR_CONTINUE(!f);
+ ERR_EXPLAIN("Can't open file from path: " + String(to_write));
+ ERR_CONTINUE(true);
}
f->store_buffer(data.ptr(), data.size());
@@ -406,9 +407,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
} break;
case HTTPRequest::RESULT_BODY_SIZE_LIMIT_EXCEEDED:
case HTTPRequest::RESULT_CONNECTION_ERROR:
- case HTTPRequest::RESULT_CHUNKED_BODY_SIZE_MISMATCH: {
- template_list_state->set_text(TTR("Can't connect."));
- } break;
+ case HTTPRequest::RESULT_CHUNKED_BODY_SIZE_MISMATCH:
case HTTPRequest::RESULT_SSL_HANDSHAKE_ERROR:
case HTTPRequest::RESULT_CANT_CONNECT: {
template_list_state->set_text(TTR("Can't connect."));
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index e57217bb11..83e529ac35 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -244,7 +244,7 @@ void FileSystemDock::set_display_mode(DisplayMode p_display_mode) {
void FileSystemDock::_update_display_mode(bool p_force) {
// Compute the new display mode
if (p_force || old_display_mode != display_mode) {
- button_toggle_display_mode->set_pressed(display_mode == DISPLAY_MODE_SPLIT ? true : false);
+ button_toggle_display_mode->set_pressed(display_mode == DISPLAY_MODE_SPLIT);
switch (display_mode) {
case DISPLAY_MODE_TREE_ONLY:
tree->show();
@@ -2063,8 +2063,6 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
}
}
}
-
- return;
}
void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) {
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 46eaf71a8a..76f92665db 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -204,7 +204,7 @@ private:
void _update_resource_paths_after_move(const Map<String, String> &p_renames) const;
void _save_scenes_after_move(const Map<String, String> &p_renames) const;
void _update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const;
- void _update_project_settings_after_move(const Map<String, String> &p_folders_renames) const;
+ void _update_project_settings_after_move(const Map<String, String> &p_renames) const;
void _file_deleted(String p_file);
void _folder_deleted(String p_folder);
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index b3eb7ae83b..eb119b4ba3 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -34,7 +34,7 @@
#include "core/io/resource_importer.h"
class EditorImportPlugin : public ResourceImporter {
- GDCLASS(EditorImportPlugin, Reference);
+ GDCLASS(EditorImportPlugin, ResourceImporter);
protected:
static void _bind_methods();
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 0989a43705..a8197ec2a2 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -1135,7 +1135,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), (meshes_out || materials_out) ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), materials_out ? 1 : 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/compress"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? 1 : 0));
@@ -1145,8 +1145,8 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "animation/filter_script", PROPERTY_HINT_MULTILINE_TEXT), ""));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out ? true : false));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/optimizer/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_linear_error"), 0.05));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_angular_error"), 0.01));
@@ -1237,7 +1237,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito
Error ResourceImporterScene::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
- String src_path = p_source_file;
+ const String &src_path = p_source_file;
Ref<EditorSceneImporter> importer;
String ext = src_path.get_extension().to_lower();
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index e89f862c1b..498e0f6fb8 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -85,7 +85,7 @@ public:
String get_source_folder() const;
String get_source_file() const;
virtual Node *post_import(Node *p_scene);
- virtual void init(const String &p_scene_folder, const String &p_scene_path);
+ virtual void init(const String &p_source_folder, const String &p_source_file);
EditorScenePostImport();
};
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 5865ceb3af..25431179b5 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -205,11 +205,11 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/bptc_ldr", PROPERTY_HINT_ENUM, "Enabled,RGBA Only"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/normal_map", PROPERTY_HINT_ENUM, "Detect,Enable,Disabled"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/repeat", PROPERTY_HINT_ENUM, "Disabled,Enabled,Mirrored"), p_preset == PRESET_3D ? 1 : 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), p_preset == PRESET_2D_PIXEL ? false : true));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_3D ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), p_preset != PRESET_2D_PIXEL));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_3D));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/anisotropic"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/srgb", PROPERTY_HINT_ENUM, "Disable,Enable,Detect"), 2));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/premult_alpha"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/HDR_as_SRGB"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/invert_color"), false));
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
index eca4e58abe..51a6cc6757 100644
--- a/editor/import/resource_importer_texture_atlas.cpp
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -205,7 +205,7 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
for (const Map<String, Map<StringName, Variant> >::Element *E = p_source_file_options.front(); E; E = E->next(), idx++) {
PackData &pack_data = pack_data_files.write[idx];
- String source = E->key();
+ const String &source = E->key();
const Map<StringName, Variant> &options = E->get();
Ref<Image> image;
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index e39f2dabaa..1787a3b88d 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -210,12 +210,6 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
print_line("bits: "+itos(format_bits));
*/
- int len = frames;
- if (format_channels == 2)
- len *= 2;
- if (format_bits > 8)
- len *= 2;
-
data.resize(frames * format_channels);
if (format_bits == 8) {
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index 56a04f615d..6af7e4bd00 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -50,7 +50,7 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
name = "script";
}
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("MultiNode Set") + " " + String(name), UndoRedo::MERGE_ENDS);
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {
diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp
index e3fb579667..1c0151ed0a 100644
--- a/editor/node_dock.cpp
+++ b/editor/node_dock.cpp
@@ -119,13 +119,13 @@ NodeDock::NodeDock() {
groups_button->connect("pressed", this, "show_groups");
connections = memnew(ConnectionsDock(EditorNode::get_singleton()));
- connections->set_undoredo(EditorNode::get_singleton()->get_undo_redo());
+ connections->set_undoredo(EditorNode::get_undo_redo());
add_child(connections);
connections->set_v_size_flags(SIZE_EXPAND_FILL);
connections->hide();
groups = memnew(GroupsEditor);
- groups->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
+ groups->set_undo_redo(EditorNode::get_undo_redo());
add_child(groups);
groups->set_v_size_flags(SIZE_EXPAND_FILL);
groups->hide();
diff --git a/editor/plugin_config_dialog.h b/editor/plugin_config_dialog.h
index 74febfe408..525b7755dd 100644
--- a/editor/plugin_config_dialog.h
+++ b/editor/plugin_config_dialog.h
@@ -62,7 +62,7 @@ protected:
static void _bind_methods();
public:
- void config(const String &p_plugin_dir_name);
+ void config(const String &p_config_path);
PluginConfigDialog();
~PluginConfigDialog();
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 1afd7df049..2931678c80 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -807,7 +807,7 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wi
canvas_item_editor = NULL;
editor = p_editor;
- undo_redo = editor->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
wip_active = false;
edited_point = PosVertex();
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 2ae39d90de..e07f041eb1 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -735,7 +735,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
error_panel->add_child(error_label);
error_label->set_text("hmmm");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
menu = memnew(PopupMenu);
add_child(menu);
@@ -751,7 +751,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
selected_point = -1;
dragging_selected = false;
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 5e8fb8e059..b422e3e927 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -1043,7 +1043,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
error_panel->add_child(error_label);
error_label->set_text("eh");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
set_custom_minimum_size(Size2(0, 300 * EDSCALE));
@@ -1061,7 +1061,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
selected_point = -1;
selected_triangle = -1;
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index dff6eb5c5e..65282ccfc2 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -598,7 +598,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
- String bone = concat;
+ const String &bone = concat;
int idx = skeleton->find_bone(bone);
List<String> bone_path;
while (idx != -1) {
@@ -796,7 +796,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name));
ERR_FAIL_COND(!gn);
- String new_name = p_text;
+ const String &new_name = p_text;
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1);
@@ -804,7 +804,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
return; //nothing to do
}
- String base_name = new_name;
+ const String &base_name = new_name;
int base = 1;
String name = base_name;
while (blend_tree->has_node(name)) {
@@ -964,5 +964,5 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
}
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index a8866a1a87..5163b372b2 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1868,7 +1868,7 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) {
editor = p_node;
anim_editor = memnew(AnimationPlayerEditor(editor, this));
- anim_editor->set_undo_redo(editor->get_undo_redo());
+ anim_editor->set_undo_redo(EditorNode::get_undo_redo());
editor->add_bottom_panel_item(TTR("Animation"), anim_editor);
}
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index e25e7ac7ed..bc22d9315e 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -1094,7 +1094,7 @@ void AnimationNodeStateMachineEditor::_removed_from_graph() {
void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
- String new_name = p_text;
+ const String &new_name = p_text;
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1);
@@ -1102,7 +1102,7 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
return; // Nothing to do.
}
- String base_name = new_name;
+ const String &base_name = new_name;
int base = 1;
String name = base_name;
while (state_machine->has_node(name)) {
@@ -1365,7 +1365,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
error_panel->add_child(error_label);
error_panel->hide();
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
set_custom_minimum_size(Size2(0, 300 * EDSCALE));
@@ -1390,7 +1390,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
over_text = false;
diff --git a/editor/plugins/animation_tree_player_editor_plugin.cpp b/editor/plugins/animation_tree_player_editor_plugin.cpp
index f5d21ffb26..c99ad7f441 100644
--- a/editor/plugins/animation_tree_player_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_player_editor_plugin.cpp
@@ -511,9 +511,7 @@ void AnimationTreePlayerEditor::_draw_node(const StringName &p_node) {
font->draw_halign(ci, ofs + ascofs, HALIGN_CENTER, w, p_node, font_color);
ofs.y += h;
- int count = 2; // title and name
int inputs = anim_tree->node_get_input_count(p_node);
- count += inputs ? inputs : 1;
float icon_h_ofs = Math::floor((font->get_height() - slot_icon->get_height()) / 2.0) + 1;
@@ -618,7 +616,7 @@ AnimationTreePlayerEditor::ClickType AnimationTreePlayerEditor::_locate_click(co
for (const List<StringName>::Element *E = order.back(); E; E = E->prev()) {
- StringName node = E->get();
+ const StringName &node = E->get();
AnimationTreePlayer::NodeType type = anim_tree->node_get_type(node);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 3c24fd19b6..10f53182bf 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -71,8 +71,7 @@ class SnapDialog : public ConfirmationDialog {
SpinBox *rotation_step;
public:
- SnapDialog() :
- ConfirmationDialog() {
+ SnapDialog() {
const int SPIN_BOX_GRID_RANGE = 256;
const int SPIN_BOX_ROTATION_RANGE = 360;
Label *label;
@@ -490,8 +489,6 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
r_items.push_back(res);
}
}
-
- return;
}
void CanvasItemEditor::_get_canvas_items_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items) {
@@ -1999,11 +1996,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
return true;
}
- if (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)) {
- // Accept the key event in any case
- return true;
- }
- return false;
+ return (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)); // Accept the key event in any case
}
bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
@@ -4340,7 +4333,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (!n2d->get_parent_item())
continue;
- if (n2d->has_meta("_edit_bone_") && (bool)n2d->get_meta("_edit_bone_") == true)
+ if (n2d->has_meta("_edit_bone_") && n2d->get_meta("_edit_bone_"))
continue;
undo_redo->add_do_method(n2d, "set_meta", "_edit_bone_", true);
@@ -4390,7 +4383,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (canvas_item->get_viewport() != EditorNode::get_singleton()->get_scene_root())
continue;
- if (canvas_item->has_meta("_edit_ik_") && (bool)canvas_item->get_meta("_edit_ik_") == true)
+ if (canvas_item->has_meta("_edit_ik_") && canvas_item->get_meta("_edit_ik_"))
continue;
undo_redo->add_do_method(canvas_item, "set_meta", "_edit_ik_", true);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index ff221eb758..a46682d494 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -425,7 +425,7 @@ private:
List<CanvasItem *> _get_edited_canvas_items(bool retreive_locked = false, bool remove_canvas_item_if_parent_in_selection = true);
Rect2 _get_encompassing_rect_from_list(List<CanvasItem *> p_list);
- void _expand_encompassing_rect_using_children(Rect2 &p_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
+ void _expand_encompassing_rect_using_children(Rect2 &r_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
Rect2 _get_encompassing_rect(const Node *p_node);
Object *_get_editor_data(Object *p_what);
diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp
index 6ab554cb05..87cb0d04a2 100644
--- a/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -527,7 +527,7 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
node = NULL;
editor = p_editor;
- undo_redo = editor->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
add_child(memnew(VSeparator));
button_create = memnew(ToolButton);
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index a10eddb131..b87bd29cbd 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -179,7 +179,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
}
// Check for segment split.
- if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge == true) {
+ if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge) {
Vector2 gpoint2 = mb->get_position();
Ref<Curve2D> curve = node->get_curve();
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 53300f45ec..b8d95efd49 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -293,10 +293,7 @@ bool ResourcePreloaderEditor::can_drop_data_fw(const Point2 &p_point, const Vari
Vector<String> files = d["files"];
- if (files.size() == 0)
- return false;
-
- return true;
+ return files.size() != 0;
}
return false;
}
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index 326e8394a0..05f682f469 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -131,7 +131,7 @@ void EditorPropertyRootMotion::_node_assign() {
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
- String bone = concat;
+ const String &bone = concat;
int idx = skeleton->find_bone(bone);
List<String> bone_path;
while (idx != -1) {
diff --git a/editor/plugins/skeleton_editor_plugin.h b/editor/plugins/skeleton_editor_plugin.h
index 33a9128a11..558e954815 100644
--- a/editor/plugins/skeleton_editor_plugin.h
+++ b/editor/plugins/skeleton_editor_plugin.h
@@ -69,7 +69,7 @@ protected:
PhysicalBone *create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos);
public:
- void edit(Skeleton *p_mesh);
+ void edit(Skeleton *p_node);
SkeletonEditor();
~SkeletonEditor();
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 701b9e8144..3bddc6d6d4 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -133,7 +133,7 @@ public:
virtual bool is_editable() const;
void set_hidden(bool p_hidden);
- void set_plugin(EditorSpatialGizmoPlugin *p_gizmo);
+ void set_plugin(EditorSpatialGizmoPlugin *p_plugin);
EditorSpatialGizmo();
~EditorSpatialGizmo();
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 16f93b8fd3..82e8248216 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -1848,7 +1848,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
manual_position = Vector2(0, 0);
canvas_item_editor_viewport = NULL;
editor = p_editor;
- undo_redo = editor->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
tool = TOOL_NONE;
selection_active = false;
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 4b225fddf5..069d9d25ee 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -263,7 +263,7 @@ void TileSetEditor::_notification(int p_what) {
TileSetEditor::TileSetEditor(EditorNode *p_editor) {
editor = p_editor;
- undo_redo = editor->get_undo_redo();
+ undo_redo = EditorNode::get_undo_redo();
current_tile = -1;
VBoxContainer *left_container = memnew(VBoxContainer);
@@ -829,8 +829,8 @@ void TileSetEditor::_on_workspace_draw() {
case EDITMODE_BITMASK: {
Color c(1, 0, 0, 0.5);
Color ci(0.3, 0.6, 1, 0.5);
- for (float x = 0; x < region.size.x / (spacing + size.x); x++) {
- for (float y = 0; y < region.size.y / (spacing + size.y); y++) {
+ for (int x = 0; x < region.size.x / (spacing + size.x); x++) {
+ for (int y = 0; y < region.size.y / (spacing + size.y); y++) {
Vector2 coord(x, y);
Point2 anchor(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
anchor += WORKSPACE_MARGIN;
@@ -2009,11 +2009,7 @@ bool TileSetEditor::_sort_tiles(Variant p_a, Variant p_b) {
return true;
} else if (pos_a.y == pos_b.y) {
- if (pos_a.x < pos_b.x) {
- return true;
- } else {
- return false;
- }
+ return (pos_a.x < pos_b.x);
} else {
return false;
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index bfb005cd0b..ddf49aa9ea 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -158,10 +158,7 @@ bool VisualShaderEditor::_is_available(int p_mode) {
p_mode = temp_mode;
}
- if (p_mode != -1 && ((p_mode & current_mode) == 0)) {
- return false;
- }
- return true;
+ return (p_mode == -1 || (p_mode & current_mode) != 0);
}
void VisualShaderEditor::_update_options_menu() {
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 567706b808..e89814df3d 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -176,12 +176,12 @@ class VisualShaderEditor : public VBoxContainer {
void _input_select_item(Ref<VisualShaderNodeInput> input, String name);
- void _add_input_port(int p_node, int p_port, int p_type, const String &p_name);
+ void _add_input_port(int p_node, int p_port, int p_port_type, const String &p_name);
void _remove_input_port(int p_node, int p_port);
void _change_input_port_type(int p_type, int p_node, int p_port);
void _change_input_port_name(const String &p_text, Object *line_edit, int p_node, int p_port);
- void _add_output_port(int p_node, int p_port, int p_type, const String &p_name);
+ void _add_output_port(int p_node, int p_port, int p_port_type, const String &p_name);
void _remove_output_port(int p_node, int p_port);
void _change_output_port_type(int p_type, int p_node, int p_port);
void _change_output_port_name(const String &p_text, Object *line_edit, int p_node, int p_port);
@@ -204,7 +204,7 @@ class VisualShaderEditor : public VBoxContainer {
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
- bool _is_available(int p_flags);
+ bool _is_available(int p_mode);
void _update_created_node(GraphNode *node);
protected:
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index ee78b240a4..956da92c35 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -166,7 +166,7 @@ void ProjectExportDialog::_update_presets() {
void ProjectExportDialog::_update_export_all() {
- bool can_export = EditorExport::get_singleton()->get_export_preset_count() > 0 ? true : false;
+ bool can_export = EditorExport::get_singleton()->get_export_preset_count() > 0;
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(i);
@@ -986,7 +986,7 @@ void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
export_all_dialog->hide();
- _export_all(p_str == "release" ? false : true);
+ _export_all(p_str != "release");
}
void ProjectExportDialog::_export_all(bool p_debug) {
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 872f8fcd2c..df0dd8781e 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -808,7 +808,7 @@ void ProjectSettingsEditor::update_plugins() {
void ProjectSettingsEditor::_item_selected(const String &p_path) {
- String selected_path = p_path;
+ const String &selected_path = p_path;
if (selected_path == String())
return;
category->set_text(globals_editor->get_current_section());
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 4fa1bd74fe..82d974cae3 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -917,7 +917,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
}
for (Set<String>::Element *j = valid_inheritors.front(); j; j = j->next()) {
- String t = j->get();
+ const String &t = j->get();
bool is_custom_resource = false;
Ref<Texture> icon;
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index 858b14a733..40343cf908 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -475,17 +475,17 @@ String RenameDialog::_substitute(const String &subject, const Node *node, int co
if (root_node) {
result = result.replace("${ROOT}", root_node->get_name());
}
-
- Node *parent_node = node->get_parent();
- if (parent_node) {
- if (node == root_node) {
- // Can not substitute parent of root.
- result = result.replace("${PARENT}", "");
- } else {
- result = result.replace("${PARENT}", parent_node->get_name());
+ if (node) {
+ Node *parent_node = node->get_parent();
+ if (parent_node) {
+ if (node == root_node) {
+ // Can not substitute parent of root.
+ result = result.replace("${PARENT}", "");
+ } else {
+ result = result.replace("${PARENT}", parent_node->get_name());
+ }
}
}
-
return result;
}
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index d6c8e6b452..ff188a00d3 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -981,11 +981,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
return true;
}
- if (String(d["type"]) == "nodes") {
- return true;
- }
-
- return false;
+ return String(d["type"]) == "nodes";
}
void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index c4b8999401..fc4ff2ecfc 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -275,15 +275,13 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLE_FAN, a);
mesh->surface_set_material(0, p_material);
- if (true) {
- float md = 0;
- for (int i = 0; i < vs.size(); i++) {
+ float md = 0;
+ for (int i = 0; i < vs.size(); i++) {
- md = MAX(0, vs[i].length());
- }
- if (md) {
- mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
- }
+ md = MAX(0, vs[i].length());
+ }
+ if (md) {
+ mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0));
}
selectable_icon_size = p_scale;
@@ -432,9 +430,7 @@ bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera, const Vector<
}
}
- if (!any_out)
- return true;
- return false;
+ return !any_out;
}
if (collision_segments.size()) {
diff --git a/main/input_default.cpp b/main/input_default.cpp
index a939d77a1e..199fcfcf66 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -726,14 +726,14 @@ InputDefault::InputDefault() {
if (entries[i] == "")
continue;
parse_mapping(entries[i]);
- };
- };
+ }
+ }
int i = 0;
while (DefaultControllerMappings::mappings[i]) {
parse_mapping(DefaultControllerMappings::mappings[i++]);
- };
+ }
}
void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {
@@ -748,14 +748,14 @@ void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {
if (joy.mapping == -1) {
_button_event(p_device, p_button, p_pressed);
return;
- };
+ }
const Map<int, JoyEvent>::Element *el = map_db[joy.mapping].buttons.find(p_button);
if (!el) {
//don't process un-mapped events for now, it could mess things up badly for devices with additional buttons/axis
//return _button_event(p_last_id, p_device, p_button, p_pressed);
return;
- };
+ }
JoyEvent map = el->get();
if (map.type == TYPE_BUTTON) {
@@ -767,14 +767,13 @@ void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {
}
_button_event(p_device, map.index, p_pressed);
return;
- };
+ }
if (map.type == TYPE_AXIS) {
_axis_event(p_device, map.index, p_pressed ? 1.0 : 0.0);
- };
-
- return; // no event?
-};
+ }
+ // no event?
+}
void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
@@ -878,19 +877,18 @@ void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
if (pressed == joy_buttons_pressed.has(_combine_device(map.index, p_device))) {
// button already pressed or released, this is an axis bounce value
return;
- };
+ }
_button_event(p_device, map.index, pressed);
return;
- };
+ }
if (map.type == TYPE_AXIS) {
_axis_event(p_device, map.index, val);
return;
- };
+ }
//printf("invalid mapping\n");
- return;
-};
+}
void InputDefault::joy_hat(int p_device, int p_val) {
@@ -909,20 +907,20 @@ void InputDefault::joy_hat(int p_device, int p_val) {
if ((p_val & HAT_MASK_UP) != (cur_val & HAT_MASK_UP)) {
_button_event(p_device, map[HAT_UP].index, p_val & HAT_MASK_UP);
- };
+ }
if ((p_val & HAT_MASK_RIGHT) != (cur_val & HAT_MASK_RIGHT)) {
_button_event(p_device, map[HAT_RIGHT].index, p_val & HAT_MASK_RIGHT);
- };
+ }
if ((p_val & HAT_MASK_DOWN) != (cur_val & HAT_MASK_DOWN)) {
_button_event(p_device, map[HAT_DOWN].index, p_val & HAT_MASK_DOWN);
- };
+ }
if ((p_val & HAT_MASK_LEFT) != (cur_val & HAT_MASK_LEFT)) {
_button_event(p_device, map[HAT_LEFT].index, p_val & HAT_MASK_LEFT);
- };
+ }
joy_names[p_device].hat_current = p_val;
-};
+}
void InputDefault::_button_event(int p_device, int p_index, bool p_pressed) {
@@ -933,7 +931,7 @@ void InputDefault::_button_event(int p_device, int p_index, bool p_pressed) {
ievent->set_pressed(p_pressed);
parse_input_event(ievent);
-};
+}
void InputDefault::_axis_event(int p_device, int p_axis, float p_value) {
diff --git a/main/main.cpp b/main/main.cpp
index c51ffd9124..b38d896368 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -812,7 +812,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
int sp = bp.find_last(":");
if (sp == -1) {
ERR_EXPLAIN("Invalid breakpoint: '" + bp + "', expected file:line format.");
- ERR_CONTINUE(sp == -1);
+ ERR_CONTINUE(true);
}
script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp));
@@ -1469,7 +1469,7 @@ bool Main::start() {
if (obj)
memdelete(obj);
ERR_EXPLAIN("Can't load script '" + script + "', it does not inherit from a MainLoop type");
- ERR_FAIL_COND_V(!script_loop, false);
+ ERR_FAIL_V(false);
}
script_loop->set_init_script(script_res);
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 87bd640001..e82af93293 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -911,7 +911,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
if (incr == 0) {
ERR_EXPLAIN("unhandled opcode: " + itos(code[ip]));
- ERR_BREAK(incr == 0);
+ ERR_BREAK(true);
}
ip += incr;
@@ -974,7 +974,7 @@ MainLoop *test(TestType p_type) {
if (tk.get_token() == GDScriptTokenizer::TK_IDENTIFIER)
text = "'" + tk.get_token_identifier() + "' (identifier)";
else if (tk.get_token() == GDScriptTokenizer::TK_CONSTANT) {
- Variant c = tk.get_token_constant();
+ const Variant &c = tk.get_token_constant();
if (c.get_type() == Variant::STRING)
text = "\"" + String(c) + "\"";
else
diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp
index 84f504a78d..6850c4d88a 100644
--- a/main/tests/test_physics.cpp
+++ b/main/tests/test_physics.cpp
@@ -329,7 +329,6 @@ public:
make_grid(5, 5, 2.5, 1, gxf);
test_fall();
quit = false;
- return;
}
virtual bool iteration(float p_time) {
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index a107fd738f..05df888f40 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -57,7 +57,7 @@ bool test_2() {
OS::get_singleton()->print("\n\nTest 2: Assign from string (operator=)\n");
String s = "Dolly";
- String t = s;
+ const String &t = s;
OS::get_singleton()->print("\tExpected: Dolly\n");
OS::get_singleton()->print("\tResulted: %ls\n", t.c_str());
@@ -70,7 +70,7 @@ bool test_3() {
OS::get_singleton()->print("\n\nTest 3: Assign from c-string (copycon)\n");
String s("Sheep");
- String t(s);
+ const String &t(s);
OS::get_singleton()->print("\tExpected: Sheep\n");
OS::get_singleton()->print("\tResulted: %ls\n", t.c_str());
@@ -1062,7 +1062,7 @@ bool test_33() {
OS::get_singleton()->print("\n\nTest 33: parse_utf8(null, -1)\n");
String empty;
- return empty.parse_utf8(NULL, -1) == true;
+ return empty.parse_utf8(NULL, -1);
}
bool test_34() {
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp
index b4530c2df1..a7e8dec11e 100644
--- a/modules/bmp/image_loader_bmp.cpp
+++ b/modules/bmp/image_loader_bmp.cpp
@@ -262,7 +262,7 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f,
PoolVector<uint8_t> bmp_color_table;
// Color table is usually 4 bytes per color -> [B][G][R][0]
- err = bmp_color_table.resize(color_table_size * 4);
+ bmp_color_table.resize(color_table_size * 4);
PoolVector<uint8_t>::Write bmp_color_table_w = bmp_color_table.write();
f->get_buffer(bmp_color_table_w.ptr(), color_table_size * 4);
diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h
index 553a7553c6..6c9419b3c2 100644
--- a/modules/csg/csg_shape.h
+++ b/modules/csg/csg_shape.h
@@ -404,7 +404,7 @@ public:
void set_spin_degrees(float p_spin_degrees);
float get_spin_degrees() const;
- void set_spin_sides(int p_sides);
+ void set_spin_sides(int p_spin_sides);
int get_spin_sides() const;
void set_path_node(const NodePath &p_path);
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 3fb9268702..95f3c12806 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -69,7 +69,7 @@ Variant GDScriptNativeClass::_new() {
Object *o = instance();
if (!o) {
ERR_EXPLAIN("Class type: '" + String(name) + "' is not instantiable.");
- ERR_FAIL_COND_V(!o, Variant());
+ ERR_FAIL_V(Variant());
}
Reference *ref = Object::cast_to<Reference>(o);
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 189317b163..caffe04700 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -1073,7 +1073,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
int set_index;
bool named = false;
- if (static_cast<const GDScriptParser::OperatorNode *>(op)->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) {
+ if (op->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) {
set_index = codegen.get_name_map_pos(static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[1])->name);
named = true;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index ec3e72eef7..f2afad74da 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -1150,7 +1150,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (!expr) {
ERR_EXPLAIN("GDScriptParser bug, couldn't figure out what expression is...");
- ERR_FAIL_COND_V(!expr, NULL);
+ ERR_FAIL_V(NULL);
}
/******************/
@@ -1493,7 +1493,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (next_op == -1) {
_set_error("Yet another parser bug....");
- ERR_FAIL_COND_V(next_op == -1, NULL);
+ ERR_FAIL_V(NULL);
}
// OK! create operator..
@@ -5944,11 +5944,8 @@ bool GDScriptParser::_is_type_compatible(const DataType &p_container, const Data
if (p_container.kind == DataType::BUILTIN && p_container.builtin_type == Variant::OBJECT) {
// Object built-in is a special case, it's compatible with any object and with null
- if (p_expression.kind == DataType::BUILTIN && p_expression.builtin_type == Variant::NIL) {
- return true;
- }
if (p_expression.kind == DataType::BUILTIN) {
- return false;
+ return p_expression.builtin_type == Variant::NIL;
}
// If it's not a built-in, must be an object
return true;
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index a93d1ceebb..95715ab648 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -1189,7 +1189,7 @@ Error GDScriptTokenizerBuffer::set_code_buffer(const Vector<uint8_t> &p_buffer)
int version = decode_uint32(&buf[4]);
if (version > BYTECODE_VERSION) {
ERR_EXPLAIN("Bytecode is too New! Please use a newer engine version.");
- ERR_FAIL_COND_V(version > BYTECODE_VERSION, ERR_INVALID_DATA);
+ ERR_FAIL_V(ERR_INVALID_DATA);
}
int identifier_count = decode_uint32(&buf[8]);
int constant_count = decode_uint32(&buf[12]);
@@ -1303,7 +1303,7 @@ Vector<uint8_t> GDScriptTokenizerBuffer::parse_code_string(const String &p_code)
} break;
case TK_CONSTANT: {
- Variant c = tt.get_token_constant();
+ const Variant &c = tt.get_token_constant();
if (!constant_map.has(c)) {
int idx = constant_map.size();
constant_map[c] = idx;
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 72199281ff..20b227bda1 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -2898,10 +2898,7 @@ void CSharpScript::update_exports() {
}
bool CSharpScript::has_script_signal(const StringName &p_signal) const {
- if (_signals.has(p_signal))
- return true;
-
- return false;
+ return _signals.has(p_signal);
}
void CSharpScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 64e3b40063..a2f1ec8f27 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -337,7 +337,7 @@ public:
_FORCE_INLINE_ static CSharpLanguage *get_singleton() { return singleton; }
static void release_script_gchandle(Ref<MonoGCHandle> &p_gchandle);
- static void release_script_gchandle(MonoObject *p_pinned_expected_obj, Ref<MonoGCHandle> &p_gchandle);
+ static void release_script_gchandle(MonoObject *p_expected_obj, Ref<MonoGCHandle> &p_gchandle);
bool debug_break(const String &p_error, bool p_allow_continue = true);
bool debug_break_parse(const String &p_file, int p_line, const String &p_error);
diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h
index 3d5a65f8da..b08c9090c7 100644
--- a/modules/mono/editor/csharp_project.h
+++ b/modules/mono/editor/csharp_project.h
@@ -36,7 +36,7 @@
namespace CSharpProject {
String generate_core_api_project(const String &p_dir, const Vector<String> &p_files = Vector<String>());
-String generate_editor_api_project(const String &p_dir, const String &p_core_dll_path, const Vector<String> &p_files = Vector<String>());
+String generate_editor_api_project(const String &p_dir, const String &p_core_proj_path, const Vector<String> &p_files = Vector<String>());
String generate_game_project(const String &p_dir, const String &p_name, const Vector<String> &p_files = Vector<String>());
void add_item(const String &p_project_path, const String &p_item_type, const String &p_include);
diff --git a/modules/mono/editor/godotsharp_editor.h b/modules/mono/editor/godotsharp_editor.h
index 4a28492bad..d5bd8ba126 100644
--- a/modules/mono/editor/godotsharp_editor.h
+++ b/modules/mono/editor/godotsharp_editor.h
@@ -35,7 +35,7 @@
#include "monodevelop_instance.h"
class GodotSharpEditor : public Node {
- GDCLASS(GodotSharpEditor, Object);
+ GDCLASS(GodotSharpEditor, Node);
EditorNode *editor;
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index 63bcfe053c..cb28efb4e5 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -105,8 +105,6 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
ScriptInstance *si = CSharpInstance::create_for_managed_type(unmanaged, script.ptr(), gchandle);
unmanaged->set_script_and_instance(script.get_ref_ptr(), si);
-
- return;
}
void unhandled_exception(MonoException *p_exc) {
diff --git a/modules/mono/utils/thread_local.h b/modules/mono/utils/thread_local.h
index 488cc2619a..e52b6e73ef 100644
--- a/modules/mono/utils/thread_local.h
+++ b/modules/mono/utils/thread_local.h
@@ -76,7 +76,7 @@ struct ThreadLocalStorage {
void *get_value() const;
void set_value(void *p_value) const;
- void alloc(void(_CALLBACK_FUNC_ *p_dest_callback)(void *));
+ void alloc(void(_CALLBACK_FUNC_ *p_destr_callback)(void *));
void free();
private:
diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h
index 445bf974b8..5e4a02fcee 100644
--- a/modules/opensimplex/noise_texture.h
+++ b/modules/opensimplex/noise_texture.h
@@ -77,12 +77,12 @@ public:
Ref<OpenSimplexNoise> get_noise();
void set_width(int p_width);
- void set_height(int p_hieght);
+ void set_height(int p_height);
void set_seamless(bool p_seamless);
bool get_seamless();
- void set_as_normalmap(bool p_seamless);
+ void set_as_normalmap(bool p_as_normalmap);
bool is_normalmap();
void set_bump_strength(float p_bump_strength);
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index 772092fabe..4b74c088e0 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -1130,7 +1130,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
if (next_op == -1) {
_set_error("Yet another parser bug....");
- ERR_FAIL_COND_V(next_op == -1, NULL);
+ ERR_FAIL_V(NULL);
}
// OK! create operator..
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 8fa7d2c0d4..f8cb6cfa3c 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -51,10 +51,7 @@ int VisualScriptFunctionCall::get_output_sequence_port_count() const {
bool VisualScriptFunctionCall::has_input_sequence_port() const {
- if ((method_cache.flags & METHOD_FLAG_CONST && call_mode != CALL_MODE_INSTANCE) || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function)))
- return false;
- else
- return true;
+ return !((method_cache.flags & METHOD_FLAG_CONST && call_mode != CALL_MODE_INSTANCE) || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function)));
}
#ifdef TOOLS_ENABLED
@@ -949,7 +946,7 @@ int VisualScriptPropertySet::get_output_sequence_port_count() const {
bool VisualScriptPropertySet::has_input_sequence_port() const {
- return call_mode != CALL_MODE_BASIC_TYPE ? true : false;
+ return call_mode != CALL_MODE_BASIC_TYPE;
}
Node *VisualScriptPropertySet::_get_base_node() const {
diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h
index 089bc25fe9..7fd97a6595 100644
--- a/modules/websocket/websocket_multiplayer_peer.h
+++ b/modules/websocket/websocket_multiplayer_peer.h
@@ -82,7 +82,7 @@ public:
/* NetworkedMultiplayerPeer */
void set_transfer_mode(TransferMode p_mode);
TransferMode get_transfer_mode() const;
- void set_target_peer(int p_peer_id);
+ void set_target_peer(int p_target_peer);
int get_packet_peer() const;
int get_unique_id() const;
virtual bool is_server() const = 0;
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index 21c3b0ac91..e6328ee14d 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -101,7 +101,6 @@ void JoypadLinux::joy_thread_func(void *p_user) {
JoypadLinux *joy = (JoypadLinux *)p_user;
joy->run_joypad_thread();
}
- return;
}
void JoypadLinux::run_joypad_thread() {
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 6421dc270f..bf6bc0b464 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -146,7 +146,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
if (is_stdout_verbose()) {
WARN_PRINT("IME is disabled");
}
- modifiers = XSetLocaleModifiers("@im=none");
+ XSetLocaleModifiers("@im=none");
WARN_PRINT("Error setting locale modifiers");
}
@@ -1032,9 +1032,7 @@ void OS_X11::set_wm_fullscreen(bool p_enabled) {
}
XSetWMNormalHints(x11_display, x11_window, xsh);
XFree(xsh);
- }
- if (!p_enabled) {
// put back or remove decorations according to the last set borderless state
Hints hints;
Atom property;
@@ -1201,7 +1199,7 @@ Point2 OS_X11::get_window_position() const {
void OS_X11::set_window_position(const Point2 &p_position) {
int x = 0;
int y = 0;
- if (get_borderless_window() == false) {
+ if (!get_borderless_window()) {
//exclude window decorations
XSync(x11_display, False);
Atom prop = XInternAtom(x11_display, "_NET_FRAME_EXTENTS", True);
@@ -3051,8 +3049,6 @@ void OS_X11::alert(const String &p_alert, const String &p_title) {
} else {
print_line(p_alert);
}
-
- return;
}
bool g_set_icon_error = false;
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 50da6a4967..758bd84114 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -202,7 +202,10 @@ void PowerX11::check_proc_acpi_battery(const char *node, bool *have_battery, boo
* We pick the battery that claims to have the most minutes left.
* (failing a report of minutes, we'll take the highest percent.)
*/
- if ((secs < 0) && (this->nsecs_left < 0)) {
+ // -- GODOT start --
+ //if ((secs < 0) && (this->nsecs_left < 0)) {
+ if (this->nsecs_left < 0) {
+ // -- GODOT end --
if ((pct < 0) && (this->percent_left < 0)) {
choose = true; /* at least we know there's a battery. */
}
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 5bf70e12b7..b7ace804ef 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -69,10 +69,7 @@ bool AnimatedSprite::_edit_use_rect() const {
Ref<Texture> t;
if (animation)
t = frames->get_frame(animation, frame);
- if (t.is_null())
- return false;
-
- return true;
+ return t.is_valid();
}
Rect2 AnimatedSprite::get_anchorable_rect() const {
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 73f583111b..932af469d0 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -457,8 +457,8 @@ void AudioStreamPlayer2D::set_stream_paused(bool p_pause) {
if (p_pause != stream_paused) {
stream_paused = p_pause;
- stream_paused_fade_in = p_pause ? false : true;
- stream_paused_fade_out = p_pause ? true : false;
+ stream_paused_fade_in = !p_pause;
+ stream_paused_fade_out = p_pause;
}
}
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 1f585d84ce..2604eb04e4 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -143,7 +143,7 @@ public:
void set_particles_anim_v_frames(int p_frames);
int get_particles_anim_v_frames() const;
- void set_particles_anim_loop(bool p_frames);
+ void set_particles_anim_loop(bool p_loop);
bool get_particles_anim_loop() const;
static void init_shaders();
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index 6c83abb311..813f5ddc6e 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -252,7 +252,7 @@ public:
void set_color(const Color &p_color);
Color get_color() const;
- void set_color_ramp(const Ref<Gradient> &p_texture);
+ void set_color_ramp(const Ref<Gradient> &p_ramp);
Ref<Gradient> get_color_ramp() const;
void set_particle_flag(Flags p_flag, bool p_enable);
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index 5ba184b324..4488dc501c 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -38,8 +38,7 @@ VARIANT_ENUM_CAST(Line2D::LineJointMode)
VARIANT_ENUM_CAST(Line2D::LineCapMode)
VARIANT_ENUM_CAST(Line2D::LineTextureMode)
-Line2D::Line2D() :
- Node2D() {
+Line2D::Line2D() {
_joint_mode = LINE_JOINT_SHARP;
_begin_cap_mode = LINE_CAP_NONE;
_end_cap_mode = LINE_CAP_NONE;
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index 89dd1e5341..66e5ce250f 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -157,8 +157,8 @@ private:
bool operator<(const ShapePair &p_sp) const {
if (body_shape == p_sp.body_shape)
return local_shape < p_sp.local_shape;
- else
- return body_shape < p_sp.body_shape;
+
+ return body_shape < p_sp.body_shape;
}
ShapePair() {}
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp
index a8c7622828..6626fccf1c 100644
--- a/scene/2d/sprite.cpp
+++ b/scene/2d/sprite.cpp
@@ -63,10 +63,7 @@ Rect2 Sprite::_edit_get_rect() const {
}
bool Sprite::_edit_use_rect() const {
- if (texture.is_null())
- return false;
-
- return true;
+ return texture.is_valid();
}
Rect2 Sprite::get_anchorable_rect() const {
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index ff8c218575..ff28f60d4f 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -93,7 +93,7 @@ void AudioStreamPlayer3D::_mix_audio() {
}
bool interpolate_filter = !started;
- ;
+
if (!found) {
//create new if was not used before
if (prev_output_count < MAX_OUTPUTS) {
@@ -872,8 +872,8 @@ void AudioStreamPlayer3D::set_stream_paused(bool p_pause) {
if (p_pause != stream_paused) {
stream_paused = p_pause;
- stream_paused_fade_in = stream_paused ? false : true;
- stream_paused_fade_out = stream_paused ? true : false;
+ stream_paused_fade_in = !stream_paused;
+ stream_paused_fade_out = stream_paused;
}
}
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index c0a4f77435..6460f17e85 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -113,7 +113,7 @@ public:
void set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far);
void set_orthogonal(float p_size, float p_z_near, float p_z_far);
- void set_frustum(float p_size, Vector2 p_offset, float p_near, float p_far);
+ void set_frustum(float p_size, Vector2 p_offset, float p_z_near, float p_z_far);
void set_projection(Camera::Projection p_mode);
void make_current();
diff --git a/scene/3d/cpu_particles.h b/scene/3d/cpu_particles.h
index 6f267102fa..6566792def 100644
--- a/scene/3d/cpu_particles.h
+++ b/scene/3d/cpu_particles.h
@@ -249,7 +249,7 @@ public:
void set_color(const Color &p_color);
Color get_color() const;
- void set_color_ramp(const Ref<Gradient> &p_texture);
+ void set_color_ramp(const Ref<Gradient> &p_ramp);
Ref<Gradient> get_color_ramp() const;
void set_particle_flag(Flags p_flag, bool p_enable);
diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp
index 909d4fda34..a9d96292a1 100644
--- a/scene/3d/soft_body.cpp
+++ b/scene/3d/soft_body.cpp
@@ -699,7 +699,6 @@ bool SoftBody::is_ray_pickable() const {
}
SoftBody::SoftBody() :
- MeshInstance(),
physics_rid(PhysicsServer::get_singleton()->soft_body_create()),
mesh_owner(false),
collision_mask(1),
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index 32b8219ee0..71136fc0f6 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -723,7 +723,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
real_t rollingFriction = 0.f;
if (wheelInfo.m_raycastInfo.m_isInContact) {
- if (engine_force != 0.f && wheelInfo.engine_traction != false) {
+ if (engine_force != 0.f && wheelInfo.engine_traction) {
rollingFriction = -engine_force * s->get_step();
} else {
real_t defaultRollingFrictionImpulse = 0.f;
@@ -928,8 +928,7 @@ void VehicleBody::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering");
}
-VehicleBody::VehicleBody() :
- RigidBody() {
+VehicleBody::VehicleBody() {
m_pitchControl = 0;
m_currentVehicleSpeedKmHour = real_t(0.);
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index 75b419ca58..5fa8c43f9f 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -212,9 +212,7 @@ static bool fast_tri_box_overlap(const Vector3 &boxcenter, const Vector3 boxhalf
/* compute plane equation of triangle: normal*x+d=0 */
normal = e0.cross(e1);
d = -normal.dot(v0); /* plane eq: normal.x+d=0 */
- if (!planeBoxOverlap(normal, d, boxhalfsize)) return false;
-
- return true; /* box and triangle overlaps */
+ return planeBoxOverlap(normal, d, boxhalfsize); /* if true, box and triangle overlaps */
}
static _FORCE_INLINE_ void get_uv_and_normal(const Vector3 &p_pos, const Vector3 *p_vtx, const Vector2 *p_uv, const Vector3 *p_normal, Vector2 &r_uv, Vector3 &r_normal) {
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index a2411743d4..f1ce948c43 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -178,11 +178,11 @@ float AnimationNodeStateMachinePlayback::get_current_length() const {
return len_current;
}
-bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *sm, const StringName &p_travel) {
+bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_state_machine, const StringName &p_travel) {
ERR_FAIL_COND_V(!playing, false);
- ERR_FAIL_COND_V(!sm->states.has(p_travel), false);
- ERR_FAIL_COND_V(!sm->states.has(current), false);
+ ERR_FAIL_COND_V(!p_state_machine->states.has(p_travel), false);
+ ERR_FAIL_COND_V(!p_state_machine->states.has(current), false);
path.clear(); //a new one will be needed
@@ -191,25 +191,25 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *sm, c
loops_current = 0; // reset loops, so fade does not happen immediately
- Vector2 current_pos = sm->states[current].position;
- Vector2 target_pos = sm->states[p_travel].position;
+ Vector2 current_pos = p_state_machine->states[current].position;
+ Vector2 target_pos = p_state_machine->states[p_travel].position;
Map<StringName, AStarCost> cost_map;
List<int> open_list;
//build open list
- for (int i = 0; i < sm->transitions.size(); i++) {
- if (sm->transitions[i].from == current) {
+ for (int i = 0; i < p_state_machine->transitions.size(); i++) {
+ if (p_state_machine->transitions[i].from == current) {
open_list.push_back(i);
- float cost = sm->states[sm->transitions[i].to].position.distance_to(current_pos);
- cost *= sm->transitions[i].transition->get_priority();
+ float cost = p_state_machine->states[p_state_machine->transitions[i].to].position.distance_to(current_pos);
+ cost *= p_state_machine->transitions[i].transition->get_priority();
AStarCost ap;
ap.prev = current;
ap.distance = cost;
- cost_map[sm->transitions[i].to] = ap;
+ cost_map[p_state_machine->transitions[i].to] = ap;
- if (sm->transitions[i].to == p_travel) { //prematurely found it! :D
+ if (p_state_machine->transitions[i].to == p_travel) { //prematurely found it! :D
path.push_back(p_travel);
return true;
}
@@ -230,42 +230,42 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *sm, c
for (List<int>::Element *E = open_list.front(); E; E = E->next()) {
- float cost = cost_map[sm->transitions[E->get()].to].distance;
- cost += sm->states[sm->transitions[E->get()].to].position.distance_to(target_pos);
+ float cost = cost_map[p_state_machine->transitions[E->get()].to].distance;
+ cost += p_state_machine->states[p_state_machine->transitions[E->get()].to].position.distance_to(target_pos);
if (cost < least_cost) {
least_cost_transition = E;
}
}
- StringName transition_prev = sm->transitions[least_cost_transition->get()].from;
- StringName transition = sm->transitions[least_cost_transition->get()].to;
+ StringName transition_prev = p_state_machine->transitions[least_cost_transition->get()].from;
+ StringName transition = p_state_machine->transitions[least_cost_transition->get()].to;
- for (int i = 0; i < sm->transitions.size(); i++) {
- if (sm->transitions[i].from != transition || sm->transitions[i].to == transition_prev) {
+ for (int i = 0; i < p_state_machine->transitions.size(); i++) {
+ if (p_state_machine->transitions[i].from != transition || p_state_machine->transitions[i].to == transition_prev) {
continue; //not interested on those
}
- float distance = sm->states[sm->transitions[i].from].position.distance_to(sm->states[sm->transitions[i].to].position);
- distance *= sm->transitions[i].transition->get_priority();
- distance += cost_map[sm->transitions[i].from].distance;
+ float distance = p_state_machine->states[p_state_machine->transitions[i].from].position.distance_to(p_state_machine->states[p_state_machine->transitions[i].to].position);
+ distance *= p_state_machine->transitions[i].transition->get_priority();
+ distance += cost_map[p_state_machine->transitions[i].from].distance;
- if (cost_map.has(sm->transitions[i].to)) {
+ if (cost_map.has(p_state_machine->transitions[i].to)) {
//oh this was visited already, can we win the cost?
- if (distance < cost_map[sm->transitions[i].to].distance) {
- cost_map[sm->transitions[i].to].distance = distance;
- cost_map[sm->transitions[i].to].prev = sm->transitions[i].from;
+ if (distance < cost_map[p_state_machine->transitions[i].to].distance) {
+ cost_map[p_state_machine->transitions[i].to].distance = distance;
+ cost_map[p_state_machine->transitions[i].to].prev = p_state_machine->transitions[i].from;
}
} else {
//add to open list
AStarCost ac;
- ac.prev = sm->transitions[i].from;
+ ac.prev = p_state_machine->transitions[i].from;
ac.distance = distance;
- cost_map[sm->transitions[i].to] = ac;
+ cost_map[p_state_machine->transitions[i].to] = ac;
open_list.push_back(i);
- if (sm->transitions[i].to == p_travel) {
+ if (p_state_machine->transitions[i].to == p_travel) {
found_route = true;
break;
}
@@ -291,12 +291,12 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *sm, c
return true;
}
-float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm, float p_time, bool p_seek) {
+float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_state_machine, float p_time, bool p_seek) {
//if not playing and it can restart, then restart
if (!playing && start_request == StringName()) {
- if (!stop_request && sm->start_node) {
- start(sm->start_node);
+ if (!stop_request && p_state_machine->start_node) {
+ start(p_state_machine->start_node);
} else {
return 0;
}
@@ -320,7 +320,7 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
ERR_FAIL_V(0);
}
- if (!_travel(sm, start_request)) {
+ if (!_travel(p_state_machine, start_request)) {
//can't travel, then teleport
path.clear();
current = start_request;
@@ -339,16 +339,16 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
if (do_start) {
- if (sm->start_node != StringName() && p_seek && p_time == 0) {
- current = sm->start_node;
+ if (p_state_machine->start_node != StringName() && p_seek && p_time == 0) {
+ current = p_state_machine->start_node;
}
- len_current = sm->blend_node(current, sm->states[current].node, 0, true, 1.0, AnimationNode::FILTER_IGNORE, false);
+ len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, 1.0, AnimationNode::FILTER_IGNORE, false);
pos_current = 0;
loops_current = 0;
}
- if (!sm->states.has(current)) {
+ if (!p_state_machine->states.has(current)) {
playing = false; //current does not exist
current = StringName();
return 0;
@@ -357,7 +357,7 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
if (fading_from != StringName()) {
- if (!sm->states.has(fading_from)) {
+ if (!p_state_machine->states.has(fading_from)) {
fading_from = StringName();
} else {
if (!p_seek) {
@@ -370,11 +370,11 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
}
}
- float rem = sm->blend_node(current, sm->states[current].node, p_time, p_seek, fade_blend, AnimationNode::FILTER_IGNORE, false);
+ float rem = p_state_machine->blend_node(current, p_state_machine->states[current].node, p_time, p_seek, fade_blend, AnimationNode::FILTER_IGNORE, false);
if (fading_from != StringName()) {
- sm->blend_node(fading_from, sm->states[fading_from].node, p_time, p_seek, 1.0 - fade_blend, AnimationNode::FILTER_IGNORE, false);
+ p_state_machine->blend_node(fading_from, p_state_machine->states[fading_from].node, p_time, p_seek, 1.0 - fade_blend, AnimationNode::FILTER_IGNORE, false);
}
//guess playback position
@@ -399,40 +399,40 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
if (path.size()) {
- for (int i = 0; i < sm->transitions.size(); i++) {
- if (sm->transitions[i].from == current && sm->transitions[i].to == path[0]) {
- next_xfade = sm->transitions[i].transition->get_xfade_time();
- switch_mode = sm->transitions[i].transition->get_switch_mode();
+ for (int i = 0; i < p_state_machine->transitions.size(); i++) {
+ if (p_state_machine->transitions[i].from == current && p_state_machine->transitions[i].to == path[0]) {
+ next_xfade = p_state_machine->transitions[i].transition->get_xfade_time();
+ switch_mode = p_state_machine->transitions[i].transition->get_switch_mode();
next = path[0];
}
}
} else {
float priority_best = 1e20;
int auto_advance_to = -1;
- for (int i = 0; i < sm->transitions.size(); i++) {
+ for (int i = 0; i < p_state_machine->transitions.size(); i++) {
bool auto_advance = false;
- if (sm->transitions[i].transition->has_auto_advance()) {
+ if (p_state_machine->transitions[i].transition->has_auto_advance()) {
auto_advance = true;
}
- StringName advance_condition_name = sm->transitions[i].transition->get_advance_condition_name();
- if (advance_condition_name != StringName() && bool(sm->get_parameter(advance_condition_name))) {
+ StringName advance_condition_name = p_state_machine->transitions[i].transition->get_advance_condition_name();
+ if (advance_condition_name != StringName() && bool(p_state_machine->get_parameter(advance_condition_name))) {
auto_advance = true;
}
- if (sm->transitions[i].from == current && auto_advance) {
+ if (p_state_machine->transitions[i].from == current && auto_advance) {
- if (sm->transitions[i].transition->get_priority() <= priority_best) {
- priority_best = sm->transitions[i].transition->get_priority();
+ if (p_state_machine->transitions[i].transition->get_priority() <= priority_best) {
+ priority_best = p_state_machine->transitions[i].transition->get_priority();
auto_advance_to = i;
}
}
}
if (auto_advance_to != -1) {
- next = sm->transitions[auto_advance_to].to;
- next_xfade = sm->transitions[auto_advance_to].transition->get_xfade_time();
- switch_mode = sm->transitions[auto_advance_to].transition->get_switch_mode();
+ next = p_state_machine->transitions[auto_advance_to].to;
+ next_xfade = p_state_machine->transitions[auto_advance_to].transition->get_xfade_time();
+ switch_mode = p_state_machine->transitions[auto_advance_to].transition->get_switch_mode();
}
}
@@ -467,12 +467,12 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
}
current = next;
if (switch_mode == AnimationNodeStateMachineTransition::SWITCH_MODE_SYNC) {
- len_current = sm->blend_node(current, sm->states[current].node, 0, true, 0, AnimationNode::FILTER_IGNORE, false);
+ len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, 0, AnimationNode::FILTER_IGNORE, false);
pos_current = MIN(pos_current, len_current);
- sm->blend_node(current, sm->states[current].node, pos_current, true, 0, AnimationNode::FILTER_IGNORE, false);
+ p_state_machine->blend_node(current, p_state_machine->states[current].node, pos_current, true, 0, AnimationNode::FILTER_IGNORE, false);
} else {
- len_current = sm->blend_node(current, sm->states[current].node, 0, true, 0, AnimationNode::FILTER_IGNORE, false);
+ len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, 0, AnimationNode::FILTER_IGNORE, false);
pos_current = 0;
}
@@ -482,9 +482,9 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
}
//compute time left for transitions by using the end node
- if (sm->end_node != StringName() && sm->end_node != current) {
+ if (p_state_machine->end_node != StringName() && p_state_machine->end_node != current) {
- rem = sm->blend_node(sm->end_node, sm->states[sm->end_node].node, 0, true, 0, AnimationNode::FILTER_IGNORE, false);
+ rem = p_state_machine->blend_node(p_state_machine->end_node, p_state_machine->states[p_state_machine->end_node].node, 0, true, 0, AnimationNode::FILTER_IGNORE, false);
}
return rem;
diff --git a/scene/animation/root_motion_view.h b/scene/animation/root_motion_view.h
index 07f51165a7..b30b06229e 100644
--- a/scene/animation/root_motion_view.h
+++ b/scene/animation/root_motion_view.h
@@ -56,7 +56,7 @@ public:
void set_animation_path(const NodePath &p_path);
NodePath get_animation_path() const;
- void set_color(const Color &p_path);
+ void set_color(const Color &p_color);
Color get_color() const;
void set_cell_size(float p_size);
diff --git a/scene/animation/skeleton_ik.cpp b/scene/animation/skeleton_ik.cpp
index 06d6806f03..43c4b2aa51 100644
--- a/scene/animation/skeleton_ik.cpp
+++ b/scene/animation/skeleton_ik.cpp
@@ -423,7 +423,6 @@ void SkeletonIK::_notification(int p_what) {
}
SkeletonIK::SkeletonIK() :
- Node(),
interpolation(1),
override_tip_basis(true),
use_magnet(false),
diff --git a/scene/animation/skeleton_ik.h b/scene/animation/skeleton_ik.h
index 5d48b7be33..d2c5f56ace 100644
--- a/scene/animation/skeleton_ik.h
+++ b/scene/animation/skeleton_ik.h
@@ -165,7 +165,7 @@ protected:
_validate_property(PropertyInfo &property) const;
static void _bind_methods();
- virtual void _notification(int p_notification);
+ virtual void _notification(int p_what);
public:
SkeletonIK();
@@ -192,7 +192,7 @@ public:
void set_use_magnet(bool p_use);
bool is_using_magnet() const;
- void set_magnet_position(const Vector3 &p_constraint);
+ void set_magnet_position(const Vector3 &p_local_position);
const Vector3 &get_magnet_position() const;
void set_min_distance(real_t p_min_distance);
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index c70e58564f..4dee4e1d12 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -583,9 +583,7 @@ bool Tween::_apply_tween_value(InterpolateData &p_data, Variant &value) {
}
// Did we get an error from the function call?
- if (error.error == Variant::CallError::CALL_OK)
- return true;
- return false;
+ return error.error == Variant::CallError::CALL_OK;
}
case INTER_CALLBACK:
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 2def9fe8fc..c053fceb74 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -339,7 +339,7 @@ void AudioStreamPlayer::set_stream_paused(bool p_pause) {
if (p_pause != stream_paused) {
stream_paused = p_pause;
- stream_paused_fade = p_pause ? true : false;
+ stream_paused_fade = p_pause;
}
}
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index cc37d4cf7d..b7d2131ee9 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -91,7 +91,6 @@ void BoxContainer::_resort() {
int stretch_diff = stretch_max - stretch_min;
if (stretch_diff < 0) {
//avoid negative stretch space
- stretch_max = stretch_min;
stretch_diff = 0;
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 0845b56828..6e0e26312f 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1042,55 +1042,37 @@ int Control::get_constant(const StringName &p_name, const StringName &p_type) co
bool Control::has_icon_override(const StringName &p_name) const {
const Ref<Texture> *tex = data.icon_override.getptr(p_name);
- if (tex)
- return true;
- else
- return false;
+ return tex != NULL;
}
bool Control::has_shader_override(const StringName &p_name) const {
const Ref<Shader> *sdr = data.shader_override.getptr(p_name);
- if (sdr)
- return true;
- else
- return false;
+ return sdr != NULL;
}
bool Control::has_stylebox_override(const StringName &p_name) const {
const Ref<StyleBox> *style = data.style_override.getptr(p_name);
- if (style)
- return true;
- else
- return false;
+ return style != NULL;
}
bool Control::has_font_override(const StringName &p_name) const {
const Ref<Font> *font = data.font_override.getptr(p_name);
- if (font)
- return true;
- else
- return false;
+ return font != NULL;
}
bool Control::has_color_override(const StringName &p_name) const {
const Color *color = data.color_override.getptr(p_name);
- if (color)
- return true;
- else
- return false;
+ return color != NULL;
}
bool Control::has_constant_override(const StringName &p_name) const {
const int *constant = data.constant_override.getptr(p_name);
- if (constant)
- return true;
- else
- return false;
+ return constant != NULL;
}
bool Control::has_icon(const StringName &p_name, const StringName &p_type) const {
@@ -1997,10 +1979,7 @@ Control *Control::find_next_valid_focus() const {
break;
}
- if (next_child) {
-
- from = next_child;
- } else {
+ if (!next_child) {
next_child = _next_control(from);
if (!next_child) { //nothing else.. go up and find either window or subwindow
diff --git a/scene/gui/control.h b/scene/gui/control.h
index a6f9a442ae..2489a5eda4 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -139,8 +139,8 @@ private:
bool operator()(const Control *p_a, const Control *p_b) const {
if (p_a->get_canvas_layer() == p_b->get_canvas_layer())
return p_b->is_greater_than(p_a);
- else
- return p_a->get_canvas_layer() < p_b->get_canvas_layer();
+
+ return p_a->get_canvas_layer() < p_b->get_canvas_layer();
}
};
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index bc8dcf0e82..ba4d390fc5 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -302,11 +302,8 @@ bool FileDialog::_is_open_should_be_disabled() {
Dictionary d = ti->get_metadata(0);
// Opening a file, but selected a folder? Forbidden.
- if (((mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES) && d["dir"]) || // Flipped case, also forbidden.
- (mode == MODE_OPEN_DIR && !d["dir"]))
- return true;
-
- return false;
+ return ((mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES) && d["dir"]) || // Flipped case, also forbidden.
+ (mode == MODE_OPEN_DIR && !d["dir"]);
}
void FileDialog::_go_up() {
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index e3e9368a12..e18387a52e 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -470,7 +470,6 @@ void Label::regenerate_word_cache() {
wc->word_len = i - word_pos;
wc->space_count = space_count;
current_word_size = char_width;
- space_count = 0;
word_pos = i;
}
}
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index da6bff8ab8..cd3c8c0097 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -623,10 +623,7 @@ bool LineEdit::_is_over_clear_button(const Point2 &p_pos) const {
}
Ref<Texture> icon = Control::get_icon("clear");
int x_ofs = get_stylebox("normal")->get_offset().x;
- if (p_pos.x > get_size().width - icon->get_width() - x_ofs) {
- return true;
- }
- return false;
+ return p_pos.x > get_size().width - icon->get_width() - x_ofs;
}
void LineEdit::_notification(int p_what) {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 8891f679ee..134bcc91a8 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -447,14 +447,13 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
if (p_font_color_shadow.a > 0) {
float x_ofs_shadow = align_ofs + pofs;
float y_ofs_shadow = y + lh - line_descent;
- float move = font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + shadow_ofs, c[i], c[i + 1], p_font_color_shadow);
+ font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + shadow_ofs, c[i], c[i + 1], p_font_color_shadow);
if (p_shadow_as_outline) {
font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + Vector2(-shadow_ofs.x, shadow_ofs.y), c[i], c[i + 1], p_font_color_shadow);
font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + Vector2(shadow_ofs.x, -shadow_ofs.y), c[i], c[i + 1], p_font_color_shadow);
font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + Vector2(-shadow_ofs.x, -shadow_ofs.y), c[i], c[i + 1], p_font_color_shadow);
}
- x_ofs_shadow += move;
}
if (selected) {
@@ -935,84 +934,80 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
return;
if (b->get_button_index() == BUTTON_LEFT) {
+ if (b->is_pressed() && !b->is_doubleclick()) {
+ scroll_updated = false;
+ int line = 0;
+ Item *item = NULL;
- if (true) {
+ bool outside;
+ _find_click(main, b->get_position(), &item, &line, &outside);
- if (b->is_pressed() && !b->is_doubleclick()) {
- scroll_updated = false;
- int line = 0;
- Item *item = NULL;
-
- bool outside;
- _find_click(main, b->get_position(), &item, &line, &outside);
-
- if (item) {
+ if (item) {
- if (selection.enabled) {
+ if (selection.enabled) {
- selection.click = item;
- selection.click_char = line;
+ selection.click = item;
+ selection.click_char = line;
- // Erase previous selection.
- if (selection.active) {
- selection.from = NULL;
- selection.from_char = '\0';
- selection.to = NULL;
- selection.to_char = '\0';
- selection.active = false;
+ // Erase previous selection.
+ if (selection.active) {
+ selection.from = NULL;
+ selection.from_char = '\0';
+ selection.to = NULL;
+ selection.to_char = '\0';
+ selection.active = false;
- update();
- }
+ update();
}
}
- } else if (b->is_pressed() && b->is_doubleclick() && selection.enabled) {
+ }
+ } else if (b->is_pressed() && b->is_doubleclick() && selection.enabled) {
- //doubleclick: select word
- int line = 0;
- Item *item = NULL;
- bool outside;
+ //doubleclick: select word
+ int line = 0;
+ Item *item = NULL;
+ bool outside;
- _find_click(main, b->get_position(), &item, &line, &outside);
+ _find_click(main, b->get_position(), &item, &line, &outside);
- while (item && item->type != ITEM_TEXT) {
+ while (item && item->type != ITEM_TEXT) {
- item = _get_next_item(item, true);
- }
+ item = _get_next_item(item, true);
+ }
- if (item && item->type == ITEM_TEXT) {
+ if (item && item->type == ITEM_TEXT) {
- String itext = static_cast<ItemText *>(item)->text;
+ String itext = static_cast<ItemText *>(item)->text;
- int beg, end;
- if (select_word(itext, line, beg, end)) {
+ int beg, end;
+ if (select_word(itext, line, beg, end)) {
- selection.from = item;
- selection.to = item;
- selection.from_char = beg;
- selection.to_char = end - 1;
- selection.active = true;
- update();
- }
+ selection.from = item;
+ selection.to = item;
+ selection.from_char = beg;
+ selection.to_char = end - 1;
+ selection.active = true;
+ update();
}
- } else if (!b->is_pressed()) {
+ }
+ } else if (!b->is_pressed()) {
- selection.click = NULL;
+ selection.click = NULL;
- if (!b->is_doubleclick() && !scroll_updated) {
- int line = 0;
- Item *item = NULL;
+ if (!b->is_doubleclick() && !scroll_updated) {
+ int line = 0;
+ Item *item = NULL;
- bool outside;
- _find_click(main, b->get_position(), &item, &line, &outside);
+ bool outside;
+ _find_click(main, b->get_position(), &item, &line, &outside);
- if (item) {
+ if (item) {
- Variant meta;
- if (!outside && _find_meta(item, &meta)) {
- //meta clicked
+ Variant meta;
+ if (!outside && _find_meta(item, &meta)) {
+ //meta clicked
- emit_signal("meta_clicked", meta);
- }
+ emit_signal("meta_clicked", meta);
}
}
}
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index a1034937b5..d83ae47671 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -140,19 +140,17 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
_cancel_drag();
}
- if (true) {
- drag_speed = Vector2();
- drag_accum = Vector2();
- last_drag_accum = Vector2();
- drag_from = Vector2(h_scroll->get_value(), v_scroll->get_value());
- drag_touching = OS::get_singleton()->has_touchscreen_ui_hint();
- drag_touching_deaccel = false;
- beyond_deadzone = false;
+ drag_speed = Vector2();
+ drag_accum = Vector2();
+ last_drag_accum = Vector2();
+ drag_from = Vector2(h_scroll->get_value(), v_scroll->get_value());
+ drag_touching = OS::get_singleton()->has_touchscreen_ui_hint();
+ drag_touching_deaccel = false;
+ beyond_deadzone = false;
+ time_since_motion = 0;
+ if (drag_touching) {
+ set_physics_process_internal(true);
time_since_motion = 0;
- if (drag_touching) {
- set_physics_process_internal(true);
- time_since_motion = 0;
- }
}
} else {
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 36d7dad1d3..62b6a917fc 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1603,7 +1603,6 @@ void TextEdit::_consume_pair_symbol(CharType ch) {
insert_text_at_cursor(ch_pair);
cursor_set_column(cursor_position_to_move);
- return;
}
void TextEdit::_consume_backspace_for_pair_symbol(int prev_line, int prev_column) {
@@ -5404,11 +5403,7 @@ bool TextEdit::is_line_comment(int p_line) const {
for (int i = 0; i < line_length - 1; i++) {
if (_is_symbol(text[p_line][i]) && cri_map.has(i)) {
const Text::ColorRegionInfo &cri = cri_map[i];
- if (color_regions[cri.region].begin_key == "#" || color_regions[cri.region].begin_key == "//") {
- return true;
- } else {
- return false;
- }
+ return color_regions[cri.region].begin_key == "#" || color_regions[cri.region].begin_key == "//";
} else if (_is_whitespace(text[p_line][i])) {
continue;
} else {
@@ -5457,9 +5452,7 @@ bool TextEdit::is_folded(int p_line) const {
ERR_FAIL_INDEX_V(p_line, text.size(), false);
if (p_line + 1 >= text.size())
return false;
- if (!is_line_hidden(p_line) && is_line_hidden(p_line + 1))
- return true;
- return false;
+ return !is_line_hidden(p_line) && is_line_hidden(p_line + 1);
}
Vector<int> TextEdit::get_folded_lines() const {
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 54370d02ba..924c480b15 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1929,8 +1929,6 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
edited_col = col;
bool on_arrow = x > col_width - cache.select_arrow->get_width();
- bring_up_editor = false;
-
custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h));
if (on_arrow || !p_item->cells[col].custom_button) {
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index ee23b24b3c..715151b4f5 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1393,7 +1393,7 @@ Node *Node::get_node(const NodePath &p_path) const {
Node *node = get_node_or_null(p_path);
if (!node) {
ERR_EXPLAIN("Node not found: " + p_path);
- ERR_FAIL_COND_V(!node, NULL);
+ ERR_FAIL_V(NULL);
}
return node;
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 10e5ad78e2..dcd70a1844 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -532,7 +532,7 @@ void Viewport::_notification(int p_what) {
Map<ObjectID, uint64_t>::Element *F = physics_2d_mouseover.find(res[i].collider_id);
if (!F) {
- F = physics_2d_mouseover.insert(res[i].collider_id, frame);
+ physics_2d_mouseover.insert(res[i].collider_id, frame);
co->_mouse_enter();
} else {
F->get() = frame;
diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp
index 5d8adc0c8d..99a17fb5b9 100644
--- a/scene/resources/multimesh.cpp
+++ b/scene/resources/multimesh.cpp
@@ -35,7 +35,7 @@ void MultiMesh::_set_transform_array(const PoolVector<Vector3> &p_array) {
if (transform_format != TRANSFORM_3D)
return;
- PoolVector<Vector3> xforms = p_array;
+ const PoolVector<Vector3> &xforms = p_array;
int len = xforms.size();
ERR_FAIL_COND((len / 4) != instance_count);
if (len == 0)
@@ -85,7 +85,7 @@ void MultiMesh::_set_transform_2d_array(const PoolVector<Vector2> &p_array) {
if (transform_format != TRANSFORM_2D)
return;
- PoolVector<Vector2> xforms = p_array;
+ const PoolVector<Vector2> &xforms = p_array;
int len = xforms.size();
ERR_FAIL_COND((len / 3) != instance_count);
if (len == 0)
@@ -130,7 +130,7 @@ PoolVector<Vector2> MultiMesh::_get_transform_2d_array() const {
void MultiMesh::_set_color_array(const PoolVector<Color> &p_array) {
- PoolVector<Color> colors = p_array;
+ const PoolVector<Color> &colors = p_array;
int len = colors.size();
if (len == 0)
return;
@@ -162,7 +162,7 @@ PoolVector<Color> MultiMesh::_get_color_array() const {
void MultiMesh::_set_custom_data_array(const PoolVector<Color> &p_array) {
- PoolVector<Color> custom_datas = p_array;
+ const PoolVector<Color> &custom_datas = p_array;
int len = custom_datas.size();
if (len == 0)
return;
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 04d13c8869..74a493d3b5 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -743,8 +743,6 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const {
int i, j, prevrow, thisrow, point;
float x, y, z, u, v, radius;
- radius = bottom_radius > top_radius ? bottom_radius : top_radius;
-
PoolVector<Vector3> points;
PoolVector<Vector3> normals;
PoolVector<float> tangents;
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index efc1082a6b..339f008a3d 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1324,7 +1324,7 @@ Error ResourceFormatLoaderText::convert_file_to_binary(const String &p_src_path,
ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN);
Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText);
- String path = p_src_path;
+ const String &path = p_src_path;
ria->local_path = ProjectSettings::get_singleton()->localize_path(path);
ria->res_path = ria->local_path;
//ria->set_local_path( ProjectSettings::get_singleton()->localize_path(p_path) );
@@ -1441,7 +1441,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant,
int len = varray.size();
for (int i = 0; i < len; i++) {
- Variant v = varray.get(i);
+ const Variant &v = varray.get(i);
_find_resources(v);
}
diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h
index df753276e4..ef64b50711 100644
--- a/scene/resources/visual_shader_nodes.h
+++ b/scene/resources/visual_shader_nodes.h
@@ -699,7 +699,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
- void set_function(Function p_op);
+ void set_function(Function p_func);
Function get_function() const;
virtual Vector<StringName> get_editable_properties() const;
@@ -740,7 +740,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
- void set_function(Function p_op);
+ void set_function(Function p_func);
Function get_function() const;
virtual Vector<StringName> get_editable_properties() const;
@@ -895,7 +895,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
- void set_function(Function p_op);
+ void set_function(Function p_func);
Function get_function() const;
virtual Vector<StringName> get_editable_properties() const;
@@ -935,7 +935,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
- void set_function(Function p_op);
+ void set_function(Function p_func);
Function get_function() const;
virtual Vector<StringName> get_editable_properties() const;
diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp
index 392938a2be..ca033f6079 100644
--- a/servers/audio/audio_filter_sw.cpp
+++ b/servers/audio/audio_filter_sw.cpp
@@ -154,7 +154,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) {
double tmpq = Math::sqrt(Q);
if (tmpq <= 0)
tmpq = 0.001;
- alpha = sin_v / (2 * tmpq);
double beta = Math::sqrt(tmpgain) / tmpq;
a0 = (tmpgain + 1.0) + (tmpgain - 1.0) * cos_v + beta * sin_v;
@@ -169,7 +168,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) {
double tmpq = Math::sqrt(Q);
if (tmpq <= 0)
tmpq = 0.001;
- alpha = sin_v / (2 * tmpq);
double beta = Math::sqrt(tmpgain) / tmpq;
a0 = (tmpgain + 1.0) - (tmpgain - 1.0) * cos_v + beta * sin_v;
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 1a6430c499..388346b67c 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -223,7 +223,7 @@ float AudioStreamPlaybackMicrophone::get_playback_position() const {
}
void AudioStreamPlaybackMicrophone::seek(float p_time) {
- return; // Can't seek a microphone input
+ // Can't seek a microphone input
}
AudioStreamPlaybackMicrophone::~AudioStreamPlaybackMicrophone() {
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 8f023c0401..ef9f8ea92a 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -119,7 +119,7 @@ public:
class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
- GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback);
+ GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlaybackResampled);
friend class AudioStreamMicrophone;
bool active;
diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
index 305f9046c3..bb1daf04a4 100644
--- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
+++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
@@ -231,8 +231,8 @@ Ref<AudioEffectInstance> AudioEffectSpectrumAnalyzer::instance() {
return ins;
}
-void AudioEffectSpectrumAnalyzer::set_buffer_length(float p_volume) {
- buffer_length = p_volume;
+void AudioEffectSpectrumAnalyzer::set_buffer_length(float p_seconds) {
+ buffer_length = p_seconds;
}
float AudioEffectSpectrumAnalyzer::get_buffer_length() const {
diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp
index 94bf274f9c..1b59779bd6 100644
--- a/servers/physics/broad_phase_octree.cpp
+++ b/servers/physics/broad_phase_octree.cpp
@@ -45,7 +45,7 @@ void BroadPhaseOctree::move(ID p_id, const AABB &p_aabb) {
void BroadPhaseOctree::set_static(ID p_id, bool p_static) {
CollisionObjectSW *it = octree.get(p_id);
- octree.set_pairable(p_id, p_static ? false : true, 1 << it->get_type(), p_static ? 0 : 0xFFFFF); //pair everything, don't care 1?
+ octree.set_pairable(p_id, !p_static, 1 << it->get_type(), p_static ? 0 : 0xFFFFF); //pair everything, don't care 1?
}
void BroadPhaseOctree::remove(ID p_id) {
diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp
index 3073cc8b11..a13fa65009 100644
--- a/servers/physics/collision_solver_sat.cpp
+++ b/servers/physics/collision_solver_sat.cpp
@@ -538,8 +538,6 @@ static void _collision_sphere_capsule(const ShapeSW *p_a, const Transform &p_tra
template <bool withMargin>
static void _collision_sphere_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
-
- return;
}
template <bool withMargin>
@@ -835,8 +833,6 @@ static void _collision_box_capsule(const ShapeSW *p_a, const Transform &p_transf
template <bool withMargin>
static void _collision_box_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
-
- return;
}
template <bool withMargin>
@@ -1117,8 +1113,6 @@ static void _collision_capsule_capsule(const ShapeSW *p_a, const Transform &p_tr
template <bool withMargin>
static void _collision_capsule_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
-
- return;
}
template <bool withMargin>
@@ -1243,20 +1237,14 @@ static void _collision_capsule_face(const ShapeSW *p_a, const Transform &p_trans
template <bool withMargin>
static void _collision_cylinder_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
-
- return;
}
template <bool withMargin>
static void _collision_cylinder_convex_polygon(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
-
- return;
}
template <bool withMargin>
static void _collision_cylinder_face(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
-
- return;
}
template <bool withMargin>
diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp
index 813d9b7704..a9fe045856 100644
--- a/servers/physics/joints/generic_6dof_joint_sw.cpp
+++ b/servers/physics/joints/generic_6dof_joint_sw.cpp
@@ -421,7 +421,6 @@ void Generic6DOFJointSW::calcAnchorPos(void) {
const Vector3 &pA = m_calculatedTransformA.origin;
const Vector3 &pB = m_calculatedTransformB.origin;
m_AnchorPos = pA * weight + pB * (real_t(1.0) - weight);
- return;
} // Generic6DOFJointSW::calcAnchorPos()
void Generic6DOFJointSW::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value) {
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index 8b9f210850..f3a4cbed24 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -118,7 +118,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask, p_collide_with_bodies, p_collide_with_areas))
continue;
- if (p_pick_ray && !(static_cast<CollisionObjectSW *>(space->intersection_query_results[i])->is_ray_pickable()))
+ if (p_pick_ray && !(space->intersection_query_results[i]->is_ray_pickable()))
continue;
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
@@ -439,7 +439,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_
continue;
}
- if (rcd.best_len == 0)
+ if (rcd.best_len == 0 || !rcd.best_object)
return false;
r_info->collider_id = rcd.best_object->get_instance_id();
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index e2b1bb9da4..7c89c43f36 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -442,7 +442,7 @@ bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Transform2D &p_sh
continue;
}
- if (rcd.best_len == 0)
+ if (rcd.best_len == 0 || !rcd.best_object)
return false;
r_info->collider_id = rcd.best_object->get_instance_id();
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index d5e154a7fc..66e2429bd0 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -783,7 +783,7 @@ void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector
ERR_FAIL_COND(!p_bones.empty() && p_bones.size() != vertex_count * 4);
ERR_FAIL_COND(!p_weights.empty() && p_weights.size() != vertex_count * 4);
- Vector<int> indices = p_indices;
+ const Vector<int> &indices = p_indices;
int count = p_count * 3;
diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h
index 26424f927e..28a8770c90 100644
--- a/servers/visual/visual_server_canvas.h
+++ b/servers/visual/visual_server_canvas.h
@@ -84,8 +84,8 @@ public:
if (Math::is_equal_approx(p_left->ysort_pos.y, p_right->ysort_pos.y))
return p_left->ysort_pos.x < p_right->ysort_pos.x;
- else
- return p_left->ysort_pos.y < p_right->ysort_pos.y;
+
+ return p_left->ysort_pos.y < p_right->ysort_pos.y;
}
};
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 3ee23e9290..faf5a1f8fa 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -3387,11 +3387,7 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
RID mat = VSG::storage->immediate_get_material(p_instance->base);
- if (!mat.is_valid() || VSG::storage->material_casts_shadows(mat)) {
- can_cast_shadows = true;
- } else {
- can_cast_shadows = false;
- }
+ can_cast_shadows = !mat.is_valid() || VSG::storage->material_casts_shadows(mat);
if (mat.is_valid() && VSG::storage->material_is_animated(mat)) {
is_animated = true;
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index b7c54caffd..f8ed035766 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -253,8 +253,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
} else {
_draw_3d(p_viewport, p_eye);
}
-
- scenario_draw_canvas_bg = false;
}
//VSG::canvas_render->canvas_debug_viewport_shadows(lights_with_shadow);
diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h
index 43bbcb66c3..bdd4c1d4f2 100644
--- a/servers/visual/visual_server_viewport.h
+++ b/servers/visual/visual_server_viewport.h
@@ -138,9 +138,8 @@ public:
if (left_to_screen == right_to_screen) {
return p_left->parent == p_right->self;
- } else {
- return right_to_screen;
}
+ return right_to_screen;
}
};
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 60be63fd24..c6468694fd 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -917,7 +917,7 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
}
r_offsets[i] = elem_size;
continue;
- } break;
+ }
default: {
ERR_FAIL_V(0);
}
@@ -953,15 +953,12 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim
switch (var.get_type()) {
case Variant::POOL_VECTOR2_ARRAY: {
PoolVector<Vector2> v2 = var;
- array_len = v2.size();
} break;
case Variant::POOL_VECTOR3_ARRAY: {
PoolVector<Vector3> v3 = var;
- array_len = v3.size();
} break;
default: {
Array v = var;
- array_len = v.size();
} break;
}
@@ -1151,7 +1148,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim
if (err) {
ERR_EXPLAIN("Invalid array format for surface");
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL();
}
Vector<PoolVector<uint8_t> > blend_shape_data;
@@ -1165,9 +1162,9 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim
AABB laabb;
Error err2 = _surface_set_data(p_blend_shapes[i], format & ~ARRAY_FORMAT_INDEX, offsets, total_elem_size, vertex_array_shape, array_len, noindex, 0, laabb, bone_aabb);
aabb.merge_with(laabb);
- if (err2) {
+ if (err2 != OK) {
ERR_EXPLAIN("Invalid blend shape array format for surface");
- ERR_FAIL_COND(err2 != OK);
+ ERR_FAIL();
}
blend_shape_data.push_back(vertex_array_shape);