summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp97
-rw-r--r--editor/code_editor.h6
-rw-r--r--editor/create_dialog.h3
-rw-r--r--editor/editor_about.h3
-rw-r--r--editor/editor_export.cpp38
-rw-r--r--editor/editor_file_dialog.h3
-rw-r--r--editor/editor_help.cpp12
-rw-r--r--editor/editor_node.cpp48
-rw-r--r--editor/editor_node.h7
-rw-r--r--editor/editor_plugin.h4
-rw-r--r--editor/editor_spin_slider.cpp5
-rw-r--r--editor/export_template_manager.cpp33
-rw-r--r--editor/find_in_files.cpp1
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.h3
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.h3
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h3
-rw-r--r--editor/plugins/animation_player_editor_plugin.h3
-rw-r--r--editor/plugins/animation_tree_player_editor_plugin.h3
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp13
-rw-r--r--editor/plugins/camera_editor_plugin.h4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h3
-rw-r--r--editor/plugins/collision_polygon_2d_editor_plugin.h3
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.h4
-rw-r--r--editor/plugins/item_list_editor_plugin.h4
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.h3
-rw-r--r--editor/plugins/multimesh_editor_plugin.h4
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.h3
-rw-r--r--editor/plugins/particles_editor_plugin.h4
-rw-r--r--editor/plugins/path_2d_editor_plugin.h3
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.h4
-rw-r--r--editor/plugins/script_editor_plugin.cpp21
-rw-r--r--editor/plugins/script_text_editor.cpp44
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp11
-rw-r--r--editor/plugins/spatial_editor_plugin.h3
-rw-r--r--editor/plugins/text_editor.cpp14
-rw-r--r--editor/plugins/text_editor.h1
-rw-r--r--editor/plugins/theme_editor_plugin.cpp71
-rw-r--r--editor/plugins/theme_editor_plugin.h2
-rw-r--r--editor/plugins/tile_map_editor_plugin.h4
-rw-r--r--editor/project_manager.cpp4
-rw-r--r--editor/property_editor.h4
-rw-r--r--editor/pvrtc_compress.cpp53
-rw-r--r--editor/scene_tree_editor.h4
-rw-r--r--editor/script_create_dialog.cpp25
-rw-r--r--editor/script_create_dialog.h1
47 files changed, 332 insertions, 262 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 89a88dc6e7..5b1a460a54 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -163,16 +163,16 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col)
result_col = col;
_update_results_count();
- set_error(vformat(TTR("Found %d match(es)."), results_count));
} else {
result_line = -1;
result_col = -1;
text_edit->set_search_text("");
text_edit->set_search_flags(p_flags);
text_edit->set_current_search_result(line, col);
- set_error(text.empty() ? "" : TTR("No Matches"));
}
+ _update_matches_label();
+
return found;
}
@@ -283,20 +283,6 @@ void FindReplaceBar::_get_search_from(int &r_line, int &r_col) {
r_line = text_edit->cursor_get_line();
r_col = text_edit->cursor_get_column();
- if (text_edit->is_selection_active() && !replace_all_mode) {
-
- int selection_line = text_edit->get_selection_from_line();
-
- if (text_edit->get_selection_text() == get_search_text() && r_line == selection_line) {
-
- int selection_from_col = text_edit->get_selection_from_column();
-
- if (r_col >= selection_from_col && r_col <= text_edit->get_selection_to_column()) {
- r_col = selection_from_col;
- }
- }
- }
-
if (r_line == result_line && r_col >= result_col && r_col <= result_col + get_search_text().length()) {
r_col = result_col;
}
@@ -332,6 +318,18 @@ void FindReplaceBar::_update_results_count() {
}
}
+void FindReplaceBar::_update_matches_label() {
+
+ if (search_text->get_text().empty() || results_count == -1) {
+ matches_label->hide();
+ } else {
+ matches_label->show();
+
+ matches_label->add_color_override("font_color", results_count > 0 ? Color(1, 1, 1) : EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
+ matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count));
+ }
+}
+
bool FindReplaceBar::search_current() {
uint32_t flags = 0;
@@ -349,6 +347,9 @@ bool FindReplaceBar::search_current() {
bool FindReplaceBar::search_prev() {
+ if (!is_visible())
+ popup_search(true);
+
uint32_t flags = 0;
String text = get_search_text();
@@ -361,13 +362,17 @@ bool FindReplaceBar::search_prev() {
int line, col;
_get_search_from(line, col);
+ if (text_edit->is_selection_active())
+ col--; //Skip currently selected word.
- col -= text.length();
- if (col < 0) {
- line -= 1;
- if (line < 0)
- line = text_edit->get_line_count() - 1;
- col = text_edit->get_line(line).length();
+ if (line == result_line && col == result_col) {
+ col -= text.length();
+ if (col < 0) {
+ line -= 1;
+ if (line < 0)
+ line = text_edit->get_line_count() - 1;
+ col = text_edit->get_line(line).length();
+ }
}
return _search(flags, line, col);
@@ -375,6 +380,9 @@ bool FindReplaceBar::search_prev() {
bool FindReplaceBar::search_next() {
+ if (!is_visible())
+ popup_search(true);
+
uint32_t flags = 0;
String text;
if (replace_all_mode)
@@ -411,38 +419,54 @@ void FindReplaceBar::_hide_bar() {
text_edit->set_search_text("");
result_line = -1;
result_col = -1;
- set_error("");
hide();
}
-void FindReplaceBar::_show_search() {
+void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) {
show();
- search_text->call_deferred("grab_focus");
+ if (p_show_only)
+ return;
+
+ if (p_focus_replace) {
+ search_text->deselect();
+ replace_text->call_deferred("grab_focus");
+ } else {
+ replace_text->deselect();
+ search_text->call_deferred("grab_focus");
+ }
if (text_edit->is_selection_active() && !selection_only->is_pressed()) {
search_text->set_text(text_edit->get_selection_text());
}
if (!get_search_text().empty()) {
- search_text->select_all();
- search_text->set_cursor_position(search_text->get_text().length());
- search_current();
+ if (p_focus_replace) {
+ replace_text->select_all();
+ replace_text->set_cursor_position(replace_text->get_text().length());
+ } else {
+ search_text->select_all();
+ search_text->set_cursor_position(search_text->get_text().length());
+ }
+
+ results_count = -1;
+ _update_results_count();
+ _update_matches_label();
}
}
-void FindReplaceBar::popup_search() {
+void FindReplaceBar::popup_search(bool p_show_only) {
- replace_text->hide();
+ if (!is_visible())
+ replace_text->hide();
hbc_button_replace->hide();
hbc_option_replace->hide();
- _show_search();
+ _show_search(false, p_show_only);
}
void FindReplaceBar::popup_replace() {
if (!replace_text->is_visible_in_tree()) {
- replace_text->clear();
replace_text->show();
hbc_button_replace->show();
hbc_option_replace->show();
@@ -450,7 +474,7 @@ void FindReplaceBar::popup_replace() {
selection_only->set_pressed((text_edit->is_selection_active() && text_edit->get_selection_from_line() < text_edit->get_selection_to_line()));
- _show_search();
+ _show_search(is_visible() || text_edit->is_selection_active());
}
void FindReplaceBar::_search_options_changed(bool p_pressed) {
@@ -557,6 +581,7 @@ FindReplaceBar::FindReplaceBar() {
vbc_lineedit = memnew(VBoxContainer);
add_child(vbc_lineedit);
+ vbc_lineedit->set_alignment(ALIGN_CENTER);
vbc_lineedit->set_h_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *vbc_button = memnew(VBoxContainer);
add_child(vbc_button);
@@ -565,8 +590,10 @@ FindReplaceBar::FindReplaceBar() {
HBoxContainer *hbc_button_search = memnew(HBoxContainer);
vbc_button->add_child(hbc_button_search);
+ hbc_button_search->set_alignment(ALIGN_END);
hbc_button_replace = memnew(HBoxContainer);
vbc_button->add_child(hbc_button_replace);
+ hbc_button_replace->set_alignment(ALIGN_END);
HBoxContainer *hbc_option_search = memnew(HBoxContainer);
vbc_option->add_child(hbc_option_search);
@@ -580,6 +607,10 @@ FindReplaceBar::FindReplaceBar() {
search_text->connect("text_changed", this, "_search_text_changed");
search_text->connect("text_entered", this, "_search_text_entered");
+ matches_label = memnew(Label);
+ hbc_button_search->add_child(matches_label);
+ matches_label->hide();
+
find_prev = memnew(ToolButton);
hbc_button_search->add_child(find_prev);
find_prev->set_focus_mode(FOCUS_NONE);
diff --git a/editor/code_editor.h b/editor/code_editor.h
index 700e72627c..f2a55cfb70 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -64,6 +64,7 @@ class FindReplaceBar : public HBoxContainer {
GDCLASS(FindReplaceBar, HBoxContainer);
LineEdit *search_text;
+ Label *matches_label;
ToolButton *find_prev;
ToolButton *find_next;
CheckBox *case_sensitive;
@@ -90,8 +91,9 @@ class FindReplaceBar : public HBoxContainer {
void _get_search_from(int &r_line, int &r_col);
void _update_results_count();
+ void _update_matches_label();
- void _show_search();
+ void _show_search(bool p_focus_replace = false, bool p_show_only = false);
void _hide_bar();
void _editor_text_changed();
@@ -123,7 +125,7 @@ public:
void set_text_edit(TextEdit *p_text_edit);
- void popup_search();
+ void popup_search(bool p_show_only = false);
void popup_replace();
bool search_current();
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index f6c3b57589..f3ed1d7af6 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -38,9 +38,6 @@
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/tree.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class CreateDialog : public ConfirmationDialog {
diff --git a/editor/editor_about.h b/editor/editor_about.h
index 87e824083e..e2ba366c65 100644
--- a/editor/editor_about.h
+++ b/editor/editor_about.h
@@ -43,9 +43,6 @@
#include "scene/gui/tree.h"
#include "editor_scale.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class EditorAbout : public AcceptDialog {
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index ed262d9c4f..e1f2635275 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -35,6 +35,7 @@
#include "core/io/resource_saver.h"
#include "core/io/zip_io.h"
#include "core/math/crypto_core.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"
#include "core/script_language.h"
@@ -884,6 +885,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
String engine_cfb = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp" + config_file);
ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list);
Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb);
+ DirAccess::remove_file_or_error(engine_cfb);
p_func(p_udata, "res://" + config_file, data, idx, total);
@@ -916,8 +918,10 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
memdelete(ftmp); //close tmp file
- if (err)
+ if (err != OK) {
+ DirAccess::remove_file_or_error(tmppath);
return err;
+ }
pd.file_ofs.sort(); //do sort, so we can do binary search later
@@ -926,11 +930,17 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
if (!p_embed) {
// Regular output to separate PCK file
f = FileAccess::open(p_path, FileAccess::WRITE);
- ERR_FAIL_COND_V(!f, ERR_CANT_CREATE);
+ if (!f) {
+ DirAccess::remove_file_or_error(tmppath);
+ ERR_FAIL_V(ERR_CANT_CREATE);
+ }
} else {
// Append to executable
f = FileAccess::open(p_path, FileAccess::READ_WRITE);
- ERR_FAIL_COND_V(!f, ERR_FILE_CANT_OPEN);
+ if (!f) {
+ DirAccess::remove_file_or_error(tmppath);
+ ERR_FAIL_V(ERR_FILE_CANT_OPEN);
+ }
f->seek_end();
embed_pos = f->get_position();
@@ -995,13 +1005,13 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
f->store_8(0);
}
- //save the rest of the data
+ // Save the rest of the data.
ftmp = FileAccess::open(tmppath, FileAccess::READ);
if (!ftmp) {
memdelete(f);
- ERR_EXPLAIN("Can't open file to read from path: " + String(tmppath));
- ERR_FAIL_V(ERR_CANT_CREATE);
+ DirAccess::remove_file_or_error(tmppath);
+ ERR_FAIL_V_MSG(ERR_CANT_CREATE, "Can't open file to read from path: " + String(tmppath));
}
const int bufsize = 16384;
@@ -1035,6 +1045,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
}
memdelete(f);
+ DirAccess::remove_file_or_error(tmppath);
return OK;
}
@@ -1043,8 +1054,6 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
EditorProgress ep("savezip", TTR("Packing"), 102, true);
- //FileAccess *tmp = FileAccess::open(tmppath,FileAccess::WRITE);
-
FileAccess *src_f;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io);
@@ -1694,11 +1703,18 @@ void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, con
bool convert = GLOBAL_GET("editor/convert_text_resources_to_binary_on_export");
if (!convert)
return;
- String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("file.res");
+ String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpfile.res");
Error err = ResourceFormatLoaderText::convert_file_to_binary(p_path, tmp_path);
- ERR_FAIL_COND(err != OK);
+ if (err != OK) {
+ DirAccess::remove_file_or_error(tmp_path);
+ ERR_FAIL();
+ }
Vector<uint8_t> data = FileAccess::get_file_as_array(tmp_path);
- ERR_FAIL_COND(data.size() == 0);
+ if (data.size() == 0) {
+ DirAccess::remove_file_or_error(tmp_path);
+ ERR_FAIL();
+ }
+ DirAccess::remove_file_or_error(tmp_path);
add_file(p_path + ".converted.res", data, true);
}
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index 86bf0f0eb3..2ecfa7db15 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -44,9 +44,6 @@
class DependencyRemoveDialog;
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class EditorFileDialog : public ConfirmationDialog {
GDCLASS(EditorFileDialog, ConfirmationDialog);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 7aa24c7476..385b6924df 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1738,19 +1738,13 @@ void FindBar::_update_results_count() {
void FindBar::_update_matches_label() {
- if (results_count > 0) {
- matches_label->show();
-
- matches_label->add_color_override("font_color", Color(1, 1, 1));
- matches_label->set_text(vformat(TTR("Found %d match(es)."), results_count));
- } else if (search_text->get_text().empty()) {
-
+ if (search_text->get_text().empty() || results_count == -1) {
matches_label->hide();
} else {
matches_label->show();
- matches_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
- matches_label->set_text(TTR("No Matches"));
+ matches_label->add_color_override("font_color", results_count > 0 ? Color(1, 1, 1) : EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
+ matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count));
}
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ae2a6d2802..866a90ff10 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4366,6 +4366,15 @@ bool EditorNode::ensure_main_scene(bool p_from_native) {
return true;
}
+void EditorNode::run_play() {
+ _menu_option_confirm(RUN_STOP, true);
+ _run(false);
+}
+
+void EditorNode::run_stop() {
+ _menu_option_confirm(RUN_STOP, false);
+}
+
int EditorNode::get_current_tab() {
return scene_tabs->get_current_tab();
}
@@ -5934,19 +5943,19 @@ EditorNode::EditorNode() {
p->add_shortcut(ED_SHORTCUT("editor/new_scene", TTR("New Scene")), FILE_NEW_SCENE);
p->add_shortcut(ED_SHORTCUT("editor/new_inherited_scene", TTR("New Inherited Scene...")), FILE_NEW_INHERITED_SCENE);
p->add_shortcut(ED_SHORTCUT("editor/open_scene", TTR("Open Scene..."), KEY_MASK_CMD + KEY_O), FILE_OPEN_SCENE);
+ p->add_shortcut(ED_SHORTCUT("editor/reopen_closed_scene", TTR("Reopen Closed Scene"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_T), FILE_OPEN_PREV);
+ p->add_submenu_item(TTR("Open Recent"), "RecentScenes", FILE_OPEN_RECENT);
+
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/save_scene", TTR("Save Scene"), KEY_MASK_CMD + KEY_S), FILE_SAVE_SCENE);
p->add_shortcut(ED_SHORTCUT("editor/save_scene_as", TTR("Save Scene As..."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_AS_SCENE);
p->add_shortcut(ED_SHORTCUT("editor/save_all_scenes", TTR("Save All Scenes"), KEY_MASK_ALT + KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_ALL_SCENES);
- p->add_separator();
- p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_W), FILE_CLOSE);
- p->add_separator();
- p->add_submenu_item(TTR("Open Recent"), "RecentScenes", FILE_OPEN_RECENT);
- p->add_shortcut(ED_SHORTCUT("editor/reopen_closed_scene", TTR("Reopen Closed Scene"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_T), FILE_OPEN_PREV);
+
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/quick_open", TTR("Quick Open..."), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_O), FILE_QUICK_OPEN);
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);
p->add_shortcut(ED_SHORTCUT("editor/quick_open_script", TTR("Quick Open Script..."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCRIPT);
+
p->add_separator();
PopupMenu *pm_export = memnew(PopupMenu);
pm_export->set_name("Export");
@@ -5959,8 +5968,10 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/undo", TTR("Undo"), KEY_MASK_CMD + KEY_Z), EDIT_UNDO, true);
p->add_shortcut(ED_SHORTCUT("editor/redo", TTR("Redo"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_Z), EDIT_REDO, true);
+
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/revert_scene", TTR("Revert Scene")), EDIT_REVERT);
+ p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_W), FILE_CLOSE);
recent_scenes = memnew(PopupMenu);
recent_scenes->set_name("RecentScenes");
@@ -5980,27 +5991,27 @@ EditorNode::EditorNode() {
p = project_menu->get_popup();
p->set_hide_on_window_lose_focus(true);
- p->add_shortcut(ED_SHORTCUT("editor/project_settings", TTR("Project Settings")), RUN_SETTINGS);
- p->add_separator();
+ p->add_shortcut(ED_SHORTCUT("editor/project_settings", TTR("Project Settings...")), RUN_SETTINGS);
p->connect("id_pressed", this, "_menu_option");
- p->add_shortcut(ED_SHORTCUT("editor/export", TTR("Export")), FILE_EXPORT_PROJECT);
+
+ p->add_separator();
+ p->add_shortcut(ED_SHORTCUT("editor/export", TTR("Export...")), FILE_EXPORT_PROJECT);
+ p->add_item(TTR("Install Android Build Template..."), FILE_INSTALL_ANDROID_SOURCE);
+ p->add_item(TTR("Open Project Data Folder"), RUN_PROJECT_DATA_FOLDER);
plugin_config_dialog = memnew(PluginConfigDialog);
plugin_config_dialog->connect("plugin_ready", this, "_on_plugin_ready");
gui_base->add_child(plugin_config_dialog);
+ p->add_separator();
tool_menu = memnew(PopupMenu);
tool_menu->set_name("Tools");
tool_menu->connect("index_pressed", this, "_tool_menu_option");
- p->add_separator();
p->add_child(tool_menu);
p->add_submenu_item(TTR("Tools"), "Tools");
- tool_menu->add_item(TTR("Orphan Resource Explorer"), TOOLS_ORPHAN_RESOURCES);
- tool_menu->add_item(TTR("Open Project Data Folder"), RUN_PROJECT_DATA_FOLDER);
- p->add_separator();
- p->add_item(TTR("Install Android Build Template"), FILE_INSTALL_ANDROID_SOURCE);
- p->add_separator();
+ tool_menu->add_item(TTR("Orphan Resource Explorer..."), TOOLS_ORPHAN_RESOURCES);
+ p->add_separator();
#ifdef OSX_ENABLED
p->add_shortcut(ED_SHORTCUT("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q), RUN_PROJECT_MANAGER, true);
#else
@@ -6052,7 +6063,7 @@ EditorNode::EditorNode() {
p = settings_menu->get_popup();
p->set_hide_on_window_lose_focus(true);
- p->add_shortcut(ED_SHORTCUT("editor/editor_settings", TTR("Editor Settings")), SETTINGS_PREFERENCES);
+ p->add_shortcut(ED_SHORTCUT("editor/editor_settings", TTR("Editor Settings...")), SETTINGS_PREFERENCES);
p->add_separator();
editor_layouts = memnew(PopupMenu);
@@ -6087,11 +6098,8 @@ EditorNode::EditorNode() {
}
p->add_separator();
- p->add_item(TTR("Manage Editor Features"), SETTINGS_MANAGE_FEATURE_PROFILES);
-
- p->add_separator();
-
- p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
+ p->add_item(TTR("Manage Editor Features..."), SETTINGS_MANAGE_FEATURE_PROFILES);
+ p->add_item(TTR("Manage Export Templates..."), SETTINGS_MANAGE_EXPORT_TEMPLATES);
// Help Menu
help_menu = memnew(MenuButton);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 8d536a1b86..10ad2d691e 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -86,10 +86,6 @@
#include "scene/gui/tree.h"
#include "scene/gui/viewport_container.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
typedef void (*EditorNodeInitCallback)();
typedef void (*EditorPluginInitializeCallback)();
typedef bool (*EditorBuildCallback)();
@@ -869,6 +865,9 @@ public:
static void add_build_callback(EditorBuildCallback p_callback);
bool ensure_main_scene(bool p_from_native);
+
+ void run_play();
+ void run_stop();
};
struct EditorProgress {
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 52ab444522..7b6f55e93d 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -41,10 +41,6 @@
#include "scene/main/node.h"
#include "scene/resources/texture.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class EditorNode;
class Spatial;
class Camera;
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index 9966394025..379b8a2980 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -347,6 +347,11 @@ void EditorSpinSlider::_value_input_closed() {
//focus_exited signal
void EditorSpinSlider::_value_focus_exited() {
+
+ // discontinue because the focus_exit was caused by right-click context menu
+ if (value_input->get_menu()->is_visible())
+ return;
+
_evaluate_input_text();
// focus is not on the same element after the vlalue_input was exited
// -> focus is on next element
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index ecfad4d146..72a4b43737 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -69,6 +69,9 @@ void ExportTemplateManager::_update_template_list() {
memdelete(d);
String current_version = VERSION_FULL_CONFIG;
+ // Downloadable export templates are only available for stable, alpha, beta and RC versions.
+ // Therefore, don't display download-related features when using a development version
+ const bool downloads_available = String(VERSION_STATUS) != String("dev");
Label *current = memnew(Label);
current->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -76,10 +79,14 @@ void ExportTemplateManager::_update_template_list() {
if (templates.has(current_version)) {
current->add_color_override("font_color", get_color("success_color", "Editor"));
- Button *redownload = memnew(Button);
- redownload->set_text(TTR("Re-Download"));
- current_hb->add_child(redownload);
- redownload->connect("pressed", this, "_download_template", varray(current_version));
+
+ // Only display a redownload button if it can be downloaded in the first place
+ if (downloads_available) {
+ Button *redownload = memnew(Button);
+ redownload->set_text(TTR("Redownload"));
+ current_hb->add_child(redownload);
+ redownload->connect("pressed", this, "_download_template", varray(current_version));
+ }
Button *uninstall = memnew(Button);
uninstall->set_text(TTR("Uninstall"));
@@ -91,6 +98,12 @@ void ExportTemplateManager::_update_template_list() {
current->add_color_override("font_color", get_color("error_color", "Editor"));
Button *redownload = memnew(Button);
redownload->set_text(TTR("Download"));
+
+ if (!downloads_available) {
+ redownload->set_disabled(true);
+ redownload->set_tooltip(TTR("Official export templates aren't available for development builds."));
+ }
+
redownload->connect("pressed", this, "_download_template", varray(current_version));
current_hb->add_child(redownload);
current->set_text(current_version + " " + TTR("(Missing)"));
@@ -422,14 +435,16 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
String path = download_templates->get_download_file();
template_list_state->set_text(TTR("Download Complete."));
template_downloader->hide();
- int ret = _install_from_file(path, false);
+ bool ret = _install_from_file(path, false);
if (ret) {
- Error err = OS::get_singleton()->move_to_trash(path);
+ // Clean up downloaded file.
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ Error err = da->remove(path);
if (err != OK) {
- EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + path + "\n");
+ EditorNode::get_singleton()->add_io_error(TTR("Cannot remove temporary file:") + "\n" + path + "\n");
}
} else {
- WARN_PRINTS(vformat(TTR("Templates installation failed. The problematic templates archives can be found at '%s'."), path));
+ EditorNode::get_singleton()->add_io_error(vformat(TTR("Templates installation failed.\nThe problematic templates archives can be found at '%s'."), path));
}
}
} break;
@@ -458,7 +473,7 @@ void ExportTemplateManager::_begin_template_download(const String &p_url) {
Error err = download_templates->request(p_url);
if (err != OK) {
- EditorNode::get_singleton()->show_warning(TTR("Error requesting url: ") + p_url);
+ EditorNode::get_singleton()->show_warning(TTR("Error requesting URL:") + " " + p_url);
return;
}
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 8665467f2d..cc2efb92ae 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -547,6 +547,7 @@ FindInFilesPanel::FindInFilesPanel() {
_results_display->connect("item_edited", this, "_on_item_edited");
_results_display->set_hide_root(true);
_results_display->set_select_mode(Tree::SELECT_ROW);
+ _results_display->set_allow_rmb_select(true);
_results_display->create_item(); // Root
vbc->add_child(_results_display);
diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h
index 97244fa4e9..a00cdd0cf6 100644
--- a/editor/plugins/abstract_polygon_2d_editor.h
+++ b/editor/plugins/abstract_polygon_2d_editor.h
@@ -36,9 +36,6 @@
#include "scene/2d/polygon_2d.h"
#include "scene/gui/tool_button.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class CanvasItemEditor;
class AbstractPolygon2DEditor : public HBoxContainer {
diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h
index 74186791e1..850a6201bb 100644
--- a/editor/plugins/animation_blend_space_2d_editor.h
+++ b/editor/plugins/animation_blend_space_2d_editor.h
@@ -40,9 +40,6 @@
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin {
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index cb40159a40..77b57a50d0 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -40,9 +40,6 @@
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index 22152fa8f4..2ab2df68e6 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -39,9 +39,6 @@
#include "scene/gui/spin_box.h"
#include "scene/gui/texture_button.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class AnimationTrackEditor;
class AnimationPlayerEditorPlugin;
diff --git a/editor/plugins/animation_tree_player_editor_plugin.h b/editor/plugins/animation_tree_player_editor_plugin.h
index f4bfe58909..03bc559b86 100644
--- a/editor/plugins/animation_tree_player_editor_plugin.h
+++ b/editor/plugins/animation_tree_player_editor_plugin.h
@@ -38,9 +38,6 @@
#include "scene/gui/button.h"
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class AnimationTreePlayerEditor : public Control {
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 4a2295fab2..e053a34a4d 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -354,16 +354,16 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
} break;
case HTTPRequest::RESULT_REQUEST_FAILED: {
error_text = TTR("Request failed, return code:") + " " + itos(p_code);
- status->set_text(TTR("Request Failed."));
+ status->set_text(TTR("Request failed."));
} break;
case HTTPRequest::RESULT_DOWNLOAD_FILE_CANT_OPEN:
case HTTPRequest::RESULT_DOWNLOAD_FILE_WRITE_ERROR: {
- error_text = TTR("Cannot save response to") + " " + download->get_download_file();
+ error_text = TTR("Cannot save response to:") + " " + download->get_download_file();
status->set_text(TTR("Write error."));
} break;
case HTTPRequest::RESULT_REDIRECT_LIMIT_REACHED: {
error_text = TTR("Request failed, too many redirects");
- status->set_text(TTR("Redirect Loop."));
+ status->set_text(TTR("Redirect loop."));
} break;
case HTTPRequest::RESULT_TIMEOUT: {
error_text = TTR("Request failed, timeout");
@@ -472,9 +472,8 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) {
}
void EditorAssetLibraryItemDownload::_close() {
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- da->remove(download->get_download_file()); //clean up removed file
- memdelete(da);
+ // Clean up downloaded file.
+ DirAccess::remove_file_or_error(download->get_download_file());
queue_delete();
}
@@ -759,7 +758,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt
switch (image_queue[p_queue_id].image_type) {
case IMAGE_QUEUE_ICON:
- image->resize(64 * EDSCALE, 64 * EDSCALE, Image::INTERPOLATE_CUBIC);
+ image->resize(64 * EDSCALE, 64 * EDSCALE, Image::INTERPOLATE_LANCZOS);
break;
case IMAGE_QUEUE_THUMBNAIL: {
diff --git a/editor/plugins/camera_editor_plugin.h b/editor/plugins/camera_editor_plugin.h
index eac9acab93..400aee132d 100644
--- a/editor/plugins/camera_editor_plugin.h
+++ b/editor/plugins/camera_editor_plugin.h
@@ -35,10 +35,6 @@
#include "editor/editor_plugin.h"
#include "scene/3d/camera.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class CameraEditor : public Control {
GDCLASS(CameraEditor, Control);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index ff134ff2d1..98c2f21e45 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4998,11 +4998,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->set_hide_on_checkable_item_selection(false);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_grid", TTR("Snap to Grid")), SNAP_USE_GRID);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION);
- p->add_shortcut(ED_SHORTCUT("canvas_item_editor/configure_snap", TTR("Configure Snap...")), SNAP_CONFIGURE);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_relative", TTR("Snap Relative")), SNAP_RELATIVE);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_pixel_snap", TTR("Use Pixel Snap")), SNAP_USE_PIXEL);
p->add_submenu_item(TTR("Smart Snapping"), "SmartSnapping");
+ p->add_separator();
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/configure_snap", TTR("Configure Snap...")), SNAP_CONFIGURE);
+
smartsnap_config_popup = memnew(PopupMenu);
p->add_child(smartsnap_config_popup);
smartsnap_config_popup->set_name("SmartSnapping");
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 553ded6b14..e6eab57810 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -39,9 +39,6 @@
#include "scene/gui/label.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/spin_box.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class CanvasItemEditorViewport;
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.h b/editor/plugins/collision_polygon_2d_editor_plugin.h
index e15360d4e5..3f0734fb19 100644
--- a/editor/plugins/collision_polygon_2d_editor_plugin.h
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.h
@@ -34,9 +34,6 @@
#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/2d/collision_polygon_2d.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class CollisionPolygon2DEditor : public AbstractPolygon2DEditor {
GDCLASS(CollisionPolygon2DEditor, AbstractPolygon2DEditor);
diff --git a/editor/plugins/collision_polygon_editor_plugin.h b/editor/plugins/collision_polygon_editor_plugin.h
index a699641aba..2a904a53ba 100644
--- a/editor/plugins/collision_polygon_editor_plugin.h
+++ b/editor/plugins/collision_polygon_editor_plugin.h
@@ -38,10 +38,6 @@
#include "scene/3d/mesh_instance.h"
#include "scene/gui/tool_button.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class CanvasItemEditor;
class Polygon3DEditor : public HBoxContainer {
diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h
index 701632e576..78b176620e 100644
--- a/editor/plugins/item_list_editor_plugin.h
+++ b/editor/plugins/item_list_editor_plugin.h
@@ -39,10 +39,6 @@
#include "scene/gui/option_button.h"
#include "scene/gui/popup_menu.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class ItemListPlugin : public Object {
GDCLASS(ItemListPlugin, Object);
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.h b/editor/plugins/light_occluder_2d_editor_plugin.h
index 633fda7091..95fa0df2c1 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.h
+++ b/editor/plugins/light_occluder_2d_editor_plugin.h
@@ -34,9 +34,6 @@
#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/2d/light_occluder_2d.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class LightOccluder2DEditor : public AbstractPolygon2DEditor {
GDCLASS(LightOccluder2DEditor, AbstractPolygon2DEditor);
diff --git a/editor/plugins/multimesh_editor_plugin.h b/editor/plugins/multimesh_editor_plugin.h
index fe87a2b9cb..5323441bd8 100644
--- a/editor/plugins/multimesh_editor_plugin.h
+++ b/editor/plugins/multimesh_editor_plugin.h
@@ -36,10 +36,6 @@
#include "scene/3d/multimesh_instance.h"
#include "scene/gui/spin_box.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class MultiMeshEditor : public Control {
GDCLASS(MultiMeshEditor, Control);
diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h
index 336c28d642..2a387a8b1e 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/editor/plugins/navigation_polygon_editor_plugin.h
@@ -34,9 +34,6 @@
#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/2d/navigation_polygon.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class NavigationPolygonEditor : public AbstractPolygon2DEditor {
GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h
index 5d05fbd4ac..f689240371 100644
--- a/editor/plugins/particles_editor_plugin.h
+++ b/editor/plugins/particles_editor_plugin.h
@@ -36,10 +36,6 @@
#include "scene/3d/particles.h"
#include "scene/gui/spin_box.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class ParticlesEditorBase : public Control {
GDCLASS(ParticlesEditorBase, Control);
diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h
index 44472f7a81..ecec5f5253 100644
--- a/editor/plugins/path_2d_editor_plugin.h
+++ b/editor/plugins/path_2d_editor_plugin.h
@@ -36,9 +36,6 @@
#include "scene/2d/path_2d.h"
#include "scene/gui/tool_button.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class CanvasItemEditor;
class Path2DEditor : public HBoxContainer {
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index 24ca2ea3f4..009501a70c 100644
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -33,9 +33,7 @@
#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/gui/scroll_container.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
+
class Polygon2DEditor : public AbstractPolygon2DEditor {
GDCLASS(Polygon2DEditor, AbstractPolygon2DEditor);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index ec391186c3..76c7545874 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -490,9 +490,6 @@ void ScriptEditor::_update_recent_scripts() {
Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scripts", Array());
recent_scripts->clear();
- recent_scripts->add_shortcut(ED_SHORTCUT("script_editor/open_recent", TTR("Open Recent")));
- recent_scripts->add_separator();
-
String path;
for (int i = 0; i < rc.size(); i++) {
@@ -515,11 +512,6 @@ void ScriptEditor::_open_recent_script(int p_idx) {
return;
}
- // take two for the open recent button
- if (p_idx > 0) {
- p_idx -= 2;
- }
-
Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scripts", Array());
ERR_FAIL_INDEX(p_idx, rc.size());
@@ -1000,7 +992,7 @@ void ScriptEditor::_menu_option(int p_option) {
file_dialog->clear_filters();
file_dialog->popup_centered_ratio();
- file_dialog->set_title(TTR("New TextFile..."));
+ file_dialog->set_title(TTR("New Text File..."));
} break;
case FILE_OPEN: {
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
@@ -1072,6 +1064,7 @@ void ScriptEditor::_menu_option(int p_option) {
save_all_scripts();
} break;
case SEARCH_IN_FILES: {
+
_on_find_in_files_requested("");
} break;
case SEARCH_HELP: {
@@ -3240,7 +3233,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu->set_switch_on_hover(true);
file_menu->get_popup()->set_hide_on_window_lose_focus(true);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTR("New Script...")), FILE_NEW);
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTR("New TextFile...")), FILE_NEW_TEXTFILE);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTR("New Text File...")), FILE_NEW_TEXTFILE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTR("Open...")), FILE_OPEN);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reopen_closed_script", TTR("Reopen Closed Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T), FILE_REOPEN_CLOSED);
file_menu->get_popup()->add_submenu_item(TTR("Open Recent"), "RecentScripts", FILE_OPEN_RECENT);
@@ -3273,17 +3266,20 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
theme_submenu->connect("id_pressed", this, "_theme_option");
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTR("Import Theme...")), THEME_IMPORT);
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTR("Reload Theme")), THEME_RELOAD);
+
theme_submenu->add_separator();
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/save_theme", TTR("Save Theme")), THEME_SAVE);
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/save_theme_as", TTR("Save Theme As...")), THEME_SAVE_AS);
file_menu->get_popup()->add_separator();
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTR("Close Docs")), CLOSE_DOCS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD | KEY_W), FILE_CLOSE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTR("Close All")), CLOSE_ALL);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_other_tabs", TTR("Close Other Tabs")), CLOSE_OTHER_TABS);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTR("Close Docs")), CLOSE_DOCS);
+
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/run_file", TTR("Run"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_X), FILE_RUN);
+
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH), TOGGLE_SCRIPTS_PANEL);
file_menu->get_popup()->connect("id_pressed", this, "_menu_option");
@@ -3572,8 +3568,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "text_editor/external/exec_flags", PROPERTY_HINT_PLACEHOLDER_TEXT, "Call flags with placeholders: {project}, {file}, {col}, {line}."));
ED_SHORTCUT("script_editor/reopen_closed_script", TTR("Reopen Closed Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T);
- ED_SHORTCUT("script_editor/open_recent", TTR("Open Recent"));
- ED_SHORTCUT("script_editor/clear_recent", TTR("Clear Recent Files"));
+ ED_SHORTCUT("script_editor/clear_recent", TTR("Clear Recent Scripts"));
}
ScriptEditorPlugin::~ScriptEditorPlugin() {
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index ddb87b200d..bded590351 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -30,6 +30,7 @@
#include "script_text_editor.h"
+#include "core/math/expression.h"
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
@@ -1147,6 +1148,32 @@ void ScriptTextEditor::_edit_option(int p_op) {
_convert_case(CodeTextEditor::CAPITALIZE);
} break;
+ case EDIT_EVALUATE: {
+
+ Expression expression;
+ Vector<String> lines = code_editor->get_text_edit()->get_selection_text().split("\n");
+ PoolStringArray results;
+
+ for (int i = 0; i < lines.size(); i++) {
+ String line = lines[i];
+ String whitespace = line.substr(0, line.size() - line.strip_edges(true, false).size()); //extract the whitespace at the beginning
+
+ if (expression.parse(line) == OK) {
+ Variant result = expression.execute(Array(), Variant(), false);
+ if (expression.get_error_text() == "") {
+ results.append(whitespace + (String)result);
+ } else {
+ results.append(line);
+ }
+ } else {
+ results.append(line);
+ }
+ }
+
+ code_editor->get_text_edit()->begin_complex_operation(); //prevents creating a two-step undo
+ code_editor->get_text_edit()->insert_text_at_cursor(results.join("\n"));
+ code_editor->get_text_edit()->end_complex_operation();
+ } break;
case SEARCH_FIND: {
code_editor->get_find_replace_bar()->popup_search();
@@ -1170,7 +1197,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
// Yep, because it doesn't make sense to instance this dialog for every single script open...
// So this will be delegated to the ScriptEditor.
emit_signal("search_in_files_requested", selected_text);
-
} break;
case SEARCH_LOCATE_FUNCTION: {
@@ -1630,16 +1656,17 @@ void ScriptTextEditor::_color_changed(const Color &p_color) {
void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p_foldable, bool p_open_docs, bool p_goto_definition) {
context_menu->clear();
- if (p_selection) {
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"), EDIT_CUT);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"), EDIT_COPY);
- }
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
+ context_menu->add_separator();
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"), EDIT_CUT);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"), EDIT_COPY);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/paste"), EDIT_PASTE);
+
context_menu->add_separator();
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"), EDIT_SELECT_ALL);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
- context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
+
context_menu->add_separator();
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
@@ -1650,6 +1677,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
context_menu->add_separator();
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_uppercase"), EDIT_TO_UPPERCASE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_lowercase"), EDIT_TO_LOWERCASE);
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/evaluate_selection"), EDIT_EVALUATE);
}
if (p_foldable)
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);
@@ -1750,6 +1778,7 @@ ScriptTextEditor::ScriptTextEditor() {
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/evaluate_selection"), EDIT_EVALUATE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS);
@@ -1875,6 +1904,7 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_D);
ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD | KEY_SPACE);
#endif
+ ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_E);
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent to Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent to Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_I);
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 4b2307555b..38c6da5c33 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -120,6 +120,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_TO_UPPERCASE,
EDIT_TO_LOWERCASE,
EDIT_CAPITALIZE,
+ EDIT_EVALUATE,
EDIT_TOGGLE_FOLD_LINE,
EDIT_FOLD_ALL_LINES,
EDIT_UNFOLD_ALL_LINES,
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 58234ba954..f2b1aad59d 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -3551,7 +3551,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_half_resolution", TTR("Half Resolution")), VIEW_HALF_RESOLUTION);
view_menu->get_popup()->add_separator();
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_audio_listener", TTR("Audio Listener")), VIEW_AUDIO_LISTENER);
- view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_audio_doppler", TTR("Doppler Enable")), VIEW_AUDIO_DOPPLER);
+ view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_audio_doppler", TTR("Enable Doppler")), VIEW_AUDIO_DOPPLER);
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_GIZMOS), true);
view_menu->get_popup()->add_separator();
@@ -5647,10 +5647,11 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
p = transform_menu->get_popup();
p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap Object to Floor"), KEY_PAGEDOWN), MENU_SNAP_TO_FLOOR);
- p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP);
- p->add_separator();
p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog...")), MENU_TRANSFORM_DIALOG);
+ p->add_separator();
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP);
+
p->connect("id_pressed", this, "_menu_item_pressed");
view_menu = memnew(MenuButton);
@@ -5674,11 +5675,11 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
p->add_submenu_item(TTR("Gizmos"), "GizmosMenu");
p->add_separator();
-
p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_origin", TTR("View Origin")), MENU_VIEW_ORIGIN);
p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_grid", TTR("View Grid")), MENU_VIEW_GRID);
+
p->add_separator();
- p->add_shortcut(ED_SHORTCUT("spatial_editor/settings", TTR("Settings")), MENU_VIEW_CAMERA_SETTINGS);
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/settings", TTR("Settings...")), MENU_VIEW_CAMERA_SETTINGS);
p->set_item_checked(p->get_item_index(MENU_VIEW_ORIGIN), true);
p->set_item_checked(p->get_item_index(MENU_VIEW_GRID), true);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 523573333b..728b67f6fa 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -37,9 +37,6 @@
#include "scene/3d/light.h"
#include "scene/3d/visual_instance.h"
#include "scene/gui/panel_container.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class Camera;
class SpatialEditor;
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index eb0794ba77..89e419ede8 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -482,6 +482,14 @@ void TextEditor::_edit_option(int p_op) {
code_editor->get_find_replace_bar()->popup_replace();
} break;
+ case SEARCH_IN_FILES: {
+
+ String selected_text = code_editor->get_text_edit()->get_selection_text();
+
+ // Yep, because it doesn't make sense to instance this dialog for every single script open...
+ // So this will be delegated to the ScriptEditor.
+ emit_signal("search_in_files_requested", selected_text);
+ } break;
case SEARCH_GOTO_LINE: {
goto_line_dialog->popup_find_line(tx);
@@ -558,7 +566,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the selected text
+ // Right click is outside the selected text.
tx->deselect();
}
}
@@ -636,13 +644,15 @@ TextEditor::TextEditor() {
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
+ search_menu->get_popup()->add_separator();
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_in_files"), SEARCH_IN_FILES);
edit_menu = memnew(MenuButton);
+ edit_hb->add_child(edit_menu);
edit_menu->set_text(TTR("Edit"));
edit_menu->set_switch_on_hover(true);
edit_menu->get_popup()->connect("id_pressed", this, "_edit_option");
- edit_hb->add_child(edit_menu);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
edit_menu->get_popup()->add_separator();
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index c69e1672c5..c8b49a61e0 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -87,6 +87,7 @@ private:
SEARCH_FIND_NEXT,
SEARCH_FIND_PREV,
SEARCH_REPLACE,
+ SEARCH_IN_FILES,
SEARCH_GOTO_LINE,
BOOKMARK_TOGGLE,
BOOKMARK_GOTO_NEXT,
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 873b125200..56357f298a 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -36,6 +36,7 @@
void ThemeEditor::edit(const Ref<Theme> &p_theme) {
theme = p_theme;
+ main_panel->set_theme(p_theme);
main_container->set_theme(p_theme);
}
@@ -53,6 +54,7 @@ void ThemeEditor::_propagate_redraw(Control *p_at) {
void ThemeEditor::_refresh_interval() {
+ _propagate_redraw(main_panel);
_propagate_redraw(main_container);
}
@@ -130,14 +132,14 @@ void ThemeEditor::_save_template_cbk(String fname) {
Map<String, _TECategory> categories;
- //fill types
+ // Fill types.
List<StringName> type_list;
Theme::get_default()->get_type_list(&type_list);
for (List<StringName>::Element *E = type_list.front(); E; E = E->next()) {
categories.insert(E->get(), _TECategory());
}
- //fill default theme
+ // Fill default theme.
for (Map<String, _TECategory>::Element *E = categories.front(); E; E = E->next()) {
_TECategory &tc = E->get();
@@ -256,7 +258,7 @@ void ThemeEditor::_save_template_cbk(String fname) {
file->store_line("");
file->store_line("");
- //write default theme
+ // Write default theme.
for (Map<String, _TECategory>::Element *E = categories.front(); E; E = E->next()) {
_TECategory &tc = E->get();
@@ -501,7 +503,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
type_select_label->show();
type_select->show();
- if (p_option == POPUP_ADD) { //add
+ if (p_option == POPUP_ADD) { // Add.
add_del_dialog->set_title(TTR("Add Item"));
add_del_dialog->get_ok()->set_text(TTR("Add"));
@@ -509,7 +511,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
base_theme = Theme::get_default();
- } else if (p_option == POPUP_CLASS_ADD) { //add
+ } else if (p_option == POPUP_CLASS_ADD) { // Add.
add_del_dialog->set_title(TTR("Add All Items"));
add_del_dialog->get_ok()->set_text(TTR("Add All"));
@@ -552,12 +554,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
type_menu->get_popup()->clear();
- if (p_option == 0 || p_option == 1) { //add
+ if (p_option == 0 || p_option == 1) { // Add.
List<StringName> new_types;
theme->get_type_list(&new_types);
-
- //uh kind of sucks
for (List<StringName>::Element *F = new_types.front(); F; F = F->next()) {
bool found = false;
@@ -583,15 +583,17 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
void ThemeEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_PROCESS) {
-
- time_left -= get_process_delta_time();
- if (time_left < 0) {
- time_left = 1.5;
- _refresh_interval();
- }
- } else if (p_what == NOTIFICATION_THEME_CHANGED) {
- theme_menu->set_icon(get_icon("Theme", "EditorIcons"));
+ switch (p_what) {
+ case NOTIFICATION_PROCESS: {
+ time_left -= get_process_delta_time();
+ if (time_left < 0) {
+ time_left = 1.5;
+ _refresh_interval();
+ }
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
+ theme_menu->set_icon(get_icon("Theme", "EditorIcons"));
+ } break;
}
}
@@ -629,35 +631,34 @@ ThemeEditor::ThemeEditor() {
top_menu->add_child(theme_menu);
theme_menu->get_popup()->connect("id_pressed", this, "_theme_menu_cbk");
- scroll = memnew(ScrollContainer);
+ ScrollContainer *scroll = memnew(ScrollContainer);
add_child(scroll);
scroll->set_enable_v_scroll(true);
scroll->set_enable_h_scroll(false);
scroll->set_v_size_flags(SIZE_EXPAND_FILL);
- main_container = memnew(MarginContainer);
- scroll->add_child(main_container);
- main_container->set_clip_contents(true);
- main_container->set_custom_minimum_size(Size2(700, 0) * EDSCALE);
- main_container->set_v_size_flags(SIZE_EXPAND_FILL);
- main_container->set_h_size_flags(SIZE_EXPAND_FILL);
+ MarginContainer *root_container = memnew(MarginContainer);
+ scroll->add_child(root_container);
+ root_container->set_theme(Theme::get_default());
+ root_container->set_clip_contents(true);
+ root_container->set_custom_minimum_size(Size2(700, 0) * EDSCALE);
+ root_container->set_v_size_flags(SIZE_EXPAND_FILL);
+ root_container->set_h_size_flags(SIZE_EXPAND_FILL);
//// Preview Controls ////
- Panel *panel = memnew(Panel);
- main_container->add_child(panel);
- panel->set_theme(Theme::get_default());
+ main_panel = memnew(Panel);
+ root_container->add_child(main_panel);
- MarginContainer *mc = memnew(MarginContainer);
- main_container->add_child(mc);
- mc->set_theme(Theme::get_default());
- mc->add_constant_override("margin_right", 4 * EDSCALE);
- mc->add_constant_override("margin_top", 4 * EDSCALE);
- mc->add_constant_override("margin_left", 4 * EDSCALE);
- mc->add_constant_override("margin_bottom", 4 * EDSCALE);
+ main_container = memnew(MarginContainer);
+ root_container->add_child(main_container);
+ main_container->add_constant_override("margin_right", 4 * EDSCALE);
+ main_container->add_constant_override("margin_top", 4 * EDSCALE);
+ main_container->add_constant_override("margin_left", 4 * EDSCALE);
+ main_container->add_constant_override("margin_bottom", 4 * EDSCALE);
HBoxContainer *main_hb = memnew(HBoxContainer);
- mc->add_child(main_hb);
+ main_container->add_child(main_hb);
VBoxContainer *first_vb = memnew(VBoxContainer);
main_hb->add_child(first_vb);
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index cc236907a9..6ffee46569 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -45,7 +45,7 @@ class ThemeEditor : public VBoxContainer {
GDCLASS(ThemeEditor, VBoxContainer);
- ScrollContainer *scroll;
+ Panel *main_panel;
MarginContainer *main_container;
Ref<Theme> theme;
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 3331fb971f..c841eb1f98 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -41,10 +41,6 @@
#include "scene/gui/menu_button.h"
#include "scene/gui/tool_button.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class TileMapEditor : public VBoxContainer {
GDCLASS(TileMapEditor, VBoxContainer);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index feb2cdd071..46d125e735 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1109,7 +1109,7 @@ void ProjectList::load_project_icon(int p_index) {
Error err = img->load(item.icon.replace_first("res://", item.path + "/"));
if (err == OK) {
- img->resize(default_icon->get_width(), default_icon->get_height());
+ img->resize(default_icon->get_width(), default_icon->get_height(), Image::INTERPOLATE_LANCZOS);
Ref<ImageTexture> it = memnew(ImageTexture);
it->create_from_image(img);
icon = it;
@@ -1312,7 +1312,7 @@ void ProjectList::set_filter_option(ProjectListFilter::FilterOption p_option) {
void ProjectList::set_order_option(ProjectListFilter::FilterOption p_option) {
if (_order_option != p_option) {
_order_option = p_option;
- EditorSettings::get_singleton()->set("project_manager/sorting_order", (int)_filter_option);
+ EditorSettings::get_singleton()->set("project_manager/sorting_order", (int)_order_option);
EditorSettings::get_singleton()->save();
}
}
diff --git a/editor/property_editor.h b/editor/property_editor.h
index a8ef1d6fc1..029c2211d5 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -46,10 +46,6 @@
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class PropertyValueEvaluator;
class CreateDialog;
class PropertySelector;
diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp
index 84cd6da3d9..7cdd900d25 100644
--- a/editor/pvrtc_compress.cpp
+++ b/editor/pvrtc_compress.cpp
@@ -32,6 +32,7 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "editor_settings.h"
@@ -52,57 +53,75 @@ static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
_base_image_compress_pvrtc2_func(p_image);
else if (_base_image_compress_pvrtc4_func)
_base_image_compress_pvrtc4_func(p_image);
-
break;
case Image::COMPRESS_PVRTC4:
if (_base_image_compress_pvrtc4_func)
_base_image_compress_pvrtc4_func(p_image);
-
break;
- default: ERR_FAIL();
+ default:
+ ERR_FAIL_MSG("Unsupported Image compress mode used in PVRTC module.");
}
return;
}
- String tmppath = EditorSettings::get_singleton()->get_cache_dir();
-
- List<String> args;
+ String tmppath = EditorSettings::get_singleton()->get_cache_dir();
String src_img = tmppath.plus_file("_tmp_src_img.png");
String dst_img = tmppath.plus_file("_tmp_dst_img.pvr");
+ List<String> args;
args.push_back("-i");
args.push_back(src_img);
args.push_back("-o");
args.push_back(dst_img);
args.push_back("-f");
- switch (p_mode) {
- case Image::COMPRESS_PVRTC2: args.push_back("PVRTC2"); break;
- case Image::COMPRESS_PVRTC4: args.push_back("PVRTC4"); break;
- case Image::COMPRESS_ETC: args.push_back("ETC"); break;
- default: ERR_FAIL();
+ switch (p_mode) {
+ case Image::COMPRESS_PVRTC2:
+ args.push_back("PVRTC2");
+ break;
+ case Image::COMPRESS_PVRTC4:
+ args.push_back("PVRTC4");
+ break;
+ case Image::COMPRESS_ETC:
+ args.push_back("ETC");
+ break;
+ default:
+ ERR_FAIL_MSG("Unsupported Image compress mode used in PVRTC module.");
}
if (EditorSettings::get_singleton()->get("filesystem/import/pvrtc_fast_conversion").operator bool()) {
args.push_back("-pvrtcfast");
}
- if (p_image->has_mipmaps())
+ if (p_image->has_mipmaps()) {
args.push_back("-m");
+ }
+ // Save source PNG.
Ref<ImageTexture> t = memnew(ImageTexture);
t->create_from_image(Ref<Image>(p_image), 0);
ResourceSaver::save(src_img, t);
Error err = OS::get_singleton()->execute(ttpath, args, true);
- ERR_EXPLAIN(TTR("Could not execute PVRTC tool:") + " " + ttpath);
- ERR_FAIL_COND(err != OK);
+ if (err != OK) {
+ // Clean up generated files.
+ DirAccess::remove_file_or_error(src_img);
+ DirAccess::remove_file_or_error(dst_img);
+ ERR_FAIL_MSG("Could not execute PVRTC tool: " + ttpath);
+ }
t = ResourceLoader::load(dst_img, "Texture");
-
- ERR_EXPLAIN(TTR("Can't load back converted image using PVRTC tool:") + " " + dst_img);
- ERR_FAIL_COND(t.is_null());
+ if (t.is_null()) {
+ // Clean up generated files.
+ DirAccess::remove_file_or_error(src_img);
+ DirAccess::remove_file_or_error(dst_img);
+ ERR_FAIL_MSG("Can't load back converted image using PVRTC tool.");
+ }
p_image->copy_internals_from(t->get_data());
+
+ // Clean up generated files.
+ DirAccess::remove_file_or_error(src_img);
+ DirAccess::remove_file_or_error(dst_img);
}
static void _compress_pvrtc2(Image *p_image) {
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index 61cb59ce6f..b216be3b59 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -37,9 +37,7 @@
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
+
class SceneTreeEditor : public Control {
GDCLASS(SceneTreeEditor, Control);
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index ed9a24311d..7d0f40fe91 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -44,6 +44,23 @@ void ScriptCreateDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_ENTER_TREE: {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ String lang = ScriptServer::get_language(i)->get_name();
+ Ref<Texture> lang_icon = get_icon(lang, "EditorIcons");
+ if (lang_icon.is_valid()) {
+ language_menu->set_item_icon(i, lang_icon);
+ }
+ }
+ String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
+ Ref<Texture> last_lang_icon;
+ if (!last_lang.empty()) {
+ last_lang_icon = get_icon(last_lang, "EditorIcons");
+ } else {
+ last_lang_icon = language_menu->get_item_icon(default_language);
+ }
+ if (last_lang_icon.is_valid()) {
+ language_menu->set_icon(last_lang_icon);
+ }
path_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_browse_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_search_button->set_icon(get_icon("ClassList", "EditorIcons"));
@@ -671,13 +688,13 @@ ScriptCreateDialog::ScriptCreateDialog() {
gc->add_child(l);
gc->add_child(language_menu);
- int default_lang = 0;
+ default_language = 0;
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
String lang = ScriptServer::get_language(i)->get_name();
language_menu->add_item(lang);
if (lang == "GDScript") {
- default_lang = i;
+ default_language = i;
}
}
@@ -691,8 +708,8 @@ ScriptCreateDialog::ScriptCreateDialog() {
}
}
} else {
- language_menu->select(default_lang);
- current_language = default_lang;
+ language_menu->select(default_language);
+ current_language = default_language;
}
language_menu->connect("item_selected", this, "_lang_changed");
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index 288b8f604b..202846fd3c 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -76,6 +76,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
bool is_built_in;
bool built_in_enabled;
int current_language;
+ int default_language;
bool re_check_path;
String script_template;
Vector<String> template_list;