Pārlūkot izejas kodu

-Fixed focus for shader editor when switching tab, closes #2551

Juan Linietsky 9 gadi atpakaļ
vecāks
revīzija
8dad6415b1
1 mainītis faili ar 2 papildinājumiem un 5 dzēšanām
  1. 2 5
      tools/editor/plugins/shader_editor_plugin.cpp

+ 2 - 5
tools/editor/plugins/shader_editor_plugin.cpp

@@ -172,11 +172,8 @@ ShaderTextEditor::ShaderTextEditor() {
 
 
 void ShaderEditor::_menu_option(int p_option) {
 void ShaderEditor::_menu_option(int p_option) {
 
 
-	int selected = tab_container->get_current_tab();
-	if (selected<0 || selected>=tab_container->get_child_count())
-		return;
 
 
-	ShaderTextEditor *current = tab_container->get_child(selected)->cast_to<ShaderTextEditor>();
+	ShaderTextEditor *current = tab_container->get_current_tab_control()->cast_to<ShaderTextEditor>();
 	if (!current)
 	if (!current)
 		return;
 		return;
 
 
@@ -235,7 +232,7 @@ void ShaderEditor::_menu_option(int p_option) {
 
 
 void ShaderEditor::_tab_changed(int p_which) {
 void ShaderEditor::_tab_changed(int p_which) {
 
 
-	ShaderTextEditor *shader_editor = tab_container->get_child(p_which)->cast_to<ShaderTextEditor>();
+	ShaderTextEditor *shader_editor = tab_container->get_tab_control(p_which)->cast_to<ShaderTextEditor>();
 
 
 	if (shader_editor)
 	if (shader_editor)
 		shader_editor->get_text_edit()->grab_focus();
 		shader_editor->get_text_edit()->grab_focus();