summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_editor.cpp75
-rw-r--r--editor/dependency_editor.cpp1
-rw-r--r--editor/editor_audio_buses.cpp23
-rw-r--r--editor/editor_audio_buses.h1
-rw-r--r--editor/editor_export.cpp2
-rw-r--r--editor/editor_node.cpp10
-rw-r--r--editor/editor_settings.cpp10
-rw-r--r--editor/editor_themes.cpp4
-rw-r--r--editor/fileserver/editor_file_server.cpp2
-rw-r--r--editor/icons/icon_class_list.svg10
-rw-r--r--editor/icons/icon_file_dead.svg7
-rw-r--r--editor/icons/icon_filesystem.svg5
-rw-r--r--editor/icons/icon_key_call.svg5
-rw-r--r--editor/icons/icon_mini_checkerboard.svg4
-rw-r--r--editor/icons/icon_shader_material.svg11
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp6
-rw-r--r--editor/import/resource_importer_scene.cpp6
-rw-r--r--editor/import/resource_importer_wav.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp130
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp20
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.cpp3
-rw-r--r--editor/plugins/script_text_editor.cpp2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp8
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp83
-rw-r--r--editor/plugins/spatial_editor_plugin.h4
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp1
-rw-r--r--editor/project_export.cpp5
-rw-r--r--editor/project_manager.cpp46
-rw-r--r--editor/project_manager.h1
-rw-r--r--editor/property_editor.cpp13
-rw-r--r--editor/property_selector.cpp33
-rw-r--r--editor/property_selector.h3
-rw-r--r--editor/scene_tree_dock.cpp56
34 files changed, 344 insertions, 252 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 702adf0c68..f4e3bf4894 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -1092,10 +1092,14 @@ void AnimationKeyEditor::_track_editor_draw() {
int sep = get_constant("vseparation", "Tree");
int hsep = get_constant("hseparation", "Tree");
Color color = get_color("font_color", "Tree");
- Color sepcolor = Color(1, 1, 1, 0.2);
- Color timecolor = Color(1, 1, 1, 0.2);
- Color hover_color = Color(1, 1, 1, 0.05);
- Color select_color = Color(1, 1, 1, 0.1);
+ Color sepcolor = color;
+ sepcolor.a = 0.2;
+ Color timecolor = color;
+ timecolor.a = 0.2;
+ Color hover_color = color;
+ hover_color.a = 0.05;
+ Color select_color = color;
+ select_color.a = 0.1;
Color invalid_path_color = get_color("error_color", "Editor");
Color track_select_color = get_color("highlight_color", "Editor");
@@ -1157,7 +1161,8 @@ void AnimationKeyEditor::_track_editor_draw() {
int settings_limit = size.width - right_separator_ofs;
int name_limit = settings_limit * name_column_ratio;
- Color linecolor = Color(1, 1, 1, 0.2);
+ Color linecolor = color;
+ linecolor.a = 0.2;
te->draw_line(ofs + Point2(name_limit, 0), ofs + Point2(name_limit, size.height), linecolor);
te->draw_line(ofs + Point2(settings_limit, 0), ofs + Point2(settings_limit, size.height), linecolor);
te->draw_texture(hsize_icon, ofs + Point2(name_limit - hsize_icon->get_width() - hsep, (h - hsize_icon->get_height()) / 2));
@@ -2890,11 +2895,9 @@ void AnimationKeyEditor::_notification(int p_what) {
key_editor->edit(key_edit);
- zoomicon->set_texture(get_icon("Zoom", "EditorIcons"));
zoomicon->set_custom_minimum_size(Size2(24 * EDSCALE, 0));
zoomicon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
- menu_add_track->set_icon(get_icon("Add", "EditorIcons"));
menu_add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), "Add Normal Track", ADD_TRACK_MENU_ADD_VALUE_TRACK);
menu_add_track->get_popup()->add_icon_item(get_icon("KeyXform", "EditorIcons"), "Add Transform Track", ADD_TRACK_MENU_ADD_TRANSFORM_TRACK);
menu_add_track->get_popup()->add_icon_item(get_icon("KeyCall", "EditorIcons"), "Add Call Func Track", ADD_TRACK_MENU_ADD_CALL_TRACK);
@@ -2921,18 +2924,10 @@ void AnimationKeyEditor::_notification(int p_what) {
optimize_dialog->connect("confirmed", this, "_animation_optimize");
menu_track->get_popup()->add_child(tpp);
- //menu_track->get_popup()->add_submenu_item("Set Transitions..","Transitions");
- //menu_track->get_popup()->add_separator();
+
menu_track->get_popup()->add_item(TTR("Optimize Animation"), TRACK_MENU_OPTIMIZE);
menu_track->get_popup()->add_item(TTR("Clean-Up Animation"), TRACK_MENU_CLEAN_UP);
- curve_linear->set_icon(get_icon("CurveLinear", "EditorIcons"));
- curve_in->set_icon(get_icon("CurveIn", "EditorIcons"));
- curve_out->set_icon(get_icon("CurveOut", "EditorIcons"));
- curve_inout->set_icon(get_icon("CurveInOut", "EditorIcons"));
- curve_outin->set_icon(get_icon("CurveOutIn", "EditorIcons"));
- curve_constant->set_icon(get_icon("CurveConstant", "EditorIcons"));
-
curve_linear->connect("pressed", this, "_menu_track", varray(CURVE_SET_LINEAR));
curve_in->connect("pressed", this, "_menu_track", varray(CURVE_SET_IN));
curve_out->connect("pressed", this, "_menu_track", varray(CURVE_SET_OUT));
@@ -2940,17 +2935,39 @@ void AnimationKeyEditor::_notification(int p_what) {
curve_outin->connect("pressed", this, "_menu_track", varray(CURVE_SET_OUTIN));
curve_constant->connect("pressed", this, "_menu_track", varray(CURVE_SET_CONSTANT));
+ edit_button->connect("pressed", this, "_toggle_edit_curves");
+
+ curve_edit->connect("transition_changed", this, "_curve_transition_changed");
+ call_select->connect("selected", this, "_add_call_track");
+
+ _update_menu();
+
+ } break;
+
+ case NOTIFICATION_THEME_CHANGED: {
+ zoomicon->set_texture(get_icon("Zoom", "EditorIcons"));
+
+ menu_add_track->set_icon(get_icon("Add", "EditorIcons"));
+
+ menu_track->set_icon(get_icon("Tools", "EditorIcons"));
+
+ menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_VALUE_TRACK, get_icon("KeyValue", "EditorIcons"));
+ menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_TRANSFORM_TRACK, get_icon("KeyXform", "EditorIcons"));
+ menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_CALL_TRACK, get_icon("KeyCall", "EditorIcons"));
+
+ curve_linear->set_icon(get_icon("CurveLinear", "EditorIcons"));
+ curve_in->set_icon(get_icon("CurveIn", "EditorIcons"));
+ curve_out->set_icon(get_icon("CurveOut", "EditorIcons"));
+ curve_inout->set_icon(get_icon("CurveInOut", "EditorIcons"));
+ curve_outin->set_icon(get_icon("CurveOutIn", "EditorIcons"));
+ curve_constant->set_icon(get_icon("CurveConstant", "EditorIcons"));
+
move_up_button->set_icon(get_icon("MoveUp", "EditorIcons"));
move_down_button->set_icon(get_icon("MoveDown", "EditorIcons"));
remove_button->set_icon(get_icon("Remove", "EditorIcons"));
edit_button->set_icon(get_icon("EditKey", "EditorIcons"));
- edit_button->connect("pressed", this, "_toggle_edit_curves");
loop->set_icon(get_icon("Loop", "EditorIcons"));
- curve_edit->connect("transition_changed", this, "_curve_transition_changed");
-
- //edit_button->add_color_override("font_color",get_color("font_color","Tree"));
- //edit_button->add_color_override("font_color_hover",get_color("font_color","Tree"));
{
@@ -2976,24 +2993,8 @@ void AnimationKeyEditor::_notification(int p_what) {
get_icon("InterpWrapClamp", "EditorIcons"),
get_icon("InterpWrapLoop", "EditorIcons"),
};
-
- //right_data_size_cache = remove_icon->get_width() + move_up_icon->get_width() + move_down_icon->get_width() + down_icon->get_width() *2 + interp_icon[0]->get_width() + cont_icon[0]->get_width() + add_key_icon->get_width() + hsep*11;
right_data_size_cache = down_icon->get_width() * 3 + add_key_icon->get_width() + interp_icon[0]->get_width() + cont_icon[0]->get_width() + wrap_icon[0]->get_width() + hsep * 8;
}
- call_select->connect("selected", this, "_add_call_track");
- //rename_anim->set_icon( get_icon("Rename","EditorIcons") );
- /*
- edit_anim->set_icon( get_icon("Edit","EditorIcons") );
- blend_anim->set_icon( get_icon("Blend","EditorIcons") );
- play->set_icon( get_icon("Play","EditorIcons") );
- stop->set_icon( get_icon("Stop","EditorIcons") );
- pause->set_icon( get_icon("Pause","EditorIcons") );
-*/
- //menu->set_icon(get_icon("Animation","EditorIcons"));
- //play->set_icon(get_icon("AnimationPlay","EditorIcons"));
- //menu->set_icon(get_icon("Animation","EditorIcons"));
- _update_menu();
-
} break;
}
}
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 890c3d8091..54bf31cd62 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -489,6 +489,7 @@ DependencyErrorDialog::DependencyErrorDialog() {
vb->add_margin_child(TTR("Scene failed to load due to missing dependencies:"), files, true);
files->set_v_size_flags(SIZE_EXPAND_FILL);
get_ok()->set_text(TTR("Open Anyway"));
+ get_cancel()->set_text(TTR("Done"));
text = memnew(Label);
vb->add_child(text);
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 6937f74316..29159c7ad5 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -414,7 +414,10 @@ void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
void EditorAudioBus::_bus_popup_pressed(int p_option) {
- if (p_option == 1) {
+ if (p_option == 2) {
+ // Reset volume
+ emit_signal("vol_reset_request");
+ } else if (p_option == 1) {
emit_signal("delete_request");
} else if (p_option == 0) {
//duplicate
@@ -617,6 +620,7 @@ void EditorAudioBus::_bind_methods() {
ADD_SIGNAL(MethodInfo("duplicate_request"));
ADD_SIGNAL(MethodInfo("delete_request"));
+ ADD_SIGNAL(MethodInfo("vol_reset_request"));
ADD_SIGNAL(MethodInfo("drop_end_request"));
ADD_SIGNAL(MethodInfo("dropped"));
}
@@ -742,6 +746,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
bus_popup = bus_options->get_popup();
bus_popup->add_item(TTR("Duplicate"));
bus_popup->add_item(TTR("Delete"));
+ bus_popup->add_item(TTR("Reset Volume"));
bus_popup->connect("index_pressed", this, "_bus_popup_pressed");
delete_effect_popup = memnew(PopupMenu);
@@ -790,6 +795,7 @@ void EditorAudioBuses::_update_buses() {
bus_hb->add_child(audio_bus);
audio_bus->connect("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED);
audio_bus->connect("duplicate_request", this, "_duplicate_bus", varray(), CONNECT_DEFERRED);
+ audio_bus->connect("vol_reset_request", this, "_reset_bus_volume", varray(audio_bus), CONNECT_DEFERRED);
audio_bus->connect("drop_end_request", this, "_request_drop_end");
audio_bus->connect("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED);
}
@@ -919,6 +925,20 @@ void EditorAudioBuses::_duplicate_bus(int p_which) {
ur->commit_action();
}
+void EditorAudioBuses::_reset_bus_volume(Object *p_which) {
+
+ EditorAudioBus *bus = Object::cast_to<EditorAudioBus>(p_which);
+ int index = bus->get_index();
+
+ UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ ur->create_action(TTR("Reset Bus Volume"));
+ ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", index, 0.f);
+ ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", index, AudioServer::get_singleton()->get_bus_volume_db(index));
+ ur->add_do_method(this, "_update_buses");
+ ur->add_undo_method(this, "_update_buses");
+ ur->commit_action();
+}
+
void EditorAudioBuses::_request_drop_end() {
if (!drop_end && bus_hb->get_child_count()) {
@@ -1063,6 +1083,7 @@ void EditorAudioBuses::_bind_methods() {
ClassDB::bind_method("_load_default_layout", &EditorAudioBuses::_load_default_layout);
ClassDB::bind_method("_new_layout", &EditorAudioBuses::_new_layout);
ClassDB::bind_method("_duplicate_bus", &EditorAudioBuses::_duplicate_bus);
+ ClassDB::bind_method("_reset_bus_volume", &EditorAudioBuses::_reset_bus_volume);
ClassDB::bind_method("_file_dialog_callback", &EditorAudioBuses::_file_dialog_callback);
}
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index e04ba7b89d..2c61228bde 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -158,6 +158,7 @@ class EditorAudioBuses : public VBoxContainer {
void _delete_bus(Object *p_which);
void _duplicate_bus(int p_which);
+ void _reset_bus_volume(Object *p_which);
void _request_drop_end();
void _drop_at_index(int p_bus, int p_index);
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 915fb7e5db..8623b9acdb 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -697,6 +697,8 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
zd.zip = zip;
Error err = export_project_files(p_preset, _save_zip_file, &zd);
+ if (err != OK)
+ ERR_PRINT("Failed to export project files");
zipClose(zip, NULL);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 91d2ddcd19..b4412014e7 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -412,7 +412,6 @@ void EditorNode::_fs_changed() {
}
if (changed.size()) {
- int idx = 0;
for (List<Ref<Resource> >::Element *E = changed.front(); E; E = E->next()) {
E->get()->reload_from_file();
}
@@ -1997,6 +1996,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
int cur_idx = editor_data.get_edited_scene();
_remove_edited_scene();
Error err = load_scene(filename);
+ if (err != OK)
+ ERR_PRINT("Failed to load scene");
editor_data.move_edited_scene_to_index(cur_idx);
get_undo_redo()->clear_history();
scene_tabs->set_current_tab(cur_idx);
@@ -3607,13 +3608,6 @@ void EditorNode::_update_dock_slots_visibility() {
right_r_vsplit,
};
- HSplitContainer *h_splits[4] = {
- left_l_hsplit,
- left_r_hsplit,
- main_hsplit,
- right_hsplit,
- };
-
if (!docks_visible) {
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index db76a27f5f..50cee6d892 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -676,9 +676,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/3d/warped_mouse_panning", true);
set("editors/3d/orbit_sensitivity", 0.4);
- set("editors/3d/freelook_inertia", 3);
- set("editors/3d/freelook_base_speed", 1);
+ set("editors/3d/orbit_inertia", 0.2);
+ hints["editors/3d/orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
+
+ set("editors/3d/freelook_inertia", 0.2);
+ hints["editors/3d/freelook_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/freelook_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
+
+ set("editors/3d/freelook_base_speed", 0.5);
+ hints["editors/3d/freelook_base_speed"] = PropertyInfo(Variant::REAL, "editors/3d/freelook_base_speed", PROPERTY_HINT_RANGE, "0.0, 10, 0.1");
set("editors/3d/freelook_activation_modifier", 0);
hints["editors/3d/freelook_activation_modifier"] = PropertyInfo(Variant::INT, "editors/3d/freelook_activation_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 19356aad3a..ff0e794a20 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -295,6 +295,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("panel", "PanelContainer", style_menu);
theme->set_stylebox("MenuPanel", "EditorStyles", style_menu);
+ // Script Editor
+ theme->set_stylebox("ScriptEditorPanel", "EditorStyles", make_empty_stylebox(4, 0, 4, 4));
+ theme->set_stylebox("ScriptEditor", "EditorStyles", make_empty_stylebox(0, 0, 0, 0));
+
// Play button group
theme->set_stylebox("PlayButtonPanel", "EditorStyles", make_empty_stylebox(8, 4, 8, 4)); //make_stylebox(theme->get_icon("GuiPlayButtonGroup", "EditorIcons"), 16, 16, 16, 16, 8, 4, 8, 4));
diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp
index ba90beee22..fccf7c323c 100644
--- a/editor/fileserver/editor_file_server.cpp
+++ b/editor/fileserver/editor_file_server.cpp
@@ -34,7 +34,7 @@
#include "io/marshalls.h"
//#define DEBUG_PRINT(m_p) print_line(m_p)
-#define DEBUG_TIME(m_what) printf("MS: %s - %lli\n", m_what, OS::get_singleton()->get_ticks_usec());
+#define DEBUG_TIME(m_what) printf("MS: %s - %lu\n", m_what, OS::get_singleton()->get_ticks_usec());
//#define DEBUG_TIME(m_what)
diff --git a/editor/icons/icon_class_list.svg b/editor/icons/icon_class_list.svg
index 1f2b37bd25..87a20743c7 100644
--- a/editor/icons/icon_class_list.svg
+++ b/editor/icons/icon_class_list.svg
@@ -1,11 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)" fill="#e0e0e0">
-<rect x="1" y="1038.4" width="5" height=".99998"/>
-<rect x="6" y="1037.4" width="6" height="3"/>
-<rect x="3" y="1038.4" width="1" height="11"/>
-<rect x="4" y="1043.4" width="5" height="1"/>
-<rect x="9" y="1042.4" width="6" height="3"/>
-<rect x="4" y="1048.4" width="5" height="1"/>
-<rect x="9" y="1047.4" width="6" height="3"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m6 1v1h-5v1h2v10h1 5v1h6v-3h-6v1h-5v-4h5v1h6v-3h-6v1h-5v-4h2v1h6v-3h-6z" fill="#e0e0e0"/>
</g>
</svg>
diff --git a/editor/icons/icon_file_dead.svg b/editor/icons/icon_file_dead.svg
new file mode 100644
index 0000000000..e0aee6fd90
--- /dev/null
+++ b/editor/icons/icon_file_dead.svg
@@ -0,0 +1,7 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<g transform="translate(0 -1.6949e-5)">
+<path transform="translate(0 1036.4)" d="m2 1v14h12v-9h-5v-5zm8 0v4h4zm-6.0078 6c0.1353-0.0020779 0.26567 0.050774 0.36133 0.14648l0.64648 0.64648 0.64648-0.64648c0.09183-0.091882 0.21582-0.14442 0.3457-0.14648 0.1353-0.00208 0.26567 0.050774 0.36133 0.14648 0.19521 0.19525 0.19521 0.51178 0 0.70703l-0.64648 0.64648 0.64648 0.64648c0.19521 0.19525 0.19521 0.51178 0 0.70703-0.19525 0.19521-0.51178 0.19521-0.70703 0l-0.64648-0.64648-0.64648 0.64648c-0.19525 0.19521-0.51178 0.19521-0.70703 0-0.19521-0.19525-0.19521-0.51178 0-0.70703l0.64648-0.64648-0.64648-0.64648c-0.19521-0.19525-0.19521-0.51178 0-0.70703 0.09183-0.091882 0.21582-0.14442 0.3457-0.14648zm6 0c0.1353-0.00208 0.26567 0.050774 0.36133 0.14648l0.64648 0.64648 0.64648-0.64648c0.09183-0.091883 0.21582-0.14442 0.3457-0.14648 0.1353-0.00208 0.26567 0.050774 0.36133 0.14648 0.19521 0.19525 0.19521 0.51178 0 0.70703l-0.64648 0.64648 0.64648 0.64648c0.19521 0.19525 0.19521 0.51178 0 0.70703-0.19525 0.19521-0.51178 0.19521-0.70703 0l-0.64648-0.64648-0.64648 0.64648c-0.19525 0.19521-0.51178 0.19521-0.70703 0-0.19521-0.19525-0.19521-0.51178 0-0.70703l0.64648-0.64648-0.64648-0.64648c-0.19521-0.19525-0.19521-0.51178 0-0.70703 0.09183-0.091882 0.21582-0.14442 0.3457-0.14648zm-6.4922 4h9c0.277 0 0.5 0.223 0.5 0.5s-0.223 0.5-0.5 0.5h-4.5c0 1.1046-0.89543 2-2 2s-2-0.8954-2-2h-0.5c-0.277 0-0.5-0.223-0.5-0.5s0.223-0.5 0.5-0.5zm1.5 1c-1.9e-5 0.5523 0.44771 1 1 1s1-0.4477 1-1z" fill="#ff8484"/>
+</g>
+</g>
+</svg>
diff --git a/editor/icons/icon_filesystem.svg b/editor/icons/icon_filesystem.svg
new file mode 100644
index 0000000000..41e0348d68
--- /dev/null
+++ b/editor/icons/icon_filesystem.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m1 1v5h2v8h1 5v1h6v-3h-6v1h-5v-4h5v1h6v-3h-6v1h-5v-2h3v-4h-2l-1-1h-3z" fill="#e0e0e0"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_key_call.svg b/editor/icons/icon_key_call.svg
new file mode 100644
index 0000000000..7fcc65801a
--- /dev/null
+++ b/editor/icons/icon_key_call.svg
@@ -0,0 +1,5 @@
+<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1044.4)">
+<rect transform="rotate(-45)" x="-741.53" y="741.08" width="6.1027" height="6.1027" ry=".76286" fill="#adf18f"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_mini_checkerboard.svg b/editor/icons/icon_mini_checkerboard.svg
new file mode 100644
index 0000000000..e740113b2d
--- /dev/null
+++ b/editor/icons/icon_mini_checkerboard.svg
@@ -0,0 +1,4 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m0 0v8h8v-8h-8zm8 8v8h8v-8h-8z" fill="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9994"/>
+<path d="m8 0v8h8v-8h-8zm0 8h-8v8h8v-8z" fill="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9994"/>
+</svg>
diff --git a/editor/icons/icon_shader_material.svg b/editor/icons/icon_shader_material.svg
new file mode 100644
index 0000000000..f77aa837c5
--- /dev/null
+++ b/editor/icons/icon_shader_material.svg
@@ -0,0 +1,11 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m2 1c-0.55226 1e-4 -0.99994 0.4477-1 1v1h2 6 3l-2-2h-8z" fill="#ff7070"/>
+<path transform="translate(0 1036.4)" d="m1 3v2h2v-2h-2zm8 0v2h5l-2-2h-3z" fill="#ffeb70"/>
+<path transform="translate(0 1036.4)" d="m1 5v2h2v-2h-2zm8 0v1c0 0.554 0.44599 1 1 1h3 2v-1l-1-1h-5z" fill="#9dff70"/>
+<path transform="translate(0 1036.4)" d="m1 7v2h2v-2h-2zm12 0v2h2v-2h-2z" fill="#70ffb9"/>
+<path transform="translate(0 1036.4)" d="m1 9v2h2v-2h-2zm12 0v2h2v-2h-2z" fill="#70deff"/>
+<path transform="translate(0 1036.4)" d="m1 13v1c5.52e-5 0.5523 0.44774 0.9999 1 1h12c0.55226-1e-4 0.99994-0.4477 1-1v-1h-2-10-2z" fill="#ff70ac"/>
+<path transform="translate(0 1036.4)" d="m1 11v2h2v-2h-2zm12 0v2h2v-2h-2z" fill="#9f70ff"/>
+</g>
+</svg>
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 21cf08f524..831eb74b66 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -55,8 +55,8 @@ Error EditorSceneImporterGLTF::_parse_glb(const String &p_path, GLTFState &state
uint32_t magic = f->get_32();
ERR_FAIL_COND_V(magic != 0x46546C67, ERR_FILE_UNRECOGNIZED); //glTF
- uint32_t version = f->get_32();
- uint32_t length = f->get_32();
+ f->get_32(); // version
+ f->get_32(); // length
uint32_t chunk_length = f->get_32();
uint32_t chunk_type = f->get_32();
@@ -1945,7 +1945,7 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
bool last = false;
while (true) {
- float value = _interpolate_track<float>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, track.weight_tracks[i].interpolation);
+ _interpolate_track<float>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, track.weight_tracks[i].interpolation);
if (last) {
break;
}
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 594728d2e0..0bbe287e2b 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -230,8 +230,8 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
if (isroot)
return p_node;
-
- if (MeshInstance *mi = Object::cast_to<MeshInstance>(p_node)) {
+ MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
+ if (mi) {
Node *col = mi->create_trimesh_collision_node();
ERR_FAIL_COND_V(!col, NULL);
@@ -1024,7 +1024,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
String root_type = p_options["nodes/root_type"];
if (scene->get_class() != root_type) {
- Node *base_node = base_node = Object::cast_to<Node>(ClassDB::instance(root_type));
+ Node *base_node = Object::cast_to<Node>(ClassDB::instance(root_type));
if (base_node) {
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index e2bacd70e4..025dbbaacf 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -103,7 +103,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
/* GET FILESIZE */
- uint32_t filesize = file->get_32();
+ file->get_32(); // filesize
/* CHECK WAVE */
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index cc7fc57cde..d7762a66df 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -55,79 +55,87 @@ void AnimationPlayerEditor::_gui_input(Ref<InputEvent> p_event) {
}
void AnimationPlayerEditor::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_PROCESS: {
- if (p_what == NOTIFICATION_PROCESS) {
-
- if (!player)
- return;
+ if (!player)
+ return;
- updating = true;
+ updating = true;
- if (player->is_playing()) {
+ if (player->is_playing()) {
- {
- String animname = player->get_current_animation();
+ {
+ String animname = player->get_current_animation();
- if (player->has_animation(animname)) {
- Ref<Animation> anim = player->get_animation(animname);
- if (!anim.is_null()) {
+ if (player->has_animation(animname)) {
+ Ref<Animation> anim = player->get_animation(animname);
+ if (!anim.is_null()) {
- frame->set_max(anim->get_length());
+ frame->set_max(anim->get_length());
+ }
}
}
+ frame->set_value(player->get_current_animation_pos());
+ key_editor->set_anim_pos(player->get_current_animation_pos());
+ EditorNode::get_singleton()->get_property_editor()->refresh();
+
+ } else if (last_active) {
+ //need the last frame after it stopped
+
+ frame->set_value(player->get_current_animation_pos());
}
- frame->set_value(player->get_current_animation_pos());
- key_editor->set_anim_pos(player->get_current_animation_pos());
- EditorNode::get_singleton()->get_property_editor()->refresh();
- } else if (last_active) {
- //need the last frame after it stopped
+ last_active = player->is_playing();
+ //seek->set_val(player->get_position());
+ updating = false;
- frame->set_value(player->get_current_animation_pos());
- }
+ } break;
- last_active = player->is_playing();
- //seek->set_val(player->get_position());
- updating = false;
- }
+ case NOTIFICATION_ENTER_TREE: {
+
+ save_anim->get_popup()->connect("id_pressed", this, "_animation_save_menu");
+
+ tool_anim->get_popup()->connect("id_pressed", this, "_animation_tool_menu");
+
+ blend_editor.next->connect("item_selected", this, "_blend_editor_next_changed");
- if (p_what == NOTIFICATION_ENTER_TREE) {
-
- //editor->connect("hide_animation_player_editors",this,"_hide_anim_editors");
- add_anim->set_icon(get_icon("New", "EditorIcons"));
- rename_anim->set_icon(get_icon("Rename", "EditorIcons"));
- duplicate_anim->set_icon(get_icon("Duplicate", "EditorIcons"));
- autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
- load_anim->set_icon(get_icon("Folder", "EditorIcons"));
- save_anim->set_icon(get_icon("Save", "EditorIcons"));
- save_anim->get_popup()->connect("id_pressed", this, "_animation_save_menu");
- remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
-
- blend_anim->set_icon(get_icon("Blend", "EditorIcons"));
- play->set_icon(get_icon("PlayStart", "EditorIcons"));
- play_from->set_icon(get_icon("Play", "EditorIcons"));
- play_bw->set_icon(get_icon("PlayStartBackwards", "EditorIcons"));
- play_bw_from->set_icon(get_icon("PlayBackwards", "EditorIcons"));
-
- autoplay_icon = get_icon("AutoPlay", "EditorIcons");
- stop->set_icon(get_icon("Stop", "EditorIcons"));
- resource_edit_anim->set_icon(get_icon("EditResource", "EditorIcons"));
- pin->set_icon(get_icon("Pin", "EditorIcons"));
- tool_anim->set_icon(get_icon("Tools", "EditorIcons"));
- tool_anim->get_popup()->connect("id_pressed", this, "_animation_tool_menu");
-
- blend_editor.next->connect("item_selected", this, "_blend_editor_next_changed");
-
- /*
- anim_editor_load->set_normal_texture( get_icon("AnimGet","EditorIcons"));
- anim_editor_store->set_normal_texture( get_icon("AnimSet","EditorIcons"));
- anim_editor_load->set_pressed_texture( get_icon("AnimGet","EditorIcons"));
- anim_editor_store->set_pressed_texture( get_icon("AnimSet","EditorIcons"));
- anim_editor_load->set_hover_texture( get_icon("AnimGetHl","EditorIcons"));
- anim_editor_store->set_hover_texture( get_icon("AnimSetHl","EditorIcons"));
-*/
-
- get_tree()->connect("node_removed", this, "_node_removed");
+ get_tree()->connect("node_removed", this, "_node_removed");
+
+ add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
+ add_constant_override("separation", get_constant("separation", "VBoxContainer"));
+ } break;
+
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+
+ add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
+ add_constant_override("separation", get_constant("separation", "VBoxContainer"));
+ } break;
+
+ case NOTIFICATION_THEME_CHANGED: {
+
+ add_anim->set_icon(get_icon("New", "EditorIcons"));
+ rename_anim->set_icon(get_icon("Rename", "EditorIcons"));
+ duplicate_anim->set_icon(get_icon("Duplicate", "EditorIcons"));
+ autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
+ load_anim->set_icon(get_icon("Folder", "EditorIcons"));
+ save_anim->set_icon(get_icon("Save", "EditorIcons"));
+
+ remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
+
+ blend_anim->set_icon(get_icon("Blend", "EditorIcons"));
+ play->set_icon(get_icon("PlayStart", "EditorIcons"));
+ play_from->set_icon(get_icon("Play", "EditorIcons"));
+ play_bw->set_icon(get_icon("PlayStartBackwards", "EditorIcons"));
+ play_bw_from->set_icon(get_icon("PlayBackwards", "EditorIcons"));
+
+ autoplay_icon = get_icon("AutoPlay", "EditorIcons");
+ stop->set_icon(get_icon("Stop", "EditorIcons"));
+ resource_edit_anim->set_icon(get_icon("EditResource", "EditorIcons"));
+ pin->set_icon(get_icon("Pin", "EditorIcons"));
+ tool_anim->set_icon(get_icon("Tools", "EditorIcons"));
+
+ } break;
}
}
@@ -1176,7 +1184,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
set_focus_mode(FOCUS_ALL);
player = NULL;
- add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
Label *l;
@@ -1376,7 +1383,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
key_editor = memnew(AnimationKeyEditor);
add_child(key_editor);
- add_constant_override("separation", get_constant("separation", "VBoxContainer"));
key_editor->set_v_size_flags(SIZE_EXPAND_FILL);
key_editor->connect("timeline_changed", this, "_animation_key_editor_seek");
key_editor->connect("animation_len_changed", this, "_animation_key_editor_anim_len_changed");
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index df4598793c..2b2358f3d0 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -580,7 +580,8 @@ void CanvasItemEditor::_key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE
} else { // p_move_mode==MOVE_LOCAL_BASE || p_move_mode==MOVE_LOCAL_WITH_ROT
- if (Node2D *node_2d = Object::cast_to<Node2D>(canvas_item)) {
+ Node2D *node_2d = Object::cast_to<Node2D>(canvas_item);
+ if (node_2d) {
if (p_move_mode == MOVE_LOCAL_WITH_ROT) {
Transform2D m;
@@ -589,9 +590,10 @@ void CanvasItemEditor::_key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE
}
node_2d->set_position(node_2d->get_position() + drag);
- } else if (Control *control = Object::cast_to<Control>(canvas_item)) {
-
- control->set_position(control->get_position() + drag);
+ } else {
+ Control *control = Object::cast_to<Control>(canvas_item);
+ if (control)
+ control->set_position(control->get_position() + drag);
}
}
}
@@ -742,7 +744,8 @@ float CanvasItemEditor::_anchor_snap(float p_anchor, bool *p_snapped, float p_op
float radius = 0.05 / zoom;
float basic_anchors[3] = { 0.0, 0.5, 1.0 };
for (int i = 0; i < 3; i++) {
- if ((dist = fabs(p_anchor - basic_anchors[i])) < radius) {
+ dist = fabs(p_anchor - basic_anchors[i]);
+ if (dist < radius) {
if (!snapped || dist <= dist_min) {
p_anchor = basic_anchors[i];
dist_min = dist;
@@ -750,7 +753,8 @@ float CanvasItemEditor::_anchor_snap(float p_anchor, bool *p_snapped, float p_op
}
}
}
- if (p_opposite_anchor >= 0 && (dist = fabs(p_anchor - p_opposite_anchor)) < radius) {
+ dist = fabs(p_anchor - p_opposite_anchor);
+ if (p_opposite_anchor >= 0 && dist < radius) {
if (!snapped || dist <= dist_min) {
p_anchor = p_opposite_anchor;
dist_min = dist;
@@ -1515,7 +1519,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
if (drag == DRAG_NONE) {
- if ((m->get_button_mask() & BUTTON_MASK_LEFT && tool == TOOL_PAN) || m->get_button_mask() & BUTTON_MASK_MIDDLE || (m->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
+ if (((m->get_button_mask() & BUTTON_MASK_LEFT) && tool == TOOL_PAN) || (m->get_button_mask() & BUTTON_MASK_MIDDLE) || ((m->get_button_mask() & BUTTON_MASK_LEFT) && Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
// Pan the viewport
Point2i relative;
if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) {
@@ -2269,6 +2273,8 @@ void CanvasItemEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels"));
+
List<Node *> &selection = editor_selection->get_selected_node_list();
bool all_control = true;
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index f7008298f0..3917c700f0 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -395,7 +395,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
- if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
+ if (edited_point != -1 && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) {
Vector2 gpoint = mm->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
@@ -554,7 +554,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
if (mm.is_valid()) {
- if (mm->get_button_mask() & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
+ if ((mm->get_button_mask() & BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
Vector2 drag(mm->get_relative().x, mm->get_relative().y);
uv_hscroll->set_value(uv_hscroll->get_value() - drag.x);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 04be1ba4ab..6f03d086ca 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -2416,6 +2416,9 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
use_space_indentation = false;
ScriptServer::edit_request_func = _open_script_request;
+
+ add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptEditorPanel", "EditorStyles"));
+ tab_container->add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptEditor", "EditorStyles"));
}
ScriptEditor::~ScriptEditor() {
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index fae57eb5d2..2192d3ac49 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -624,7 +624,7 @@ void ScriptTextEditor::_code_complete_script(const String &p_code, List<String>
}
String hint;
Error err = script->get_language()->complete_code(p_code, script->get_path().get_base_dir(), base, r_options, r_force, hint);
- if (hint != "") {
+ if (err == OK && hint != "") {
code_editor->get_text_edit()->set_code_hint(hint);
}
}
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index b02016c273..1b02f18d85 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -164,6 +164,8 @@ void ShaderTextEditor::_code_complete_script(const String &p_code, List<String>
String calltip;
Error err = sl.complete(p_code, ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_types(), r_options, calltip);
+ if (err != OK)
+ ERR_PRINT("Shaderlang complete failed");
if (calltip != "") {
get_text_edit()->set_code_hint(calltip);
@@ -403,13 +405,7 @@ void ShaderEditorPlugin::edit(Object *p_object) {
bool ShaderEditorPlugin::handles(Object *p_object) const {
- bool handles = true;
Shader *shader = Object::cast_to<Shader>(p_object);
- /*
- if (Object::cast_to<ShaderGraph>(shader)) // Don't handle ShaderGraph's
- handles = false;
- */
-
return shader != NULL;
}
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index a5f55835f0..93d12fd3d2 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -76,40 +76,35 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) {
} else
camera->set_perspective(get_fov(), get_znear(), get_zfar());
- Transform new_transform = to_camera_transform(cursor);
- Transform old_transform = camera->get_global_transform();
- Transform transform;
+ float inertia = EDITOR_DEF("editors/3d/orbit_inertia", 0.5);
+ inertia = MAX(0, inertia);
+
+ Cursor old_camera_cursor = camera_cursor;
+ camera_cursor = cursor;
+
+ camera_cursor.x_rot = Math::lerp(old_camera_cursor.x_rot, cursor.x_rot, p_interp_delta * (1 / inertia));
+ camera_cursor.y_rot = Math::lerp(old_camera_cursor.y_rot, cursor.y_rot, p_interp_delta * (1 / inertia));
bool disable_interp = (Input::get_singleton()->get_mouse_button_mask() & (2 | 4)) || Input::get_singleton()->is_key_pressed(KEY_SHIFT) || Input::get_singleton()->is_key_pressed(KEY_ALT) || Input::get_singleton()->is_key_pressed(KEY_CONTROL);
- if (p_interp_delta && !disable_interp) {
- //interpolate
- float interp_speed = 14; //maybe should be made configuration
- transform = old_transform.interpolate_with(new_transform, MIN(1.0, p_interp_delta * interp_speed));
- } else {
- transform = new_transform;
+ if (p_interp_delta == 0 || disable_interp || is_freelook_active()) {
+ camera_cursor = cursor;
}
float tolerance = 0.0001;
bool equal = true;
- for (int i = 0; i < 3; i++) {
- if (transform.basis[i].distance_to(old_transform.basis[i]) > tolerance) {
- equal = false;
- break;
- }
- }
+ if (Math::abs(old_camera_cursor.x_rot - camera_cursor.x_rot) > tolerance || Math::abs(old_camera_cursor.y_rot - camera_cursor.y_rot) > tolerance)
+ equal = false;
- if (equal && transform.origin.distance_to(old_transform.origin) > tolerance) {
+ if (equal && old_camera_cursor.pos.distance_squared_to(camera_cursor.pos) > tolerance * tolerance)
equal = false;
- }
- if (equal) {
- transform = new_transform;
- }
+ if (equal && Math::abs(old_camera_cursor.distance - camera_cursor.distance) > tolerance)
+ equal = false;
+
+ if (!equal || p_interp_delta == 0 || is_freelook_active()) {
- if (!equal || p_interp_delta == 0) {
- //print_line(transform);
- camera->set_global_transform(transform);
+ camera->set_global_transform(to_camera_transform(camera_cursor));
update_transform_gizmo_view();
}
}
@@ -1540,6 +1535,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
Vector3 pos = camera_transform.xform(Vector3(0, 0, 0));
Vector3 diff = camera->get_translation() - pos;
cursor.pos += diff;
+ freelook_target_position += diff;
name = "";
_update_name();
@@ -1661,7 +1657,7 @@ void SpatialEditorViewport::scale_cursor_distance(real_t scale) {
Point2i SpatialEditorViewport::_get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const {
Point2i relative;
- if (bool(EditorSettings::get_singleton()->get("editors/3d/warped_mouse_panning"))) {
+ if (bool(EDITOR_DEF("editors/3d/warped_mouse_panning", false))) {
relative = Input::get_singleton()->warp_mouse_motion(p_ev_mouse_motion, surface->get_global_rect());
} else {
relative = p_ev_mouse_motion->get_relative();
@@ -1672,7 +1668,7 @@ Point2i SpatialEditorViewport::_get_warped_mouse_motion(const Ref<InputEventMous
void SpatialEditorViewport::_update_freelook(real_t delta) {
if (!is_freelook_active()) {
- freelook_velocity = Vector3();
+ freelook_target_position = cursor.pos;
return;
}
@@ -1689,60 +1685,47 @@ void SpatialEditorViewport::_update_freelook(real_t delta) {
int key_speed_modifier = Object::cast_to<InputEventKey>(ED_GET_SHORTCUT("spatial_editor/freelook_speed_modifier")->get_shortcut().ptr())->get_scancode();
Vector3 direction;
- bool pressed = false;
bool speed_modifier = false;
const Input &input = *Input::get_singleton();
if (input.is_key_pressed(key_left)) {
direction -= right;
- pressed = true;
}
if (input.is_key_pressed(key_right)) {
direction += right;
- pressed = true;
}
if (input.is_key_pressed(key_forward)) {
direction += forward;
- pressed = true;
}
if (input.is_key_pressed(key_backwards)) {
direction -= forward;
- pressed = true;
}
if (input.is_key_pressed(key_up)) {
direction += up;
- pressed = true;
}
if (input.is_key_pressed(key_down)) {
direction -= up;
- pressed = true;
}
if (input.is_key_pressed(key_speed_modifier)) {
speed_modifier = true;
}
- const EditorSettings &s = *EditorSettings::get_singleton();
- real_t inertia = s.get("editors/3d/freelook_inertia");
- if (inertia < 0)
- inertia = 0;
-
- const real_t base_speed = s.get("editors/3d/freelook_base_speed");
- const real_t modifier_speed_factor = s.get("editors/3d/freelook_modifier_speed_factor");
+ real_t inertia = EDITOR_DEF("editors/3d/freelook_inertia", 0.2);
+ inertia = MAX(0, inertia);
+ const real_t base_speed = EDITOR_DEF("editors/3d/freelook_base_speed", 0.5);
+ const real_t modifier_speed_factor = EDITOR_DEF("editors/3d/freelook_modifier_speed_factor", 5);
real_t speed = base_speed * cursor.distance;
if (speed_modifier)
speed *= modifier_speed_factor;
- Vector3 instant_velocity = direction * speed;
-
// Higher inertia should increase "lag" (lerp with factor between 0 and 1)
- // Inertia of zero should produce instant movement (lerp with factor of 1)
- // Takes reference of 60fps for units, so that inertia of 1 gives approximate lerp factor of 0.5
- real_t factor = 1.0 / (1.0 + inertia * delta * 60.f);
- freelook_velocity = freelook_velocity.linear_interpolate(instant_velocity, CLAMP(factor, 0, 1));
+ // Inertia of zero should produce instant movement (lerp with factor of 1) in this case it returns a really high value and gets clamped to 1.
- cursor.pos += freelook_velocity * delta;
+ freelook_target_position += direction * speed;
+ real_t factor = (1.0 / (inertia + 0.001)) * delta;
+ cursor.pos = cursor.pos.linear_interpolate(freelook_target_position, CLAMP(factor, 0, 1));
}
void SpatialEditorViewport::set_message(String p_message, float p_time) {
@@ -2528,7 +2511,6 @@ Vector3 SpatialEditorViewport::_get_instance_position(const Point2 &p_pos) const
found_gizmos.insert(seg);
- int handle = -1;
Vector3 hit_point;
Vector3 hit_normal;
bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal, NULL, false);
@@ -3423,13 +3405,6 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
settings_znear->set_value(float(d["znear"]));
if (d.has("fov"))
settings_fov->set_value(float(d["fov"]));
-
- if (d.has("default_srgb")) {
- bool use = d["default_srgb"];
-
- //viewport_environment->set_enable_fx(Environment::FX_SRGB,use);
- //view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB), use );
- }
if (d.has("show_grid")) {
bool use = d["show_grid"];
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index db5abe2b53..5f3ef2dbee 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -131,7 +131,7 @@ private:
float gizmo_scale;
bool freelook_active;
- Vector3 freelook_velocity;
+ Vector3 freelook_target_position;
PanelContainer *info;
Label *info_label;
@@ -239,7 +239,7 @@ private:
distance = 4;
region_select = false;
}
- } cursor;
+ } cursor, camera_cursor;
void scale_cursor_distance(real_t scale);
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index f943ee5f6d..43856116a6 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -550,7 +550,6 @@ void TileMapEditor::_draw_fill_preview(int p_cell, const Point2i &p_point, bool
PoolVector<Vector2> points = _bucket_fill(p_point, false, true);
PoolVector<Vector2>::Read pr = points.read();
int len = points.size();
- int time_after = OS::get_singleton()->get_ticks_msec();
for (int i = 0; i < len; ++i) {
_draw_cell(p_cell, pr[i], p_flip_h, p_flip_v, p_transpose, p_xform);
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index d649afc594..7e81513a8b 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -425,9 +425,10 @@ void ProjectExportDialog::_delete_preset_confirm() {
int idx = presets->get_current();
parameters->edit(NULL); //to avoid crash
+ _edit_preset(-1);
EditorExport::get_singleton()->remove_export_preset(idx);
_update_presets();
- _edit_preset(-1);
+ _edit_preset(presets->get_current());
}
Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
@@ -732,6 +733,8 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
ERR_FAIL_COND(platform.is_null());
Error err = platform->export_project(current, export_debug->is_pressed(), p_path, 0);
+ if (err != OK)
+ ERR_PRINT("Failed to export project");
}
void ProjectExportDialog::_bind_methods() {
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 323a36154e..b36d4715c4 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -449,13 +449,15 @@ struct ProjectItem {
String conf;
uint64_t last_modified;
bool favorite;
+ bool grayed;
ProjectItem() {}
- ProjectItem(const String &p_project, const String &p_path, const String &p_conf, uint64_t p_last_modified, bool p_favorite = false) {
+ ProjectItem(const String &p_project, const String &p_path, const String &p_conf, uint64_t p_last_modified, bool p_favorite = false, bool p_grayed = false) {
project = p_project;
path = p_path;
conf = p_conf;
last_modified = p_last_modified;
favorite = p_favorite;
+ grayed = p_grayed;
}
_FORCE_INLINE_ bool operator<(const ProjectItem &l) const { return last_modified > l.last_modified; }
_FORCE_INLINE_ bool operator==(const ProjectItem &l) const { return project == l.project; }
@@ -465,7 +467,7 @@ void ProjectManager::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- Engine::get_singleton()->set_editor_hint(true);
+ Engine::get_singleton()->set_editor_hint(false);
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
@@ -737,6 +739,7 @@ void ProjectManager::_load_recent_projects() {
String project = _name.get_slice("/", 1);
String conf = path.plus_file("project.godot");
bool favorite = (_name.begins_with("favorite_projects/")) ? true : false;
+ bool grayed = false;
uint64_t last_modified = 0;
if (FileAccess::exists(conf)) {
@@ -748,16 +751,15 @@ void ProjectManager::_load_recent_projects() {
if (cache_modified > last_modified)
last_modified = cache_modified;
}
-
- ProjectItem item(project, path, conf, last_modified, favorite);
- if (favorite)
- favorite_projects.push_back(item);
- else
- projects.push_back(item);
} else {
- //project doesn't exist on disk but it's in the XML settings file
- EditorSettings::get_singleton()->erase(_name); //remove it
+ grayed = true;
}
+
+ ProjectItem item(project, path, conf, last_modified, favorite, grayed);
+ if (favorite)
+ favorite_projects.push_back(item);
+ else
+ projects.push_back(item);
}
projects.sort();
@@ -782,14 +784,14 @@ void ProjectManager::_load_recent_projects() {
String path = item.path;
String conf = item.conf;
bool is_favorite = item.favorite;
+ bool is_grayed = item.grayed;
Ref<ConfigFile> cf = memnew(ConfigFile);
- Error err = cf->load(conf);
- ERR_CONTINUE(err != OK);
+ Error cf_err = cf->load(conf);
String project_name = TTR("Unnamed Project");
- if (cf->has_section_key("application", "config/name")) {
+ if (cf_err == OK && cf->has_section_key("application", "config/name")) {
project_name = static_cast<String>(cf->get_value("application", "config/name")).xml_unescape();
}
@@ -797,7 +799,7 @@ void ProjectManager::_load_recent_projects() {
continue;
Ref<Texture> icon;
- if (cf->has_section_key("application", "config/icon")) {
+ if (cf_err == OK && cf->has_section_key("application", "config/icon")) {
String appicon = cf->get_value("application", "config/icon");
if (appicon != "") {
Ref<Image> img;
@@ -819,8 +821,10 @@ void ProjectManager::_load_recent_projects() {
}
String main_scene;
- if (cf->has_section_key("application", "run/main_scene")) {
+ if (cf_err == OK && cf->has_section_key("application", "run/main_scene")) {
main_scene = cf->get_value("application", "run/main_scene");
+ } else {
+ main_scene = "";
}
selected_list_copy.erase(project);
@@ -848,6 +852,8 @@ void ProjectManager::_load_recent_projects() {
hb->add_child(tf);
VBoxContainer *vb = memnew(VBoxContainer);
+ if (is_grayed)
+ vb->set_modulate(Color(0.5, 0.5, 0.5));
vb->set_name("project");
vb->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(vb);
@@ -926,6 +932,13 @@ void ProjectManager::_open_project_confirm() {
for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) {
const String &selected = E->key();
String path = EditorSettings::get_singleton()->get("projects/" + selected);
+ String conf = path + "/project.godot";
+ if (!FileAccess::exists(conf)) {
+ dialog_error->set_text(TTR("Can't open project"));
+ dialog_error->popup_centered_minsize();
+ return;
+ }
+
print_line("OPENING: " + path + " (" + selected + ")");
List<String> args;
@@ -1397,6 +1410,9 @@ ProjectManager::ProjectManager() {
run_error_diag = memnew(AcceptDialog);
gui_base->add_child(run_error_diag);
run_error_diag->set_title(TTR("Can't run project"));
+
+ dialog_error = memnew(AcceptDialog);
+ gui_base->add_child(dialog_error);
}
ProjectManager::~ProjectManager() {
diff --git a/editor/project_manager.h b/editor/project_manager.h
index ecc01955ba..9fcf10a0d9 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -58,6 +58,7 @@ class ProjectManager : public Control {
ConfirmationDialog *multi_run_ask;
ConfirmationDialog *multi_scan_ask;
AcceptDialog *run_error_diag;
+ AcceptDialog *dialog_error;
NewProjectDialog *npdialog;
ScrollContainer *scroll;
VBoxContainer *scroll_childs;
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index a42fb41ee2..c7a4e1fc3b 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -2275,19 +2275,6 @@ void PropertyEditor::_check_reload_status(const String &p_name, TreeItem *item)
}
}
- if (_might_be_in_instance()) {
-
- Variant vorig;
- Dictionary d = item->get_metadata(0);
- int usage = d.has("usage") ? int(int(d["usage"]) & (PROPERTY_USAGE_STORE_IF_NONONE | PROPERTY_USAGE_STORE_IF_NONZERO)) : 0;
-
- if (_get_instanced_node_original_property(p_name, vorig) || usage) {
- Variant v = obj->get(p_name);
-
- bool has_reload = _is_property_different(v, vorig, usage);
- }
- }
-
if (obj->call("property_can_revert", p_name).operator bool()) {
has_reload = true;
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 6bbb35ceab..86de7c56e1 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -75,6 +75,8 @@ void PropertySelector::_update_search() {
if (properties)
set_title(TTR("Select Property"));
+ else if (virtuals_only)
+ set_title(TTR("Select Virtual Method"));
else
set_title(TTR("Select Method"));
@@ -209,7 +211,7 @@ void PropertySelector::_update_search() {
StringName base = base_type;
while (base) {
methods.push_back(MethodInfo("*" + String(base)));
- ClassDB::get_method_list(base, &methods, true);
+ ClassDB::get_method_list(base, &methods, true, true);
base = ClassDB::get_parent_class(base);
}
}
@@ -230,11 +232,13 @@ void PropertySelector::_update_search() {
Ref<Texture> icon;
script_methods = false;
+ print_line("name: " + E->get().name);
+ String rep = E->get().name.replace("*", "");
if (E->get().name == "*Script Methods") {
icon = get_icon("Script", "EditorIcons");
script_methods = true;
- } else if (has_icon(E->get().name, "EditorIcons")) {
- icon = get_icon(E->get().name, "EditorIcons");
+ } else if (has_icon(rep, "EditorIcons")) {
+ icon = get_icon(rep, "EditorIcons");
} else {
icon = get_icon("Object", "EditorIcons");
}
@@ -247,6 +251,12 @@ void PropertySelector::_update_search() {
if (!script_methods && name.begins_with("_") && !(E->get().flags & METHOD_FLAG_VIRTUAL))
continue;
+ if (virtuals_only && !(E->get().flags & METHOD_FLAG_VIRTUAL))
+ continue;
+
+ if (!virtuals_only && (E->get().flags & METHOD_FLAG_VIRTUAL))
+ continue;
+
if (search_box->get_text() != String() && name.find(search_box->get_text()) == -1)
continue;
@@ -283,6 +293,12 @@ void PropertySelector::_update_search() {
desc += " )";
+ if (E->get().flags & METHOD_FLAG_CONST)
+ desc += " const";
+
+ if (E->get().flags & METHOD_FLAG_VIRTUAL)
+ desc += " virtual";
+
item->set_text(0, desc);
item->set_metadata(0, name);
item->set_selectable(0, true);
@@ -397,7 +413,7 @@ void PropertySelector::_notification(int p_what) {
}
}
-void PropertySelector::select_method_from_base_type(const String &p_base, const String &p_current) {
+void PropertySelector::select_method_from_base_type(const String &p_base, const String &p_current, bool p_virtuals_only) {
base_type = p_base;
selected = p_current;
@@ -405,6 +421,7 @@ void PropertySelector::select_method_from_base_type(const String &p_base, const
script = 0;
properties = false;
instance = NULL;
+ virtuals_only = p_virtuals_only;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -421,6 +438,7 @@ void PropertySelector::select_method_from_script(const Ref<Script> &p_script, co
script = p_script->get_instance_id();
properties = false;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -436,6 +454,7 @@ void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const
script = 0;
properties = false;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -456,6 +475,7 @@ void PropertySelector::select_method_from_instance(Object *p_instance, const Str
}
properties = false;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -471,6 +491,7 @@ void PropertySelector::select_property_from_base_type(const String &p_base, cons
script = 0;
properties = true;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -488,6 +509,7 @@ void PropertySelector::select_property_from_script(const Ref<Script> &p_script,
script = p_script->get_instance_id();
properties = true;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -503,6 +525,7 @@ void PropertySelector::select_property_from_basic_type(Variant::Type p_type, con
script = 0;
properties = true;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -518,6 +541,7 @@ void PropertySelector::select_property_from_instance(Object *p_instance, const S
script = 0;
properties = true;
instance = p_instance;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -554,6 +578,7 @@ PropertySelector::PropertySelector() {
search_options->connect("cell_selected", this, "_item_selected");
search_options->set_hide_root(true);
search_options->set_hide_folding(true);
+ virtuals_only = false;
help_bit = memnew(EditorHelpBit);
vbc->add_margin_child(TTR("Description:"), help_bit);
diff --git a/editor/property_selector.h b/editor/property_selector.h
index 3fa60771d7..eb745d776f 100644
--- a/editor/property_selector.h
+++ b/editor/property_selector.h
@@ -55,6 +55,7 @@ class PropertySelector : public ConfirmationDialog {
String base_type;
ObjectID script;
Object *instance;
+ bool virtuals_only;
void _item_selected();
@@ -63,7 +64,7 @@ protected:
static void _bind_methods();
public:
- void select_method_from_base_type(const String &p_base, const String &p_current = "");
+ void select_method_from_base_type(const String &p_base, const String &p_current = "", bool p_virtuals_only = false);
void select_method_from_script(const Ref<Script> &p_script, const String &p_current = "");
void select_method_from_basic_type(Variant::Type p_type, const String &p_current = "");
void select_method_from_instance(Object *p_instance, const String &p_current = "");
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index afdf48b314..5b783493cb 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -433,7 +433,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
dup->set_name(parent->validate_child_name(dup));
- editor_data->get_undo_redo().add_do_method(parent, "_add_child_below_node", node, dup);
+ editor_data->get_undo_redo().add_do_method(parent, "add_child_below_node", node, dup);
for (List<Node *>::Element *F = owned.front(); F; F = F->next()) {
if (!duplimap.has(F->get())) {
@@ -582,13 +582,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
new_scene_from_dialog->popup_centered_ratio();
new_scene_from_dialog->set_title(TTR("Save New Scene As.."));
-
} break;
case TOOL_COPY_NODE_PATH: {
List<Node *> selection = editor_selection->get_selected_node_list();
-
- if (List<Node *>::Element *e = selection.front()) {
- if (Node *node = e->get()) {
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
Node *root = EditorNode::get_singleton()->get_edited_scene();
NodePath path = root->get_path().rel_path_to(node->get_path());
OS::get_singleton()->set_clipboard(path);
@@ -597,8 +597,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_SCENE_EDITABLE_CHILDREN: {
List<Node *> selection = editor_selection->get_selected_node_list();
- if (List<Node *>::Element *e = selection.front()) {
- if (Node *node = e->get()) {
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(node);
int editable_item_idx = menu->get_item_idx_from_text(TTR("Editable Children"));
int placeholder_item_idx = menu->get_item_idx_from_text(TTR("Load As Placeholder"));
@@ -617,8 +619,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_SCENE_USE_PLACEHOLDER: {
List<Node *> selection = editor_selection->get_selected_node_list();
- if (List<Node *>::Element *e = selection.front()) {
- if (Node *node = e->get()) {
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
bool placeholder = node->get_scene_instance_load_placeholder();
placeholder = !placeholder;
int editable_item_idx = menu->get_item_idx_from_text(TTR("Editable Children"));
@@ -635,15 +639,16 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_SCENE_CLEAR_INSTANCING: {
List<Node *> selection = editor_selection->get_selected_node_list();
- if (List<Node *>::Element *e = selection.front()) {
- if (Node *node = e->get()) {
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
Node *root = EditorNode::get_singleton()->get_edited_scene();
UndoRedo *undo_redo = &editor_data->get_undo_redo();
if (!root)
break;
ERR_FAIL_COND(node->get_filename() == String());
-
undo_redo->create_action(TTR("Discard Instancing"));
undo_redo->add_do_method(node, "set_filename", "");
undo_redo->add_undo_method(node, "set_filename", node->get_filename());
@@ -656,8 +661,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_SCENE_OPEN: {
List<Node *> selection = editor_selection->get_selected_node_list();
- if (List<Node *>::Element *e = selection.front()) {
- if (Node *node = e->get()) {
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
scene_tree->emit_signal("open", node->get_filename());
}
}
@@ -667,8 +674,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM: {
List<Node *> selection = editor_selection->get_selected_node_list();
- if (List<Node *>::Element *e = selection.front()) {
- if (Node *node = e->get()) {
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
node->set_scene_inherited_state(Ref<SceneState>());
scene_tree->update_tree();
EditorNode::get_singleton()->get_property_editor()->update_tree();
@@ -677,8 +686,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_SCENE_OPEN_INHERITED: {
List<Node *> selection = editor_selection->get_selected_node_list();
- if (List<Node *>::Element *e = selection.front()) {
- if (Node *node = e->get()) {
+ List<Node *>::Element *e = selection.front();
+ if (e) {
+ Node *node = e->get();
+ if (node) {
if (node && node->get_scene_inherited_state().is_valid()) {
scene_tree->emit_signal("open", node->get_scene_inherited_state()->get_path());
}
@@ -823,7 +834,14 @@ Node *SceneTreeDock::_duplicate(Node *p_node, Map<Node *, Node *> &duplimap) {
if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
continue;
String name = E->get().name;
- node->set(name, p_node->get(name));
+ Variant value = p_node->get(name);
+ // Duplicate dictionaries and arrays, mainly needed for __meta__
+ if (value.get_type() == Variant::DICTIONARY) {
+ value = Dictionary(value).copy();
+ } else if (value.get_type() == Variant::ARRAY) {
+ value = Array(value).duplicate();
+ }
+ node->set(name, value);
}
List<Node::GroupInfo> group_info;