You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Documentation generation for GDScript
- ClassDoc added to GDScript and property reflection data were extracted from parse tree - GDScript comments are collected from tokenizer for documentation and applied to the ClassDoc by the GDScript compiler - private docs were excluded (name with underscore prefix and doesn't have any doc comments) - default values (of non exported vars), arguments are extraced from the parser - Integrated with GDScript 2.0 and new enums were added. - merge conflicts fixed
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/object/script_language.h"
|
||||
#include "editor/doc_data.h"
|
||||
#include "gdscript_function.h"
|
||||
|
||||
class GDScriptNativeClass : public Reference {
|
||||
@@ -91,9 +92,7 @@ class GDScript : public Script {
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
Map<StringName, int> member_lines;
|
||||
|
||||
Map<StringName, Variant> member_default_values;
|
||||
|
||||
List<PropertyInfo> members_cache;
|
||||
Map<StringName, Variant> member_default_values_cache;
|
||||
Ref<GDScript> base_cache;
|
||||
@@ -102,6 +101,20 @@ class GDScript : public Script {
|
||||
bool placeholder_fallback_enabled;
|
||||
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
|
||||
|
||||
DocData::ClassDoc doc;
|
||||
Vector<DocData::ClassDoc> docs;
|
||||
String doc_brief_description;
|
||||
String doc_description;
|
||||
Vector<DocData::TutorialDoc> doc_tutorials;
|
||||
Map<String, String> doc_functions;
|
||||
Map<String, String> doc_variables;
|
||||
Map<String, String> doc_constants;
|
||||
Map<String, String> doc_signals;
|
||||
Map<String, DocData::EnumDoc> doc_enums;
|
||||
void _clear_doc();
|
||||
void _update_doc();
|
||||
void _add_doc(const DocData::ClassDoc &p_inner_class);
|
||||
|
||||
#endif
|
||||
Map<StringName, PropertyInfo> member_info;
|
||||
|
||||
@@ -141,6 +154,13 @@ class GDScript : public Script {
|
||||
void _save_orphaned_subclasses();
|
||||
void _init_rpc_methods_properties();
|
||||
|
||||
void _get_script_property_list(List<PropertyInfo> *r_list, bool p_include_base) const;
|
||||
void _get_script_method_list(List<MethodInfo> *r_list, bool p_include_base) const;
|
||||
void _get_script_signal_list(List<MethodInfo> *r_list, bool p_include_base) const;
|
||||
|
||||
// This method will map the class name from "Reference" to "MyClass.InnerClass".
|
||||
static String _get_gdscript_reference_class_name(const GDScript *p_gdscript);
|
||||
|
||||
protected:
|
||||
bool _get(const StringName &p_name, Variant &r_ret) const;
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
@@ -191,6 +211,12 @@ public:
|
||||
virtual void set_source_code(const String &p_code) override;
|
||||
virtual void update_exports() override;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual const Vector<DocData::ClassDoc> &get_documentation() const override {
|
||||
return docs;
|
||||
}
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
virtual Error reload(bool p_keep_state = false) override;
|
||||
|
||||
void set_script_path(const String &p_path) { path = p_path; } //because subclasses need a path too...
|
||||
|
||||
Reference in New Issue
Block a user