Browse Source

Fix enum tooltip with no description

(cherry picked from commit c0453a544d10858672b635de0a75e385c532e333)
MewPurPur 2 years ago
parent
commit
ab14aa9f16
1 changed files with 2 additions and 1 deletions
  1. 2 1
      editor/editor_inspector.cpp

+ 2 - 1
editor/editor_inspector.cpp

@@ -3184,10 +3184,11 @@ void EditorInspector::update_tree() {
 										if (val.enumeration == enum_name && !val.name.ends_with("_MAX")) {
 											const String enum_value = EditorPropertyNameProcessor::get_singleton()->process_name(val.name, EditorPropertyNameProcessor::STYLE_CAPITALIZED);
 											// Prettify the enum value display, so that "<ENUM NAME>_<VALUE>" becomes "Value".
+											String desc = DTR(val.description).trim_prefix("\n");
 											doc_info.description += vformat(
 													"\n[b]%s:[/b] %s",
 													enum_value.trim_prefix(EditorPropertyNameProcessor::get_singleton()->process_name(enum_name, EditorPropertyNameProcessor::STYLE_CAPITALIZED) + " "),
-													DTR(val.description).trim_prefix("\n"));
+													desc.is_empty() ? ("[i]" + TTR("No description.") + "[/i]") : desc);
 										}
 									}
 								}