浏览代码

Merge pull request #29283 from qarmin/fix_some_always_same_values

Remove always true/false values
Rémi Verschelde 6 年之前
父节点
当前提交
5c66771e3e

+ 1 - 3
core/class_db.cpp

@@ -666,10 +666,8 @@ void ClassDB::bind_integer_constant(const StringName &p_class, const StringName
 	OBJTYPE_WLOCK;
 	OBJTYPE_WLOCK;
 
 
 	ClassInfo *type = classes.getptr(p_class);
 	ClassInfo *type = classes.getptr(p_class);
-	if (!type) {
 
 
-		ERR_FAIL_COND(!type);
-	}
+	ERR_FAIL_COND(!type);
 
 
 	if (type->constant_map.has(p_name)) {
 	if (type->constant_map.has(p_name)) {
 
 

+ 1 - 3
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();
 		int left = cache_data_left();
 		if (left == 0) {
 		if (left == 0) {
-			if (to_read > 0) {
-				file.offset += to_read;
-			};
+			file.offset += to_read;
 			return total_read;
 			return total_read;
 		};
 		};
 		if (left < 0) {
 		if (left < 0) {

+ 1 - 4
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;
 	const uint8_t *buf = p_buffer;
 	int len = p_len;
 	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);
 	uint32_t type = decode_uint32(buf);
 
 

+ 3 - 7
core/io/resource_format_binary.cpp

@@ -991,10 +991,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons
 	Error err;
 	Error err;
 	FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
 	FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
 
 
-	if (err != OK) {
-
-		ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
-	}
+	ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
 
 
 	Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
 	Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
 	String path = p_original_path != "" ? p_original_path : p_path;
 	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;
 		Error err;
 		f = FileAccess::open(p_path, FileAccess::READ, &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<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
 		Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
 		ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path);
 		ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path);

+ 1 - 3
core/io/xml_parser.cpp

@@ -486,9 +486,7 @@ Error XMLParser::open(const String &p_path) {
 	Error err;
 	Error err;
 	FileAccess *file = FileAccess::open(p_path, FileAccess::READ, &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();
 	length = file->get_len();
 	ERR_FAIL_COND_V(length < 1, ERR_FILE_CORRUPT);
 	ERR_FAIL_COND_V(length < 1, ERR_FILE_CORRUPT);

+ 2 - 4
core/os/file_access.cpp

@@ -600,9 +600,8 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_err
 	if (!f) {
 	if (!f) {
 		if (r_error) { // if error requested, do not throw error
 		if (r_error) { // if error requested, do not throw error
 			return Vector<uint8_t>();
 			return Vector<uint8_t>();
-		} else {
-			ERR_FAIL_COND_V(!f, Vector<uint8_t>());
 		}
 		}
+		ERR_FAIL_COND_V(!f, Vector<uint8_t>());
 	}
 	}
 	Vector<uint8_t> data;
 	Vector<uint8_t> data;
 	data.resize(f->get_len());
 	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 (err != OK) {
 		if (r_error) {
 		if (r_error) {
 			return String();
 			return String();
-		} else {
-			ERR_FAIL_COND_V(err != OK, String());
 		}
 		}
+		ERR_FAIL_COND_V(err != OK, String());
 	}
 	}
 
 
 	String ret;
 	String ret;

+ 1 - 3
core/pool_allocator.cpp

@@ -500,9 +500,7 @@ void *PoolAllocator::get(ID p_mem) {
 	if (!needs_locking) {
 	if (!needs_locking) {
 
 
 		Entry *e = get_entry(p_mem);
 		Entry *e = get_entry(p_mem);
-		if (!e) {
-			ERR_FAIL_COND_V(!e, NULL);
-		};
+		ERR_FAIL_COND_V(!e, NULL);
 		return &pool[e->pos];
 		return &pool[e->pos];
 	}
 	}
 
 

+ 2 - 9
drivers/gles2/rasterizer_storage_gles2.cpp

@@ -4526,9 +4526,7 @@ void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene
 			ERR_FAIL_COND(!inst);
 			ERR_FAIL_COND(!inst);
 		} break;
 		} break;
 		default: {
 		default: {
-			if (!inst) {
-				ERR_FAIL();
-			}
+			ERR_FAIL();
 		}
 		}
 	}
 	}
 
 
@@ -4573,15 +4571,10 @@ void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerSc
 			ERR_FAIL_COND(!inst);
 			ERR_FAIL_COND(!inst);
 		} break;
 		} break;
 		default: {
 		default: {
-
-			if (!inst) {
-				ERR_FAIL();
-			}
+			ERR_FAIL();
 		}
 		}
 	}
 	}
 
 
