diff --git a/core/class_db.cpp b/core/class_db.cpp index 0c844657a45..ec07ee98e27 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -666,10 +666,8 @@ void ClassDB::bind_integer_constant(const StringName &p_class, const StringName OBJTYPE_WLOCK; ClassInfo *type = classes.getptr(p_class); - if (!type) { - ERR_FAIL_COND(!type); - } + ERR_FAIL_COND(!type); if (type->constant_map.has(p_name)) { diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp index 83ff532aa48..93eaeb08c5b 100644 --- a/core/io/file_access_buffered.cpp +++ b/core/io/file_access_buffered.cpp @@ -141,9 +141,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const { int left = cache_data_left(); if (left == 0) { - if (to_read > 0) { - file.offset += to_read; - }; + file.offset += to_read; return total_read; }; if (left < 0) { diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index d1b6b82cf0e..74946034621 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -103,10 +103,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int const uint8_t *buf = p_buffer; int len = p_len; - if (len < 4) { - - ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); - } + ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); uint32_t type = decode_uint32(buf); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index f25abc4aab6..aef2dcfff3c 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -991,10 +991,7 @@ Ref ResourceFormatLoaderBinary::load_interactive(cons Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); - if (err != OK) { - - ERR_FAIL_COND_V(err != OK, Ref()); - } + ERR_FAIL_COND_V(err != OK, Ref()); Ref ria = memnew(ResourceInteractiveLoaderBinary); String path = p_original_path != "" ? p_original_path : p_path; @@ -1129,9 +1126,8 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons Error err; f = FileAccess::open(p_path, FileAccess::READ, &err); - if (err != OK) { - ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN); - } + + ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN); Ref ria = memnew(ResourceInteractiveLoaderBinary); ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path); diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 4638ddcc09b..4407ddb7d32 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -486,9 +486,7 @@ Error XMLParser::open(const String &p_path) { Error err; FileAccess *file = FileAccess::open(p_path, FileAccess::READ, &err); - if (err) { - ERR_FAIL_COND_V(err != OK, err); - } + ERR_FAIL_COND_V(err != OK, err); length = file->get_len(); ERR_FAIL_COND_V(length < 1, ERR_FILE_CORRUPT); diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 079f51bada2..913caf6584d 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -600,9 +600,8 @@ Vector FileAccess::get_file_as_array(const String &p_path, Error *r_err if (!f) { if (r_error) { // if error requested, do not throw error return Vector(); - } else { - ERR_FAIL_COND_V(!f, Vector()); } + ERR_FAIL_COND_V(!f, Vector()); } Vector data; data.resize(f->get_len()); @@ -621,9 +620,8 @@ String FileAccess::get_file_as_string(const String &p_path, Error *r_error) { if (err != OK) { if (r_error) { return String(); - } else { - ERR_FAIL_COND_V(err != OK, String()); } + ERR_FAIL_COND_V(err != OK, String()); } String ret; diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp index a283d8db1d9..11a3be89bd8 100644 --- a/core/pool_allocator.cpp +++ b/core/pool_allocator.cpp @@ -500,9 +500,7 @@ void *PoolAllocator::get(ID p_mem) { if (!needs_locking) { Entry *e = get_entry(p_mem); - if (!e) { - ERR_FAIL_COND_V(!e, NULL); - }; + ERR_FAIL_COND_V(!e, NULL); return &pool[e->pos]; } diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index c610f31bc10..7a701d49568 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -4505,9 +4505,7 @@ void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene ERR_FAIL_COND(!inst); } break; default: { - if (!inst) { - ERR_FAIL(); - } + ERR_FAIL(); } } @@ -4552,15 +4550,10 @@ void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerSc ERR_FAIL_COND(!inst); } break; default: { - - if (!inst) { - ERR_FAIL(); - } + ERR_FAIL(); } } - ERR_FAIL_COND(!inst); - inst->instance_list.remove(&p_instance->dependency_item); } diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 30aa22732cf..1f3af2f8859 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -327,9 +327,6 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun uint32_t buffer_ofs = 0; //vertex -#ifdef DEBUG_ENABLED - ERR_FAIL_COND(buffer_ofs > data.polygon_buffer_size); -#endif glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_vertices); glEnableVertexAttribArray(VS::ARRAY_VERTEX); glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, false, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs)); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 4552fddfe8a..dbc6d87e0c8 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -4290,7 +4290,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const use_mrt = use_mrt && !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]; use_mrt = use_mrt && !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_NO_3D_EFFECTS]; use_mrt = use_mrt && state.debug_draw != VS::VIEWPORT_DEBUG_DRAW_OVERDRAW; - use_mrt = use_mrt && env && (env->bg_mode != VS::ENV_BG_KEEP && env->bg_mode != VS::ENV_BG_CANVAS); + use_mrt = use_mrt && (env->bg_mode != VS::ENV_BG_KEEP && env->bg_mode != VS::ENV_BG_CANVAS); glViewport(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 8311d0de842..558b1b47837 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -6702,9 +6702,7 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base, RasterizerScene ERR_FAIL_COND(!inst); } break; default: { - if (!inst) { - ERR_FAIL(); - } + ERR_FAIL(); } } @@ -6749,15 +6747,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base, RasterizerSc ERR_FAIL_COND(!inst); } break; default: { - - if (!inst) { - ERR_FAIL(); - } + ERR_FAIL(); } } - ERR_FAIL_COND(!inst); - inst->instance_list.remove(&p_instance->dependency_item); } diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index 37abccbe27d..8b523f9f8d4 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -421,7 +421,7 @@ Error NetSocketPosix::poll(PollType p_type, int p_timeout) const { pfd.events = POLLOUT; break; case POLL_TYPE_IN_OUT: - pfd.events = POLLOUT || POLLIN; + pfd.events = POLLOUT | POLLIN; } int ret = ::poll(&pfd, 1, p_timeout); diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp index 1259e81be77..ed8ea5497a9 100644 --- a/editor/import/resource_importer_image.cpp +++ b/editor/import/resource_importer_image.cpp @@ -77,9 +77,8 @@ void ResourceImporterImage::get_import_options(List *r_options, in Error ResourceImporterImage::import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ); - if (!f) { - ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); - } + + ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); size_t len = f->get_len(); diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index e9504214764..868f67fd777 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -215,7 +215,6 @@ static Error _parse_obj(const String &p_path, List > &r_meshes, bool p bool generate_tangents = p_generate_tangents; Vector3 scale_mesh = p_scale_mesh; - bool flip_faces = false; int mesh_flags = p_optimize ? Mesh::ARRAY_COMPRESS_DEFAULT : 0; Vector vertices; @@ -293,7 +292,7 @@ static Error _parse_obj(const String &p_path, List > &r_meshes, bool p int idx = j; - if (!flip_faces && idx < 2) { + if (idx < 2) { idx = 1 ^ idx; } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 839c9483d78..505e0f841b9 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1868,9 +1868,7 @@ Ref ScriptEditor::_load_text_file(const String &p_path, Error *r_error Ref text_res(text_file); Error err = text_file->load_text(path); - if (err != OK) { - ERR_FAIL_COND_V(err != OK, RES()); - } + ERR_FAIL_COND_V(err != OK, RES()); text_file->set_file_path(local_path); text_file->set_path(local_path, true); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 60f1248ace6..c61415fdc7f 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1275,13 +1275,13 @@ void SpatialEditorViewport::_sinput(const Ref &p_event) { _edit.mode = TRANSFORM_TRANSLATE; } - if (cursor.region_select && nav_mode == NAVIGATION_NONE) { + if (cursor.region_select) { cursor.region_end = m->get_position(); surface->update(); return; } - if (_edit.mode == TRANSFORM_NONE && nav_mode == NAVIGATION_NONE) + if (_edit.mode == TRANSFORM_NONE) return; Vector3 ray_pos = _get_ray_pos(m->get_position()); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index a1b903576ed..1dd5311a7c9 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -573,13 +573,11 @@ void VisualShaderEditor::_update_graph() { name_box->connect("text_entered", this, "_change_input_port_name", varray(name_box, nodes[n_i], i)); name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, false)); - if (is_group) { - Button *remove_btn = memnew(Button); - remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); - remove_btn->set_tooltip(TTR("Remove") + " " + name_left); - remove_btn->connect("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED); - hb->add_child(remove_btn); - } + Button *remove_btn = memnew(Button); + remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); + remove_btn->set_tooltip(TTR("Remove") + " " + name_left); + remove_btn->connect("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED); + hb->add_child(remove_btn); } else { Label *label = memnew(Label); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index a661c2cfc3d..e106acaff15 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -305,49 +305,51 @@ void ScriptEditorDebugger::_scene_tree_rmb_selected(const Vector2 &p_position) { } void ScriptEditorDebugger::_file_selected(const String &p_file) { - if (file_dialog_mode == SAVE_NODE) { + switch (file_dialog_mode) { + case SAVE_NODE: { + Array msg; + msg.push_back("save_node"); + msg.push_back(inspected_object_id); + msg.push_back(p_file); + ppeer->put_var(msg); + } break; + case SAVE_CSV: { + Error err; + FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err); - Array msg; - msg.push_back("save_node"); - msg.push_back(inspected_object_id); - msg.push_back(p_file); - ppeer->put_var(msg); - } else if (file_dialog_mode == SAVE_CSV) { + if (err != OK) { + ERR_PRINTS("Failed to open " + p_file); + return; + } + Vector line; + line.resize(Performance::MONITOR_MAX); - Error err; - FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err); - - if (err != OK) { - ERR_PRINTS("Failed to open " + p_file); - return; - } - Vector line; - line.resize(Performance::MONITOR_MAX); - - // signatures - for (int i = 0; i < Performance::MONITOR_MAX; i++) { - line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)); - } - file->store_csv_line(line); - - // values - List >::Element *E = perf_history.back(); - while (E) { - - Vector &perf_data = E->get(); - for (int i = 0; i < perf_data.size(); i++) { - - line.write[i] = String::num_real(perf_data[i]); + // signatures + for (int i = 0; i < Performance::MONITOR_MAX; i++) { + line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)); } file->store_csv_line(line); - E = E->prev(); - } - file->store_string("\n"); - Vector > profiler_data = profiler->get_data_as_csv(); - for (int i = 0; i < profiler_data.size(); i++) { - file->store_csv_line(profiler_data[i]); - } + // values + List >::Element *E = perf_history.back(); + while (E) { + + Vector &perf_data = E->get(); + for (int i = 0; i < perf_data.size(); i++) { + + line.write[i] = String::num_real(perf_data[i]); + } + file->store_csv_line(line); + E = E->prev(); + } + file->store_string("\n"); + + Vector > profiler_data = profiler->get_data_as_csv(); + for (int i = 0; i < profiler_data.size(); i++) { + file->store_csv_line(profiler_data[i]); + } + + } break; } } diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 104bac190e1..46e4211ef45 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -1834,12 +1834,12 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { JointSpatialGizmoPlugin::CreateConeTwistJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), - pb ? pb->get_global_transform() : Transform(), - pbp ? pbp->get_global_transform() : Transform(), + pb->get_global_transform(), + pbp->get_global_transform(), cjd->swing_span, cjd->twist_span, - pb ? &points : NULL, - pbp ? &points : NULL); + &points, + &points); } break; case PhysicalBone::JOINT_TYPE_HINGE: { @@ -1847,14 +1847,14 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { JointSpatialGizmoPlugin::CreateHingeJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), - pb ? pb->get_global_transform() : Transform(), - pbp ? pbp->get_global_transform() : Transform(), + pb->get_global_transform(), + pbp->get_global_transform(), hjd->angular_limit_lower, hjd->angular_limit_upper, hjd->angular_limit_enabled, points, - pb ? &points : NULL, - pbp ? &points : NULL); + &points, + &points); } break; case PhysicalBone::JOINT_TYPE_SLIDER: { @@ -1862,15 +1862,15 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { JointSpatialGizmoPlugin::CreateSliderJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), - pb ? pb->get_global_transform() : Transform(), - pbp ? pbp->get_global_transform() : Transform(), + pb->get_global_transform(), + pbp->get_global_transform(), sjd->angular_limit_lower, sjd->angular_limit_upper, sjd->linear_limit_lower, sjd->linear_limit_upper, points, - pb ? &points : NULL, - pbp ? &points : NULL); + &points, + &points); } break; case PhysicalBone::JOINT_TYPE_6DOF: { @@ -1879,8 +1879,8 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), - pb ? pb->get_global_transform() : Transform(), - pbp ? pbp->get_global_transform() : Transform(), + pb->get_global_transform(), + pbp->get_global_transform(), sdofjd->axis_data[0].angular_limit_lower, sdofjd->axis_data[0].angular_limit_upper, @@ -1904,8 +1904,8 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { sdofjd->axis_data[2].linear_limit_enabled, points, - pb ? &points : NULL, - pbp ? &points : NULL); + &points, + &points); } break; default: return; diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index bcc992db241..b4530c2df1d 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -261,12 +261,10 @@ Error ImageLoaderBMP::load_image(Ref p_image, FileAccess *f, ERR_FAIL_COND_V(color_table_size == 0, ERR_BUG); PoolVector bmp_color_table; - if (color_table_size > 0) { - // Color table is usually 4 bytes per color -> [B][G][R][0] - err = bmp_color_table.resize(color_table_size * 4); - PoolVector::Write bmp_color_table_w = bmp_color_table.write(); - f->get_buffer(bmp_color_table_w.ptr(), color_table_size * 4); - } + // Color table is usually 4 bytes per color -> [B][G][R][0] + err = bmp_color_table.resize(color_table_size * 4); + PoolVector::Write bmp_color_table_w = bmp_color_table.write(); + f->get_buffer(bmp_color_table_w.ptr(), color_table_size * 4); f->seek(bmp_header.bmp_file_header.bmp_file_offset); diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index 3a61afa0235..3db1f9e3e09 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -1018,15 +1018,15 @@ int CSGBrushOperation::MeshMerge::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from max_depth = p_depth; } - if (p_size <= BVH_LIMIT) { + if (p_size == 0) { + + return -1; + } else if (p_size <= BVH_LIMIT) { for (int i = 0; i < p_size - 1; i++) { p_bb[p_from + i]->next = p_bb[p_from + i + 1] - p_bvh; } return p_bb[p_from] - p_bvh; - } else if (p_size == 0) { - - return -1; } AABB aabb; diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 1d27b9b6f44..a496a214fd5 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -1816,11 +1816,9 @@ CSGBrush *CSGPolygon::_build_brush() { path_cache = path; - if (path_cache) { - path_cache->connect("tree_exited", this, "_path_exited"); - path_cache->connect("curve_changed", this, "_path_changed"); - path_cache = NULL; - } + path_cache->connect("tree_exited", this, "_path_exited"); + path_cache->connect("curve_changed", this, "_path_changed"); + path_cache = NULL; } curve = path->get_curve(); if (curve.is_null()) diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp index 7254f576725..e10f29e310d 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp @@ -82,9 +82,8 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin float loop_offset = p_options["loop_offset"]; FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ); - if (!f) { - ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); - } + + ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); size_t len = f->get_len(); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 85fc867901f..df5bb9ca2ee 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -1692,7 +1692,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p if ((ret == output || ret & VisualScriptNodeInstance::STEP_FLAG_PUSH_STACK_BIT) && node->sequence_output_count) { //if no exit bit was set, and has sequence outputs, guess next node - if (output < 0 || output >= node->sequence_output_count) { + if (output >= node->sequence_output_count) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; error_str = RTR("Node returned an invalid sequence output: ") + itos(output); error = true; diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index ceec79c0d5a..1e7ed3019c7 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -188,7 +188,6 @@ void VisualScriptPropertySelector::_update_search() { } } } - bool script_methods = false; { if (type != Variant::NIL) { Variant v; @@ -211,7 +210,7 @@ void VisualScriptPropertySelector::_update_search() { for (List::Element *M = methods.front(); M; M = M->next()) { String name = M->get().name.get_slice(":", 0); - if (!script_methods && name.begins_with("_") && !(M->get().flags & METHOD_FLAG_VIRTUAL)) + if (name.begins_with("_") && !(M->get().flags & METHOD_FLAG_VIRTUAL)) continue; if (virtuals_only && !(M->get().flags & METHOD_FLAG_VIRTUAL)) diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index 5b14b3e8e1c..d8156a0afe6 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -61,9 +61,7 @@ void Joint2D::_update_joint(bool p_only_free) { if (!body_a || !body_b) return; - if (!body_a) { - SWAP(body_a, body_b); - } + SWAP(body_a, body_b); joint = _configure_joint(body_a, body_b); diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 686d1c96cc0..a7c15151aee 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -439,27 +439,26 @@ double ScrollBar::get_grabber_size() const { } double ScrollBar::get_area_size() const { - - if (orientation == VERTICAL) { - - double area = get_size().height; - area -= get_stylebox("scroll")->get_minimum_size().height; - area -= get_icon("increment")->get_height(); - area -= get_icon("decrement")->get_height(); - area -= get_grabber_min_size(); - return area; - - } else if (orientation == HORIZONTAL) { - - double area = get_size().width; - area -= get_stylebox("scroll")->get_minimum_size().width; - area -= get_icon("increment")->get_width(); - area -= get_icon("decrement")->get_width(); - area -= get_grabber_min_size(); - return area; - } else { - - return 0; + switch (orientation) { + case VERTICAL: { + double area = get_size().height; + area -= get_stylebox("scroll")->get_minimum_size().height; + area -= get_icon("increment")->get_height(); + area -= get_icon("decrement")->get_height(); + area -= get_grabber_min_size(); + return area; + } break; + case HORIZONTAL: { + double area = get_size().width; + area -= get_stylebox("scroll")->get_minimum_size().width; + area -= get_icon("increment")->get_width(); + area -= get_icon("decrement")->get_width(); + area -= get_grabber_min_size(); + return area; + } break; + default: { + return 0.0; + } } } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index e5313061da1..1c240640bf3 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3148,10 +3148,7 @@ bool Tree::is_anything_selected() { void Tree::clear() { - if (blocked > 0) { - - ERR_FAIL_COND(blocked > 0); - } + ERR_FAIL_COND(blocked > 0); if (pressing_for_editor) { if (range_drag_enabled) { diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index b5e5022e636..fafbfefb4a9 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1456,9 +1456,7 @@ void Viewport::_gui_show_tooltip() { return; } - Control *rp = which; //->get_root_parent_control(); - if (!rp) - return; + Control *rp = which; gui.tooltip_popup = which->make_custom_tooltip(tooltip); diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 6e7bb27e748..a9689934290 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1225,10 +1225,7 @@ Ref ResourceFormatLoaderText::load_interactive(const Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); - if (err != OK) { - - ERR_FAIL_COND_V(err != OK, Ref()); - } + ERR_FAIL_COND_V(err != OK, Ref()); Ref ria = memnew(ResourceInteractiveLoaderText); String path = p_original_path != "" ? p_original_path : p_path; @@ -1324,10 +1321,7 @@ Error ResourceFormatLoaderText::convert_file_to_binary(const String &p_src_path, Error err; FileAccess *f = FileAccess::open(p_src_path, FileAccess::READ, &err); - if (err != OK) { - - ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN); - } + ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN); Ref ria = memnew(ResourceInteractiveLoaderText); String path = p_src_path; diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index b4c3670a7bb..172a2a3429e 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -346,8 +346,7 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant &p_varian //biased_angular_velocity=Vector3(); set_active(false); } else { - if (mode != PhysicsServer::BODY_MODE_STATIC) - set_active(true); + set_active(true); } } break; case PhysicsServer::BODY_STATE_CAN_SLEEP: { diff --git a/servers/physics/gjk_epa.cpp b/servers/physics/gjk_epa.cpp index ae512183fdc..1d5ca42838e 100644 --- a/servers/physics/gjk_epa.cpp +++ b/servers/physics/gjk_epa.cpp @@ -722,7 +722,10 @@ struct GJK append(m_stock,face); return(0); } - m_status=m_stock.root?eStatus::OutOfVertices:eStatus::OutOfFaces; + // -- GODOT start -- + //m_status=m_stock.root?eStatus::OutOfVertices:eStatus::OutOfFaces; + m_status=eStatus::OutOfFaces; + // -- GODOT end -- return(0); } sFace* findbest()