From 0ab9d2b6458029960a3e4174a642dd975dd11f63 Mon Sep 17 00:00:00 2001 From: Lazy-Rabbit-2001 <2733679597@qq.com> Date: Thu, 17 Oct 2024 00:16:18 +0800 Subject: [PATCH] dunno why there are no footprints for private and protected signals and members... --- doc/tools/make_rst.py | 12 ++++++++++-- modules/gdscript/editor/gdscript_docgen.cpp | 17 +++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py index 7b2d057d81..13d21af920 100755 --- a/doc/tools/make_rst.py +++ b/doc/tools/make_rst.py @@ -63,12 +63,12 @@ "This method accepts any number of arguments after the ones described here.", "This method is used to construct a type.", "This method doesn't need an instance to be called, so it can be called directly using the class name.", - "This method describes a valid operator to use with this type as left-hand operand.", "This exported signal can only be accessed from the inspector or the class that contains the signal.", "This exported signal can only be accessed from the inspector or the class that contains the signal, or whose derived classes.", "This exported property can only be accessed from the inspector or the class that contains the signal.", "This exported property can only be accessed from the inspector or the class that contains the signal, or whose derived classes.", "This value is an integer composed as a bitmask of the following flags.", + "This method describes a valid operator to use with this type as left-hand operand.", "No return value.", "There is currently no description for this class. Please help us by :ref:`contributing one `!", "There is currently no description for this signal. Please help us by :ref:`contributing one `!", @@ -207,6 +207,8 @@ def parse_class(self, class_root: ET.Element, filepath: str) -> None: assert property.tag == "member" property_name = property.attrib["name"] + qualifiers = property.get("qualifiers") + if property_name in class_def.properties: print_error(f'{class_name}.xml: Duplicate property "{property_name}".', self) continue @@ -373,6 +375,7 @@ def parse_class(self, class_root: ET.Element, filepath: str) -> None: assert signal.tag == "signal" signal_name = signal.attrib["name"] + qualifiers = property.get("qualifiers") if signal_name in class_def.signals: print_error(f'{class_name}.xml: Duplicate signal "{signal_name}".', self) @@ -1063,6 +1066,11 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: else: ref = f":ref:`{property_def.name}`" ml.append((type_rst, ref, default)) + + qualifiers = property_def.qualifiers + if qualifiers is not None: + for q in qualifiers.split(): + ml.append((f" |{q}|")) format_table(f, ml, True) @@ -1585,7 +1593,7 @@ def make_method_signature( ret_type = definition.return_type.to_rst(state) qualifiers = None - if isinstance(definition, (MethodDef, AnnotationDef)): + if isinstance(definition, (MethodDef, AnnotationDef, SignalDef)): qualifiers = definition.qualifiers out = "" diff --git a/modules/gdscript/editor/gdscript_docgen.cpp b/modules/gdscript/editor/gdscript_docgen.cpp index c5a9f8774d..3d3d872a0e 100644 --- a/modules/gdscript/editor/gdscript_docgen.cpp +++ b/modules/gdscript/editor/gdscript_docgen.cpp @@ -453,7 +453,12 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_ signal_doc.deprecated_message = m_signal->doc_data.deprecated_message; signal_doc.is_experimental = m_signal->doc_data.is_experimental; signal_doc.experimental_message = m_signal->doc_data.experimental_message; - + for (const GDP::ParameterNode *p : m_signal->parameters) { + DocData::ArgumentDoc arg_doc; + arg_doc.name = p->identifier->name; + _doctype_from_gdtype(p->get_datatype(), arg_doc.type, arg_doc.enumeration); + signal_doc.arguments.push_back(arg_doc); + } switch (m_signal->access_restriction) { case GDP::Node::ACCESS_RESTRICTION_PRIVATE: signal_doc.qualifiers = "private_signal"; @@ -465,13 +470,6 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_ break; } - for (const GDP::ParameterNode *p : m_signal->parameters) { - DocData::ArgumentDoc arg_doc; - arg_doc.name = p->identifier->name; - _doctype_from_gdtype(p->get_datatype(), arg_doc.type, arg_doc.enumeration); - signal_doc.arguments.push_back(arg_doc); - } - doc.signals.push_back(signal_doc); } break; @@ -492,8 +490,6 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_ prop_doc.deprecated_message = m_var->doc_data.deprecated_message; prop_doc.is_experimental = m_var->doc_data.is_experimental; prop_doc.experimental_message = m_var->doc_data.experimental_message; - _doctype_from_gdtype(m_var->get_datatype(), prop_doc.type, prop_doc.enumeration); - if (m_var->exported) { switch (m_var->access_restriction) { case GDP::Node::ACCESS_RESTRICTION_PRIVATE: @@ -506,6 +502,7 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_ break; } } + _doctype_from_gdtype(m_var->get_datatype(), prop_doc.type, prop_doc.enumeration); switch (m_var->property) { case GDP::VariableNode::PROP_NONE: