Ver Fonte

Merge pull request #8971 from noshyaar/pr-help

EditorHelp: Help>Class now switch to script editor
Andreas Haas há 8 anos atrás
pai
commit
d58a58402e
2 ficheiros alterados com 4 adições e 10 exclusões
  1. 4 8
      editor/editor_help.cpp
  2. 0 2
      editor/editor_help.h

+ 4 - 8
editor/editor_help.cpp

@@ -253,7 +253,7 @@ void EditorHelpSearch::_confirmed() {
 
 	String mdata = ti->get_metadata(0);
 	emit_signal("go_to_help", mdata);
-	editor->call("_editor_select", EditorNode::EDITOR_SCRIPT); // in case EditorHelpSearch beeen invoked on top of other editor window
+	EditorNode::get_singleton()->call("_editor_select", EditorNode::EDITOR_SCRIPT); // in case EditorHelpSearch beeen invoked on top of other editor window
 	// go to that
 	hide();
 }
@@ -288,7 +288,6 @@ void EditorHelpSearch::_bind_methods() {
 
 EditorHelpSearch::EditorHelpSearch() {
 
-	editor = EditorNode::get_singleton();
 	VBoxContainer *vbc = memnew(VBoxContainer);
 	add_child(vbc);
 
@@ -363,7 +362,7 @@ void EditorHelpIndex::_tree_item_selected() {
 		return;
 
 	emit_signal("open_class", s->get_text(0));
-
+	EditorNode::get_singleton()->call("_editor_select", EditorNode::EDITOR_SCRIPT);
 	hide();
 
 	//_goto_desc(s->get_text(0));
@@ -371,12 +370,11 @@ void EditorHelpIndex::_tree_item_selected() {
 
 void EditorHelpIndex::select_class(const String &p_class) {
 
-	EditorNode *editor = EditorNode::get_singleton();
 	if (!tree_item_map.has(p_class))
 		return;
 	tree_item_map[p_class]->select(0);
 	class_list->ensure_cursor_is_visible();
-	editor->call("_editor_select", EditorNode::EDITOR_SCRIPT); // in case EditorHelpIndex beeen invoked on top of other editor window
+	EditorNode::get_singleton()->call("_editor_select", EditorNode::EDITOR_SCRIPT); // in case EditorHelpIndex beeen invoked on top of other editor window
 }
 
 void EditorHelpIndex::popup() {
@@ -1281,7 +1279,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
 void EditorHelp::_request_help(const String &p_string) {
 	Error err = _goto_desc(p_string);
 	if (err == OK) {
-		editor->call("_editor_select", EditorNode::EDITOR_SCRIPT);
+		EditorNode::get_singleton()->call("_editor_select", EditorNode::EDITOR_SCRIPT);
 	}
 	//100 palabras
 }
@@ -1691,8 +1689,6 @@ void EditorHelp::_bind_methods() {
 
 EditorHelp::EditorHelp() {
 
-	editor = EditorNode::get_singleton();
-
 	VBoxContainer *vbc = this;
 
 	EDITOR_DEF("text_editor/help/sort_functions_alphabetically", true);

+ 0 - 2
editor/editor_help.h

@@ -49,7 +49,6 @@ class EditorHelpSearch : public ConfirmationDialog {
 
 	GDCLASS(EditorHelpSearch, ConfirmationDialog)
 
-	EditorNode *editor;
 	LineEdit *search_box;
 	Tree *search_options;
 	String base_type;
@@ -119,7 +118,6 @@ class EditorHelp : public VBoxContainer {
 
 	String edited_class;
 
-	EditorNode *editor;
 	Map<String, int> method_line;
 	Map<String, int> signal_line;
 	Map<String, int> property_line;