diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-02 15:47:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 15:47:57 +0200 |
commit | b9d544b404bfcfbaf797b97b540961510595cd29 (patch) | |
tree | 3ecbfa6d3f93b414a58466fe2e6eef61a03bd168 /editor | |
parent | 538d026527a82ab5c73c0244cd27e49fc54dfe2a (diff) | |
parent | 24f2aaecc35b758076f22b1250dec0221ccffb28 (diff) |
Merge pull request #51173 from RandomShaper/tidy_property_reversion
Fix up property reversion
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_inspector.cpp | 6 | ||||
-rw-r--r-- | editor/editor_inspector.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 4a3413d9ef..d7b7e8e52d 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -417,7 +417,7 @@ bool EditorPropertyRevert::may_node_be_in_instance(Node *p_node) { return might_be; // or might not be } -bool EditorPropertyRevert::get_instantiated_node_original_property(Node *p_node, const StringName &p_prop, Variant &value) { +bool EditorPropertyRevert::get_instantiated_node_original_property(Node *p_node, const StringName &p_prop, Variant &value, bool p_check_class_default) { Node *node = p_node; Node *orig = node; @@ -455,7 +455,7 @@ bool EditorPropertyRevert::get_instantiated_node_original_property(Node *p_node, node = node->get_owner(); } - if (!found && p_node) { + if (p_check_class_default && !found && p_node) { //if not found, try default class value Variant attempt = ClassDB::class_get_default_property_value(p_node->get_class_name(), p_prop); if (attempt.get_type() != Variant::NIL) { @@ -548,7 +548,7 @@ Variant EditorPropertyRevert::get_property_revert_value(Object *p_object, const if (!ignore_parent) { //check for difference including instantiation Variant vorig; - if (EditorPropertyRevert::get_instantiated_node_original_property(node, p_property, vorig)) { + if (EditorPropertyRevert::get_instantiated_node_original_property(node, p_property, vorig, false)) { return vorig; } } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 2bb856dc81..3c9ba9f39d 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -40,7 +40,7 @@ class UndoRedo; class EditorPropertyRevert { public: static bool may_node_be_in_instance(Node *p_node); - static bool get_instantiated_node_original_property(Node *p_node, const StringName &p_prop, Variant &value); + static bool get_instantiated_node_original_property(Node *p_node, const StringName &p_prop, Variant &value, bool p_check_class_default = true); static bool is_node_property_different(Node *p_node, const Variant &p_current, const Variant &p_orig); static bool is_property_value_different(const Variant &p_a, const Variant &p_b); static Variant get_property_revert_value(Object *p_object, const StringName &p_property); |