You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #105148 from salianifo/contrib-upstream
Fix exported Node/Resource variables resetting when extending script in the SceneTreeDock
This commit is contained in:
@@ -646,10 +646,40 @@ void InspectorDock::apply_script_properties(Object *p_object) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<PropertyInfo> properties;
|
||||
si->get_property_list(&properties);
|
||||
|
||||
for (const Pair<StringName, Variant> &E : stored_properties) {
|
||||
Variant current_prop;
|
||||
if (si->get(E.first, current_prop) && current_prop.get_type() == E.second.get_type()) {
|
||||
si->set(E.first, E.second);
|
||||
} else if (E.second.get_type() == Variant::OBJECT) {
|
||||
for (const PropertyInfo &pi : properties) {
|
||||
if (E.first != pi.name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pi.type != Variant::OBJECT) {
|
||||
break;
|
||||
}
|
||||
|
||||
Object *p_property_object = E.second;
|
||||
|
||||
if (p_property_object->is_class(pi.hint_string)) {
|
||||
si->set(E.first, E.second);
|
||||
break;
|
||||
}
|
||||
|
||||
Ref<Script> base_script = p_property_object->get_script();
|
||||
while (base_script.is_valid()) {
|
||||
if (base_script->get_global_name() == pi.hint_string) {
|
||||
si->set(E.first, E.second);
|
||||
break;
|
||||
}
|
||||
base_script = base_script->get_base_script();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
stored_properties.clear();
|
||||
|
||||
Reference in New Issue
Block a user