You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Fixed editor settings disappearing.
Some items that are no longer defined may disappear, but thats expected i guess.
This commit is contained in:
@@ -135,6 +135,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
|
|||||||
void EditorSettings::_initial_set(const StringName &p_name, const Variant &p_value) {
|
void EditorSettings::_initial_set(const StringName &p_name, const Variant &p_value) {
|
||||||
set(p_name, p_value);
|
set(p_name, p_value);
|
||||||
props[p_name].initial = p_value;
|
props[p_name].initial = p_value;
|
||||||
|
props[p_name].initial_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct _EVCSort {
|
struct _EVCSort {
|
||||||
@@ -214,6 +215,14 @@ void EditorSettings::_add_property_info_bind(const Dictionary &p_info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Default configs
|
// Default configs
|
||||||
|
bool EditorSettings::has_default_value(const String &p_setting) const {
|
||||||
|
|
||||||
|
_THREAD_SAFE_METHOD_
|
||||||
|
|
||||||
|
if (!props.has(p_setting))
|
||||||
|
return false;
|
||||||
|
return props[p_setting].initial_set;
|
||||||
|
}
|
||||||
|
|
||||||
void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
||||||
|
|
||||||
@@ -834,10 +843,10 @@ void EditorSettings::setup_network() {
|
|||||||
hint += ip;
|
hint += ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
set("network/debug/remote_host", lip);
|
_initial_set("network/debug/remote_host", lip);
|
||||||
add_property_hint(PropertyInfo(Variant::STRING, "network/debug/remote_host", PROPERTY_HINT_ENUM, hint));
|
add_property_hint(PropertyInfo(Variant::STRING, "network/debug/remote_host", PROPERTY_HINT_ENUM, hint));
|
||||||
|
|
||||||
set("network/debug/remote_port", port);
|
_initial_set("network/debug/remote_port", port);
|
||||||
add_property_hint(PropertyInfo(Variant::INT, "network/debug/remote_port", PROPERTY_HINT_RANGE, "1,65535,1"));
|
add_property_hint(PropertyInfo(Variant::INT, "network/debug/remote_port", PROPERTY_HINT_RANGE, "1,65535,1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -915,16 +924,20 @@ void EditorSettings::set_initial_value(const StringName &p_setting, const Varian
|
|||||||
|
|
||||||
ERR_FAIL_COND(!props.has(p_setting));
|
ERR_FAIL_COND(!props.has(p_setting));
|
||||||
props[p_setting].initial = p_value;
|
props[p_setting].initial = p_value;
|
||||||
|
props[p_setting].initial_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default) {
|
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default) {
|
||||||
|
|
||||||
|
Variant ret = p_default;
|
||||||
if (EditorSettings::get_singleton()->has_setting(p_setting))
|
if (EditorSettings::get_singleton()->has_setting(p_setting))
|
||||||
return EditorSettings::get_singleton()->get(p_setting);
|
ret = EditorSettings::get_singleton()->get(p_setting);
|
||||||
EditorSettings::get_singleton()->set(p_setting, p_default);
|
if (!EditorSettings::get_singleton()->has_default_value(p_setting)) {
|
||||||
EditorSettings::get_singleton()->set_initial_value(p_setting, p_default);
|
EditorSettings::get_singleton()->set_initial_value(p_setting, p_default);
|
||||||
|
EditorSettings::get_singleton()->set(p_setting, p_default);
|
||||||
|
}
|
||||||
|
|
||||||
return p_default;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant _EDITOR_GET(const String &p_setting) {
|
Variant _EDITOR_GET(const String &p_setting) {
|
||||||
|
|||||||
@@ -66,11 +66,13 @@ private:
|
|||||||
int order;
|
int order;
|
||||||
Variant variant;
|
Variant variant;
|
||||||
Variant initial;
|
Variant initial;
|
||||||
|
bool initial_set;
|
||||||
bool hide_from_editor;
|
bool hide_from_editor;
|
||||||
bool save;
|
bool save;
|
||||||
VariantContainer() {
|
VariantContainer() {
|
||||||
order = 0;
|
order = 0;
|
||||||
hide_from_editor = false;
|
hide_from_editor = false;
|
||||||
|
initial_set = false;
|
||||||
save = false;
|
save = false;
|
||||||
}
|
}
|
||||||
VariantContainer(const Variant &p_variant, int p_order) {
|
VariantContainer(const Variant &p_variant, int p_order) {
|
||||||
@@ -128,6 +130,7 @@ public:
|
|||||||
static void destroy();
|
static void destroy();
|
||||||
void set_optimize_save(bool p_optimize);
|
void set_optimize_save(bool p_optimize);
|
||||||
|
|
||||||
|
bool has_default_value(const String &p_setting) const;
|
||||||
void set_setting(const String &p_setting, const Variant &p_value);
|
void set_setting(const String &p_setting, const Variant &p_value);
|
||||||
Variant get_setting(const String &p_setting) const;
|
Variant get_setting(const String &p_setting) const;
|
||||||
bool has_setting(const String &p_setting) const;
|
bool has_setting(const String &p_setting) const;
|
||||||
|
|||||||
@@ -365,16 +365,14 @@ GodotSharpBuilds::GodotSharpBuilds() {
|
|||||||
|
|
||||||
// Build tool settings
|
// Build tool settings
|
||||||
EditorSettings *ed_settings = EditorSettings::get_singleton();
|
EditorSettings *ed_settings = EditorSettings::get_singleton();
|
||||||
if (!ed_settings->has_setting("mono/builds/build_tool")) {
|
EDITOR_DEF("mono/builds/build_tool",
|
||||||
ed_settings->set_setting("mono/builds/build_tool",
|
|
||||||
#ifdef WINDOWS_ENABLED
|
#ifdef WINDOWS_ENABLED
|
||||||
// TODO: Default to MSBUILD_MONO if its csc.exe issue is fixed in the installed mono version
|
// TODO: Default to MSBUILD_MONO if its csc.exe issue is fixed in the installed mono version
|
||||||
MSBUILD
|
MSBUILD
|
||||||
#else
|
#else
|
||||||
MSBUILD_MONO
|
MSBUILD_MONO
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
|
||||||
ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/builds/build_tool", PROPERTY_HINT_ENUM,
|
ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/builds/build_tool", PROPERTY_HINT_ENUM,
|
||||||
#ifdef WINDOWS_ENABLED
|
#ifdef WINDOWS_ENABLED
|
||||||
"MSBuild (Mono),MSBuild (System)"
|
"MSBuild (Mono),MSBuild (System)"
|
||||||
|
|||||||
@@ -221,9 +221,7 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
|
|||||||
|
|
||||||
// External editor settings
|
// External editor settings
|
||||||
EditorSettings *ed_settings = EditorSettings::get_singleton();
|
EditorSettings *ed_settings = EditorSettings::get_singleton();
|
||||||
if (!ed_settings->has_setting("mono/editor/external_editor")) {
|
EDITOR_DEF("mono/editor/external_editor", EDITOR_NONE);
|
||||||
ed_settings->set_setting("mono/editor/external_editor", EDITOR_NONE);
|
|
||||||
}
|
|
||||||
ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/editor/external_editor", PROPERTY_HINT_ENUM, "None,MonoDevelop,Visual Studio Code"));
|
ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/editor/external_editor", PROPERTY_HINT_ENUM, "None,MonoDevelop,Visual Studio Code"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user