-	ERR_FAIL_COND(!inst);
-
 	inst->instance_list.remove(&p_instance->dependency_item);
 	inst->instance_list.remove(&p_instance->dependency_item);
 }
 }
 
 

+ 0 - 3
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;
 	uint32_t buffer_ofs = 0;
 
 
 	//vertex
 	//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);
 	glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_vertices);
 	glEnableVertexAttribArray(VS::ARRAY_VERTEX);
 	glEnableVertexAttribArray(VS::ARRAY_VERTEX);
 	glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, false, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
 	glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, false, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));

+ 1 - 1
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -4297,7 +4297,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_TRANSPARENT];
 		use_mrt = use_mrt && !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_NO_3D_EFFECTS];
 		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 && 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);
 		glViewport(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height);
 
 

+ 2 - 9
drivers/gles3/rasterizer_storage_gles3.cpp

@@ -6713,9 +6713,7 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base, RasterizerScene
 			ERR_FAIL_COND(!inst);
 			ERR_FAIL_COND(!inst);
 		} break;
 		} break;
 		default: {
 		default: {
-			if (!inst) {
-				ERR_FAIL();
-			}
+			ERR_FAIL();
 		}
 		}
 	}
 	}
 
 
@@ -6760,15 +6758,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base, RasterizerSc
 			ERR_FAIL_COND(!inst);
 			ERR_FAIL_COND(!inst);
 		} break;
 		} break;
 		default: {
 		default: {
-
-			if (!inst) {
-				ERR_FAIL();
-			}
+			ERR_FAIL();
 		}
 		}
 	}
 	}
 
 
-	ERR_FAIL_COND(!inst);
-
 	inst->instance_list.remove(&p_instance->dependency_item);
 	inst->instance_list.remove(&p_instance->dependency_item);
 }
 }
 
 

+ 1 - 1
drivers/unix/net_socket_posix.cpp

@@ -421,7 +421,7 @@ Error NetSocketPosix::poll(PollType p_type, int p_timeout) const {
 			pfd.events = POLLOUT;
 			pfd.events = POLLOUT;
 			break;
 			break;
 		case POLL_TYPE_IN_OUT:
 		case POLL_TYPE_IN_OUT:
-			pfd.events = POLLOUT || POLLIN;
+			pfd.events = POLLOUT | POLLIN;
 	}
 	}
 
 
 	int ret = ::poll(&pfd, 1, p_timeout);
 	int ret = ::poll(&pfd, 1, p_timeout);

+ 2 - 3
editor/import/resource_importer_image.cpp

@@ -77,9 +77,8 @@ void ResourceImporterImage::get_import_options(List<ImportOption> *r_options, in
 Error ResourceImporterImage::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) {
 Error ResourceImporterImage::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) {
 
 
 	FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ);
 	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();
 	size_t len = f->get_len();
 
 

+ 1 - 2
editor/import/resource_importer_obj.cpp

@@ -215,7 +215,6 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
 
 
 	bool generate_tangents = p_generate_tangents;
 	bool generate_tangents = p_generate_tangents;
 	Vector3 scale_mesh = p_scale_mesh;
 	Vector3 scale_mesh = p_scale_mesh;
-	bool flip_faces = false;
 	int mesh_flags = p_optimize ? Mesh::ARRAY_COMPRESS_DEFAULT : 0;
 	int mesh_flags = p_optimize ? Mesh::ARRAY_COMPRESS_DEFAULT : 0;
 
 
 	Vector<Vector3> vertices;
 	Vector<Vector3> vertices;
@@ -293,7 +292,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
 
 
 					int idx = j;
 					int idx = j;
 
 
