mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
[Export] Use project settings overrides with the target preset features instead of current platform features.
This commit is contained in:
committed by
Pāvels Nadtočajevs
parent
4248411baf
commit
c6739f64df
@@ -359,6 +359,29 @@ bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
Variant ProjectSettings::get_setting_with_override_and_custom_features(const StringName &p_name, const Vector<String> &p_features) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
StringName name = p_name;
|
||||
if (feature_overrides.has(name)) {
|
||||
const LocalVector<Pair<StringName, StringName>> &overrides = feature_overrides[name];
|
||||
for (uint32_t i = 0; i < overrides.size(); i++) {
|
||||
if (p_features.has(String(overrides[i].first).to_lower())) {
|
||||
if (props.has(overrides[i].second)) {
|
||||
name = overrides[i].second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!props.has(name)) {
|
||||
WARN_PRINT("Property not found: " + String(name));
|
||||
return Variant();
|
||||
}
|
||||
return props[name].variant;
|
||||
}
|
||||
|
||||
Variant ProjectSettings::get_setting_with_override(const StringName &p_name) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
@@ -1411,6 +1434,7 @@ void ProjectSettings::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_setting", "name", "default_value"), &ProjectSettings::get_setting, DEFVAL(Variant()));
|
||||
ClassDB::bind_method(D_METHOD("get_setting_with_override", "name"), &ProjectSettings::get_setting_with_override);
|
||||
ClassDB::bind_method(D_METHOD("get_global_class_list"), &ProjectSettings::get_global_class_list);
|
||||
ClassDB::bind_method(D_METHOD("get_setting_with_override_and_custom_features", "name", "features"), &ProjectSettings::get_setting_with_override_and_custom_features);
|
||||
ClassDB::bind_method(D_METHOD("set_order", "name", "position"), &ProjectSettings::set_order);
|
||||
ClassDB::bind_method(D_METHOD("get_order", "name"), &ProjectSettings::get_order);
|
||||
ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &ProjectSettings::set_initial_value);
|
||||
|
||||
Reference in New Issue
Block a user