Browse Source

-Merged Script and Help tabs
-Help tabs can be opened many at the same time
-Color temperatures for opened scripts
-Dominant script opening when switching scene tab

Juan Linietsky 9 years ago
parent
commit
081a236c67

+ 15 - 9
drivers/theora/video_stream_theora.cpp

@@ -243,7 +243,9 @@ void VideoStreamPlaybackTheora::set_file(const String& p_file) {
 	/* Only interested in Vorbis/Theora streams */
 	/* Only interested in Vorbis/Theora streams */
 	int stateflag = 0;
 	int stateflag = 0;
 
 
-    int audio_track_skip=audio_track;
+	int audio_track_skip=audio_track;
+
+
 	while(!stateflag){
 	while(!stateflag){
 		int ret=buffer_data();
 		int ret=buffer_data();
 		if(ret==0)break;
 		if(ret==0)break;
@@ -270,14 +272,18 @@ void VideoStreamPlaybackTheora::set_file(const String& p_file) {
 				theora_p=1;
 				theora_p=1;
 			}else if(!vorbis_p && vorbis_synthesis_headerin(&vi,&vc,&op)>=0){
 			}else if(!vorbis_p && vorbis_synthesis_headerin(&vi,&vc,&op)>=0){
 				/* it is vorbis */
 				/* it is vorbis */
-		if (audio_track_skip) {
-		    vorbis_info_clear(&vi);
-		    vorbis_comment_clear(&vc);
-		    audio_track_skip--;
-		} else {
-		    copymem(&vo,&test,sizeof(test));
-		    vorbis_p=1;
-		}
+				if (audio_track_skip) {
+					vorbis_info_clear(&vi);
+					vorbis_comment_clear(&vc);
+					ogg_stream_clear(&test);
+					vorbis_info_init(&vi);
+					vorbis_comment_init(&vc);
+
+					audio_track_skip--;
+				} else {
+					copymem(&vo,&test,sizeof(test));
+					vorbis_p=1;
+				}
 			}else{
 			}else{
 				/* whatever it is, we don't care about it */
 				/* whatever it is, we don't care about it */
 				ogg_stream_clear(&test);
 				ogg_stream_clear(&test);

+ 31 - 0
scene/gui/item_list.cpp

@@ -235,6 +235,37 @@ int ItemList::get_current() const {
 	return current;
 	return current;
 }
 }
 
 
+void ItemList::move_item(int p_item,int p_to_pos) {
+
+	ERR_FAIL_INDEX(p_item,items.size());
+	ERR_FAIL_INDEX(p_to_pos,items.size()+1);
+
+	Item it=items[p_item];
+	items.remove(p_item);;
+
+	if (p_to_pos>p_item) {
+		p_to_pos--;
+	}
+
+	if (p_to_pos>=items.size()) {
+		items.push_back(it);
+	} else {
+		items.insert(p_to_pos,it);
+	}
+
+	if (current<0) {
+		//do none
+	} if (p_item==current) {
+		current=p_to_pos;
+	} else if (p_to_pos>p_item && current>p_item && current<p_to_pos) {
+		current--;
+	} else if (p_to_pos<p_item && current<p_item && current>p_to_pos) {
+		current++;
+	}
+
+
+	update();
+}
 
 
 int ItemList::get_item_count() const{
 int ItemList::get_item_count() const{
 
 

+ 1 - 0
scene/gui/item_list.h

@@ -101,6 +101,7 @@ public:
 	void set_current(int p_current);
 	void set_current(int p_current);
 	int get_current() const;
 	int get_current() const;
 
 
+	void move_item(int p_item,int p_to_pos);
 
 
 	int get_item_count() const;
 	int get_item_count() const;
 	void remove_item(int p_idx);
 	void remove_item(int p_idx);

+ 2 - 0
scene/gui/menu_button.cpp

@@ -54,6 +54,8 @@ void MenuButton::_unhandled_key_input(InputEvent p_event) {
 
 
 
 
 		int item = popup->find_item_by_accelerator(code);
 		int item = popup->find_item_by_accelerator(code);
+
+
 		if (item>=0 && ! popup->is_item_disabled(item))
 		if (item>=0 && ! popup->is_item_disabled(item))
 			popup->activate_item(item);
 			popup->activate_item(item);
 		/*
 		/*

+ 2 - 1
scene/gui/rich_text_label.cpp

@@ -719,7 +719,7 @@ void RichTextLabel::_input_event(InputEvent p_event) {
 		case InputEvent::KEY: {
 		case InputEvent::KEY: {
 
 
 			const InputEventKey &k=p_event.key;
 			const InputEventKey &k=p_event.key;
-			if (k.pressed) {
+			if (k.pressed && !k.mod.alt && !k.mod.shift && !k.mod.command && !k.mod.meta) {
 				bool handled=true;
 				bool handled=true;
 				switch(k.scancode) {
 				switch(k.scancode) {
 					case KEY_PAGEUP: {
 					case KEY_PAGEUP: {
@@ -765,6 +765,7 @@ void RichTextLabel::_input_event(InputEvent p_event) {
 					default: handled=false;
 					default: handled=false;
 				}
 				}
 
 
+
 				if (handled)
 				if (handled)
 					accept_event();
 					accept_event();
 			}
 			}

+ 1 - 1
scene/gui/video_player.cpp

@@ -384,12 +384,12 @@ void VideoPlayer::_bind_methods() {
 	ObjectTypeDB::bind_method(_MD("set_buffering_msec","msec"),&VideoPlayer::set_buffering_msec);
 	ObjectTypeDB::bind_method(_MD("set_buffering_msec","msec"),&VideoPlayer::set_buffering_msec);
 	ObjectTypeDB::bind_method(_MD("get_buffering_msec"),&VideoPlayer::get_buffering_msec);
 	ObjectTypeDB::bind_method(_MD("get_buffering_msec"),&VideoPlayer::get_buffering_msec);
 
 
+	ADD_PROPERTY( PropertyInfo(Variant::INT, "stream/audio_track",PROPERTY_HINT_RANGE,"0,128,1"), _SCS("set_audio_track"), _SCS("get_audio_track") );
 	ADD_PROPERTY( PropertyInfo(Variant::OBJECT, "stream/stream", PROPERTY_HINT_RESOURCE_TYPE,"VideoStream"), _SCS("set_stream"), _SCS("get_stream") );
 	ADD_PROPERTY( PropertyInfo(Variant::OBJECT, "stream/stream", PROPERTY_HINT_RESOURCE_TYPE,"VideoStream"), _SCS("set_stream"), _SCS("get_stream") );
 //	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/loop"), _SCS("set_loop"), _SCS("has_loop") );
 //	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/loop"), _SCS("set_loop"), _SCS("has_loop") );
 	ADD_PROPERTY( PropertyInfo(Variant::REAL, "stream/volume_db", PROPERTY_HINT_RANGE,"-80,24,0.01"), _SCS("set_volume_db"), _SCS("get_volume_db") );
 	ADD_PROPERTY( PropertyInfo(Variant::REAL, "stream/volume_db", PROPERTY_HINT_RANGE,"-80,24,0.01"), _SCS("set_volume_db"), _SCS("get_volume_db") );
 	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/autoplay"), _SCS("set_autoplay"), _SCS("has_autoplay") );
 	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/autoplay"), _SCS("set_autoplay"), _SCS("has_autoplay") );
 	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/paused"), _SCS("set_paused"), _SCS("is_paused") );
 	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/paused"), _SCS("set_paused"), _SCS("is_paused") );
-	ADD_PROPERTY( PropertyInfo(Variant::INT, "stream/audio_track",PROPERTY_HINT_RANGE,"0,128,1"), _SCS("set_audio_track"), _SCS("get_audio_track") );
 	ADD_PROPERTY( PropertyInfo( Variant::BOOL, "expand" ), _SCS("set_expand"),_SCS("has_expand") );
 	ADD_PROPERTY( PropertyInfo( Variant::BOOL, "expand" ), _SCS("set_expand"),_SCS("has_expand") );
 }
 }
 
 

+ 3 - 2
scene/resources/default_theme/default_theme.cpp

@@ -188,6 +188,7 @@ void make_default_theme() {
 	// Font Colors
 	// Font Colors
 
 
 	Color control_font_color = Color::html("e0e0e0");
 	Color control_font_color = Color::html("e0e0e0");
+	Color control_font_color_lower = Color::html("a0a0a0");
 	Color control_font_color_low = Color::html("b0b0b0");
 	Color control_font_color_low = Color::html("b0b0b0");
 	Color control_font_color_hover = Color::html("f0f0f0");
 	Color control_font_color_hover = Color::html("f0f0f0");
 	Color control_font_color_disabled = Color(0.9,0.9,0.9,0.2);
 	Color control_font_color_disabled = Color(0.9,0.9,0.9,0.2);
@@ -273,7 +274,7 @@ void make_default_theme() {
 	t->set_color("font_color_hover","ToolButton", control_font_color_hover );
 	t->set_color("font_color_hover","ToolButton", control_font_color_hover );
 	t->set_color("font_color_disabled","ToolButton", Color(0.9,0.95,1,0.3) );
 	t->set_color("font_color_disabled","ToolButton", Color(0.9,0.95,1,0.3) );
 
 
-	t->set_constant("hseparation","ToolButton", 0 );
+	t->set_constant("hseparation","ToolButton", 3 );
 
 
 
 
 
 
@@ -649,7 +650,7 @@ void make_default_theme() {
 	t->set_constant("icon_margin","ItemList",4);
 	t->set_constant("icon_margin","ItemList",4);
 	t->set_constant("line_separation","ItemList",2);
 	t->set_constant("line_separation","ItemList",2);
 	t->set_font("font","ItemList", default_font );
 	t->set_font("font","ItemList", default_font );
-	t->set_color("font_color","ItemList", control_font_color_low );
+	t->set_color("font_color","ItemList", control_font_color_lower );
 	t->set_color("font_color_selected","ItemList", control_font_color_pressed );
 	t->set_color("font_color_selected","ItemList", control_font_color_pressed );
 	t->set_color("guide_color","ItemList", Color(0,0,0,0.1) );
 	t->set_color("guide_color","ItemList", Color(0,0,0,0.1) );
 	t->set_stylebox("selected","ItemList", item_selected_oof );
 	t->set_stylebox("selected","ItemList", item_selected_oof );

+ 2 - 2
tools/editor/code_editor.cpp

@@ -618,7 +618,7 @@ CodeTextEditor::CodeTextEditor() {
 	line_col = memnew( Label );
 	line_col = memnew( Label );
 	add_child(line_col);
 	add_child(line_col);
 	line_col->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,135);
 	line_col->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,135);
-	line_col->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,20);
+	line_col->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,15);
 	line_col->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,1);
 	line_col->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,1);
 	line_col->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
 	line_col->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
 	//line_col->set_align(Label::ALIGN_RIGHT);
 	//line_col->set_align(Label::ALIGN_RIGHT);
@@ -637,7 +637,7 @@ CodeTextEditor::CodeTextEditor() {
 	error = memnew( Label );
 	error = memnew( Label );
 	add_child(error);
 	add_child(error);
 	error->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
 	error->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
-	error->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,20);
+	error->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,15);
 	error->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,1);
 	error->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,1);
 	error->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,130);
 	error->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,130);
 	error->hide();
 	error->hide();

+ 223 - 285
tools/editor/editor_help.cpp

@@ -300,9 +300,9 @@ void EditorHelpSearch::_bind_methods() {
 }
 }
 
 
 
 
-EditorHelpSearch::EditorHelpSearch(EditorNode *p_editor) {
+EditorHelpSearch::EditorHelpSearch() {
 
 
-	editor=p_editor;
+	editor=EditorNode::get_singleton();
 	VBoxContainer *vbc = memnew( VBoxContainer );
 	VBoxContainer *vbc = memnew( VBoxContainer );
 	add_child(vbc);
 	add_child(vbc);
 	set_child_rect(vbc);
 	set_child_rect(vbc);
@@ -318,17 +318,138 @@ EditorHelpSearch::EditorHelpSearch(EditorNode *p_editor) {
 	search_box->connect("input_event",this,"_sbox_input");
 	search_box->connect("input_event",this,"_sbox_input");
 	search_options = memnew( Tree );
 	search_options = memnew( Tree );
 	vbc->add_margin_child("Matches:",search_options,true);
 	vbc->add_margin_child("Matches:",search_options,true);
-	get_ok()->set_text("View");
+	get_ok()->set_text("Open");
 	get_ok()->set_disabled(true);
 	get_ok()->set_disabled(true);
 	register_text_enter(search_box);
 	register_text_enter(search_box);
 	set_hide_on_ok(false);
 	set_hide_on_ok(false);
 	search_options->connect("item_activated",this,"_confirmed");
 	search_options->connect("item_activated",this,"_confirmed");
 	set_title("Search Classes");
 	set_title("Search Classes");
+
 //	search_options->set_hide_root(true);
 //	search_options->set_hide_root(true);
 
 
 }
 }
 
 
+/////////////////////////////////
+
+////////////////////////////////////
+/// /////////////////////////////////
+
+
+
+void EditorHelpIndex::add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root) {
+
+	if (p_types.has(p_type))
+		return;
+//	if (!ObjectTypeDB::is_type(p_type,base) || p_type==base)
+//		return;
+
+	String inherits=EditorHelp::get_doc_data()->class_list[p_type].inherits;
+
+	TreeItem *parent=p_root;
+
+
+	if (inherits.length()) {
+
+		if (!p_types.has(inherits)) {
+
+			add_type(inherits,p_types,p_root);
+		}
+
+		if (p_types.has(inherits) )
+			parent=p_types[inherits];
+	}
+
+	TreeItem *item = class_list->create_item(parent);
+	item->set_metadata(0,p_type);
+	item->set_tooltip(0,EditorHelp::get_doc_data()->class_list[p_type].brief_description);
+	item->set_text(0,p_type);
+
+
+	if (has_icon(p_type,"EditorIcons")) {
+
+		item->set_icon(0, get_icon(p_type,"EditorIcons"));
+	}
+
+	p_types[p_type]=item;
+}
+
+
+void EditorHelpIndex::_tree_item_selected() {
+
+
+	TreeItem *s=class_list->get_selected();
+	if (!s)
+		return;
+
+	emit_signal("open_class",s->get_text(0));
+
+	hide();
+
+	//_goto_desc(s->get_text(0));
+
+}
+
+void EditorHelpIndex::select_class(const String& p_class) {
+
+	if (!tree_item_map.has(p_class))
+		return;
+	tree_item_map[p_class]->select(0);
+	class_list->ensure_cursor_is_visible();
+}
+
+void EditorHelpIndex::_notification(int p_what) {
+
+	if (p_what==NOTIFICATION_ENTER_TREE) {
+
+		class_list->clear();
+		tree_item_map.clear();
+		TreeItem *root = class_list->create_item();
+		class_list->set_hide_root(true);
+		connect("confirmed",this,"_tree_item_selected");
+
+
+		for(Map<String,DocData::ClassDoc>::Element *E=EditorHelp::get_doc_data()->class_list.front();E;E=E->next()) {
+
 
 
+			add_type(E->key(),tree_item_map,root);
+		}
+
+	}
+}
+
+void EditorHelpIndex::_bind_methods() {
+
+	ObjectTypeDB::bind_method("_tree_item_selected",&EditorHelpIndex::_tree_item_selected);
+	ObjectTypeDB::bind_method("select_class",&EditorHelpIndex::select_class);
+	ADD_SIGNAL( MethodInfo("open_class"));
+}
+
+
+
+EditorHelpIndex::EditorHelpIndex() {
+
+
+	VBoxContainer *vbc = memnew( VBoxContainer );
+	add_child(vbc);
+	set_child_rect(vbc);
+
+	class_list = memnew( Tree );
+	vbc->add_margin_child("Class List: ",class_list,true);
+	class_list->set_v_size_flags(SIZE_EXPAND_FILL);
+
+
+	class_list->connect("item_activated",this,"_tree_item_selected");
+
+
+	get_ok()->set_text("Open");
+}
+
+
+
+/////////////////////////////////
+
+////////////////////////////////////
+/// /////////////////////////////////
 DocData *EditorHelp::doc=NULL;
 DocData *EditorHelp::doc=NULL;
 
 
 void EditorHelp::_unhandled_key_input(const InputEvent& p_ev) {
 void EditorHelp::_unhandled_key_input(const InputEvent& p_ev) {
@@ -339,8 +460,6 @@ void EditorHelp::_unhandled_key_input(const InputEvent& p_ev) {
 
 
 		search->grab_focus();
 		search->grab_focus();
 		search->select_all();
 		search->select_all();
-	} else if (p_ev.key.mod.shift && p_ev.key.scancode==KEY_F1) {
-		class_search->popup();
 	}
 	}
 }
 }
 
 
@@ -351,17 +470,19 @@ void EditorHelp::_search(const String&) {
 
 
 
 
 	String stext=search->get_text();
 	String stext=search->get_text();
-	bool keep = prev_search==stext && class_list->get_selected() && prev_search_page==class_list->get_selected()->get_text(0);
+	bool keep = prev_search==stext;
 
 
-	class_desc->search(stext, keep);
+	bool ret = class_desc->search(stext, keep);
+	if (!ret) {
+		class_desc->search(stext, false);
+	}
 
 
 	prev_search=stext;
 	prev_search=stext;
-	if (class_list->get_selected())
-		prev_search_page=class_list->get_selected()->get_text(0);
 
 
 
 
 }
 }
 
 
+#if 0
 void EditorHelp::_button_pressed(int p_idx) {
 void EditorHelp::_button_pressed(int p_idx) {
 
 
 	if (p_idx==PAGE_CLASS_LIST) {
 	if (p_idx==PAGE_CLASS_LIST) {
@@ -399,16 +520,11 @@ void EditorHelp::_button_pressed(int p_idx) {
 	} else if (p_idx==PAGE_SEARCH) {
 	} else if (p_idx==PAGE_SEARCH) {
 
 
 		_search("");
 		_search("");
-	} else if (p_idx==CLASS_SEARCH) {
-
-		class_search->popup();
 	}
 	}
-
-
 }
 }
 
 
 
 
-
+#endif
 
 
 void EditorHelp::_class_list_select(const String& p_select) {
 void EditorHelp::_class_list_select(const String& p_select) {
 
 
@@ -417,16 +533,28 @@ void EditorHelp::_class_list_select(const String& p_select) {
 
 
 void EditorHelp::_class_desc_select(const String& p_select) {
 void EditorHelp::_class_desc_select(const String& p_select) {
 
 
+
+
+//	print_line("LINK: "+p_select);
 	if (p_select.begins_with("#")) {
 	if (p_select.begins_with("#")) {
-		_goto_desc(p_select.substr(1,p_select.length()));
+		//_goto_desc(p_select.substr(1,p_select.length()));
+		emit_signal("go_to_help","class_name:"+p_select.substr(1,p_select.length()));
 		return;
 		return;
 	} else if (p_select.begins_with("@")) {
 	} else if (p_select.begins_with("@")) {
 
 
 		String m = p_select.substr(1,p_select.length());
 		String m = p_select.substr(1,p_select.length());
-		if (!method_line.has(m))
-			return;
-		class_desc->scroll_to_line(method_line[m]);
-		return;
+
+		if (m.find(".")!=-1) {
+			//must go somewhere else
+
+			emit_signal("go_to_help","class_method:"+m.get_slice(".",0)+":"+m.get_slice(".",0));
+		} else {
+
+			if (!method_line.has(m))
+				return;
+			class_desc->scroll_to_line(method_line[m]);
+		}
+
 	}
 	}
 
 
 
 
@@ -449,68 +577,40 @@ void EditorHelp::_add_type(const String& p_type) {
 
 
 }
 }
 
 
-void EditorHelp::_update_history_buttons() {
-
-	back->set_disabled(history_pos<2);
-	forward->set_disabled(history_pos>=history.size());
-
-}
-
-
 void EditorHelp::_scroll_changed(double p_scroll) {
 void EditorHelp::_scroll_changed(double p_scroll) {
 
 
 	if (scroll_locked)
 	if (scroll_locked)
 		return;
 		return;
 
 
-	int p = history_pos -1;
-	if (p<0 || p>=history.size())
-		return;
-
 	if (class_desc->get_v_scroll()->is_hidden())
 	if (class_desc->get_v_scroll()->is_hidden())
 		p_scroll=0;
 		p_scroll=0;
 
 
-	history[p].scroll=p_scroll;
+	//history[p].scroll=p_scroll;
 }
 }
 
 
-Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_vscr) {
+Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) {
 
 
 	//ERR_FAIL_COND(!doc->class_list.has(p_class));
 	//ERR_FAIL_COND(!doc->class_list.has(p_class));
 	if (!doc->class_list.has(p_class))
 	if (!doc->class_list.has(p_class))
 		return ERR_DOES_NOT_EXIST;
 		return ERR_DOES_NOT_EXIST;
 
 
 
 
-	if (tree_item_map.has(p_class)) {
+	//if (tree_item_map.has(p_class)) {
 		select_locked = true;
 		select_locked = true;
-		tree_item_map[p_class]->select(0);
-		class_list->ensure_cursor_is_visible();
-	}
+	//}
 
 
 	class_desc->show();
 	class_desc->show();
 	//tabs->set_current_tab(PAGE_CLASS_DESC);
 	//tabs->set_current_tab(PAGE_CLASS_DESC);
-	edited_class->set_pressed(true);
-	class_list_button->set_pressed(false);
 	description_line=0;
 	description_line=0;
 
 
-	if (p_class==edited_class->get_text())
+	if (p_class==edited_class)
 		return OK; //already there
 		return OK; //already there
 
 
 	scroll_locked=true;
 	scroll_locked=true;
 
 
-	if (p_update_history) {
-
-		history.resize(history_pos);
-		history_pos++;
-		History h;
-		h.c=p_class;
-		h.scroll=0;
-		history.push_back(h);
-		_update_history_buttons();
-		class_desc->get_v_scroll()->set_val(0);
-	}
-
 	class_desc->clear();
 	class_desc->clear();
 	method_line.clear();
 	method_line.clear();
-	edited_class->set_text(p_class);
+	edited_class=p_class;
 	//edited_class->show();
 	//edited_class->show();
 
 
 
 
@@ -925,10 +1025,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v
 
 
 	}
 	}
 
 
-	if (!p_update_history) {
 
 
-		class_desc->get_v_scroll()->set_val(history[history_pos-1].scroll);
-	}
 
 
 	scroll_locked=false;
 	scroll_locked=false;
 
 
@@ -939,8 +1036,6 @@ void EditorHelp::_request_help(const String& p_string) {
 	Error err = _goto_desc(p_string);
 	Error err = _goto_desc(p_string);
 	if (err==OK) {
 	if (err==OK) {
 		editor->call("_editor_select",3);
 		editor->call("_editor_select",3);
-	} else {
-		class_search->popup(p_string);
 	}
 	}
 	//100 palabras
 	//100 palabras
 }
 }
@@ -1209,315 +1304,158 @@ void EditorHelp::_add_text(const String& p_bbcode) {
 }
 }
 
 
 
 
-void EditorHelp::add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root) {
-
-	if (p_types.has(p_type))
-		return;
-//	if (!ObjectTypeDB::is_type(p_type,base) || p_type==base)
-//		return;
-
-	String inherits=doc->class_list[p_type].inherits;
-
-	TreeItem *parent=p_root;
 
 
 
 
-	if (inherits.length()) {
+void EditorHelp::_update_doc() {
 
 
-		if (!p_types.has(inherits)) {
 
 
-			add_type(inherits,p_types,p_root);
-		}
 
 
-		if (p_types.has(inherits) )
-			parent=p_types[inherits];
-	}
+}
 
 
-	TreeItem *item = class_list->create_item(parent);
-	item->set_metadata(0,p_type);
-	item->set_tooltip(0,doc->class_list[p_type].brief_description);
-	item->set_text(0,p_type);
 
 
+void EditorHelp::generate_doc() {
 
 
-	if (has_icon(p_type,"EditorIcons")) {
+	doc = memnew( DocData );
+	doc->generate(true);
+	DocData compdoc;
+	compdoc.load_compressed(_doc_data_compressed,_doc_data_compressed_size,_doc_data_uncompressed_size);
+	doc->merge_from(compdoc); //ensure all is up to date
 
 
-		item->set_icon(0, get_icon(p_type,"EditorIcons"));
-	}
 
 
-	p_types[p_type]=item;
 }
 }
 
 
+void EditorHelp::_notification(int p_what) {
 
 
 
 
-void EditorHelp::_update_doc() {
+	switch(p_what) {
 
 
+		case NOTIFICATION_READY: {
 
 
-	class_list->clear();
 
 
-	List<StringName> type_list;
+//			forward->set_icon(get_icon("Forward","EditorIcons"));
+//			back->set_icon(get_icon("Back","EditorIcons"));
+			_update_doc();
+			editor->connect("request_help",this,"_request_help");
 
 
-	tree_item_map.clear();
+		} break;
+	}
+}
 
 
-	TreeItem *root = class_list->create_item();
-	class_list->set_hide_root(true);
-	List<StringName>::Element *I=type_list.front();
 
 
-	for(Map<String,DocData::ClassDoc>::Element *E=doc->class_list.front();E;E=E->next()) {
 
 
 
 
-		add_type(E->key(),tree_item_map,root);
-	}
+void EditorHelp::go_to_help(const String& p_help) {
 
 
+	_help_callback(p_help);
 }
 }
 
 
+void EditorHelp::go_to_class(const String& p_class,int p_scroll) {
 
 
-void EditorHelp::generate_doc() {
+	_goto_desc(p_class,p_scroll);
+}
 
 
-	doc = memnew( DocData );
-	doc->generate(true);
-	DocData compdoc;
-	compdoc.load_compressed(_doc_data_compressed,_doc_data_compressed_size,_doc_data_uncompressed_size);
-	doc->merge_from(compdoc); //ensure all is up to date
+void EditorHelp::popup_search() {
 
 
 
 
+	search_dialog->popup_centered(Size2(250,80));
+	search->grab_focus();
 }
 }
 
 
-void EditorHelp::_notification(int p_what) {
+void EditorHelp::_search_cbk() {
 
 
+	_search(search->get_text());
+}
 
 
-	switch(p_what) {
+String EditorHelp::get_class_name() {
 
 
-		case NOTIFICATION_READY: {
+	return edited_class;
+}
 
 
+void EditorHelp::search_again() {
+	_search(prev_search);
+}
 
 
-			forward->set_icon(get_icon("Forward","EditorIcons"));
-			back->set_icon(get_icon("Back","EditorIcons"));
-			_update_doc();
-			editor->connect("request_help",this,"_request_help");
+int EditorHelp::get_scroll() const {
 
 
-		} break;
-	}
+	return class_desc->get_v_scroll()->get_val();
 }
 }
+void EditorHelp::set_scroll(int p_scroll) {
 
 
-void EditorHelp::_tree_item_selected() {
 
 
-	if (select_locked) {
-		select_locked = false;
-		return;
-	}
-	TreeItem *s=class_list->get_selected();
-	if (!s)
-		return;
-	select_locked=true;
-	_goto_desc(s->get_text(0));
-	select_locked=false;
+	class_desc->get_v_scroll()->set_val(p_scroll);
+
 }
 }
 
 
 void EditorHelp::_bind_methods() {
 void EditorHelp::_bind_methods() {
 
 
 	ObjectTypeDB::bind_method("_class_list_select",&EditorHelp::_class_list_select);
 	ObjectTypeDB::bind_method("_class_list_select",&EditorHelp::_class_list_select);
 	ObjectTypeDB::bind_method("_class_desc_select",&EditorHelp::_class_desc_select);
 	ObjectTypeDB::bind_method("_class_desc_select",&EditorHelp::_class_desc_select);
-	ObjectTypeDB::bind_method("_button_pressed",&EditorHelp::_button_pressed);
+//	ObjectTypeDB::bind_method("_button_pressed",&EditorHelp::_button_pressed);
 	ObjectTypeDB::bind_method("_scroll_changed",&EditorHelp::_scroll_changed);
 	ObjectTypeDB::bind_method("_scroll_changed",&EditorHelp::_scroll_changed);
 	ObjectTypeDB::bind_method("_request_help",&EditorHelp::_request_help);
 	ObjectTypeDB::bind_method("_request_help",&EditorHelp::_request_help);
 	ObjectTypeDB::bind_method("_unhandled_key_input",&EditorHelp::_unhandled_key_input);
 	ObjectTypeDB::bind_method("_unhandled_key_input",&EditorHelp::_unhandled_key_input);
 	ObjectTypeDB::bind_method("_search",&EditorHelp::_search);
 	ObjectTypeDB::bind_method("_search",&EditorHelp::_search);
-	ObjectTypeDB::bind_method("_tree_item_selected",&EditorHelp::_tree_item_selected);
+	ObjectTypeDB::bind_method("_search_cbk",&EditorHelp::_search_cbk);
+
 	ObjectTypeDB::bind_method("_help_callback",&EditorHelp::_help_callback);
 	ObjectTypeDB::bind_method("_help_callback",&EditorHelp::_help_callback);
 
 
+	ADD_SIGNAL(MethodInfo("go_to_help"));
+
 }
 }
 
 
-EditorHelp::EditorHelp(EditorNode *p_editor) {
+EditorHelp::EditorHelp() {
 
 
-	editor=p_editor;
+	editor=EditorNode::get_singleton();
 
 
 	VBoxContainer *vbc = this;
 	VBoxContainer *vbc = this;
 
 
-	HBoxContainer *panel_hb = memnew( HBoxContainer );
-
-	Button *b = memnew( Button );
-	b->set_text("Class List");
-	panel_hb->add_child(b);
-	vbc->add_child(panel_hb);
-	b->set_toggle_mode(true);
-	b->set_pressed(true);
-	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_LIST));
-	class_list_button=b;
-	class_list_button->hide();
-
-	b = memnew( Button );
-	b->set_text("Class");
-	panel_hb->add_child(b);
-	edited_class=b;
-	edited_class->hide();
-	b->set_toggle_mode(true);
-	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_DESC));
-
-	b = memnew( Button );
-	b->set_text("Search in Classes");
-	panel_hb->add_child(b);
-	b->connect("pressed",this,"_button_pressed",make_binds(CLASS_SEARCH));
-
-	Control *expand = memnew( Control );
-	expand->set_h_size_flags(SIZE_EXPAND_FILL);
-	panel_hb->add_child(expand);
-
-	b = memnew( Button );
-	panel_hb->add_child(b);
-	back=b;
-	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_PREV));
-
-	b = memnew( Button );
-	panel_hb->add_child(b);
-	forward=b;
-	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_NEXT));
-
-	Separator *hs = memnew( VSeparator );
-	panel_hb->add_child(hs);
-	Control *ec = memnew( Control );
-	ec->set_custom_minimum_size(Size2(200,1));
-	panel_hb->add_child(ec);
-	search = memnew( LineEdit );
-	ec->add_child(search);
-	search->set_area_as_parent_rect();
-	search->connect("text_entered",this,"_search");
-
-	b = memnew( Button );
-	b->set_text("Find");
-	panel_hb->add_child(b);
-	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_SEARCH));
-
-	hs = memnew( VSeparator );
-	panel_hb->add_child(hs);
 
 
-	h_split = memnew( HSplitContainer );
-	h_split->set_v_size_flags(SIZE_EXPAND_FILL);
-
-
-	vbc->add_child(h_split);
-
-	class_list = memnew( Tree );
-	h_split->add_child(class_list);
 	//class_list->connect("meta_clicked",this,"_class_list_select");
 	//class_list->connect("meta_clicked",this,"_class_list_select");
 	//class_list->set_selection_enabled(true);
 	//class_list->set_selection_enabled(true);
 
 
 	{
 	{
-		PanelContainer *pc = memnew( PanelContainer );
+		Panel *pc = memnew( Panel );
 		Ref<StyleBoxFlat> style( memnew( StyleBoxFlat ) );
 		Ref<StyleBoxFlat> style( memnew( StyleBoxFlat ) );
 		style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/background_color") );	
 		style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/background_color") );	
-		style->set_default_margin(MARGIN_LEFT,20);
-		style->set_default_margin(MARGIN_TOP,20);
+		pc->set_v_size_flags(SIZE_EXPAND_FILL);
 		pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit"));
 		pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit"));
-		h_split->add_child(pc);
+		vbc->add_child(pc);
 		class_desc = memnew( RichTextLabel );
 		class_desc = memnew( RichTextLabel );
 		pc->add_child(class_desc);
 		pc->add_child(class_desc);
+		class_desc->set_area_as_parent_rect(8);
 		class_desc->connect("meta_clicked",this,"_class_desc_select");
 		class_desc->connect("meta_clicked",this,"_class_desc_select");
 	}
 	}
 
 
 	class_desc->get_v_scroll()->connect("value_changed",this,"_scroll_changed");
 	class_desc->get_v_scroll()->connect("value_changed",this,"_scroll_changed");
 	class_desc->set_selection_enabled(true);
 	class_desc->set_selection_enabled(true);
-	editor=p_editor;
-	history_pos=0;
+
 	scroll_locked=false;
 	scroll_locked=false;
 	select_locked=false;
 	select_locked=false;
 	set_process_unhandled_key_input(true);
 	set_process_unhandled_key_input(true);
-	h_split->set_split_offset(200);
-	class_list->connect("cell_selected",this,"_tree_item_selected");
 	class_desc->hide();
 	class_desc->hide();
 
 
-	class_search = memnew( EditorHelpSearch(editor) );
-	editor->get_gui_base()->add_child(class_search);
-	class_search->connect("go_to_help",this,"_help_callback");
-//	prev_search_page=-1;
-}
-
-EditorHelp::~EditorHelp() {
-	if (doc)
-		memdelete(doc);
-}
-
-
-void EditorHelpPlugin::edit(Object *p_object) {
-
-	if (!p_object->cast_to<Script>())
-		return;
-
-	//editor_help->edit(p_object->cast_to<Script>());
-}
-
-bool EditorHelpPlugin::handles(Object *p_object) const {
-
-	return false;
-}
-
-void EditorHelpPlugin::make_visible(bool p_visible) {
-
-	if (p_visible) {
-		editor_help->show();
-	} else {
-
-		editor_help->hide();
-	}
-
-}
-
-void EditorHelpPlugin::selected_notify() {
-
-	//editor_help->ensure_select_current();
-}
-
-Dictionary EditorHelpPlugin::get_state() const {
-
-	return Dictionary();
-}
-
-void EditorHelpPlugin::set_state(const Dictionary& p_state) {
-
-	//editor_help->set_state(p_state);
-}
-void EditorHelpPlugin::clear() {
-
-	//editor_help->clear();
-}
-
-void EditorHelpPlugin::save_external_data() {
-
-	//editor_help->save_external_data();
-}
-
-void EditorHelpPlugin::apply_changes() {
-
-	//editor_help->apply_helps();
-}
-
-void EditorHelpPlugin::restore_global_state() {
-
-	//if (bool(EDITOR_DEF("text_editor/restore_helps_on_load",true))) {
-//		editor_help->_load_files_state();
-	//}
-
-}
+	search_dialog = memnew( ConfirmationDialog );
+	add_child(search_dialog);
+	VBoxContainer *search_vb = memnew( VBoxContainer );
+	search_dialog->add_child(search_vb);
+	search_dialog->set_child_rect(search_vb);
+	search = memnew( LineEdit );
+	search_dialog->register_text_enter(search);
+	search_vb->add_margin_child("Search Text",search);
+	search_dialog->get_ok()->set_text("Find");
+	search_dialog->connect("confirmed",this,"_search_cbk");
+	search_dialog->set_hide_on_ok(false);
+	search_dialog->set_self_opacity(0.8);
 
 
-void EditorHelpPlugin::save_global_state() {
 
 
-	//if (bool(EDITOR_DEF("text_editor/restore_helps_on_load",true))) {
-//		editor_help->_save_files_state();
-//	}
+	/*class_search = memnew( EditorHelpSearch(editor) );
+	editor->get_gui_base()->add_child(class_search);
+	class_search->connect("go_to_help",this,"_help_callback");*/
 
 
+//	prev_search_page=-1;
 }
 }
 
 
-
-EditorHelpPlugin::EditorHelpPlugin(EditorNode *p_node) {
-
-	editor=p_node;
-	editor_help = memnew( EditorHelp(p_node) );
-	editor->get_viewport()->add_child(editor_help);
-	editor_help->set_area_as_parent_rect();
-	editor_help->hide();
-
+EditorHelp::~EditorHelp() {
 
 
 }
 }
 
 
-
-EditorHelpPlugin::~EditorHelpPlugin()
-{
-}

+ 42 - 49
tools/editor/editor_help.h

@@ -70,9 +70,29 @@ public:
 
 
 	void popup(const String& p_term="");
 	void popup(const String& p_term="");
 
 
-	EditorHelpSearch(EditorNode *p_editor);
+	EditorHelpSearch();
 };
 };
 
 
+class EditorHelpIndex : public ConfirmationDialog {
+	OBJ_TYPE( EditorHelpIndex, ConfirmationDialog );
+
+
+	Tree *class_list;
+	HashMap<String,TreeItem*> tree_item_map;
+
+	void _tree_item_selected();
+	void add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root);
+protected:
+
+	void _notification(int p_what);
+	static void _bind_methods();
+
+public:
+
+	void select_class(const String& p_class);
+
+	EditorHelpIndex();
+};
 
 
 
 
 class EditorHelp : public VBoxContainer {
 class EditorHelp : public VBoxContainer {
@@ -91,17 +111,11 @@ class EditorHelp : public VBoxContainer {
 	};
 	};
 
 
 
 
-	struct History {
-		String c;
-		int scroll;
-	};
-
-	Vector<History> history;
-	int history_pos;
 	bool select_locked;
 	bool select_locked;
 
 
 	String prev_search;
 	String prev_search;
-	String prev_search_page;
+
+	String edited_class;
 
 
 	EditorNode *editor;
 	EditorNode *editor;
 	Map<String,int> method_line;
 	Map<String,int> method_line;
@@ -111,21 +125,17 @@ class EditorHelp : public VBoxContainer {
 	Map<String,int> constant_line;
 	Map<String,int> constant_line;
 	int description_line;
 	int description_line;
 
 
-	Tree *class_list;
 
 
 	RichTextLabel *class_desc;
 	RichTextLabel *class_desc;
 	HSplitContainer *h_split;
 	HSplitContainer *h_split;
 	static DocData *doc;
 	static DocData *doc;
 
 
-	Button *class_list_button;
-	Button *edited_class;
-	Button *back;
-	Button *forward;
+
+	ConfirmationDialog *search_dialog;
 	LineEdit *search;
 	LineEdit *search;
 
 
-	String base_path;
 
 
-	HashMap<String,TreeItem*> tree_item_map;
+	String base_path;
 
 
 
 
 	void _help_callback(const String& p_topic);
 	void _help_callback(const String& p_topic);
@@ -133,25 +143,24 @@ class EditorHelp : public VBoxContainer {
 	void _add_text(const String& p_text);
 	void _add_text(const String& p_text);
 	bool scroll_locked;
 	bool scroll_locked;
 
 
-	void _button_pressed(int p_idx);
+	//void _button_pressed(int p_idx);
 	void _add_type(const String& p_type);
 	void _add_type(const String& p_type);
 
 
 	void _scroll_changed(double p_scroll);
 	void _scroll_changed(double p_scroll);
 	void _class_list_select(const String& p_select);
 	void _class_list_select(const String& p_select);
 	void _class_desc_select(const String& p_select);
 	void _class_desc_select(const String& p_select);
 
 
-	Error _goto_desc(const String& p_class,bool p_update_history=true,int p_vscr=-1);
-	void _update_history_buttons();
+	Error _goto_desc(const String& p_class, int p_vscr=-1);
+	//void _update_history_buttons();
 	void _update_doc();
 	void _update_doc();
 
 
 	void _request_help(const String& p_string);
 	void _request_help(const String& p_string);
 	void _search(const String& p_str);
 	void _search(const String& p_str);
+	void _search_cbk();
 
 
 	void _unhandled_key_input(const InputEvent& p_ev);
 	void _unhandled_key_input(const InputEvent& p_ev);
-	void add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root);
-	void _tree_item_selected();
 
 
-	EditorHelpSearch *class_search;
+
 
 
 protected:
 protected:
 
 
@@ -163,41 +172,25 @@ public:
 	static void generate_doc();
 	static void generate_doc();
 	static DocData *get_doc_data() { return doc; }
 	static DocData *get_doc_data() { return doc; }
 
 
-	EditorHelp(EditorNode *p_editor=NULL);
-	~EditorHelp();
-};
-
-
+	void go_to_help(const String& p_help);
+	void go_to_class(const String& p_class,int p_scroll=0);
 
 
-class EditorHelpPlugin : public EditorPlugin {
+	void popup_search();
+	void search_again();
 
 
-	OBJ_TYPE( EditorHelpPlugin, EditorPlugin );
+	String get_class_name();
 
 
-	EditorHelp *editor_help;
-	EditorNode *editor;
-public:
+	void set_focused() { class_desc->grab_focus(); }
 
 
-	virtual String get_name() const { return "Help"; }
-	bool has_main_screen() const { return true; }
-	virtual void edit(Object *p_node);
-	virtual bool handles(Object *p_node) const;
-	virtual void make_visible(bool p_visible);
-	virtual void selected_notify();
+	int get_scroll() const;
+	void set_scroll(int p_scroll);
 
 
-	Dictionary get_state() const;
-	virtual void set_state(const Dictionary& p_state);
-	virtual void clear();
-
-	virtual void save_external_data();
-	virtual void apply_changes();
+	EditorHelp();
+	~EditorHelp();
+};
 
 
-	virtual void restore_global_state();
-	virtual void save_global_state();
 
 
-	EditorHelpPlugin(EditorNode *p_node);
-	~EditorHelpPlugin();
 
 
-};
 
 
 
 
 #endif // EDITOR_HELP_H
 #endif // EDITOR_HELP_H

+ 47 - 9
tools/editor/editor_node.cpp

@@ -163,12 +163,12 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) {
 
 
 		switch(p_event.key.scancode) {
 		switch(p_event.key.scancode) {
 
 
-			case KEY_F1:
+			/*case KEY_F1:
 				if (!p_event.key.mod.shift && !p_event.key.mod.command)
 				if (!p_event.key.mod.shift && !p_event.key.mod.command)
 					_editor_select(3);
 					_editor_select(3);
-			break;
-			case KEY_F2: _editor_select(0); break;
-			case KEY_F3: _editor_select(1); break;
+			break;*/
+			case KEY_F1: _editor_select(0); break;
+			case KEY_F2: _editor_select(1); break;
 			case KEY_F4: _editor_select(2); break;
 			case KEY_F4: _editor_select(2); break;
 			case KEY_F5: _menu_option_confirm((p_event.key.mod.control&&p_event.key.mod.shift)?RUN_PLAY_CUSTOM_SCENE:RUN_PLAY,true); break;
 			case KEY_F5: _menu_option_confirm((p_event.key.mod.control&&p_event.key.mod.shift)?RUN_PLAY_CUSTOM_SCENE:RUN_PLAY,true); break;
 			case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break;
 			case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break;
@@ -2846,7 +2846,7 @@ Control* EditorNode::get_viewport() {
 void EditorNode::_editor_select(int p_which) {
 void EditorNode::_editor_select(int p_which) {
 
 
 	static bool selecting=false;
 	static bool selecting=false;
-	if (selecting)
+	if (selecting || changing_scene)
 		return;
 		return;
 
 
 	selecting=true;
 	selecting=true;
@@ -3223,9 +3223,14 @@ Dictionary EditorNode::_get_main_scene_state() {
 void EditorNode::_set_main_scene_state(Dictionary p_state) {
 void EditorNode::_set_main_scene_state(Dictionary p_state) {
 
 
 	//print_line("set current 7 ");
 	//print_line("set current 7 ");
+	changing_scene=false;
 
 
+#if 0
 	if (p_state.has("main_tab")) {
 	if (p_state.has("main_tab")) {
 		int idx = p_state["main_tab"];
 		int idx = p_state["main_tab"];
+
+
+		print_line("comes with tab: "+itos(idx));
 		int current=-1;
 		int current=-1;
 		for(int i=0;i<editor_table.size();i++) {
 		for(int i=0;i<editor_table.size();i++) {
 			if (editor_plugin_screen==editor_table[i]) {
 			if (editor_plugin_screen==editor_table[i]) {
@@ -3234,12 +3239,41 @@ void EditorNode::_set_main_scene_state(Dictionary p_state) {
 			}
 			}
 		}
 		}
 
 
+
 		if (idx<2 && current<2) {
 		if (idx<2 && current<2) {
 			//only set tab for 2D and 3D
 			//only set tab for 2D and 3D
-			_editor_select(p_state["main_tab"]);
+			_editor_select(idx);
 			//print_line(" setting main tab: "+itos(p_state["main_tab"]));
 			//print_line(" setting main tab: "+itos(p_state["main_tab"]));
 		}
 		}
 	}
 	}
+#else
+
+	if (get_edited_scene()) {
+
+		int current=-1;
+		for(int i=0;i<editor_table.size();i++) {
+			if (editor_plugin_screen==editor_table[i]) {
+				current=i;
+				break;
+			}
+		}
+
+		if (current<2) {
+			//use heuristic instead
+
+			int n2d=0,n3d=0;
+			_find_node_types(get_edited_scene(),n2d,n3d);
+			if (n2d>n3d) {
+				_editor_select(0);
+			} else if (n3d>n2d) {
+				_editor_select(1);
+
+			}
+		}
+
+	}
+#endif
+
 
 
 	if (p_state.has("scene_tree_offset"))
 	if (p_state.has("scene_tree_offset"))
 		scene_tree_dock->get_tree_editor()->get_scene_tree()->get_vscroll_bar()->set_val(p_state["scene_tree_offset"]);
 		scene_tree_dock->get_tree_editor()->get_scene_tree()->get_vscroll_bar()->set_val(p_state["scene_tree_offset"]);
@@ -3248,6 +3282,12 @@ void EditorNode::_set_main_scene_state(Dictionary p_state) {
 
 
 	//print_line("set current 8 ");
 	//print_line("set current 8 ");
 
 
+	//this should only happen at the very end
+
+	//changing_scene=true; //avoid script change from opening editor
+	ScriptEditor::get_singleton()->get_debugger()->update_live_edit_root();
+	ScriptEditor::get_singleton()->set_scene_root_script( editor_data.get_scene_root_script(editor_data.get_edited_scene()) );
+	//changing_scene=false;
 
 
 }
 }
 
 
@@ -3312,8 +3352,6 @@ void EditorNode::set_current_scene(int p_idx) {
 
 
 	call_deferred("_set_main_scene_state",state); //do after everything else is done setting up
 	call_deferred("_set_main_scene_state",state); //do after everything else is done setting up
 	//print_line("set current 6 ");
 	//print_line("set current 6 ");
-	changing_scene=false;
-	ScriptEditor::get_singleton()->get_debugger()->update_live_edit_root();
 
 
 
 
 }
 }
@@ -5493,7 +5531,6 @@ EditorNode::EditorNode() {
 	add_editor_plugin( memnew( CanvasItemEditorPlugin(this) ) );
 	add_editor_plugin( memnew( CanvasItemEditorPlugin(this) ) );
 	add_editor_plugin( memnew( SpatialEditorPlugin(this) ) );
 	add_editor_plugin( memnew( SpatialEditorPlugin(this) ) );
 	add_editor_plugin( memnew( ScriptEditorPlugin(this) ) );
 	add_editor_plugin( memnew( ScriptEditorPlugin(this) ) );
-	add_editor_plugin( memnew( EditorHelpPlugin(this) ) );
 	add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
 	add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
 	add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,true) ) );
 	add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,true) ) );
 	add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,false) ) );
 	add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,false) ) );
