summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-11-25 13:22:18 -0600
committerThaddeus Crews <repiteo@outlook.com>2024-11-25 13:22:18 -0600
commit7104f20634c7a1ea4b751575ac6eecec16949a72 (patch)
treef499a32ca8b3006c434df3583829e43592e6ed47 /editor
parent0c45ace151f25de2ca54fe7a46b6f077be32ba6f (diff)
parentedde380e9cb1545d77e99bba99aaf55f55e7dc86 (diff)
downloadredot-engine-7104f20634c7a1ea4b751575ac6eecec16949a72.tar.gz
Merge pull request #97986 from dustdfg/metadata/forbid_deleting_inherited_metadata
Editor: forbid deleting inherited metadata properties
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_inspector.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 6e837560f6..1a973d7b77 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -3472,6 +3472,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;
@@ -3525,7 +3533,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)) {