summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp29
-rw-r--r--tools/editor/plugins/script_editor_plugin.h7
-rw-r--r--tools/editor/property_editor.cpp1
-rw-r--r--tools/editor/property_selector.cpp1
5 files changed, 36 insertions, 4 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 85c560bf9d..ea553c5597 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -1673,7 +1673,7 @@ void EditorNode::_edit_current() {
if (main_plugin) {
- if (main_plugin!=editor_plugin_screen) {
+ if (main_plugin!=editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible() || ScriptEditor::get_singleton()->can_take_away_focus())) {
// update screen main_plugin
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 74c8ac9766..fdb7856b83 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -987,6 +987,20 @@ void ScriptEditor::_notification(int p_what) {
}
+bool ScriptEditor::can_take_away_focus() const {
+
+ int selected = tab_container->get_current_tab();
+ if (selected<0 || selected>=tab_container->get_child_count())
+ return true;
+
+ ScriptEditorBase *current = tab_container->get_child(selected)->cast_to<ScriptEditorBase>();
+ if (!current)
+ return true;
+
+
+ return current->can_lose_focus_on_node_selection();
+
+}
void ScriptEditor::close_builtin_scripts_from_scene(const String& p_scene) {
@@ -1397,7 +1411,7 @@ void ScriptEditor::_update_script_names() {
-void ScriptEditor::edit(const Ref<Script>& p_script) {
+void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) {
if (p_script.is_null())
return;
@@ -1471,7 +1485,9 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
}
- _go_to_tab(tab_container->get_tab_count()-1);
+ if (p_grab_focus) {
+ _go_to_tab(tab_container->get_tab_count()-1);
+ }
@@ -1932,6 +1948,13 @@ void ScriptEditor::_help_search(String p_text) {
help_search_dialog->popup(p_text);
}
+void ScriptEditor::_open_script_request(const String& p_path) {
+
+ Ref<Script> script = ResourceLoader::load(p_path);
+ if (script.is_valid()) {
+ script_editor->edit(script,false);
+ }
+}
int ScriptEditor::script_editor_func_count=0;
CreateScriptEditorFunc ScriptEditor::script_editor_funcs[ScriptEditor::SCRIPT_EDITOR_FUNC_MAX];
@@ -2208,6 +2231,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
edit_pass=0;
trim_trailing_whitespace_on_save = false;
+
+ ScriptServer::edit_request_func=_open_script_request;
}
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 0ba2efce34..1a23ffed72 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -101,6 +101,7 @@ public:
virtual void add_callback(const String& p_function,StringArray p_args)=0;
virtual void update_settings()=0;
virtual void set_debugger_active(bool p_active)=0;
+ virtual bool can_lose_focus_on_node_selection() { return true; }
virtual void set_tooltip_request_func(String p_method,Object* p_obj)=0;
virtual Control *get_edit_menu()=0;
@@ -285,6 +286,8 @@ class ScriptEditor : public VBoxContainer {
int file_dialog_option;
void _file_dialog_action(String p_file);
+ static void _open_script_request(const String& p_path);
+
static ScriptEditor *script_editor;
protected:
void _notification(int p_what);
@@ -297,7 +300,7 @@ public:
void apply_scripts() const;
void ensure_select_current();
- void edit(const Ref<Script>& p_script);
+ void edit(const Ref<Script>& p_script,bool p_grab_focus=true);
Dictionary get_state() const;
void set_state(const Dictionary& p_state);
@@ -322,6 +325,8 @@ public:
void goto_help(const String& p_desc) { _help_class_goto(p_desc); }
+ bool can_take_away_focus() const;
+
ScriptEditorDebugger *get_debugger() { return debugger; }
void set_live_auto_reload_running_scripts(bool p_enabled);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index ea036593b8..d7e527f473 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -1151,6 +1151,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
file->clear_filters();
+
if (hint_text!="") {
Vector<String> extensions=hint_text.split(",");
for(int i=0;i<extensions.size();i++) {
diff --git a/tools/editor/property_selector.cpp b/tools/editor/property_selector.cpp
index e960a0e0d3..20b72240d9 100644
--- a/tools/editor/property_selector.cpp
+++ b/tools/editor/property_selector.cpp
@@ -508,6 +508,7 @@ void PropertySelector::select_property_from_base_type(const String& p_base,const
void PropertySelector::select_property_from_script(const Ref<Script>& p_script,const String& p_current){
ERR_FAIL_COND( p_script.is_null() );
+
base_type=p_script->get_instance_base_type();
selected=p_current;
type=Variant::NIL;