浏览代码

Remove unused variables (third pass) + dead code

Fixes various gcc 5.4.0 warnings for -Wunused-variable and -Wunused-but-set-variable
Rémi Verschelde 9 年之前
父节点
当前提交
454b210242

+ 0 - 2
scene/gui/dialogs.cpp

@@ -62,7 +62,6 @@ void WindowDialog::_input_event(const InputEvent& p_event) {
 
 		Point2 rel( p_event.mouse_motion.relative_x, p_event.mouse_motion.relative_y );
 		Point2 pos = get_pos();
-		Size2 size = get_size();
 
 		pos+=rel;
 
@@ -409,7 +408,6 @@ AcceptDialog::AcceptDialog() {
 	ok->set_text(RTR("OK"));
 	hbc->add_child(ok);
 	hbc->add_spacer();
-	//add_child(ok);
 
 
 	ok->connect("pressed", this,"_ok");

+ 0 - 1
scene/gui/graph_edit.cpp

@@ -774,7 +774,6 @@ void GraphEdit::set_zoom(float p_zoom) {
 
 	Vector2 sbofs = (Vector2( h_scroll->get_val(), v_scroll->get_val() ) + get_size()/2)/zoom;
 
-	float prev_zoom = zoom;
 	zoom = p_zoom;
 	top_layer->update();
 

+ 0 - 1
scene/gui/label.cpp

@@ -144,7 +144,6 @@ void Label::_notification(int p_what) {
 		if (!wc)
 			return;
 
-		int c = 0;
 		int line=0;
 		int line_to=lines_skipped + (lines_visible>0?lines_visible:1);
 		while(wc) {

+ 0 - 5
scene/gui/line_edit.cpp

@@ -980,10 +980,6 @@ void LineEdit::set_cursor_pos(int p_pos) {
 
 	cursor_pos=p_pos;
 
-//	if (cursor_pos>(window_pos+get_window_length())) {
-//	set_window_pos(cursor_pos-get_window_lengt//h());
-//	}
-
 	if (!is_inside_tree()) {
 
 		window_pos=cursor_pos;
@@ -1002,7 +998,6 @@ void LineEdit::set_cursor_pos(int p_pos) {
 
 		if (window_width<0)
 			return;
-		int width_to_cursor=0;
 		int wp=window_pos;
 
 		if (font.is_valid()) {

+ 0 - 2
scene/gui/progress_bar.cpp

@@ -51,7 +51,6 @@ void ProgressBar::_notification(int p_what) {
 		Ref<StyleBox> fg = get_stylebox("fg");
 		Ref<Font> font = get_font("font");
 		Color font_color=get_color("font_color");
-		Color font_color_shadow=get_color("font_color_shadow");
 
 		draw_style_box(bg,Rect2(Point2(),get_size()));
 		float r = get_unit_value();
@@ -63,7 +62,6 @@ void ProgressBar::_notification(int p_what) {
 		}
 
 		if (percent_visible) {
-			int fh=font->get_height();
 			String txt=itos(int(get_unit_value()*100))+"%";
 			font->draw_halign(get_canvas_item(),Point2(0,font->get_ascent()+(get_size().height-font->get_height())/2),HALIGN_CENTER,get_size().width,txt,font_color);
 		}

+ 1 - 65
scene/gui/rich_text_label.cpp

@@ -270,7 +270,6 @@ if (m_height > line_height) {\
 					if (p_mode!=PROCESS_CACHE) {
 						lh=line<l.height_caches.size()?l.height_caches[line]:1;
 					}
-					bool found_space=false;
 
 					while (c[end]!=0 && !(end && c[end-1]==' ' && c[end]!=' ')) {
 
@@ -284,30 +283,13 @@ if (m_height > line_height) {\
 						}
 
 						w+=cw;
-
-						if (c[end]==' ') {
-
-							fw+=cw;
-							/*
-							if (p_mode==PROCESS_CACHE) {
-								fw+=cw;
-							} else if (align==ALIGN_FILL && line<l.space_caches.size() && l.space_caches[line]>0) {
-								//print_line(String(c,end)+": "+itos(l.offset_caches[line])+"/"+itos(l.space_caches[line]));
-								//sub_space=cw;
-								found_space=true;
-							} else {
-								fw+=cw;
-							}*/
-						} else {
-							fw+=cw;
-						}
+						fw+=cw;
 
 						end++;
 					}
 
 					ENSURE_WIDTH(w);
 
-					//print_line("END: "+String::chr(c[end])+".");
 					if (end && c[end-1]==' ') {
 						if (p_mode==PROCESS_CACHE) {
 							spaces_size+=font->get_char_size(' ').width;
@@ -319,27 +301,17 @@ if (m_height > line_height) {\
 						}
 						spaces++;
 
-						/*
-						if (found_space) {
-							int ln = MIN(l.offset_caches.size()-1,line);
-
-							fw+=l.offset_caches[ln]/l.space_caches[ln];
-						}*/
-
 					}
 
 
 					{
 
-
 						int ofs=0;
 
 						for(int i=0;i<end;i++) {
 							int pofs=wofs+ofs;
 
 
-
-
 							if (p_mode==PROCESS_POINTER && r_click_char && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh) {
 								//int o = (wofs+w)-p_click_pos.x;
 
@@ -354,15 +326,6 @@ if (m_height > line_height) {\
 								if (p_click_pos.x-cw/2>p_ofs.x+align_ofs+pofs) {
 
 									rchar=int((&c[i])-cf);
-									//print_line("GOT: "+itos(rchar));
-
-
-									//if (i==end-1 && p_click_pos.x+cw/2 > pofs)
-									//	rchar++;
-									//int o = (wofs+w)-p_click_pos.x;
-
-								//	if (o>cw/2)
-								//		rchar++;
 								}
 
 
@@ -402,12 +365,9 @@ if (m_height > line_height) {\
 								}
 
 
-								//print_line("draw char: "+String::chr(c[i]));
-
 								if (underline) {
 									Color uc=color;
 									uc.a*=0.5;
-									//VS::get_singleton()->canvas_item_add_line(ci,Point2(pofs,y+ascent+2),Point2(pofs+cw,y+ascent+2),uc);
 									int uy = y+lh-fh+ascent+2;
 									VS::get_singleton()->canvas_item_add_line(ci,p_ofs+Point2(align_ofs+pofs,uy),p_ofs+Point2(align_ofs+pofs+cw,uy),uc);
 								}
@@ -462,28 +422,6 @@ if (m_height > line_height) {\
 				if (p_mode!=PROCESS_CACHE)
 					lh = line<l.height_caches.size()?l.height_caches[line]:1;
 
-
-#if 0
-				if (p_mode==PROCESS_POINTER && r_click_item ) {
-					//previous last "wrapped" line
-					int pl = line-1;
-					if (pl<0 || lines[pl].height_caches.size()==0)
-						break;
-					int py=lines[pl].offset_caches[ lines[pl].offset_caches.size() -1 ];
-					int ph=lines[pl].height_caches[ lines[pl].height_caches.size() -1 ];
-					print_line("py: "+itos(py));
-					print_line("ph: "+itos(ph));
-
-					rchar=0;
-					if (p_click_pos.y>=py && p_click_pos.y<=py+ph) {
-						if (r_outside) *r_outside=true;
-						*r_click_item=it;
-						*r_click_char=rchar;
-						return;
-					}
-				}
-
-#endif
 			} break;
 			case ITEM_TABLE: {
 
@@ -493,7 +431,6 @@ if (m_height > line_height) {\
 				int vseparation=get_constant("table_vseparation");
 				Color ccolor = _find_color(table,p_base_color);
 				Vector2 draw_ofs = Point2(wofs,y);
-				int max_y=get_size().height;
 
 				if (p_mode==PROCESS_CACHE) {
 
@@ -1825,7 +1762,6 @@ bool RichTextLabel::search(const String& p_string,bool p_from_selection) {
 		charidx=selection.to_char+1;
 	}
 
-	int line=-1;
 	while(it) {
 
 		if (it->type==ITEM_TEXT) {

+ 0 - 1
scene/gui/scroll_container.cpp

@@ -177,7 +177,6 @@ void ScrollContainer::_input_event(const InputEvent& p_input_event) {
 
 void ScrollContainer::_update_scrollbar_pos() {
 
-	Size2 size = get_size();
 	Size2 hmin = h_scroll->get_combined_minimum_size();
 	Size2 vmin = v_scroll->get_combined_minimum_size();
 

+ 0 - 31
scene/gui/tab_container.cpp

@@ -40,8 +40,6 @@ int TabContainer::_get_top_margin() const {
 
 	int h = MAX( tab_bg->get_minimum_size().height,tab_fg->get_minimum_size().height);
 
-//	h+=MIN( get_constant("label_valign_fg"), get_constant("label_valign_bg") );
-
 	int ch = font->get_height();;
 	for(int i=0;i<get_child_count();i++) {
 
@@ -207,9 +205,7 @@ void TabContainer::_notification(int p_what) {
 			Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
 			Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
 			Ref<Texture> incr = get_icon("increment");
-			Ref<Texture> incr_hl = get_icon("increment_hilite");
 			Ref<Texture> decr = get_icon("decrement");
-			Ref<Texture> decr_hl = get_icon("decrement_hilite");
 			Ref<Texture> menu = get_icon("menu");
 			Ref<Texture> menu_hl = get_icon("menu_hl");
 			Ref<Font> font = get_font("font");
@@ -219,9 +215,6 @@ void TabContainer::_notification(int p_what) {
 			int side_margin = get_constant("side_margin");
 			int top_margin = _get_top_margin();
 
-			int label_valign_fg = get_constant("label_valign_fg");
-			int label_valign_bg = get_constant("label_valign_bg");
-
 
 			Size2 top_size = Size2( size.width, top_margin );
 
@@ -338,17 +331,14 @@ void TabContainer::_notification(int p_what) {
 
 
 				Ref<StyleBox> sb;
-				int va;
 				Color col;
 
 				if (idx==current) {
 
 					sb=tab_fg;
-					va=label_valign_fg;
 					col=color_fg;
 				} else {
 					sb=tab_bg;
-					va=label_valign_bg;
 					col=color_bg;
 				}
 
@@ -371,23 +361,7 @@ void TabContainer::_notification(int p_what) {
 				}
 
 				font->draw(ci, Point2i( lpos.x, sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-font->get_height())/2+font->get_ascent() ), s, col );
-				//ofs+=sb_ms.x+w;
-
-				/*
-				int sb_mw = sb->get_minimum_size().width;
-				int font_ofs = sb_mw / 2;
-
-				Rect2i rect =Rect2( ofs, 0, w+sb_mw, top_margin);
 
-				rect.size
-				sb->draw(ci,rect);
-				rect.y+=va;
-				rect.height+=va;
-				int font_y = (rect.height - font->get_height())/2;
-
-				font->draw(ci, Point2( ofs+font_ofs, va+font_y ), s, col );
-
-*/
 				idx++;
 			}
 
@@ -477,7 +451,6 @@ void TabContainer::set_current_tab(int p_current) {
 
 	ERR_FAIL_INDEX( p_current, get_tab_count() );
 
-    //printf("DEBUG %p: set_current_tab to %i\n", this, p_current);
 	current=p_current;
 
 	int idx=0;
@@ -560,7 +533,6 @@ Control* TabContainer::get_current_tab_control() const {
 void TabContainer::remove_child_notify(Node *p_child) {
 
 	int tc = get_tab_count();
-//	bool set_curent=false;
 	if (current==tc-1) {
 		current--;
 		if (current<0)
@@ -705,9 +677,6 @@ Size2 TabContainer::get_minimum_size() const {
 		if (c->is_set_as_toplevel())
 			continue;
 
-		//if (!c->has_meta("_tab_name"))
-		//	continue;
-
 		if (!c->is_visible())
 			continue;
 

+ 0 - 1
scene/gui/text_edit.cpp

@@ -4137,7 +4137,6 @@ void TextEdit::_update_completion_candidates() {
 	completion_options.clear();
 	completion_index=0;
 	completion_base=s;
-	int ci_match=0;
 	Vector<float> sim_cache;
 	for(int i=0;i<completion_strings.size();i++) {
 		if (s == completion_strings[i]) {

+ 0 - 3
scene/gui/texture_button.cpp

@@ -76,10 +76,7 @@ void TextureButton::_notification(int p_what) {
 	switch( p_what ) {
 
 		case NOTIFICATION_DRAW: {
-			RID canvas_item = get_canvas_item();
 			DrawMode draw_mode = get_draw_mode();
-//			if (normal.is_null())
-//				break;
 
 			Ref<Texture> texdraw;
 

+ 0 - 20
scene/gui/texture_frame.cpp

@@ -37,9 +37,6 @@ void TextureFrame::_notification(int p_what) {
 			return;
 
 
-
-		RID ci = get_canvas_item();
-
 		switch(stretch_mode) {
 			case STRETCH_SCALE_ON_EXPAND: {
 				Size2 s=expand?get_size():texture->get_size();
@@ -85,23 +82,6 @@ void TextureFrame::_notification(int p_what) {
 
 		}
 
-
-/*
-		Vector<Point2> points;
-		points.resize(4);
-		points[0]=Point2(0,0);
-		points[1]=Point2(s.x,0);
-		points[2]=Point2(s.x,s.y);
-		points[3]=Point2(0,s.y);
-		Vector<Point2> uvs;
-		uvs.resize(4);
-		uvs[0]=Point2(0,0);
-		uvs[1]=Point2(1,0);
-		uvs[2]=Point2(1,1);
-		uvs[3]=Point2(0,1);
-
-		VisualServer::get_singleton()->canvas_item_add_primitive(ci,points,Vector<Color>(),uvs,texture->get_rid());
-*/
 	}
 }
 

+ 0 - 15
scene/gui/tree.cpp

@@ -973,22 +973,12 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
 
 	/* Draw label, if height fits */
 
-	Point2i guide_from;
 
 		bool skip=(p_item==root && hide_root);
-   // printf("skip (%p == %p && %i) %i\n",p_item,root,hide_root,skip);
 
 
 	if (!skip && (p_pos.y+label_h-cache.offset.y)>0) {
 
-	  //  printf("entering\n");
-
-		int height=label_h;
-
-		Point2i guide_space=Point2i( cache.guide_width , height );
-
-
-
 		if (!hide_folding && p_item->childs) { //has childs, draw the guide box
 
 			Ref<Texture> arrow;
@@ -1660,7 +1650,6 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
 		/* editing */
 
 		bool bring_up_editor=force_select_on_already_selected ? (c.selected && already_selected) : c.selected;
-		bool bring_up_value_editor=false;
 		String editor_text=c.text;
 
 		switch (c.mode) {
@@ -1711,9 +1700,6 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
 					bring_up_editor=false;
 				} else {
 
-					Ref<Texture> updown = cache.updown;
-
-
 					if (x >= (col_width-item_h/2)) {
 
 						/* touching the combo */
@@ -1760,7 +1746,6 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
 					}  else {
 
 						editor_text=String::num( p_item->cells[col].val, Math::decimals( p_item->cells[col].step ) );
-						bring_up_value_editor=false;
 						if (select_mode==SELECT_MULTI && get_tree()->get_last_event_id() == focus_in_id)
 							bring_up_editor=false;
 

+ 0 - 10
scene/gui/video_player.cpp

@@ -116,7 +116,6 @@ void VideoPlayer::_notification(int p_notification) {
 
 		case NOTIFICATION_ENTER_TREE: {
 
-			//set_idle_process(false); //don't annoy
 			if (stream.is_valid() && autoplay && !get_tree()->is_editor_hint()) {
 				play();
 			}
@@ -141,13 +140,6 @@ void VideoPlayer::_notification(int p_notification) {
 
 			playback->update(delta);
 
-			/*int prev_width = texture->get_width();
-			stream->pop_frame(texture);
-			if (prev_width == 0) {
-				update();
-				minimum_size_changed();
-			};*/
-
 		} break;
 
 		case NOTIFICATION_DRAW: {
@@ -158,8 +150,6 @@ void VideoPlayer::_notification(int p_notification) {
 				return;
 
 			Size2 s=expand?get_size():texture->get_size();
-			RID ci = get_canvas_item();
-			printf("drawing with size %f, %f\n", s.x, s.y);
 			draw_texture_rect(texture,Rect2(Point2(),s),false);
 
 		} break;

+ 0 - 1
scene/main/node.cpp

@@ -1206,7 +1206,6 @@ void Node::add_to_group(const StringName& p_identifier,bool p_persistent) {
 
 	GroupData gd;
 
-	SceneTree::Group *gptr=NULL;
 	if (data.tree) {
 		gd.group=data.tree->add_to_group(p_identifier,this);
 	} else {

+ 0 - 7
tools/collada/collada.cpp

@@ -681,9 +681,6 @@ void Collada::_parse_effect_material(XMLParser& parser,Effect &effect,String &id
 											} else {
 												String uri = effect.params[surface];
 
-												int channel=0;
-												//if (parser.has_attribute("texcoord"))
-
 
 												if (what=="diffuse") {
 													effect.diffuse.texture=uri;
@@ -759,9 +756,6 @@ void Collada::_parse_effect_material(XMLParser& parser,Effect &effect,String &id
 								} else {
 									String uri = effect.params[surface];
 
-									int channel=0;
-									//if (parser.has_attribute("texcoord"))
-
 									if (parser.has_attribute("bumptype") && parser.get_attribute_value("bumptype")!="NORMALMAP") {
 										WARN_PRINT("'bump' texture type is not NORMALMAP, only NORMALMAP is supported.")
 									}
@@ -2636,7 +2630,6 @@ void Collada::_find_morph_nodes(VisualScene *p_vscene,Node *p_node) {
 					base=sk.base;
 				} else if (state.morph_controller_data_map.has(base)) {
 
-					MorphControllerData &sk = state.morph_controller_data_map[base];
 					state.morph_ownership_map[base]=nj->id;
 					break;
 				} else {

+ 1 - 5
tools/editor/io_plugins/editor_atlas.cpp

@@ -82,7 +82,6 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
 
 		//place them
 		int ofs=0;
-		int limit_h=0;
 
 		for(int j=0;j<wrects.size();j++) {
 
@@ -106,8 +105,6 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
 
 			int end_h = from_y+wrects[j].s.height;
 			int end_w = ofs+wrects[j].s.width;
-			if (ofs==0)
-				limit_h=end_h;
 
 			for(int k=0;k<wrects[j].s.width;k++) {
 
@@ -120,8 +117,7 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
 			if (end_w > max_w)
 				max_w=end_w;
 
-			//if (ofs==0 || end_h>limit_h ) //while h limit not reched, keep stacking
-				ofs+=wrects[j].s.width;
+			ofs+=wrects[j].s.width;
 
 		}
 

+ 0 - 6
tools/editor/io_plugins/editor_import_collada.cpp

@@ -2278,12 +2278,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
 		NodeMap &nm = node_map[at.target];
 		String path = scene->get_path_to(nm.node);
 
-		Collada::Node *cn = collada.state.scene_map[at.target];
-		//if (cn->ignore_anim) {
-		//	print_line("warning, ignoring property animation on node: "+nm.path);
-			//continue;
-		//}
-
 		animation->add_track(Animation::TYPE_VALUE);
 		int track = animation->get_track_count() -1;
 

+ 1 - 9
tools/editor/io_plugins/editor_scene_import_plugin.cpp

@@ -2680,12 +2680,6 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
 	progress.step(TTR("Importing Scene.."),2);
 
 
-	bool reimport = bool(from->get_option("reimport"));
-	int this_time_action = from->get_option("import_this_time");
-	int next_time_action = from->get_option("import_next_time");
-
-	int import_action = reimport?this_time_action:next_time_action;
-
 	from->set_source_md5(0,FileAccess::get_md5(src_path));
 	from->set_editor(get_name());
 
@@ -2694,8 +2688,6 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
 
 	Map<Ref<Mesh>,Ref<Shape> > collision_map;
 
-	Ref<ResourceImportMetadata> imd = memnew(ResourceImportMetadata);
-
 	Map< Ref<ImageTexture>,TextureRole > imagemap;
 
 	scene=_fix_node(scene,scene,collision_map,scene_flags,imagemap);
@@ -2811,7 +2803,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
 			target_path=target_path.basename()+".tex";
 
 			Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
-			print_line("flags: "+itos(image_flags));
+
 			uint32_t flags = image_flags;
 			if (E->get()==TEXTURE_ROLE_DIFFUSE && scene_flags&SCENE_FLAG_LINEARIZE_DIFFUSE_TEXTURES)
 				flags|=EditorTextureImportPlugin::IMAGE_FLAG_CONVERT_TO_LINEAR;

+ 0 - 4
tools/editor/io_plugins/editor_texture_import_plugin.cpp

@@ -1192,8 +1192,6 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
 		}
 		ep.step(TTR("Converting Images"),sources.size());
 
-		int base_index=0;
-
 
 		Map<uint64_t,int> source_md5;
 		Map<int,List<int> > source_map;
@@ -1760,7 +1758,6 @@ void EditorTextureImportPlugin::reimport_multiple_files(const Vector<String>& p_
 	Vector<String> valid;
 
 
-	bool warning=false;
 	for(int i=0;i<p_list.size();i++) {
 
 		Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_list[i]);
@@ -1768,7 +1765,6 @@ void EditorTextureImportPlugin::reimport_multiple_files(const Vector<String>& p_
 		if (type=="texture" || type.begins_with("texture_")) {
 
 			if ((rimd->has_option("atlas") && rimd->get_option("atlas")) || (rimd->has_option("large") && rimd->get_option("large"))) {
-				warning=true;
 				continue;
 			}
 

+ 0 - 2
tools/editor/io_plugins/editor_translation_import_plugin.cpp

@@ -425,7 +425,6 @@ Error EditorTranslationImportPlugin::import(const String& p_path, const Ref<Reso
 
 	ERR_FAIL_COND_V( !f, ERR_INVALID_PARAMETER );
 
-	bool first=false;
 	bool skip_first = from->get_option("skip_first");
 	int index = from->get_option("index");
 	index+=1;
@@ -439,7 +438,6 @@ Error EditorTranslationImportPlugin::import(const String& p_path, const Ref<Reso
 
 	while(line.size()>1) {
 
-
 		if (!skip_first) {
 			ERR_FAIL_INDEX_V(index,line.size(),ERR_INVALID_DATA );
 			translation->add_message(line[0].strip_edges(),line[index]);