mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Fixed button flat behavior when not in normal state.
Also changed some buttons to flat mode
This commit is contained in:
		
							parent
							
								
									0afa77a8a2
								
							
						
					
					
						commit
						337c1238b9
					
				
					 3 changed files with 15 additions and 8 deletions
				
			
		|  | @ -3386,6 +3386,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { | ||||||
| 
 | 
 | ||||||
| 	key_loc_button = memnew(Button("loc")); | 	key_loc_button = memnew(Button("loc")); | ||||||
| 	key_loc_button->set_toggle_mode(true); | 	key_loc_button->set_toggle_mode(true); | ||||||
|  | 	key_loc_button->set_flat(true); | ||||||
| 	key_loc_button->set_pressed(true); | 	key_loc_button->set_pressed(true); | ||||||
| 	key_loc_button->set_focus_mode(FOCUS_NONE); | 	key_loc_button->set_focus_mode(FOCUS_NONE); | ||||||
| 	key_loc_button->add_color_override("font_color", Color(1, 0.6, 0.6)); | 	key_loc_button->add_color_override("font_color", Color(1, 0.6, 0.6)); | ||||||
|  | @ -3394,6 +3395,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { | ||||||
| 	animation_hb->add_child(key_loc_button); | 	animation_hb->add_child(key_loc_button); | ||||||
| 	key_rot_button = memnew(Button("rot")); | 	key_rot_button = memnew(Button("rot")); | ||||||
| 	key_rot_button->set_toggle_mode(true); | 	key_rot_button->set_toggle_mode(true); | ||||||
|  | 	key_rot_button->set_flat(true); | ||||||
| 	key_rot_button->set_pressed(true); | 	key_rot_button->set_pressed(true); | ||||||
| 	key_rot_button->set_focus_mode(FOCUS_NONE); | 	key_rot_button->set_focus_mode(FOCUS_NONE); | ||||||
| 	key_rot_button->add_color_override("font_color", Color(1, 0.6, 0.6)); | 	key_rot_button->add_color_override("font_color", Color(1, 0.6, 0.6)); | ||||||
|  | @ -3402,12 +3404,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { | ||||||
| 	animation_hb->add_child(key_rot_button); | 	animation_hb->add_child(key_rot_button); | ||||||
| 	key_scale_button = memnew(Button("scl")); | 	key_scale_button = memnew(Button("scl")); | ||||||
| 	key_scale_button->set_toggle_mode(true); | 	key_scale_button->set_toggle_mode(true); | ||||||
|  | 	key_scale_button->set_flat(true); | ||||||
| 	key_scale_button->set_focus_mode(FOCUS_NONE); | 	key_scale_button->set_focus_mode(FOCUS_NONE); | ||||||
| 	key_scale_button->add_color_override("font_color", Color(1, 0.6, 0.6)); | 	key_scale_button->add_color_override("font_color", Color(1, 0.6, 0.6)); | ||||||
| 	key_scale_button->add_color_override("font_color_pressed", Color(0.6, 1, 0.6)); | 	key_scale_button->add_color_override("font_color_pressed", Color(0.6, 1, 0.6)); | ||||||
| 	key_scale_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_SCALE)); | 	key_scale_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_SCALE)); | ||||||
| 	animation_hb->add_child(key_scale_button); | 	animation_hb->add_child(key_scale_button); | ||||||
| 	key_insert_button = memnew(Button); | 	key_insert_button = memnew(Button); | ||||||
|  | 	key_insert_button->set_flat(true); | ||||||
| 	key_insert_button->set_focus_mode(FOCUS_NONE); | 	key_insert_button->set_focus_mode(FOCUS_NONE); | ||||||
| 	key_insert_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_KEY)); | 	key_insert_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_KEY)); | ||||||
| 	key_insert_button->set_tooltip(TTR("Insert Keys")); | 	key_insert_button->set_tooltip(TTR("Insert Keys")); | ||||||
|  |  | ||||||
|  | @ -1625,24 +1625,24 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { | ||||||
| 
 | 
 | ||||||
| 		hbc->add_child(memnew(VSeparator)); | 		hbc->add_child(memnew(VSeparator)); | ||||||
| 
 | 
 | ||||||
| 		step = memnew(Button); | 		step = memnew(ToolButton); | ||||||
| 		hbc->add_child(step); | 		hbc->add_child(step); | ||||||
| 		step->set_tooltip(TTR("Step Into")); | 		step->set_tooltip(TTR("Step Into")); | ||||||
| 		step->connect("pressed", this, "debug_step"); | 		step->connect("pressed", this, "debug_step"); | ||||||
| 
 | 
 | ||||||
| 		next = memnew(Button); | 		next = memnew(ToolButton); | ||||||
| 		hbc->add_child(next); | 		hbc->add_child(next); | ||||||
| 		next->set_tooltip(TTR("Step Over")); | 		next->set_tooltip(TTR("Step Over")); | ||||||
| 		next->connect("pressed", this, "debug_next"); | 		next->connect("pressed", this, "debug_next"); | ||||||
| 
 | 
 | ||||||
| 		hbc->add_child(memnew(VSeparator)); | 		hbc->add_child(memnew(VSeparator)); | ||||||
| 
 | 
 | ||||||
| 		dobreak = memnew(Button); | 		dobreak = memnew(ToolButton); | ||||||
| 		hbc->add_child(dobreak); | 		hbc->add_child(dobreak); | ||||||
| 		dobreak->set_tooltip(TTR("Break")); | 		dobreak->set_tooltip(TTR("Break")); | ||||||
| 		dobreak->connect("pressed", this, "debug_break"); | 		dobreak->connect("pressed", this, "debug_break"); | ||||||
| 
 | 
 | ||||||
| 		docontinue = memnew(Button); | 		docontinue = memnew(ToolButton); | ||||||
| 		hbc->add_child(docontinue); | 		hbc->add_child(docontinue); | ||||||
| 		docontinue->set_tooltip(TTR("Continue")); | 		docontinue->set_tooltip(TTR("Continue")); | ||||||
| 		docontinue->connect("pressed", this, "debug_continue"); | 		docontinue->connect("pressed", this, "debug_continue"); | ||||||
|  | @ -1816,7 +1816,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { | ||||||
| 		vmem_total->set_editable(false); | 		vmem_total->set_editable(false); | ||||||
| 		vmem_total->set_custom_minimum_size(Size2(100, 1) * EDSCALE); | 		vmem_total->set_custom_minimum_size(Size2(100, 1) * EDSCALE); | ||||||
| 		vmem_hb->add_child(vmem_total); | 		vmem_hb->add_child(vmem_total); | ||||||
| 		vmem_refresh = memnew(Button); | 		vmem_refresh = memnew(ToolButton); | ||||||
| 		vmem_hb->add_child(vmem_refresh); | 		vmem_hb->add_child(vmem_refresh); | ||||||
| 		vmem_vb->add_child(vmem_hb); | 		vmem_vb->add_child(vmem_hb); | ||||||
| 		vmem_refresh->connect("pressed", this, "_video_mem_request"); | 		vmem_refresh->connect("pressed", this, "_video_mem_request"); | ||||||
|  |  | ||||||
|  | @ -89,7 +89,8 @@ void Button::_notification(int p_what) { | ||||||
| 			case DRAW_PRESSED: { | 			case DRAW_PRESSED: { | ||||||
| 
 | 
 | ||||||
| 				style = get_stylebox("pressed"); | 				style = get_stylebox("pressed"); | ||||||
| 				style->draw(ci, Rect2(Point2(0, 0), size)); | 				if (!flat) | ||||||
|  | 					style->draw(ci, Rect2(Point2(0, 0), size)); | ||||||
| 				if (has_color("font_color_pressed")) | 				if (has_color("font_color_pressed")) | ||||||
| 					color = get_color("font_color_pressed"); | 					color = get_color("font_color_pressed"); | ||||||
| 				else | 				else | ||||||
|  | @ -101,7 +102,8 @@ void Button::_notification(int p_what) { | ||||||
| 			case DRAW_HOVER: { | 			case DRAW_HOVER: { | ||||||
| 
 | 
 | ||||||
| 				style = get_stylebox("hover"); | 				style = get_stylebox("hover"); | ||||||
| 				style->draw(ci, Rect2(Point2(0, 0), size)); | 				if (!flat) | ||||||
|  | 					style->draw(ci, Rect2(Point2(0, 0), size)); | ||||||
| 				color = get_color("font_color_hover"); | 				color = get_color("font_color_hover"); | ||||||
| 				if (has_color("icon_color_hover")) | 				if (has_color("icon_color_hover")) | ||||||
| 					color_icon = get_color("icon_color_hover"); | 					color_icon = get_color("icon_color_hover"); | ||||||
|  | @ -110,7 +112,8 @@ void Button::_notification(int p_what) { | ||||||
| 			case DRAW_DISABLED: { | 			case DRAW_DISABLED: { | ||||||
| 
 | 
 | ||||||
| 				style = get_stylebox("disabled"); | 				style = get_stylebox("disabled"); | ||||||
| 				style->draw(ci, Rect2(Point2(0, 0), size)); | 				if (!flat) | ||||||
|  | 					style->draw(ci, Rect2(Point2(0, 0), size)); | ||||||
| 				color = get_color("font_color_disabled"); | 				color = get_color("font_color_disabled"); | ||||||
| 				if (has_color("icon_color_disabled")) | 				if (has_color("icon_color_disabled")) | ||||||
| 					color_icon = get_color("icon_color_disabled"); | 					color_icon = get_color("icon_color_disabled"); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Daniel J. Ramirez
						Daniel J. Ramirez