summaryrefslogtreecommitdiff
path: root/tools/doc/doc_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/doc/doc_data.cpp')
-rw-r--r--tools/doc/doc_data.cpp94
1 files changed, 64 insertions, 30 deletions
diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp
index 4a8fdfb215..d51dc886b2 100644
--- a/tools/doc/doc_data.cpp
+++ b/tools/doc/doc_data.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -26,9 +26,9 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "version.h"
#include "doc_data.h"
+#include "version.h"
#include "global_constants.h"
#include "globals.h"
#include "script_language.h"
@@ -132,6 +132,9 @@ void DocData::merge_from(const DocData& p_data) {
const PropertyDoc &pf = cf.properties[j];
p.description=pf.description;
+ p.setter=pf.setter;
+ p.getter=pf.getter;
+
break;
}
}
@@ -159,7 +162,7 @@ void DocData::generate(bool p_basic_types) {
List<StringName> classes;
- ObjectTypeDB::get_type_list(&classes);
+ ClassDB::get_class_list(&classes);
classes.sort_custom<StringName::AlphCompare>();
while(classes.size()) {
@@ -172,11 +175,35 @@ void DocData::generate(bool p_basic_types) {
class_list[cname]=ClassDoc();
ClassDoc& c = class_list[cname];
c.name=cname;
- c.inherits=ObjectTypeDB::type_inherits_from(name);
- c.category=ObjectTypeDB::get_category(name);
+ c.inherits=ClassDB::get_parent_class(name);
+ c.category=ClassDB::get_category(name);
+
+
+ List<PropertyInfo> properties;
+ ClassDB::get_property_list(name,&properties,true);
+
+ for(List<PropertyInfo>::Element *E=properties.front();E;E=E->next()) {
+ if (E->get().usage& PROPERTY_USAGE_GROUP || E->get().usage& PROPERTY_USAGE_CATEGORY)
+ continue;
+
+ PropertyDoc prop;
+ StringName setter = ClassDB::get_property_setter(name,E->get().name);
+ StringName getter = ClassDB::get_property_getter(name,E->get().name);
+
+ prop.name=E->get().name;
+ prop.setter=setter;
+ prop.getter=getter;
+ if (E->get().type==Variant::OBJECT && E->get().hint==PROPERTY_HINT_RESOURCE_TYPE)
+ prop.type=E->get().hint_string;
+ else
+ prop.type=Variant::get_type_name(E->get().type);
+
+ c.properties.push_back(prop);
+ }
+
List<MethodInfo> method_list;
- ObjectTypeDB::get_method_list(name,&method_list,true);
+ ClassDB::get_method_list(name,&method_list,true);
method_list.sort();
@@ -189,7 +216,7 @@ void DocData::generate(bool p_basic_types) {
method.name=E->get().name;
- MethodBind *m = ObjectTypeDB::get_method(name,E->get().name);
+ MethodBind *m = ClassDB::get_method(name,E->get().name);
if (E->get().flags&METHOD_FLAG_VIRTUAL)
@@ -223,7 +250,7 @@ void DocData::generate(bool p_basic_types) {
} else if (arginfo.type!=Variant::NIL) // {
#endif
method.return_type=(arginfo.hint==PROPERTY_HINT_RESOURCE_TYPE)?arginfo.hint_string:Variant::get_type_name(arginfo.type);
-// }
+ //}
} else {
@@ -281,23 +308,23 @@ void DocData::generate(bool p_basic_types) {
default_arg_text=Variant::get_type_name(default_arg.get_type())+"("+default_arg_text+")";
break;
- case Variant::_AABB: //sorry naming convention fail :( not like it's used often // 10
+ case Variant::RECT3: //sorry naming convention fail :( not like it's used often // 10
case Variant::COLOR:
case Variant::PLANE:
- case Variant::RAW_ARRAY:
- case Variant::INT_ARRAY:
- case Variant::REAL_ARRAY:
- case Variant::STRING_ARRAY: //25
- case Variant::VECTOR2_ARRAY:
- case Variant::VECTOR3_ARRAY:
- case Variant::COLOR_ARRAY:
+ case Variant::POOL_BYTE_ARRAY:
+ case Variant::POOL_INT_ARRAY:
+ case Variant::POOL_REAL_ARRAY:
+ case Variant::POOL_STRING_ARRAY: //25
+ case Variant::POOL_VECTOR2_ARRAY:
+ case Variant::POOL_VECTOR3_ARRAY:
+ case Variant::POOL_COLOR_ARRAY:
default_arg_text=Variant::get_type_name(default_arg.get_type())+"("+default_arg_text+")";
break;
case Variant::VECTOR2: // 5
case Variant::RECT2:
case Variant::VECTOR3:
case Variant::QUAT:
- case Variant::MATRIX3:
+ case Variant::BASIS:
default_arg_text=Variant::get_type_name(default_arg.get_type())+default_arg_text;
break;
case Variant::OBJECT:
@@ -358,7 +385,7 @@ void DocData::generate(bool p_basic_types) {
}
List<MethodInfo> signal_list;
- ObjectTypeDB::get_signal_list(name,&signal_list,true);
+ ClassDB::get_signal_list(name,&signal_list,true);
if (signal_list.size()) {
@@ -383,13 +410,13 @@ void DocData::generate(bool p_basic_types) {
}
List<String> constant_list;
- ObjectTypeDB::get_integer_constant_list(name, &constant_list, true);
+ ClassDB::get_integer_constant_list(name, &constant_list, true);
for(List<String>::Element *E=constant_list.front();E;E=E->next()) {
ConstantDoc constant;
constant.name=E->get();
- constant.value=itos(ObjectTypeDB::get_integer_constant(name, E->get()));
+ constant.value=itos(ClassDB::get_integer_constant(name, E->get()));
c.constants.push_back(constant);
}
@@ -476,7 +503,7 @@ void DocData::generate(bool p_basic_types) {
if (i==Variant::INPUT_EVENT) {
static const char* ie_type[InputEvent::TYPE_MAX]={
- "","Key","MouseMotion","MouseButton","JoystickMotion","JoystickButton","ScreenTouch","ScreenDrag","Action"
+ "","Key","MouseMotion","MouseButton","JoypadMotion","JoypadButton","ScreenTouch","ScreenDrag","Action"
};
cname+=ie_type[j];
}
@@ -581,18 +608,18 @@ void DocData::generate(bool p_basic_types) {
c.constants.push_back(cd);
}
- List<Globals::Singleton> singletons;
- Globals::get_singleton()->get_singletons(&singletons);
+ List<GlobalConfig::Singleton> singletons;
+ GlobalConfig::get_singleton()->get_singletons(&singletons);
//servers (this is kind of hackish)
- for(List<Globals::Singleton>::Element *E=singletons.front();E;E=E->next()) {
+ for(List<GlobalConfig::Singleton>::Element *E=singletons.front();E;E=E->next()) {
PropertyDoc pd;
- Globals::Singleton &s=E->get();
+ GlobalConfig::Singleton &s=E->get();
pd.name=s.name;
- pd.type=s.ptr->get_type();
- while (String(ObjectTypeDB::type_inherits_from(pd.type))!="Object")
- pd.type=ObjectTypeDB::type_inherits_from(pd.type);
+ pd.type=s.ptr->get_class();
+ while (String(ClassDB::get_parent_class(pd.type))!="Object")
+ pd.type=ClassDB::get_parent_class(pd.type);
if (pd.type.begins_with("_"))
pd.type=pd.type.substr(1,pd.type.length());
c.properties.push_back(pd);
@@ -777,7 +804,7 @@ Error DocData::_load(Ref<XMLParser> parser) {
class_list[name]=ClassDoc();
ClassDoc& c = class_list[name];
-// print_line("class: "+name);
+ //print_line("class: "+name);
c.name=name;
if (parser->has_attribute("inherits"))
c.inherits = parser->get_attribute_value("inherits");
@@ -825,6 +852,13 @@ Error DocData::_load(Ref<XMLParser> parser) {
prop.name=parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("type"),ERR_FILE_CORRUPT);
prop.type=parser->get_attribute_value("type");
+ if (parser->has_attribute("setter"))
+ prop.setter=parser->get_attribute_value("setter");
+ if (parser->has_attribute("getter"))
+ prop.getter=parser->get_attribute_value("getter");
+ if (parser->has_attribute("brief"))
+ prop.brief_description=parser->get_attribute_value("brief").xml_unescape();
+
parser->read();
if (parser->get_node_type()==XMLParser::NODE_TEXT)
prop.description=parser->get_node_data().strip_edges();
@@ -1009,7 +1043,7 @@ Error DocData::save(const String& p_path) {
PropertyDoc &p=c.properties[i];
- _write_string(f,2,"<member name=\""+p.name+"\" type=\""+p.type+"\">");
+ _write_string(f,2,"<member name=\""+p.name+"\" type=\""+p.type+"\" setter=\""+p.setter+"\" getter=\""+p.getter+"\" brief=\""+p.brief_description.xml_escape(true)+"\">");
if (p.description!="")
_write_string(f,3,p.description.xml_escape());
_write_string(f,2,"</member>");