mirror of https://github.com/godotengine/godot
Fix up property reversion
This commit is contained in:
parent
854725f400
commit
24f2aaecc3
|
|
@ -417,7 +417,7 @@ bool EditorPropertyRevert::may_node_be_in_instance(Node *p_node) {
|
||||||
return might_be; // or might not be
|
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 *node = p_node;
|
||||||
Node *orig = node;
|
Node *orig = node;
|
||||||
|
|
||||||
|
|
@ -455,7 +455,7 @@ bool EditorPropertyRevert::get_instantiated_node_original_property(Node *p_node,
|
||||||
node = node->get_owner();
|
node = node->get_owner();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found && p_node) {
|
if (p_check_class_default && !found && p_node) {
|
||||||
//if not found, try default class value
|
//if not found, try default class value
|
||||||
Variant attempt = ClassDB::class_get_default_property_value(p_node->get_class_name(), p_prop);
|
Variant attempt = ClassDB::class_get_default_property_value(p_node->get_class_name(), p_prop);
|
||||||
if (attempt.get_type() != Variant::NIL) {
|
if (attempt.get_type() != Variant::NIL) {
|
||||||
|
|
@ -548,7 +548,7 @@ Variant EditorPropertyRevert::get_property_revert_value(Object *p_object, const
|
||||||
if (!ignore_parent) {
|
if (!ignore_parent) {
|
||||||
//check for difference including instantiation
|
//check for difference including instantiation
|
||||||
Variant vorig;
|
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;
|
return vorig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class UndoRedo;
|
||||||
class EditorPropertyRevert {
|
class EditorPropertyRevert {
|
||||||
public:
|
public:
|
||||||
static bool may_node_be_in_instance(Node *p_node);
|
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_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 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);
|
static Variant get_property_revert_value(Object *p_object, const StringName &p_property);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue