summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.h1
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.cpp1
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_server.cpp1
-rw-r--r--editor/debugger/editor_debugger_tree.cpp33
-rw-r--r--editor/debugger/editor_debugger_tree.h2
-rw-r--r--editor/debugger/script_editor_debugger.cpp1
-rw-r--r--editor/dependency_editor.cpp1
-rw-r--r--editor/editor_audio_buses.cpp1
-rw-r--r--editor/editor_command_palette.cpp1
-rw-r--r--editor/editor_help_search.cpp1
-rw-r--r--editor/editor_inspector.cpp179
-rw-r--r--editor/editor_inspector.h9
-rw-r--r--editor/editor_log.cpp2
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/editor_node.h3
-rw-r--r--editor/editor_plugin_settings.cpp1
-rw-r--r--editor/editor_plugin_settings.h4
-rw-r--r--editor/editor_properties.cpp6
-rw-r--r--editor/editor_properties.h1
-rw-r--r--editor/editor_resource_picker.cpp1
-rw-r--r--editor/editor_run_native.cpp1
-rw-r--r--editor/export/editor_export_platform.cpp1
-rw-r--r--editor/export/export_template_manager.cpp2
-rw-r--r--editor/import/scene_import_settings.cpp1
-rw-r--r--editor/import_defaults_editor.cpp1
-rw-r--r--editor/import_dock.cpp1
-rw-r--r--editor/inspector_dock.cpp10
-rw-r--r--editor/inspector_dock.h2
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp1
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.h2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp1
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.h2
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp1
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h1
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp1
-rw-r--r--editor/plugins/animation_state_machine_editor.h1
-rw-r--r--editor/plugins/animation_tree_editor_plugin.h1
-rw-r--r--editor/plugins/control_editor_plugin.cpp2
-rw-r--r--editor/plugins/curve_editor_plugin.cpp1
-rw-r--r--editor/plugins/debugger_editor_plugin.cpp1
-rw-r--r--editor/plugins/editor_resource_conversion_plugin.cpp64
-rw-r--r--editor/plugins/editor_resource_conversion_plugin.h54
-rw-r--r--editor/plugins/gradient_editor_plugin.cpp1
-rw-r--r--editor/plugins/material_editor_plugin.cpp1
-rw-r--r--editor/plugins/material_editor_plugin.h2
-rw-r--r--editor/plugins/path_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/script_editor_plugin.cpp19
-rw-r--r--editor/plugins/shader_editor_plugin.cpp1
-rw-r--r--editor/plugins/shader_file_editor_plugin.cpp1
-rw-r--r--editor/plugins/text_editor.cpp1
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp2
-rw-r--r--editor/plugins/theme_editor_plugin.cpp1
-rw-r--r--editor/plugins/theme_editor_preview.cpp1
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h1
-rw-r--r--editor/project_settings_editor.cpp21
-rw-r--r--editor/project_settings_editor.h2
-rw-r--r--editor/property_editor.cpp34
-rw-r--r--editor/property_editor.h16
-rw-r--r--editor/rename_dialog.cpp1
61 files changed, 403 insertions, 110 deletions
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 18ce2ded63..9e693eaffd 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -33,7 +33,6 @@
#include "editor/editor_data.h"
#include "editor/editor_spin_slider.h"
-#include "editor/property_editor.h"
#include "editor/property_selector.h"
#include "scene/gui/control.h"
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
index 92ea0f15e9..4c445eb766 100644
--- a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
@@ -37,6 +37,7 @@
#include "editor/doc_tools.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
DebugAdapterProtocol *DebugAdapterProtocol::singleton = nullptr;
diff --git a/editor/debugger/debug_adapter/debug_adapter_server.cpp b/editor/debugger/debug_adapter/debug_adapter_server.cpp
index e9fc7ec913..41e6b1f308 100644
--- a/editor/debugger/debug_adapter/debug_adapter_server.cpp
+++ b/editor/debugger/debug_adapter/debug_adapter_server.cpp
@@ -33,6 +33,7 @@
#include "core/os/os.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
DebugAdapterServer::DebugAdapterServer() {
_EDITOR_DEF("network/debug_adapter/remote_port", remote_port);
diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp
index bdab1cfecb..dbd2c61d44 100644
--- a/editor/debugger/editor_debugger_tree.cpp
+++ b/editor/debugger/editor_debugger_tree.cpp
@@ -225,6 +225,39 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int
updating_scene_tree = false;
}
+Variant EditorDebuggerTree::get_drag_data(const Point2 &p_point) {
+ if (get_button_id_at_position(p_point) != -1) {
+ return Variant();
+ }
+
+ TreeItem *selected = get_selected();
+ if (!selected) {
+ return Variant();
+ }
+
+ String path = selected->get_text(0);
+
+ HBoxContainer *hb = memnew(HBoxContainer);
+ TextureRect *tf = memnew(TextureRect);
+ tf->set_texture(selected->get_icon(0));
+ tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
+ hb->add_child(tf);
+ Label *label = memnew(Label(path));
+ hb->add_child(label);
+ set_drag_preview(hb);
+
+ if (!selected->get_parent() || !selected->get_parent()->get_parent()) {
+ path = ".";
+ } else {
+ while (selected->get_parent()->get_parent() != get_root()) {
+ selected = selected->get_parent();
+ path = selected->get_text(0) + "/" + path;
+ }
+ }
+
+ return vformat("\"%s\"", path);
+}
+
String EditorDebuggerTree::get_selected_path() {
if (!get_selected()) {
return "";
diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h
index 9d163fd548..5b2df8abd5 100644
--- a/editor/debugger/editor_debugger_tree.h
+++ b/editor/debugger/editor_debugger_tree.h
@@ -65,6 +65,8 @@ protected:
void _notification(int p_what);
public:
+ virtual Variant get_drag_data(const Point2 &p_point) override;
+
String get_selected_path();
ObjectID get_selected_object();
int get_current_debugger(); // Would love to have one tree for every debugger.
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 41095a7267..ac2e958c5b 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -50,7 +50,6 @@
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/editor_debugger_plugin.h"
#include "editor/plugins/node_3d_editor_plugin.h"
-#include "editor/property_editor.h"
#include "main/performance.h"
#include "scene/3d/camera_3d.h"
#include "scene/debugger/scene_debugger.h"
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 4f89e1b2d1..5b4da0e32b 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -37,6 +37,7 @@
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/gui/margin_container.h"
void DependencyEditor::_searched(const String &p_path) {
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 556a0176cb..b6d7bbc45f 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -37,6 +37,7 @@
#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "filesystem_dock.h"
#include "scene/resources/font.h"
#include "servers/audio_server.h"
diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp
index 174a97d471..ba1f2fd6af 100644
--- a/editor/editor_command_palette.cpp
+++ b/editor/editor_command_palette.cpp
@@ -32,6 +32,7 @@
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/gui/control.h"
#include "scene/gui/tree.h"
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 424195e4dd..297d1226e3 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -34,6 +34,7 @@
#include "editor/editor_feature_profile.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
void EditorHelpSearch::_update_icons() {
search_box->set_right_icon(results_tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 57acc0b2c5..e06e3cbc5f 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -471,6 +471,9 @@ void EditorProperty::update_revert_and_pin_status() {
bool new_can_revert = EditorPropertyRevert::can_property_revert(object, property, &current) && !is_read_only();
if (new_can_revert != can_revert || new_pinned != pinned) {
+ if (new_can_revert != can_revert) {
+ emit_signal(SNAME("property_can_revert_changed"), property, new_can_revert);
+ }
can_revert = new_can_revert;
pinned = new_pinned;
update();
@@ -784,6 +787,9 @@ void EditorProperty::expand_all_folding() {
void EditorProperty::collapse_all_folding() {
}
+void EditorProperty::expand_revertable() {
+}
+
void EditorProperty::set_selectable(bool p_selectable) {
selectable = p_selectable;
}
@@ -966,6 +972,7 @@ void EditorProperty::_bind_methods() {
ADD_SIGNAL(MethodInfo("property_keyed_with_value", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
ADD_SIGNAL(MethodInfo("property_checked", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::BOOL, "checked")));
ADD_SIGNAL(MethodInfo("property_pinned", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::BOOL, "pinned")));
+ ADD_SIGNAL(MethodInfo("property_can_revert_changed", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::BOOL, "can_revert")));
ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "focusable_idx")));
@@ -1225,12 +1232,15 @@ void EditorInspectorSection::_notification(int p_what) {
// Get the section header font.
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
+ Color font_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
// Get the right direction arrow texture, if the section is foldable.
Ref<Texture2D> arrow;
+ bool folded = foldable;
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
arrow = get_theme_icon(SNAME("arrow"), SNAME("Tree"));
+ folded = false;
} else {
if (is_layout_rtl()) {
arrow = get_theme_icon(SNAME("arrow_collapsed_mirrored"), SNAME("Tree"));
@@ -1274,28 +1284,71 @@ void EditorInspectorSection::_notification(int p_what) {
}
draw_rect(header_rect, c);
- // Draw header title and folding arrow.
- const int arrow_margin = 2;
- const int arrow_width = arrow.is_valid() ? arrow->get_width() : 0;
- Color color = get_theme_color(SNAME("font_color"));
- float text_width = get_size().width - Math::round(arrow_width + arrow_margin * EDSCALE) - section_indent;
- Point2 text_offset = Point2(0, font->get_ascent(font_size) + (header_height - font->get_height(font_size)) / 2);
- HorizontalAlignment text_align = HORIZONTAL_ALIGNMENT_LEFT;
- if (rtl) {
- text_align = HORIZONTAL_ALIGNMENT_RIGHT;
- } else {
- text_offset.x = section_indent + Math::round(arrow_width + arrow_margin * EDSCALE);
- }
- draw_string(font, text_offset.floor(), label, text_align, text_width, font_size, color);
+ // Draw header title, folding arrow and coutn of revertable properties.
+ {
+ int separation = Math::round(2 * EDSCALE);
- if (arrow.is_valid()) {
- Point2 arrow_position = Point2(0, (header_height - arrow->get_height()) / 2);
+ int margin_start = section_indent + separation;
+ int margin_end = separation;
+
+ // - Arrow.
+ if (arrow.is_valid()) {
+ Point2 arrow_position;
+ if (rtl) {
+ arrow_position.x = get_size().width - (margin_start + arrow->get_width());
+ } else {
+ arrow_position.x = margin_start;
+ }
+ arrow_position.y = (header_height - arrow->get_height()) / 2;
+ draw_texture(arrow, arrow_position);
+ margin_start += arrow->get_width();
+ }
+
+ int available = get_size().width - (margin_start + margin_end);
+
+ // - Count of revertable properties.
+ String num_revertable_str;
+ int num_revertable_width = 0;
+ if (folded && revertable_properties.size()) {
+ int label_width = font->get_string_size(label, HORIZONTAL_ALIGNMENT_LEFT, available, font_size, TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_CONSTRAIN_ELLIPSIS).x;
+
+ Ref<Font> light_font = get_theme_font(SNAME("main"), SNAME("EditorFonts"));
+ int light_font_size = get_theme_font_size(SNAME("main_size"), SNAME("EditorFonts"));
+ Color light_font_color = get_theme_color(SNAME("disabled_font_color"), SNAME("Editor"));
+
+ // Can we fit the long version of the revertable count text?
+ if (revertable_properties.size() == 1) {
+ num_revertable_str = "(1 change)";
+ } else {
+ num_revertable_str = vformat("(%d changes)", revertable_properties.size());
+ }
+ num_revertable_width = light_font->get_string_size(num_revertable_str, HORIZONTAL_ALIGNMENT_LEFT, -1.0f, light_font_size, TextServer::JUSTIFICATION_NONE).x;
+ if (label_width + separation + num_revertable_width > available) {
+ // We'll have to use the short version.
+ num_revertable_str = vformat("(%d)", revertable_properties.size());
+ num_revertable_width = light_font->get_string_size(num_revertable_str, HORIZONTAL_ALIGNMENT_LEFT, -1.0f, light_font_size, TextServer::JUSTIFICATION_NONE).x;
+ }
+
+ Point2 text_offset = Point2(
+ margin_end,
+ light_font->get_ascent(light_font_size) + (header_height - light_font->get_height(light_font_size)) / 2);
+ if (!rtl) {
+ text_offset.x = get_size().width - (text_offset.x + num_revertable_width);
+ }
+ draw_string(light_font, text_offset, num_revertable_str, HORIZONTAL_ALIGNMENT_LEFT, -1.0f, light_font_size, light_font_color, TextServer::JUSTIFICATION_NONE);
+ margin_end += num_revertable_width + separation;
+ available -= num_revertable_width + separation;
+ }
+
+ // - Label.
+ Point2 text_offset = Point2(
+ margin_start,
+ font->get_ascent(font_size) + (header_height - font->get_height(font_size)) / 2);
if (rtl) {
- arrow_position.x = get_size().width - section_indent - arrow->get_width() - Math::round(arrow_margin * EDSCALE);
- } else {
- arrow_position.x = section_indent + Math::round(arrow_margin * EDSCALE);
+ text_offset.x = margin_end;
}
- draw_texture(arrow, arrow_position.floor());
+ HorizontalAlignment text_align = rtl ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT;
+ draw_string(font, text_offset, label, text_align, available, font_size, font_color, TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_CONSTRAIN_ELLIPSIS);
}
// Draw dropping highlight.
@@ -1471,6 +1524,22 @@ void EditorInspectorSection::fold() {
update();
}
+bool EditorInspectorSection::has_revertable_properties() const {
+ return !revertable_properties.is_empty();
+}
+
+void EditorInspectorSection::property_can_revert_changed(const String &p_path, bool p_can_revert) {
+ bool had_revertable_properties = has_revertable_properties();
+ if (p_can_revert) {
+ revertable_properties.insert(p_path);
+ } else {
+ revertable_properties.erase(p_path);
+ }
+ if (has_revertable_properties() != had_revertable_properties) {
+ update();
+ }
+}
+
void EditorInspectorSection::_bind_methods() {
ClassDB::bind_method(D_METHOD("setup", "section", "label", "object", "bg_color", "foldable"), &EditorInspectorSection::setup);
ClassDB::bind_method(D_METHOD("get_vbox"), &EditorInspectorSection::get_vbox);
@@ -2330,7 +2399,7 @@ String EditorInspector::get_selected_path() const {
return property_selected;
}
-void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped) {
+void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, EditorInspectorSection *p_section, Ref<EditorInspectorPlugin> ped) {
for (const EditorInspectorPlugin::AddedEditor &F : ped->added_editors) {
EditorProperty *ep = Object::cast_to<EditorProperty>(F.property_editor);
current_vbox->add_child(F.property_editor);
@@ -2370,6 +2439,10 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<Edit
}
}
+ if (p_section) {
+ ep->connect("property_can_revert_changed", callable_mp(p_section, &EditorInspectorSection::property_can_revert_changed));
+ }
+
ep->set_read_only(read_only);
ep->update_property();
ep->_update_pin_flags();
@@ -2476,9 +2549,11 @@ void EditorInspector::update_tree() {
// Get the lists of editors to add the beginning.
for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
ped->parse_begin(object);
- _parse_added_editors(main_vbox, ped);
+ _parse_added_editors(main_vbox, nullptr, ped);
}
+ StringName type_name;
+
// Get the lists of editors for properties.
for (List<PropertyInfo>::Element *E_property = plist.front(); E_property; E_property = E_property->next()) {
PropertyInfo &p = E_property->get();
@@ -2549,6 +2624,7 @@ void EditorInspector::update_tree() {
category_vbox = nullptr; //reset
String type = p.name;
+ type_name = p.name;
// Set the category icon.
if (!ClassDB::class_exists(type) && !ScriptServer::is_global_class(type) && p.hint_string.length() && FileAccess::exists(p.hint_string)) {
@@ -2582,24 +2658,23 @@ void EditorInspector::update_tree() {
if (use_doc_hints) {
// Sets the category tooltip to show documentation.
- StringName type2 = p.name;
- if (!class_descr_cache.has(type2)) {
+ if (!class_descr_cache.has(type_name)) {
String descr;
DocTools *dd = EditorHelp::get_doc_data();
- HashMap<String, DocData::ClassDoc>::Iterator E = dd->class_list.find(type2);
+ HashMap<String, DocData::ClassDoc>::Iterator E = dd->class_list.find(type_name);
if (E) {
descr = DTR(E->value.brief_description);
}
- class_descr_cache[type2] = descr;
+ class_descr_cache[type_name] = descr;
}
- category->set_tooltip(p.name + "::" + (class_descr_cache[type2].is_empty() ? "" : class_descr_cache[type2]));
+ category->set_tooltip(p.name + "::" + (class_descr_cache[type_name].is_empty() ? "" : class_descr_cache[type_name]));
}
// Add editors at the start of a category.
for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
ped->parse_category(object, p.name);
- _parse_added_editors(main_vbox, ped);
+ _parse_added_editors(main_vbox, nullptr, ped);
}
continue;
@@ -2791,7 +2866,7 @@ void EditorInspector::update_tree() {
// Add editors at the start of a group.
for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
ped->parse_group(object, path);
- _parse_added_editors(section->get_vbox(), ped);
+ _parse_added_editors(section->get_vbox(), section, ped);
}
vbox_per_path[root_vbox][acc_path] = section->get_vbox();
@@ -2864,7 +2939,7 @@ void EditorInspector::update_tree() {
// Build the doc hint, to use as tooltip.
// Get the class name.
- StringName classname = object->get_class_name();
+ StringName classname = type_name == "" ? object->get_class_name() : type_name;
if (!object_class.is_empty()) {
classname = object_class;
}
@@ -2973,6 +3048,12 @@ void EditorInspector::update_tree() {
editor_property_map[prop].push_back(ep);
}
}
+
+ EditorInspectorSection *section = Object::cast_to<EditorInspectorSection>(current_vbox->get_parent());
+ if (section) {
+ ep->connect("property_can_revert_changed", callable_mp(section, &EditorInspectorSection::property_can_revert_changed));
+ }
+
ep->set_draw_warning(draw_warning);
ep->set_use_folding(use_folding);
ep->set_checkable(checkable);
@@ -3025,7 +3106,7 @@ void EditorInspector::update_tree() {
// Get the lists of to add at the end.
for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
ped->parse_end(object);
- _parse_added_editors(main_vbox, ped);
+ _parse_added_editors(main_vbox, nullptr, ped);
}
}
@@ -3178,6 +3259,44 @@ void EditorInspector::expand_all_folding() {
}
}
+void EditorInspector::expand_revertable() {
+ HashSet<EditorInspectorSection *> sections_to_unfold[2];
+ for (EditorInspectorSection *E : sections) {
+ if (E->has_revertable_properties()) {
+ sections_to_unfold[0].insert(E);
+ }
+ }
+
+ // Climb up the hierachy doing double buffering with the sets.
+ int a = 0;
+ int b = 1;
+ while (sections_to_unfold[a].size()) {
+ for (EditorInspectorSection *E : sections_to_unfold[a]) {
+ E->unfold();
+
+ Node *n = E->get_parent();
+ while (n) {
+ if (Object::cast_to<EditorInspector>(n)) {
+ break;
+ }
+ if (Object::cast_to<EditorInspectorSection>(n) && !sections_to_unfold[a].has((EditorInspectorSection *)n)) {
+ sections_to_unfold[b].insert((EditorInspectorSection *)n);
+ }
+ n = n->get_parent();
+ }
+ }
+
+ sections_to_unfold[a].clear();
+ SWAP(a, b);
+ }
+
+ for (const KeyValue<StringName, List<EditorProperty *>> &F : editor_property_map) {
+ for (EditorProperty *E : F.value) {
+ E->expand_revertable();
+ }
+ }
+}
+
void EditorInspector::set_scroll_offset(int p_offset) {
set_v_scroll(p_offset);
}
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 4ec3513da5..54533de960 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -184,6 +184,7 @@ public:
virtual void expand_all_folding();
virtual void collapse_all_folding();
+ virtual void expand_revertable();
virtual Variant get_drag_data(const Point2 &p_point) override;
virtual void update_cache();
@@ -281,6 +282,8 @@ class EditorInspectorSection : public Container {
Timer *dropping_unfold_timer = nullptr;
bool dropping = false;
+ HashSet<StringName> revertable_properties;
+
void _test_unfold();
protected:
@@ -299,6 +302,9 @@ public:
void unfold();
void fold();
+ bool has_revertable_properties() const;
+ void property_can_revert_changed(const String &p_path, bool p_can_revert);
+
EditorInspectorSection();
~EditorInspectorSection();
};
@@ -517,7 +523,7 @@ class EditorInspector : public ScrollContainer {
void _edit_request_change(Object *p_object, const String &p_prop);
void _filter_changed(const String &p_text);
- void _parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped);
+ void _parse_added_editors(VBoxContainer *current_vbox, EditorInspectorSection *p_section, Ref<EditorInspectorPlugin> ped);
void _vscroll_changed(double);
@@ -579,6 +585,7 @@ public:
void collapse_all_folding();
void expand_all_folding();
+ void expand_revertable();
void set_scroll_offset(int p_offset);
int get_scroll_offset() const;
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 012666d625..38cc85bb4e 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -35,7 +35,9 @@
#include "editor/editor_node.h"
#include "editor/editor_paths.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/gui/center_container.h"
+#include "scene/gui/separator.h"
#include "scene/resources/font.h"
void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type) {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 8b540f9787..e9aceb684f 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -49,6 +49,7 @@
#include "main/main.h"
#include "scene/3d/importer_mesh_instance_3d.h"
#include "scene/gui/center_container.h"
+#include "scene/gui/color_picker.h"
#include "scene/gui/control.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/file_dialog.h"
@@ -149,6 +150,7 @@
#include "editor/plugins/debugger_editor_plugin.h"
#include "editor/plugins/editor_debugger_plugin.h"
#include "editor/plugins/editor_preview_plugins.h"
+#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "editor/plugins/font_config_plugin.h"
#include "editor/plugins/gdextension_export_plugin.h"
#include "editor/plugins/gpu_particles_2d_editor_plugin.h"
diff --git a/editor/editor_node.h b/editor/editor_node.h
index c521c0fb04..0201e84eaf 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -37,7 +37,6 @@
#include "editor/editor_run.h"
#include "editor/export/editor_export.h"
#include "editor/inspector_dock.h"
-#include "editor/property_editor.h"
typedef void (*EditorNodeInitCallback)();
typedef void (*EditorPluginInitializeCallback)();
@@ -48,6 +47,7 @@ class AudioStreamPreviewGenerator;
class BackgroundProgress;
class Button;
class CenterContainer;
+class ColorPicker;
class ConfirmationDialog;
class Control;
class DependencyEditor;
@@ -67,6 +67,7 @@ class EditorPlugin;
class EditorPluginList;
class EditorQuickOpen;
class EditorResourcePreview;
+class EditorResourceConversionPlugin;
class EditorRun;
class EditorRunNative;
class EditorSettingsDialog;
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index 3a0b875b8c..5a010a66c1 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -37,6 +37,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/gui/margin_container.h"
+#include "scene/gui/tree.h"
void EditorPluginSettings::_notification(int p_what) {
switch (p_what) {
diff --git a/editor/editor_plugin_settings.h b/editor/editor_plugin_settings.h
index 7c6d93e6f4..9c619066f2 100644
--- a/editor/editor_plugin_settings.h
+++ b/editor/editor_plugin_settings.h
@@ -34,8 +34,8 @@
#include "core/object/undo_redo.h"
#include "editor/editor_data.h"
#include "editor/plugin_config_dialog.h"
-#include "property_editor.h"
-#include "scene/gui/dialogs.h"
+
+class Tree;
class EditorPluginSettings : public VBoxContainer {
GDCLASS(EditorPluginSettings, VBoxContainer);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 919443eeb8..09c55d5d24 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -3918,6 +3918,12 @@ void EditorPropertyResource::expand_all_folding() {
}
}
+void EditorPropertyResource::expand_revertable() {
+ if (sub_inspector) {
+ sub_inspector->expand_revertable();
+ }
+}
+
void EditorPropertyResource::set_use_sub_inspector(bool p_enable) {
use_sub_inspector = p_enable;
}
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index b3aac6e8ca..cfe0c2f38c 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -856,6 +856,7 @@ public:
void collapse_all_folding() override;
void expand_all_folding() override;
+ void expand_revertable() override;
void set_use_sub_inspector(bool p_enable);
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 60c091a4b0..d850773a6d 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -38,6 +38,7 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/filesystem_dock.h"
+#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/scene_tree_dock.h"
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp
index ec5edab860..d8b738be17 100644
--- a/editor/editor_run_native.cpp
+++ b/editor/editor_run_native.cpp
@@ -32,6 +32,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "editor/export/editor_export_platform.h"
void EditorRunNative::_notification(int p_what) {
diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp
index 57ae83aeee..34b407779e 100644
--- a/editor/export/editor_export_platform.cpp
+++ b/editor/export/editor_export_platform.cpp
@@ -41,6 +41,7 @@
#include "editor/editor_node.h"
#include "editor/editor_paths.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor_export_plugin.h"
diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp
index 7d20081217..a7d9d7f068 100644
--- a/editor/export/export_template_manager.cpp
+++ b/editor/export/export_template_manager.cpp
@@ -37,8 +37,10 @@
#include "editor/editor_node.h"
#include "editor/editor_paths.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "editor/progress_dialog.h"
#include "scene/gui/file_dialog.h"
+#include "scene/gui/separator.h"
#include "scene/gui/tree.h"
#include "scene/main/http_request.h"
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index 410f01a9c6..6c12464b5a 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -35,6 +35,7 @@
#include "editor/editor_inspector.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/3d/importer_mesh_instance_3d.h"
#include "scene/animation/animation_player.h"
#include "scene/resources/importer_mesh.h"
diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp
index 9d96822aef..a70f5225e9 100644
--- a/editor/import_defaults_editor.cpp
+++ b/editor/import_defaults_editor.cpp
@@ -36,6 +36,7 @@
#include "editor/editor_autoload_settings.h"
#include "editor/editor_plugin_settings.h"
#include "editor/editor_sectioned_inspector.h"
+#include "editor/editor_settings.h"
#include "editor/localization_editor.h"
#include "editor/shader_globals_editor.h"
#include "scene/gui/center_container.h"
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index f9e5885f9d..087ef48b56 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -34,6 +34,7 @@
#include "editor/editor_node.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
class ImportDockParameters : public Object {
GDCLASS(ImportDockParameters, Object);
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index e0dd5610ee..79d94246ad 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -33,6 +33,7 @@
#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "editor/plugins/script_editor_plugin.h"
InspectorDock *InspectorDock::singleton = nullptr;
@@ -64,6 +65,9 @@ void InspectorDock::_menu_option_confirm(int p_option, bool p_confirmed) {
case COLLAPSE_ALL: {
_menu_collapseall();
} break;
+ case EXPAND_REVERTABLE: {
+ _menu_expand_revertable();
+ } break;
case RESOURCE_SAVE: {
_save_resource(false);
@@ -400,6 +404,10 @@ void InspectorDock::_menu_expandall() {
inspector->expand_all_folding();
}
+void InspectorDock::_menu_expand_revertable() {
+ inspector->expand_revertable();
+}
+
void InspectorDock::_warning_pressed() {
warning_dialog->popup_centered();
}
@@ -518,6 +526,8 @@ void InspectorDock::update(Object *p_object) {
p->clear();
p->add_icon_shortcut(get_theme_icon(SNAME("GuiTreeArrowDown"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/expand_all", TTR("Expand All")), EXPAND_ALL);
p->add_icon_shortcut(get_theme_icon(SNAME("GuiTreeArrowRight"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse All")), COLLAPSE_ALL);
+ // Calling it 'revertable' internally, because that's what the implementation is based on, but labeling it as 'non-default' because that's more user friendly, even if not 100% accurate.
+ p->add_shortcut(ED_SHORTCUT("property_editor/expand_revertable", TTR("Expand Non-Default")), EXPAND_REVERTABLE);
p->add_separator(TTR("Property Name Style"));
p->add_radio_check_item(TTR("Raw"), PROPERTY_NAME_STYLE_RAW);
diff --git a/editor/inspector_dock.h b/editor/inspector_dock.h
index e3d35c2157..e32410151f 100644
--- a/editor/inspector_dock.h
+++ b/editor/inspector_dock.h
@@ -61,6 +61,7 @@ class InspectorDock : public VBoxContainer {
COLLAPSE_ALL,
EXPAND_ALL,
+ EXPAND_REVERTABLE,
// Matches `EditorPropertyNameProcessor::Style`.
PROPERTY_NAME_STYLE_RAW,
@@ -124,6 +125,7 @@ class InspectorDock : public VBoxContainer {
void _edit_back();
void _menu_collapseall();
void _menu_expandall();
+ void _menu_expand_revertable();
void _select_history(int p_idx);
void _prepare_history();
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 9d80e7a193..cb77cd78bf 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -35,6 +35,8 @@
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
+#include "scene/gui/separator.h"
bool AbstractPolygon2DEditor::Vertex::operator==(const AbstractPolygon2DEditor::Vertex &p_vertex) const {
return polygon == p_vertex.polygon && vertex == p_vertex.vertex;
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 7481882cbe..32d97c65a9 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -34,6 +34,7 @@
#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/animation/animation_blend_tree.h"
StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const {
diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h
index 3488b4bf30..9b06f3248f 100644
--- a/editor/plugins/animation_blend_space_1d_editor.h
+++ b/editor/plugins/animation_blend_space_1d_editor.h
@@ -33,11 +33,11 @@
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
-#include "editor/property_editor.h"
#include "scene/animation/animation_blend_space_1d.h"
#include "scene/gui/button.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"
+#include "scene/gui/separator.h"
#include "scene/gui/tree.h"
class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 14d009f03b..dc764725dd 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -38,6 +38,7 @@
#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h
index 88b9072599..26471df051 100644
--- a/editor/plugins/animation_blend_space_2d_editor.h
+++ b/editor/plugins/animation_blend_space_2d_editor.h
@@ -33,11 +33,11 @@
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
-#include "editor/property_editor.h"
#include "scene/animation/animation_blend_space_2d.h"
#include "scene/gui/button.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"
+#include "scene/gui/separator.h"
#include "scene/gui/tree.h"
class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin {
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 561651e5f5..79be2d04b3 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -38,6 +38,7 @@
#include "editor/editor_inspector.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index b5bf91a1da..18199676b8 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -33,7 +33,6 @@
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
-#include "editor/property_editor.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/gui/button.h"
#include "scene/gui/graph_edit.h"
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index fe5a772b0d..473450b292 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -38,6 +38,7 @@
#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h
index ea16abd64c..165940e639 100644
--- a/editor/plugins/animation_state_machine_editor.h
+++ b/editor/plugins/animation_state_machine_editor.h
@@ -33,7 +33,6 @@
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
-#include "editor/property_editor.h"
#include "scene/animation/animation_node_state_machine.h"
#include "scene/gui/button.h"
#include "scene/gui/graph_edit.h"
diff --git a/editor/plugins/animation_tree_editor_plugin.h b/editor/plugins/animation_tree_editor_plugin.h
index ab4ef5a001..a33d97f62f 100644
--- a/editor/plugins/animation_tree_editor_plugin.h
+++ b/editor/plugins/animation_tree_editor_plugin.h
@@ -32,7 +32,6 @@
#define ANIMATION_TREE_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
-#include "editor/property_editor.h"
#include "scene/animation/animation_tree.h"
#include "scene/gui/button.h"
#include "scene/gui/graph_edit.h"
diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp
index ec038174fc..2756e45cf4 100644
--- a/editor/plugins/control_editor_plugin.cpp
+++ b/editor/plugins/control_editor_plugin.cpp
@@ -31,7 +31,9 @@
#include "control_editor_plugin.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
+#include "scene/gui/separator.h"
void ControlPositioningWarning::_update_warning() {
if (!control_node) {
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 2954071054..8aeab684e3 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -36,6 +36,7 @@
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
CurveEditor::CurveEditor() {
_selected_point = -1;
diff --git a/editor/plugins/debugger_editor_plugin.cpp b/editor/plugins/debugger_editor_plugin.cpp
index 5c90d70982..c572b5b7fe 100644
--- a/editor/plugins/debugger_editor_plugin.cpp
+++ b/editor/plugins/debugger_editor_plugin.cpp
@@ -35,6 +35,7 @@
#include "editor/debugger/editor_debugger_server.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "editor/fileserver/editor_file_server.h"
#include "editor/plugins/script_editor_plugin.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/plugins/editor_resource_conversion_plugin.cpp b/editor/plugins/editor_resource_conversion_plugin.cpp
new file mode 100644
index 0000000000..91394dbac7
--- /dev/null
+++ b/editor/plugins/editor_resource_conversion_plugin.cpp
@@ -0,0 +1,64 @@
+/*************************************************************************/
+/* editor_resource_conversion_plugin.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "editor_resource_conversion_plugin.h"
+
+void EditorResourceConversionPlugin::_bind_methods() {
+ GDVIRTUAL_BIND(_converts_to);
+ GDVIRTUAL_BIND(_handles, "resource");
+ GDVIRTUAL_BIND(_convert, "resource");
+}
+
+String EditorResourceConversionPlugin::converts_to() const {
+ String ret;
+ if (GDVIRTUAL_CALL(_converts_to, ret)) {
+ return ret;
+ }
+
+ return "";
+}
+
+bool EditorResourceConversionPlugin::handles(const Ref<Resource> &p_resource) const {
+ bool ret;
+ if (GDVIRTUAL_CALL(_handles, p_resource, ret)) {
+ return ret;
+ }
+
+ return false;
+}
+
+Ref<Resource> EditorResourceConversionPlugin::convert(const Ref<Resource> &p_resource) const {
+ Ref<Resource> ret;
+ if (GDVIRTUAL_CALL(_convert, p_resource, ret)) {
+ return ret;
+ }
+
+ return Ref<Resource>();
+}
diff --git a/editor/plugins/editor_resource_conversion_plugin.h b/editor/plugins/editor_resource_conversion_plugin.h
new file mode 100644
index 0000000000..34b0837383
--- /dev/null
+++ b/editor/plugins/editor_resource_conversion_plugin.h
@@ -0,0 +1,54 @@
+/*************************************************************************/
+/* editor_resource_conversion_plugin.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef EDITOR_RESOURCE_CONVERSION_PLUGIN_H
+#define EDITOR_RESOURCE_CONVERSION_PLUGIN_H
+
+#include "core/io/resource.h"
+#include "core/object/gdvirtual.gen.inc"
+#include "core/object/script_language.h"
+
+class EditorResourceConversionPlugin : public RefCounted {
+ GDCLASS(EditorResourceConversionPlugin, RefCounted);
+
+protected:
+ static void _bind_methods();
+
+ GDVIRTUAL0RC(String, _converts_to)
+ GDVIRTUAL1RC(bool, _handles, Ref<Resource>)
+ GDVIRTUAL1RC(Ref<Resource>, _convert, Ref<Resource>)
+
+public:
+ virtual String converts_to() const;
+ virtual bool handles(const Ref<Resource> &p_resource) const;
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
+};
+
+#endif // EDITOR_RESOURCE_CONVERSION_PLUGIN_H
diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp
index 4cdca95fca..542aee879b 100644
--- a/editor/plugins/gradient_editor_plugin.cpp
+++ b/editor/plugins/gradient_editor_plugin.cpp
@@ -33,6 +33,7 @@
#include "canvas_item_editor_plugin.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "node_3d_editor_plugin.h"
Size2 GradientEditor::get_minimum_size() const {
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index 4f8f6568d1..00fc8cc7d6 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -32,6 +32,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/gui/subviewport_container.h"
#include "scene/resources/fog_material.h"
#include "scene/resources/particles_material.h"
diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h
index 9c6247d59b..fc3da5fd9f 100644
--- a/editor/plugins/material_editor_plugin.h
+++ b/editor/plugins/material_editor_plugin.h
@@ -32,7 +32,7 @@
#define MATERIAL_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
-#include "editor/property_editor.h"
+#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/mesh_instance_3d.h"
diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp
index 2605a60d48..65b15a6001 100644
--- a/editor/plugins/path_3d_editor_plugin.cpp
+++ b/editor/plugins/path_3d_editor_plugin.cpp
@@ -34,6 +34,7 @@
#include "core/math/geometry_3d.h"
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
#include "node_3d_editor_plugin.h"
#include "scene/resources/curve.h"
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index e2f5d459e0..bbf5ffa462 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -591,7 +591,7 @@ void ScriptEditor::_go_to_tab(int p_idx) {
}
}
- Control *c = Object::cast_to<Control>(tab_container->get_tab_control(p_idx));
+ Control *c = tab_container->get_tab_control(p_idx);
if (!c) {
return;
}
@@ -813,7 +813,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
if (history_pos >= 0) {
idx = tab_container->get_tab_idx_from_control(history[history_pos].control);
}
- tab_container->set_current_tab(idx);
+ _go_to_tab(idx);
} else {
_update_selected_editor_menu();
}
@@ -1448,20 +1448,20 @@ void ScriptEditor::_menu_option(int p_option) {
case WINDOW_MOVE_UP: {
if (tab_container->get_current_tab() > 0) {
tab_container->move_child(current, tab_container->get_current_tab() - 1);
- tab_container->set_current_tab(tab_container->get_current_tab() - 1);
+ tab_container->set_current_tab(tab_container->get_current_tab());
_update_script_names();
}
} break;
case WINDOW_MOVE_DOWN: {
if (tab_container->get_current_tab() < tab_container->get_tab_count() - 1) {
tab_container->move_child(current, tab_container->get_current_tab() + 1);
- tab_container->set_current_tab(tab_container->get_current_tab() + 1);
+ tab_container->set_current_tab(tab_container->get_current_tab());
_update_script_names();
}
} break;
default: {
if (p_option >= WINDOW_SELECT_BASE) {
- tab_container->set_current_tab(p_option - WINDOW_SELECT_BASE);
+ _go_to_tab(p_option - WINDOW_SELECT_BASE);
_update_script_names();
}
}
@@ -1494,14 +1494,14 @@ void ScriptEditor::_menu_option(int p_option) {
case WINDOW_MOVE_UP: {
if (tab_container->get_current_tab() > 0) {
tab_container->move_child(help, tab_container->get_current_tab() - 1);
- tab_container->set_current_tab(tab_container->get_current_tab() - 1);
+ tab_container->set_current_tab(tab_container->get_current_tab());
_update_script_names();
}
} break;
case WINDOW_MOVE_DOWN: {
if (tab_container->get_current_tab() < tab_container->get_tab_count() - 1) {
tab_container->move_child(help, tab_container->get_current_tab() + 1);
- tab_container->set_current_tab(tab_container->get_current_tab() + 1);
+ tab_container->set_current_tab(tab_container->get_current_tab());
_update_script_names();
}
} break;
@@ -2125,8 +2125,8 @@ void ScriptEditor::_update_script_names() {
sd.index = i;
sedata.set(i, sd);
}
- tab_container->set_current_tab(new_prev_tab);
- tab_container->set_current_tab(new_cur_tab);
+ _go_to_tab(new_prev_tab);
+ _go_to_tab(new_cur_tab);
_sort_list_on_update = false;
}
@@ -2154,7 +2154,6 @@ void ScriptEditor::_update_script_names() {
}
if (tab_container->get_current_tab() == sedata_filtered[i].index) {
script_list->select(index);
- _script_selected(index);
script_name_label->set_text(sedata_filtered[i].name);
script_icon->set_texture(sedata_filtered[i].icon);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index f77e23e63e..e700412188 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -41,7 +41,6 @@
#include "editor/filesystem_dock.h"
#include "editor/plugins/visual_shader_editor_plugin.h"
#include "editor/project_settings_editor.h"
-#include "editor/property_editor.h"
#include "editor/shader_create_dialog.h"
#include "scene/gui/split_container.h"
#include "servers/display_server.h"
diff --git a/editor/plugins/shader_file_editor_plugin.cpp b/editor/plugins/shader_file_editor_plugin.cpp
index 4564f60fa5..4874944d33 100644
--- a/editor/plugins/shader_file_editor_plugin.cpp
+++ b/editor/plugins/shader_file_editor_plugin.cpp
@@ -37,7 +37,6 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-#include "editor/property_editor.h"
#include "servers/display_server.h"
#include "servers/rendering/shader_types.h"
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 2e9b89f1f3..196d87da36 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -32,6 +32,7 @@
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
void TextEditor::add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) {
ERR_FAIL_COND(p_highlighter.is_null());
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index a2b09b95eb..0bd8a8a484 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -35,7 +35,9 @@
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "scene/gui/check_box.h"
+#include "scene/gui/separator.h"
#include "scene/gui/view_panner.h"
#include "scene/resources/texture.h"
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index b4eab5f811..2a61ea0baa 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -36,6 +36,7 @@
#include "editor/editor_resource_picker.h"
#include "editor/editor_scale.h"
#include "editor/progress_dialog.h"
+#include "scene/gui/color_picker.h"
void ThemeItemImportTree::_update_items_tree() {
import_items_tree->clear();
diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp
index 0c7303dda4..b5c6c6d651 100644
--- a/editor/plugins/theme_editor_preview.cpp
+++ b/editor/plugins/theme_editor_preview.cpp
@@ -36,6 +36,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/gui/button.h"
+#include "scene/gui/check_button.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/progress_bar.h"
#include "scene/resources/packed_scene.h"
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index 443d5975cd..cf55465417 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -35,6 +35,8 @@
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
+#include "scene/gui/separator.h"
VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = nullptr;
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 2feed6108a..ecaad1e540 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -33,6 +33,7 @@
#include "editor/editor_plugin.h"
#include "editor/plugins/curve_editor_plugin.h"
+#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "editor/property_editor.h"
#include "scene/gui/button.h"
#include "scene/gui/code_edit.h"
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index be1ad1ca9c..fba8c5c522 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -34,6 +34,7 @@
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
+#include "editor/editor_settings.h"
#include "servers/movie_writer/movie_writer.h"
ProjectSettingsEditor *ProjectSettingsEditor::singleton = nullptr;
@@ -74,8 +75,13 @@ void ProjectSettingsEditor::_setting_edited(const String &p_name) {
queue_save();
}
+void ProjectSettingsEditor::_update_advanced(bool p_is_advanced) {
+ custom_properties->set_visible(p_is_advanced);
+}
+
void ProjectSettingsEditor::_advanced_toggled(bool p_button_pressed) {
EditorSettings::get_singleton()->set_project_metadata("project_settings", "advanced_mode", p_button_pressed);
+ _update_advanced(p_button_pressed);
general_settings_inspector->set_restrict_to_basic_settings(!p_button_pressed);
}
@@ -584,35 +590,35 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
advanced->connect("toggled", callable_mp(this, &ProjectSettingsEditor::_advanced_toggled));
search_bar->add_child(advanced);
- HBoxContainer *header = memnew(HBoxContainer);
- general_editor->add_child(header);
+ custom_properties = memnew(HBoxContainer);
+ general_editor->add_child(custom_properties);
property_box = memnew(LineEdit);
property_box->set_placeholder(TTR("Select a Setting or Type its Name"));
property_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
property_box->connect("text_changed", callable_mp(this, &ProjectSettingsEditor::_property_box_changed));
- header->add_child(property_box);
+ custom_properties->add_child(property_box);
feature_box = memnew(OptionButton);
feature_box->set_custom_minimum_size(Size2(120, 0) * EDSCALE);
feature_box->connect("item_selected", callable_mp(this, &ProjectSettingsEditor::_feature_selected));
- header->add_child(feature_box);
+ custom_properties->add_child(feature_box);
type_box = memnew(OptionButton);
type_box->set_custom_minimum_size(Size2(120, 0) * EDSCALE);
- header->add_child(type_box);
+ custom_properties->add_child(type_box);
add_button = memnew(Button);
add_button->set_text(TTR("Add"));
add_button->set_disabled(true);
add_button->connect("pressed", callable_mp(this, &ProjectSettingsEditor::_add_setting));
- header->add_child(add_button);
+ custom_properties->add_child(add_button);
del_button = memnew(Button);
del_button->set_text(TTR("Delete"));
del_button->set_disabled(true);
del_button->connect("pressed", callable_mp(this, &ProjectSettingsEditor::_delete_setting));
- header->add_child(del_button);
+ custom_properties->add_child(del_button);
general_settings_inspector = memnew(SectionedInspector);
general_settings_inspector->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
@@ -693,6 +699,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
advanced->set_pressed(true);
}
+ _update_advanced(use_advanced);
general_settings_inspector->set_restrict_to_basic_settings(!use_advanced);
import_defaults_editor = memnew(ImportDefaultsEditor);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 455aaae11c..849c50b9ba 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -61,6 +61,7 @@ class ProjectSettingsEditor : public AcceptDialog {
LineEdit *search_box = nullptr;
CheckButton *advanced = nullptr;
+ HBoxContainer *custom_properties = nullptr;
LineEdit *property_box = nullptr;
OptionButton *feature_box = nullptr;
OptionButton *type_box = nullptr;
@@ -77,6 +78,7 @@ class ProjectSettingsEditor : public AcceptDialog {
UndoRedo *undo_redo = nullptr;
void _advanced_toggled(bool p_button_pressed);
+ void _update_advanced(bool p_is_advanced);
void _property_box_changed(const String &p_text);
void _update_property_box();
void _feature_selected(int p_index);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 5f4375b424..4092cc47e3 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -51,6 +51,7 @@
#include "editor/editor_settings.h"
#include "editor/filesystem_dock.h"
#include "editor/multi_node_edit.h"
+#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "editor/property_selector.h"
#include "editor/scene_tree_dock.h"
#include "scene/gui/label.h"
@@ -59,39 +60,6 @@
#include "scene/resources/packed_scene.h"
#include "scene/scene_string_names.h"
-void EditorResourceConversionPlugin::_bind_methods() {
- GDVIRTUAL_BIND(_converts_to);
- GDVIRTUAL_BIND(_handles, "resource");
- GDVIRTUAL_BIND(_convert, "resource");
-}
-
-String EditorResourceConversionPlugin::converts_to() const {
- String ret;
- if (GDVIRTUAL_CALL(_converts_to, ret)) {
- return ret;
- }
-
- return "";
-}
-
-bool EditorResourceConversionPlugin::handles(const Ref<Resource> &p_resource) const {
- bool ret;
- if (GDVIRTUAL_CALL(_handles, p_resource, ret)) {
- return ret;
- }
-
- return false;
-}
-
-Ref<Resource> EditorResourceConversionPlugin::convert(const Ref<Resource> &p_resource) const {
- Ref<Resource> ret;
- if (GDVIRTUAL_CALL(_convert, p_resource, ret)) {
- return ret;
- }
-
- return Ref<Resource>();
-}
-
void CustomPropertyEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_WM_CLOSE_REQUEST: {
diff --git a/editor/property_editor.h b/editor/property_editor.h
index 27d1cabc3d..195eb89b81 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -51,22 +51,6 @@ class EditorFileDialog;
class PropertyValueEvaluator;
class PropertySelector;
-class EditorResourceConversionPlugin : public RefCounted {
- GDCLASS(EditorResourceConversionPlugin, RefCounted);
-
-protected:
- static void _bind_methods();
-
- GDVIRTUAL0RC(String, _converts_to)
- GDVIRTUAL1RC(bool, _handles, Ref<Resource>)
- GDVIRTUAL1RC(Ref<Resource>, _convert, Ref<Resource>)
-
-public:
- virtual String converts_to() const;
- virtual bool handles(const Ref<Resource> &p_resource) const;
- virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
-};
-
class CustomPropertyEditor : public PopupPanel {
GDCLASS(CustomPropertyEditor, PopupPanel);
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index 3222fb6eec..665aca6a37 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -42,6 +42,7 @@
#include "plugins/script_editor_plugin.h"
#include "scene/gui/control.h"
#include "scene/gui/label.h"
+#include "scene/gui/separator.h"
#include "scene/gui/tab_container.h"
RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo) {