-					if (!flip_faces && idx < 2) {
+					if (idx < 2) {
 						idx = 1 ^ idx;
 						idx = 1 ^ idx;
 					}
 					}
 
 

+ 1 - 3
editor/plugins/script_editor_plugin.cpp

@@ -1915,9 +1915,7 @@ Ref<TextFile> ScriptEditor::_load_text_file(const String &p_path, Error *r_error
 	Ref<TextFile> text_res(text_file);
 	Ref<TextFile> text_res(text_file);
 	Error err = text_file->load_text(path);
 	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_file_path(local_path);
 	text_file->set_path(local_path, true);
 	text_file->set_path(local_path, true);

+ 2 - 2
editor/plugins/spatial_editor_plugin.cpp

@@ -1275,13 +1275,13 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 					_edit.mode = TRANSFORM_TRANSLATE;
 					_edit.mode = TRANSFORM_TRANSLATE;
 				}
 				}
 
 
-				if (cursor.region_select && nav_mode == NAVIGATION_NONE) {
+				if (cursor.region_select) {
 					cursor.region_end = m->get_position();
 					cursor.region_end = m->get_position();
 					surface->update();
 					surface->update();
 					return;
 					return;
 				}
 				}
 
 
-				if (_edit.mode == TRANSFORM_NONE && nav_mode == NAVIGATION_NONE)
+				if (_edit.mode == TRANSFORM_NONE)
 					return;
 					return;
 
 
 				Vector3 ray_pos = _get_ray_pos(m->get_position());
 				Vector3 ray_pos = _get_ray_pos(m->get_position());

+ 5 - 7
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("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));
 						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 {
 					} else {
 
 
 						Label *label = memnew(Label);
 						Label *label = memnew(Label);

+ 37 - 35
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) {
 void ScriptEditorDebugger::_file_selected(const String &p_file) {
-	if (file_dialog_mode == SAVE_NODE) {
-
-		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) {
+	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);
 
 
-		Error err;
-		FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
+			if (err != OK) {
+				ERR_PRINTS("Failed to open " + p_file);
+				return;
+			}
+			Vector<String> line;
+			line.resize(Performance::MONITOR_MAX);
 
 
-		if (err != OK) {
-			ERR_PRINTS("Failed to open " + p_file);
-			return;
-		}
-		Vector<String> 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);
 
 
-		// 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<Vector<float> >::Element *E = perf_history.back();
+			while (E) {
 
 
-		// values
-		List<Vector<float> >::Element *E = perf_history.back();
-		while (E) {
+				Vector<float> &perf_data = E->get();
+				for (int i = 0; i < perf_data.size(); i++) {
 
 
-			Vector<float> &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");
 
 
-				line.write[i] = String::num_real(perf_data[i]);
+			Vector<Vector<String> > profiler_data = profiler->get_data_as_csv();
+			for (int i = 0; i < profiler_data.size(); i++) {
+				file->store_csv_line(profiler_data[i]);
 			}
 			}
-			file->store_csv_line(line);
-			E = E->prev();
-		}
-		file->store_string("\n");
 
 
-		Vector<Vector<String> > profiler_data = profiler->get_data_as_csv();
-		for (int i = 0; i < profiler_data.size(); i++) {
-			file->store_csv_line(profiler_data[i]);
-		}
+		} break;
 	}
 	}
 }
 }
 
 

+ 16 - 16
editor/spatial_editor_gizmos.cpp

