2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* editor_settings.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2018-01-04 23:50:27 +00:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
2020-01-01 10:16:22 +00:00
|
|
|
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 01:10:30 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "editor_settings.h"
|
2017-01-16 07:04:19 +00:00
|
|
|
|
2018-09-15 12:45:54 +00:00
|
|
|
#include "core/io/certs_compressed.gen.h"
|
2017-08-26 15:46:49 +00:00
|
|
|
#include "core/io/compression.h"
|
|
|
|
#include "core/io/config_file.h"
|
|
|
|
#include "core/io/file_access_memory.h"
|
2019-12-24 07:17:23 +00:00
|
|
|
#include "core/io/ip.h"
|
2017-08-26 15:46:49 +00:00
|
|
|
#include "core/io/resource_loader.h"
|
|
|
|
#include "core/io/resource_saver.h"
|
|
|
|
#include "core/io/translation_loader_po.h"
|
|
|
|
#include "core/os/dir_access.h"
|
|
|
|
#include "core/os/file_access.h"
|
|
|
|
#include "core/os/keyboard.h"
|
|
|
|
#include "core/os/os.h"
|
|
|
|
#include "core/project_settings.h"
|
|
|
|
#include "core/version.h"
|
2020-03-18 17:34:36 +00:00
|
|
|
#include "editor/doc_translations.gen.h"
|
2017-08-26 15:46:49 +00:00
|
|
|
#include "editor/editor_node.h"
|
2020-03-18 17:34:36 +00:00
|
|
|
#include "editor/editor_translations.gen.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "scene/main/node.h"
|
2017-06-27 01:58:03 +00:00
|
|
|
#include "scene/main/scene_tree.h"
|
2020-03-04 01:51:12 +00:00
|
|
|
#include "scene/main/window.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
// PRIVATE METHODS
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Ref<EditorSettings> EditorSettings::singleton = NULL;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
// Properties
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-01-06 11:40:43 +00:00
|
|
|
bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
|
|
|
|
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
|
|
|
bool changed = _set_only(p_name, p_value);
|
|
|
|
if (changed) {
|
|
|
|
emit_signal("settings_changed");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
_THREAD_SAFE_METHOD_
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_name.operator String() == "shortcuts") {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Array arr = p_value;
|
|
|
|
ERR_FAIL_COND_V(arr.size() && arr.size() & 1, true);
|
|
|
|
for (int i = 0; i < arr.size(); i += 2) {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
String name = arr[i];
|
2017-05-20 15:38:03 +00:00
|
|
|
Ref<InputEvent> shortcut = arr[i + 1];
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
Ref<ShortCut> sc;
|
|
|
|
sc.instance();
|
|
|
|
sc->set_shortcut(shortcut);
|
2017-03-05 15:44:50 +00:00
|
|
|
add_shortcut(name, sc);
|
2016-06-05 00:31:29 +00:00
|
|
|
}
|
|
|
|
|
2018-01-06 11:40:43 +00:00
|
|
|
return false;
|
2016-06-05 00:31:29 +00:00
|
|
|
}
|
|
|
|
|
2017-12-29 10:03:29 +00:00
|
|
|
bool changed = false;
|
|
|
|
|
2017-11-30 03:11:53 +00:00
|
|
|
if (p_value.get_type() == Variant::NIL) {
|
2017-12-29 10:03:29 +00:00
|
|
|
if (props.has(p_name)) {
|
|
|
|
props.erase(p_name);
|
|
|
|
changed = true;
|
|
|
|
}
|
2017-11-30 03:11:53 +00:00
|
|
|
} else {
|
2017-12-29 10:03:29 +00:00
|
|
|
if (props.has(p_name)) {
|
|
|
|
if (p_value != props[p_name].variant) {
|
|
|
|
props[p_name].variant = p_value;
|
|
|
|
changed = true;
|
|
|
|
}
|
|
|
|
} else {
|
2017-03-05 15:44:50 +00:00
|
|
|
props[p_name] = VariantContainer(p_value, last_order++);
|
2017-12-29 10:03:29 +00:00
|
|
|
changed = true;
|
|
|
|
}
|
2016-06-12 00:16:14 +00:00
|
|
|
|
|
|
|
if (save_changed_setting) {
|
2019-06-26 13:08:25 +00:00
|
|
|
if (!props[p_name].save) {
|
2017-12-29 10:03:29 +00:00
|
|
|
props[p_name].save = true;
|
|
|
|
changed = true;
|
|
|
|
}
|
2016-06-12 00:16:14 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2018-01-06 11:40:43 +00:00
|
|
|
return changed;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
2017-08-26 15:46:49 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_name.operator String() == "shortcuts") {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
Array arr;
|
2020-03-17 06:33:00 +00:00
|
|
|
for (const Map<String, Ref<ShortCut>>::Element *E = shortcuts.front(); E; E = E->next()) {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Ref<ShortCut> sc = E->get();
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2016-07-03 22:13:45 +00:00
|
|
|
if (optimize_save) {
|
|
|
|
if (!sc->has_meta("original")) {
|
|
|
|
continue; //this came from settings but is not any longer used
|
|
|
|
}
|
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
Ref<InputEvent> original = sc->get_meta("original");
|
|
|
|
if (sc->is_shortcut(original) || (original.is_null() && sc->get_shortcut().is_null()))
|
2016-07-03 22:13:45 +00:00
|
|
|
continue; //not changed from default, don't save
|
|
|
|
}
|
|
|
|
|
2016-06-05 00:31:29 +00:00
|
|
|
arr.push_back(E->key());
|
|
|
|
arr.push_back(sc->get_shortcut());
|
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
r_ret = arr;
|
2016-06-05 00:31:29 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
const VariantContainer *v = props.getptr(p_name);
|
2017-01-05 22:41:36 +00:00
|
|
|
if (!v) {
|
2019-11-07 08:44:15 +00:00
|
|
|
WARN_PRINT("EditorSettings::_get - Property not found: " + String(p_name));
|
2014-02-10 01:10:30 +00:00
|
|
|
return false;
|
2017-01-05 22:41:36 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
r_ret = v->variant;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-09-25 03:26:41 +00:00
|
|
|
void EditorSettings::_initial_set(const StringName &p_name, const Variant &p_value) {
|
|
|
|
set(p_name, p_value);
|
|
|
|
props[p_name].initial = p_value;
|
2017-11-20 17:34:13 +00:00
|
|
|
props[p_name].has_default_value = true;
|
2017-09-25 03:26:41 +00:00
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
struct _EVCSort {
|
|
|
|
|
|
|
|
String name;
|
|
|
|
Variant::Type type;
|
|
|
|
int order;
|
2016-06-12 00:16:14 +00:00
|
|
|
bool save;
|
2018-07-19 21:58:15 +00:00
|
|
|
bool restart_if_changed;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
bool operator<(const _EVCSort &p_vcs) const { return order < p_vcs.order; }
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
|
|
|
|
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
const String *k = NULL;
|
2014-02-10 01:10:30 +00:00
|
|
|
Set<_EVCSort> vclist;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
while ((k = props.next(k))) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
const VariantContainer *v = props.getptr(*k);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
if (v->hide_from_editor)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
_EVCSort vc;
|
2017-03-05 15:44:50 +00:00
|
|
|
vc.name = *k;
|
|
|
|
vc.order = v->order;
|
|
|
|
vc.type = v->variant.get_type();
|
|
|
|
vc.save = v->save;
|
2019-03-06 15:10:36 +00:00
|
|
|
/*if (vc.save) { this should be implemented, but lets do after 3.1 is out.
|
|
|
|
if (v->initial.get_type() != Variant::NIL && v->initial == v->variant) {
|
|
|
|
vc.save = false;
|
|
|
|
}
|
|
|
|
}*/
|
2018-07-19 21:58:15 +00:00
|
|
|
vc.restart_if_changed = v->restart_if_changed;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
vclist.insert(vc);
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (Set<_EVCSort>::Element *E = vclist.front(); E; E = E->next()) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-06-12 00:16:14 +00:00
|
|
|
int pinfo = 0;
|
2016-07-03 22:13:45 +00:00
|
|
|
if (E->get().save || !optimize_save) {
|
2017-03-05 15:44:50 +00:00
|
|
|
pinfo |= PROPERTY_USAGE_STORAGE;
|
2016-06-12 00:16:14 +00:00
|
|
|
}
|
|
|
|
|
2016-06-12 18:34:58 +00:00
|
|
|
if (!E->get().name.begins_with("_") && !E->get().name.begins_with("projects/")) {
|
2017-03-05 15:44:50 +00:00
|
|
|
pinfo |= PROPERTY_USAGE_EDITOR;
|
2016-06-12 00:16:14 +00:00
|
|
|
} else {
|
2017-03-05 15:44:50 +00:00
|
|
|
pinfo |= PROPERTY_USAGE_STORAGE; //hiddens must always be saved
|
2016-06-12 00:16:14 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
PropertyInfo pi(E->get().type, E->get().name);
|
2017-03-05 15:44:50 +00:00
|
|
|
pi.usage = pinfo;
|
2014-02-10 01:10:30 +00:00
|
|
|
if (hints.has(E->get().name))
|
2017-03-05 15:44:50 +00:00
|
|
|
pi = hints[E->get().name];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-07-19 21:58:15 +00:00
|
|
|
if (E->get().restart_if_changed) {
|
|
|
|
pi.usage |= PROPERTY_USAGE_RESTART_IF_CHANGED;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
p_list->push_back(pi);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2018-01-11 22:35:12 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, "shortcuts", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); //do not edit
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::_add_property_info_bind(const Dictionary &p_info) {
|
2017-10-05 18:34:34 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
ERR_FAIL_COND(!p_info.has("name"));
|
|
|
|
ERR_FAIL_COND(!p_info.has("type"));
|
2017-10-05 18:34:34 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
PropertyInfo pinfo;
|
|
|
|
pinfo.name = p_info["name"];
|
|
|
|
ERR_FAIL_COND(!props.has(pinfo.name));
|
|
|
|
pinfo.type = Variant::Type(p_info["type"].operator int());
|
|
|
|
ERR_FAIL_INDEX(pinfo.type, Variant::VARIANT_MAX);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (p_info.has("hint"))
|
|
|
|
pinfo.hint = PropertyHint(p_info["hint"].operator int());
|
|
|
|
if (p_info.has("hint_string"))
|
|
|
|
pinfo.hint_string = p_info["hint_string"];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
add_property_hint(pinfo);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
// Default configs
|
2017-10-28 21:25:28 +00:00
|
|
|
bool EditorSettings::has_default_value(const String &p_setting) const {
|
|
|
|
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
|
|
|
if (!props.has(p_setting))
|
|
|
|
return false;
|
2017-11-20 17:34:13 +00:00
|
|
|
return props[p_setting].has_default_value;
|
2017-10-28 21:25:28 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
/* Languages */
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
{
|
|
|
|
String lang_hint = "en";
|
|
|
|
String host_lang = OS::get_singleton()->get_locale();
|
|
|
|
host_lang = TranslationServer::standardize_locale(host_lang);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-05-21 12:32:01 +00:00
|
|
|
// Some locales are not properly supported currently in Godot due to lack of font shaping
|
|
|
|
// (e.g. Arabic or Hindi), so even though we have work in progress translations for them,
|
|
|
|
// we skip them as they don't render properly. (GH-28577)
|
|
|
|
const Vector<String> locales_to_skip = String("ar,bn,fa,he,hi,ml,si,ta,te,ur").split(",");
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
String best;
|
2017-09-25 03:26:41 +00:00
|
|
|
|
2018-01-06 12:17:12 +00:00
|
|
|
EditorTranslationList *etl = _editor_translations;
|
|
|
|
|
|
|
|
while (etl->data) {
|
|
|
|
|
|
|
|
const String &locale = etl->lang;
|
2019-05-21 12:32:01 +00:00
|
|
|
|
|
|
|
// Skip locales which we can't render properly (see above comment).
|
|
|
|
// Test against language code without regional variants (e.g. ur_PK).
|
|
|
|
String lang_code = locale.get_slice("_", 0);
|
|
|
|
if (locales_to_skip.find(lang_code) != -1) {
|
|
|
|
etl++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
lang_hint += ",";
|
|
|
|
lang_hint += locale;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (host_lang == locale) {
|
|
|
|
best = locale;
|
|
|
|
}
|
2017-08-26 03:40:45 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (best == String() && host_lang.begins_with(locale)) {
|
|
|
|
best = locale;
|
|
|
|
}
|
2018-01-06 12:17:12 +00:00
|
|
|
|
|
|
|
etl++;
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2017-08-26 03:40:45 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (best == String()) {
|
|
|
|
best = "en";
|
|
|
|
}
|
2017-08-03 16:23:46 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/editor/editor_language", best);
|
2018-07-19 21:58:15 +00:00
|
|
|
set_restart_if_changed("interface/editor/editor_language", true);
|
2017-10-28 13:40:55 +00:00
|
|
|
hints["interface/editor/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
|
|
|
}
|
2017-08-03 16:23:46 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
/* Interface */
|
|
|
|
|
|
|
|
// Editor
|
2018-03-22 19:20:42 +00:00
|
|
|
_initial_set("interface/editor/display_scale", 0);
|
|
|
|
hints["interface/editor/display_scale"] = PropertyInfo(Variant::INT, "interface/editor/display_scale", PROPERTY_HINT_ENUM, "Auto,75%,100%,125%,150%,175%,200%,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
|
|
|
_initial_set("interface/editor/custom_display_scale", 1.0f);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["interface/editor/custom_display_scale"] = PropertyInfo(Variant::FLOAT, "interface/editor/custom_display_scale", PROPERTY_HINT_RANGE, "0.5,3,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
2018-01-07 19:07:47 +00:00
|
|
|
_initial_set("interface/editor/main_font_size", 14);
|
2019-06-14 12:23:49 +00:00
|
|
|
hints["interface/editor/main_font_size"] = PropertyInfo(Variant::INT, "interface/editor/main_font_size", PROPERTY_HINT_RANGE, "8,48,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
2019-07-27 23:10:51 +00:00
|
|
|
_initial_set("interface/editor/code_font_size", 14);
|
|
|
|
hints["interface/editor/code_font_size"] = PropertyInfo(Variant::INT, "interface/editor/code_font_size", PROPERTY_HINT_RANGE, "8,48,1", PROPERTY_USAGE_DEFAULT);
|
|
|
|
_initial_set("interface/editor/font_antialiased", true);
|
2019-08-14 12:51:13 +00:00
|
|
|
_initial_set("interface/editor/font_hinting", 0);
|
|
|
|
hints["interface/editor/font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/font_hinting", PROPERTY_HINT_ENUM, "Auto,None,Light,Normal", PROPERTY_USAGE_DEFAULT);
|
2018-01-07 19:07:47 +00:00
|
|
|
_initial_set("interface/editor/main_font", "");
|
2018-07-20 08:19:20 +00:00
|
|
|
hints["interface/editor/main_font"] = PropertyInfo(Variant::STRING, "interface/editor/main_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT);
|
2018-05-11 01:38:16 +00:00
|
|
|
_initial_set("interface/editor/main_font_bold", "");
|
2018-07-20 08:19:20 +00:00
|
|
|
hints["interface/editor/main_font_bold"] = PropertyInfo(Variant::STRING, "interface/editor/main_font_bold", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT);
|
2018-01-07 19:07:47 +00:00
|
|
|
_initial_set("interface/editor/code_font", "");
|
2018-07-20 08:19:20 +00:00
|
|
|
hints["interface/editor/code_font"] = PropertyInfo(Variant::STRING, "interface/editor/code_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/editor/dim_editor_on_dialog_popup", true);
|
2019-05-29 21:12:19 +00:00
|
|
|
_initial_set("interface/editor/low_processor_mode_sleep_usec", 6900); // ~144 FPS
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["interface/editor/low_processor_mode_sleep_usec"] = PropertyInfo(Variant::FLOAT, "interface/editor/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "1,100000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
2019-05-29 21:12:19 +00:00
|
|
|
_initial_set("interface/editor/unfocused_low_processor_mode_sleep_usec", 50000); // 20 FPS
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["interface/editor/unfocused_low_processor_mode_sleep_usec"] = PropertyInfo(Variant::FLOAT, "interface/editor/unfocused_low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "1,100000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/editor/separate_distraction_mode", false);
|
2019-07-23 05:05:29 +00:00
|
|
|
_initial_set("interface/editor/automatically_open_screenshots", true);
|
2018-12-18 13:17:43 +00:00
|
|
|
_initial_set("interface/editor/hide_console_window", false);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
|
|
|
|
_initial_set("interface/editor/quit_confirmation", true);
|
2017-07-12 18:46:08 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Theme
|
2018-06-23 09:05:12 +00:00
|
|
|
_initial_set("interface/theme/preset", "Default");
|
2018-10-04 12:18:34 +00:00
|
|
|
hints["interface/theme/preset"] = PropertyInfo(Variant::STRING, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Alien,Arc,Godot 2,Grey,Light,Solarized (Dark),Solarized (Light),Custom", PROPERTY_USAGE_DEFAULT);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/theme/icon_and_font_color", 0);
|
2018-10-04 12:18:34 +00:00
|
|
|
hints["interface/theme/icon_and_font_color"] = PropertyInfo(Variant::INT, "interface/theme/icon_and_font_color", PROPERTY_HINT_ENUM, "Auto,Dark,Light", PROPERTY_USAGE_DEFAULT);
|
2019-07-08 18:03:06 +00:00
|
|
|
_initial_set("interface/theme/base_color", Color(0.2, 0.23, 0.31));
|
2018-10-04 12:18:34 +00:00
|
|
|
hints["interface/theme/base_color"] = PropertyInfo(Variant::COLOR, "interface/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT);
|
2019-07-08 18:03:06 +00:00
|
|
|
_initial_set("interface/theme/accent_color", Color(0.41, 0.61, 0.91));
|
2019-03-16 17:59:48 +00:00
|
|
|
hints["interface/theme/accent_color"] = PropertyInfo(Variant::COLOR, "interface/theme/accent_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/theme/contrast", 0.25);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["interface/theme/contrast"] = PropertyInfo(Variant::FLOAT, "interface/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01");
|
2019-03-06 15:10:36 +00:00
|
|
|
_initial_set("interface/theme/relationship_line_opacity", 0.1);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["interface/theme/relationship_line_opacity"] = PropertyInfo(Variant::FLOAT, "interface/theme/relationship_line_opacity", PROPERTY_HINT_RANGE, "0.00, 1, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/theme/highlight_tabs", false);
|
|
|
|
_initial_set("interface/theme/border_size", 1);
|
|
|
|
_initial_set("interface/theme/use_graph_node_headers", false);
|
2018-10-04 12:18:34 +00:00
|
|
|
hints["interface/theme/border_size"] = PropertyInfo(Variant::INT, "interface/theme/border_size", PROPERTY_HINT_RANGE, "0,2,1", PROPERTY_USAGE_DEFAULT);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/theme/additional_spacing", 0);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["interface/theme/additional_spacing"] = PropertyInfo(Variant::FLOAT, "interface/theme/additional_spacing", PROPERTY_HINT_RANGE, "0,5,0.1", PROPERTY_USAGE_DEFAULT);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/theme/custom_theme", "");
|
2018-10-04 12:18:34 +00:00
|
|
|
hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT);
|
2017-08-03 16:23:46 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Scene tabs
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("interface/scene_tabs/show_extension", false);
|
|
|
|
_initial_set("interface/scene_tabs/show_thumbnail_on_hover", true);
|
|
|
|
_initial_set("interface/scene_tabs/resize_if_many_tabs", true);
|
|
|
|
_initial_set("interface/scene_tabs/minimum_width", 50);
|
|
|
|
hints["interface/scene_tabs/minimum_width"] = PropertyInfo(Variant::INT, "interface/scene_tabs/minimum_width", PROPERTY_HINT_RANGE, "50,500,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
2018-12-12 07:18:24 +00:00
|
|
|
_initial_set("interface/scene_tabs/show_script_button", false);
|
2017-08-03 16:23:46 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
/* Filesystem */
|
|
|
|
|
|
|
|
// Directories
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("filesystem/directories/autoscan_project_path", "");
|
|
|
|
hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR);
|
|
|
|
_initial_set("filesystem/directories/default_project_path", OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS));
|
|
|
|
hints["filesystem/directories/default_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/default_project_path", PROPERTY_HINT_GLOBAL_DIR);
|
2017-07-12 18:46:08 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// On save
|
|
|
|
_initial_set("filesystem/on_save/compress_binary_resources", true);
|
|
|
|
_initial_set("filesystem/on_save/safe_save_on_backup_then_rename", true);
|
|
|
|
|
|
|
|
// File dialog
|
|
|
|
_initial_set("filesystem/file_dialog/show_hidden_files", false);
|
|
|
|
_initial_set("filesystem/file_dialog/display_mode", 0);
|
|
|
|
hints["filesystem/file_dialog/display_mode"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
|
|
|
|
_initial_set("filesystem/file_dialog/thumbnail_size", 64);
|
|
|
|
hints["filesystem/file_dialog/thumbnail_size"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
|
|
|
|
|
|
|
|
// Import
|
|
|
|
_initial_set("filesystem/import/pvrtc_texture_tool", "");
|
|
|
|
#ifdef WINDOWS_ENABLED
|
|
|
|
hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "*.exe");
|
|
|
|
#else
|
|
|
|
hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "");
|
|
|
|
#endif
|
|
|
|
_initial_set("filesystem/import/pvrtc_fast_conversion", false);
|
|
|
|
|
|
|
|
/* Docks */
|
|
|
|
|
|
|
|
// SceneTree
|
|
|
|
_initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
|
|
|
|
|
|
|
|
// FileSystem
|
|
|
|
_initial_set("docks/filesystem/thumbnail_size", 64);
|
|
|
|
hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
|
|
|
|
_initial_set("docks/filesystem/always_show_folders", true);
|
|
|
|
|
|
|
|
// Property editor
|
|
|
|
_initial_set("docks/property_editor/auto_refresh_interval", 0.3);
|
|
|
|
|
|
|
|
/* Text editor */
|
|
|
|
|
|
|
|
// Theme
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/theme/color_theme", "Adaptive");
|
2017-12-26 19:41:08 +00:00
|
|
|
hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default,Custom");
|
2018-10-14 19:38:35 +00:00
|
|
|
_initial_set("text_editor/theme/line_spacing", 6);
|
2019-04-11 16:29:07 +00:00
|
|
|
hints["text_editor/theme/line_spacing"] = PropertyInfo(Variant::INT, "text_editor/theme/line_spacing", PROPERTY_HINT_RANGE, "0,50,1");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
_load_default_text_editor_theme();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Highlighting
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/highlighting/syntax_highlighting", true);
|
|
|
|
_initial_set("text_editor/highlighting/highlight_all_occurrences", true);
|
|
|
|
_initial_set("text_editor/highlighting/highlight_current_line", true);
|
2018-06-05 16:50:21 +00:00
|
|
|
_initial_set("text_editor/highlighting/highlight_type_safe_lines", true);
|
2017-01-11 19:52:21 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Indent
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/indent/type", 0);
|
|
|
|
hints["text_editor/indent/type"] = PropertyInfo(Variant::INT, "text_editor/indent/type", PROPERTY_HINT_ENUM, "Tabs,Spaces");
|
|
|
|
_initial_set("text_editor/indent/size", 4);
|
|
|
|
hints["text_editor/indent/size"] = PropertyInfo(Variant::INT, "text_editor/indent/size", PROPERTY_HINT_RANGE, "1, 64, 1"); // size of 0 crashes.
|
|
|
|
_initial_set("text_editor/indent/auto_indent", true);
|
2019-10-14 19:35:17 +00:00
|
|
|
_initial_set("text_editor/indent/convert_indent_on_save", true);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/indent/draw_tabs", true);
|
2019-04-23 23:33:20 +00:00
|
|
|
_initial_set("text_editor/indent/draw_spaces", false);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-09-01 11:28:57 +00:00
|
|
|
// Navigation
|
|
|
|
_initial_set("text_editor/navigation/smooth_scrolling", true);
|
|
|
|
_initial_set("text_editor/navigation/v_scroll_speed", 80);
|
|
|
|
_initial_set("text_editor/navigation/show_minimap", true);
|
|
|
|
_initial_set("text_editor/navigation/minimap_width", 80);
|
|
|
|
hints["text_editor/navigation/minimap_width"] = PropertyInfo(Variant::INT, "text_editor/navigation/minimap_width", PROPERTY_HINT_RANGE, "50,250,1");
|
|
|
|
|
|
|
|
// Appearance
|
|
|
|
_initial_set("text_editor/appearance/show_line_numbers", true);
|
|
|
|
_initial_set("text_editor/appearance/line_numbers_zero_padded", false);
|
|
|
|
_initial_set("text_editor/appearance/show_bookmark_gutter", true);
|
|
|
|
_initial_set("text_editor/appearance/show_breakpoint_gutter", true);
|
|
|
|
_initial_set("text_editor/appearance/show_info_gutter", true);
|
|
|
|
_initial_set("text_editor/appearance/code_folding", true);
|
|
|
|
_initial_set("text_editor/appearance/word_wrap", false);
|
2020-02-15 01:59:59 +00:00
|
|
|
_initial_set("text_editor/appearance/show_line_length_guidelines", true);
|
|
|
|
_initial_set("text_editor/appearance/line_length_guideline_soft_column", 80);
|
|
|
|
hints["text_editor/appearance/line_length_guideline_soft_column"] = PropertyInfo(Variant::INT, "text_editor/appearance/line_length_guideline_soft_column", PROPERTY_HINT_RANGE, "20, 160, 1");
|
|
|
|
_initial_set("text_editor/appearance/line_length_guideline_hard_column", 100);
|
|
|
|
hints["text_editor/appearance/line_length_guideline_hard_column"] = PropertyInfo(Variant::INT, "text_editor/appearance/line_length_guideline_hard_column", PROPERTY_HINT_RANGE, "20, 160, 1");
|
2019-09-01 11:28:57 +00:00
|
|
|
|
|
|
|
// Script list
|
|
|
|
_initial_set("text_editor/script_list/show_members_overview", true);
|
2016-02-19 07:41:08 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Files
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/files/trim_trailing_whitespace_on_save", false);
|
2018-12-12 07:18:24 +00:00
|
|
|
_initial_set("text_editor/files/autosave_interval_secs", 0);
|
|
|
|
_initial_set("text_editor/files/restore_scripts_on_load", true);
|
|
|
|
|
|
|
|
// Tools
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/tools/create_signal_callbacks", true);
|
2018-04-30 12:27:00 +00:00
|
|
|
_initial_set("text_editor/tools/sort_members_outline_alphabetically", false);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Cursor
|
|
|
|
_initial_set("text_editor/cursor/scroll_past_end_of_file", false);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/cursor/block_caret", false);
|
2017-12-05 09:28:00 +00:00
|
|
|
_initial_set("text_editor/cursor/caret_blink", true);
|
2018-08-02 19:01:45 +00:00
|
|
|
_initial_set("text_editor/cursor/caret_blink_speed", 0.5);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::FLOAT, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.01");
|
2017-12-20 01:36:47 +00:00
|
|
|
_initial_set("text_editor/cursor/right_click_moves_caret", true);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Completion
|
2019-04-25 21:48:59 +00:00
|
|
|
_initial_set("text_editor/completion/idle_parse_delay", 2.0);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["text_editor/completion/idle_parse_delay"] = PropertyInfo(Variant::FLOAT, "text_editor/completion/idle_parse_delay", PROPERTY_HINT_RANGE, "0.1, 10, 0.01");
|
2019-07-18 19:34:28 +00:00
|
|
|
_initial_set("text_editor/completion/auto_brace_complete", true);
|
|
|
|
_initial_set("text_editor/completion/code_complete_delay", 0.3);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["text_editor/completion/code_complete_delay"] = PropertyInfo(Variant::FLOAT, "text_editor/completion/code_complete_delay", PROPERTY_HINT_RANGE, "0.01, 5, 0.01");
|
2018-01-06 11:40:43 +00:00
|
|
|
_initial_set("text_editor/completion/put_callhint_tooltip_below_current_line", true);
|
|
|
|
_initial_set("text_editor/completion/callhint_tooltip_offset", Vector2());
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/completion/complete_file_paths", true);
|
2018-05-30 02:16:59 +00:00
|
|
|
_initial_set("text_editor/completion/add_type_hints", false);
|
2018-12-18 01:53:54 +00:00
|
|
|
_initial_set("text_editor/completion/use_single_quotes", false);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Help
|
|
|
|
_initial_set("text_editor/help/show_help_index", true);
|
2019-06-14 12:23:49 +00:00
|
|
|
_initial_set("text_editor/help/help_font_size", 15);
|
|
|
|
hints["text_editor/help/help_font_size"] = PropertyInfo(Variant::INT, "text_editor/help/help_font_size", PROPERTY_HINT_RANGE, "8,48,1");
|
|
|
|
_initial_set("text_editor/help/help_source_font_size", 14);
|
|
|
|
hints["text_editor/help/help_source_font_size"] = PropertyInfo(Variant::INT, "text_editor/help/help_source_font_size", PROPERTY_HINT_RANGE, "8,48,1");
|
|
|
|
_initial_set("text_editor/help/help_title_font_size", 23);
|
|
|
|
hints["text_editor/help/help_title_font_size"] = PropertyInfo(Variant::INT, "text_editor/help/help_title_font_size", PROPERTY_HINT_RANGE, "8,48,1");
|
2018-12-12 07:18:24 +00:00
|
|
|
|
|
|
|
/* Editors */
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// GridMap
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/grid_map/pick_distance", 5000.0);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// 3D
|
2019-07-08 18:03:06 +00:00
|
|
|
_initial_set("editors/3d/primary_grid_color", Color(0.56, 0.56, 0.56));
|
2018-05-08 11:47:54 +00:00
|
|
|
hints["editors/3d/primary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/primary_grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
2018-04-29 23:43:20 +00:00
|
|
|
|
2019-07-08 18:03:06 +00:00
|
|
|
_initial_set("editors/3d/secondary_grid_color", Color(0.38, 0.38, 0.38));
|
2018-05-08 11:47:54 +00:00
|
|
|
hints["editors/3d/secondary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/secondary_grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
2018-04-29 23:43:20 +00:00
|
|
|
|
|
|
|
_initial_set("editors/3d/grid_size", 50);
|
|
|
|
hints["editors/3d/grid_size"] = PropertyInfo(Variant::INT, "editors/3d/grid_size", PROPERTY_HINT_RANGE, "1,500,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
|
|
|
|
|
|
|
_initial_set("editors/3d/primary_grid_steps", 10);
|
|
|
|
hints["editors/3d/primary_grid_steps"] = PropertyInfo(Variant::INT, "editors/3d/primary_grid_steps", PROPERTY_HINT_RANGE, "1,100,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-11-25 22:03:26 +00:00
|
|
|
_initial_set("editors/3d/default_fov", 70.0);
|
|
|
|
_initial_set("editors/3d/default_z_near", 0.05);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/default_z_far", 500.0);
|
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// 3D: Navigation
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/navigation/navigation_scheme", 0);
|
2018-11-17 15:24:34 +00:00
|
|
|
_initial_set("editors/3d/navigation/invert_y_axis", false);
|
2017-10-28 13:40:55 +00:00
|
|
|
hints["editors/3d/navigation/navigation_scheme"] = PropertyInfo(Variant::INT, "editors/3d/navigation/navigation_scheme", PROPERTY_HINT_ENUM, "Godot,Maya,Modo");
|
|
|
|
_initial_set("editors/3d/navigation/zoom_style", 0);
|
|
|
|
hints["editors/3d/navigation/zoom_style"] = PropertyInfo(Variant::INT, "editors/3d/navigation/zoom_style", PROPERTY_HINT_ENUM, "Vertical, Horizontal");
|
|
|
|
|
|
|
|
_initial_set("editors/3d/navigation/emulate_3_button_mouse", false);
|
|
|
|
_initial_set("editors/3d/navigation/orbit_modifier", 0);
|
|
|
|
hints["editors/3d/navigation/orbit_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/orbit_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
|
|
|
|
_initial_set("editors/3d/navigation/pan_modifier", 1);
|
|
|
|
hints["editors/3d/navigation/pan_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/pan_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
|
|
|
|
_initial_set("editors/3d/navigation/zoom_modifier", 4);
|
|
|
|
hints["editors/3d/navigation/zoom_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/zoom_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
|
|
|
|
_initial_set("editors/3d/navigation/warped_mouse_panning", true);
|
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// 3D: Navigation feel
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/navigation_feel/orbit_sensitivity", 0.4);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["editors/3d/navigation_feel/orbit_sensitivity"] = PropertyInfo(Variant::FLOAT, "editors/3d/navigation_feel/orbit_sensitivity", PROPERTY_HINT_RANGE, "0.0, 2, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/navigation_feel/orbit_inertia", 0.05);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["editors/3d/navigation_feel/orbit_inertia"] = PropertyInfo(Variant::FLOAT, "editors/3d/navigation_feel/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/navigation_feel/translation_inertia", 0.15);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["editors/3d/navigation_feel/translation_inertia"] = PropertyInfo(Variant::FLOAT, "editors/3d/navigation_feel/translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/navigation_feel/zoom_inertia", 0.075);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["editors/3d/navigation_feel/zoom_inertia"] = PropertyInfo(Variant::FLOAT, "editors/3d/navigation_feel/zoom_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/navigation_feel/manipulation_orbit_inertia", 0.075);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["editors/3d/navigation_feel/manipulation_orbit_inertia"] = PropertyInfo(Variant::FLOAT, "editors/3d/navigation_feel/manipulation_orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/navigation_feel/manipulation_translation_inertia", 0.075);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["editors/3d/navigation_feel/manipulation_translation_inertia"] = PropertyInfo(Variant::FLOAT, "editors/3d/navigation_feel/manipulation_translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// 3D: Freelook
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/freelook/freelook_inertia", 0.1);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["editors/3d/freelook/freelook_inertia"] = PropertyInfo(Variant::FLOAT, "editors/3d/freelook/freelook_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/freelook/freelook_base_speed", 5.0);
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
hints["editors/3d/freelook/freelook_base_speed"] = PropertyInfo(Variant::FLOAT, "editors/3d/freelook/freelook_base_speed", PROPERTY_HINT_RANGE, "0.0, 10, 0.01");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/3d/freelook/freelook_activation_modifier", 0);
|
|
|
|
hints["editors/3d/freelook/freelook_activation_modifier"] = PropertyInfo(Variant::INT, "editors/3d/freelook/freelook_activation_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
|
|
|
|
_initial_set("editors/3d/freelook/freelook_speed_zoom_link", false);
|
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// 2D
|
2018-08-18 15:32:09 +00:00
|
|
|
_initial_set("editors/2d/grid_color", Color(1.0, 1.0, 1.0, 0.07));
|
2017-12-05 20:42:33 +00:00
|
|
|
_initial_set("editors/2d/guides_color", Color(0.6, 0.0, 0.8));
|
2019-04-05 08:18:21 +00:00
|
|
|
_initial_set("editors/2d/smart_snapping_line_color", Color(0.9, 0.1, 0.1));
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/2d/bone_width", 5);
|
|
|
|
_initial_set("editors/2d/bone_color1", Color(1.0, 1.0, 1.0, 0.9));
|
2018-05-04 14:54:04 +00:00
|
|
|
_initial_set("editors/2d/bone_color2", Color(0.6, 0.6, 0.6, 0.9));
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/2d/bone_selected_color", Color(0.9, 0.45, 0.45, 0.9));
|
|
|
|
_initial_set("editors/2d/bone_ik_color", Color(0.9, 0.9, 0.45, 0.9));
|
2018-05-04 14:54:04 +00:00
|
|
|
_initial_set("editors/2d/bone_outline_color", Color(0.35, 0.35, 0.35));
|
|
|
|
_initial_set("editors/2d/bone_outline_size", 2);
|
2018-09-24 13:16:40 +00:00
|
|
|
_initial_set("editors/2d/viewport_border_color", Color(0.4, 0.4, 1.0, 0.4));
|
2019-06-24 19:15:26 +00:00
|
|
|
_initial_set("editors/2d/constrain_editor_view", true);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/2d/warped_mouse_panning", true);
|
2019-06-05 20:35:07 +00:00
|
|
|
_initial_set("editors/2d/simple_panning", false);
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/2d/scroll_to_pan", false);
|
|
|
|
_initial_set("editors/2d/pan_speed", 20);
|
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Polygon editor
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("editors/poly_editor/point_grab_radius", 8);
|
|
|
|
_initial_set("editors/poly_editor/show_previous_outline", true);
|
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Animation
|
|
|
|
_initial_set("editors/animation/autorename_animation_tracks", true);
|
|
|
|
_initial_set("editors/animation/confirm_insert_track", true);
|
|
|
|
_initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));
|
|
|
|
_initial_set("editors/animation/onion_layers_future_color", Color(0, 1, 0));
|
|
|
|
|
|
|
|
/* Run */
|
|
|
|
|
|
|
|
// Window placement
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("run/window_placement/rect", 1);
|
|
|
|
hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
|
2018-08-18 13:30:00 +00:00
|
|
|
String screen_hints = "Same as Editor,Previous Monitor,Next Monitor";
|
2020-03-03 13:36:29 +00:00
|
|
|
for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) {
|
2017-10-28 13:40:55 +00:00
|
|
|
screen_hints += ",Monitor " + itos(i + 1);
|
|
|
|
}
|
|
|
|
_initial_set("run/window_placement/rect_custom_position", Vector2());
|
|
|
|
_initial_set("run/window_placement/screen", 0);
|
|
|
|
hints["run/window_placement/screen"] = PropertyInfo(Variant::INT, "run/window_placement/screen", PROPERTY_HINT_ENUM, screen_hints);
|
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
// Auto save
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("run/auto_save/save_before_running", true);
|
2018-12-12 07:18:24 +00:00
|
|
|
|
|
|
|
// Output
|
2019-06-14 12:23:49 +00:00
|
|
|
_initial_set("run/output/font_size", 13);
|
|
|
|
hints["run/output/font_size"] = PropertyInfo(Variant::INT, "run/output/font_size", PROPERTY_HINT_RANGE, "8,48,1");
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("run/output/always_clear_output_on_play", true);
|
|
|
|
_initial_set("run/output/always_open_output_on_play", true);
|
|
|
|
_initial_set("run/output/always_close_output_on_stop", false);
|
|
|
|
|
2019-08-21 15:05:06 +00:00
|
|
|
/* Network */
|
|
|
|
|
|
|
|
// Debug
|
|
|
|
_initial_set("network/debug/remote_host", "127.0.0.1"); // Hints provided in setup_network
|
|
|
|
|
|
|
|
_initial_set("network/debug/remote_port", 6007);
|
|
|
|
hints["network/debug/remote_port"] = PropertyInfo(Variant::INT, "network/debug/remote_port", PROPERTY_HINT_RANGE, "1,65535,1");
|
|
|
|
|
|
|
|
// SSL
|
|
|
|
_initial_set("network/ssl/editor_ssl_certificates", _SYSTEM_CERTS_PATH);
|
|
|
|
hints["network/ssl/editor_ssl_certificates"] = PropertyInfo(Variant::STRING, "network/ssl/editor_ssl_certificates", PROPERTY_HINT_GLOBAL_FILE, "*.crt,*.pem");
|
|
|
|
|
2018-12-12 07:18:24 +00:00
|
|
|
/* Extra config */
|
2017-10-28 13:40:55 +00:00
|
|
|
|
2018-12-12 20:12:41 +00:00
|
|
|
_initial_set("project_manager/sorting_order", 0);
|
2020-02-12 17:13:32 +00:00
|
|
|
hints["project_manager/sorting_order"] = PropertyInfo(Variant::INT, "project_manager/sorting_order", PROPERTY_HINT_ENUM, "Name,Path,Last Edited");
|
2018-12-12 20:12:41 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (p_extra_config.is_valid()) {
|
|
|
|
|
|
|
|
if (p_extra_config->has_section("init_projects") && p_extra_config->has_section_key("init_projects", "list")) {
|
|
|
|
|
|
|
|
Vector<String> list = p_extra_config->get_value("init_projects", "list");
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
|
|
|
String name = list[i].replace("/", "::");
|
|
|
|
set("projects/" + name, list[i]);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if (p_extra_config->has_section("presets")) {
|
|
|
|
|
|
|
|
List<String> keys;
|
|
|
|
p_extra_config->get_section_keys("presets", &keys);
|
|
|
|
|
|
|
|
for (List<String>::Element *E = keys.front(); E; E = E->next()) {
|
|
|
|
|
|
|
|
String key = E->get();
|
|
|
|
Variant val = p_extra_config->get_value("presets", key);
|
|
|
|
set(key, val);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettings::_load_default_text_editor_theme() {
|
2018-06-10 14:30:49 +00:00
|
|
|
|
|
|
|
bool dark_theme = is_dark_theme();
|
|
|
|
|
2019-07-08 18:03:06 +00:00
|
|
|
_initial_set("text_editor/highlighting/symbol_color", Color(0.73, 0.87, 1.0));
|
|
|
|
_initial_set("text_editor/highlighting/keyword_color", Color(1.0, 1.0, 0.7));
|
|
|
|
_initial_set("text_editor/highlighting/base_type_color", Color(0.64, 1.0, 0.83));
|
|
|
|
_initial_set("text_editor/highlighting/engine_type_color", Color(0.51, 0.83, 1.0));
|
2019-09-28 10:11:06 +00:00
|
|
|
_initial_set("text_editor/highlighting/user_type_color", Color(0.42, 0.67, 0.93));
|
2019-07-08 18:03:06 +00:00
|
|
|
_initial_set("text_editor/highlighting/comment_color", Color(0.4, 0.4, 0.4));
|
|
|
|
_initial_set("text_editor/highlighting/string_color", Color(0.94, 0.43, 0.75));
|
|
|
|
_initial_set("text_editor/highlighting/background_color", dark_theme ? Color(0.0, 0.0, 0.0, 0.23) : Color(0.2, 0.23, 0.31));
|
|
|
|
_initial_set("text_editor/highlighting/completion_background_color", Color(0.17, 0.16, 0.2));
|
|
|
|
_initial_set("text_editor/highlighting/completion_selected_color", Color(0.26, 0.26, 0.27));
|
|
|
|
_initial_set("text_editor/highlighting/completion_existing_color", Color(0.13, 0.87, 0.87, 0.87));
|
|
|
|
_initial_set("text_editor/highlighting/completion_scroll_color", Color(1, 1, 1));
|
|
|
|
_initial_set("text_editor/highlighting/completion_font_color", Color(0.67, 0.67, 0.67));
|
|
|
|
_initial_set("text_editor/highlighting/text_color", Color(0.67, 0.67, 0.67));
|
|
|
|
_initial_set("text_editor/highlighting/line_number_color", Color(0.67, 0.67, 0.67, 0.4));
|
|
|
|
_initial_set("text_editor/highlighting/safe_line_number_color", Color(0.67, 0.78, 0.67, 0.6));
|
|
|
|
_initial_set("text_editor/highlighting/caret_color", Color(0.67, 0.67, 0.67));
|
|
|
|
_initial_set("text_editor/highlighting/caret_background_color", Color(0, 0, 0));
|
|
|
|
_initial_set("text_editor/highlighting/text_selected_color", Color(0, 0, 0));
|
|
|
|
_initial_set("text_editor/highlighting/selection_color", Color(0.41, 0.61, 0.91, 0.35));
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2));
|
|
|
|
_initial_set("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15));
|
|
|
|
_initial_set("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1));
|
2018-06-10 14:30:49 +00:00
|
|
|
_initial_set("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
|
2019-07-08 18:03:06 +00:00
|
|
|
_initial_set("text_editor/highlighting/number_color", Color(0.92, 0.58, 0.2));
|
|
|
|
_initial_set("text_editor/highlighting/function_color", Color(0.4, 0.64, 0.81));
|
|
|
|
_initial_set("text_editor/highlighting/member_variable_color", Color(0.9, 0.31, 0.35));
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
|
2019-04-19 23:51:25 +00:00
|
|
|
_initial_set("text_editor/highlighting/bookmark_color", Color(0.08, 0.49, 0.98));
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2));
|
2019-04-22 16:20:27 +00:00
|
|
|
_initial_set("text_editor/highlighting/executing_line_color", Color(0.2, 0.8, 0.2, 0.4));
|
2017-12-04 21:48:20 +00:00
|
|
|
_initial_set("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8));
|
2017-10-28 13:40:55 +00:00
|
|
|
_initial_set("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
|
2019-03-15 17:15:24 +00:00
|
|
|
_initial_set("text_editor/highlighting/search_result_border_color", Color(0.41, 0.61, 0.91, 0.38));
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorSettings::_save_text_editor_theme(String p_file) {
|
|
|
|
String theme_section = "color_theme";
|
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile); // hex is better?
|
2018-06-10 12:06:24 +00:00
|
|
|
|
|
|
|
List<String> keys;
|
|
|
|
props.get_key_list(&keys);
|
|
|
|
keys.sort();
|
|
|
|
|
|
|
|
for (const List<String>::Element *E = keys.front(); E; E = E->next()) {
|
2019-06-26 13:08:25 +00:00
|
|
|
const String &key = E->get();
|
2018-06-10 12:06:24 +00:00
|
|
|
if (key.begins_with("text_editor/highlighting/") && key.find("color") >= 0) {
|
|
|
|
cf->set_value(theme_section, key.replace("text_editor/highlighting/", ""), ((Color)props[key].variant).to_html());
|
|
|
|
}
|
|
|
|
}
|
2018-04-12 21:26:15 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Error err = cf->save(p_file);
|
|
|
|
|
2019-06-26 13:08:25 +00:00
|
|
|
return err == OK;
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 15:18:24 +00:00
|
|
|
bool EditorSettings::_is_default_text_editor_theme(String p_theme_name) {
|
|
|
|
return p_theme_name == "default" || p_theme_name == "adaptive" || p_theme_name == "custom";
|
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
static Dictionary _get_builtin_script_templates() {
|
|
|
|
Dictionary templates;
|
|
|
|
|
2019-04-05 21:15:12 +00:00
|
|
|
// No Comments
|
2017-10-28 13:40:55 +00:00
|
|
|
templates["no_comments.gd"] =
|
|
|
|
"extends %BASE%\n"
|
|
|
|
"\n"
|
2019-11-17 11:54:43 +00:00
|
|
|
"\n"
|
2019-04-05 21:15:12 +00:00
|
|
|
"func _ready()%VOID_RETURN%:\n"
|
2017-10-28 13:40:55 +00:00
|
|
|
"%TS%pass\n";
|
|
|
|
|
2019-04-05 21:15:12 +00:00
|
|
|
// Empty
|
2017-10-28 13:40:55 +00:00
|
|
|
templates["empty.gd"] =
|
|
|
|
"extends %BASE%"
|
|
|
|
"\n"
|
|
|
|
"\n";
|
|
|
|
|
|
|
|
return templates;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _create_script_templates(const String &p_path) {
|
|
|
|
|
|
|
|
Dictionary templates = _get_builtin_script_templates();
|
|
|
|
List<Variant> keys;
|
|
|
|
templates.get_key_list(&keys);
|
|
|
|
FileAccess *file = FileAccess::create(FileAccess::ACCESS_FILESYSTEM);
|
|
|
|
|
|
|
|
DirAccess *dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
|
|
|
dir->change_dir(p_path);
|
|
|
|
for (int i = 0; i < keys.size(); i++) {
|
|
|
|
if (!dir->file_exists(keys[i])) {
|
|
|
|
Error err = file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE);
|
|
|
|
ERR_FAIL_COND(err != OK);
|
|
|
|
file->store_string(templates[keys[i]]);
|
|
|
|
file->close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
memdelete(dir);
|
|
|
|
memdelete(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
// PUBLIC METHODS
|
|
|
|
|
|
|
|
EditorSettings *EditorSettings::get_singleton() {
|
|
|
|
|
|
|
|
return singleton.ptr();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettings::create() {
|
|
|
|
|
|
|
|
if (singleton.ptr())
|
|
|
|
return; //pointless
|
|
|
|
|
|
|
|
DirAccess *dir = NULL;
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
String data_path;
|
|
|
|
String data_dir;
|
2017-10-28 13:40:55 +00:00
|
|
|
String config_path;
|
|
|
|
String config_dir;
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
String cache_path;
|
|
|
|
String cache_dir;
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Ref<ConfigFile> extra_config = memnew(ConfigFile);
|
|
|
|
|
|
|
|
String exe_path = OS::get_singleton()->get_executable_path().get_base_dir();
|
|
|
|
DirAccess *d = DirAccess::create_for_path(exe_path);
|
|
|
|
bool self_contained = false;
|
|
|
|
|
|
|
|
if (d->file_exists(exe_path + "/._sc_")) {
|
|
|
|
self_contained = true;
|
2019-08-07 10:54:30 +00:00
|
|
|
Error err = extra_config->load(exe_path + "/._sc_");
|
|
|
|
if (err != OK) {
|
2019-11-06 16:03:04 +00:00
|
|
|
ERR_PRINT("Can't load config from path '" + exe_path + "/._sc_'.");
|
2019-08-07 10:54:30 +00:00
|
|
|
}
|
2017-10-28 13:40:55 +00:00
|
|
|
} else if (d->file_exists(exe_path + "/_sc_")) {
|
|
|
|
self_contained = true;
|
2019-08-07 10:54:30 +00:00
|
|
|
Error err = extra_config->load(exe_path + "/_sc_");
|
|
|
|
if (err != OK) {
|
2019-11-06 16:03:04 +00:00
|
|
|
ERR_PRINT("Can't load config from path '" + exe_path + "/_sc_'.");
|
2019-08-07 10:54:30 +00:00
|
|
|
}
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
memdelete(d);
|
|
|
|
|
|
|
|
if (self_contained) {
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
|
|
|
|
// editor is self contained, all in same folder
|
|
|
|
data_path = exe_path;
|
|
|
|
data_dir = data_path.plus_file("editor_data");
|
2017-10-28 13:40:55 +00:00
|
|
|
config_path = exe_path;
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
config_dir = data_dir;
|
|
|
|
cache_path = exe_path;
|
|
|
|
cache_dir = data_dir.plus_file("cache");
|
2017-10-28 13:40:55 +00:00
|
|
|
} else {
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
// Typically XDG_DATA_HOME or %APPDATA%
|
|
|
|
data_path = OS::get_singleton()->get_data_path();
|
|
|
|
data_dir = data_path.plus_file(OS::get_singleton()->get_godot_dir_name());
|
|
|
|
// Can be different from data_path e.g. on Linux or macOS
|
|
|
|
config_path = OS::get_singleton()->get_config_path();
|
|
|
|
config_dir = config_path.plus_file(OS::get_singleton()->get_godot_dir_name());
|
|
|
|
// Can be different from above paths, otherwise a subfolder of data_dir
|
|
|
|
cache_path = OS::get_singleton()->get_cache_path();
|
|
|
|
if (cache_path == data_path) {
|
|
|
|
cache_dir = data_dir.plus_file("cache");
|
|
|
|
} else {
|
|
|
|
cache_dir = cache_path.plus_file(OS::get_singleton()->get_godot_dir_name());
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
}
|
2017-10-28 13:40:55 +00:00
|
|
|
|
|
|
|
ClassDB::register_class<EditorSettings>(); //otherwise it can't be unserialized
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
String config_file_path;
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
if (data_path != "" && config_path != "" && cache_path != "") {
|
|
|
|
|
|
|
|
// Validate/create data dir and subdirectories
|
2017-10-28 13:40:55 +00:00
|
|
|
|
|
|
|
dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
if (dir->change_dir(data_dir) != OK) {
|
2018-08-12 19:26:08 +00:00
|
|
|
dir->make_dir_recursive(data_dir);
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
if (dir->change_dir(data_dir) != OK) {
|
|
|
|
ERR_PRINT("Cannot create data directory!");
|
2017-10-28 13:40:55 +00:00
|
|
|
memdelete(dir);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dir->change_dir("templates") != OK) {
|
|
|
|
dir->make_dir("templates");
|
|
|
|
} else {
|
|
|
|
dir->change_dir("..");
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
// Validate/create cache dir
|
|
|
|
|
|
|
|
if (dir->change_dir(cache_dir) != OK) {
|
2018-08-12 19:26:08 +00:00
|
|
|
dir->make_dir_recursive(cache_dir);
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
if (dir->change_dir(cache_dir) != OK) {
|
|
|
|
ERR_PRINT("Cannot create cache directory!");
|
|
|
|
memdelete(dir);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Validate/create config dir and subdirectories
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (dir->change_dir(config_dir) != OK) {
|
2018-08-12 19:26:08 +00:00
|
|
|
dir->make_dir_recursive(config_dir);
|
2017-10-28 13:40:55 +00:00
|
|
|
if (dir->change_dir(config_dir) != OK) {
|
|
|
|
ERR_PRINT("Cannot create config directory!");
|
|
|
|
memdelete(dir);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
if (dir->change_dir("text_editor_themes") != OK) {
|
2016-04-12 14:45:31 +00:00
|
|
|
dir->make_dir("text_editor_themes");
|
|
|
|
} else {
|
|
|
|
dir->change_dir("..");
|
|
|
|
}
|
|
|
|
|
2017-06-13 20:03:08 +00:00
|
|
|
if (dir->change_dir("script_templates") != OK) {
|
|
|
|
dir->make_dir("script_templates");
|
|
|
|
} else {
|
|
|
|
dir->change_dir("..");
|
|
|
|
}
|
2019-04-08 22:18:03 +00:00
|
|
|
|
|
|
|
if (dir->change_dir("feature_profiles") != OK) {
|
|
|
|
dir->make_dir("feature_profiles");
|
|
|
|
} else {
|
|
|
|
dir->change_dir("..");
|
|
|
|
}
|
|
|
|
|
2017-11-17 20:48:24 +00:00
|
|
|
_create_script_templates(dir->get_current_dir().plus_file("script_templates"));
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-11-17 20:48:24 +00:00
|
|
|
if (dir->change_dir("projects") != OK) {
|
|
|
|
dir->make_dir("projects");
|
2015-06-06 12:44:38 +00:00
|
|
|
} else {
|
|
|
|
dir->change_dir("..");
|
|
|
|
}
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
// Validate/create project-specific config dir
|
2015-06-06 12:44:38 +00:00
|
|
|
|
2017-11-17 20:48:24 +00:00
|
|
|
dir->change_dir("projects");
|
2017-11-17 14:50:18 +00:00
|
|
|
String project_config_dir = ProjectSettings::get_singleton()->get_resource_path();
|
|
|
|
if (project_config_dir.ends_with("/"))
|
|
|
|
project_config_dir = config_path.substr(0, project_config_dir.size() - 1);
|
|
|
|
project_config_dir = project_config_dir.get_file() + "-" + project_config_dir.md5_text();
|
2015-06-06 12:44:38 +00:00
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
if (dir->change_dir(project_config_dir) != OK) {
|
2017-11-17 14:50:18 +00:00
|
|
|
dir->make_dir(project_config_dir);
|
2015-06-06 12:44:38 +00:00
|
|
|
} else {
|
|
|
|
dir->change_dir("..");
|
|
|
|
}
|
|
|
|
dir->change_dir("..");
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
// Validate editor config file
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-11-20 06:40:06 +00:00
|
|
|
String config_file_name = "editor_settings-" + itos(VERSION_MAJOR) + ".tres";
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
config_file_path = config_dir.plus_file(config_file_name);
|
2017-01-11 21:38:00 +00:00
|
|
|
if (!dir->file_exists(config_file_name)) {
|
2017-01-05 22:41:36 +00:00
|
|
|
goto fail;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
memdelete(dir);
|
|
|
|
|
2017-11-17 14:50:18 +00:00
|
|
|
singleton = ResourceLoader::load(config_file_path, "EditorSettings");
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
if (singleton.is_null()) {
|
|
|
|
WARN_PRINT("Could not open config file.");
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
singleton->save_changed_setting = true;
|
|
|
|
singleton->config_file_path = config_file_path;
|
2017-11-17 14:50:18 +00:00
|
|
|
singleton->project_config_dir = project_config_dir;
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
singleton->settings_dir = config_dir;
|
|
|
|
singleton->data_dir = data_dir;
|
|
|
|
singleton->cache_dir = cache_dir;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-08-24 06:47:34 +00:00
|
|
|
print_verbose("EditorSettings: Load OK!");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-05-27 22:58:28 +00:00
|
|
|
singleton->setup_language();
|
2015-08-06 05:37:40 +00:00
|
|
|
singleton->setup_network();
|
2015-06-06 12:44:38 +00:00
|
|
|
singleton->load_favorites();
|
2016-04-12 14:45:31 +00:00
|
|
|
singleton->list_text_editor_themes();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
fail:
|
2017-01-05 22:41:36 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
// patch init projects
|
|
|
|
if (extra_config->has_section("init_projects")) {
|
|
|
|
Vector<String> list = extra_config->get_value("init_projects", "list");
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
2017-01-05 22:41:36 +00:00
|
|
|
|
2019-06-16 12:31:57 +00:00
|
|
|
list.write[i] = exe_path.plus_file(list[i]);
|
2017-10-28 13:40:55 +00:00
|
|
|
};
|
|
|
|
extra_config->set_value("init_projects", "list", list);
|
|
|
|
};
|
2017-01-05 22:41:36 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
singleton = Ref<EditorSettings>(memnew(EditorSettings));
|
|
|
|
singleton->save_changed_setting = true;
|
|
|
|
singleton->config_file_path = config_file_path;
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
singleton->settings_dir = config_dir;
|
|
|
|
singleton->data_dir = data_dir;
|
|
|
|
singleton->cache_dir = cache_dir;
|
2017-10-28 13:40:55 +00:00
|
|
|
singleton->_load_defaults(extra_config);
|
|
|
|
singleton->setup_language();
|
|
|
|
singleton->setup_network();
|
|
|
|
singleton->list_text_editor_themes();
|
|
|
|
}
|
2017-01-05 22:41:36 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::setup_language() {
|
2017-03-05 15:44:50 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
String lang = get("interface/editor/editor_language");
|
|
|
|
if (lang == "en")
|
2020-03-18 17:34:36 +00:00
|
|
|
return; // Default, nothing to do.
|
2017-03-05 15:44:50 +00:00
|
|
|
|
2020-03-18 17:34:36 +00:00
|
|
|
// Load editor translation for configured/detected locale.
|
2018-01-06 12:17:12 +00:00
|
|
|
EditorTranslationList *etl = _editor_translations;
|
|
|
|
while (etl->data) {
|
|
|
|
if (etl->lang == lang) {
|
|
|
|
Vector<uint8_t> data;
|
|
|
|
data.resize(etl->uncomp_size);
|
|
|
|
Compression::decompress(data.ptrw(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE);
|
|
|
|
|
|
|
|
FileAccessMemory *fa = memnew(FileAccessMemory);
|
|
|
|
fa->open_custom(data.ptr(), data.size());
|
|
|
|
|
2020-03-18 17:34:36 +00:00
|
|
|
Ref<Translation> tr = TranslationLoaderPO::load_translation(fa);
|
2018-01-06 12:17:12 +00:00
|
|
|
|
|
|
|
if (tr.is_valid()) {
|
|
|
|
tr->set_locale(etl->lang);
|
|
|
|
TranslationServer::get_singleton()->set_tool_translation(tr);
|
|
|
|
break;
|
|
|
|
}
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2018-01-06 12:17:12 +00:00
|
|
|
|
|
|
|
etl++;
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2020-03-18 17:34:36 +00:00
|
|
|
|
|
|
|
// Load class reference translation.
|
|
|
|
DocTranslationList *dtl = _doc_translations;
|
|
|
|
while (dtl->data) {
|
|
|
|
if (dtl->lang == lang) {
|
|
|
|
Vector<uint8_t> data;
|
|
|
|
data.resize(dtl->uncomp_size);
|
|
|
|
Compression::decompress(data.ptrw(), dtl->uncomp_size, dtl->data, dtl->comp_size, Compression::MODE_DEFLATE);
|
|
|
|
|
|
|
|
FileAccessMemory *fa = memnew(FileAccessMemory);
|
|
|
|
fa->open_custom(data.ptr(), data.size());
|
|
|
|
|
|
|
|
Ref<Translation> tr = TranslationLoaderPO::load_translation(fa);
|
|
|
|
|
|
|
|
if (tr.is_valid()) {
|
|
|
|
tr->set_locale(dtl->lang);
|
|
|
|
TranslationServer::get_singleton()->set_doc_translation(tr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dtl++;
|
|
|
|
}
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2017-09-19 00:30:48 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::setup_network() {
|
2017-09-19 00:30:48 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
List<IP_Address> local_ip;
|
|
|
|
IP::get_singleton()->get_local_addresses(&local_ip);
|
|
|
|
String hint;
|
|
|
|
String current = has_setting("network/debug/remote_host") ? get("network/debug/remote_host") : "";
|
2019-08-21 15:05:06 +00:00
|
|
|
String selected = "127.0.0.1";
|
2017-01-05 22:41:36 +00:00
|
|
|
|
2019-08-21 15:05:06 +00:00
|
|
|
// Check that current remote_host is a valid interface address and populate hints.
|
2017-10-28 13:40:55 +00:00
|
|
|
for (List<IP_Address>::Element *E = local_ip.front(); E; E = E->next()) {
|
2017-09-19 00:30:48 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
String ip = E->get();
|
2017-09-18 23:30:14 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
// link-local IPv6 addresses don't work, skipping them
|
|
|
|
if (ip.begins_with("fe80:0:0:0:")) // fe80::/64
|
|
|
|
continue;
|
2019-03-31 14:57:23 +00:00
|
|
|
// Same goes for IPv4 link-local (APIPA) addresses.
|
|
|
|
if (ip.begins_with("169.254.")) // 169.254.0.0/16
|
|
|
|
continue;
|
2019-08-21 15:05:06 +00:00
|
|
|
// Select current IP (found)
|
2017-10-28 13:40:55 +00:00
|
|
|
if (ip == current)
|
2019-08-21 15:05:06 +00:00
|
|
|
selected = ip;
|
2017-10-28 13:40:55 +00:00
|
|
|
if (hint != "")
|
|
|
|
hint += ",";
|
|
|
|
hint += ip;
|
|
|
|
}
|
2017-05-01 18:57:35 +00:00
|
|
|
|
2019-08-21 15:05:06 +00:00
|
|
|
// Add hints with valid IP addresses to remote_host property.
|
2017-10-28 13:40:55 +00:00
|
|
|
add_property_hint(PropertyInfo(Variant::STRING, "network/debug/remote_host", PROPERTY_HINT_ENUM, hint));
|
2019-08-21 15:05:06 +00:00
|
|
|
// Fix potentially invalid remote_host due to network change.
|
|
|
|
set("network/debug/remote_host", selected);
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2017-04-25 12:18:08 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::save() {
|
2015-08-06 05:37:40 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
//_THREAD_SAFE_METHOD_
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (!singleton.ptr())
|
|
|
|
return;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (singleton->config_file_path == "") {
|
|
|
|
ERR_PRINT("Cannot save EditorSettings config, no valid path");
|
|
|
|
return;
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Error err = ResourceSaver::save(singleton->config_file_path, singleton);
|
2016-08-16 16:25:42 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (err != OK) {
|
2019-11-06 16:03:04 +00:00
|
|
|
ERR_PRINT("Error saving editor settings to " + singleton->config_file_path);
|
2018-08-24 06:47:34 +00:00
|
|
|
} else {
|
|
|
|
print_verbose("EditorSettings: Save OK!");
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::destroy() {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (!singleton.ptr())
|
|
|
|
return;
|
|
|
|
save();
|
|
|
|
singleton = Ref<EditorSettings>();
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::set_optimize_save(bool p_optimize) {
|
2016-02-21 23:15:47 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
optimize_save = p_optimize;
|
|
|
|
}
|
2016-05-27 17:18:40 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
// Properties
|
2016-02-21 23:15:47 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::set_setting(const String &p_setting, const Variant &p_value) {
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
set(p_setting, p_value);
|
|
|
|
}
|
2016-02-27 15:11:40 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Variant EditorSettings::get_setting(const String &p_setting) const {
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
return get(p_setting);
|
|
|
|
}
|
2016-02-27 15:11:40 +00:00
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
bool EditorSettings::has_setting(const String &p_setting) const {
|
2016-02-27 15:11:40 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
_THREAD_SAFE_METHOD_
|
2016-02-27 15:11:40 +00:00
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
return props.has(p_setting);
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2016-02-27 15:11:40 +00:00
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
void EditorSettings::erase(const String &p_setting) {
|
2016-02-21 23:15:47 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
props.erase(p_setting);
|
2016-04-12 14:45:31 +00:00
|
|
|
}
|
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
void EditorSettings::raise_order(const String &p_setting) {
|
2017-10-28 13:40:55 +00:00
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
ERR_FAIL_COND(!props.has(p_setting));
|
|
|
|
props[p_setting].order = ++last_order;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2018-07-19 21:58:15 +00:00
|
|
|
void EditorSettings::set_restart_if_changed(const StringName &p_setting, bool p_restart) {
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
|
|
|
if (!props.has(p_setting))
|
|
|
|
return;
|
|
|
|
props[p_setting].restart_if_changed = p_restart;
|
|
|
|
}
|
|
|
|
|
2018-01-09 15:52:46 +00:00
|
|
|
void EditorSettings::set_initial_value(const StringName &p_setting, const Variant &p_value, bool p_update_current) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-11-30 03:11:53 +00:00
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
2017-11-17 20:22:27 +00:00
|
|
|
if (!props.has(p_setting))
|
|
|
|
return;
|
2018-01-07 19:39:38 +00:00
|
|
|
props[p_setting].initial = p_value;
|
|
|
|
props[p_setting].has_default_value = true;
|
2018-01-09 15:52:46 +00:00
|
|
|
if (p_update_current) {
|
2018-01-07 19:39:38 +00:00
|
|
|
set(p_setting, p_value);
|
|
|
|
}
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-07-19 21:58:15 +00:00
|
|
|
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_restart_if_changed) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 21:25:28 +00:00
|
|
|
Variant ret = p_default;
|
2018-07-19 21:58:15 +00:00
|
|
|
if (EditorSettings::get_singleton()->has_setting(p_setting)) {
|
2017-10-28 21:25:28 +00:00
|
|
|
ret = EditorSettings::get_singleton()->get(p_setting);
|
2018-07-19 21:58:15 +00:00
|
|
|
} else {
|
2017-11-30 03:11:53 +00:00
|
|
|
EditorSettings::get_singleton()->set_manually(p_setting, p_default);
|
2018-07-19 21:58:15 +00:00
|
|
|
EditorSettings::get_singleton()->set_restart_if_changed(p_setting, p_restart_if_changed);
|
|
|
|
}
|
2017-11-30 03:11:53 +00:00
|
|
|
|
2018-07-19 21:58:15 +00:00
|
|
|
if (!EditorSettings::get_singleton()->has_default_value(p_setting)) {
|
2017-11-20 17:34:13 +00:00
|
|
|
EditorSettings::get_singleton()->set_initial_value(p_setting, p_default);
|
2018-07-19 21:58:15 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-28 21:25:28 +00:00
|
|
|
return ret;
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
Variant _EDITOR_GET(const String &p_setting) {
|
2017-10-28 13:40:55 +00:00
|
|
|
|
2019-06-11 12:49:34 +00:00
|
|
|
ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has_setting(p_setting), Variant());
|
2017-10-31 14:24:35 +00:00
|
|
|
return EditorSettings::get_singleton()->get(p_setting);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
bool EditorSettings::property_can_revert(const String &p_setting) {
|
2016-08-16 20:10:53 +00:00
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
if (!props.has(p_setting))
|
2017-10-28 13:40:55 +00:00
|
|
|
return false;
|
2016-08-16 20:10:53 +00:00
|
|
|
|
2017-11-30 03:11:53 +00:00
|
|
|
if (!props[p_setting].has_default_value)
|
|
|
|
return false;
|
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
return props[p_setting].initial != props[p_setting].variant;
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
2016-08-16 20:10:53 +00:00
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
Variant EditorSettings::property_get_revert(const String &p_setting) {
|
2016-08-16 20:10:53 +00:00
|
|
|
|
2017-11-30 03:11:53 +00:00
|
|
|
if (!props.has(p_setting) || !props[p_setting].has_default_value)
|
2017-10-28 13:40:55 +00:00
|
|
|
return Variant();
|
|
|
|
|
2017-10-31 14:24:35 +00:00
|
|
|
return props[p_setting].initial;
|
2016-08-16 20:10:53 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void EditorSettings::add_property_hint(const PropertyInfo &p_hint) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
hints[p_hint.name] = p_hint;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
// Data directories
|
|
|
|
|
|
|
|
String EditorSettings::get_data_dir() const {
|
|
|
|
|
|
|
|
return data_dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
String EditorSettings::get_templates_dir() const {
|
|
|
|
|
|
|
|
return get_data_dir().plus_file("templates");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Config directories
|
2017-10-28 13:40:55 +00:00
|
|
|
|
2017-11-17 14:50:18 +00:00
|
|
|
String EditorSettings::get_settings_dir() const {
|
2017-10-28 13:40:55 +00:00
|
|
|
|
2017-11-17 14:50:18 +00:00
|
|
|
return settings_dir;
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
|
2017-11-17 14:50:18 +00:00
|
|
|
String EditorSettings::get_project_settings_dir() const {
|
2017-10-28 13:40:55 +00:00
|
|
|
|
2017-11-17 20:48:24 +00:00
|
|
|
return get_settings_dir().plus_file("projects").plus_file(project_config_dir);
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
String EditorSettings::get_text_editor_themes_dir() const {
|
2017-10-28 13:40:55 +00:00
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
return get_settings_dir().plus_file("text_editor_themes");
|
|
|
|
}
|
2017-10-28 13:40:55 +00:00
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
String EditorSettings::get_script_templates_dir() const {
|
|
|
|
|
|
|
|
return get_settings_dir().plus_file("script_templates");
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
|
2019-08-22 15:59:43 +00:00
|
|
|
String EditorSettings::get_project_script_templates_dir() const {
|
|
|
|
|
|
|
|
return ProjectSettings::get_singleton()->get("editor/script_templates_search_path");
|
|
|
|
}
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
// Cache directory
|
|
|
|
|
|
|
|
String EditorSettings::get_cache_dir() const {
|
2017-10-28 13:40:55 +00:00
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
return cache_dir;
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
|
2019-04-08 22:18:03 +00:00
|
|
|
String EditorSettings::get_feature_profiles_dir() const {
|
|
|
|
|
|
|
|
return get_settings_dir().plus_file("feature_profiles");
|
|
|
|
}
|
|
|
|
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
// Metadata
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::set_project_metadata(const String &p_section, const String &p_key, Variant p_data) {
|
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile);
|
2017-11-17 14:50:18 +00:00
|
|
|
String path = get_project_settings_dir().plus_file("project_metadata.cfg");
|
2019-08-07 10:54:30 +00:00
|
|
|
Error err;
|
|
|
|
err = cf->load(path);
|
2019-09-25 08:28:50 +00:00
|
|
|
ERR_FAIL_COND_MSG(err != OK && err != ERR_FILE_NOT_FOUND, "Cannot load editor settings from file '" + path + "'.");
|
2017-10-28 13:40:55 +00:00
|
|
|
cf->set_value(p_section, p_key, p_data);
|
2019-08-07 10:54:30 +00:00
|
|
|
err = cf->save(path);
|
2019-09-25 08:28:50 +00:00
|
|
|
ERR_FAIL_COND_MSG(err != OK, "Cannot save editor settings to file '" + path + "'.");
|
2017-10-28 13:40:55 +00:00
|
|
|
}
|
|
|
|
|
2018-05-16 15:23:20 +00:00
|
|
|
Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const {
|
2017-10-28 13:40:55 +00:00
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile);
|
2017-11-17 14:50:18 +00:00
|
|
|
String path = get_project_settings_dir().plus_file("project_metadata.cfg");
|
2017-10-28 13:40:55 +00:00
|
|
|
Error err = cf->load(path);
|
|
|
|
if (err != OK) {
|
|
|
|
return p_default;
|
|
|
|
}
|
|
|
|
return cf->get_value(p_section, p_key, p_default);
|
|
|
|
}
|
|
|
|
|
2018-09-18 12:02:59 +00:00
|
|
|
void EditorSettings::set_favorites(const Vector<String> &p_favorites) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-09-18 12:02:59 +00:00
|
|
|
favorites = p_favorites;
|
|
|
|
FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorites"), FileAccess::WRITE);
|
2015-06-06 12:44:38 +00:00
|
|
|
if (f) {
|
2018-09-18 12:02:59 +00:00
|
|
|
for (int i = 0; i < favorites.size(); i++)
|
|
|
|
f->store_line(favorites[i]);
|
2015-06-06 12:44:38 +00:00
|
|
|
memdelete(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-18 12:02:59 +00:00
|
|
|
Vector<String> EditorSettings::get_favorites() const {
|
2015-06-06 12:44:38 +00:00
|
|
|
|
2018-09-18 12:02:59 +00:00
|
|
|
return favorites;
|
2015-06-06 12:44:38 +00:00
|
|
|
}
|
|
|
|
|
2017-08-12 16:52:50 +00:00
|
|
|
void EditorSettings::set_recent_dirs(const Vector<String> &p_recent_dirs) {
|
2015-06-06 12:44:38 +00:00
|
|
|
|
2017-08-12 16:52:50 +00:00
|
|
|
recent_dirs = p_recent_dirs;
|
2017-11-17 14:50:18 +00:00
|
|
|
FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("recent_dirs"), FileAccess::WRITE);
|
2015-06-06 12:44:38 +00:00
|
|
|
if (f) {
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < recent_dirs.size(); i++)
|
2015-06-06 12:44:38 +00:00
|
|
|
f->store_line(recent_dirs[i]);
|
|
|
|
memdelete(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector<String> EditorSettings::get_recent_dirs() const {
|
|
|
|
|
|
|
|
return recent_dirs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettings::load_favorites() {
|
|
|
|
|
2018-09-18 12:02:59 +00:00
|
|
|
FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorites"), FileAccess::READ);
|
2015-06-06 12:44:38 +00:00
|
|
|
if (f) {
|
|
|
|
String line = f->get_line().strip_edges();
|
2017-03-05 15:44:50 +00:00
|
|
|
while (line != "") {
|
2018-09-18 12:02:59 +00:00
|
|
|
favorites.push_back(line);
|
2015-06-06 12:44:38 +00:00
|
|
|
line = f->get_line().strip_edges();
|
|
|
|
}
|
|
|
|
memdelete(f);
|
|
|
|
}
|
|
|
|
|
2017-11-17 14:50:18 +00:00
|
|
|
f = FileAccess::open(get_project_settings_dir().plus_file("recent_dirs"), FileAccess::READ);
|
2015-06-06 12:44:38 +00:00
|
|
|
if (f) {
|
|
|
|
String line = f->get_line().strip_edges();
|
2017-03-05 15:44:50 +00:00
|
|
|
while (line != "") {
|
2015-06-06 12:44:38 +00:00
|
|
|
recent_dirs.push_back(line);
|
|
|
|
line = f->get_line().strip_edges();
|
|
|
|
}
|
|
|
|
memdelete(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-10 14:30:49 +00:00
|
|
|
bool EditorSettings::is_dark_theme() {
|
|
|
|
int AUTO_COLOR = 0;
|
|
|
|
int LIGHT_COLOR = 2;
|
|
|
|
Color base_color = get("interface/theme/base_color");
|
|
|
|
int icon_font_color_setting = get("interface/theme/icon_and_font_color");
|
|
|
|
return (icon_font_color_setting == AUTO_COLOR && ((base_color.r + base_color.g + base_color.b) / 3.0) < 0.5) || icon_font_color_setting == LIGHT_COLOR;
|
|
|
|
}
|
|
|
|
|
2016-04-12 14:45:31 +00:00
|
|
|
void EditorSettings::list_text_editor_themes() {
|
2017-12-26 19:41:08 +00:00
|
|
|
String themes = "Adaptive,Default,Custom";
|
2018-09-22 08:02:20 +00:00
|
|
|
|
2017-11-17 20:48:24 +00:00
|
|
|
DirAccess *d = DirAccess::open(get_text_editor_themes_dir());
|
2016-04-12 14:45:31 +00:00
|
|
|
if (d) {
|
2018-09-22 08:02:20 +00:00
|
|
|
List<String> custom_themes;
|
2016-04-12 14:45:31 +00:00
|
|
|
d->list_dir_begin();
|
|
|
|
String file = d->get_next();
|
2017-03-05 15:44:50 +00:00
|
|
|
while (file != String()) {
|
2019-05-23 15:18:24 +00:00
|
|
|
if (file.get_extension() == "tet" && !_is_default_text_editor_theme(file.get_basename().to_lower())) {
|
2018-09-22 08:02:20 +00:00
|
|
|
custom_themes.push_back(file.get_basename());
|
2016-04-12 14:45:31 +00:00
|
|
|
}
|
|
|
|
file = d->get_next();
|
|
|
|
}
|
|
|
|
d->list_dir_end();
|
|
|
|
memdelete(d);
|
2018-09-22 08:02:20 +00:00
|
|
|
|
|
|
|
custom_themes.sort();
|
|
|
|
for (List<String>::Element *E = custom_themes.front(); E; E = E->next()) {
|
|
|
|
themes += "," + E->get();
|
|
|
|
}
|
2016-04-12 14:45:31 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
add_property_hint(PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, themes));
|
2016-04-12 14:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettings::load_text_editor_theme() {
|
2019-05-23 15:18:24 +00:00
|
|
|
String p_file = get("text_editor/theme/color_theme");
|
|
|
|
|
|
|
|
if (_is_default_text_editor_theme(p_file.get_file().to_lower())) {
|
|
|
|
if (p_file == "Default") {
|
2018-01-06 11:40:43 +00:00
|
|
|
_load_default_text_editor_theme();
|
|
|
|
}
|
|
|
|
return; // sorry for "Settings changed" console spam
|
2016-04-12 14:45:31 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 15:18:24 +00:00
|
|
|
String theme_path = get_text_editor_themes_dir().plus_file(p_file + ".tet");
|
2016-04-12 14:45:31 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile);
|
2016-04-12 14:45:31 +00:00
|
|
|
Error err = cf->load(theme_path);
|
|
|
|
|
|
|
|
if (err != OK) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> keys;
|
|
|
|
cf->get_section_keys("color_theme", &keys);
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<String>::Element *E = keys.front(); E; E = E->next()) {
|
2016-04-12 14:45:31 +00:00
|
|
|
String key = E->get();
|
|
|
|
String val = cf->get_value("color_theme", key);
|
|
|
|
|
|
|
|
// don't load if it's not already there!
|
2017-10-05 18:34:34 +00:00
|
|
|
if (has_setting("text_editor/highlighting/" + key)) {
|
2016-04-12 14:45:31 +00:00
|
|
|
|
|
|
|
// make sure it is actually a color
|
|
|
|
if (val.is_valid_html_color() && key.find("color") >= 0) {
|
2017-03-05 15:44:50 +00:00
|
|
|
props["text_editor/highlighting/" + key].variant = Color::html(val); // change manually to prevent "Settings changed" console spam
|
2016-04-12 14:45:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
emit_signal("settings_changed");
|
|
|
|
// if it doesn't load just use what is currently loaded
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorSettings::import_text_editor_theme(String p_file) {
|
|
|
|
|
|
|
|
if (!p_file.ends_with(".tet")) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
if (p_file.get_file().to_lower() == "default.tet") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-11-17 20:48:24 +00:00
|
|
|
DirAccess *d = DirAccess::open(get_text_editor_themes_dir());
|
2016-04-12 14:45:31 +00:00
|
|
|
if (d) {
|
2017-11-17 20:48:24 +00:00
|
|
|
d->copy(p_file, get_text_editor_themes_dir().plus_file(p_file.get_file()));
|
2016-04-12 14:45:31 +00:00
|
|
|
memdelete(d);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorSettings::save_text_editor_theme() {
|
|
|
|
|
2017-01-05 22:41:36 +00:00
|
|
|
String p_file = get("text_editor/theme/color_theme");
|
2016-04-12 14:45:31 +00:00
|
|
|
|
2019-05-23 15:18:24 +00:00
|
|
|
if (_is_default_text_editor_theme(p_file.get_file().to_lower())) {
|
2016-04-12 14:45:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
2017-11-17 20:48:24 +00:00
|
|
|
String theme_path = get_text_editor_themes_dir().plus_file(p_file + ".tet");
|
2016-04-12 14:45:31 +00:00
|
|
|
return _save_text_editor_theme(theme_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorSettings::save_text_editor_theme_as(String p_file) {
|
|
|
|
if (!p_file.ends_with(".tet")) {
|
|
|
|
p_file += ".tet";
|
|
|
|
}
|
|
|
|
|
2019-05-23 15:18:24 +00:00
|
|
|
if (_is_default_text_editor_theme(p_file.get_file().to_lower().trim_suffix(".tet"))) {
|
2016-04-12 14:45:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
if (_save_text_editor_theme(p_file)) {
|
2016-04-12 14:45:31 +00:00
|
|
|
|
|
|
|
// switch to theme is saved in the theme directory
|
|
|
|
list_text_editor_themes();
|
|
|
|
String theme_name = p_file.substr(0, p_file.length() - 4).get_file();
|
|
|
|
|
2017-11-17 20:48:24 +00:00
|
|
|
if (p_file.get_base_dir() == get_text_editor_themes_dir()) {
|
2017-09-25 03:26:41 +00:00
|
|
|
_initial_set("text_editor/theme/color_theme", theme_name);
|
2016-04-12 14:45:31 +00:00
|
|
|
load_text_editor_theme();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-05-23 15:18:24 +00:00
|
|
|
bool EditorSettings::is_default_text_editor_theme() {
|
|
|
|
String p_file = get("text_editor/theme/color_theme");
|
|
|
|
return _is_default_text_editor_theme(p_file.get_file().to_lower());
|
|
|
|
}
|
|
|
|
|
2019-08-22 15:59:43 +00:00
|
|
|
Vector<String> EditorSettings::get_script_templates(const String &p_extension, const String &p_custom_path) {
|
2017-06-13 20:03:08 +00:00
|
|
|
|
|
|
|
Vector<String> templates;
|
2019-08-22 15:59:43 +00:00
|
|
|
String template_dir = get_script_templates_dir();
|
|
|
|
if (!p_custom_path.empty()) {
|
|
|
|
template_dir = p_custom_path;
|
|
|
|
}
|
|
|
|
DirAccess *d = DirAccess::open(template_dir);
|
2017-06-13 20:03:08 +00:00
|
|
|
if (d) {
|
|
|
|
d->list_dir_begin();
|
|
|
|
String file = d->get_next();
|
|
|
|
while (file != String()) {
|
|
|
|
if (file.get_extension() == p_extension) {
|
|
|
|
templates.push_back(file.get_basename());
|
|
|
|
}
|
|
|
|
file = d->get_next();
|
|
|
|
}
|
|
|
|
d->list_dir_end();
|
|
|
|
memdelete(d);
|
|
|
|
}
|
|
|
|
return templates;
|
|
|
|
}
|
|
|
|
|
2017-11-17 20:48:24 +00:00
|
|
|
String EditorSettings::get_editor_layouts_config() const {
|
|
|
|
|
|
|
|
return get_settings_dir().plus_file("editor_layouts.cfg");
|
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
// Shortcuts
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void EditorSettings::add_shortcut(const String &p_name, Ref<ShortCut> &p_shortcut) {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
shortcuts[p_name] = p_shortcut;
|
2016-06-05 00:31:29 +00:00
|
|
|
}
|
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
bool EditorSettings::is_shortcut(const String &p_name, const Ref<InputEvent> &p_event) const {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2020-03-17 06:33:00 +00:00
|
|
|
const Map<String, Ref<ShortCut>>::Element *E = shortcuts.find(p_name);
|
2019-08-15 02:57:49 +00:00
|
|
|
ERR_FAIL_COND_V_MSG(!E, false, "Unknown Shortcut: " + p_name + ".");
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
return E->get()->is_shortcut(p_event);
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Ref<ShortCut> EditorSettings::get_shortcut(const String &p_name) const {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2020-03-17 06:33:00 +00:00
|
|
|
const Map<String, Ref<ShortCut>>::Element *E = shortcuts.find(p_name);
|
2016-06-05 00:31:29 +00:00
|
|
|
if (!E)
|
|
|
|
return Ref<ShortCut>();
|
|
|
|
|
|
|
|
return E->get();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) {
|
|
|
|
|
2020-03-17 06:33:00 +00:00
|
|
|
for (const Map<String, Ref<ShortCut>>::Element *E = shortcuts.front(); E; E = E->next()) {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
r_shortcuts->push_back(E->key());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) {
|
2016-07-03 22:13:45 +00:00
|
|
|
|
2019-06-01 13:42:22 +00:00
|
|
|
if (!EditorSettings::get_singleton()) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
|
2019-08-15 02:57:49 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND_V_MSG(!sc.is_valid(), sc, "Used ED_GET_SHORTCUT with invalid shortcut: " + p_path + ".");
|
2017-10-28 13:40:55 +00:00
|
|
|
|
|
|
|
return sc;
|
2016-07-03 22:13:45 +00:00
|
|
|
}
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-12-26 06:30:36 +00:00
|
|
|
struct ShortCutMapping {
|
|
|
|
const char *path;
|
|
|
|
uint32_t keycode;
|
|
|
|
};
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode) {
|
|
|
|
|
2017-12-26 06:30:36 +00:00
|
|
|
#ifdef OSX_ENABLED
|
2018-06-11 05:53:25 +00:00
|
|
|
// Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
|
2017-12-26 06:30:36 +00:00
|
|
|
if (p_keycode == KEY_DELETE) {
|
|
|
|
p_keycode = KEY_MASK_CMD | KEY_BACKSPACE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Ref<InputEventKey> ie;
|
|
|
|
if (p_keycode) {
|
|
|
|
ie.instance();
|
|
|
|
|
|
|
|
ie->set_unicode(p_keycode & KEY_CODE_MASK);
|
2018-04-05 17:59:35 +00:00
|
|
|
ie->set_keycode(p_keycode & KEY_CODE_MASK);
|
2017-10-28 13:40:55 +00:00
|
|
|
ie->set_shift(bool(p_keycode & KEY_MASK_SHIFT));
|
|
|
|
ie->set_alt(bool(p_keycode & KEY_MASK_ALT));
|
|
|
|
ie->set_control(bool(p_keycode & KEY_MASK_CTRL));
|
|
|
|
ie->set_metakey(bool(p_keycode & KEY_MASK_META));
|
2016-10-12 20:23:48 +00:00
|
|
|
}
|
|
|
|
|
2019-06-01 13:42:22 +00:00
|
|
|
if (!EditorSettings::get_singleton()) {
|
|
|
|
Ref<ShortCut> sc;
|
|
|
|
sc.instance();
|
|
|
|
sc->set_name(p_name);
|
|
|
|
sc->set_shortcut(ie);
|
|
|
|
sc->set_meta("original", ie);
|
|
|
|
return sc;
|
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
|
|
|
|
if (sc.is_valid()) {
|
2016-10-12 20:23:48 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
sc->set_name(p_name); //keep name (the ones that come from disk have no name)
|
|
|
|
sc->set_meta("original", ie); //to compare against changes
|
|
|
|
return sc;
|
|
|
|
}
|
2017-09-25 03:26:41 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
sc.instance();
|
|
|
|
sc->set_name(p_name);
|
|
|
|
sc->set_shortcut(ie);
|
|
|
|
sc->set_meta("original", ie); //to compare against changes
|
|
|
|
EditorSettings::get_singleton()->add_shortcut(p_path, sc);
|
2017-09-25 03:26:41 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
return sc;
|
2017-09-25 03:26:41 +00:00
|
|
|
}
|
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
void EditorSettings::notify_changes() {
|
2017-09-25 03:26:41 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
_THREAD_SAFE_METHOD_
|
2017-09-25 03:26:41 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
SceneTree *sml = Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop());
|
2017-09-25 03:26:41 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
if (!sml) {
|
|
|
|
return;
|
|
|
|
}
|
2017-09-25 03:26:41 +00:00
|
|
|
|
2017-10-28 13:40:55 +00:00
|
|
|
Node *root = sml->get_root()->get_child(0);
|
|
|
|
|
|
|
|
if (!root) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
root->propagate_notification(NOTIFICATION_EDITOR_SETTINGS_CHANGED);
|
2017-09-25 03:26:41 +00:00
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void EditorSettings::_bind_methods() {
|
|
|
|
|
2017-10-05 18:34:34 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("has_setting", "name"), &EditorSettings::has_setting);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &EditorSettings::set_setting);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_setting", "name"), &EditorSettings::get_setting);
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("erase", "property"), &EditorSettings::erase);
|
2018-01-09 15:52:46 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value", "update_current"), &EditorSettings::set_initial_value);
|
2017-10-28 13:40:55 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &EditorSettings::property_can_revert);
|
|
|
|
ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &EditorSettings::property_get_revert);
|
|
|
|
ClassDB::bind_method(D_METHOD("add_property_info", "info"), &EditorSettings::_add_property_info_bind);
|
|
|
|
|
2017-11-17 14:50:18 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("get_settings_dir"), &EditorSettings::get_settings_dir);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_project_settings_dir"), &EditorSettings::get_project_settings_dir);
|
2016-02-27 03:32:00 +00:00
|
|
|
|
2018-05-16 15:23:20 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_project_metadata", "section", "key", "data"), &EditorSettings::set_project_metadata);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_project_metadata", "section", "key", "default"), &EditorSettings::get_project_metadata, DEFVAL(Variant()));
|
|
|
|
|
2018-09-18 12:02:59 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_favorites", "dirs"), &EditorSettings::set_favorites);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_favorites"), &EditorSettings::get_favorites);
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_recent_dirs", "dirs"), &EditorSettings::set_recent_dirs);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_recent_dirs"), &EditorSettings::get_recent_dirs);
|
2016-02-27 03:32:00 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
ADD_SIGNAL(MethodInfo("settings_changed"));
|
2019-07-03 07:44:53 +00:00
|
|
|
|
|
|
|
BIND_CONSTANT(NOTIFICATION_EDITOR_SETTINGS_CHANGED);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EditorSettings::EditorSettings() {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
last_order = 0;
|
|
|
|
optimize_save = true;
|
|
|
|
save_changed_setting = true;
|
2016-05-27 22:58:28 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
_load_defaults();
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorSettings::~EditorSettings() {
|
|
|
|
}
|