From cec1c48a7e7bb9bdc2c6829fba9e269a97d1c8bc Mon Sep 17 00:00:00 2001 From: Johan Manuel Date: Mon, 25 Jul 2016 19:12:13 +0200 Subject: [PATCH] Fix various warnings The warnings fixed were about things like unused variables, misleading indentation, missing default cases in switches and better grouping of conditions in if statements. --- tools/editor/editor_import_export.cpp | 2 +- tools/editor/editor_node.cpp | 2 +- tools/editor/io_plugins/editor_bitmask_import_plugin.cpp | 2 +- tools/editor/io_plugins/editor_sample_import_plugin.cpp | 2 +- tools/editor/io_plugins/editor_scene_import_plugin.cpp | 7 ++++--- tools/editor/plugins/baked_light_baker.cpp | 4 +--- tools/editor/plugins/shader_graph_editor_plugin.cpp | 9 +++++++-- tools/editor/spatial_editor_gizmos.cpp | 2 -- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 357d139c040..d90a1758113 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -1441,7 +1441,7 @@ bool EditorExportPlatformPC::can_export(String *r_error) const { String err; bool valid=true; - if (use64 && (!exists_export_template(debug_binary64)) || !exists_export_template(release_binary64)) { + if (use64 && (!exists_export_template(debug_binary64) || !exists_export_template(release_binary64))) { valid=false; err="No 64 bits export templates found.\nDownload and install export templates.\n"; } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 30b89cacc5a..b3de3aab1d6 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -784,7 +784,7 @@ bool EditorNode::_find_and_save_resource(RES res,Map& processed,int32_ if (changed || subchanged) { //save print_line("Also saving modified external resource: "+res->get_path()); - Error err = ResourceSaver::save(res->get_path(),res,flags); + ResourceSaver::save(res->get_path(),res,flags); } processed[res]=false; //because it's a file diff --git a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp index dca7d011ff0..757d2ed5d46 100644 --- a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp @@ -147,7 +147,7 @@ public: dst = dst.plus_file(bitmasks[i].get_file().basename() + ".pbm"); - Error err = plugin->import(dst, imd); + plugin->import(dst, imd); } hide(); diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index ac0795f522d..7dc74e58dd0 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -298,7 +298,7 @@ public: dst = dst.plus_file(samples[i].get_file().basename()+".smp"); - Error err = plugin->import(dst,imd); + plugin->import(dst,imd); } hide(); diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index fa62283e37e..190b56faba1 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1447,6 +1447,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Maphas_node(String("AnimationPlayer"))) return; - Node* n = scene->get_node(String("AnimationPlayer")); + Node* n = scene->get_node(String("AnimationPlayer")); ERR_FAIL_COND(!n); AnimationPlayer *anim = n->cast_to(); ERR_FAIL_COND(!anim); @@ -2443,7 +2444,7 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_ if (!scene->has_node(String("AnimationPlayer"))) return; - Node* n = scene->get_node(String("AnimationPlayer")); + Node* n = scene->get_node(String("AnimationPlayer")); ERR_FAIL_COND(!n); AnimationPlayer *anim = n->cast_to(); ERR_FAIL_COND(!anim); @@ -2842,7 +2843,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c } } - Error err = EditorTextureImportPlugin::get_singleton()->import(target_path,imd); + EditorTextureImportPlugin::get_singleton()->import(target_path,imd); } } diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index 6a88ba4cbe8..4e442f5b9f6 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -1177,8 +1177,6 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c diffuse_at_point.g=res_light.g*diffuse_at_point.g; diffuse_at_point.b=res_light.b*diffuse_at_point.b; - float ret=1e6; - if (p_bounces>0) { @@ -1220,7 +1218,7 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c #endif - ret=_throw_ray(thread_stack,p_bake_direct,r_point,r_point+rn*p_rest,p_rest,diffuse_at_point,p_att_curve,p_att_pos,p_att_curve_len,p_bounces-1); + _throw_ray(thread_stack,p_bake_direct,r_point,r_point+rn*p_rest,p_rest,diffuse_at_point,p_att_curve,p_att_pos,p_att_curve_len,p_bounces-1); } if (use_specular && (specular_at_point.r>CMP_EPSILON || specular_at_point.g>CMP_EPSILON || specular_at_point.b>CMP_EPSILON)) { diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 375220051c5..a59867dd08d 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -901,6 +901,7 @@ void ShaderGraphView::_variant_edited() { case Variant::COLOR: v2=Color(); break; + default: {} } UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Default Value")); @@ -1321,6 +1322,7 @@ void ShaderGraphView::_default_changed(int p_id, Node *p_button, int p_param, in h=PROPERTY_HINT_COLOR_NO_ALPHA; v=Color(); break; + default: {} } ped_popup->edit(NULL,"",vt,v,h,p_hint); @@ -1347,6 +1349,8 @@ ToolButton *ShaderGraphView::make_label(String text, Variant::Type v_type) { break; case Variant::COLOR: l->set_icon(ped_popup->get_icon("Color", "EditorIcons")); + break; + default: {} } return l; } @@ -1372,7 +1376,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int case Variant::TRANSFORM: edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons")); break; - case Variant::COLOR: + case Variant::COLOR: { Image icon_color = Image(15,15,false,Image::FORMAT_RGB); Color c = graph->default_get_value(type,p_id,param); for (int x=1;x<14;x++) @@ -1382,7 +1386,8 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int t.instance(); t->create_from_image(icon_color); edit->set_icon(t); - break; + } break; + default: {} } return edit; } diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 480d33fd0aa..84803eb6dbd 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -422,8 +422,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po if (billboard_handle) { t.set_look_at(t.origin,t.origin+p_camera->get_transform().basis.get_axis(2),p_camera->get_transform().basis.get_axis(1)); } - Transform ti=t.affine_inverse(); - float min_d=1e20; int idx=-1;