|
@@ -1051,6 +1051,8 @@ void EditorSettings::set_initial_value(const StringName &p_setting, const Varian
|
|
|
}
|
|
|
|
|
|
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_restart_if_changed) {
|
|
|
+ ERR_FAIL_NULL_V_MSG(EditorSettings::get_singleton(), p_default, "EditorSettings not instantiated yet.");
|
|
|
+
|
|
|
Variant ret = p_default;
|
|
|
if (EditorSettings::get_singleton()->has_setting(p_setting)) {
|
|
|
ret = EditorSettings::get_singleton()->get(p_setting);
|
|
@@ -1067,7 +1069,7 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_re
|
|
|
}
|
|
|
|
|
|
Variant _EDITOR_GET(const String &p_setting) {
|
|
|
- ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has_setting(p_setting), Variant());
|
|
|
+ ERR_FAIL_COND_V(!EditorSettings::get_singleton() || !EditorSettings::get_singleton()->has_setting(p_setting), Variant());
|
|
|
return EditorSettings::get_singleton()->get(p_setting);
|
|
|
}
|
|
|
|
|
@@ -1422,9 +1424,7 @@ void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) {
|
|
|
}
|
|
|
|
|
|
Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path) {
|
|
|
- if (!EditorSettings::get_singleton()) {
|
|
|
- return nullptr;
|
|
|
- }
|
|
|
+ ERR_FAIL_NULL_V_MSG(EditorSettings::get_singleton(), nullptr, "EditorSettings not instantiated yet.");
|
|
|
|
|
|
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
|
|
|
|
|
@@ -1434,6 +1434,8 @@ Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path) {
|
|
|
}
|
|
|
|
|
|
void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_keycode) {
|
|
|
+ ERR_FAIL_NULL_MSG(EditorSettings::get_singleton(), "EditorSettings not instantiated yet.");
|
|
|
+
|
|
|
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
|
|
|
ERR_FAIL_COND_MSG(!sc.is_valid(), "Used ED_SHORTCUT_OVERRIDE with invalid shortcut: " + p_path + ".");
|
|
|
|
|
@@ -1444,6 +1446,8 @@ void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_k
|
|
|
}
|
|
|
|
|
|
void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, const PackedInt32Array &p_keycodes) {
|
|
|
+ ERR_FAIL_NULL_MSG(EditorSettings::get_singleton(), "EditorSettings not instantiated yet.");
|
|
|
+
|
|
|
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
|
|
|
ERR_FAIL_COND_MSG(!sc.is_valid(), "Used ED_SHORTCUT_OVERRIDE_ARRAY with invalid shortcut: " + p_path + ".");
|
|
|
|