summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/joints_2d.cpp4
-rw-r--r--scene/gui/scroll_bar.cpp41
-rw-r--r--scene/gui/tree.cpp5
-rw-r--r--scene/main/viewport.cpp4
-rw-r--r--scene/resources/resource_format_text.cpp10
5 files changed, 25 insertions, 39 deletions
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 5b14b3e8e1..d8156a0afe 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 686d1c96cc..a7c15151ae 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 522c1ecb6a..54370d02ba 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3163,10 +3163,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 f8a0db18b1..10e5ad78e2 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1444,9 +1444,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 0921c0dae9..efc1082a6b 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1225,10 +1225,7 @@ Ref<ResourceInteractiveLoader> 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<ResourceInteractiveLoader>());
- }
+ ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
Ref<ResourceInteractiveLoaderText> 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<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText);
String path = p_src_path;