@@ -5669,6 +5706,7 @@ EditorNode::EditorNode() {
 EditorNode::~EditorNode() {	
 EditorNode::~EditorNode() {	
 
 
 
 
+	memdelete( EditorHelp::get_doc_data() );
 	memdelete(editor_selection);
 	memdelete(editor_selection);
 	memdelete(file_server);
 	memdelete(file_server);
 	EditorSettings::destroy();
 	EditorSettings::destroy();

BIN
tools/editor/icons/icon_help.png


File diff suppressed because it is too large
+ 536 - 372
tools/editor/plugins/script_editor_plugin.cpp


+ 49 - 0
tools/editor/plugins/script_editor_plugin.h

@@ -41,6 +41,7 @@
 #include "tools/editor/code_editor.h"
 #include "tools/editor/code_editor.h"
 #include "scene/gui/split_container.h"
 #include "scene/gui/split_container.h"
 #include "scene/gui/item_list.h"
 #include "scene/gui/item_list.h"
+#include "tools/editor/editor_help.h"
 
 
 class ScriptEditorQuickOpen : public ConfirmationDialog {
 class ScriptEditorQuickOpen : public ConfirmationDialog {
 
 
@@ -141,6 +142,9 @@ class ScriptEditor : public VBoxContainer {
 		SEARCH_REPLACE,
 		SEARCH_REPLACE,
 		SEARCH_LOCATE_FUNCTION,
 		SEARCH_LOCATE_FUNCTION,
 		SEARCH_GOTO_LINE,
 		SEARCH_GOTO_LINE,
+		SEARCH_HELP,
+		SEARCH_CLASSES,
+		SEARCH_WEBSITE,
 		DEBUG_TOGGLE_BREAKPOINT,
 		DEBUG_TOGGLE_BREAKPOINT,
 		DEBUG_NEXT,
 		DEBUG_NEXT,
 		DEBUG_STEP,
 		DEBUG_STEP,
@@ -150,6 +154,8 @@ class ScriptEditor : public VBoxContainer {
 		HELP_CONTEXTUAL,		
 		HELP_CONTEXTUAL,		
 		WINDOW_MOVE_LEFT,
 		WINDOW_MOVE_LEFT,
 		WINDOW_MOVE_RIGHT,
 		WINDOW_MOVE_RIGHT,
+		WINDOW_NEXT,
+		WINDOW_PREV,
 		WINDOW_SELECT_BASE=100
 		WINDOW_SELECT_BASE=100
 	};
 	};
 
 
@@ -157,11 +163,17 @@ class ScriptEditor : public VBoxContainer {
 	MenuButton *file_menu;
 	MenuButton *file_menu;
 	MenuButton *edit_menu;
 	MenuButton *edit_menu;
 	MenuButton *search_menu;
 	MenuButton *search_menu;
+	MenuButton *script_search_menu;
 	MenuButton *debug_menu;
 	MenuButton *debug_menu;
 	MenuButton *help_menu;
 	MenuButton *help_menu;
 	Timer *autosave_timer;
 	Timer *autosave_timer;
 	uint64_t idle;
 	uint64_t idle;
 
 
+	Button *help_search;
+	Button *site_search;
+	Button *class_search;
+	EditorHelpSearch *help_search_dialog;
+
 	ItemList *script_list;
 	ItemList *script_list;
 	HSplitContainer *script_split;
 	HSplitContainer *script_split;
 	TabContainer *tab_container;
 	TabContainer *tab_container;
@@ -172,6 +184,27 @@ class ScriptEditor : public VBoxContainer {
 	ScriptEditorDebugger* debugger;
 	ScriptEditorDebugger* debugger;
 	ToolButton *scripts_visible;
 	ToolButton *scripts_visible;
 
 
+	TextureFrame *script_icon;
+	Label *script_name_label;
+
+	ToolButton *script_back;
+	ToolButton *script_forward;
+
+
+	struct ScriptHistory {
+
+		Control *control;
+		int scroll_pos;
+		int cursor_column;
+		int cursor_row;
+	};
+
+	Vector<ScriptHistory> history;
+	int history_pos;
+
+
+	EditorHelpIndex *help_index;
+
 	void _tab_changed(int p_which);
 	void _tab_changed(int p_which);
 	void _menu_option(int p_optin);
 	void _menu_option(int p_optin);
 
 
@@ -201,6 +234,8 @@ class ScriptEditor : public VBoxContainer {
 	void _editor_pause();
 	void _editor_pause();
 	void _editor_stop();
 	void _editor_stop();
 
 
+	int edit_pass;
+
 	void _add_callback(Object *p_obj, const String& p_function, const StringArray& p_args);
 	void _add_callback(Object *p_obj, const String& p_function, const StringArray& p_args);
 	void _res_saved_callback(const Ref<Resource>& p_res);
 	void _res_saved_callback(const Ref<Resource>& p_res);
 
 
@@ -224,8 +259,20 @@ class ScriptEditor : public VBoxContainer {
 
 
 	void _script_split_dragged(float);
 	void _script_split_dragged(float);
 
 
+
+	void _history_forward();
+	void _history_back();
+
 	bool waiting_update_names;
 	bool waiting_update_names;
 
 
+	void _help_class_open(const String& p_class);
+	void _help_class_goto(const String& p_desc);
+	void _update_history_arrows();
+	void _go_to_tab(int p_idx);
+	void _update_history_pos(int p_new_pos);
+	void _update_script_colors();
+
+
 	static ScriptEditor *script_editor;
 	static ScriptEditor *script_editor;
 protected:
 protected:
 	void _notification(int p_what);
 	void _notification(int p_what);
@@ -253,6 +300,8 @@ public:
 	void set_window_layout(Ref<ConfigFile> p_layout);
 	void set_window_layout(Ref<ConfigFile> p_layout);
 	void get_window_layout(Ref<ConfigFile> p_layout);
 	void get_window_layout(Ref<ConfigFile> p_layout);
 
 
+	void set_scene_root_script( Ref<Script> p_script );
+
 	ScriptEditorDebugger *get_debugger() { return debugger; }
 	ScriptEditorDebugger *get_debugger() { return debugger; }
 
 
 	ScriptEditor(EditorNode *p_editor);
 	ScriptEditor(EditorNode *p_editor);

Some files were not shown because too many files changed in this diff