aboutsummaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/SCsub2
-rw-r--r--tools/editor/editor_settings.cpp28
-rw-r--r--tools/editor/editor_settings.h3
-rw-r--r--tools/editor/fileserver/SCsub2
-rw-r--r--tools/editor/filesystem_dock.cpp7
-rw-r--r--tools/editor/icons/SCsub2
-rw-r--r--tools/editor/io_plugins/SCsub2
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp20
-rw-r--r--tools/editor/plugins/SCsub2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp1
-rw-r--r--tools/editor/property_editor.cpp16
-rw-r--r--tools/editor/script_create_dialog.cpp14
-rw-r--r--tools/editor/script_create_dialog.h2
13 files changed, 89 insertions, 12 deletions
diff --git a/tools/editor/SCsub b/tools/editor/SCsub
index 34651b36f..f6cb16dc2 100644
--- a/tools/editor/SCsub
+++ b/tools/editor/SCsub
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
Import('env')
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index bdbf20e34..f5741c4a9 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -1026,6 +1026,34 @@ void EditorSettings::set_optimize_save(bool p_optimize) {
optimize_save=p_optimize;
}
+String EditorSettings::get_last_selected_language()
+{
+ Ref<ConfigFile> cf = memnew( ConfigFile );
+ String path = get_project_settings_path().plus_file("project_metadata.cfg");
+ Error err = cf->load(path);
+ if (err != OK) {
+ WARN_PRINTS("Can't load config file: " + path);
+ return "";
+ }
+ Variant last_selected_language = cf->get_value("script_setup", "last_selected_language");
+ if (last_selected_language.get_type() != Variant::STRING)
+ return "";
+ return static_cast<String>(last_selected_language);
+}
+
+void EditorSettings::set_last_selected_language(String p_language)
+{
+ Ref<ConfigFile> cf = memnew( ConfigFile );
+ String path = get_project_settings_path().plus_file("project_metadata.cfg");
+ Error err = cf->load(path);
+ if (err != OK) {
+ WARN_PRINTS("Can't load config file: " + path);
+ return;
+ }
+ cf->set_value("script_setup", "last_selected_language", p_language);
+ cf->save(path);
+}
+
void EditorSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("erase","property"),&EditorSettings::erase);
diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h
index 2a7d3bb4f..a97660230 100644
--- a/tools/editor/editor_settings.h
+++ b/tools/editor/editor_settings.h
@@ -160,6 +160,9 @@ public:
void set_optimize_save(bool p_optimize);
+ String get_last_selected_language();
+ void set_last_selected_language(String p_language);
+
EditorSettings();
~EditorSettings();
diff --git a/tools/editor/fileserver/SCsub b/tools/editor/fileserver/SCsub
index 363a2ce4c..6299fd416 100644
--- a/tools/editor/fileserver/SCsub
+++ b/tools/editor/fileserver/SCsub
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
Import('env')
Export('env')
env.add_source_files(env.tool_sources,"*.cpp")
diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp
index 8a94c6e34..5b1e80fc3 100644
--- a/tools/editor/filesystem_dock.cpp
+++ b/tools/editor/filesystem_dock.cpp
@@ -234,13 +234,6 @@ void FileSystemDock::_dir_selected() {
button_favorite->set_pressed(found);
- if (ti->get_parent() && ti->get_parent()->get_parent()==tree->get_root() && !ti->get_parent()->get_prev()) {
-
- //a favorite!!!
- } else {
-
-
- }
if (!split_mode) {
_open_pressed(); //go directly to dir
diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub
index 44e28f49e..9e05d8f39 100644
--- a/tools/editor/icons/SCsub
+++ b/tools/editor/icons/SCsub
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
Import('env')
def make_editor_icons_action(target, source, env):
diff --git a/tools/editor/io_plugins/SCsub b/tools/editor/io_plugins/SCsub
index 363a2ce4c..6299fd416 100644
--- a/tools/editor/io_plugins/SCsub
+++ b/tools/editor/io_plugins/SCsub
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
Import('env')
Export('env')
env.add_source_files(env.tool_sources,"*.cpp")
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index 190b56fab..56af35c6d 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -175,6 +175,7 @@ class EditorSceneImportDialog : public ConfirmationDialog {
EditorDirDialog *save_select;
OptionButton *texture_action;
CreateDialog *root_type_choose;
+ LineEdit *root_node_name;
ConfirmationDialog *confirm_open;
@@ -639,6 +640,7 @@ void EditorSceneImportDialog::_choose_file(const String& p_path) {
} else {
#endif
save_path->set_text("");
+ root_node_name->set_text("");
//save_path->set_text(p_path.get_file().basename()+".scn");
#if 0
}
@@ -656,6 +658,9 @@ void EditorSceneImportDialog::_choose_file(const String& p_path) {
import_path->set_text(p_path);
+ if (root_node_name->get_text().size()==0){
+ root_node_name->set_text(import_path->get_text().get_file().basename());
+ }
}
void EditorSceneImportDialog::_choose_save_file(const String& p_path) {
@@ -788,6 +793,10 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
if (!root_default->is_pressed()) {
rim->set_option("root_type",root_type->get_text());
}
+ if (root_node_name->get_text().size()==0) {
+ root_node_name->set_text(import_path->get_text().get_file().basename());
+ }
+ rim->set_option("root_name",root_node_name->get_text());
List<String> missing;
Error err = plugin->import1(rim,&scene,&missing);
@@ -946,7 +955,11 @@ void EditorSceneImportDialog::popup_import(const String &p_from) {
root_default->set_pressed(true);
root_type->set_disabled(true);
}
-
+ if (rimd->has_option("root_name")) {
+ root_node_name->set_text(rimd->get_option("root_name"));
+ } else {
+ root_node_name->set_text(root_type->get_text()); // backward compatibility for 2.1 or before
+ }
script_path->set_text(rimd->get_option("post_import_script"));
save_path->set_text(p_from.get_base_dir());
@@ -1241,7 +1254,9 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce
root_default->connect("pressed",this,"_root_default_pressed");
custom_root_hb->add_child(root_default);
-
+ root_node_name = memnew( LineEdit );
+ root_node_name->set_h_size_flags(SIZE_EXPAND_FILL);
+ vbc->add_margin_child(TTR("Root Node Name:"),root_node_name);
/*
this_import = memnew( OptionButton );
this_import->add_item("Overwrite Existing Scene");
@@ -2185,6 +2200,7 @@ Error EditorSceneImportPlugin::import1(const Ref<ResourceImportMetadata>& p_from
}
}
+ scene->set_name(from->get_option("root_name"));
_tag_import_paths(scene,scene);
*r_node=scene;
diff --git a/tools/editor/plugins/SCsub b/tools/editor/plugins/SCsub
index 363a2ce4c..6299fd416 100644
--- a/tools/editor/plugins/SCsub
+++ b/tools/editor/plugins/SCsub
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
Import('env')
Export('env')
env.add_source_files(env.tool_sources,"*.cpp")
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 3cd6d8336..99c50efd2 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1620,6 +1620,7 @@ void ScriptEditor::apply_scripts() const {
void ScriptEditor::_editor_play() {
debugger->start();
+ debug_menu->get_popup()->grab_focus();
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_NEXT), true );
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_STEP), true );
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_BREAK), false );
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index f18d5c928..ef6b1aa47 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -3613,9 +3613,10 @@ void PropertyEditor::update_tree() {
} break;
case Variant::NODE_PATH: {
- item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
+ item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
item->set_editable( 1, !read_only );
item->set_text(1,obj->get(p.name));
+ item->add_button(1, get_icon("Collapse", "EditorIcons"));
} break;
case Variant::OBJECT: {
@@ -3892,6 +3893,7 @@ void PropertyEditor::_item_edited() {
} break;
case Variant::NODE_PATH: {
+ _edit_set(name, NodePath(item->get_text(1)));
} break;
@@ -4067,7 +4069,17 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
String n = d["name"];
String ht = d["hint_text"];
- if (t==Variant::STRING) {
+ if(t == Variant::NODE_PATH) {
+
+ Variant v = obj->get(n);
+ custom_editor->edit(obj, n, (Variant::Type)t, v, h, ht);
+ Rect2 where = tree->get_item_rect(ti, 1);
+ where.pos -= tree->get_scroll();
+ where.pos += tree->get_global_pos();
+ custom_editor->set_pos(where.pos);
+ custom_editor->popup();
+
+ } else if (t==Variant::STRING) {
Variant v = obj->get(n);
diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp
index 749198314..62d5c7cd8 100644
--- a/tools/editor/script_create_dialog.cpp
+++ b/tools/editor/script_create_dialog.cpp
@@ -121,6 +121,8 @@ void ScriptCreateDialog::ok_pressed() {
Ref<Script> scr = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text());
//scr->set_source_code(text);
+ String selected_language = language_menu->get_item_text(language_menu->get_selected());
+ editor_settings->set_last_selected_language(selected_language);
if (cname!="")
scr->set_name(cname);
@@ -330,7 +332,17 @@ ScriptCreateDialog::ScriptCreateDialog() {
language_menu->add_item(ScriptServer::get_language(i)->get_name());
}
- language_menu->select(0);
+ editor_settings = EditorSettings::get_singleton();
+ String last_selected_language = editor_settings->get_last_selected_language();
+ if (last_selected_language != "")
+ for (int i = 0; i < language_menu->get_item_count(); i++)
+ if (language_menu->get_item_text(i) == last_selected_language)
+ {
+ language_menu->select(i);
+ break;
+ }
+ else language_menu->select(0);
+
language_menu->connect("item_selected",this,"_lang_changed");
//parent_name->set_text();
diff --git a/tools/editor/script_create_dialog.h b/tools/editor/script_create_dialog.h
index 181989402..c71ea16d3 100644
--- a/tools/editor/script_create_dialog.h
+++ b/tools/editor/script_create_dialog.h
@@ -33,6 +33,7 @@
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
#include "tools/editor/editor_file_dialog.h"
+#include "tools/editor/editor_settings.h"
#include "scene/gui/check_button.h"
class ScriptCreateDialog : public ConfirmationDialog {
@@ -50,6 +51,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
AcceptDialog *alert;
bool path_valid;
String initial_bp;
+ EditorSettings *editor_settings;
void _path_changed(const String& p_path=String());