summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp1
-rw-r--r--editor/collada/collada.h41
-rw-r--r--editor/dependency_editor.cpp9
-rw-r--r--editor/dependency_editor.h2
-rw-r--r--editor/editor_audio_buses.cpp40
-rw-r--r--editor/editor_audio_buses.h4
-rw-r--r--editor/editor_export.cpp33
-rw-r--r--editor/editor_export.h7
-rw-r--r--editor/editor_help_search.cpp24
-rw-r--r--editor/editor_node.cpp48
-rw-r--r--editor/editor_node.h3
-rw-r--r--editor/editor_plugin.cpp10
-rw-r--r--editor/editor_properties.cpp32
-rw-r--r--editor/editor_sectioned_inspector.cpp15
-rw-r--r--editor/editor_settings.cpp162
-rw-r--r--editor/editor_settings.h32
-rw-r--r--editor/editor_themes.cpp2
-rw-r--r--editor/filesystem_dock.cpp23
-rw-r--r--editor/filesystem_dock.h7
-rw-r--r--editor/find_in_files.cpp9
-rw-r--r--editor/find_in_files.h1
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp11
-rw-r--r--editor/import/editor_scene_importer_gltf.h28
-rw-r--r--editor/import/resource_importer_wav.cpp14
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp10
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h6
-rw-r--r--editor/plugins/script_editor_plugin.cpp42
-rw-r--r--editor/plugins/script_text_editor.cpp8
-rw-r--r--editor/plugins/shader_editor_plugin.cpp21
-rw-r--r--editor/plugins/shader_editor_plugin.h4
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp2
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp45
-rw-r--r--editor/plugins/tile_set_editor_plugin.h5
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp26
36 files changed, 474 insertions, 257 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index a0a8e9459d..a7a51cb93d 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -768,6 +768,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type"));
text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size"));
text_editor->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent"));
+ text_editor->set_draw_indent_guides(EditorSettings::get_singleton()->get("text_editor/indent/draw_indent_guides"));
text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs"));
text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers"));
text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_numbers_zero_padded"));
diff --git a/editor/collada/collada.h b/editor/collada/collada.h
index b777fa04c2..2d5819902c 100644
--- a/editor/collada/collada.h
+++ b/editor/collada/collada.h
@@ -110,14 +110,13 @@ public:
float z_near;
float z_far;
- CameraData() {
-
- mode = MODE_PERSPECTIVE;
- perspective.y_fov = 0;
+ CameraData() :
+ mode(MODE_PERSPECTIVE),
+ aspect(1),
+ z_near(0.1),
+ z_far(100) {
perspective.x_fov = 0;
- aspect = 1;
- z_near = 0.1;
- z_far = 100;
+ perspective.y_fov = 0;
}
};
@@ -141,16 +140,14 @@ public:
float spot_angle;
float spot_exp;
- LightData() {
-
- mode = MODE_AMBIENT;
- color = Color(1, 1, 1, 1);
- constant_att = 0;
- linear_att = 0;
- quad_att = 0;
-
- spot_angle = 45;
- spot_exp = 1;
+ LightData() :
+ mode(MODE_AMBIENT),
+ color(Color(1, 1, 1, 1)),
+ constant_att(0),
+ linear_att(0),
+ quad_att(0),
+ spot_angle(45),
+ spot_exp(1) {
}
};
@@ -580,11 +577,11 @@ public:
float animation_length;
- State() {
- unit_scale = 1.0;
- up_axis = Vector3::AXIS_Y;
- import_flags = 0;
- animation_length = 0;
+ State() :
+ import_flags(0),
+ unit_scale(1.0),
+ up_axis(Vector3::AXIS_Y),
+ animation_length(0) {
}
} state;
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 74f574ce1c..aa9125915c 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -506,6 +506,8 @@ void DependencyRemoveDialog::ok_pressed() {
Error err = OS::get_singleton()->move_to_trash(path);
if (err != OK) {
EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n");
+ } else {
+ emit_signal("file_removed", files_to_delete[i]);
}
}
@@ -521,6 +523,8 @@ void DependencyRemoveDialog::ok_pressed() {
Error err = OS::get_singleton()->move_to_trash(path);
if (err != OK) {
EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + dirs_to_delete[i] + "\n");
+ } else {
+ emit_signal("folder_removed", dirs_to_delete[i]);
}
}
@@ -546,6 +550,11 @@ void DependencyRemoveDialog::ok_pressed() {
}
}
+void DependencyRemoveDialog::_bind_methods() {
+ ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
+ ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
+}
+
DependencyRemoveDialog::DependencyRemoveDialog() {
VBoxContainer *vb = memnew(VBoxContainer);
diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h
index e46df4c837..5f1074764b 100644
--- a/editor/dependency_editor.h
+++ b/editor/dependency_editor.h
@@ -126,6 +126,8 @@ class DependencyRemoveDialog : public ConfirmationDialog {
void ok_pressed();
+ static void _bind_methods();
+
public:
void show(const Vector<String> &p_folders, const Vector<String> &p_files);
DependencyRemoveDialog();
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 6cd81626c7..b1f5bc4908 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -36,11 +36,35 @@
#include "filesystem_dock.h"
#include "servers/audio_server.h"
+void EditorAudioBus::_update_visible_channels() {
+
+ int i = 0;
+ for (; i < cc; i++) {
+
+ if (!channel[i].vu_l->is_visible()) {
+ channel[i].vu_l->show();
+ }
+ if (!channel[i].vu_r->is_visible()) {
+ channel[i].vu_r->show();
+ }
+ }
+
+ for (; i < CHANNELS_MAX; i++) {
+
+ if (channel[i].vu_l->is_visible()) {
+ channel[i].vu_l->hide();
+ }
+ if (channel[i].vu_r->is_visible()) {
+ channel[i].vu_r->hide();
+ }
+ }
+}
+
void EditorAudioBus::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
- for (int i = 0; i < cc; i++) {
+ for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
@@ -72,6 +96,11 @@ void EditorAudioBus::_notification(int p_what) {
if (p_what == NOTIFICATION_PROCESS) {
+ if (cc != AudioServer::get_singleton()->get_bus_channels(get_index())) {
+ cc = AudioServer::get_singleton()->get_bus_channels(get_index());
+ _update_visible_channels();
+ }
+
for (int i = 0; i < cc; i++) {
float real_peak[2] = { -100, -100 };
bool activity_found = false;
@@ -113,7 +142,7 @@ void EditorAudioBus::_notification(int p_what) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].peak_l = -100;
channel[i].peak_r = -100;
channel[i].prev_active = true;
@@ -124,7 +153,7 @@ void EditorAudioBus::_notification(int p_what) {
if (p_what == NOTIFICATION_THEME_CHANGED) {
- for (int i = 0; i < cc; i++) {
+ for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
@@ -709,9 +738,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
slider->connect("value_changed", this, "_volume_db_changed");
hb->add_child(slider);
- cc = AudioServer::get_singleton()->get_channel_count();
-
- for (int i = 0; i < cc; i++) {
+ cc = 0;
+ for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].vu_l = memnew(TextureProgress);
channel[i].vu_l->set_fill_mode(TextureProgress::FILL_BOTTOM_TO_TOP);
hb->add_child(channel[i].vu_l);
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index 4cdcb65d7b..02038fbe18 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -59,6 +59,7 @@ class EditorAudioBus : public PanelContainer {
VSlider *slider;
int cc;
+ static const int CHANNELS_MAX = 4;
struct {
bool prev_active;
@@ -68,7 +69,7 @@ class EditorAudioBus : public PanelContainer {
TextureProgress *vu_l;
TextureProgress *vu_r;
- } channel[4];
+ } channel[CHANNELS_MAX];
TextureRect *scale;
OptionButton *send;
@@ -102,6 +103,7 @@ class EditorAudioBus : public PanelContainer {
void _effect_selected();
void _delete_effect_pressed(int p_option);
void _effect_rmb(const Vector2 &p_pos);
+ void _update_visible_channels();
virtual Variant get_drag_data(const Point2 &p_point);
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 209a006a06..71315f1377 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -222,11 +222,10 @@ String EditorExportPreset::get_custom_features() const {
return custom_features;
}
-EditorExportPreset::EditorExportPreset() {
-
- export_path = "";
- export_filter = EXPORT_ALL_RESOURCES;
- runnable = false;
+EditorExportPreset::EditorExportPreset() :
+ export_filter(EXPORT_ALL_RESOURCES),
+ export_path(""),
+ runnable(false) {
}
///////////////////////////////////
@@ -546,6 +545,13 @@ void EditorExportPlugin::_export_begin_script(const PoolVector<String> &p_featur
}
}
+void EditorExportPlugin::_export_end_script() {
+
+ if (get_script_instance()) {
+ get_script_instance()->call("_export_end");
+ }
+}
+
void EditorExportPlugin::_export_file(const String &p_path, const String &p_type, const Set<String> &p_features) {
}
@@ -587,6 +593,20 @@ EditorExportPlatform::FeatureContainers EditorExportPlatform::get_feature_contai
result.features.insert(E->get());
result.features_pv.push_back(E->get());
}
+
+ if (p_preset->get_custom_features() != String()) {
+
+ Vector<String> tmp_custom_list = p_preset->get_custom_features().split(",");
+
+ for (int i = 0; i < tmp_custom_list.size(); i++) {
+ String f = tmp_custom_list[i].strip_edges();
+ if (f != String()) {
+ result.features.insert(f);
+ result.features_pv.push_back(f);
+ }
+ }
+ }
+
return result;
}
@@ -606,6 +626,9 @@ EditorExportPlatform::ExportNotifier::ExportNotifier(EditorExportPlatform &p_pla
EditorExportPlatform::ExportNotifier::~ExportNotifier() {
Vector<Ref<EditorExportPlugin> > export_plugins = EditorExport::get_singleton()->get_export_plugins();
for (int i = 0; i < export_plugins.size(); i++) {
+ if (export_plugins[i]->get_script_instance()) {
+ export_plugins.write[i]->_export_end_script();
+ }
export_plugins.write[i]->_export_end();
}
}
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 380b33cd17..881e86fb12 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -206,9 +206,9 @@ public:
PropertyInfo option;
Variant default_value;
- ExportOption(const PropertyInfo &p_info, const Variant &p_default) {
- option = p_info;
- default_value = p_default;
+ ExportOption(const PropertyInfo &p_info, const Variant &p_default) :
+ option(p_info),
+ default_value(p_default) {
}
ExportOption() {}
};
@@ -291,6 +291,7 @@ class EditorExportPlugin : public Reference {
void _export_file_script(const String &p_path, const String &p_type, const PoolVector<String> &p_features);
void _export_begin_script(const PoolVector<String> &p_features, bool p_debug, const String &p_path, int p_flags);
+ void _export_end_script();
protected:
void add_file(const String &p_path, const Vector<uint8_t> &p_file, bool p_remap);
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 4e4c5143f2..a9f7be0fff 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -130,7 +130,7 @@ void EditorHelpSearch::_notification(int p_what) {
} break;
case NOTIFICATION_POPUP_HIDE: {
- results_tree->clear();
+ results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
get_ok()->set_disabled(true);
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect());
} break;
@@ -579,18 +579,12 @@ bool EditorHelpSearch::Runner::work(uint64_t slot) {
return true;
}
-EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree, const String &p_term, int p_search_flags) {
-
- ui_service = p_icon_service;
- results_tree = p_results_tree;
- term = p_term.strip_edges();
- search_flags = p_search_flags;
-
- if ((search_flags & SEARCH_CASE_SENSITIVE) == 0)
- term = term.to_lower();
-
- empty_icon = ui_service->get_icon("ArrowRight", "EditorIcons");
- disabled_color = ui_service->get_color("disabled_font_color", "Editor");
-
- phase = 0;
+EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree, const String &p_term, int p_search_flags) :
+ phase(0),
+ ui_service(p_icon_service),
+ results_tree(p_results_tree),
+ term((p_search_flags & SEARCH_CASE_SENSITIVE) == 0 ? p_term.strip_edges().to_lower() : p_term.strip_edges()),
+ search_flags(p_search_flags),
+ empty_icon(ui_service->get_icon("ArrowRight", "EditorIcons")),
+ disabled_color(ui_service->get_color("disabled_font_color", "Editor")) {
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d009ed61b5..d100d7f618 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3645,6 +3645,7 @@ void EditorNode::_load_docks() {
_load_docks_from_config(config, "docks");
_load_open_scenes_from_config(config, "EditorNode");
+
editor_data.set_plugin_window_layout(config);
}
@@ -3839,6 +3840,23 @@ void EditorNode::_load_open_scenes_from_config(Ref<ConfigFile> p_layout, const S
restoring_scenes = false;
}
+bool EditorNode::has_scenes_in_session() {
+ if (!bool(EDITOR_GET("interface/scene_tabs/restore_scenes_on_load"))) {
+ return false;
+ }
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg"));
+ if (err != OK) {
+ return false;
+ }
+ if (!config->has_section("EditorNode") || !config->has_section_key("EditorNode", "open_scenes")) {
+ return false;
+ }
+ Array scenes = config->get_value("EditorNode", "open_scenes");
+ return !scenes.empty();
+}
+
void EditorNode::_update_layouts_menu() {
editor_layouts->clear();
@@ -5169,14 +5187,9 @@ EditorNode::EditorNode() {
top_region->add_child(left_menu_hb);
menu_hb->add_child(top_region);
- {
- Control *sp = memnew(Control);
- sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- menu_hb->add_child(sp);
- }
-
file_menu = memnew(MenuButton);
file_menu->set_flat(false);
+ file_menu->set_switch_on_hover(true);
file_menu->set_text(TTR("Scene"));
file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(file_menu);
@@ -5268,6 +5281,7 @@ EditorNode::EditorNode() {
project_menu = memnew(MenuButton);
project_menu->set_flat(false);
+ project_menu->set_switch_on_hover(true);
project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
project_menu->set_text(TTR("Project"));
project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
@@ -5309,6 +5323,7 @@ EditorNode::EditorNode() {
debug_menu = memnew(MenuButton);
debug_menu->set_flat(false);
+ debug_menu->set_switch_on_hover(true);
debug_menu->set_text(TTR("Debug"));
debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(debug_menu);
@@ -5339,6 +5354,7 @@ EditorNode::EditorNode() {
settings_menu = memnew(MenuButton);
settings_menu->set_flat(false);
+ settings_menu->set_switch_on_hover(true);
settings_menu->set_text(TTR("Editor"));
settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(settings_menu);
@@ -5375,6 +5391,7 @@ EditorNode::EditorNode() {
// Help Menu
help_menu = memnew(MenuButton);
help_menu->set_flat(false);
+ help_menu->set_switch_on_hover(true);
help_menu->set_text(TTR("Help"));
help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(help_menu);
@@ -5391,12 +5408,8 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_icon_item(gui_base->get_icon("Godot", "EditorIcons"), TTR("About"), HELP_ABOUT);
- play_cc = memnew(CenterContainer);
- play_cc->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
- menu_hb->add_child(play_cc);
-
play_button_panel = memnew(PanelContainer);
- play_cc->add_child(play_button_panel);
+ menu_hb->add_child(play_button_panel);
HBoxContainer *play_hb = memnew(HBoxContainer);
play_button_panel->add_child(play_hb);
@@ -5442,11 +5455,6 @@ EditorNode::EditorNode() {
run_native = memnew(EditorRunNative);
play_hb->add_child(run_native);
- native_play_button = memnew(MenuButton);
- native_play_button->set_text("NTV");
- menu_hb->add_child(native_play_button);
- native_play_button->hide();
- native_play_button->get_popup()->connect("id_pressed", this, "_run_in_device");
run_native->connect("native_run", this, "_menu_option", varray(RUN_PLAY_NATIVE));
play_scene_button = memnew(ToolButton);
@@ -5475,6 +5483,9 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
#endif
+ HBoxContainer *right_menu_hb = memnew(HBoxContainer);
+ menu_hb->add_child(right_menu_hb);
+
// Toggle for video driver
video_driver = memnew(OptionButton);
video_driver->set_flat(true);
@@ -5482,7 +5493,7 @@ EditorNode::EditorNode() {
video_driver->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
video_driver->connect("item_selected", this, "_video_driver_selected");
video_driver->add_font_override("font", gui_base->get_font("bold", "EditorFonts"));
- menu_hb->add_child(video_driver);
+ right_menu_hb->add_child(video_driver);
String video_drivers = ProjectSettings::get_singleton()->get_custom_property_info()["rendering/quality/driver/driver_name"].hint_string;
String current_video_driver = OS::get_singleton()->get_video_driver_name(OS::get_singleton()->get_current_video_driver());
@@ -5508,9 +5519,6 @@ EditorNode::EditorNode() {
progress_hb = memnew(BackgroundProgress);
- HBoxContainer *right_menu_hb = memnew(HBoxContainer);
- menu_hb->add_child(right_menu_hb);
-
layout_dialog = memnew(EditorNameDialog);
gui_base->add_child(layout_dialog);
layout_dialog->set_hide_on_ok(false);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 4d89d1f956..e5670e5e7c 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -243,7 +243,6 @@ private:
Control *vp_base;
PaneDrag *pd;
- CenterContainer *play_cc;
HBoxContainer *menu_hb;
Control *viewport;
MenuButton *file_menu;
@@ -255,7 +254,6 @@ private:
ToolButton *export_button;
ToolButton *prev_scene;
ToolButton *play_button;
- MenuButton *native_play_button;
ToolButton *pause_button;
ToolButton *stop_button;
ToolButton *run_settings_button;
@@ -789,6 +787,7 @@ public:
void edit_current() { _edit_current(); };
void update_keying() const { inspector_dock->update_keying(); };
+ bool has_scenes_in_session();
EditorNode();
~EditorNode();
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 86b2db877e..cd024ff870 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -829,11 +829,11 @@ void EditorPlugin::_bind_methods() {
BIND_ENUM_CONSTANT(DOCK_SLOT_MAX);
}
-EditorPlugin::EditorPlugin() {
- undo_redo = NULL;
- input_event_forwarding_always_enabled = false;
- force_draw_over_forwarding_enabled = false;
- last_main_screen_name = "";
+EditorPlugin::EditorPlugin() :
+ undo_redo(NULL),
+ input_event_forwarding_always_enabled(false),
+ force_draw_over_forwarding_enabled(false),
+ last_main_screen_name("") {
}
EditorPlugin::~EditorPlugin() {
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index de948acc71..ff7ab051b5 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1096,6 +1096,8 @@ void EditorPropertyVector2::setup(double p_min, double p_max, double p_step, boo
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1177,6 +1179,8 @@ void EditorPropertyRect2::setup(double p_min, double p_max, double p_step, bool
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1257,6 +1261,8 @@ void EditorPropertyVector3::setup(double p_min, double p_max, double p_step, boo
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1337,6 +1343,8 @@ void EditorPropertyPlane::setup(double p_min, double p_max, double p_step, bool
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1419,6 +1427,8 @@ void EditorPropertyQuat::setup(double p_min, double p_max, double p_step, bool p
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1506,6 +1516,8 @@ void EditorPropertyAABB::setup(double p_min, double p_max, double p_step, bool p
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1580,6 +1592,8 @@ void EditorPropertyTransform2D::setup(double p_min, double p_max, double p_step,
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1659,6 +1673,8 @@ void EditorPropertyBasis::setup(double p_min, double p_max, double p_step, bool
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1744,6 +1760,8 @@ void EditorPropertyTransform::setup(double p_min, double p_max, double p_step, b
spin[i]->set_max(p_max);
spin[i]->set_step(p_step);
spin[i]->set_hide_slider(p_no_slider);
+ spin[i]->set_allow_greater(true);
+ spin[i]->set_allow_lesser(true);
}
}
@@ -1938,6 +1956,20 @@ EditorPropertyNodePath::EditorPropertyNodePath() {
void EditorPropertyResource::_file_selected(const String &p_path) {
RES res = ResourceLoader::load(p_path);
+
+ List<PropertyInfo> prop_list;
+ get_edited_object()->get_property_list(&prop_list);
+ String type;
+
+ for (List<PropertyInfo>::Element *E = prop_list.front(); E; E = E->next()) {
+ if (E->get().name == get_edited_property() && (E->get().hint & PROPERTY_HINT_RESOURCE_TYPE)) {
+ type = E->get().hint_string;
+ }
+ }
+
+ if (!type.empty() && !res->is_class(type))
+ EditorNode::get_singleton()->show_warning(vformat(TTR("The selected resource (%s) does not match the type expected for this property (%s)."), res->get_class(), type));
+
emit_signal("property_changed", get_edited_property(), res);
update_property();
}
diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp
index 9d3ab59116..a28d071d77 100644
--- a/editor/editor_sectioned_inspector.cpp
+++ b/editor/editor_sectioned_inspector.cpp
@@ -298,19 +298,18 @@ EditorInspector *SectionedInspector::get_inspector() {
return inspector;
}
-SectionedInspector::SectionedInspector() {
-
- obj = -1;
-
- search_box = NULL;
-
+SectionedInspector::SectionedInspector() :
+ obj(-1),
+ sections(memnew(Tree)),
+ filter(memnew(SectionedInspectorFilter)),
+ inspector(memnew(EditorInspector)),
+ search_box(NULL) {
add_constant_override("autohide", 1); // Fixes the dragger always showing up
VBoxContainer *left_vb = memnew(VBoxContainer);
left_vb->set_custom_minimum_size(Size2(170, 0) * EDSCALE);
add_child(left_vb);
- sections = memnew(Tree);
sections->set_v_size_flags(SIZE_EXPAND_FILL);
sections->set_hide_root(true);
@@ -321,8 +320,6 @@ SectionedInspector::SectionedInspector() {
right_vb->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(right_vb);
- filter = memnew(SectionedInspectorFilter);
- inspector = memnew(EditorInspector);
inspector->set_v_size_flags(SIZE_EXPAND_FILL);
right_vb->add_child(inspector, true);
inspector->set_use_doc_hints(true);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index fdfa094ba2..7fa5019cb7 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -256,6 +256,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_THREAD_SAFE_METHOD_
+ /* Languages */
+
{
String lang_hint = "en";
String host_lang = OS::get_singleton()->get_locale();
@@ -291,11 +293,13 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/editor/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
}
+ /* Interface */
+
+ // Editor
_initial_set("interface/editor/display_scale", 0);
hints["interface/editor/display_scale"] = PropertyInfo(Variant::INT, "interface/editor/display_scale", PROPERTY_HINT_ENUM, "Auto,75%,100%,125%,150%,175%,200%,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/custom_display_scale", 1.0f);
hints["interface/editor/custom_display_scale"] = PropertyInfo(Variant::REAL, "interface/editor/custom_display_scale", PROPERTY_HINT_RANGE, "0.75,3,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- _initial_set("interface/scene_tabs/show_script_button", false);
_initial_set("interface/editor/main_font_size", 14);
hints["interface/editor/main_font_size"] = PropertyInfo(Variant::INT, "interface/editor/main_font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/code_font_size", 14);
@@ -317,12 +321,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/editor/dim_amount"] = PropertyInfo(Variant::REAL, "interface/editor/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/dim_transition_time", 0.08f);
hints["interface/editor/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/editor/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT);
-
_initial_set("interface/editor/separate_distraction_mode", false);
-
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
_initial_set("interface/editor/quit_confirmation", true);
+ // Theme
_initial_set("interface/theme/preset", "Default");
hints["interface/theme/preset"] = PropertyInfo(Variant::STRING, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Alien,Arc,Godot 2,Grey,Light,Solarized (Dark),Solarized (Light),Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/theme/icon_and_font_color", 0);
@@ -342,43 +345,88 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/theme/custom_theme", "");
hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ // Scene tabs
_initial_set("interface/scene_tabs/show_extension", false);
_initial_set("interface/scene_tabs/show_thumbnail_on_hover", true);
_initial_set("interface/scene_tabs/resize_if_many_tabs", true);
_initial_set("interface/scene_tabs/minimum_width", 50);
hints["interface/scene_tabs/minimum_width"] = PropertyInfo(Variant::INT, "interface/scene_tabs/minimum_width", PROPERTY_HINT_RANGE, "50,500,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/scene_tabs/show_script_button", false);
+
+ /* Filesystem */
+ // Directories
_initial_set("filesystem/directories/autoscan_project_path", "");
hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR);
_initial_set("filesystem/directories/default_project_path", OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS));
hints["filesystem/directories/default_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/default_project_path", PROPERTY_HINT_GLOBAL_DIR);
- _initial_set("filesystem/directories/default_project_export_path", "");
- hints["filesystem/directories/default_project_export_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/default_project_export_path", PROPERTY_HINT_GLOBAL_DIR);
- _initial_set("interface/scene_tabs/show_script_button", false);
+ // On save
+ _initial_set("filesystem/on_save/compress_binary_resources", true);
+ _initial_set("filesystem/on_save/safe_save_on_backup_then_rename", true);
+
+ // File dialog
+ _initial_set("filesystem/file_dialog/show_hidden_files", false);
+ _initial_set("filesystem/file_dialog/display_mode", 0);
+ hints["filesystem/file_dialog/display_mode"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
+ _initial_set("filesystem/file_dialog/thumbnail_size", 64);
+ hints["filesystem/file_dialog/thumbnail_size"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
+
+ // Import
+ _initial_set("filesystem/import/pvrtc_texture_tool", "");
+#ifdef WINDOWS_ENABLED
+ hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "*.exe");
+#else
+ hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "");
+#endif
+ _initial_set("filesystem/import/pvrtc_fast_conversion", false);
+
+ /* Docks */
+
+ // SceneTree
+ _initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
+ _initial_set("docks/scene_tree/draw_relationship_lines", true);
+ _initial_set("docks/scene_tree/relationship_line_color", Color::html("464646"));
+
+ // FileSystem
+ _initial_set("docks/filesystem/display_mode", 0);
+ hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Tree only, Split");
+ _initial_set("docks/filesystem/thumbnail_size", 64);
+ hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
+ _initial_set("docks/filesystem/files_display_mode", 0);
+ hints["docks/filesystem/files_display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/files_display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
+ _initial_set("docks/filesystem/always_show_folders", true);
+
+ // Property editor
+ _initial_set("docks/property_editor/auto_refresh_interval", 0.3);
+
+ /* Text editor */
+
+ // Theme
_initial_set("text_editor/theme/color_theme", "Adaptive");
hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default,Custom");
-
_initial_set("text_editor/theme/line_spacing", 6);
_initial_set("text_editor/theme/selection_color", Color::html("40808080"));
_load_default_text_editor_theme();
+ // Highlighting
_initial_set("text_editor/highlighting/syntax_highlighting", true);
-
_initial_set("text_editor/highlighting/highlight_all_occurrences", true);
_initial_set("text_editor/highlighting/highlight_current_line", true);
_initial_set("text_editor/highlighting/highlight_type_safe_lines", true);
- _initial_set("text_editor/cursor/scroll_past_end_of_file", false);
+ // Indent
_initial_set("text_editor/indent/type", 0);
hints["text_editor/indent/type"] = PropertyInfo(Variant::INT, "text_editor/indent/type", PROPERTY_HINT_ENUM, "Tabs,Spaces");
_initial_set("text_editor/indent/size", 4);
hints["text_editor/indent/size"] = PropertyInfo(Variant::INT, "text_editor/indent/size", PROPERTY_HINT_RANGE, "1, 64, 1"); // size of 0 crashes.
_initial_set("text_editor/indent/auto_indent", true);
_initial_set("text_editor/indent/convert_indent_on_save", false);
+ _initial_set("text_editor/indent/draw_indent_guides", true);
_initial_set("text_editor/indent/draw_tabs", true);
+ // Line numbers
_initial_set("text_editor/line_numbers/show_line_numbers", true);
_initial_set("text_editor/line_numbers/line_numbers_zero_padded", false);
_initial_set("text_editor/line_numbers/show_breakpoint_gutter", true);
@@ -388,35 +436,45 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/line_numbers/line_length_guideline_column", 80);
hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 1");
+ // Open scripts
_initial_set("text_editor/open_scripts/smooth_scrolling", true);
_initial_set("text_editor/open_scripts/v_scroll_speed", 80);
_initial_set("text_editor/open_scripts/show_members_overview", true);
+ // Files
_initial_set("text_editor/files/trim_trailing_whitespace_on_save", false);
- _initial_set("text_editor/completion/idle_parse_delay", 2);
+ _initial_set("text_editor/files/autosave_interval_secs", 0);
+ _initial_set("text_editor/files/restore_scripts_on_load", true);
+
+ // Tools
_initial_set("text_editor/tools/create_signal_callbacks", true);
_initial_set("text_editor/tools/sort_members_outline_alphabetically", false);
- _initial_set("text_editor/files/autosave_interval_secs", 0);
+ // Cursor
+ _initial_set("text_editor/cursor/scroll_past_end_of_file", false);
_initial_set("text_editor/cursor/block_caret", false);
_initial_set("text_editor/cursor/caret_blink", true);
_initial_set("text_editor/cursor/caret_blink_speed", 0.5);
hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::REAL, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.01");
_initial_set("text_editor/cursor/right_click_moves_caret", true);
+ // Completion
+ _initial_set("text_editor/completion/idle_parse_delay", 2);
_initial_set("text_editor/completion/auto_brace_complete", false);
_initial_set("text_editor/completion/put_callhint_tooltip_below_current_line", true);
_initial_set("text_editor/completion/callhint_tooltip_offset", Vector2());
- _initial_set("text_editor/files/restore_scripts_on_load", true);
_initial_set("text_editor/completion/complete_file_paths", true);
_initial_set("text_editor/completion/add_type_hints", false);
- _initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
- _initial_set("docks/scene_tree/draw_relationship_lines", true);
- _initial_set("docks/scene_tree/relationship_line_color", Color::html("464646"));
+ // Help
+ _initial_set("text_editor/help/show_help_index", true);
+ /* Editors */
+
+ // GridMap
_initial_set("editors/grid_map/pick_distance", 5000.0);
+ // 3D
_initial_set("editors/3d/primary_grid_color", Color::html("909090"));
hints["editors/3d/primary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/primary_grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
@@ -433,7 +491,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/3d/default_z_near", 0.05);
_initial_set("editors/3d/default_z_far", 500.0);
- // navigation
+ // 3D: Navigation
_initial_set("editors/3d/navigation/navigation_scheme", 0);
_initial_set("editors/3d/navigation/invert_y_axis", false);
hints["editors/3d/navigation/navigation_scheme"] = PropertyInfo(Variant::INT, "editors/3d/navigation/navigation_scheme", PROPERTY_HINT_ENUM, "Godot,Maya,Modo");
@@ -447,14 +505,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["editors/3d/navigation/pan_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/pan_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
_initial_set("editors/3d/navigation/zoom_modifier", 4);
hints["editors/3d/navigation/zoom_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/zoom_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
-
- // _initial_set("editors/3d/navigation/emulate_numpad", false); not used at the moment
_initial_set("editors/3d/navigation/warped_mouse_panning", true);
- // navigation feel
+ // 3D: Navigation feel
_initial_set("editors/3d/navigation_feel/orbit_sensitivity", 0.4);
hints["editors/3d/navigation_feel/orbit_sensitivity"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/orbit_sensitivity", PROPERTY_HINT_RANGE, "0.0, 2, 0.01");
-
_initial_set("editors/3d/navigation_feel/orbit_inertia", 0.05);
hints["editors/3d/navigation_feel/orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
_initial_set("editors/3d/navigation_feel/translation_inertia", 0.15);
@@ -466,7 +521,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/3d/navigation_feel/manipulation_translation_inertia", 0.075);
hints["editors/3d/navigation_feel/manipulation_translation_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/manipulation_translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- // freelook
+ // 3D: Freelook
_initial_set("editors/3d/freelook/freelook_inertia", 0.1);
hints["editors/3d/freelook/freelook_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
_initial_set("editors/3d/freelook/freelook_base_speed", 5.0);
@@ -477,6 +532,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["editors/3d/freelook/freelook_modifier_speed_factor"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_modifier_speed_factor", PROPERTY_HINT_RANGE, "0.0, 10.0, 0.1");
_initial_set("editors/3d/freelook/freelook_speed_zoom_link", false);
+ // 2D
_initial_set("editors/2d/grid_color", Color(1.0, 1.0, 1.0, 0.07));
_initial_set("editors/2d/guides_color", Color(0.6, 0.0, 0.8));
_initial_set("editors/2d/bone_width", 5);
@@ -493,9 +549,19 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/2d/scroll_to_pan", false);
_initial_set("editors/2d/pan_speed", 20);
+ // Polygon editor
_initial_set("editors/poly_editor/point_grab_radius", 8);
_initial_set("editors/poly_editor/show_previous_outline", true);
+ // Animation
+ _initial_set("editors/animation/autorename_animation_tracks", true);
+ _initial_set("editors/animation/confirm_insert_track", true);
+ _initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));
+ _initial_set("editors/animation/onion_layers_future_color", Color(0, 1, 0));
+
+ /* Run */
+
+ // Window placement
_initial_set("run/window_placement/rect", 1);
hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
String screen_hints = "Same as Editor,Previous Monitor,Next Monitor";
@@ -506,54 +572,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("run/window_placement/screen", 0);
hints["run/window_placement/screen"] = PropertyInfo(Variant::INT, "run/window_placement/screen", PROPERTY_HINT_ENUM, screen_hints);
- _initial_set("filesystem/on_save/compress_binary_resources", true);
- _initial_set("filesystem/on_save/save_modified_external_resources", true);
-
- _initial_set("text_editor/tools/create_signal_callbacks", true);
-
- _initial_set("filesystem/file_dialog/show_hidden_files", false);
- _initial_set("filesystem/file_dialog/display_mode", 0);
- hints["filesystem/file_dialog/display_mode"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
-
- _initial_set("filesystem/file_dialog/thumbnail_size", 64);
- hints["filesystem/file_dialog/thumbnail_size"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
-
- _initial_set("docks/filesystem/display_mode", 0);
- hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Tree only, Split");
- _initial_set("docks/filesystem/thumbnail_size", 64);
- hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
- _initial_set("docks/filesystem/files_display_mode", 0);
- hints["docks/filesystem/files_display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/files_display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
- _initial_set("docks/filesystem/always_show_folders", true);
-
- _initial_set("editors/animation/autorename_animation_tracks", true);
- _initial_set("editors/animation/confirm_insert_track", true);
- _initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));
- _initial_set("editors/animation/onion_layers_future_color", Color(0, 1, 0));
-
- _initial_set("docks/property_editor/texture_preview_width", 48);
- _initial_set("docks/property_editor/auto_refresh_interval", 0.3);
- _initial_set("text_editor/help/show_help_index", true);
-
- _initial_set("filesystem/import/ask_save_before_reimport", false);
-
- _initial_set("filesystem/import/pvrtc_texture_tool", "");
-#ifdef WINDOWS_ENABLED
- hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "*.exe");
-#else
- hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "");
-#endif
- _initial_set("filesystem/import/pvrtc_fast_conversion", false);
-
+ // Auto save
_initial_set("run/auto_save/save_before_running", true);
+
+ // Output
_initial_set("run/output/always_clear_output_on_play", true);
_initial_set("run/output/always_open_output_on_play", true);
_initial_set("run/output/always_close_output_on_stop", false);
- _initial_set("filesystem/resources/save_compressed_resources", true);
- _initial_set("filesystem/resources/auto_reload_modified_images", true);
- _initial_set("filesystem/import/automatic_reimport_on_sources_changed", true);
- _initial_set("filesystem/on_save/safe_save_on_backup_then_rename", true);
+ /* Extra config */
if (p_extra_config.is_valid()) {
@@ -592,8 +619,8 @@ void EditorSettings::_load_default_text_editor_theme() {
_initial_set("text_editor/highlighting/engine_type_color", Color::html("83d3ff"));
_initial_set("text_editor/highlighting/comment_color", Color::html("676767"));
_initial_set("text_editor/highlighting/string_color", Color::html("ef6ebe"));
- _initial_set("text_editor/highlighting/background_color", dark_theme ? Color::html("3b000000") : Color::html("#323b4f"));
- _initial_set("text_editor/highlighting/completion_background_color", Color::html("2C2A32"));
+ _initial_set("text_editor/highlighting/background_color", dark_theme ? Color::html("3b000000") : Color::html("323b4f"));
+ _initial_set("text_editor/highlighting/completion_background_color", Color::html("2c2a32"));
_initial_set("text_editor/highlighting/completion_selected_color", Color::html("434244"));
_initial_set("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"));
_initial_set("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"));
@@ -603,13 +630,14 @@ void EditorSettings::_load_default_text_editor_theme() {
_initial_set("text_editor/highlighting/safe_line_number_color", Color::html("99aac8aa"));
_initial_set("text_editor/highlighting/caret_color", Color::html("aaaaaa"));
_initial_set("text_editor/highlighting/caret_background_color", Color::html("000000"));
+ _initial_set("text_editor/highlighting/indent_guide_color", Color::html("50808080"));
_initial_set("text_editor/highlighting/text_selected_color", Color::html("000000"));
_initial_set("text_editor/highlighting/selection_color", Color::html("6ca9c2"));
_initial_set("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2));
_initial_set("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15));
_initial_set("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1));
_initial_set("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
- _initial_set("text_editor/highlighting/number_color", Color::html("EB9532"));
+ _initial_set("text_editor/highlighting/number_color", Color::html("eb9532"));
_initial_set("text_editor/highlighting/function_color", Color::html("66a2ce"));
_initial_set("text_editor/highlighting/member_variable_color", Color::html("e64e59"));
_initial_set("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 7b0de9617c..dabe697f10 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -71,23 +71,23 @@ private:
bool hide_from_editor;
bool save;
bool restart_if_changed;
- VariantContainer() {
- variant = Variant();
- initial = Variant();
- order = 0;
- hide_from_editor = false;
- has_default_value = false;
- save = false;
- restart_if_changed = false;
+ VariantContainer() :
+ order(0),
+ variant(Variant()),
+ initial(Variant()),
+ has_default_value(false),
+ hide_from_editor(false),
+ save(false),
+ restart_if_changed(false) {
}
- VariantContainer(const Variant &p_variant, int p_order) {
- variant = p_variant;
- initial = Variant();
- order = p_order;
- hide_from_editor = false;
- has_default_value = false;
- save = false;
- restart_if_changed = false;
+ VariantContainer(const Variant &p_variant, int p_order) :
+ order(p_order),
+ variant(p_variant),
+ initial(Variant()),
+ has_default_value(false),
+ hide_from_editor(false),
+ save(false),
+ restart_if_changed(false) {
}
};
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 36053d7534..3dfc49583c 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -1080,6 +1080,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color safe_line_number_color = dim_color * Color(1, 1.2, 1, 1.5);
const Color caret_color = mono_color;
const Color caret_background_color = mono_color.inverted();
+ const Color indent_guide_color = alpha2;
const Color text_selected_color = dark_color_3;
const Color selection_color = alpha2;
const Color brace_mismatch_color = error_color;
@@ -1115,6 +1116,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
setting->set_initial_value("text_editor/highlighting/safe_line_number_color", safe_line_number_color, true);
setting->set_initial_value("text_editor/highlighting/caret_color", caret_color, true);
setting->set_initial_value("text_editor/highlighting/caret_background_color", caret_background_color, true);
+ setting->set_initial_value("text_editor/highlighting/indent_guide_color", indent_guide_color, true);
setting->set_initial_value("text_editor/highlighting/text_selected_color", text_selected_color, true);
setting->set_initial_value("text_editor/highlighting/selection_color", selection_color, true);
setting->set_initial_value("text_editor/highlighting/brace_mismatch_color", brace_mismatch_color, true);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 828e608fa4..b2368fff6b 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -951,7 +951,7 @@ void FileSystemDock::_find_remaps(EditorFileSystemDirectory *efsd, const Map<Str
}
void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_new_path,
- Map<String, String> &p_file_renames, Map<String, String> &p_folder_renames) const {
+ Map<String, String> &p_file_renames, Map<String, String> &p_folder_renames) {
//Ensure folder paths end with "/"
String old_path = (p_item.is_file || p_item.path.ends_with("/")) ? p_item.path : (p_item.path + "/");
String new_path = (p_item.is_file || p_new_path.ends_with("/")) ? p_new_path : (p_new_path + "/");
@@ -981,6 +981,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_
print_verbose("Moving " + old_path + " -> " + new_path);
Error err = da->rename(old_path, new_path);
if (err == OK) {
+
//Move/Rename any corresponding import settings too
if (p_item.is_file && FileAccess::exists(old_path + ".import")) {
err = da->rename(old_path + ".import", new_path + ".import");
@@ -1007,9 +1008,11 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_
for (int i = 0; i < file_changed_paths.size(); ++i) {
p_file_renames[file_changed_paths[i]] = file_changed_paths[i].replace_first(old_path, new_path);
print_verbose(" Remap: " + file_changed_paths[i] + " -> " + p_file_renames[file_changed_paths[i]]);
+ emit_signal("files_moved", file_changed_paths[i], p_file_renames[file_changed_paths[i]]);
}
for (int i = 0; i < folder_changed_paths.size(); ++i) {
p_folder_renames[folder_changed_paths[i]] = folder_changed_paths[i].replace_first(old_path, new_path);
+ emit_signal("folder_moved", folder_changed_paths[i], p_folder_renames[folder_changed_paths[i]].substr(0, p_folder_renames[folder_changed_paths[i]].length() - 1));
}
} else {
EditorNode::get_singleton()->add_io_error(TTR("Error moving:") + "\n" + old_path + "\n");
@@ -1205,6 +1208,14 @@ void FileSystemDock::_make_dir_confirm() {
}
}
+void FileSystemDock::_file_deleted(String p_file) {
+ emit_signal("file_deleted", p_file);
+}
+
+void FileSystemDock::_folder_deleted(String p_folder) {
+ emit_signal("folder_deleted", p_folder);
+}
+
void FileSystemDock::_rename_operation_confirm() {
String new_name = rename_dialog_text->get_text().strip_edges();
@@ -2273,6 +2284,9 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_file_list_rmb_select"), &FileSystemDock::_file_list_rmb_select);
ClassDB::bind_method(D_METHOD("_file_list_rmb_pressed"), &FileSystemDock::_file_list_rmb_pressed);
+ ClassDB::bind_method(D_METHOD("_file_deleted"), &FileSystemDock::_file_deleted);
+ ClassDB::bind_method(D_METHOD("_folder_deleted"), &FileSystemDock::_folder_deleted);
+
ClassDB::bind_method(D_METHOD("_file_list_thumbnail_done"), &FileSystemDock::_file_list_thumbnail_done);
ClassDB::bind_method(D_METHOD("_tree_thumbnail_done"), &FileSystemDock::_tree_thumbnail_done);
ClassDB::bind_method(D_METHOD("_file_list_activate_file"), &FileSystemDock::_file_list_activate_file);
@@ -2303,6 +2317,11 @@ void FileSystemDock::_bind_methods() {
ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files")));
ADD_SIGNAL(MethodInfo("open"));
+
+ ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
+ ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
+ ADD_SIGNAL(MethodInfo("files_moved", PropertyInfo(Variant::STRING, "old_file"), PropertyInfo(Variant::STRING, "new_file")));
+ ADD_SIGNAL(MethodInfo("folder_moved", PropertyInfo(Variant::STRING, "old_folder"), PropertyInfo(Variant::STRING, "new_file")));
}
FileSystemDock::FileSystemDock(EditorNode *p_editor) {
@@ -2464,6 +2483,8 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
add_child(owners_editor);
remove_dialog = memnew(DependencyRemoveDialog);
+ remove_dialog->connect("file_removed", this, "_file_deleted");
+ remove_dialog->connect("folder_removed", this, "_folder_deleted");
add_child(remove_dialog);
move_dialog = memnew(EditorDirDialog);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index df6fa5f9d2..7692566c0b 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -202,13 +202,18 @@ private:
void _get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files, Vector<String> &folders) const;
void _find_remaps(EditorFileSystemDirectory *efsd, const Map<String, String> &renames, Vector<String> &to_remaps) const;
- void _try_move_item(const FileOrFolder &p_item, const String &p_new_path, Map<String, String> &p_file_renames, Map<String, String> &p_folder_renames) const;
+ void _try_move_item(const FileOrFolder &p_item, const String &p_new_path, Map<String, String> &p_file_renames, Map<String, String> &p_folder_renames);
void _try_duplicate_item(const FileOrFolder &p_item, const String &p_new_path) const;
void _update_dependencies_after_move(const Map<String, String> &p_renames) const;
void _update_resource_paths_after_move(const Map<String, String> &p_renames) const;
void _update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const;
void _update_project_settings_after_move(const Map<String, String> &p_folders_renames) const;
+ void _file_deleted(String p_file);
+ void _folder_deleted(String p_folder);
+ void _files_moved(String p_old_file, String p_new_file);
+ void _folder_moved(String p_old_folder, String p_new_folder);
+
void _resource_created() const;
void _make_dir_confirm();
void _rename_operation_confirm();
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 705bb1d9c5..6ebe8cfe2c 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -44,8 +44,6 @@
#include "scene/gui/progress_bar.h"
#include "scene/gui/tree.h"
-#define ROOT_PREFIX "res://"
-
const char *FindInFiles::SIGNAL_RESULT_FOUND = "result_found";
const char *FindInFiles::SIGNAL_FINISHED = "finished";
@@ -89,7 +87,6 @@ static bool find_next(const String &line, String pattern, int from, bool match_c
//--------------------------------------------------------------------------------
FindInFiles::FindInFiles() {
- _root_prefix = ROOT_PREFIX;
_searching = false;
_whole_words = true;
_match_case = true;
@@ -182,7 +179,7 @@ void FindInFiles::_iterate() {
_current_dir = _current_dir.plus_file(folder_name);
PoolStringArray sub_dirs;
- _scan_dir(_root_prefix + _current_dir, sub_dirs);
+ _scan_dir("res://" + _current_dir, sub_dirs);
_folders_stack.push_back(sub_dirs);
@@ -348,7 +345,7 @@ FindInFilesDialog::FindInFilesDialog() {
HBoxContainer *hbc = memnew(HBoxContainer);
Label *prefix_label = memnew(Label);
- prefix_label->set_text(ROOT_PREFIX);
+ prefix_label->set_text("res://");
hbc->add_child(prefix_label);
_folder_line_edit = memnew(LineEdit);
@@ -375,10 +372,12 @@ FindInFilesDialog::FindInFilesDialog() {
{
HBoxContainer *hbc = memnew(HBoxContainer);
+ // TODO: Unhardcode this.
Vector<String> exts;
exts.push_back("gd");
if (Engine::get_singleton()->has_singleton("GodotSharp"))
exts.push_back("cs");
+ exts.push_back("shader");
for (int i = 0; i < exts.size(); ++i) {
CheckBox *cb = memnew(CheckBox);
diff --git a/editor/find_in_files.h b/editor/find_in_files.h
index 7f37123430..9705c4796c 100644
--- a/editor/find_in_files.h
+++ b/editor/find_in_files.h
@@ -73,7 +73,6 @@ private:
// Config
String _pattern;
Set<String> _extension_filter;
- String _root_prefix;
String _root_dir;
bool _whole_words;
bool _match_case;
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 8e69090da3..93c462f747 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -771,7 +771,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
int binormal_pos = (binormal_src->stride ? binormal_src->stride : 3) * p.indices[src + binormal_ofs];
ERR_FAIL_INDEX_V(binormal_pos, binormal_src->array.size(), ERR_INVALID_DATA);
- Vector3 binormal = Vector3(-binormal_src->array[binormal_pos + 0], -binormal_src->array[binormal_pos + 1], -binormal_src->array[binormal_pos + 2]); // Due to Godots face order it seems we need to flip our binormal!
+ Vector3 binormal = Vector3(binormal_src->array[binormal_pos + 0], binormal_src->array[binormal_pos + 1], binormal_src->array[binormal_pos + 2]);
int tangent_pos = (tangent_src->stride ? tangent_src->stride : 3) * p.indices[src + tangent_ofs];
ERR_FAIL_INDEX_V(tangent_pos, tangent_src->array.size(), ERR_INVALID_DATA);
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 00ca86a43b..b5d646d5d4 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -899,16 +899,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
array[Mesh::ARRAY_NORMAL] = _decode_accessor_as_vec3(state, a["NORMAL"], true);
}
if (a.has("TANGENT")) {
- PoolVector<float> tans = _decode_accessor_as_floats(state, a["TANGENT"], true);
- { // we need our binormals inversed, so flip our w component.
- int ts = tans.size();
- PoolVector<float>::Write w = tans.write();
-
- for (int j = 3; j < ts; j += 4) {
- w[j] *= -1.0;
- }
- }
- array[Mesh::ARRAY_TANGENT] = tans;
+ array[Mesh::ARRAY_TANGENT] = _decode_accessor_as_floats(state, a["TANGENT"], true);
}
if (a.has("TEXCOORD_0")) {
array[Mesh::ARRAY_TEX_UV] = _decode_accessor_as_vec2(state, a["TEXCOORD_0"], true);
diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h
index 8258ec41fd..721db30112 100644
--- a/editor/import/editor_scene_importer_gltf.h
+++ b/editor/import/editor_scene_importer_gltf.h
@@ -114,14 +114,14 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
Vector<int> children;
Vector<Node *> godot_nodes;
- GLTFNode() {
- // child_of_skeleton = -1;
- // skeleton_skin = -1;
- mesh = -1;
- camera = -1;
- parent = -1;
- skin = -1;
- scale = Vector3(1, 1, 1);
+ GLTFNode() :
+ parent(-1),
+ mesh(-1),
+ camera(-1),
+ skin(-1),
+ //skeleton_skin(-1),
+ //child_of_skeleton(-1),
+ scale(Vector3(1, 1, 1)) {
}
};
@@ -134,12 +134,12 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
bool indices;
//matrices need to be transformed to this
- GLTFBufferView() {
- buffer = 0;
- byte_offset = 0;
- byte_length = 0;
- byte_stride = 0;
- indices = false;
+ GLTFBufferView() :
+ buffer(0),
+ byte_offset(0),
+ byte_length(0),
+ byte_stride(0),
+ indices(false) {
}
};
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 55f4cc7439..85ea0d343c 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -272,12 +272,18 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
for (int i = 0; i < 10; i++)
file->get_32(); // i wish to know why should i do this... no doc!
- // only read 0x00 (loop forward) and 0x01 (loop ping-pong) and skip anything else because
- // it's not supported (loop backward), reserved for future uses or sampler specific
+ // only read 0x00 (loop forward), 0x01 (loop ping-pong) and 0x02 (loop backward)
+ // Skip anything else because it's not supported, reserved for future uses or sampler specific
// from https://sites.google.com/site/musicgapi/technical-documents/wav-file-format#smpl (loop type values table)
int loop_type = file->get_32();
- if (loop_type == 0x00 || loop_type == 0x01) {
- loop = loop_type ? AudioStreamSample::LOOP_PING_PONG : AudioStreamSample::LOOP_FORWARD;
+ if (loop_type == 0x00 || loop_type == 0x01 || loop_type == 0x02) {
+ if (loop_type == 0x00) {
+ loop = AudioStreamSample::LOOP_FORWARD;
+ } else if (loop_type == 0x01) {
+ loop = AudioStreamSample::LOOP_PING_PONG;
+ } else if (loop_type == 0x02) {
+ loop = AudioStreamSample::LOOP_BACKWARD;
+ }
loop_begin = file->get_32();
loop_end = file->get_32();
}
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index a85f4456f7..cc030dac4c 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -826,13 +826,11 @@ void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) {
}
}
-AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class) {
-
- editor = p_node;
- polygon_editor = p_polygon_editor;
- klass = p_class;
+AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class) :
+ polygon_editor(p_polygon_editor),
+ editor(p_node),
+ klass(p_class) {
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(polygon_editor);
-
polygon_editor->hide();
}
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index e2daefdec6..e7934ea3a0 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -70,9 +70,9 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
String name;
String type;
Ref<Script> script;
- AddOption(const String &p_name = String(), const String &p_type = String()) {
- name = p_name;
- type = p_type;
+ AddOption(const String &p_name = String(), const String &p_type = String()) :
+ name(p_name),
+ type(p_type) {
}
};
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 0bbe08821a..44f1625d06 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -40,6 +40,7 @@
#include "editor/editor_settings.h"
#include "editor/find_in_files.h"
#include "editor/node_dock.h"
+#include "editor/plugins/shader_editor_plugin.h"
#include "editor/script_editor_debugger.h"
#include "scene/main/viewport.h"
#include "script_text_editor.h"
@@ -896,12 +897,12 @@ void ScriptEditor::_file_dialog_action(String p_file) {
} break;
case THEME_SAVE_AS: {
if (!EditorSettings::get_singleton()->save_text_editor_theme_as(p_file)) {
- editor->show_warning(TTR("Error while saving theme"), TTR("Error saving"));
+ editor->show_warning(TTR("Error while saving theme."), TTR("Error Saving"));
}
} break;
case THEME_IMPORT: {
if (!EditorSettings::get_singleton()->import_text_editor_theme(p_file)) {
- editor->show_warning(TTR("Error importing theme"), TTR("Error importing"));
+ editor->show_warning(TTR("Error importing theme."), TTR("Error Importing"));
}
} break;
}
@@ -1089,7 +1090,7 @@ void ScriptEditor::_menu_option(int p_option) {
Ref<Script> scr = current->get_edited_resource();
if (scr == NULL || scr.is_null()) {
- EditorNode::get_singleton()->show_warning("Can't obtain the script for running");
+ EditorNode::get_singleton()->show_warning("Can't obtain the script for running.");
break;
}
@@ -1102,13 +1103,13 @@ void ScriptEditor::_menu_option(int p_option) {
}
if (!scr->is_tool()) {
- EditorNode::get_singleton()->show_warning("Script is not in tool mode, will not be able to run");
+ EditorNode::get_singleton()->show_warning("Script is not in tool mode, will not be able to run.");
return;
}
if (!ClassDB::is_parent_class(scr->get_instance_base_type(), "EditorScript")) {
- EditorNode::get_singleton()->show_warning("To run this script, it must inherit EditorScript and be set to tool mode");
+ EditorNode::get_singleton()->show_warning("To run this script, it must inherit EditorScript and be set to tool mode.");
return;
}
@@ -2778,13 +2779,18 @@ void ScriptEditor::_on_find_in_files_requested(String text) {
void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_number, int begin, int end) {
RES res = ResourceLoader::load(fpath);
- edit(res);
-
- ScriptEditorBase *seb = _get_current_editor();
+ if (fpath.get_extension() == "shader") {
+ ShaderEditorPlugin *shader_editor = Object::cast_to<ShaderEditorPlugin>(EditorNode::get_singleton()->get_editor_data().get_editor("Shader"));
+ shader_editor->edit(res.ptr());
+ shader_editor->make_visible(true);
+ shader_editor->get_shader_editor()->goto_line_selection(line_number - 1, begin, end);
+ } else {
+ edit(res);
- ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(seb);
- if (ste) {
- ste->goto_line_selection(line_number - 1, begin, end);
+ ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(_get_current_editor());
+ if (ste) {
+ ste->goto_line_selection(line_number - 1, begin, end);
+ }
}
}
@@ -2971,10 +2977,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu = memnew(MenuButton);
menu_hb->add_child(file_menu);
file_menu->set_text(TTR("File"));
+ 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/open", TTR("Open")), FILE_OPEN);
+ 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_submenu_item(TTR("Open Recent"), "RecentScripts", FILE_OPEN_RECENT);
recent_scripts = memnew(PopupMenu);
@@ -3003,10 +3010,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
theme_submenu->set_name("Theme");
file_menu->get_popup()->add_child(theme_submenu);
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/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);
+ 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);
@@ -3022,6 +3030,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
script_search_menu = memnew(MenuButton);
menu_hb->add_child(script_search_menu);
script_search_menu->set_text(TTR("Search"));
+ script_search_menu->set_switch_on_hover(true);
script_search_menu->get_popup()->set_hide_on_window_lose_focus(true);
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT);
@@ -3031,6 +3040,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
debug_menu = memnew(MenuButton);
menu_hb->add_child(debug_menu);
debug_menu->set_text(TTR("Debug"));
+ debug_menu->set_switch_on_hover(true);
debug_menu->get_popup()->set_hide_on_window_lose_focus(true);
debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("debugger/step_over", TTR("Step Over"), KEY_F10), DEBUG_NEXT);
debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("debugger/step_into", TTR("Step Into"), KEY_F11), DEBUG_STEP);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index e6bb8b24a9..6d4b1d1b9c 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -131,6 +131,7 @@ void ScriptTextEditor::_load_theme_settings() {
Color safe_line_number_color = EDITOR_GET("text_editor/highlighting/safe_line_number_color");
Color caret_color = EDITOR_GET("text_editor/highlighting/caret_color");
Color caret_background_color = EDITOR_GET("text_editor/highlighting/caret_background_color");
+ Color indent_guide_color = EDITOR_GET("text_editor/highlighting/indent_guide_color");
Color text_selected_color = EDITOR_GET("text_editor/highlighting/text_selected_color");
Color selection_color = EDITOR_GET("text_editor/highlighting/selection_color");
Color brace_mismatch_color = EDITOR_GET("text_editor/highlighting/brace_mismatch_color");
@@ -163,6 +164,7 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_color_override("safe_line_number_color", safe_line_number_color);
text_edit->add_color_override("caret_color", caret_color);
text_edit->add_color_override("caret_background_color", caret_background_color);
+ text_edit->add_color_override("indent_guide_color", indent_guide_color);
text_edit->add_color_override("font_selected_color", text_selected_color);
text_edit->add_color_override("selection_color", selection_color);
text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
@@ -1076,7 +1078,7 @@ void ScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter)
if (p_highlighter != NULL)
highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(p_highlighter->get_name()), true);
else
- highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text("Standard"), true);
+ highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(TTR("Standard")), true);
}
void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
@@ -1466,6 +1468,7 @@ ScriptTextEditor::ScriptTextEditor() {
edit_menu = memnew(MenuButton);
edit_menu->set_text(TTR("Edit"));
+ edit_menu->set_switch_on_hover(true);
edit_menu->get_popup()->set_hide_on_window_lose_focus(true);
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);
@@ -1509,7 +1512,7 @@ ScriptTextEditor::ScriptTextEditor() {
convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F6), EDIT_CAPITALIZE);
convert_case->connect("id_pressed", this, "_edit_option");
- highlighters["Standard"] = NULL;
+ highlighters[TTR("Standard")] = NULL;
highlighter_menu = memnew(PopupMenu);
highlighter_menu->set_name("highlighter_menu");
edit_menu->get_popup()->add_child(highlighter_menu);
@@ -1520,6 +1523,7 @@ ScriptTextEditor::ScriptTextEditor() {
search_menu = memnew(MenuButton);
edit_hb->add_child(search_menu);
search_menu->set_text(TTR("Search"));
+ search_menu->set_switch_on_hover(true);
search_menu->get_popup()->set_hide_on_window_lose_focus(true);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 6bc5c77df2..e3389f25cf 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -70,6 +70,7 @@ void ShaderTextEditor::_load_theme_settings() {
Color line_number_color = EDITOR_GET("text_editor/highlighting/line_number_color");
Color caret_color = EDITOR_GET("text_editor/highlighting/caret_color");
Color caret_background_color = EDITOR_GET("text_editor/highlighting/caret_background_color");
+ Color indent_guide_color = EDITOR_GET("text_editor/highlighting/indent_guide_color");
Color text_selected_color = EDITOR_GET("text_editor/highlighting/text_selected_color");
Color selection_color = EDITOR_GET("text_editor/highlighting/selection_color");
Color brace_mismatch_color = EDITOR_GET("text_editor/highlighting/brace_mismatch_color");
@@ -98,6 +99,7 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_color_override("line_number_color", line_number_color);
get_text_edit()->add_color_override("caret_color", caret_color);
get_text_edit()->add_color_override("caret_background_color", caret_background_color);
+ get_text_edit()->add_color_override("indent_guide_color", indent_guide_color);
get_text_edit()->add_color_override("font_selected_color", text_selected_color);
get_text_edit()->add_color_override("selection_color", selection_color);
get_text_edit()->add_color_override("brace_mismatch_color", brace_mismatch_color);
@@ -350,9 +352,9 @@ void ShaderEditor::_menu_option(int p_option) {
void ShaderEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_ENTER_TREE) {
- }
- if (p_what == NOTIFICATION_DRAW) {
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+ if (is_visible_in_tree())
+ shader_editor->get_text_edit()->grab_focus();
}
}
@@ -368,6 +370,7 @@ void ShaderEditor::_editor_settings_changed() {
shader_editor->get_text_edit()->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size"));
shader_editor->get_text_edit()->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type"));
shader_editor->get_text_edit()->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent"));
+ shader_editor->get_text_edit()->set_draw_indent_guides(EditorSettings::get_singleton()->get("text_editor/indent/draw_indent_guides"));
shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs"));
shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers"));
shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting"));
@@ -389,7 +392,6 @@ void ShaderEditor::_bind_methods() {
ClassDB::bind_method("_menu_option", &ShaderEditor::_menu_option);
ClassDB::bind_method("_params_changed", &ShaderEditor::_params_changed);
ClassDB::bind_method("apply_shaders", &ShaderEditor::apply_shaders);
- //ClassDB::bind_method("_close_current_tab",&ShaderEditor::_close_current_tab);
}
void ShaderEditor::ensure_select_current() {
@@ -405,6 +407,11 @@ void ShaderEditor::ensure_select_current() {
}*/
}
+void ShaderEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
+
+ shader_editor->goto_line_selection(p_line, p_begin, p_end);
+}
+
void ShaderEditor::edit(const Ref<Shader> &p_shader) {
if (p_shader.is_null() || !p_shader->is_text_shader())
@@ -527,9 +534,8 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
HBoxContainer *hbc = memnew(HBoxContainer);
edit_menu = memnew(MenuButton);
- //edit_menu->set_position(Point2(5, -1));
edit_menu->set_text(TTR("Edit"));
-
+ edit_menu->set_switch_on_hover(true);
edit_menu->get_popup()->set_hide_on_window_lose_focus(true);
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);
@@ -549,12 +555,11 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN);
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE);
-
edit_menu->get_popup()->connect("id_pressed", this, "_menu_option");
search_menu = memnew(MenuButton);
- //search_menu->set_position(Point2(38, -1));
search_menu->set_text(TTR("Search"));
+ search_menu->set_switch_on_hover(true);
search_menu->get_popup()->set_hide_on_window_lose_focus(true);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT);
diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h
index 2ea1562310..46e3dffdd5 100644
--- a/editor/plugins/shader_editor_plugin.h
+++ b/editor/plugins/shader_editor_plugin.h
@@ -120,6 +120,8 @@ public:
void ensure_select_current();
void edit(const Ref<Shader> &p_shader);
+ void goto_line_selection(int p_line, int p_begin, int p_end);
+
virtual Size2 get_minimum_size() const { return Size2(0, 200); }
void save_external_data();
@@ -143,6 +145,8 @@ public:
virtual void make_visible(bool p_visible);
virtual void selected_notify();
+ ShaderEditor *get_shader_editor() const { return shader_editor; }
+
virtual void save_external_data();
virtual void apply_changes();
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index cc5f50a834..4fe278d005 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -5475,6 +5475,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
transform_menu = memnew(MenuButton);
transform_menu->set_text(TTR("Transform"));
+ transform_menu->set_switch_on_hover(true);
hbc_menu->add_child(transform_menu);
p = transform_menu->get_popup();
@@ -5487,6 +5488,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
view_menu = memnew(MenuButton);
view_menu->set_text(TTR("View"));
+ view_menu->set_switch_on_hover(true);
hbc_menu->add_child(view_menu);
p = view_menu->get_popup();
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 4a8eae1ba4..52dd115b3e 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -84,6 +84,7 @@ void TextEditor::_load_theme_settings() {
Color line_number_color = EDITOR_GET("text_editor/highlighting/line_number_color");
Color caret_color = EDITOR_GET("text_editor/highlighting/caret_color");
Color caret_background_color = EDITOR_GET("text_editor/highlighting/caret_background_color");
+ Color indent_guide_color = EDITOR_GET("text_editor/highlighting/indent_guide_color");
Color text_selected_color = EDITOR_GET("text_editor/highlighting/text_selected_color");
Color selection_color = EDITOR_GET("text_editor/highlighting/selection_color");
Color brace_mismatch_color = EDITOR_GET("text_editor/highlighting/brace_mismatch_color");
@@ -115,6 +116,7 @@ void TextEditor::_load_theme_settings() {
text_edit->add_color_override("line_number_color", line_number_color);
text_edit->add_color_override("caret_color", caret_color);
text_edit->add_color_override("caret_background_color", caret_background_color);
+ text_edit->add_color_override("indent_guide_color", indent_guide_color);
text_edit->add_color_override("font_selected_color", text_selected_color);
text_edit->add_color_override("selection_color", selection_color);
text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 5844315529..cab9a4297d 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -185,6 +185,7 @@ void TileSetEditor::_bind_methods() {
ClassDB::bind_method("_on_workspace_input", &TileSetEditor::_on_workspace_input);
ClassDB::bind_method("_on_tool_clicked", &TileSetEditor::_on_tool_clicked);
ClassDB::bind_method("_on_priority_changed", &TileSetEditor::_on_priority_changed);
+ ClassDB::bind_method("_on_z_index_changed", &TileSetEditor::_on_z_index_changed);
ClassDB::bind_method("_on_grid_snap_toggled", &TileSetEditor::_on_grid_snap_toggled);
ClassDB::bind_method("_set_snap_step", &TileSetEditor::_set_snap_step);
ClassDB::bind_method("_set_snap_off", &TileSetEditor::_set_snap_off);
@@ -233,6 +234,7 @@ void TileSetEditor::_notification(int p_what) {
tool_editmode[EDITMODE_BITMASK]->set_icon(get_icon("PackedDataContainer", "EditorIcons"));
tool_editmode[EDITMODE_PRIORITY]->set_icon(get_icon("MaterialPreviewLight1", "EditorIcons"));
tool_editmode[EDITMODE_ICON]->set_icon(get_icon("LargeTexture", "EditorIcons"));
+ tool_editmode[EDITMODE_Z_INDEX]->set_icon(get_icon("Sort", "EditorIcons"));
scroll->add_style_override("bg", get_stylebox("bg", "Tree"));
} break;
@@ -320,7 +322,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
tool_hb = memnew(HBoxContainer);
g = Ref<ButtonGroup>(memnew(ButtonGroup));
- String label[EDITMODE_MAX] = { "Region", "Collision", "Occlusion", "Navigation", "Bitmask", "Priority", "Icon" };
+ String label[EDITMODE_MAX] = { "Region", "Collision", "Occlusion", "Navigation", "Bitmask", "Priority", "Icon", "Z Index" };
for (int i = 0; i < (int)EDITMODE_MAX; i++) {
tool_editmode[i] = memnew(Button);
tool_editmode[i]->set_text(label[i]);
@@ -395,6 +397,15 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
spin_priority->hide();
toolbar->add_child(spin_priority);
+ spin_z_index = memnew(SpinBox);
+ spin_z_index->set_min(VS::CANVAS_ITEM_Z_MIN);
+ spin_z_index->set_max(VS::CANVAS_ITEM_Z_MAX);
+ spin_z_index->set_step(1);
+ spin_z_index->set_custom_minimum_size(Size2(100, 0));
+ spin_z_index->connect("value_changed", this, "_on_z_index_changed");
+ spin_z_index->hide();
+ toolbar->add_child(spin_z_index);
+
Control *separator = memnew(Control);
separator->set_h_size_flags(SIZE_EXPAND_FILL);
toolbar->add_child(separator);
@@ -617,6 +628,7 @@ void TileSetEditor::_on_edit_mode_changed(int p_edit_mode) {
tools[TOOL_SELECT]->set_tooltip(TTR("Drag handles to edit Rect.\nClick on another Tile to edit it."));
tools[SHAPE_DELETE]->set_tooltip(TTR("Delete selected Rect."));
spin_priority->hide();
+ spin_z_index->hide();
} break;
case EDITMODE_COLLISION:
case EDITMODE_NAVIGATION:
@@ -639,6 +651,8 @@ void TileSetEditor::_on_edit_mode_changed(int p_edit_mode) {
tools[TOOL_SELECT]->set_tooltip(TTR("Select current edited sub-tile.\nClick on another Tile to edit it."));
tools[SHAPE_DELETE]->set_tooltip(TTR("Delete polygon."));
spin_priority->hide();
+ spin_z_index->hide();
+
select_coord(edited_shape_coord);
} break;
case EDITMODE_BITMASK: {
@@ -661,6 +675,7 @@ void TileSetEditor::_on_edit_mode_changed(int p_edit_mode) {
tools[TOOL_SELECT]->set_tooltip(TTR("LMB: Set bit on.\nRMB: Set bit off.\nClick on another Tile to edit it."));
spin_priority->hide();
} break;
+ case EDITMODE_Z_INDEX:
case EDITMODE_PRIORITY:
case EDITMODE_ICON: {
tools[TOOL_SELECT]->show();
@@ -681,9 +696,15 @@ void TileSetEditor::_on_edit_mode_changed(int p_edit_mode) {
if (edit_mode == EDITMODE_ICON) {
tools[TOOL_SELECT]->set_tooltip(TTR("Select sub-tile to use as icon, this will be also used on invalid autotile bindings.\nClick on another Tile to edit it."));
spin_priority->hide();
- } else {
+ spin_z_index->hide();
+ } else if (edit_mode == EDITMODE_PRIORITY) {
tools[TOOL_SELECT]->set_tooltip(TTR("Select sub-tile to change its priority.\nClick on another Tile to edit it."));
spin_priority->show();
+ spin_z_index->hide();
+ } else {
+ tools[TOOL_SELECT]->set_tooltip(TTR("Select sub-tile to change its z index.\nClick on another Tile to edit it."));
+ spin_priority->hide();
+ spin_z_index->show();
}
} break;
default: {}
@@ -811,6 +832,10 @@ void TileSetEditor::_on_workspace_draw() {
spin_priority->set_suffix(" / " + String::num(total, 0));
draw_highlight_subtile(edited_shape_coord, queue_others);
} break;
+ case EDITMODE_Z_INDEX: {
+ spin_z_index->set_value(tileset->autotile_get_z_index(get_current_tile(), edited_shape_coord));
+ draw_highlight_subtile(edited_shape_coord);
+ } break;
default: {}
}
}
@@ -1205,7 +1230,8 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
case EDITMODE_COLLISION:
case EDITMODE_OCCLUSION:
case EDITMODE_NAVIGATION:
- case EDITMODE_PRIORITY: {
+ case EDITMODE_PRIORITY:
+ case EDITMODE_Z_INDEX: {
Vector2 shape_anchor = Vector2(0, 0);
if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) {
shape_anchor = edited_shape_coord;
@@ -1481,6 +1507,11 @@ void TileSetEditor::_on_priority_changed(float val) {
workspace->update();
}
+void TileSetEditor::_on_z_index_changed(float val) {
+ tileset->autotile_set_z_index(get_current_tile(), edited_shape_coord, (int)val);
+ workspace->update();
+}
+
void TileSetEditor::_on_grid_snap_toggled(bool p_val) {
helper->set_snap_options_visible(p_val);
workspace->update();
@@ -2219,7 +2250,7 @@ void TileSetEditor::update_workspace_tile_mode() {
separator_editmode->show();
if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) {
- if (tool_editmode[EDITMODE_ICON]->is_pressed() || tool_editmode[EDITMODE_PRIORITY]->is_pressed() || tool_editmode[EDITMODE_BITMASK]->is_pressed()) {
+ if (tool_editmode[EDITMODE_ICON]->is_pressed() || tool_editmode[EDITMODE_PRIORITY]->is_pressed() || tool_editmode[EDITMODE_BITMASK]->is_pressed() || tool_editmode[EDITMODE_Z_INDEX]->is_pressed()) {
tool_editmode[EDITMODE_COLLISION]->set_pressed(true);
edit_mode = EDITMODE_COLLISION;
}
@@ -2228,6 +2259,7 @@ void TileSetEditor::update_workspace_tile_mode() {
tool_editmode[EDITMODE_ICON]->hide();
tool_editmode[EDITMODE_BITMASK]->hide();
tool_editmode[EDITMODE_PRIORITY]->hide();
+ tool_editmode[EDITMODE_Z_INDEX]->hide();
} else if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) {
if (edit_mode == EDITMODE_ICON)
select_coord(tileset->autotile_get_icon_coordinate(get_current_tile()));
@@ -2442,6 +2474,11 @@ void TilesetEditorContext::_get_property_list(List<PropertyInfo> *p_list) const
}
}
+void TilesetEditorContext::_bind_methods() {
+
+ ClassDB::bind_method("_hide_script_from_inspector", &TilesetEditorContext::_hide_script_from_inspector);
+}
+
TilesetEditorContext::TilesetEditorContext(TileSetEditor *p_tileset_editor) {
tileset_editor = p_tileset_editor;
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index c6fcdae404..276e23f9ee 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -71,6 +71,7 @@ class TileSetEditor : public HSplitContainer {
EDITMODE_BITMASK,
EDITMODE_PRIORITY,
EDITMODE_ICON,
+ EDITMODE_Z_INDEX,
EDITMODE_MAX
};
@@ -138,6 +139,7 @@ class TileSetEditor : public HSplitContainer {
VSeparator *separator_delete;
VSeparator *separator_grid;
SpinBox *spin_priority;
+ SpinBox *spin_z_index;
WorkspaceMode workspace_mode;
EditMode edit_mode;
int current_tile;
@@ -178,6 +180,7 @@ private:
void _on_workspace_input(const Ref<InputEvent> &p_ie);
void _on_tool_clicked(int p_tool);
void _on_priority_changed(float val);
+ void _on_z_index_changed(float val);
void _on_grid_snap_toggled(bool p_val);
void _set_snap_step(Vector2 p_val);
void _set_snap_off(Vector2 p_val);
@@ -213,6 +216,7 @@ class TilesetEditorContext : public Object {
bool snap_options_visible;
public:
+ bool _hide_script_from_inspector() { return true; }
void set_tileset(const Ref<TileSet> &p_tileset);
private:
@@ -222,6 +226,7 @@ protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
+ static void _bind_methods();
public:
TilesetEditorContext(TileSetEditor *p_tileset_editor);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index b084fe1915..d3295c0f51 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -633,18 +633,23 @@ void VisualShaderEditor::_duplicate_nodes() {
VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
List<int> nodes;
+ Set<int> excluded;
for (int i = 0; i < graph->get_child_count(); i++) {
- if (Object::cast_to<GraphNode>(graph->get_child(i))) {
- int id = String(graph->get_child(i)->get_name()).to_int();
+ GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
+ if (gn) {
+ int id = String(gn->get_name()).to_int();
Ref<VisualShaderNode> node = visual_shader->get_node(type, id);
Ref<VisualShaderNodeOutput> output = node;
- if (output.is_valid()) //can't duplicate output
+ if (output.is_valid()) { // can't duplicate output
+ excluded.insert(id);
continue;
- if (node.is_valid()) {
+ }
+ if (node.is_valid() && gn->is_selected()) {
nodes.push_back(id);
}
+ excluded.insert(id);
}
}
@@ -683,15 +688,16 @@ void VisualShaderEditor::_duplicate_nodes() {
undo_redo->add_undo_method(this, "_update_graph");
undo_redo->commit_action();
- //reselect
+ // reselect duplicated nodes by excluding the other ones
for (int i = 0; i < graph->get_child_count(); i++) {
- if (Object::cast_to<GraphNode>(graph->get_child(i))) {
- int id = String(graph->get_child(i)->get_name()).to_int();
- if (nodes.find(id)) {
- Object::cast_to<GraphNode>(graph->get_child(i))->set_selected(true);
+ GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
+ if (gn) {
+ int id = String(gn->get_name()).to_int();
+ if (!excluded.has(id)) {
+ gn->set_selected(true);
} else {
- Object::cast_to<GraphNode>(graph->get_child(i))->set_selected(false);
+ gn->set_selected(false);
}
}
}