summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/tile_map.cpp1
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/3d/light.cpp6
-rw-r--r--scene/3d/navigation.cpp4
-rw-r--r--scene/gui/rich_text_label.cpp7
-rw-r--r--scene/gui/scroll_container.cpp3
-rw-r--r--scene/gui/text_edit.cpp4
-rw-r--r--scene/gui/tree.cpp12
-rw-r--r--scene/main/viewport.cpp18
-rw-r--r--scene/resources/audio_stream_sample.cpp4
-rw-r--r--scene/resources/bit_mask.cpp1
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--scene/resources/mesh.cpp13
-rw-r--r--scene/resources/visual_shader.cpp8
14 files changed, 24 insertions, 61 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 71bd51507e..5b8d10ea85 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -257,7 +257,6 @@ void TileMap::update_dirty_quadrants() {
VisualServer *vs = VisualServer::get_singleton();
Physics2DServer *ps = Physics2DServer::get_singleton();
Vector2 tofs = get_cell_draw_offset();
- Vector2 tcenter = cell_size / 2;
Transform2D nav_rel;
if (navigation)
nav_rel = get_relative_transform_to_parent(navigation);
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 386f2a4348..b1f90b72e7 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -417,7 +417,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
}
}
- for (int k = 0; k < cc; k++) {
+ for (unsigned int k = 0; k < cc; k++) {
output.vol[k] *= multiplier;
}
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index d674958d33..7e1d60ab8e 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -163,6 +163,11 @@ void Light::_update_visibility() {
if (!is_inside_tree())
return;
+ // FIXME: Since the call to VS::instance_light_set_enabled was disabled below,
+ // the whole logic became pointless so editor_ok triggers unused variable warnings.
+ // Commenting out for now but this should be fixed/reimplemented so that editor_only
+ // works as expected (GH-17989).
+ /*
bool editor_ok = true;
#ifdef TOOLS_ENABLED
@@ -180,6 +185,7 @@ void Light::_update_visibility() {
#endif
//VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible_in_tree() && editor_ok);
+ */
_change_notify("geometry/visible");
}
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index 54f74c2df3..6e7b372647 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -563,7 +563,6 @@ Vector3 Navigation::get_closest_point_to_segment(const Vector3 &p_from, const Ve
bool use_collision = p_use_collision;
Vector3 closest_point;
float closest_point_d = 1e20;
- NavMesh *closest_navmesh = NULL;
for (Map<int, NavMesh>::Element *E = navmesh_map.front(); E; E = E->next()) {
@@ -582,12 +581,10 @@ Vector3 Navigation::get_closest_point_to_segment(const Vector3 &p_from, const Ve
closest_point = inters;
use_collision = true;
closest_point_d = p_from.distance_to(inters);
- closest_navmesh = p.owner;
} else if (closest_point_d > inters.distance_to(p_from)) {
closest_point = inters;
closest_point_d = p_from.distance_to(inters);
- closest_navmesh = p.owner;
}
}
}
@@ -605,7 +602,6 @@ Vector3 Navigation::get_closest_point_to_segment(const Vector3 &p_from, const Ve
closest_point_d = d;
closest_point = b;
- closest_navmesh = p.owner;
}
}
}
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 81f1ee67c5..bb36852cf9 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -421,7 +421,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
int cw = 0;
- bool visible = visible_characters < 0 || p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - line_descent - line_ascent, line_ascent + line_descent);
+ bool visible = visible_characters < 0 || (p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - line_descent - line_ascent, line_ascent + line_descent));
if (visible)
line_is_blank = false;
@@ -509,7 +509,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
ENSURE_WIDTH(img->image->get_width());
- bool visible = visible_characters < 0 || p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - font->get_descent() - img->image->get_height(), img->image->get_height());
+ bool visible = visible_characters < 0 || (p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - font->get_descent() - img->image->get_height(), img->image->get_height()));
if (visible)
line_is_blank = false;
@@ -847,8 +847,6 @@ void RichTextLabel::_notification(int p_what) {
bool use_outline = get_constant("shadow_as_outline");
Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
- float x_ofs = 0;
-
visible_line_count = 0;
while (y < size.height && from_line < main->lines.size()) {
@@ -866,7 +864,6 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
if (r_click_item)
*r_click_item = NULL;
- Size2 size = get_size();
Rect2 text_rect = _get_text_rect();
int ofs = vscroll->get_value();
Color font_color_shadow = get_color("font_color_shadow");
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index e3fb602065..26da16569a 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -30,6 +30,7 @@
#include "scroll_container.h"
#include "core/os/os.h"
+
bool ScrollContainer::clips_input() const {
return true;
@@ -170,7 +171,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
Vector2 motion = Vector2(mm->get_relative().x, mm->get_relative().y);
drag_accum -= motion;
- if (beyond_deadzone || scroll_h && Math::abs(drag_accum.x) > deadzone || scroll_v && Math::abs(drag_accum.y) > deadzone) {
+ if (beyond_deadzone || (scroll_h && Math::abs(drag_accum.x) > deadzone) || (scroll_v && Math::abs(drag_accum.y) > deadzone)) {
if (!beyond_deadzone) {
propagate_notification(NOTIFICATION_SCROLL_BEGIN);
emit_signal("scroll_started");
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index a9566d9387..64567a3d0f 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -650,8 +650,6 @@ void TextEdit::_notification(int p_what) {
int visible_rows = get_visible_rows() + 1;
- int tab_w = cache.font->get_char_size(' ').width * indent_size;
-
Color color = cache.font_color;
color.a *= readonly_alpha;
@@ -4402,7 +4400,7 @@ int TextEdit::_is_line_in_region(int p_line) {
// if not find the closest line we have
int previous_line = p_line - 1;
- for (previous_line; previous_line > -1; previous_line--) {
+ for (; previous_line > -1; previous_line--) {
if (color_region_cache.has(p_line)) {
break;
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 23e4c26695..3a540d187b 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1254,13 +1254,13 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
String s = RTR("(Other)");
Vector<String> strings = p_item->cells[i].text.split(",");
- for (int i = 0; i < strings.size(); i++) {
- int value = i;
- if (!strings[i].get_slicec(':', 1).empty()) {
- value = strings[i].get_slicec(':', 1).to_int();
+ for (int j = 0; j < strings.size(); j++) {
+ int value = j;
+ if (!strings[j].get_slicec(':', 1).empty()) {
+ value = strings[j].get_slicec(':', 1).to_int();
}
if (option == value) {
- s = strings[i].get_slicec(':', 0);
+ s = strings[j].get_slicec(':', 0);
break;
}
}
@@ -1416,7 +1416,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
while (c) {
- if (cache.draw_relationship_lines == 1 && (c->get_parent() != root || c->get_parent() == root && !hide_root)) {
+ if (cache.draw_relationship_lines == 1 && (c->get_parent() != root || !hide_root)) {
int root_ofs = children_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
int parent_ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h / 2) - cache.offset + p_draw_ofs;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 487ca2b009..bb379ff4af 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -701,15 +701,6 @@ void Viewport::set_canvas_transform(const Transform2D &p_transform) {
canvas_transform = p_transform;
VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform);
-
- Transform2D xform = (global_canvas_transform * canvas_transform).affine_inverse();
- Size2 ss = get_visible_rect().size;
- /*SpatialSound2DServer::get_singleton()->listener_set_transform(internal_listener_2d, Transform2D(0, xform.xform(ss*0.5)));
- Vector2 ss2 = ss*xform.get_scale();
- float panrange = MAX(ss2.x,ss2.y);
-
- SpatialSound2DServer::get_singleton()->listener_set_param(internal_listener_2d, SpatialSound2DServer::LISTENER_PARAM_PAN_RANGE, panrange);
-*/
}
Transform2D Viewport::get_canvas_transform() const {
@@ -722,15 +713,6 @@ void Viewport::_update_global_transform() {
Transform2D sxform = stretch_transform * global_canvas_transform;
VisualServer::get_singleton()->viewport_set_global_canvas_transform(viewport, sxform);
-
- Transform2D xform = (sxform * canvas_transform).affine_inverse();
- Size2 ss = get_visible_rect().size;
- /*SpatialSound2DServer::get_singleton()->listener_set_transform(internal_listener_2d, Transform2D(0, xform.xform(ss*0.5)));
- Vector2 ss2 = ss*xform.get_scale();
- float panrange = MAX(ss2.x,ss2.y);
-
- SpatialSound2DServer::get_singleton()->listener_set_param(internal_listener_2d, SpatialSound2DServer::LISTENER_PARAM_PAN_RANGE, panrange);
-*/
}
void Viewport::set_global_canvas_transform(const Transform2D &p_transform) {
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 57d0deeb78..9ee85b64b6 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -562,13 +562,13 @@ void AudioStreamSample::save_to_wav(String p_path) {
PoolVector<uint8_t>::Read read_data = get_data().read();
switch (format) {
case AudioStreamSample::FORMAT_8_BITS:
- for (int i = 0; i < data_bytes; i++) {
+ for (unsigned int i = 0; i < data_bytes; i++) {
uint8_t data_point = (read_data[i] + 128);
file->store_8(data_point);
}
break;
case AudioStreamSample::FORMAT_16_BITS:
- for (int i = 0; i < data_bytes / 2; i++) {
+ for (unsigned int i = 0; i < data_bytes / 2; i++) {
uint16_t data_point = decode_uint16(&read_data[i * 2]);
file->store_16(data_point);
}
diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp
index d670161afd..56b236d03b 100644
--- a/scene/resources/bit_mask.cpp
+++ b/scene/resources/bit_mask.cpp
@@ -183,7 +183,6 @@ Vector<Vector2> BitMap::_march_square(const Rect2i &rect, const Point2i &start)
unsigned int count = 0;
Set<Point2i> case9s;
Set<Point2i> case6s;
- int i;
Vector<Vector2> _points;
do {
int sv = 0;
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index cc8685b952..ce801c8763 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -427,10 +427,8 @@ void SpatialMaterial::_update_shader() {
if (flags[FLAG_USE_VERTEX_LIGHTING]) {
code += ",vertex_lighting";
}
- bool using_world = false;
if (flags[FLAG_TRIPLANAR_USE_WORLD] && (flags[FLAG_UV1_USE_TRIPLANAR] || flags[FLAG_UV2_USE_TRIPLANAR])) {
code += ",world_vertex_coords";
- using_world = true;
}
if (flags[FLAG_DONT_RECEIVE_SHADOWS]) {
code += ",shadows_disabled";
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 6426689397..fa87623e38 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -546,19 +546,6 @@ void Mesh::clear_cache() const {
Mesh::Mesh() {
}
-static const char *_array_name[] = {
- "vertex_array",
- "normal_array",
- "tangent_array",
- "color_array",
- "tex_uv_array",
- "tex_uv2_array",
- "bone_array",
- "weights_array",
- "index_array",
- NULL
-};
-
static const ArrayMesh::ArrayType _array_types[] = {
ArrayMesh::ARRAY_VERTEX,
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index f12ea8f2bb..96b9cfa137 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -796,10 +796,10 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
val.basis.transpose();
inputs[i] = "n_in" + itos(node) + "p" + itos(i);
Array values;
- for (int i = 0; i < 3; i++) {
- values.push_back(val.basis[i].x);
- values.push_back(val.basis[i].y);
- values.push_back(val.basis[i].z);
+ for (int j = 0; j < 3; j++) {
+ values.push_back(val.basis[j].x);
+ values.push_back(val.basis[j].y);
+ values.push_back(val.basis[j].z);
}
values.push_back(val.origin.x);
values.push_back(val.origin.y);