浏览代码

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.
Johan Manuel 9 年之前
父节点
当前提交
cec1c48a7e

+ 1 - 1
tools/editor/editor_import_export.cpp

@@ -1441,7 +1441,7 @@ bool EditorExportPlatformPC::can_export(String *r_error) const {
 	String err;
 	String err;
 	bool valid=true;
 	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;
 		valid=false;
 		err="No 64 bits export templates found.\nDownload and install export templates.\n";
 		err="No 64 bits export templates found.\nDownload and install export templates.\n";
 	}
 	}

+ 1 - 1
tools/editor/editor_node.cpp

@@ -784,7 +784,7 @@ bool EditorNode::_find_and_save_resource(RES res,Map<RES,bool>& processed,int32_
 		if (changed || subchanged) {
 		if (changed || subchanged) {
 			//save
 			//save
 			print_line("Also saving modified external resource: "+res->get_path());
 			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
 		processed[res]=false; //because it's a file

+ 1 - 1
tools/editor/io_plugins/editor_bitmask_import_plugin.cpp

@@ -147,7 +147,7 @@ public:
 
 
 			dst = dst.plus_file(bitmasks[i].get_file().basename() + ".pbm");
 			dst = dst.plus_file(bitmasks[i].get_file().basename() + ".pbm");
 
 
-			Error err = plugin->import(dst, imd);
+			plugin->import(dst, imd);
 		}
 		}
 
 
 		hide();
 		hide();

+ 1 - 1
tools/editor/io_plugins/editor_sample_import_plugin.cpp

@@ -298,7 +298,7 @@ public:
 
 
 			dst = dst.plus_file(samples[i].get_file().basename()+".smp");
 			dst = dst.plus_file(samples[i].get_file().basename()+".smp");
 
 
-			Error err = plugin->import(dst,imd);
+			plugin->import(dst,imd);
 		}
 		}
 
 
 		hide();
 		hide();

+ 4 - 3
tools/editor/io_plugins/editor_scene_import_plugin.cpp

@@ -1447,6 +1447,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag
 			}
 			}
 
 
 		} break;
 		} break;
+		default: {}
 
 
 	}
 	}
 
 
@@ -2325,7 +2326,7 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text)
 
 
 	if (!scene->has_node(String("AnimationPlayer")))
 	if (!scene->has_node(String("AnimationPlayer")))
 		return;
 		return;
-		Node* n = scene->get_node(String("AnimationPlayer"));
+	Node* n = scene->get_node(String("AnimationPlayer"));
 	ERR_FAIL_COND(!n);
 	ERR_FAIL_COND(!n);
 	AnimationPlayer *anim = n->cast_to<AnimationPlayer>();
 	AnimationPlayer *anim = n->cast_to<AnimationPlayer>();
 	ERR_FAIL_COND(!anim);
 	ERR_FAIL_COND(!anim);
@@ -2443,7 +2444,7 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_
 
 
 	if (!scene->has_node(String("AnimationPlayer")))
 	if (!scene->has_node(String("AnimationPlayer")))
 		return;
 		return;
-		Node* n = scene->get_node(String("AnimationPlayer"));
+	Node* n = scene->get_node(String("AnimationPlayer"));
 	ERR_FAIL_COND(!n);
 	ERR_FAIL_COND(!n);
 	AnimationPlayer *anim = n->cast_to<AnimationPlayer>();
 	AnimationPlayer *anim = n->cast_to<AnimationPlayer>();
 	ERR_FAIL_COND(!anim);
 	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);
 
 
 		}
 		}
 	}
 	}

+ 1 - 3
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.g=res_light.g*diffuse_at_point.g;
 		diffuse_at_point.b=res_light.b*diffuse_at_point.b;
 		diffuse_at_point.b=res_light.b*diffuse_at_point.b;
 
 
-		float ret=1e6;
-
 		if (p_bounces>0) {
 		if (p_bounces>0) {
 
 
 
 
@@ -1220,7 +1218,7 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c
 #endif
 #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)) {
 			if (use_specular && (specular_at_point.r>CMP_EPSILON || specular_at_point.g>CMP_EPSILON || specular_at_point.b>CMP_EPSILON)) {

+ 7 - 2
tools/editor/plugins/shader_graph_editor_plugin.cpp

@@ -901,6 +901,7 @@ void ShaderGraphView::_variant_edited() {
 			case Variant::COLOR:
 			case Variant::COLOR:
 				v2=Color();
 				v2=Color();
 				break;
 				break;
+			default: {}
 			}
 			}
 		UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
 		UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
 		ur->create_action(TTR("Change Default Value"));
 		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;
 			h=PROPERTY_HINT_COLOR_NO_ALPHA;
 			v=Color();
 			v=Color();
 			break;
 			break;
+		default: {}
 		}
 		}
 
 
 	ped_popup->edit(NULL,"",vt,v,h,p_hint);
 	ped_popup->edit(NULL,"",vt,v,h,p_hint);
@@ -1347,6 +1349,8 @@ ToolButton *ShaderGraphView::make_label(String text, Variant::Type v_type) {
 		break;
 		break;
 	case Variant::COLOR:
 	case Variant::COLOR:
 		l->set_icon(ped_popup->get_icon("Color", "EditorIcons"));
 		l->set_icon(ped_popup->get_icon("Color", "EditorIcons"));
+		break;
+	default: {}
 	}
 	}
 	return l;
 	return l;
 }
 }
@@ -1372,7 +1376,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int
 	case Variant::TRANSFORM:
 	case Variant::TRANSFORM:
 		edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons"));
 		edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons"));
 		break;
 		break;
-	case Variant::COLOR:
+	case Variant::COLOR: {
 		Image icon_color = Image(15,15,false,Image::FORMAT_RGB);
 		Image icon_color = Image(15,15,false,Image::FORMAT_RGB);
 		Color c = graph->default_get_value(type,p_id,param);
 		Color c = graph->default_get_value(type,p_id,param);
 		for (int x=1;x<14;x++)
 		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.instance();
 		t->create_from_image(icon_color);
 		t->create_from_image(icon_color);
 		edit->set_icon(t);
 		edit->set_icon(t);
-		break;
+	} break;
+	default: {}
 	}
 	}
 	return edit;
 	return edit;
 }
 }

+ 0 - 2
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) {
 		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));
 			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;
 		float min_d=1e20;
 		int idx=-1;
 		int idx=-1;