summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp1
-rw-r--r--editor/plugins/script_editor_plugin.cpp59
-rw-r--r--editor/plugins/script_editor_plugin.h3
-rw-r--r--editor/plugins/shader_editor_plugin.cpp10
-rw-r--r--editor/plugins/shader_editor_plugin.h4
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp86
-rw-r--r--editor/plugins/spatial_editor_plugin.h4
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp4
8 files changed, 121 insertions, 50 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index e45ff3fee2..89a88dc6e7 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -152,6 +152,7 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col)
text_edit->cursor_set_line(line, false);
text_edit->cursor_set_column(col + text.length(), false);
text_edit->center_viewport_to_cursor();
+ text_edit->select(line, col, line, col + text.length());
}
text_edit->set_search_text(text);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 9cf889c5b0..9418349d71 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -485,7 +485,7 @@ 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"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T));
+ recent_scripts->add_shortcut(ED_SHORTCUT("script_editor/open_recent", TTR("Open Recent")));
recent_scripts->add_separator();
String path;
@@ -579,6 +579,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
Ref<Script> script = current->get_edited_resource();
if (script != NULL) {
+ previous_scripts.push_back(script->get_path());
notify_script_close(script);
}
}
@@ -907,7 +908,7 @@ void ScriptEditor::_file_dialog_action(String p_file) {
if (extensions.find(p_file.get_extension())) {
Ref<Script> scr = ResourceLoader::load(p_file);
if (!scr.is_valid()) {
- editor->show_warning(TTR("Error: could not load file."), TTR("Error!"));
+ editor->show_warning(TTR("Could not load file at:") + "\n\n" + p_file, TTR("Error!"));
file_dialog_option = -1;
return;
}
@@ -920,7 +921,7 @@ void ScriptEditor::_file_dialog_action(String p_file) {
Error error;
Ref<TextFile> text_file = _load_text_file(p_file, &error);
if (error != OK) {
- editor->show_warning(TTR("Error could not load file."), TTR("Error!"));
+ editor->show_warning(TTR("Could not load file at:") + "\n\n" + p_file, TTR("Error!"));
}
if (text_file.is_valid()) {
@@ -1012,6 +1013,52 @@ void ScriptEditor::_menu_option(int p_option) {
file_dialog->set_title(TTR("Open File"));
return;
} break;
+ case FILE_REOPEN_CLOSED: {
+
+ if (previous_scripts.empty())
+ return;
+
+ String path = previous_scripts.back()->get();
+ previous_scripts.pop_back();
+
+ List<String> extensions;
+ ResourceLoader::get_recognized_extensions_for_type("Script", &extensions);
+ bool built_in = !path.is_resource_file();
+
+ if (extensions.find(path.get_extension()) || built_in) {
+ if (built_in) {
+ String scene_path = path.get_slice("::", 0);
+ if (!EditorNode::get_singleton()->is_scene_open(scene_path)) {
+ EditorNode::get_singleton()->load_scene(scene_path);
+ script_editor->call_deferred("_menu_option", p_option);
+ previous_scripts.push_back(path); //repeat the operation
+ return;
+ }
+ }
+
+ Ref<Script> scr = ResourceLoader::load(path);
+ if (!scr.is_valid()) {
+ editor->show_warning(TTR("Could not load file at:") + "\n\n" + path, TTR("Error!"));
+ file_dialog_option = -1;
+ return;
+ }
+
+ edit(scr);
+ file_dialog_option = -1;
+ return;
+ } else {
+ Error error;
+ Ref<TextFile> text_file = _load_text_file(path, &error);
+ if (error != OK)
+ editor->show_warning(TTR("Could not load file at:") + "\n\n" + path, TTR("Error!"));
+
+ if (text_file.is_valid()) {
+ edit(text_file);
+ file_dialog_option = -1;
+ return;
+ }
+ }
+ } break;
case FILE_SAVE_ALL: {
if (_test_script_times_on_disk())
@@ -1894,6 +1941,8 @@ void ScriptEditor::_update_script_names() {
_update_members_overview_visibility();
_update_help_overview_visibility();
_update_script_colors();
+
+ file_menu->get_popup()->set_item_disabled(file_menu->get_popup()->get_item_index(FILE_REOPEN_CLOSED), previous_scripts.empty());
}
void ScriptEditor::_update_script_connections() {
@@ -3172,6 +3221,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
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/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);
recent_scripts = memnew(PopupMenu);
@@ -3500,7 +3550,8 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("text_editor/external/exec_flags", "{file}");
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/open_recent", TTR("Open Recent"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T);
+ 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"));
}
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 4ad2156779..0c876108a5 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -139,6 +139,7 @@ class ScriptEditor : public PanelContainer {
FILE_NEW,
FILE_NEW_TEXTFILE,
FILE_OPEN,
+ FILE_REOPEN_CLOSED,
FILE_OPEN_RECENT,
FILE_SAVE,
FILE_SAVE_AS,
@@ -265,7 +266,7 @@ class ScriptEditor : public PanelContainer {
Vector<ScriptHistory> history;
int history_pos;
- Vector<String> previous_scripts;
+ List<String> previous_scripts;
void _tab_changed(int p_which);
void _menu_option(int p_option);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 994c542187..37460c58ff 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -342,6 +342,9 @@ void ShaderEditor::_menu_option(int p_option) {
shader_editor->remove_all_bookmarks();
} break;
+ case HELP_DOCS: {
+ OS::get_singleton()->shell_open("https://docs.godotengine.org/en/stable/tutorials/shading/shading_reference/index.html");
+ } break;
}
if (p_option != SEARCH_FIND && p_option != SEARCH_REPLACE && p_option != SEARCH_GOTO_LINE) {
shader_editor->get_text_edit()->call_deferred("grab_focus");
@@ -657,11 +660,18 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list");
bookmarks_menu->get_popup()->connect("index_pressed", this, "_bookmark_item_pressed");
+ help_menu = memnew(MenuButton);
+ help_menu->set_text(TTR("Help"));
+ help_menu->set_switch_on_hover(true);
+ help_menu->get_popup()->add_icon_item(p_node->get_gui_base()->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS);
+ help_menu->get_popup()->connect("id_pressed", this, "_menu_option");
+
add_child(main_container);
main_container->add_child(hbc);
hbc->add_child(search_menu);
hbc->add_child(edit_menu);
hbc->add_child(bookmarks_menu);
+ hbc->add_child(help_menu);
hbc->add_style_override("panel", p_node->get_gui_base()->get_stylebox("ScriptEditorPanel", "EditorStyles"));
main_container->add_child(shader_editor);
diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h
index 8e55a1ad70..5d03c37dc4 100644
--- a/editor/plugins/shader_editor_plugin.h
+++ b/editor/plugins/shader_editor_plugin.h
@@ -94,13 +94,13 @@ class ShaderEditor : public PanelContainer {
BOOKMARK_GOTO_NEXT,
BOOKMARK_GOTO_PREV,
BOOKMARK_REMOVE_ALL,
-
+ HELP_DOCS,
};
MenuButton *edit_menu;
MenuButton *search_menu;
MenuButton *bookmarks_menu;
- MenuButton *settings_menu;
+ MenuButton *help_menu;
PopupMenu *context_menu;
uint64_t idle;
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 630f3ba9e1..6af6d48618 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -250,15 +250,7 @@ Vector3 SpatialEditorViewport::_get_ray(const Vector2 &p_pos) const {
return camera->project_ray_normal(p_pos / viewport_container->get_stretch_shrink());
}
-/*
-void SpatialEditorViewport::_clear_id(Spatial *p_node) {
-
- editor_selection->remove_node(p_node);
-
-
-}
-*/
void SpatialEditorViewport::_clear_selected() {
editor_selection->clear();
@@ -4001,11 +3993,11 @@ void SpatialEditor::select_gizmo_highlight_axis(int p_axis) {
for (int i = 0; i < 3; i++) {
- move_gizmo[i]->surface_set_material(0, i == p_axis ? gizmo_hl : gizmo_color[i]);
- move_plane_gizmo[i]->surface_set_material(0, (i + 6) == p_axis ? gizmo_hl : plane_gizmo_color[i]);
- rotate_gizmo[i]->surface_set_material(0, (i + 3) == p_axis ? gizmo_hl : gizmo_color[i]);
- scale_gizmo[i]->surface_set_material(0, (i + 9) == p_axis ? gizmo_hl : gizmo_color[i]);
- scale_plane_gizmo[i]->surface_set_material(0, (i + 12) == p_axis ? gizmo_hl : plane_gizmo_color[i]);
+ move_gizmo[i]->surface_set_material(0, i == p_axis ? gizmo_color_hl[i] : gizmo_color[i]);
+ move_plane_gizmo[i]->surface_set_material(0, (i + 6) == p_axis ? plane_gizmo_color_hl[i] : plane_gizmo_color[i]);
+ rotate_gizmo[i]->surface_set_material(0, (i + 3) == p_axis ? gizmo_color_hl[i] : gizmo_color[i]);
+ scale_gizmo[i]->surface_set_material(0, (i + 9) == p_axis ? gizmo_color_hl[i] : gizmo_color[i]);
+ scale_plane_gizmo[i]->surface_set_material(0, (i + 12) == p_axis ? plane_gizmo_color_hl[i] : plane_gizmo_color[i]);
}
}
@@ -4084,6 +4076,23 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) {
return si;
}
+Color SpatialEditor::_get_axis_color(int axis) {
+
+ switch (axis) {
+ case 0:
+ // X axis
+ return Color(0.96, 0.20, 0.32);
+ case 1:
+ // Y axis
+ return Color(0.53, 0.84, 0.01);
+ case 2:
+ // Z axis
+ return Color(0.16, 0.55, 0.96);
+ default:
+ return Color(0, 0, 0);
+ }
+}
+
void SpatialEditor::_generate_selection_box() {
AABB aabb(Vector3(), Vector3(1, 1, 1));
@@ -4097,11 +4106,6 @@ void SpatialEditor::_generate_selection_box() {
Vector3 a, b;
aabb.get_edge(i, a, b);
- /*Vector<Vector3> points;
- Vector<Color> colors;
- points.push_back(a);
- points.push_back(b);*/
-
st->add_color(Color(1.0, 1.0, 0.8, 0.8));
st->add_vertex(a);
st->add_color(Color(1.0, 1.0, 0.8, 0.4));
@@ -4640,12 +4644,13 @@ void SpatialEditor::_init_indicators() {
for (int i = 0; i < 3; i++) {
Vector3 axis;
axis[i] = 1;
+ Color origin_color = _get_axis_color(i);
grid_enable[i] = false;
grid_visible[i] = false;
- origin_colors.push_back(Color(axis.x, axis.y, axis.z));
- origin_colors.push_back(Color(axis.x, axis.y, axis.z));
+ origin_colors.push_back(origin_color);
+ origin_colors.push_back(origin_color);
origin_points.push_back(axis * 4096);
origin_points.push_back(axis * -4096);
}
@@ -4674,17 +4679,11 @@ void SpatialEditor::_init_indicators() {
//move gizmo
- float gizmo_alph = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_opacity");
-
- gizmo_hl = Ref<SpatialMaterial>(memnew(SpatialMaterial));
- gizmo_hl->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- gizmo_hl->set_on_top_of_alpha();
- gizmo_hl->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- gizmo_hl->set_albedo(Color(1, 1, 1, gizmo_alph + 0.2f));
- gizmo_hl->set_cull_mode(SpatialMaterial::CULL_DISABLED);
-
for (int i = 0; i < 3; i++) {
+ Color col = _get_axis_color(i);
+ col.a = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_opacity");
+
move_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
move_plane_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
rotate_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
@@ -4695,13 +4694,13 @@ void SpatialEditor::_init_indicators() {
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
mat->set_on_top_of_alpha();
mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
- Color col;
- col[i] = 1.0;
- col.a = gizmo_alph;
mat->set_albedo(col);
-
gizmo_color[i] = mat;
+ Ref<SpatialMaterial> mat_hl = mat->duplicate();
+ mat_hl->set_albedo(Color(col.r, col.g, col.b, 1.0));
+ gizmo_color_hl[i] = mat_hl;
+
Vector3 ivec;
ivec[i] = 1;
Vector3 nivec;
@@ -4791,13 +4790,14 @@ void SpatialEditor::_init_indicators() {
plane_mat->set_on_top_of_alpha();
plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
- Color col2;
- col2[i] = 1.0;
- col2.a = gizmo_alph;
- plane_mat->set_albedo(col2);
+ plane_mat->set_albedo(col);
plane_gizmo_color[i] = plane_mat; // needed, so we can draw planes from both sides
surftool->set_material(plane_mat);
surftool->commit(move_plane_gizmo[i]);
+
+ Ref<SpatialMaterial> plane_mat_hl = plane_mat->duplicate();
+ plane_mat_hl->set_albedo(Color(col.r, col.g, col.b, 1.0));
+ plane_gizmo_color_hl[i] = plane_mat_hl; // needed, so we can draw planes from both sides
}
// Rotate
@@ -4920,13 +4920,14 @@ void SpatialEditor::_init_indicators() {
plane_mat->set_on_top_of_alpha();
plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
- Color col2;
- col2[i] = 1.0;
- col2.a = gizmo_alph;
- plane_mat->set_albedo(col2);
+ plane_mat->set_albedo(col);
plane_gizmo_color[i] = plane_mat; // needed, so we can draw planes from both sides
surftool->set_material(plane_mat);
surftool->commit(scale_plane_gizmo[i]);
+
+ Ref<SpatialMaterial> plane_mat_hl = plane_mat->duplicate();
+ plane_mat_hl->set_albedo(Color(col.r, col.g, col.b, 1.0));
+ plane_gizmo_color_hl[i] = plane_mat_hl; // needed, so we can draw planes from both sides
}
}
}
@@ -5824,7 +5825,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
EDITOR_DEF("editors/3d/manipulator_gizmo_size", 80);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/3d/manipulator_gizmo_size", PROPERTY_HINT_RANGE, "16,1024,1"));
- EDITOR_DEF("editors/3d/manipulator_gizmo_opacity", 0.2);
+ EDITOR_DEF("editors/3d/manipulator_gizmo_opacity", 0.4);
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::REAL, "editors/3d/manipulator_gizmo_opacity", PROPERTY_HINT_RANGE, "0,1,0.01"));
over_gizmo_handle = -1;
}
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index dde402c0ff..523573333b 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -528,7 +528,8 @@ private:
Ref<ArrayMesh> move_gizmo[3], move_plane_gizmo[3], rotate_gizmo[3], scale_gizmo[3], scale_plane_gizmo[3];
Ref<SpatialMaterial> gizmo_color[3];
Ref<SpatialMaterial> plane_gizmo_color[3];
- Ref<SpatialMaterial> gizmo_hl;
+ Ref<SpatialMaterial> gizmo_color_hl[3];
+ Ref<SpatialMaterial> plane_gizmo_color_hl[3];
int over_gizmo_handle;
@@ -635,6 +636,7 @@ private:
Node *custom_camera;
Object *_get_editor_data(Object *p_what);
+ Color _get_axis_color(int axis);
Ref<Environment> viewport_environment;
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 4376e3e68f..4f7b9f9815 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -604,6 +604,10 @@ void VisualShaderEditor::_update_graph() {
}
}
+ if (!is_group) {
+ hb->add_spacer();
+ }
+
if (valid_right) {
if (is_group) {
Button *remove_btn = memnew(Button);