summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_editor.cpp1
-rw-r--r--editor/editor_data.cpp20
-rw-r--r--editor/editor_data.h24
-rw-r--r--editor/editor_node.cpp169
-rw-r--r--editor/editor_node.h8
-rw-r--r--editor/editor_plugin.cpp49
-rw-r--r--editor/editor_plugin.h12
-rw-r--r--editor/editor_themes.cpp22
-rw-r--r--editor/icons/2x/icon_variant.pngbin0 -> 398 bytes
-rw-r--r--editor/icons/icon_variant.pngbin240 -> 237 bytes
-rw-r--r--editor/icons/source/icon_variant.svg146
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.cpp61
-rw-r--r--editor/plugins/script_editor_plugin.h7
-rw-r--r--editor/script_editor_debugger.cpp29
15 files changed, 363 insertions, 189 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 1798e66e8a..45da365695 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -3774,6 +3774,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
zoom->set_max(2.0);
zoom->set_value(1.0);
zoom->set_h_size_flags(SIZE_EXPAND_FILL);
+ zoom->set_v_size_flags(SIZE_EXPAND_FILL);
zoom->set_stretch_ratio(2);
hb->add_child(zoom);
zoom->connect("value_changed", this, "_scroll_changed");
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 58ffa223fb..11b900f45c 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -353,6 +353,7 @@ void EditorData::notify_edited_scene_changed() {
for (int i = 0; i < editor_plugins.size(); i++) {
editor_plugins[i]->edited_scene_changed();
+ editor_plugins[i]->notify_scene_changed(get_edited_scene_root());
}
}
@@ -488,8 +489,14 @@ void EditorData::move_edited_scene_index(int p_idx, int p_to_idx) {
}
void EditorData::remove_scene(int p_idx) {
ERR_FAIL_INDEX(p_idx, edited_scene.size());
- if (edited_scene[p_idx].root)
+ if (edited_scene[p_idx].root) {
+
+ for (int i = 0; i < editor_plugins.size(); i++) {
+ editor_plugins[i]->notify_scene_closed(edited_scene[p_idx].root->get_filename());
+ }
+
memdelete(edited_scene[p_idx].root);
+ }
if (current_edited_scene > p_idx)
current_edited_scene--;
@@ -615,6 +622,17 @@ int EditorData::get_edited_scene_count() const {
return edited_scene.size();
}
+Vector<EditorData::EditedScene> EditorData::get_edited_scenes() const {
+
+ Vector<EditedScene> out_edited_scenes_list = Vector<EditedScene>();
+
+ for (int i = 0; i < edited_scene.size(); i++) {
+ out_edited_scenes_list.push_back(edited_scene[i]);
+ }
+
+ return out_edited_scenes_list;
+}
+
void EditorData::set_edited_scene_version(uint64_t version, int scene_idx) {
ERR_FAIL_INDEX(current_edited_scene, edited_scene.size());
if (scene_idx < 0) {
diff --git a/editor/editor_data.h b/editor/editor_data.h
index 50f0d5fd41..a601b5019d 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -31,6 +31,7 @@
#define EDITOR_DATA_H
#include "editor/editor_plugin.h"
+#include "editor/plugins/script_editor_plugin.h"
#include "list.h"
#include "pair.h"
#include "scene/resources/texture.h"
@@ -109,6 +110,17 @@ public:
Ref<Texture> icon;
};
+ struct EditedScene {
+ Node *root;
+ Dictionary editor_states;
+ List<Node *> selection;
+ Vector<EditorHistory::History> history_stored;
+ int history_current;
+ Dictionary custom_state;
+ uint64_t version;
+ NodePath live_edit_root;
+ };
+
private:
Vector<EditorPlugin *> editor_plugins;
@@ -124,17 +136,6 @@ private:
void _cleanup_history();
- struct EditedScene {
- Node *root;
- Dictionary editor_states;
- List<Node *> selection;
- Vector<EditorHistory::History> history_stored;
- int history_current;
- Dictionary custom_state;
- uint64_t version;
- NodePath live_edit_root;
- };
-
Vector<EditedScene> edited_scene;
int current_edited_scene;
@@ -180,6 +181,7 @@ public:
int get_edited_scene() const;
Node *get_edited_scene_root(int p_idx = -1);
int get_edited_scene_count() const;
+ Vector<EditedScene> get_edited_scenes() const;
String get_scene_title(int p_idx) const;
String get_scene_path(int p_idx) const;
String get_scene_type(int p_idx) const;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 00609b22d7..79c7aa044c 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1575,6 +1575,11 @@ void EditorNode::_edit_current() {
editor_plugin_screen->make_visible(true);
+ int plugin_count = editor_data.get_editor_plugin_count();
+ for (int i = 0; i < plugin_count; i++) {
+ editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
+ }
+
for (int i = 0; i < editor_table.size(); i++) {
main_editor_buttons[i]->set_pressed(editor_table[i] == main_plugin);
@@ -1628,7 +1633,7 @@ void EditorNode::_edit_current() {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTR("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES);
p->add_separator();
- p->add_icon_shortcut(gui_base->get_icon("Help", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
+ p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
}
List<MethodInfo> methods;
@@ -2865,6 +2870,11 @@ void EditorNode::_editor_select(int p_which) {
editor_plugin_screen->make_visible(true);
editor_plugin_screen->selected_notify();
+ int plugin_count = editor_data.get_editor_plugin_count();
+ for (int i = 0; i < plugin_count; i++) {
+ editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
+ }
+
if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) {
if (p_which == EDITOR_SCRIPT) {
set_distraction_free_mode(script_distraction);
@@ -2913,7 +2923,6 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) {
}
}
- //singleton->main_editor_tabs->add_tab(p_editor->get_name());
singleton->editor_table.erase(p_editor);
}
p_editor->make_visible(false);
@@ -3589,15 +3598,6 @@ void EditorNode::_open_recent_scene(int p_idx) {
ERR_FAIL_INDEX(p_idx, rc.size());
String path = "res://" + rc[p_idx];
-
- /*if (unsaved_cache) {
- _recent_scene=rc[p_idx];
- open_recent_confirmation->set_text("Discard current scene and open:\n'"+rc[p_idx]+"'");
- open_recent_confirmation->get_label()->set_align(Label::ALIGN_CENTER);
- open_recent_confirmation->popup_centered(Size2(400,100));
- return;
- }*/
-
load_scene(path);
}
@@ -3756,6 +3756,7 @@ void EditorNode::register_editor_types() {
ClassDB::register_class<EditorResourcePreviewGenerator>();
ClassDB::register_class<EditorFileSystem>();
ClassDB::register_class<EditorFileSystemDirectory>();
+ ClassDB::register_virtual_class<ScriptEditor>();
//ClassDB::register_type<EditorImporter>();
//ClassDB::register_type<EditorPostImport>();
@@ -5222,28 +5223,9 @@ EditorNode::EditorNode() {
main_vbox->set_area_as_parent_rect(8);
main_vbox->set_margin(MARGIN_TOP, 5);
-#if 0
- PanelContainer *top_dark_panel = memnew( PanelContainer );
- Ref<StyleBoxTexture> top_dark_sb;
- top_dark_sb.instance();
- top_dark_sb->set_texture(theme->get_icon("PanelTop","EditorIcons"));
- for(int i=0;i<4;i++) {
- top_dark_sb->set_margin_size(Margin(i),3);
- top_dark_sb->set_default_margin(Margin(i),0);
- }
- top_dark_sb->set_expand_margin_size(MARGIN_LEFT,20);
- top_dark_sb->set_expand_margin_size(MARGIN_RIGHT,20);
-
- top_dark_panel->add_style_override("panel",top_dark_sb);
- VBoxContainer *top_dark_vb = memnew( VBoxContainer );
- main_vbox->add_child(top_dark_panel);
- top_dark_panel->add_child(top_dark_vb);
-#endif
-
menu_hb = memnew(HBoxContainer);
main_vbox->add_child(menu_hb);
- //top_dark_vb->add_child(scene_tabs);
//left
left_l_hsplit = memnew(HSplitContainer);
main_vbox->add_child(left_l_hsplit);
@@ -5318,10 +5300,10 @@ EditorNode::EditorNode() {
main_hsplit->connect("dragged", this, "_dock_split_dragged");
right_hsplit->connect("dragged", this, "_dock_split_dragged");
- dock_select_popoup = memnew(PopupPanel);
- gui_base->add_child(dock_select_popoup);
+ dock_select_popup = memnew(PopupPanel);
+ gui_base->add_child(dock_select_popup);
VBoxContainer *dock_vb = memnew(VBoxContainer);
- dock_select_popoup->add_child(dock_vb);
+ dock_select_popup->add_child(dock_vb);
HBoxContainer *dock_hb = memnew(HBoxContainer);
dock_tab_move_left = memnew(ToolButton);
@@ -5348,14 +5330,13 @@ EditorNode::EditorNode() {
dock_select->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_vb->add_child(dock_select);
- dock_select_popoup->set_as_minsize();
+ dock_select_popup->set_as_minsize();
dock_select_rect_over = -1;
dock_popup_selected = -1;
- //dock_select_popoup->set_(Size2(20,20));
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
dock_slot[i]->set_custom_minimum_size(Size2(230, 220) * EDSCALE);
dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- dock_slot[i]->set_popup(dock_select_popoup);
+ dock_slot[i]->set_popup(dock_select_popup);
dock_slot[i]->connect("pre_popup_pressed", this, "_dock_pre_popup", varray(i));
dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
}
@@ -5376,10 +5357,6 @@ EditorNode::EditorNode() {
top_split->add_child(srt);
srt->add_constant_override("separation", 0);
- /* main_editor_tabs = memnew( Tabs );
- main_editor_tabs->connect("tab_changed",this,"_editor_select");
- main_editor_tabs->set_tab_close_display_policy(Tabs::SHOW_NEVER);
-*/
tab_preview_panel = memnew(Panel);
tab_preview_panel->set_size(Size2(100, 100) * EDSCALE);
tab_preview_panel->hide();
@@ -5493,7 +5470,6 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_W), FILE_CLOSE);
p->add_separator();
- //p->add_shortcut(ED_SHORTCUT("editor/save_scene",TTR("Close Goto Prev. Scene")),FILE_OPEN_PREV,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_P);
p->add_submenu_item(TTR("Open Recent"), "RecentScenes", FILE_OPEN_RECENT);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/quick_open_scene", TTR("Quick Open Scene.."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCENE);
@@ -5561,35 +5537,6 @@ EditorNode::EditorNode() {
menu_hb->add_spacer();
menu_hb->add_child(editor_region);
-//menu_hb->add_spacer();
-#if 0
- node_menu = memnew( MenuButton );
- node_menu->set_text("Node");
- node_menu->set_position( Point2( 50,0) );
- menu_panel->add_child( node_menu );
-
- p=node_menu->get_popup();
- p->add_item("Create",NODE_CREATE);
- p->add_item("Instance",NODE_INSTANCE);
- p->add_separator();
- p->add_item("Reparent",NODE_REPARENT);
- p->add_item("Move Up",NODE_MOVE_UP);
- p->add_item("Move Down",NODE_MOVE_DOWN);
- p->add_separator();
- p->add_item("Duplicate",NODE_DUPLICATE);
- p->add_separator();
- p->add_item("Remove (Branch)",NODE_REMOVE_BRANCH);
- p->add_item("Remove (Element)",NODE_REMOVE_ELEMENT);
- p->add_separator();
- p->add_item("Edit Subscriptions..",NODE_CONNECTIONS);
- p->add_item("Edit Groups..",NODE_GROUPS);
-
- resource_menu = memnew( MenuButton );
- resource_menu->set_text("Resource");
- resource_menu->set_position( Point2( 90,0) );
- menu_panel->add_child( resource_menu );
-#endif
-
debug_menu = memnew(MenuButton);
debug_menu->set_text(TTR("Debug"));
debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
@@ -5642,7 +5589,7 @@ EditorNode::EditorNode() {
p = help_menu->get_popup();
p->connect("id_pressed", this, "_menu_option");
p->add_icon_item(gui_base->get_icon("ClassList", "EditorIcons"), TTR("Classes"), HELP_CLASSES);
- p->add_icon_item(gui_base->get_icon("Help", "EditorIcons"), TTR("Search"), HELP_SEARCH);
+ p->add_icon_item(gui_base->get_icon("HelpSearch", "EditorIcons"), TTR("Search"), HELP_SEARCH);
p->add_separator();
p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS);
p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Q&A"), HELP_QA);
@@ -5651,11 +5598,6 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_icon_item(gui_base->get_icon("GodotDocs", "EditorIcons"), TTR("About"), HELP_ABOUT);
- //Separator *s1 = memnew( VSeparator );
- //menu_panel->add_child(s1);
- //s1->set_position(Point2(210,4));
- //s1->set_size(Point2(10,15));
-
play_cc = memnew(CenterContainer);
play_cc->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
menu_hb->add_child(play_cc);
@@ -5680,7 +5622,6 @@ EditorNode::EditorNode() {
play_button->set_shortcut(ED_SHORTCUT("editor/play", TTR("Play"), KEY_F5));
pause_button = memnew(ToolButton);
- //menu_panel->add_child(pause_button); - not needed for now?
pause_button->set_toggle_mode(true);
pause_button->set_icon(gui_base->get_icon("Pause", "EditorIcons"));
pause_button->set_focus_mode(Control::FOCUS_NONE);
@@ -5708,9 +5649,6 @@ EditorNode::EditorNode() {
native_play_button->get_popup()->connect("id_pressed", this, "_run_in_device");
run_native->connect("native_run", this, "_menu_option", varray(RUN_PLAY_NATIVE));
- //VSeparator *s1 = memnew( VSeparator );
- //play_hb->add_child(s1);
-
play_scene_button = memnew(ToolButton);
play_hb->add_child(play_scene_button);
play_scene_button->set_toggle_mode(true);
@@ -5729,24 +5667,6 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
- /*
- run_settings_button = memnew( ToolButton );
- //menu_hb->add_child(run_settings_button);
- //run_settings_button->set_toggle_mode(true);
- run_settings_button->set_focus_mode(Control::FOCUS_NONE);
- run_settings_button->set_icon(gui_base->get_icon("Run","EditorIcons"));
- run_settings_button->connect("pressed", this,"_menu_option",make_binds(RUN_SCENE_SETTINGS));
-*/
-
- /*
- run_settings_button = memnew( ToolButton );
- menu_panel->add_child(run_settings_button);
- run_settings_button->set_position(Point2(305,0));
- run_settings_button->set_focus_mode(Control::FOCUS_NONE);
- run_settings_button->set_icon(gui_base->get_icon("Run","EditorIcons"));
- run_settings_button->connect("pressed", this,"_menu_option",make_binds(RUN_SETTINGS));
-*/
-
progress_hb = memnew(BackgroundProgress);
//menu_hb->add_child(progress_hb);
@@ -5785,52 +5705,15 @@ EditorNode::EditorNode() {
p->add_check_item(TTR("Disable Update Spinner"), SETTINGS_UPDATE_SPINNER_HIDE);
p->set_item_checked(1, true);
- //sources_button->connect();
-
- /*
- Separator *s2 = memnew( VSeparator );
- menu_panel->add_child(s2);
- s2->set_position(Point2(338,4));
- s2->set_size(Point2(10,15));
-*/
-
- //editor_hsplit = memnew( HSplitContainer );
- //main_split->add_child(editor_hsplit);
- //editor_hsplit->set_v_size_flags(Control::SIZE_EXPAND_FILL);
-
- //editor_vsplit = memnew( VSplitContainer );
- //editor_hsplit->add_child(editor_vsplit);
-
- //top_pallete = memnew( TabContainer );
scene_tree_dock = memnew(SceneTreeDock(this, scene_root, editor_selection, editor_data));
scene_tree_dock->set_name(TTR("Scene"));
- //top_pallete->add_child(scene_tree_dock);
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(scene_tree_dock);
#if 0
resources_dock = memnew( ResourcesDock(this) );
resources_dock->set_name("Resources");
- //top_pallete->add_child(resources_dock);
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(resources_dock);
- //top_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
#endif
dock_slot[DOCK_SLOT_LEFT_BR]->hide();
- /*Control *editor_spacer = memnew( Control );
- editor_spacer->set_custom_minimum_size(Size2(260,200));
- editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- editor_vsplit->add_child( editor_spacer );
- editor_spacer->add_child( top_pallete );
- top_pallete->set_area_as_parent_rect();*/
-
- //prop_pallete = memnew( TabContainer );
-
- //prop_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
-
- /*editor_spacer = memnew( Control );
- editor_spacer->set_custom_minimum_size(Size2(260,200));
- editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- editor_vsplit->add_child( editor_spacer );
- editor_spacer->add_child( prop_pallete );
- prop_pallete->set_area_as_parent_rect();*/
VBoxContainer *prop_editor_base = memnew(VBoxContainer);
prop_editor_base->set_name(TTR("Inspector")); // Properties?
@@ -5972,7 +5855,6 @@ EditorNode::EditorNode() {
} else {
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(filesystem_dock);
}
- //prop_pallete->add_child(filesystem_dock);
filesystem_dock->connect("open", this, "open_request");
filesystem_dock->connect("instance", this, "_instance_request");
@@ -6023,17 +5905,6 @@ EditorNode::EditorNode() {
//progress_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- /*
- animation_menu = memnew( ToolButton );
- animation_menu->set_position(Point2(500,0));
- animation_menu->set_size(Size2(20,20));
- animation_menu->set_toggle_mode(true);
- animation_menu->set_focus_mode(Control::FOCUS_NONE);
- menu_panel->add_child(animation_menu);
- animation_menu->set_icon(gui_base->get_icon("Animation","EditorIcons"));
- animation_menu->connect("pressed",this,"_animation_visibility_toggle");
-*/
-
orphan_resources = memnew(OrphanResourcesDialog);
gui_base->add_child(orphan_resources);
@@ -6088,10 +5959,6 @@ EditorNode::EditorNode() {
import_confirmation->connect("custom_action", this, "_import_action");
gui_base->add_child(import_confirmation);
- open_recent_confirmation = memnew(ConfirmationDialog);
- add_child(open_recent_confirmation);
- open_recent_confirmation->connect("confirmed", this, "_open_recent_scene_confirm");
-
run_settings_dialog = memnew(RunSettingsDialog);
gui_base->add_child(run_settings_dialog);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 991cf1df71..228fbe7196 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -247,10 +247,7 @@ private:
Control *vp_base;
PaneDrag *pd;
//PaneDrag *pd_anim;
- Panel *menu_panel;
- //HSplitContainer *editor_hsplit;
- //VSplitContainer *editor_vsplit;
CenterContainer *play_cc;
HBoxContainer *menu_hb;
Control *viewport;
@@ -300,7 +297,6 @@ private:
ConfirmationDialog *confirmation;
ConfirmationDialog *save_confirmation;
ConfirmationDialog *import_confirmation;
- ConfirmationDialog *open_recent_confirmation;
ConfirmationDialog *pick_main_scene;
AcceptDialog *accept;
AcceptDialog *about;
@@ -326,8 +322,6 @@ private:
String current_path;
MenuButton *update_menu;
- //TabContainer *prop_pallete;
- //TabContainer *top_pallete;
String defer_load_scene;
String defer_export;
String defer_export_platform;
@@ -363,7 +357,7 @@ private:
TabContainer *dock_slot[DOCK_SLOT_MAX];
Rect2 dock_select_rect[DOCK_SLOT_MAX];
int dock_select_rect_over;
- PopupPanel *dock_select_popoup;
+ PopupPanel *dock_select_popup;
Control *dock_select;
ToolButton *dock_tab_move_left;
ToolButton *dock_tab_move_right;
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 3ad9843e36..968be43946 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -171,6 +171,46 @@ void EditorPlugin::set_input_event_forwarding_always_enabled() {
always_input_forwarding_list->add_plugin(this);
}
+Node *EditorPlugin::get_edited_scene_root() {
+ return EditorNode::get_singleton()->get_edited_scene();
+}
+
+Array EditorPlugin::get_opened_scenes_list() const {
+
+ Array ret;
+ Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes();
+
+ int scns_amount = scenes.size();
+ for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) {
+ if (scenes[idx_scn].root == NULL)
+ continue;
+ ret.push_back(scenes[idx_scn].root->get_filename());
+ }
+ return ret;
+}
+
+ScriptEditor *EditorPlugin::get_script_editor() {
+ return ScriptEditor::get_singleton();
+}
+
+void EditorPlugin::notify_scene_changed(const Node *scn_root) {
+ if (scn_root == NULL) return;
+ emit_signal("scene_changed", scn_root);
+}
+
+void EditorPlugin::notify_main_screen_changed(const String &screen_name) {
+
+ if (screen_name == last_main_screen_name)
+ return;
+
+ emit_signal("main_screen_changed", screen_name);
+ last_main_screen_name = screen_name;
+}
+
+void EditorPlugin::notify_scene_closed(const String &scene_filepath) {
+ emit_signal("scene_closed", scene_filepath);
+}
+
Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial *p_spatial) {
//??
if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) {
@@ -392,6 +432,7 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_undo_redo:UndoRedo"), &EditorPlugin::_get_undo_redo);
ClassDB::bind_method(D_METHOD("get_selection:EditorSelection"), &EditorPlugin::get_selection);
ClassDB::bind_method(D_METHOD("get_editor_settings:EditorSettings"), &EditorPlugin::get_editor_settings);
+ ClassDB::bind_method(D_METHOD("get_script_editor:ScriptEditor"), &EditorPlugin::get_script_editor);
ClassDB::bind_method(D_METHOD("queue_save_layout"), &EditorPlugin::queue_save_layout);
ClassDB::bind_method(D_METHOD("edit_resource", "resource:Resource"), &EditorPlugin::edit_resource);
ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorPlugin::open_scene_from_path);
@@ -399,6 +440,9 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::add_import_plugin);
ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::remove_import_plugin);
ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled);
+ ClassDB::bind_method(D_METHOD("get_opened_scenes_list"), &EditorPlugin::get_opened_scenes_list);
+ ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &EditorPlugin::get_edited_scene_root);
+
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_draw_over_canvas", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "canvas:Control")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
@@ -420,6 +464,10 @@ void EditorPlugin::_bind_methods() {
ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
+ ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root:Node")));
+ ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath:String")));
+ ADD_SIGNAL(MethodInfo("main_screen_changed", PropertyInfo(Variant::STRING, "screen_name:String")));
+
BIND_CONSTANT(CONTAINER_TOOLBAR);
BIND_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU);
BIND_CONSTANT(CONTAINER_SPATIAL_EDITOR_SIDE);
@@ -442,6 +490,7 @@ void EditorPlugin::_bind_methods() {
EditorPlugin::EditorPlugin() {
undo_redo = NULL;
input_event_forwarding_always_enabled = false;
+ last_main_screen_name = "";
}
EditorPlugin::~EditorPlugin() {
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 3653851d5a..2c920323a1 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -52,6 +52,8 @@ class EditorImportPlugin;
class EditorExportPlugin;
class EditorResourcePreview;
class EditorFileSystem;
+class EditorToolAddons;
+class ScriptEditor;
class EditorPlugin : public Node {
@@ -63,6 +65,8 @@ class EditorPlugin : public Node {
bool input_event_forwarding_always_enabled;
+ String last_main_screen_name;
+
protected:
static void _bind_methods();
UndoRedo &get_undo_redo() { return *undo_redo; }
@@ -113,6 +117,14 @@ public:
void set_input_event_forwarding_always_enabled();
bool is_input_event_forwarding_always_enabled() { return input_event_forwarding_always_enabled; }
+ Node *get_edited_scene_root();
+ Array get_opened_scenes_list() const;
+ ScriptEditor *get_script_editor();
+
+ void notify_main_screen_changed(const String &screen_name);
+ void notify_scene_changed(const Node *scn_root);
+ void notify_scene_closed(const String &scene_filepath);
+
virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event);
virtual void forward_draw_over_canvas(const Transform2D &p_canvas_xform, Control *p_canvas);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index ce9b004ce1..4e8f7029ff 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -69,6 +69,15 @@ static Ref<StyleBoxFlat> make_flat_stylebox(Color color, float p_margin_left = -
return style;
}
+static Ref<StyleBoxLine> make_line_stylebox(Color color, int thickness = 1, float grow = 1, bool vertical = false) {
+ Ref<StyleBoxLine> style(memnew(StyleBoxLine));
+ style->set_color(color);
+ style->set_grow(grow);
+ style->set_thickness(thickness);
+ style->set_vertical(vertical);
+ return style;
+}
+
static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_color) {
Ref<StyleBoxFlat> style = p_style->duplicate();
style->set_light_color(p_color);
@@ -143,6 +152,9 @@ Ref<Theme> create_editor_theme() {
Color title_color_hl_text_color = dark_bg ? Color(1, 1, 1, 0.9) : Color(0, 0, 0, 0.9);
Ref<Texture> title_hl_close_icon = theme->get_icon((dark_bg ? "GuiCloseLight" : "GuiCloseDark"), "EditorIcons");
+ bool dark_base = ((base_color.r + base_color.g + base_color.b) / 3.0) < 0.5;
+ Color separator_color = dark_base ? Color(1, 1, 1, 0.1) : Color(0, 0, 0, 0.1);
+
theme->set_color("highlight_color", "Editor", highlight_color);
theme->set_color("base_color", "Editor", base_color);
theme->set_color("dark_color_1", "Editor", dark_color_1);
@@ -244,7 +256,7 @@ Ref<Theme> create_editor_theme() {
theme->set_color("icon_color_pressed", "Button", Color(highlight_color.r * 1.15, highlight_color.g * 1.15, highlight_color.b * 1.15, highlight_color.a));
// OptionButton
- Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
+ Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 8, 4);
style_option_button->set_border_size(border_width);
style_option_button->set_light_color(light_color_1);
style_option_button->set_dark_color(light_color_1);
@@ -259,6 +271,8 @@ Ref<Theme> create_editor_theme() {
theme->set_color("font_color_pressed", "OptionButton", highlight_color);
theme->set_color("icon_color_hover", "OptionButton", HIGHLIGHT_COLOR_LIGHT);
theme->set_icon("arrow", "OptionButton", theme->get_icon("GuiOptionArrow", "EditorIcons"));
+ theme->set_constant("arrow_margin", "OptionButton", 4);
+ theme->set_constant("modulate_arrow", "OptionButton", true);
// CheckButton
theme->set_icon("on", "CheckButton", theme->get_icon("GuiToggleOn", "EditorIcons"));
@@ -271,7 +285,7 @@ Ref<Theme> create_editor_theme() {
style_popup_menu->set_dark_color(light_color_1);
style_popup_menu->set_border_blend(false);
theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
- theme->set_stylebox("separator", "PopupMenu", make_empty_stylebox());
+ theme->set_stylebox("separator", "PopupMenu", make_line_stylebox(separator_color, border_width, 8 - border_width));
// Tree & ItemList background
Ref<StyleBoxFlat> style_tree_bg = make_flat_stylebox(dark_color_1, 2, 4, 2, 4);
@@ -362,8 +376,8 @@ Ref<Theme> create_editor_theme() {
theme->set_icon("close", "Tabs", title_hl_close_icon);
// Separatos (no separatos)
- theme->set_stylebox("separator", "HSeparator", make_empty_stylebox());
- theme->set_stylebox("separator", "VSeparator", make_empty_stylebox());
+ theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width));
+ theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, border_width, 0, true));
// Debugger
Ref<StyleBoxFlat> style_panel_debugger = make_flat_stylebox(dark_color_2, 0, 4, 0, 0);
diff --git a/editor/icons/2x/icon_variant.png b/editor/icons/2x/icon_variant.png
new file mode 100644
index 0000000000..bb8075a069
--- /dev/null
+++ b/editor/icons/2x/icon_variant.png
Binary files differ
diff --git a/editor/icons/icon_variant.png b/editor/icons/icon_variant.png
index 1ae2812ff7..af7590345e 100644
--- a/editor/icons/icon_variant.png
+++ b/editor/icons/icon_variant.png
Binary files differ
diff --git a/editor/icons/source/icon_variant.svg b/editor/icons/source/icon_variant.svg
new file mode 100644
index 0000000000..d966190ab0
--- /dev/null
+++ b/editor/icons/source/icon_variant.svg
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92+devel unknown"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_variant.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627418"
+ inkscape:cx="12.635414"
+ inkscape:cy="11.860443"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-midpoints="true"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true"
+ inkscape:document-rotation="0">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <g
+ transform="translate(0,-3)"
+ id="layer1-5"
+ inkscape:label="Layer 1"
+ style="fill:#e0e0e0;fill-opacity:1">
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4320"
+ width="2"
+ height="5.9999666"
+ x="3"
+ y="1044.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4324"
+ width="2"
+ height="5.9999843"
+ x="6"
+ y="1044.3622" />
+ <rect
+ y="1044.3622"
+ x="3"
+ height="2.0000174"
+ width="1"
+ id="rect4326"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1044.3622 a 3,3 0 0 0 -3,3 h 2 a 1.0000174,1.0000174 0 0 1 1,-1 z"
+ id="path4328"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path4330"
+ d="m 14,1050.3622 a 3,3 0 0 1 -3,-3 h 2 a 1.0000174,1.0000174 0 0 0 1,1 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1052.3622"
+ x="14"
+ height="7.9999843"
+ width="2"
+ id="rect4334"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1047.3622"
+ x="11"
+ height="2.9999826"
+ width="2"
+ id="rect4338"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4340"
+ d="m 3,1050.3622 a 3,3 0 0 1 -3,-3 h 2 a 1.0000174,1.0000174 0 0 0 1,1 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4342"
+ d="m 8,1044.3622 a 3,3 0 0 1 3,3 H 9 a 1.0000174,1.0000174 0 0 0 -1,-1 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1047.3622"
+ x="9"
+ height="3.0000174"
+ width="2"
+ id="rect4344"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index b059e63467..c8936c8c35 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -3386,6 +3386,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
key_loc_button = memnew(Button("loc"));
key_loc_button->set_toggle_mode(true);
+ key_loc_button->set_flat(true);
key_loc_button->set_pressed(true);
key_loc_button->set_focus_mode(FOCUS_NONE);
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);
key_rot_button = memnew(Button("rot"));
key_rot_button->set_toggle_mode(true);
+ key_rot_button->set_flat(true);
key_rot_button->set_pressed(true);
key_rot_button->set_focus_mode(FOCUS_NONE);
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);
key_scale_button = memnew(Button("scl"));
key_scale_button->set_toggle_mode(true);
+ key_scale_button->set_flat(true);
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_pressed", Color(0.6, 1, 0.6));
key_scale_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_SCALE));
animation_hb->add_child(key_scale_button);
key_insert_button = memnew(Button);
+ key_insert_button->set_flat(true);
key_insert_button->set_focus_mode(FOCUS_NONE);
key_insert_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_KEY));
key_insert_button->set_tooltip(TTR("Insert Keys"));
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d10831eea1..f7952e77f2 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -405,6 +405,8 @@ void ScriptEditor::_go_to_tab(int p_idx) {
script_icon->set_texture(c->cast_to<ScriptEditorBase>()->get_icon());
if (is_visible_in_tree())
c->cast_to<ScriptEditorBase>()->ensure_focus();
+
+ notify_script_changed(c->cast_to<ScriptEditorBase>()->get_edited_script());
}
if (c->cast_to<EditorHelp>()) {
@@ -510,7 +512,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) {
apply_scripts();
}
current->clear_edit_menu();
-
+ notify_script_close(current->get_edited_script());
} else {
EditorHelp *help = tab_container->get_child(selected)->cast_to<EditorHelp>();
_add_recent_script(help->get_class());
@@ -777,6 +779,31 @@ void ScriptEditor::_file_dialog_action(String p_file) {
file_dialog_option = -1;
}
+Ref<Script> ScriptEditor::_get_current_script() {
+
+ int selected = tab_container->get_current_tab();
+ if (selected < 0 || selected >= tab_container->get_child_count())
+ return NULL;
+
+ ScriptEditorBase *current = tab_container->get_child(selected)->cast_to<ScriptEditorBase>();
+ if (current) {
+ return current->get_edited_script();
+ } else {
+ return NULL;
+ }
+}
+
+Array ScriptEditor::_get_opened_script_list() const {
+
+ Array ret;
+ Vector<Ref<Script> > scripts = get_opened_scripts();
+ int scrits_amount = scripts.size();
+ for (int idx_script = 0; idx_script < scrits_amount; idx_script++) {
+ ret.push_back(scripts[idx_script]);
+ }
+ return ret;
+}
+
void ScriptEditor::_menu_option(int p_option) {
switch (p_option) {
@@ -1127,6 +1154,14 @@ void ScriptEditor::edited_scene_changed() {
_update_modified_scripts_for_external_editor();
}
+void ScriptEditor::notify_script_close(const Ref<Script> &p_script) {
+ emit_signal("script_close", p_script);
+}
+
+void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
+ emit_signal("script_changed", p_script);
+}
+
static const Node *_find_node_with_script(const Node *p_node, const RefPtr &p_script) {
if (p_node->get_script() == p_script)
@@ -1662,6 +1697,7 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
if (p_line >= 0)
se->goto_line(p_line - 1);
+ notify_script_changed(p_script);
return true;
}
@@ -2038,6 +2074,8 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
n->cast_to<ScriptEditorBase>()->set_edit_state(history[history_pos].state);
n->cast_to<ScriptEditorBase>()->ensure_focus();
+
+ notify_script_changed(n->cast_to<ScriptEditorBase>()->get_edited_script());
}
if (n->cast_to<EditorHelp>()) {
@@ -2065,6 +2103,21 @@ void ScriptEditor::_history_back() {
_update_history_pos(history_pos - 1);
}
}
+
+Vector<Ref<Script> > ScriptEditor::get_opened_scripts() const {
+
+ Vector<Ref<Script> > out_scripts = Vector<Ref<Script> >();
+
+ for (int i = 0; i < tab_container->get_child_count(); i++) {
+ ScriptEditorBase *se = tab_container->get_child(i)->cast_to<ScriptEditorBase>();
+ if (!se)
+ continue;
+ out_scripts.push_back(se->get_edited_script());
+ }
+
+ return out_scripts;
+}
+
void ScriptEditor::set_scene_root_script(Ref<Script> p_script) {
bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
@@ -2158,6 +2211,12 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_history_back", &ScriptEditor::_history_back);
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input);
+
+ ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
+ ClassDB::bind_method(D_METHOD("get_opened_scripts_list"), &ScriptEditor::_get_opened_script_list);
+
+ ADD_SIGNAL(MethodInfo("script_changed", PropertyInfo(Variant::OBJECT, "script:Script")));
+ ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::STRING, "script:String")));
}
ScriptEditor::ScriptEditor(EditorNode *p_editor) {
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 010a5604ec..3d03eb0f49 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -321,6 +321,9 @@ class ScriptEditor : public PanelContainer {
int file_dialog_option;
void _file_dialog_action(String p_file);
+ Ref<Script> _get_current_script();
+ Array _get_opened_script_list() const;
+
static void _open_script_request(const String &p_path);
static ScriptEditor *script_editor;
@@ -354,11 +357,15 @@ public:
void get_window_layout(Ref<ConfigFile> p_layout);
void set_scene_root_script(Ref<Script> p_script);
+ Vector<Ref<Script> > get_opened_scripts() const;
bool script_goto_method(Ref<Script> p_script, const String &p_method);
virtual void edited_scene_changed();
+ void notify_script_close(const Ref<Script> &p_script);
+ void notify_script_changed(const Ref<Script> &p_script);
+
void close_builtin_scripts_from_scene(const String &p_scene);
void goto_help(const String &p_desc) { _help_class_goto(p_desc); }
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 9dce48937c..c2e54ebd69 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1625,24 +1625,24 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
hbc->add_child(memnew(VSeparator));
- step = memnew(Button);
+ step = memnew(ToolButton);
hbc->add_child(step);
step->set_tooltip(TTR("Step Into"));
step->connect("pressed", this, "debug_step");
- next = memnew(Button);
+ next = memnew(ToolButton);
hbc->add_child(next);
next->set_tooltip(TTR("Step Over"));
next->connect("pressed", this, "debug_next");
hbc->add_child(memnew(VSeparator));
- dobreak = memnew(Button);
+ dobreak = memnew(ToolButton);
hbc->add_child(dobreak);
dobreak->set_tooltip(TTR("Break"));
dobreak->connect("pressed", this, "debug_break");
- docontinue = memnew(Button);
+ docontinue = memnew(ToolButton);
hbc->add_child(docontinue);
docontinue->set_tooltip(TTR("Continue"));
docontinue->connect("pressed", this, "debug_continue");
@@ -1816,7 +1816,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
vmem_total->set_editable(false);
vmem_total->set_custom_minimum_size(Size2(100, 1) * EDSCALE);
vmem_hb->add_child(vmem_total);
- vmem_refresh = memnew(Button);
+ vmem_refresh = memnew(ToolButton);
vmem_hb->add_child(vmem_refresh);
vmem_vb->add_child(vmem_hb);
vmem_refresh->connect("pressed", this, "_video_mem_request");
@@ -1849,30 +1849,31 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
}
{ // misc
- VBoxContainer *info_left = memnew(VBoxContainer);
- info_left->set_h_size_flags(SIZE_EXPAND_FILL);
+ GridContainer *info_left = memnew(GridContainer);
+ info_left->set_columns(2);
info_left->set_name(TTR("Misc"));
tabs->add_child(info_left);
clicked_ctrl = memnew(LineEdit);
- info_left->add_margin_child(TTR("Clicked Control:"), clicked_ctrl);
+ clicked_ctrl->set_h_size_flags(SIZE_EXPAND_FILL);
+ info_left->add_child(memnew(Label(TTR("Clicked Control:"))));
+ info_left->add_child(clicked_ctrl);
clicked_ctrl_type = memnew(LineEdit);
- info_left->add_margin_child(TTR("Clicked Control Type:"), clicked_ctrl_type);
+ info_left->add_child(memnew(Label(TTR("Clicked Control Type:"))));
+ info_left->add_child(clicked_ctrl_type);
live_edit_root = memnew(LineEdit);
+ live_edit_root->set_h_size_flags(SIZE_EXPAND_FILL);
{
HBoxContainer *lehb = memnew(HBoxContainer);
Label *l = memnew(Label(TTR("Live Edit Root:")));
- lehb->add_child(l);
- l->set_h_size_flags(SIZE_EXPAND_FILL);
+ info_left->add_child(l);
+ lehb->add_child(live_edit_root);
le_set = memnew(Button(TTR("Set From Tree")));
lehb->add_child(le_set);
le_clear = memnew(Button(TTR("Clear")));
lehb->add_child(le_clear);
info_left->add_child(lehb);
- MarginContainer *mc = memnew(MarginContainer);
- mc->add_child(live_edit_root);
- info_left->add_child(mc);
le_set->set_disabled(true);
le_clear->set_disabled(true);
}