summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorqarmin <mikrutrafal54@gmail.com>2019-07-20 08:09:57 +0200
committerqarmin <mikrutrafal54@gmail.com>2019-07-20 08:09:57 +0200
commit6cbaf7662f5ee3ca1d02c0ebc85854fceee057af (patch)
tree9c6c688f72d0a6e2e79879be73e15adeb328d1b1 /scene
parent584ca0f156cec64c259382895e105cf27566a987 (diff)
Changed some code showed in LGTM and Coverage
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/cpu_particles_2d.cpp3
-rw-r--r--scene/3d/cpu_particles.cpp3
-rw-r--r--scene/3d/light.cpp3
-rw-r--r--scene/3d/sprite_3d.cpp2
-rw-r--r--scene/3d/visual_instance.cpp13
-rw-r--r--scene/gui/base_button.cpp3
-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/animation.cpp17
-rw-r--r--scene/resources/resource_format_text.cpp4
11 files changed, 8 insertions, 46 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 591933d972..ab54cef508 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -980,9 +980,6 @@ void CPUParticles2D::_notification(int p_what) {
_set_redraw(false);
}
- if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) {
- }
-
if (p_what == NOTIFICATION_DRAW) {
if (!redraw)
return; // don't add to render list
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 86b407b9e6..dd64ffe934 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -1059,9 +1059,6 @@ void CPUParticles::_notification(int p_what) {
_set_redraw(false);
}
- if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) {
- }
-
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
if (particles.size() == 0 || !is_visible_in_tree()) {
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 4ef945ab8d..73d3ab50e3 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -200,9 +200,6 @@ void Light::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
_update_visibility();
}
-
- if (p_what == NOTIFICATION_EXIT_TREE) {
- }
}
void Light::set_editor_only(bool p_editor_only) {
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 67c79d8b5a..2c315790ac 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -558,7 +558,7 @@ Rect2 Sprite3D::get_region_rect() const {
void Sprite3D::set_frame(int p_frame) {
- ERR_FAIL_INDEX(p_frame, vframes * hframes);
+ ERR_FAIL_INDEX(p_frame, int64_t(vframes) * hframes);
if (frame != p_frame)
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 5141c84803..d1de0c56a7 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -215,17 +215,6 @@ float GeometryInstance::get_lod_max_hysteresis() const {
}
void GeometryInstance::_notification(int p_what) {
-
- if (p_what == NOTIFICATION_ENTER_WORLD) {
-
- if (flags[FLAG_USE_BAKED_LIGHT]) {
- }
-
- } else if (p_what == NOTIFICATION_EXIT_WORLD) {
-
- if (flags[FLAG_USE_BAKED_LIGHT]) {
- }
- }
}
void GeometryInstance::set_flag(Flags p_flag, bool p_value) {
@@ -236,8 +225,6 @@ void GeometryInstance::set_flag(Flags p_flag, bool p_value) {
flags[p_flag] = p_value;
VS::get_singleton()->instance_geometry_set_flag(get_instance(), (VS::InstanceFlags)p_flag, p_value);
- if (p_flag == FLAG_USE_BAKED_LIGHT) {
- }
}
bool GeometryInstance::get_flag(Flags p_flag) const {
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 52fcea2a71..4f71481280 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -115,9 +115,6 @@ void BaseButton::_notification(int p_what) {
}
}
- if (p_what == NOTIFICATION_ENTER_TREE) {
- }
-
if (p_what == NOTIFICATION_EXIT_TREE || (p_what == NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree())) {
if (!toggle_mode) {
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 4005505830..814100afdc 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2921,8 +2921,6 @@ void Tree::_notification(int p_what) {
drag_touching = false;
drag_touching_deaccel = false;
}
-
- } else {
}
}
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 06d6f0871c..caa0da5d1f 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -210,7 +210,7 @@ void Node::_propagate_enter_tree() {
}
data.viewport = Object::cast_to<Viewport>(this);
- if (!data.viewport)
+ if (!data.viewport && data.parent)
data.viewport = data.parent->data.viewport;
data.inside_tree = true;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index d147d43f50..9466b7c5c1 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -581,7 +581,7 @@ void Viewport::_notification(int p_what) {
if (physics_object_capture != 0) {
CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(physics_object_capture));
- if (co) {
+ if (co && camera) {
_collision_object_input_event(co, camera, ev, Vector3(), Vector3(), 0);
captured = true;
if (mb.is_valid() && mb->get_button_index() == 1 && !mb->is_pressed()) {
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 64051fe304..8c8552ac54 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -1667,8 +1667,7 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
Vector2 pb = p_post_b;
return a.cubic_interpolate(b, pa, pb, p_c);
-
- } break;
+ }
case Variant::RECT2: {
Rect2 a = p_a;
@@ -1679,8 +1678,7 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
return Rect2(
a.position.cubic_interpolate(b.position, pa.position, pb.position, p_c),
a.size.cubic_interpolate(b.size, pa.size, pb.size, p_c));
-
- } break;
+ }
case Variant::VECTOR3: {
Vector3 a = p_a;
@@ -1689,8 +1687,7 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
Vector3 pb = p_post_b;
return a.cubic_interpolate(b, pa, pb, p_c);
-
- } break;
+ }
case Variant::QUAT: {
Quat a = p_a;
@@ -1699,8 +1696,7 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
Quat pb = p_post_b;
return a.cubic_slerp(b, pa, pb, p_c);
-
- } break;
+ }
case Variant::AABB: {
AABB a = p_a;
@@ -1711,14 +1707,12 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
return AABB(
a.position.cubic_interpolate(b.position, pa.position, pb.position, p_c),
a.size.cubic_interpolate(b.size, pa.size, pb.size, p_c));
- } break;
+ }
default: {
return _interpolate(p_a, p_b, p_c);
}
}
-
- return Variant();
}
float Animation::_cubic_interpolate(const float &p_pre_a, const float &p_a, const float &p_b, const float &p_post_b, float p_c) const {
@@ -3028,7 +3022,6 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons
//this could be done as a second pass and would be
//able to optimize more
erase = false;
- } else {
}
}
}
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 12bf007bb1..6212066c3c 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1371,8 +1371,6 @@ String ResourceFormatSaverTextInstance::_write_resource(const RES &res) {
//internal resource
}
}
-
- return "null";
}
void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant, bool p_main) {
@@ -1514,8 +1512,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
}
}
- ERR_FAIL_COND_V(err != OK, err);
-
{
String title = packed_scene.is_valid() ? "[gd_scene " : "[gd_resource ";
if (packed_scene.is_null())