diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-09-28 21:57:30 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2018-09-29 22:26:12 +0200 |
commit | 62ecb44035011b0440ad0f4c2fc2bf41045acfba (patch) | |
tree | f0b5b05f9bb3cf32895c028ac8a7687d10eae011 /editor | |
parent | 4115e6d1795270dc0012a6328c951e73dfd24c9a (diff) |
Fix warning about functions defined but not used [-Wunused-function]
Fixes the following GCC 5 warnings:
```
core/io/zip_io.h:128:26: warning: 'zlib_filefunc_def zipio_create_io_from_file(FileAccess**)' defined but not used [-Wunused-function]
core/script_debugger_remote.cpp:110:17: warning: 'ObjectID safe_get_instance_id(const Variant&)' defined but not used [-Wunused-function]
drivers/unix/socket_helpers.h:103:12: warning: 'int _socket_create(IP::Type&, int, int)' defined but not used [-Wunused-function]
drivers/unix/socket_helpers.h:45:15: warning: 'size_t _set_sockaddr(sockaddr_storage*, const IP_Address&, int, IP::Type)' defined but not used [-Wunused-function]
drivers/unix/socket_helpers.h:76:15: warning: 'size_t _set_listen_sockaddr(sockaddr_storage*, int, IP::Type, IP_Address)' defined but not used [-Wunused-function]
editor/editor_fonts.cpp:40:24: warning: 'Ref<BitmapFont> make_font(int, int, int, int, const int*, const Ref<Texture>&)' defined but not used [-Wunused-function]
editor/editor_themes.cpp:85:26: warning: 'Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat>, Color)' defined but not used [-Wunused-function]
editor/import/editor_import_collada.cpp:493:13: warning: 'void _generate_normals(const PoolVector<int>&, const PoolVector<Vector3>&, PoolVector<Vector3>&)' defined but not used [-Wunused-function]
editor/import/editor_import_collada.cpp:524:13: warning: 'void _generate_tangents_and_binormals(const PoolVector<int>&, const PoolVector<Vector3>&, const PoolVector<Vector3>&, const PoolVector<Vector3>&, PoolVector<float>&)' defined but not used [-Wunused-function]
editor/pvrtc_compress.cpp:118:13: warning: 'void _compress_etc(Image*)' defined but not used [-Wunused-function]
modules/etc/image_etc.cpp:89:13: warning: 'void _decompress_etc1(Image*)' defined but not used [-Wunused-function]
modules/etc/image_etc.cpp:93:13: warning: 'void _decompress_etc2(Image*)' defined but not used [-Wunused-function]
modules/gdscript/editor/gdscript_highlighter.cpp:46:13: warning: 'bool _is_whitespace(CharType)' defined but not used [-Wunused-function]
scene/2d/cpu_particles_2d.cpp:510:14: warning: 'float rand_from_seed_m1_p1(uint32_t&)' defined but not used [-Wunused-function]
scene/3d/cpu_particles.cpp:474:14: warning: 'float rand_from_seed_m1_p1(uint32_t&)' defined but not used [-Wunused-function]
scene/resources/default_theme/default_theme.cpp:123:20: warning: 'Ref<Shader> make_shader(const char*, const char*, const char*)' defined but not used [-Wunused-function]
scene/resources/default_theme/default_theme.cpp:130:24: warning: 'Ref<BitmapFont> make_font(int, int, int, int, const int*, const Ref<Texture>&)' defined but not used [-Wunused-function]
```
Had to split `core/io/zip_io.h` into header and .cpp file without 'static' keyword.
Not fixed yet (static definition in header used in some files but not all):
```
modules/websocket/lws_helper.h:111:13: warning: 'void _lws_make_protocols(void*, int (*)(lws*, lws_callback_reasons, void*, void*, size_t), PoolVector<String>, _LWSRef**)' defined but not used [-Wunused-function]
```
Also fixed a couple other warnings missed in previous commits.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_fonts.cpp | 27 | ||||
-rw-r--r-- | editor/editor_node.cpp | 1 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 6 | ||||
-rw-r--r-- | editor/import/editor_import_collada.cpp | 114 | ||||
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/pvrtc_compress.cpp | 6 |
6 files changed, 0 insertions, 155 deletions
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index ea99c882e4..8b1818b595 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -37,33 +37,6 @@ #include "scene/resources/default_theme/default_theme.h" #include "scene/resources/dynamic_font.h" -static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p_charcount, const int *p_chars, const Ref<Texture> &p_texture) { - - Ref<BitmapFont> font(memnew(BitmapFont)); - font->add_texture(p_texture); - - for (int i = 0; i < p_charcount; i++) { - - const int *c = &p_chars[i * 8]; - - int chr = c[0]; - Rect2 frect; - frect.position.x = c[1]; - frect.position.y = c[2]; - frect.size.x = c[3]; - frect.size.y = c[4]; - Point2 align(c[5], c[6] + p_valign); - int advance = c[7]; - - font->add_char(chr, 0, frect, align, advance); - } - - font->set_height(p_height); - font->set_ascent(p_ascent); - - return font; -} - #define MAKE_FALLBACKS(m_name) \ m_name->add_fallback(FontArabic); \ m_name->add_fallback(FontHebrew); \ diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 330173a8c3..c9871bf27d 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -36,7 +36,6 @@ #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/stream_peer_ssl.h" -#include "core/io/zip_io.h" #include "core/message_queue.h" #include "core/os/file_access.h" #include "core/os/input.h" diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 8575d7be96..39d2f685b6 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -81,12 +81,6 @@ static Ref<StyleBoxLine> make_line_stylebox(Color p_color, int p_thickness = 1, return style; } -static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_color) { - Ref<StyleBoxFlat> style = p_style->duplicate(); - style->set_border_color_all(p_color); - return style; -} - Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float p_scale = EDSCALE, bool p_force_filter = false) { Ref<ImageTexture> icon = memnew(ImageTexture); diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 31c1886d32..60ca66e464 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -490,120 +490,6 @@ Error ColladaImport::_create_material(const String &p_target) { return OK; } -static void _generate_normals(const PoolVector<int> &p_indices, const PoolVector<Vector3> &p_vertices, PoolVector<Vector3> &r_normals) { - - r_normals.resize(p_vertices.size()); - PoolVector<Vector3>::Write narrayw = r_normals.write(); - - int iacount = p_indices.size() / 3; - PoolVector<int>::Read index_arrayr = p_indices.read(); - PoolVector<Vector3>::Read vertex_arrayr = p_vertices.read(); - - for (int idx = 0; idx < iacount; idx++) { - - Vector3 v[3] = { - vertex_arrayr[index_arrayr[idx * 3 + 0]], - vertex_arrayr[index_arrayr[idx * 3 + 1]], - vertex_arrayr[index_arrayr[idx * 3 + 2]] - }; - - Vector3 normal = Plane(v[0], v[1], v[2]).normal; - - narrayw[index_arrayr[idx * 3 + 0]] += normal; - narrayw[index_arrayr[idx * 3 + 1]] += normal; - narrayw[index_arrayr[idx * 3 + 2]] += normal; - } - - int vlen = p_vertices.size(); - - for (int idx = 0; idx < vlen; idx++) { - narrayw[idx].normalize(); - } -} - -static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, const PoolVector<Vector3> &p_vertices, const PoolVector<Vector3> &p_uvs, const PoolVector<Vector3> &p_normals, PoolVector<real_t> &r_tangents) { - - int vlen = p_vertices.size(); - - Vector<Vector3> tangents; - tangents.resize(vlen); - Vector<Vector3> binormals; - binormals.resize(vlen); - - int iacount = p_indices.size() / 3; - - PoolVector<int>::Read index_arrayr = p_indices.read(); - PoolVector<Vector3>::Read vertex_arrayr = p_vertices.read(); - PoolVector<Vector3>::Read narrayr = p_normals.read(); - PoolVector<Vector3>::Read uvarrayr = p_uvs.read(); - - for (int idx = 0; idx < iacount; idx++) { - - Vector3 v1 = vertex_arrayr[index_arrayr[idx * 3 + 0]]; - Vector3 v2 = vertex_arrayr[index_arrayr[idx * 3 + 1]]; - Vector3 v3 = vertex_arrayr[index_arrayr[idx * 3 + 2]]; - - Vector3 w1 = uvarrayr[index_arrayr[idx * 3 + 0]]; - Vector3 w2 = uvarrayr[index_arrayr[idx * 3 + 1]]; - Vector3 w3 = uvarrayr[index_arrayr[idx * 3 + 2]]; - - real_t x1 = v2.x - v1.x; - real_t x2 = v3.x - v1.x; - real_t y1 = v2.y - v1.y; - real_t y2 = v3.y - v1.y; - real_t z1 = v2.z - v1.z; - real_t z2 = v3.z - v1.z; - - real_t s1 = w2.x - w1.x; - real_t s2 = w3.x - w1.x; - real_t t1 = w2.y - w1.y; - real_t t2 = w3.y - w1.y; - - real_t r = (s1 * t2 - s2 * t1); - - Vector3 tangent; - Vector3 binormal; - - if (r == 0) { - - binormal = Vector3(); - tangent = Vector3(); - } else { - tangent = Vector3((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, - (t2 * z1 - t1 * z2) * r) - .normalized(); - binormal = Vector3((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, - (s1 * z2 - s2 * z1) * r) - .normalized(); - } - - tangents.write[index_arrayr[idx * 3 + 0]] += tangent; - binormals.write[index_arrayr[idx * 3 + 0]] += binormal; - tangents.write[index_arrayr[idx * 3 + 1]] += tangent; - binormals.write[index_arrayr[idx * 3 + 1]] += binormal; - tangents.write[index_arrayr[idx * 3 + 2]] += tangent; - binormals.write[index_arrayr[idx * 3 + 2]] += binormal; - } - - r_tangents.resize(vlen * 4); - PoolVector<real_t>::Write tarrayw = r_tangents.write(); - - for (int idx = 0; idx < vlen; idx++) { - Vector3 tangent = tangents[idx]; - Vector3 bingen = narrayr[idx].cross(tangent); - float dir; - if (bingen.dot(binormals[idx]) < 0) - dir = -1.0; - else - dir = +1.0; - - tarrayw[idx * 4 + 0] = tangent.x; - tarrayw[idx * 4 + 1] = tangent.y; - tarrayw[idx * 4 + 2] = tangent.z; - tarrayw[idx * 4 + 3] = dir; - } -} - Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_use_compression, bool p_use_mesh_material) { bool local_xform_mirror = p_local_xform.basis.determinant() < 0; diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 775fca308e..17f93b55a1 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -448,7 +448,6 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { int col, row; TextEdit *tx = shader_editor->get_text_edit(); tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col); - Vector2 mpos = mb->get_global_position() - tx->get_global_position(); tx->set_right_click_moves_caret(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret")); if (tx->is_right_click_moving_caret()) { diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp index b1c847570c..30e78aa32b 100644 --- a/editor/pvrtc_compress.cpp +++ b/editor/pvrtc_compress.cpp @@ -115,11 +115,6 @@ static void _compress_pvrtc4(Image *p_image) { _compress_image(Image::COMPRESS_PVRTC4, p_image); } -static void _compress_etc(Image *p_image) { - - _compress_image(Image::COMPRESS_ETC, p_image); -} - void _pvrtc_register_compressors() { _base_image_compress_pvrtc2_func = Image::_image_compress_pvrtc2_func; @@ -127,5 +122,4 @@ void _pvrtc_register_compressors() { Image::_image_compress_pvrtc2_func = _compress_pvrtc2; Image::_image_compress_pvrtc4_func = _compress_pvrtc4; - //Image::_image_compress_etc_func=_compress_etc; //use the built in one for ETC } |