@@ -1835,12 +1835,12 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
 			JointSpatialGizmoPlugin::CreateConeTwistJointGizmo(
 			JointSpatialGizmoPlugin::CreateConeTwistJointGizmo(
 					physical_bone->get_joint_offset(),
 					physical_bone->get_joint_offset(),
 					physical_bone->get_global_transform() * 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->swing_span,
 					cjd->twist_span,
 					cjd->twist_span,
-					pb ? &points : NULL,
-					pbp ? &points : NULL);
+					&points,
+					&points);
 		} break;
 		} break;
 		case PhysicalBone::JOINT_TYPE_HINGE: {
 		case PhysicalBone::JOINT_TYPE_HINGE: {
 
 
@@ -1848,14 +1848,14 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
 			JointSpatialGizmoPlugin::CreateHingeJointGizmo(
 			JointSpatialGizmoPlugin::CreateHingeJointGizmo(
 					physical_bone->get_joint_offset(),
 					physical_bone->get_joint_offset(),
 					physical_bone->get_global_transform() * 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_lower,
 					hjd->angular_limit_upper,
 					hjd->angular_limit_upper,
 					hjd->angular_limit_enabled,
 					hjd->angular_limit_enabled,
 					points,
 					points,
-					pb ? &points : NULL,
-					pbp ? &points : NULL);
+					&points,
+					&points);
 		} break;
 		} break;
 		case PhysicalBone::JOINT_TYPE_SLIDER: {
 		case PhysicalBone::JOINT_TYPE_SLIDER: {
 
 
@@ -1863,15 +1863,15 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
 			JointSpatialGizmoPlugin::CreateSliderJointGizmo(
 			JointSpatialGizmoPlugin::CreateSliderJointGizmo(
 					physical_bone->get_joint_offset(),
 					physical_bone->get_joint_offset(),
 					physical_bone->get_global_transform() * 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_lower,
 					sjd->angular_limit_upper,
 					sjd->angular_limit_upper,
 					sjd->linear_limit_lower,
 					sjd->linear_limit_lower,
 					sjd->linear_limit_upper,
 					sjd->linear_limit_upper,
 					points,
 					points,
-					pb ? &points : NULL,
-					pbp ? &points : NULL);
+					&points,
+					&points);
 		} break;
 		} break;
 		case PhysicalBone::JOINT_TYPE_6DOF: {
 		case PhysicalBone::JOINT_TYPE_6DOF: {
 
 
@@ -1880,8 +1880,8 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
 					physical_bone->get_joint_offset(),
 					physical_bone->get_joint_offset(),
 
 
 					physical_bone->get_global_transform() * 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_lower,
 					sdofjd->axis_data[0].angular_limit_upper,
 					sdofjd->axis_data[0].angular_limit_upper,
@@ -1905,8 +1905,8 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
 					sdofjd->axis_data[2].linear_limit_enabled,
 					sdofjd->axis_data[2].linear_limit_enabled,
 
 
 					points,
 					points,
-					pb ? &points : NULL,
-					pbp ? &points : NULL);
+					&points,
+					&points);
 		} break;
 		} break;
 		default:
 		default:
 			return;
 			return;

+ 4 - 6
modules/bmp/image_loader_bmp.cpp

@@ -261,12 +261,10 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f,
 			ERR_FAIL_COND_V(color_table_size == 0, ERR_BUG);
 			ERR_FAIL_COND_V(color_table_size == 0, ERR_BUG);
 
 
 			PoolVector<uint8_t> bmp_color_table;
 			PoolVector<uint8_t> 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<uint8_t>::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<uint8_t>::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);
 			f->seek(bmp_header.bmp_file_header.bmp_file_offset);
 
 

+ 4 - 4
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;
 		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++) {
 		for (int i = 0; i < p_size - 1; i++) {
 			p_bb[p_from + i]->next = p_bb[p_from + i + 1] - p_bvh;
 			p_bb[p_from + i]->next = p_bb[p_from + i + 1] - p_bvh;
 		}
 		}
 		return p_bb[p_from] - p_bvh;
 		return p_bb[p_from] - p_bvh;
-	} else if (p_size == 0) {
-
-		return -1;
 	}
 	}
 
 
 	AABB aabb;
 	AABB aabb;

+ 3 - 5
modules/csg/csg_shape.cpp

@@ -1816,11 +1816,9 @@ CSGBrush *CSGPolygon::_build_brush() {
 
 
 			path_cache = path;
 			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();
 		curve = path->get_curve();
 		if (curve.is_null())
 		if (curve.is_null())

+ 2 - 3
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"];
 	float loop_offset = p_options["loop_offset"];
 
 
 	FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ);
 	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();
 	size_t len = f->get_len();
 
 

+ 1 - 1
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 ((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 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;
 				r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
 				error_str = RTR("Node returned an invalid sequence output: ") + itos(output);
 				error_str = RTR("Node returned an invalid sequence output: ") + itos(output);
 				error = true;
 				error = true;

+ 1 - 2
modules/visual_script/visual_script_property_selector.cpp

@@ -188,7 +188,6 @@ void VisualScriptPropertySelector::_update_search() {
 				}
 				}
 			}
 			}
 		}
 		}
