Skip to content

Commit

Permalink
Merge pull request #76910 from AThousandShips/inspector_fix
Browse files Browse the repository at this point in the history
Make `EditorPropertyNameProcessor` check `EditorSettings` validity
  • Loading branch information
akien-mga committed May 10, 2023
2 parents 104de1a + 6cd9d72 commit 4e1d5be
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions editor/editor_property_name_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
EditorPropertyNameProcessor *EditorPropertyNameProcessor::singleton = nullptr;

EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_default_inspector_style() {
if (!EditorSettings::get_singleton()) {
return STYLE_CAPITALIZED;
}
const Style style = (Style)EDITOR_GET("interface/inspector/default_property_name_style").operator int();
if (style == STYLE_LOCALIZED && !is_localization_available()) {
return STYLE_CAPITALIZED;
Expand All @@ -44,6 +47,9 @@ EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_default_insp
}

EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_settings_style() {
if (!EditorSettings::get_singleton()) {
return STYLE_LOCALIZED;
}
const bool translate = EDITOR_GET("interface/editor/localize_settings");
return translate ? STYLE_LOCALIZED : STYLE_CAPITALIZED;
}
Expand All @@ -53,6 +59,9 @@ EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_tooltip_styl
}

bool EditorPropertyNameProcessor::is_localization_available() {
if (!EditorSettings::get_singleton()) {
return false;
}
const Vector<String> forbidden = String("en").split(",");
return forbidden.find(EDITOR_GET("interface/editor/editor_language")) == -1;
}
Expand Down

0 comments on commit 4e1d5be

Please sign in to comment.