Ver Fonte

Merge pull request #89086 from Mickeon/documentation-ProjectSettings-members-display-nice

Improve how Project & Editor Settings look in built-in docs
Rémi Verschelde há 1 ano atrás
pai
commit
0fefbe85fb
1 ficheiros alterados com 26 adições e 3 exclusões
  1. 26 3
      editor/editor_help.cpp

+ 26 - 3
editor/editor_help.cpp

@@ -2513,11 +2513,34 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control
 			} else if (link_tag == "annotation") {
 			} else if (link_tag == "annotation") {
 				target_color = link_annotation_color;
 				target_color = link_annotation_color;
 			}
 			}
+
 			p_rt->push_color(target_color);
 			p_rt->push_color(target_color);
 			p_rt->push_meta("@" + link_tag + " " + link_target);
 			p_rt->push_meta("@" + link_tag + " " + link_target);
-			p_rt->add_text(link_target + (link_tag == "method" ? "()" : ""));
-			p_rt->pop();
-			p_rt->pop();
+
+			if (link_tag == "member" &&
+					((!link_target.contains(".") && (p_class == "ProjectSettings" || p_class == "EditorSettings")) ||
+							link_target.begins_with("ProjectSettings.") || link_target.begins_with("EditorSettings."))) {
+				// Special formatting for both ProjectSettings and EditorSettings.
+				String prefix;
+				if (link_target.begins_with("EditorSettings.")) {
+					prefix = "(" + TTR("Editor") + ") ";
+				}
+
+				const String setting_name = link_target.trim_prefix("ProjectSettings.").trim_prefix("EditorSettings.");
+				PackedStringArray setting_sections;
+				for (const String &section : setting_name.split("/", false)) {
+					setting_sections.append(EditorPropertyNameProcessor::get_singleton()->process_name(section, EditorPropertyNameProcessor::get_settings_style()));
+				}
+
+				p_rt->push_bold();
+				p_rt->add_text(prefix + String(" > ").join(setting_sections));
+				p_rt->pop(); // bold
+			} else {
+				p_rt->add_text(link_target + (link_tag == "method" ? "()" : ""));
+			}
+
+			p_rt->pop(); // meta
+			p_rt->pop(); // color
 
 
 			p_rt->pop(); // font size
 			p_rt->pop(); // font size
 			p_rt->pop(); // font
 			p_rt->pop(); // font