summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-06-29 22:41:02 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-06-29 22:41:02 -0300
commit01632a824ee7e2326aa90b32d75c2fe09f61a37e (patch)
tree86d97af34596130fb69bf444781b7ca8fdc8c20d /tools
parent97731696c9e45a351d64660b46c6d027f3b0a25e (diff)
downloadredot-engine-01632a824ee7e2326aa90b32d75c2fe09f61a37e.tar.gz
Bug Fixes
-=-=-=-=- -Documentation now shows overridable theme values (though this needs to be documented). -Detect when object transform is flipped and flip normals too. -TileMap can specify bounce and friction for collision. -Removed limit of 4 lights per object -Added is_hovered() to buttons.
Diffstat (limited to 'tools')
-rw-r--r--tools/doc/doc_data.cpp114
-rw-r--r--tools/doc/doc_data.h1
-rw-r--r--tools/editor/editor_help.cpp57
-rw-r--r--tools/editor/editor_help.h1
4 files changed, 172 insertions, 1 deletions
diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp
index 35f1140644..319c1ad8b7 100644
--- a/tools/doc/doc_data.cpp
+++ b/tools/doc/doc_data.cpp
@@ -34,6 +34,7 @@
#include "script_language.h"
#include "io/marshalls.h"
#include "io/compression.h"
+#include "scene/resources/theme.h"
void DocData::merge_from(const DocData& p_data) {
@@ -111,6 +112,21 @@ void DocData::merge_from(const DocData& p_data) {
}
}
+ for(int i=0;i<c.theme_properties.size();i++) {
+
+ PropertyDoc &p = c.theme_properties[i];
+
+ for(int j=0;j<cf.theme_properties.size();j++) {
+
+ if (cf.theme_properties[j].name!=p.name)
+ continue;
+ const PropertyDoc &pf = cf.theme_properties[j];
+
+ p.description=pf.description;
+ break;
+ }
+ }
+
}
}
@@ -334,6 +350,60 @@ void DocData::generate(bool p_basic_types) {
c.constants.push_back(constant);
}
+ //theme stuff
+
+ {
+ List<StringName> l;
+ Theme::get_default()->get_constant_list(cname,&l);
+ for (List<StringName>::Element*E=l.front();E;E=E->next()) {
+
+ PropertyDoc pd;
+ pd.name=E->get();
+ pd.type="int";
+ c.theme_properties.push_back(pd);
+ }
+
+ l.clear();
+ Theme::get_default()->get_color_list(cname,&l);
+ for (List<StringName>::Element*E=l.front();E;E=E->next()) {
+
+ PropertyDoc pd;
+ pd.name=E->get();
+ pd.type="Color";
+ c.theme_properties.push_back(pd);
+ }
+
+ l.clear();
+ Theme::get_default()->get_icon_list(cname,&l);
+ for (List<StringName>::Element*E=l.front();E;E=E->next()) {
+
+ PropertyDoc pd;
+ pd.name=E->get();
+ pd.type="Texture";
+ c.theme_properties.push_back(pd);
+ }
+ l.clear();
+ Theme::get_default()->get_font_list(cname,&l);
+ for (List<StringName>::Element*E=l.front();E;E=E->next()) {
+
+ PropertyDoc pd;
+ pd.name=E->get();
+ pd.type="Font";
+ c.theme_properties.push_back(pd);
+ }
+ l.clear();
+ Theme::get_default()->get_stylebox_list(cname,&l);
+ for (List<StringName>::Element*E=l.front();E;E=E->next()) {
+
+ PropertyDoc pd;
+ pd.name=E->get();
+ pd.type="StyleBox";
+ c.theme_properties.push_back(pd);
+ }
+
+ }
+
+
classes.pop_front();
}
@@ -714,6 +784,35 @@ Error DocData::_load(Ref<XMLParser> parser) {
break; //end of <constants>
}
+ } else if (name=="theme_items") {
+
+ while(parser->read()==OK) {
+
+ if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
+
+ String name = parser->get_node_name();
+
+ if (name=="theme_item") {
+
+ PropertyDoc prop;
+
+ ERR_FAIL_COND_V(!parser->has_attribute("name"),ERR_FILE_CORRUPT);
+ 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");
+ parser->read();
+ if (parser->get_node_type()==XMLParser::NODE_TEXT)
+ prop.description=parser->get_node_data().strip_edges();
+ c.theme_properties.push_back(prop);
+ } else {
+ ERR_EXPLAIN("Invalid tag in doc file: "+name);
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
+ }
+
+ } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name()=="members")
+ break; //end of <constants>
+ }
+
} else if (name=="constants") {
while(parser->read()==OK) {
@@ -897,7 +996,20 @@ Error DocData::save(const String& p_path) {
}
_write_string(f,1,"</constants>");
- _write_string(f,0,"</class>");
+
+ _write_string(f,1,"<theme_items>");
+ if (c.theme_properties.size()) {
+ for(int i=0;i<c.theme_properties.size();i++) {
+
+
+ PropertyDoc &p=c.theme_properties[i];
+ _write_string(f,2,"<theme_item name=\""+p.name+"\" type=\""+p.type+"\">");
+ _write_string(f,2,"</theme_item>");
+
+ }
+ }
+
+ _write_string(f,0,"</theme_items>");
}
diff --git a/tools/doc/doc_data.h b/tools/doc/doc_data.h
index 59d6958aa5..018bd67aaf 100644
--- a/tools/doc/doc_data.h
+++ b/tools/doc/doc_data.h
@@ -77,6 +77,7 @@ public:
Vector<MethodDoc> signals;
Vector<ConstantDoc> constants;
Vector<PropertyDoc> properties;
+ Vector<PropertyDoc> theme_properties;
};
diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp
index 0471d62d16..b7e708e360 100644
--- a/tools/editor/editor_help.cpp
+++ b/tools/editor/editor_help.cpp
@@ -168,6 +168,18 @@ void EditorHelpSearch::_update_search() {
}
}
+ for(int i=0;i<c.theme_properties.size();i++) {
+
+ if (c.theme_properties[i].name.findn(term)!=-1) {
+
+ TreeItem *item = search_options->create_item(root);
+ item->set_metadata(0,"class_theme_item:"+E->key()+":"+c.theme_properties[i].name);
+ item->set_text(0,E->key()+"."+c.theme_properties[i].name+" (Theme Item)");
+ item->set_icon(0,cicon);
+ }
+ }
+
+
}
//same but descriptions
@@ -666,7 +678,48 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v
}
+ if (cd.theme_properties.size()) {
+
+
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color"));
+ class_desc->push_font(doc_title_font);
+ class_desc->add_text("GUI Theme Items:");
+ class_desc->pop();
+ class_desc->pop();
+ class_desc->add_newline();
+
+ class_desc->push_indent(1);
+
+ //class_desc->add_newline();
+
+ for(int i=0;i<cd.theme_properties.size();i++) {
+
+ theme_property_line[cd.theme_properties[i].name]=class_desc->get_line_count()-2; //gets overriden if description
+ class_desc->push_font(doc_code_font);
+ _add_type(cd.theme_properties[i].type);
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color"));
+ class_desc->add_text(" "+cd.theme_properties[i].name);
+ class_desc->pop();
+ class_desc->pop();
+ if (cd.theme_properties[i].description!="") {
+ class_desc->push_font(doc_font);
+ class_desc->add_text(" ");
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color"));
+ class_desc->add_text(cd.theme_properties[i].description);
+ class_desc->pop();
+ class_desc->pop();
+
+ }
+
+ class_desc->add_newline();
+ }
+
+ class_desc->add_newline();
+ class_desc->pop();
+
+
+ }
if (cd.signals.size()) {
class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color"));
@@ -905,6 +958,10 @@ void EditorHelp::_help_callback(const String& p_topic) {
if (property_line.has(name))
line=property_line[name];
+ } else if (what=="class_theme_item") {
+
+ if (theme_property_line.has(name))
+ line=theme_property_line[name];
} else if (what=="class_constant") {
if (constant_line.has(name))
diff --git a/tools/editor/editor_help.h b/tools/editor/editor_help.h
index 94a31ce902..1c2b704b98 100644
--- a/tools/editor/editor_help.h
+++ b/tools/editor/editor_help.h
@@ -107,6 +107,7 @@ class EditorHelp : public VBoxContainer {
Map<String,int> method_line;
Map<String,int> signal_line;
Map<String,int> property_line;
+ Map<String,int> theme_property_line;
Map<String,int> constant_line;
int description_line;