Appease some CppCheck warns for files in the "scene" directory
This commit is contained in:
parent
9c1768836f
commit
9c69d7f339
@ -224,15 +224,12 @@ void Polygon2D::_notification(int p_what) {
|
|||||||
for (int i = 0; i < bone_weights.size(); i++) {
|
for (int i = 0; i < bone_weights.size(); i++) {
|
||||||
if (bone_weights[i].weights.size() != points.size()) {
|
if (bone_weights[i].weights.size() != points.size()) {
|
||||||
continue; //different number of vertices, sorry not using.
|
continue; //different number of vertices, sorry not using.
|
||||||
print_line("wrong weight size");
|
|
||||||
}
|
}
|
||||||
if (!skeleton_node->has_node(bone_weights[i].path)) {
|
if (!skeleton_node->has_node(bone_weights[i].path)) {
|
||||||
print_line("no node");
|
|
||||||
continue; //node does not exist
|
continue; //node does not exist
|
||||||
}
|
}
|
||||||
Bone2D *bone = Object::cast_to<Bone2D>(skeleton_node->get_node(bone_weights[i].path));
|
Bone2D *bone = Object::cast_to<Bone2D>(skeleton_node->get_node(bone_weights[i].path));
|
||||||
if (!bone) {
|
if (!bone) {
|
||||||
print_line("no bone");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,13 +377,12 @@ void TileMap::update_dirty_quadrants() {
|
|||||||
r.size = tile_set->autotile_get_size(c.id);
|
r.size = tile_set->autotile_get_size(c.id);
|
||||||
r.position += (r.size + Vector2(spacing, spacing)) * Vector2(c.autotile_coord_x, c.autotile_coord_y);
|
r.position += (r.size + Vector2(spacing, spacing)) * Vector2(c.autotile_coord_x, c.autotile_coord_y);
|
||||||
}
|
}
|
||||||
Size2 s = tex->get_size();
|
|
||||||
|
|
||||||
|
Size2 s;
|
||||||
if (r == Rect2())
|
if (r == Rect2())
|
||||||
s = tex->get_size();
|
s = tex->get_size();
|
||||||
else {
|
else
|
||||||
s = r.size;
|
s = r.size;
|
||||||
}
|
|
||||||
|
|
||||||
Rect2 rect;
|
Rect2 rect;
|
||||||
rect.position = offset.floor();
|
rect.position = offset.floor();
|
||||||
|
@ -605,19 +605,14 @@ void CPUParticles::_particles_process(float p_delta) {
|
|||||||
p.hue_rot_rand = Math::randf();
|
p.hue_rot_rand = Math::randf();
|
||||||
p.anim_offset_rand = Math::randf();
|
p.anim_offset_rand = Math::randf();
|
||||||
|
|
||||||
float angle1_rad;
|
|
||||||
float angle2_rad;
|
|
||||||
|
|
||||||
if (flags[FLAG_DISABLE_Z]) {
|
if (flags[FLAG_DISABLE_Z]) {
|
||||||
|
float angle1_rad = (Math::randf() * 2.0 - 1.0) * Math_PI * spread / 180.0;
|
||||||
angle1_rad = (Math::randf() * 2.0 - 1.0) * Math_PI * spread / 180.0;
|
|
||||||
Vector3 rot = Vector3(Math::cos(angle1_rad), Math::sin(angle1_rad), 0.0);
|
Vector3 rot = Vector3(Math::cos(angle1_rad), Math::sin(angle1_rad), 0.0);
|
||||||
p.velocity = rot * parameters[PARAM_INITIAL_LINEAR_VELOCITY] * Math::lerp(1.0f, float(Math::randf()), randomness[PARAM_INITIAL_LINEAR_VELOCITY]);
|
p.velocity = rot * parameters[PARAM_INITIAL_LINEAR_VELOCITY] * Math::lerp(1.0f, float(Math::randf()), randomness[PARAM_INITIAL_LINEAR_VELOCITY]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//initiate velocity spread in 3D
|
//initiate velocity spread in 3D
|
||||||
angle1_rad = (Math::randf() * 2.0 - 1.0) * Math_PI * spread / 180.0;
|
float angle1_rad = (Math::randf() * 2.0 - 1.0) * Math_PI * spread / 180.0;
|
||||||
angle2_rad = (Math::randf() * 2.0 - 1.0) * (1.0 - flatness) * Math_PI * spread / 180.0;
|
float angle2_rad = (Math::randf() * 2.0 - 1.0) * (1.0 - flatness) * Math_PI * spread / 180.0;
|
||||||
|
|
||||||
Vector3 direction_xz = Vector3(Math::sin(angle1_rad), 0, Math::cos(angle1_rad));
|
Vector3 direction_xz = Vector3(Math::sin(angle1_rad), 0, Math::cos(angle1_rad));
|
||||||
Vector3 direction_yz = Vector3(0, Math::sin(angle2_rad), Math::cos(angle2_rad));
|
Vector3 direction_yz = Vector3(0, Math::sin(angle2_rad), Math::cos(angle2_rad));
|
||||||
|
@ -1931,7 +1931,6 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
|
|||||||
|
|
||||||
//add directional light (do this after blur)
|
//add directional light (do this after blur)
|
||||||
{
|
{
|
||||||
LightMap *lightmap_ptr = lightmap.ptrw();
|
|
||||||
const Cell *cells = bake_cells.ptr();
|
const Cell *cells = bake_cells.ptr();
|
||||||
const Light *light = bake_light.ptr();
|
const Light *light = bake_light.ptr();
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
|
@ -1290,13 +1290,11 @@ int LineEdit::get_max_length() const {
|
|||||||
|
|
||||||
void LineEdit::selection_fill_at_cursor() {
|
void LineEdit::selection_fill_at_cursor() {
|
||||||
|
|
||||||
int aux;
|
|
||||||
|
|
||||||
selection.begin = cursor_pos;
|
selection.begin = cursor_pos;
|
||||||
selection.end = selection.cursor_start;
|
selection.end = selection.cursor_start;
|
||||||
|
|
||||||
if (selection.end < selection.begin) {
|
if (selection.end < selection.begin) {
|
||||||
aux = selection.end;
|
int aux = selection.end;
|
||||||
selection.end = selection.begin;
|
selection.end = selection.begin;
|
||||||
selection.begin = aux;
|
selection.begin = aux;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,6 @@ void ScrollContainer::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
if (!scroll_v || (!v_scroll->is_visible_in_tree() && c->get_v_size_flags() & SIZE_EXPAND)) {
|
if (!scroll_v || (!v_scroll->is_visible_in_tree() && c->get_v_size_flags() & SIZE_EXPAND)) {
|
||||||
r.position.y = 0;
|
r.position.y = 0;
|
||||||
r.size.height = size.height;
|
|
||||||
if (c->get_v_size_flags() & SIZE_EXPAND)
|
if (c->get_v_size_flags() & SIZE_EXPAND)
|
||||||
r.size.height = MAX(size.height, minsize.height);
|
r.size.height = MAX(size.height, minsize.height);
|
||||||
else
|
else
|
||||||
|
@ -3811,7 +3811,6 @@ Vector<String> TextEdit::get_wrap_rows_text(int p_line) const {
|
|||||||
if (indent_ofs + word_px > wrap_at) {
|
if (indent_ofs + word_px > wrap_at) {
|
||||||
// not enough space; add it anyway
|
// not enough space; add it anyway
|
||||||
wrap_substring += word_str;
|
wrap_substring += word_str;
|
||||||
px += word_px;
|
|
||||||
word_str = "";
|
word_str = "";
|
||||||
word_px = 0;
|
word_px = 0;
|
||||||
}
|
}
|
||||||
|
@ -220,13 +220,12 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
|
|||||||
Error err;
|
Error err;
|
||||||
if (new_request.begins_with("http")) {
|
if (new_request.begins_with("http")) {
|
||||||
// New url, request all again
|
// New url, request all again
|
||||||
err = _parse_url(new_request);
|
_parse_url(new_request);
|
||||||
} else {
|
} else {
|
||||||
request_string = new_request;
|
request_string = new_request;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = _request();
|
err = _request();
|
||||||
|
|
||||||
if (err == OK) {
|
if (err == OK) {
|
||||||
request_sent = false;
|
request_sent = false;
|
||||||
got_response = false;
|
got_response = false;
|
||||||
|
@ -2332,7 +2332,7 @@ float Animation::bezier_track_interpolate(int p_track, float p_time) const {
|
|||||||
float duration = bt->values[idx + 1].time - bt->values[idx].time; // time duration between our two keyframes
|
float duration = bt->values[idx + 1].time - bt->values[idx].time; // time duration between our two keyframes
|
||||||
float low = 0; // 0% of the current animation segment
|
float low = 0; // 0% of the current animation segment
|
||||||
float high = 1; // 100% of the current animation segment
|
float high = 1; // 100% of the current animation segment
|
||||||
float middle = 0;
|
float middle;
|
||||||
|
|
||||||
Vector2 start(0, bt->values[idx].value.value);
|
Vector2 start(0, bt->values[idx].value.value);
|
||||||
Vector2 start_out = start + bt->values[idx].value.out_handle;
|
Vector2 start_out = start + bt->values[idx].value.out_handle;
|
||||||
|
@ -761,8 +761,8 @@ Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const {
|
|||||||
//validate//
|
//validate//
|
||||||
int pc = baked_point_cache.size();
|
int pc = baked_point_cache.size();
|
||||||
if (pc == 0) {
|
if (pc == 0) {
|
||||||
ERR_EXPLAIN("No points in Curve2D");
|
ERR_EXPLAIN("No points in Curve2D.");
|
||||||
ERR_FAIL_COND_V(pc == 0, Vector2());
|
ERR_FAIL_V(Vector2());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc == 1)
|
if (pc == 1)
|
||||||
@ -826,8 +826,8 @@ Vector2 Curve2D::get_closest_point(const Vector2 &p_to_point) const {
|
|||||||
//validate//
|
//validate//
|
||||||
int pc = baked_point_cache.size();
|
int pc = baked_point_cache.size();
|
||||||
if (pc == 0) {
|
if (pc == 0) {
|
||||||
ERR_EXPLAIN("No points in Curve2D");
|
ERR_EXPLAIN("No points in Curve2D.");
|
||||||
ERR_FAIL_COND_V(pc == 0, Vector2());
|
ERR_FAIL_V(Vector2());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc == 1)
|
if (pc == 1)
|
||||||
@ -865,8 +865,8 @@ float Curve2D::get_closest_offset(const Vector2 &p_to_point) const {
|
|||||||
//validate//
|
//validate//
|
||||||
int pc = baked_point_cache.size();
|
int pc = baked_point_cache.size();
|
||||||
if (pc == 0) {
|
if (pc == 0) {
|
||||||
ERR_EXPLAIN("No points in Curve2D");
|
ERR_EXPLAIN("No points in Curve2D.");
|
||||||
ERR_FAIL_COND_V(pc == 0, 0.0f);
|
ERR_FAIL_V(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc == 1)
|
if (pc == 1)
|
||||||
@ -1331,8 +1331,8 @@ Vector3 Curve3D::interpolate_baked(float p_offset, bool p_cubic) const {
|
|||||||
//validate//
|
//validate//
|
||||||
int pc = baked_point_cache.size();
|
int pc = baked_point_cache.size();
|
||||||
if (pc == 0) {
|
if (pc == 0) {
|
||||||
ERR_EXPLAIN("No points in Curve3D");
|
ERR_EXPLAIN("No points in Curve3D.");
|
||||||
ERR_FAIL_COND_V(pc == 0, Vector3());
|
ERR_FAIL_V(Vector3());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc == 1)
|
if (pc == 1)
|
||||||
@ -1375,8 +1375,8 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const {
|
|||||||
//validate//
|
//validate//
|
||||||
int pc = baked_tilt_cache.size();
|
int pc = baked_tilt_cache.size();
|
||||||
if (pc == 0) {
|
if (pc == 0) {
|
||||||
ERR_EXPLAIN("No tilts in Curve3D");
|
ERR_EXPLAIN("No tilts in Curve3D.");
|
||||||
ERR_FAIL_COND_V(pc == 0, 0);
|
ERR_FAIL_V(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc == 1)
|
if (pc == 1)
|
||||||
@ -1413,8 +1413,8 @@ Vector3 Curve3D::interpolate_baked_up_vector(float p_offset, bool p_apply_tilt)
|
|||||||
// curve may not have baked up vectors
|
// curve may not have baked up vectors
|
||||||
int count = baked_up_vector_cache.size();
|
int count = baked_up_vector_cache.size();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
ERR_EXPLAIN("No up vectors in Curve3D");
|
ERR_EXPLAIN("No up vectors in Curve3D.");
|
||||||
ERR_FAIL_COND_V(count == 0, Vector3(0, 1, 0));
|
ERR_FAIL_V(Vector3(0, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
@ -1484,8 +1484,8 @@ Vector3 Curve3D::get_closest_point(const Vector3 &p_to_point) const {
|
|||||||
//validate//
|
//validate//
|
||||||
int pc = baked_point_cache.size();
|
int pc = baked_point_cache.size();
|
||||||
if (pc == 0) {
|
if (pc == 0) {
|
||||||
ERR_EXPLAIN("No points in Curve3D");
|
ERR_EXPLAIN("No points in Curve3D.");
|
||||||
ERR_FAIL_COND_V(pc == 0, Vector3());
|
ERR_FAIL_V(Vector3());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc == 1)
|
if (pc == 1)
|
||||||
@ -1523,8 +1523,8 @@ float Curve3D::get_closest_offset(const Vector3 &p_to_point) const {
|
|||||||
//validate//
|
//validate//
|
||||||
int pc = baked_point_cache.size();
|
int pc = baked_point_cache.size();
|
||||||
if (pc == 0) {
|
if (pc == 0) {
|
||||||
ERR_EXPLAIN("No points in Curve3D");
|
ERR_EXPLAIN("No points in Curve3D.");
|
||||||
ERR_FAIL_COND_V(pc == 0, 0.0f);
|
ERR_FAIL_V(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc == 1)
|
if (pc == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user