Merge pull request #204 from monxa/fix-editor-setting-gdextension

Fix editor setting initialization for GDExtensions
This commit is contained in:
Serhii Snitsaruk 2024-09-03 02:23:28 +02:00 committed by GitHub
commit d972b2e7ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 5 deletions

View File

@ -1464,12 +1464,17 @@ LimboAIEditor::LimboAIEditor() {
EDITOR_SETTINGS()->add_property_hint(PropertyInfo(Variant::INT, "limbo_ai/editor/layout", PROPERTY_HINT_ENUM, "Classic:0,Widescreen Optimized:1")); EDITOR_SETTINGS()->add_property_hint(PropertyInfo(Variant::INT, "limbo_ai/editor/layout", PROPERTY_HINT_ENUM, "Classic:0,Widescreen Optimized:1"));
EDITOR_SETTINGS()->set_restart_if_changed("limbo_ai/editor/layout", true); EDITOR_SETTINGS()->set_restart_if_changed("limbo_ai/editor/layout", true);
#elif LIMBOAI_GDEXTENSION #elif LIMBOAI_GDEXTENSION
Dictionary pinfo; PropertyInfo pinfo;
pinfo["name"] = "limbo_ai/editor/layout"; pinfo.name = "limbo_ai/editor/layout";
pinfo["type"] = Variant::INT; pinfo.type = Variant::INT;
pinfo["hint"] = PROPERTY_HINT_ENUM; pinfo.hint = PROPERTY_HINT_ENUM;
pinfo["hint_string"] = "Classic:0,Widescreen Optimized:1"; pinfo.hint_string = "Classic:0,Widescreen Optimized:1";
EDITOR_SETTINGS()->add_property_info(pinfo); EDITOR_SETTINGS()->add_property_info(pinfo);
// Hotfix: Ensure the property is set (EditorInterface->get_singleton()->set_initial_value(m_setting, m_value, false) appears insufficient.)
if (!EDITOR_SETTINGS()->has_setting("limbo_ai/editor/layout")) {
EDITOR_SETTINGS()->set_setting("limbo_ai/editor/layout", 0);
}
#endif #endif
LW_SHORTCUT("limbo_ai/rename_task", TTR("Rename"), LW_KEY(F2)); LW_SHORTCUT("limbo_ai/rename_task", TTR("Rename"), LW_KEY(F2));