summaryrefslogtreecommitdiffstats
path: root/editor/editor_inspector.cpp
diff options
context:
space:
mode:
authorSpartan322 <Megacake1234@gmail.com>2024-11-26 12:56:19 -0500
committerSpartan322 <Megacake1234@gmail.com>2024-11-26 12:56:19 -0500
commite58e18261ea7ed3978146ef8d77a900be2601be3 (patch)
tree79c2a4c34f2d888ff962d76edf474c518d1abdea /editor/editor_inspector.cpp
parentc5b1645e60a59c0292c04bece3fdb0715a61afea (diff)
parentd09d82d433b03bb3773fd2a8cc8d6ccc2f8739ce (diff)
downloadredot-engine-e58e18261ea7ed3978146ef8d77a900be2601be3.tar.gz
Merge commit godotengine/godot@d09d82d433b03bb3773fd2a8cc8d6ccc2f8739ce
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r--editor/editor_inspector.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 6c12ad65b2..caf6abc822 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -3474,6 +3474,14 @@ void EditorInspector::update_tree() {
editors.append_array(late_editors);
+ const Node *node = Object::cast_to<Node>(object);
+
+ Vector<SceneState::PackState> sstack;
+ if (node != nullptr) {
+ const Node *es = EditorNode::get_singleton()->get_edited_scene();
+ sstack = PropertyUtils::get_node_states_stack(node, es);
+ }
+
for (int i = 0; i < editors.size(); i++) {
EditorProperty *ep = Object::cast_to<EditorProperty>(editors[i].property_editor);
const Vector<String> &properties = editors[i].properties;
@@ -3527,7 +3535,15 @@ void EditorInspector::update_tree() {
ep->set_checked(checked);
ep->set_keying(keying);
ep->set_read_only(property_read_only || all_read_only);
- ep->set_deletable(deletable_properties || p.name.begins_with("metadata/"));
+ if (p.name.begins_with("metadata/")) {
+ Variant _default = Variant();
+ if (node != nullptr) {
+ _default = PropertyUtils::get_property_default_value(node, p.name, nullptr, &sstack, false, nullptr, nullptr);
+ }
+ ep->set_deletable(_default == Variant());
+ } else {
+ ep->set_deletable(deletable_properties);
+ }
}
if (ep && ep->is_favoritable() && current_favorites.has(p.name)) {
@@ -3650,8 +3666,6 @@ void EditorInspector::update_tree() {
for (List<EditorInspectorSection *>::Element *I = sections.back(); I; I = I->prev()) {
EditorInspectorSection *section = I->get();
if (section->get_vbox()->get_child_count() == 0) {
- I = I->prev();
-
sections.erase(section);
vbox_per_path[main_vbox].erase(section->get_section());
memdelete(section);