DocData: Skip language-specific ClassDoc without methods/constants

Removes the useless `@C#`, `@NativeScript` and `@VisualScript` entries.

(cherry picked from commit ba0db95909)
This commit is contained in:
Rémi Verschelde 2020-06-17 15:06:13 +02:00
parent dc7f555783
commit bf913d6917
8 changed files with 16 additions and 48 deletions

View File

@ -30,6 +30,9 @@
<member name="Geometry" type="Geometry" setter="" getter=""> <member name="Geometry" type="Geometry" setter="" getter="">
The [Geometry] singleton. The [Geometry] singleton.
</member> </member>
<member name="GodotSharp" type="GodotSharp" setter="" getter="">
The [GodotSharp] singleton.
</member>
<member name="IP" type="IP" setter="" getter=""> <member name="IP" type="IP" setter="" getter="">
The [IP] singleton. The [IP] singleton.
</member> </member>

View File

@ -643,7 +643,9 @@ void DocData::generate(bool p_basic_types) {
} }
} }
//built in script reference // Built-in script reference.
// We only add a doc entry for languages which actually define any built-in
// methods or constants.
{ {
@ -651,12 +653,11 @@ void DocData::generate(bool p_basic_types) {
ScriptLanguage *lang = ScriptServer::get_language(i); ScriptLanguage *lang = ScriptServer::get_language(i);
String cname = "@" + lang->get_name(); String cname = "@" + lang->get_name();
class_list[cname] = ClassDoc(); ClassDoc c;
ClassDoc &c = class_list[cname];
c.name = cname; c.name = cname;
// Get functions.
List<MethodInfo> minfo; List<MethodInfo> minfo;
lang->get_public_functions(&minfo); lang->get_public_functions(&minfo);
for (List<MethodInfo>::Element *E = minfo.front(); E; E = E->next()) { for (List<MethodInfo>::Element *E = minfo.front(); E; E = E->next()) {
@ -690,6 +691,7 @@ void DocData::generate(bool p_basic_types) {
c.methods.push_back(md); c.methods.push_back(md);
} }
// Get constants.
List<Pair<String, Variant> > cinfo; List<Pair<String, Variant> > cinfo;
lang->get_public_constants(&cinfo); lang->get_public_constants(&cinfo);
@ -700,6 +702,13 @@ void DocData::generate(bool p_basic_types) {
cd.value = E->get().second; cd.value = E->get().second;
c.constants.push_back(cd); c.constants.push_back(cd);
} }
// Skip adding the lang if it doesn't expose anything (e.g. C#).
if (c.methods.empty() && c.constants.empty()) {
continue;
}
class_list[cname] = c;
} }
} }
} }

View File

@ -8,7 +8,6 @@ def configure(env):
def get_doc_classes(): def get_doc_classes():
return [ return [
"@NativeScript",
"ARVRInterfaceGDNative", "ARVRInterfaceGDNative",
"GDNative", "GDNative",
"GDNativeLibrary", "GDNativeLibrary",

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="@NativeScript" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<constants>
</constants>
</class>

View File

@ -57,7 +57,6 @@ def configure(env):
def get_doc_classes(): def get_doc_classes():
return [ return [
"@C#",
"CSharpScript", "CSharpScript",
"GodotSharp", "GodotSharp",
] ]

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="@C#" category="Core" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<constants>
</constants>
</class>

View File

@ -8,7 +8,6 @@ def configure(env):
def get_doc_classes(): def get_doc_classes():
return [ return [
"@VisualScript",
"VisualScriptBasicTypeConstant", "VisualScriptBasicTypeConstant",
"VisualScriptBuiltinFunc", "VisualScriptBuiltinFunc",
"VisualScriptClassConstant", "VisualScriptClassConstant",

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="@VisualScript" version="3.2">
<brief_description>
Built-in visual script functions.
</brief_description>
<description>
A list of built-in visual script functions, see [VisualScriptBuiltinFunc] and [VisualScript].
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<constants>
</constants>
</class>