summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/animation.cpp18
-rw-r--r--scene/resources/font.cpp3
-rw-r--r--scene/resources/skeleton_modification_3d.cpp3
-rw-r--r--scene/resources/tile_set.cpp2
4 files changed, 16 insertions, 10 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index a1e66fabb1..b6151bccf4 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -2474,34 +2474,38 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, double p_time, Interpol
real_t delta = (length - p_keys[next].time) - (length - p_keys[idx].time);
real_t from = (length - p_time) - (length - p_keys[idx].time);
- if (Math::is_zero_approx(delta))
+ if (Math::is_zero_approx(delta)) {
c = 0;
- else
+ } else {
c = from / delta;
+ }
} else {
next = len - 1;
real_t delta = p_keys[idx].time + (length - p_keys[next].time);
real_t from = (length - p_time) - (length - p_keys[idx].time);
- if (Math::is_zero_approx(delta))
+ if (Math::is_zero_approx(delta)) {
c = 0;
- else
+ } else {
c = from / delta;
+ }
}
} else {
// on loop, in front of last key
idx = 0;
next = len - 1;
real_t endtime = p_keys[idx].time;
- if (endtime > length) // may be keys past the end
+ if (endtime > length) { // may be keys past the end
endtime = length;
+ }
real_t delta = p_keys[next].time - endtime;
real_t from = p_time - endtime;
- if (Math::is_zero_approx(delta))
+ if (Math::is_zero_approx(delta)) {
c = 0;
- else
+ } else {
c = from / delta;
+ }
}
}
} else { // no loop
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index f040041aa5..b512acdd8a 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -2344,8 +2344,9 @@ real_t Font::draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_char,
bool Font::has_char(char32_t p_char) const {
for (int i = 0; i < data.size(); i++) {
- if (data[i]->has_char(p_char))
+ if (data[i]->has_char(p_char)) {
return true;
+ }
}
return false;
}
diff --git a/scene/resources/skeleton_modification_3d.cpp b/scene/resources/skeleton_modification_3d.cpp
index b5b3fd5e9f..2c0f6e779e 100644
--- a/scene/resources/skeleton_modification_3d.cpp
+++ b/scene/resources/skeleton_modification_3d.cpp
@@ -34,8 +34,9 @@
void SkeletonModification3D::_execute(real_t p_delta) {
GDVIRTUAL_CALL(_execute, p_delta);
- if (!enabled)
+ if (!enabled) {
return;
+ }
}
void SkeletonModification3D::_setup_modification(SkeletonModificationStack3D *p_stack) {
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index b5b7d14f96..2854cbe30d 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -5089,7 +5089,7 @@ int TileData::get_collision_polygon_shapes_count(int p_layer_id, int p_polygon_i
}
Ref<ConvexPolygonShape2D> TileData::get_collision_polygon_shape(int p_layer_id, int p_polygon_index, int shape_index) const {
- ERR_FAIL_INDEX_V(p_layer_id, physics.size(), 0);
+ ERR_FAIL_INDEX_V(p_layer_id, physics.size(), Ref<ConvexPolygonShape2D>());
ERR_FAIL_INDEX_V(p_polygon_index, physics[p_layer_id].polygons.size(), Ref<ConvexPolygonShape2D>());
ERR_FAIL_INDEX_V(shape_index, (int)physics[p_layer_id].polygons[p_polygon_index].shapes.size(), Ref<ConvexPolygonShape2D>());
return physics[p_layer_id].polygons[p_polygon_index].shapes[shape_index];