-		bool script_methods = false;
 		{
 		{
 			if (type != Variant::NIL) {
 			if (type != Variant::NIL) {
 				Variant v;
 				Variant v;
@@ -211,7 +210,7 @@ void VisualScriptPropertySelector::_update_search() {
 		for (List<MethodInfo>::Element *M = methods.front(); M; M = M->next()) {
 		for (List<MethodInfo>::Element *M = methods.front(); M; M = M->next()) {
 
 
 			String name = M->get().name.get_slice(":", 0);
 			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;
 				continue;
 
 
 			if (virtuals_only && !(M->get().flags & METHOD_FLAG_VIRTUAL))
 			if (virtuals_only && !(M->get().flags & METHOD_FLAG_VIRTUAL))

+ 1 - 3
scene/2d/joints_2d.cpp

@@ -61,9 +61,7 @@ void Joint2D::_update_joint(bool p_only_free) {
 	if (!body_a || !body_b)
 	if (!body_a || !body_b)
 		return;
 		return;
 
 
-	if (!body_a) {
-		SWAP(body_a, body_b);
-	}
+	SWAP(body_a, body_b);
 
 
 	joint = _configure_joint(body_a, body_b);
 	joint = _configure_joint(body_a, body_b);
 
 

+ 20 - 21
scene/gui/scroll_bar.cpp

@@ -439,27 +439,26 @@ double ScrollBar::get_grabber_size() const {
 }
 }
 
 
 double ScrollBar::get_area_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;
+		}
 	}
 	}
 }
 }
 
 

+ 1 - 4
scene/gui/tree.cpp

@@ -3163,10 +3163,7 @@ bool Tree::is_anything_selected() {
 
 
 void Tree::clear() {
 void Tree::clear() {
 
 
-	if (blocked > 0) {
-
-		ERR_FAIL_COND(blocked > 0);
-	}
+	ERR_FAIL_COND(blocked > 0);
 
 
 	if (pressing_for_editor) {
 	if (pressing_for_editor) {
 		if (range_drag_enabled) {
 		if (range_drag_enabled) {

+ 1 - 3
scene/main/viewport.cpp

@@ -1444,9 +1444,7 @@ void Viewport::_gui_show_tooltip() {
 		return;
 		return;
 	}
 	}
 
 
-	Control *rp = which; //->get_root_parent_control();
-	if (!rp)
-		return;
+	Control *rp = which;
 
 
 	gui.tooltip_popup = which->make_custom_tooltip(tooltip);
 	gui.tooltip_popup = which->make_custom_tooltip(tooltip);
 
 

+ 2 - 8
scene/resources/resource_format_text.cpp

@@ -1225,10 +1225,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderText::load_interactive(const
 	Error err;
 	Error err;
 	FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
 	FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
 
 
-	if (err != OK) {
-
-		ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
-	}
+	ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
 
 
 	Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText);
 	Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText);
 	String path = p_original_path != "" ? p_original_path : p_path;
 	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;
 	Error err;
 	FileAccess *f = FileAccess::open(p_src_path, FileAccess::READ, &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<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText);
 	Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText);
 	String path = p_src_path;
 	String path = p_src_path;

+ 1 - 2
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();
 				//biased_angular_velocity=Vector3();
 				set_active(false);
 				set_active(false);
 			} else {
 			} else {
-				if (mode != PhysicsServer::BODY_MODE_STATIC)
-					set_active(true);
+				set_active(true);
 			}
 			}
 		} break;
 		} break;
 		case PhysicsServer::BODY_STATE_CAN_SLEEP: {
 		case PhysicsServer::BODY_STATE_CAN_SLEEP: {

+ 4 - 1
servers/physics/gjk_epa.cpp

@@ -722,7 +722,10 @@ struct	GJK
 					append(m_stock,face);
 					append(m_stock,face);
 					return(0);
 					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);
 				return(0);
 			}
 			}
 			sFace*				findbest()
 			sFace*				findbest()