summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYRIGHT.txt6
-rw-r--r--doc/classes/VisualScriptEngineSingleton.xml2
-rw-r--r--editor/editor_fonts.cpp20
-rw-r--r--editor/editor_help.cpp281
-rw-r--r--editor/editor_help.h4
-rw-r--r--editor/editor_node.cpp52
-rw-r--r--editor/editor_node.h4
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/editor_themes.cpp8
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp15
-rw-r--r--editor/plugins/script_editor_plugin.cpp73
-rw-r--r--editor/plugins/script_editor_plugin.h6
-rw-r--r--editor/project_manager.cpp363
-rw-r--r--editor/project_manager.h3
-rw-r--r--modules/gdnative/gd_native_library_editor.cpp120
-rw-r--r--modules/gdnative/gd_native_library_editor.h26
-rw-r--r--modules/gdnative/register_types.cpp13
-rw-r--r--modules/visual_script/visual_script_nodes.cpp2
-rw-r--r--thirdparty/README.md6
-rw-r--r--thirdparty/fonts/LICENSE_Mononoki (renamed from thirdparty/fonts/LICENSE.SourceCodePro.txt)8
-rw-r--r--thirdparty/fonts/mononoki_Regular.ttfbin0 -> 90216 bytes
-rw-r--r--thirdparty/fonts/source_code_pro.otfbin145556 -> 0 bytes
22 files changed, 707 insertions, 306 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 5709f3d8d6..16ef854f1f 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -150,9 +150,9 @@ Comment: Noto Sans font
Copyright: 2012, Google Inc.
License: OFL-1.1
-Files: ./thirdparty/fonts/source_code_pro.otf
-Comment: Source Code Pro font
-Copyright: 2010, 2012, Adobe Systems Incorporated
+Files: ./thirdparty/fonts/mononoki_Regular.ttf
+Comment: Mononoki font
+Copyright: 2013, Matthias Tellen
License: OFL-1.1
Files: ./thirdparty/freetype/
diff --git a/doc/classes/VisualScriptEngineSingleton.xml b/doc/classes/VisualScriptEngineSingleton.xml
index c130e71962..c00fd2a0a4 100644
--- a/doc/classes/VisualScriptEngineSingleton.xml
+++ b/doc/classes/VisualScriptEngineSingleton.xml
@@ -25,7 +25,7 @@
</method>
</methods>
<members>
- <member name="/constant" type="String" setter="set_singleton" getter="get_singleton">
+ <member name="constant" type="String" setter="set_singleton" getter="get_singleton">
</member>
</members>
<constants>
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 3ab3f05906..d806b825ba 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -73,13 +73,13 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p
m_name->add_fallback(FontFallback);
// the custom spacings might only work with Noto Sans
-#define MAKE_DEFAULT_FONT(m_name, m_size) \
- Ref<DynamicFont> m_name; \
- m_name.instance(); \
- m_name->set_size(m_size); \
- m_name->set_font_data(DefaultFont); \
- m_name->set_spacing(DynamicFont::SPACING_TOP, -1); \
- m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -1); \
+#define MAKE_DEFAULT_FONT(m_name, m_size) \
+ Ref<DynamicFont> m_name; \
+ m_name.instance(); \
+ m_name->set_size(m_size); \
+ m_name->set_font_data(DefaultFont); \
+ m_name->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); \
+ m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); \
MAKE_FALLBACKS(m_name);
void editor_register_fonts(Ref<Theme> p_theme) {
@@ -119,7 +119,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<DynamicFontData> dfmono;
dfmono.instance();
- dfmono->set_font_ptr(_font_source_code_pro, _font_source_code_pro_size);
+ dfmono->set_font_ptr(_font_mononoki_Regular, _font_mononoki_Regular_size);
//dfd->set_force_autohinter(true); //just looks better..i think?
MAKE_DEFAULT_FONT(df, int(EditorSettings::get_singleton()->get("interface/font_size")) * EDSCALE);
@@ -147,7 +147,9 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<DynamicFont> df_doc_code;
df_doc_code.instance();
- df_doc_code->set_size(int(EDITOR_DEF("text_editor/help/help_source_font_size", 14)) * EDSCALE);
+ df_doc_code->set_size(int(EDITOR_DEF("text_editor/help/help_source_font_size", 18)) * EDSCALE);
+ df_doc_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE);
+ df_doc_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE);
df_doc_code->set_font_data(dfmono);
MAKE_FALLBACKS(df_doc_code);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index a5baf62ea0..6c8bd0f14b 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -607,7 +607,9 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) {
t = p_enum.get_slice(".", 0);
}
}
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color"));
+ const Color text_color = get_color("default_color", "RichTextLabel");
+ const Color type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5);
+ class_desc->push_color(type_color);
if (can_ref) {
if (p_enum == "") {
class_desc->push_meta("#" + t); //class
@@ -642,24 +644,32 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->clear();
method_line.clear();
+ section_line.clear();
edited_class = p_class;
//edited_class->show();
- DocData::ClassDoc cd = doc->class_list[p_class]; //make a copy, so we can sort without worrying
+ // Colors
+ const Color title_color = get_color("accent_color", "Editor");
+ const Color text_color = get_color("font_color", "RichTextLabel");
+ const Color highlight_color = get_color("highlight_color", "RichTextLabel");
+ const Color base_type_color = title_color.linear_interpolate(text_color, 0.5);
+ const Color comment_color = Color(text_color.r, text_color.g, text_color.b, 0.6);
+ const Color symbol_color = comment_color;
+ const Color value_color = Color(text_color.r, text_color.g, text_color.b, 0.4);
+ const Color qualifier_color = Color(text_color.r, text_color.g, text_color.b, 0.8);
- Color h_color;
+ DocData::ClassDoc cd = doc->class_list[p_class]; //make a copy, so we can sort without worrying
Ref<Font> doc_font = get_font("doc", "EditorFonts");
Ref<Font> doc_title_font = get_font("doc_title", "EditorFonts");
Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
- String link_color_text = Color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")).to_html(false);
-
- h_color = Color(1, 1, 1, 1);
+ String link_color_text = title_color.to_html(false);
+ section_line.push_back(Pair<String, int>(TTR("Top"), 0));
class_desc->push_font(doc_title_font);
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(title_color);
class_desc->add_text(TTR("Class:") + " ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color"));
+ class_desc->push_color(highlight_color);
_add_text(p_class);
class_desc->pop();
class_desc->pop();
@@ -668,7 +678,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (cd.inherits != "") {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Inherits:") + " ");
class_desc->pop();
@@ -702,7 +712,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (E->get().inherits == cd.name) {
if (!found) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Inherited by:") + " ");
class_desc->pop();
@@ -730,10 +740,11 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
}
class_desc->add_newline();
+ class_desc->add_newline();
if (cd.brief_description != "") {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Brief Description:"));
class_desc->pop();
@@ -741,7 +752,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
//class_desc->add_newline();
class_desc->add_newline();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
class_desc->push_font(doc_font);
class_desc->push_indent(1);
_add_text(cd.brief_description);
@@ -750,6 +761,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->pop();
class_desc->add_newline();
class_desc->add_newline();
+ class_desc->add_newline();
}
Set<String> skip_methods;
@@ -757,7 +769,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (cd.properties.size()) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ section_line.push_back(Pair<String, int>(TTR("Members"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Members:"));
class_desc->pop();
@@ -775,7 +788,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_align(RichTextLabel::ALIGN_RIGHT);
class_desc->push_font(doc_code_font);
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
- class_desc->add_text(" ");
class_desc->pop();
class_desc->pop();
class_desc->pop();
@@ -800,7 +812,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
}
class_desc->push_font(doc_code_font);
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(highlight_color);
_add_text(cd.properties[i].name);
if (describe) {
@@ -835,7 +847,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (sort_methods)
methods.sort();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ section_line.push_back(Pair<String, int>(TTR("Public Methods"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Public Methods:"));
class_desc->pop();
@@ -852,9 +865,9 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
bool is_vararg = methods[i].qualifiers.find("vararg") != -1;
- class_desc->push_cell();
-
method_line[methods[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
+
+ class_desc->push_cell();
class_desc->push_align(RichTextLabel::ALIGN_RIGHT);
class_desc->push_font(doc_code_font);
_add_type(methods[i].return_type, methods[i].return_enum);
@@ -862,23 +875,24 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->pop(); //align
class_desc->pop(); //font
class_desc->pop(); //cell
+
class_desc->push_cell();
class_desc->push_font(doc_code_font);
- if (true || methods[i].description != "") { //always describe method
+ if (methods[i].description != "") {
method_descr = true;
class_desc->push_meta("@" + methods[i].name);
}
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(highlight_color);
_add_text(methods[i].name);
class_desc->pop();
if (methods[i].description != "")
- class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->pop(); // pop meta
+ class_desc->push_color(symbol_color);
class_desc->add_text(methods[i].arguments.size() || is_vararg ? "( " : "(");
class_desc->pop();
for (int j = 0; j < methods[i].arguments.size(); j++) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
if (j > 0)
class_desc->add_text(", ");
_add_type(methods[i].arguments[j].type, methods[i].arguments[j].enumeration);
@@ -886,7 +900,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_text(methods[i].arguments[j].name);
if (methods[i].arguments[j].default_value != "") {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text("=");
class_desc->pop();
_add_text(methods[i].arguments[j].default_value);
@@ -896,21 +910,21 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
}
if (is_vararg) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
if (methods[i].arguments.size())
class_desc->add_text(", ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text("...");
class_desc->pop();
class_desc->pop();
}
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text(methods[i].arguments.size() || is_vararg ? " )" : ")");
class_desc->pop();
if (methods[i].qualifiers != "") {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(qualifier_color);
class_desc->add_text(" ");
_add_text(methods[i].qualifiers);
class_desc->pop();
@@ -927,42 +941,54 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (cd.theme_properties.size()) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ section_line.push_back(Pair<String, int>(TTR("GUI Theme Items"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("GUI Theme Items:"));
class_desc->pop();
class_desc->pop();
- class_desc->add_newline();
+ // class_desc->add_newline();
class_desc->push_indent(1);
+ class_desc->push_table(2);
+ class_desc->set_table_column_expand(1, 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 overridden if description
+
+ class_desc->push_cell();
+ class_desc->push_align(RichTextLabel::ALIGN_RIGHT);
class_desc->push_font(doc_code_font);
_add_type(cd.theme_properties[i].type);
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
- class_desc->add_text(" ");
+ class_desc->pop();
+ class_desc->pop();
+ class_desc->pop();
+
+ class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
+ class_desc->push_color(highlight_color);
_add_text(cd.theme_properties[i].name);
class_desc->pop();
class_desc->pop();
- if (true || cd.theme_properties[i].description != "") { //always describe properties
+ 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/highlighting/comment_color"));
+ class_desc->push_color(comment_color);
_add_text(cd.theme_properties[i].description);
class_desc->pop();
class_desc->pop();
}
-
- class_desc->add_newline();
+ class_desc->pop(); // cell
}
+ class_desc->pop(); // table
class_desc->pop();
class_desc->add_newline();
+ class_desc->add_newline();
}
if (cd.signals.size()) {
@@ -970,7 +996,9 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (sort_methods) {
cd.signals.sort();
}
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+
+ section_line.push_back(Pair<String, int>(TTR("Signals"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Signals:"));
class_desc->pop();
@@ -987,14 +1015,14 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_font(doc_code_font); // monofont
//_add_type("void");
//class_desc->add_text(" ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(highlight_color);
_add_text(cd.signals[i].name);
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text(cd.signals[i].arguments.size() ? "( " : "(");
class_desc->pop();
for (int j = 0; j < cd.signals[i].arguments.size(); j++) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
if (j > 0)
class_desc->add_text(", ");
_add_type(cd.signals[i].arguments[j].type);
@@ -1002,7 +1030,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_text(cd.signals[i].arguments[j].name);
if (cd.signals[i].arguments[j].default_value != "") {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text("=");
class_desc->pop();
_add_text(cd.signals[i].arguments[j].default_value);
@@ -1011,13 +1039,13 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->pop();
}
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text(cd.signals[i].arguments.size() ? " )" : ")");
class_desc->pop();
class_desc->pop(); // end monofont
if (cd.signals[i].description != "") {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
+ class_desc->push_color(comment_color);
class_desc->add_text(" ");
_add_text(cd.signals[i].description);
class_desc->pop();
@@ -1050,7 +1078,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (enums.size()) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ section_line.push_back(Pair<String, int>(TTR("Enumerations"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Enumerations:"));
class_desc->pop();
@@ -1064,7 +1093,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
enum_line[E->key()] = class_desc->get_line_count() - 2;
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(title_color);
class_desc->add_text(TTR("enum "));
class_desc->pop();
class_desc->push_font(doc_code_font);
@@ -1073,9 +1102,11 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
e = e.get_slice(".", 1);
}
+ class_desc->push_color(highlight_color);
class_desc->add_text(e);
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->pop();
+ class_desc->push_color(symbol_color);
class_desc->add_text(":");
class_desc->pop();
class_desc->add_newline();
@@ -1086,20 +1117,20 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
for (int i = 0; i < enum_list.size(); i++) {
class_desc->push_font(doc_code_font);
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color"));
+ class_desc->push_color(highlight_color);
_add_text(enum_list[i].name);
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text(" = ");
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(value_color);
_add_text(enum_list[i].value);
class_desc->pop();
class_desc->pop();
if (enum_list[i].description != "") {
class_desc->push_font(doc_font);
class_desc->add_text(" ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
+ class_desc->push_color(comment_color);
_add_text(enum_list[i].description);
class_desc->pop();
class_desc->pop();
@@ -1119,7 +1150,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (constants.size()) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ section_line.push_back(Pair<String, int>(TTR("Constants"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Constants:"));
class_desc->pop();
@@ -1133,20 +1165,20 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
constant_line[constants[i].name] = class_desc->get_line_count() - 2;
class_desc->push_font(doc_code_font);
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color"));
+ class_desc->push_color(highlight_color);
_add_text(constants[i].name);
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text(" = ");
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(value_color);
_add_text(constants[i].value);
class_desc->pop();
class_desc->pop();
if (constants[i].description != "") {
class_desc->push_font(doc_font);
class_desc->add_text(" ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
+ class_desc->push_color(comment_color);
_add_text(constants[i].description);
class_desc->pop();
class_desc->pop();
@@ -1162,16 +1194,16 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (cd.description != "") {
+ section_line.push_back(Pair<String, int>(TTR("Description"), class_desc->get_line_count() - 2));
description_line = class_desc->get_line_count() - 2;
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Description:"));
class_desc->pop();
class_desc->pop();
class_desc->add_newline();
- class_desc->add_newline();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
class_desc->push_font(doc_font);
class_desc->push_indent(1);
_add_text(cd.description);
@@ -1180,11 +1212,13 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->pop();
class_desc->add_newline();
class_desc->add_newline();
+ class_desc->add_newline();
}
if (property_descr) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ section_line.push_back(Pair<String, int>(TTR("Properties"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Property Description:"));
class_desc->pop();
@@ -1201,7 +1235,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->add_text(" ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(highlight_color);
_add_text(cd.properties[i].name);
class_desc->pop(); //color
@@ -1214,11 +1248,11 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_font(doc_font);
class_desc->push_indent(2);
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(comment_color);
class_desc->add_text("Setter: ");
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
class_desc->add_text(cd.properties[i].setter + "(value)");
class_desc->pop(); //color
@@ -1232,11 +1266,11 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_font(doc_font);
class_desc->push_indent(2);
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(comment_color);
class_desc->add_text("Getter: ");
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
class_desc->add_text(cd.properties[i].getter + "()");
class_desc->pop(); //color
@@ -1247,7 +1281,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->add_newline();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
class_desc->push_font(doc_font);
class_desc->push_indent(1);
if (cd.properties[i].description.strip_edges() != String()) {
@@ -1255,7 +1289,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
} else {
class_desc->add_image(get_icon("Error", "EditorIcons"));
class_desc->add_text(" ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
+ class_desc->push_color(comment_color);
class_desc->append_bbcode(TTR("There is currently no description for this property. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text));
class_desc->pop();
}
@@ -1270,7 +1304,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (method_descr) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_line_count() - 2));
+ class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Method Description:"));
class_desc->pop();
@@ -1289,14 +1324,14 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_type(methods[i].return_type, methods[i].return_enum);
class_desc->add_text(" ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(highlight_color);
_add_text(methods[i].name);
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text(methods[i].arguments.size() || is_vararg ? "( " : "(");
class_desc->pop();
for (int j = 0; j < methods[i].arguments.size(); j++) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
if (j > 0)
class_desc->add_text(", ");
_add_type(methods[i].arguments[j].type, methods[i].arguments[j].enumeration);
@@ -1304,7 +1339,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_text(methods[i].arguments[j].name);
if (methods[i].arguments[j].default_value != "") {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text("=");
class_desc->pop();
_add_text(methods[i].arguments[j].default_value);
@@ -1314,21 +1349,21 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
}
if (is_vararg) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
if (methods[i].arguments.size())
class_desc->add_text(", ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text("...");
class_desc->pop();
class_desc->pop();
}
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->push_color(symbol_color);
class_desc->add_text(methods[i].arguments.size() || is_vararg ? " )" : ")");
class_desc->pop();
if (methods[i].qualifiers != "") {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_color(qualifier_color);
class_desc->add_text(" ");
_add_text(methods[i].qualifiers);
class_desc->pop();
@@ -1337,7 +1372,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->pop();
class_desc->add_newline();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
+ class_desc->push_color(text_color);
class_desc->push_font(doc_font);
class_desc->push_indent(1);
if (methods[i].description.strip_edges() != String()) {
@@ -1345,7 +1380,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
} else {
class_desc->add_image(get_icon("Error", "EditorIcons"));
class_desc->add_text(" ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
+ class_desc->push_color(comment_color);
class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text));
class_desc->pop();
}
@@ -1419,70 +1454,16 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
DocData *doc = EditorHelp::get_doc_data();
String base_path;
- /*p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
- p_rt->push_font( get_font("normal","Fonts") );
- p_rt->push_indent(1);*/
- int pos = 0;
-
Ref<Font> doc_font = p_rt->get_font("doc", "EditorFonts");
Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts");
+ Color font_color_hl = p_rt->get_color("highlight_color", "RichTextLabel");
+ Color link_color = p_rt->get_color("accent_color", "Editor").linear_interpolate(font_color_hl, 0.8);
String bbcode = p_bbcode.replace("\t", " ").replace("\r", " ").strip_edges();
- //change newlines for double newlines
- for (int i = 0; i < bbcode.length(); i++) {
-
- //find valid newlines (double)
- if (bbcode[i] == '\n') {
- bool dnl = false;
- int j = i + 1;
- for (; j < p_bbcode.length(); j++) {
- if (bbcode[j] == ' ')
- continue;
- if (bbcode[j] == '\n') {
- dnl = true;
- break;
- }
- break;
- }
-
- if (dnl) {
- bbcode[i] = 0xFFFF;
- //keep
- i = j;
- } else {
- bbcode = bbcode.insert(i, "\n");
- i++;
- //bbcode[i]=' ';
- //i=j-1;
- }
- }
- }
-
- //remove double spaces or spaces after newlines
- for (int i = 0; i < bbcode.length(); i++) {
-
- if (bbcode[i] == ' ' || bbcode[i] == '\n' || bbcode[i] == 0xFFFF) {
-
- for (int j = i + 1; j < p_bbcode.length(); j++) {
- if (bbcode[j] == ' ') {
- bbcode.remove(j);
- j--;
- continue;
- } else {
- break;
- }
- }
- }
- }
-
- //change newlines to double newlines
-
- CharType dnls[2] = { 0xFFFF, 0 };
- bbcode = bbcode.replace(dnls, "\n");
-
List<String> tag_stack;
+ int pos = 0;
while (pos < bbcode.length()) {
int brk_pos = bbcode.find("[", pos);
@@ -1500,7 +1481,6 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
int brk_end = bbcode.find("]", brk_pos + 1);
if (brk_end == -1) {
- //no close, add the rest
p_rt->add_text(bbcode.substr(brk_pos, bbcode.length() - brk_pos));
break;
@@ -1512,6 +1492,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1, tag.length());
if (tag_stack.size()) {
}
+
if (!tag_ok) {
p_rt->add_text("[");
@@ -1527,7 +1508,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
} else if (tag.begins_with("method ")) {
String m = tag.substr(7, tag.length());
- p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ p_rt->push_color(link_color);
p_rt->push_meta("@" + m);
p_rt->add_text(m + "()");
p_rt->pop();
@@ -1536,7 +1517,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
} else if (doc->class_list.has(tag)) {
- p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ p_rt->push_color(link_color);
p_rt->push_meta("#" + tag);
p_rt->add_text(tag);
p_rt->pop();
@@ -1552,13 +1533,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
} else if (tag == "i") {
//use italics font
- Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color");
- //no italics so emphasize with color
- text_color.r *= 1.1;
- text_color.g *= 1.1;
- text_color.b *= 1.1;
- p_rt->push_color(text_color);
- //p_rt->push_font(get_font("italic","Fonts"));
+ p_rt->push_color(font_color_hl);
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "code" || tag == "codeblock") {
@@ -1728,6 +1703,7 @@ void EditorHelp::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
class_desc->add_color_override("selection_color", EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1)));
+
} break;
default: break;
@@ -1744,9 +1720,23 @@ void EditorHelp::go_to_class(const String &p_class, int p_scroll) {
_goto_desc(p_class, p_scroll);
}
+Vector<Pair<String, int> > EditorHelp::get_sections() {
+ Vector<Pair<String, int> > sections;
+
+ for (int i = 0; i < section_line.size(); i++) {
+ sections.push_back(Pair<String, int>(section_line[i].first, i));
+ }
+ return sections;
+}
+
+void EditorHelp::scroll_to_section(int p_section_index) {
+ int line = section_line[p_section_index].second;
+ class_desc->scroll_to_line(line);
+}
+
void EditorHelp::popup_search() {
- search_dialog->popup_centered(Size2(250, 80));
+ search_dialog->popup_centered(Size2(250, 80) * EDSCALE);
search->grab_focus();
}
@@ -1825,7 +1815,6 @@ EditorHelp::EditorHelp() {
search_dialog->get_ok()->set_text(TTR("Find"));
search_dialog->connect("confirmed", this, "_search_cbk");
search_dialog->set_hide_on_ok(false);
- search_dialog->set_self_modulate(Color(1, 1, 1, 0.8));
/*class_search = memnew( EditorHelpSearch(editor) );
editor->get_gui_base()->add_child(class_search);
diff --git a/editor/editor_help.h b/editor/editor_help.h
index f937e4a723..92c0e2f4d1 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -118,6 +118,7 @@ class EditorHelp : public VBoxContainer {
String edited_class;
+ Vector<Pair<String, int> > section_line;
Map<String, int> method_line;
Map<String, int> signal_line;
Map<String, int> property_line;
@@ -168,6 +169,9 @@ public:
void go_to_help(const String &p_help);
void go_to_class(const String &p_class, int p_scroll = 0);
+ Vector<Pair<String, int> > get_sections();
+ void scroll_to_section(int p_section_index);
+
void popup_search();
void search_again();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 3735c30578..4bcf5a49e6 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -254,6 +254,7 @@ void EditorNode::_notification(int p_what) {
get_tree()->get_root()->set_as_audio_listener_2d(false);
get_tree()->set_auto_accept_quit(false);
get_tree()->connect("files_dropped", this, "_dropped_files");
+ property_editable_warning->set_icon(gui_base->get_icon("NodeWarning","EditorIcons"));
}
if (p_what == NOTIFICATION_EXIT_TREE) {
@@ -1387,6 +1388,11 @@ static bool overrides_external_editor(Object *p_object) {
return script->get_language()->overrides_external_editor();
}
+void EditorNode::_property_editable_warning_pressed() {
+
+ property_editable_warning_dialog->popup_centered_minsize();
+}
+
void EditorNode::_edit_current() {
uint32_t current = editor_history.get_current();
@@ -1398,6 +1404,9 @@ void EditorNode::_edit_current() {
this->current = current_obj;
editor_path->update_path();
+ String editable_warning; //none by default
+ property_editable_warning->hide(); //hide by default
+
if (!current_obj) {
scene_tree_dock->set_selected(NULL);
@@ -1425,6 +1434,22 @@ void EditorNode::_edit_current() {
node_dock->set_node(NULL);
object_menu->set_disabled(false);
EditorNode::get_singleton()->get_import_dock()->set_edit_path(current_res->get_path());
+
+ int subr_idx = current_res->get_path().find("::");
+ if (subr_idx!=-1) {
+ String base_path=current_res->get_path().substr(0,subr_idx);
+ if (FileAccess::exists(base_path+".import")) {
+ editable_warning=TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
+ } else {
+ if (!get_edited_scene() || get_edited_scene()->get_filename()!=base_path) {
+ editable_warning=TTR("This resource belongs to a scene that was instanced or inherited.\nChanges to it will not be kept when saving the current scene.");
+ }
+ }
+ } else if (current_res->get_path().is_resource_file()){
+ if (FileAccess::exists(current_res->get_path()+".import")) {
+ editable_warning=TTR("This resource was imported, so it's not editable. Change it's settings in the import panel and re-import.");
+ }
+ }
} else if (is_node) {
Node *current_node = Object::cast_to<Node>(current_obj);
@@ -1440,12 +1465,25 @@ void EditorNode::_edit_current() {
}
object_menu->get_popup()->clear();
+ if (get_edited_scene() && get_edited_scene()->get_filename()!=String()) {
+ String source_scene = get_edited_scene()->get_filename();
+ if (FileAccess::exists(source_scene+".import")) {
+ editable_warning=TTR("This scene was imported, so changes to it will not be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
+ }
+ }
+
} else {
property_editor->edit(current_obj);
node_dock->set_node(NULL);
}
+ if (editable_warning!=String()) {
+ property_editable_warning->show(); //hide by default
+ property_editable_warning_dialog->set_text(editable_warning);
+
+ }
+
/* Take care of PLUGIN EDITOR */
EditorPlugin *main_plugin = editor_data.get_editor(current_obj);
@@ -4471,6 +4509,9 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("_clear_undo_history", &EditorNode::_clear_undo_history);
ClassDB::bind_method("_dropped_files", &EditorNode::_dropped_files);
ClassDB::bind_method("_toggle_distraction_free_mode", &EditorNode::_toggle_distraction_free_mode);
+ ClassDB::bind_method("_property_editable_warning_pressed", &EditorNode::_property_editable_warning_pressed);
+
+
ClassDB::bind_method(D_METHOD("get_gui_base"), &EditorNode::get_gui_base);
ClassDB::bind_method(D_METHOD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch);
@@ -5232,6 +5273,15 @@ EditorNode::EditorNode() {
search_bar->add_child(clear_button);
clear_button->connect("pressed", this, "_clear_search_box");
+ property_editable_warning = memnew (Button);
+ property_editable_warning->set_text(TTR("Changes may be lost!"));
+ prop_editor_base->add_child(property_editable_warning);
+ property_editable_warning_dialog = memnew( AcceptDialog );
+ gui_base->add_child(property_editable_warning_dialog);
+ property_editable_warning->hide();
+ property_editable_warning->connect("pressed",this,"_property_editable_warning_pressed");
+
+
property_editor = memnew(PropertyEditor);
property_editor->set_autoclear(true);
property_editor->set_show_categories(true);
@@ -5244,6 +5294,7 @@ EditorNode::EditorNode() {
property_editor->hide_top_label();
property_editor->register_text_enter(search_box);
+ Button *property_editable_warning;
prop_editor_base->add_child(property_editor);
property_editor->set_undo_redo(&editor_data.get_undo_redo());
@@ -5251,6 +5302,7 @@ EditorNode::EditorNode() {
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(import_dock);
import_dock->set_name(TTR("Import"));
+
bool use_single_dock_column = (OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x < 1200);
node_dock = memnew(NodeDock);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index ea74bcbd9d..5c6c5be4c8 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -262,6 +262,9 @@ private:
Button *property_forward;
SceneTreeDock *scene_tree_dock;
PropertyEditor *property_editor;
+ Button *property_editable_warning;
+ AcceptDialog *property_editable_warning_dialog;
+ void _property_editable_warning_pressed();
NodeDock *node_dock;
ImportDock *import_dock;
VBoxContainer *prop_editor_vb;
@@ -606,6 +609,7 @@ private:
void _license_tree_selected();
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 3bb6345d73..d7266df67c 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -739,6 +739,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("docks/property_editor/texture_preview_width", 48);
set("docks/property_editor/auto_refresh_interval", 0.3);
set("text_editor/help/doc_path", "");
+ set("text_editor/help/show_help_index", true);
set("filesystem/import/ask_save_before_reimport", false);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index cacd26a20a..304d6acd62 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -285,6 +285,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("contrast_color_1", "Editor", contrast_color_1);
theme->set_color("contrast_color_2", "Editor", contrast_color_2);
+ theme->set_color("font_color", "Editor", font_color);
+
Color success_color = accent_color.linear_interpolate(Color(.6, 1, .6), 0.8);
Color warning_color = accent_color.linear_interpolate(Color(1, 1, .2), 0.8);
Color error_color = accent_color.linear_interpolate(Color(1, .2, .2), 0.8);
@@ -704,7 +706,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
//RichTextLabel
Color rtl_combined_bg_color = dark_color_1.linear_interpolate(script_bg_color, script_bg_color.a);
- Color rtl_font_color = (rtl_combined_bg_color.r + rtl_combined_bg_color.g + rtl_combined_bg_color.b > 0.5 * 3) ? Color(0, 0, 0) : Color(1, 1, 1);
+ Color rtl_mono_color = (rtl_combined_bg_color.r + rtl_combined_bg_color.g + rtl_combined_bg_color.b > 1.5) ? Color(0, 0, 0) : Color(1, 1, 1);
+ Color rtl_font_color = rtl_mono_color.linear_interpolate(rtl_combined_bg_color, 0.25);
theme->set_color("default_color", "RichTextLabel", rtl_font_color);
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
theme->set_stylebox("normal", "RichTextLabel", style_tree_bg);
@@ -715,6 +718,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_code_focus->set_bg_color(rtl_combined_bg_color);
theme->set_stylebox("code_focus", "RichTextLabel", style_code_focus);
+ theme->set_color("font_color", "RichTextLabel", rtl_font_color);
+ theme->set_color("highlight_color", "RichTextLabel", rtl_mono_color);
+
// Panel
theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 2b2358f3d0..ad01d0a31e 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2301,19 +2301,24 @@ void CanvasItemEditor::_notification(int p_what) {
Rect2 r = canvas_item->get_item_rect();
Transform2D xform = canvas_item->get_transform();
- float anchors[4];
- Vector2 pivot;
+ if (r != se->prev_rect || xform != se->prev_xform) {
+ viewport->update();
+ se->prev_rect = r;
+ se->prev_xform = xform;
+ }
+
if (Object::cast_to<Control>(canvas_item)) {
+ float anchors[4];
+ Vector2 pivot;
+
pivot = Object::cast_to<Control>(canvas_item)->get_pivot_offset();
anchors[MARGIN_LEFT] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_LEFT);
anchors[MARGIN_RIGHT] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_RIGHT);
anchors[MARGIN_TOP] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_TOP);
anchors[MARGIN_BOTTOM] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_BOTTOM);
- if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) {
+ if (pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) {
viewport->update();
- se->prev_rect = r;
- se->prev_xform = xform;
se->prev_pivot = pivot;
se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT];
se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT];
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 6f03d086ca..44a9bc6d2e 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -421,8 +421,10 @@ void ScriptEditor::_go_to_tab(int p_idx) {
_update_history_arrows();
_update_script_colors();
_update_members_overview();
+ _update_help_overview();
_update_selected_editor_menu();
_update_members_overview_visibility();
+ _update_help_overview_visibility();
}
void ScriptEditor::_add_recent_script(String p_path) {
@@ -555,6 +557,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) {
_update_script_names();
_update_members_overview_visibility();
+ _update_help_overview_visibility();
_save_layout();
}
@@ -1110,6 +1113,7 @@ void ScriptEditor::_notification(int p_what) {
editor->connect("resource_saved", this, "_res_saved_callback");
script_list->connect("item_selected", this, "_script_selected");
members_overview->connect("item_selected", this, "_members_overview_selected");
+ help_overview->connect("item_selected", this, "_help_overview_selected");
script_split->connect("dragged", this, "_script_split_dragged");
autosave_timer->connect("timeout", this, "_autosave_scripts");
{
@@ -1278,6 +1282,15 @@ void ScriptEditor::_members_overview_selected(int p_idx) {
se->ensure_focus();
}
+void ScriptEditor::_help_overview_selected(int p_idx) {
+ Node *current = tab_container->get_child(tab_container->get_current_tab());
+ EditorHelp *se = Object::cast_to<EditorHelp>(current);
+ if (!se) {
+ return;
+ }
+ se->scroll_to_section(help_overview->get_item_metadata(p_idx));
+}
+
void ScriptEditor::_script_selected(int p_idx) {
grab_focus_block = !Input::get_singleton()->is_mouse_button_pressed(1); //amazing hack, simply amazing
@@ -1387,14 +1400,58 @@ void ScriptEditor::_update_members_overview() {
}
}
+void ScriptEditor::_update_help_overview_visibility() {
+
+ int selected = tab_container->get_current_tab();
+ if (selected < 0 || selected >= tab_container->get_child_count())
+ return;
+
+ Node *current = tab_container->get_child(tab_container->get_current_tab());
+ EditorHelp *se = Object::cast_to<EditorHelp>(current);
+ if (!se) {
+ help_overview->set_visible(false);
+ return;
+ }
+
+ if (help_overview_enabled) {
+ help_overview->set_visible(true);
+ } else {
+ help_overview->set_visible(false);
+ }
+}
+
+void ScriptEditor::_update_help_overview() {
+
+ int selected = tab_container->get_current_tab();
+ if (selected < 0 || selected >= tab_container->get_child_count())
+ return;
+
+ Node *current = tab_container->get_child(tab_container->get_current_tab());
+ EditorHelp *se = Object::cast_to<EditorHelp>(current);
+ if (!se) {
+ return;
+ }
+
+ help_overview->clear();
+
+ Vector<Pair<String, int> > sections = se->get_sections();
+ for (int i = 0; i < sections.size(); i++) {
+ help_overview->add_item(sections[i].first);
+ help_overview->set_item_metadata(i, sections[i].second);
+ }
+}
+
+void _help_overview_selected(int p_idx) {
+}
+
void ScriptEditor::_update_script_colors() {
bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_enabled");
bool highlight_current = EditorSettings::get_singleton()->get("text_editor/open_scripts/highlight_current_script");
int hist_size = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_history_size");
- Color hot_color = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_hot_color");
- Color cold_color = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_cold_color");
+ Color hot_color = get_color("accent_color", "Editor");
+ Color cold_color = get_color("font_color", "Editor");
for (int i = 0; i < script_list->get_item_count(); i++) {
@@ -1531,6 +1588,7 @@ void ScriptEditor::_update_script_names() {
}
_update_members_overview();
+ _update_help_overview();
_update_script_colors();
}
@@ -1785,7 +1843,9 @@ void ScriptEditor::_editor_settings_changed() {
use_space_indentation = EditorSettings::get_singleton()->get("text_editor/indent/type");
members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/show_members_overview");
+ help_overview_enabled = EditorSettings::get_singleton()->get("text_editor/help/show_help_index");
_update_members_overview_visibility();
+ _update_help_overview_visibility();
float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs");
if (autosave_time > 0) {
@@ -2164,6 +2224,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_update_script_names", &ScriptEditor::_update_script_names);
ClassDB::bind_method("_tree_changed", &ScriptEditor::_tree_changed);
ClassDB::bind_method("_members_overview_selected", &ScriptEditor::_members_overview_selected);
+ ClassDB::bind_method("_help_overview_selected", &ScriptEditor::_help_overview_selected);
ClassDB::bind_method("_script_selected", &ScriptEditor::_script_selected);
ClassDB::bind_method("_script_created", &ScriptEditor::_script_created);
ClassDB::bind_method("_script_split_dragged", &ScriptEditor::_script_split_dragged);
@@ -2193,6 +2254,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
pending_auto_reload = false;
auto_reload_running_scripts = false;
members_overview_enabled = true;
+ help_overview_enabled = true;
editor = p_editor;
VBoxContainer *main_container = memnew(VBoxContainer);
@@ -2221,6 +2283,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
members_overview->set_custom_minimum_size(Size2(0, 100)); //need to give a bit of limit to avoid it from disappearing
members_overview->set_v_size_flags(SIZE_EXPAND_FILL);
+ help_overview = memnew(ItemList);
+ list_split->add_child(help_overview);
+ help_overview->set_custom_minimum_size(Size2(0, 100)); //need to give a bit of limit to avoid it from disappearing
+ help_overview->set_v_size_flags(SIZE_EXPAND_FILL);
+
tab_container = memnew(TabContainer);
tab_container->set_tabs_visible(false);
script_split->add_child(tab_container);
@@ -2520,8 +2587,6 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("text_editor/open_scripts/script_temperature_enabled", true);
EDITOR_DEF("text_editor/open_scripts/highlight_current_script", true);
EDITOR_DEF("text_editor/open_scripts/script_temperature_history_size", 15);
- EDITOR_DEF("text_editor/open_scripts/script_temperature_hot_color", Color::html("ed5e5e"));
- EDITOR_DEF("text_editor/open_scripts/script_temperature_cold_color", Color(1, 1, 1, 0.3));
EDITOR_DEF("text_editor/open_scripts/current_script_background_color", Color(1, 1, 1, 0.5));
EDITOR_DEF("text_editor/open_scripts/group_help_pages", true);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/open_scripts/sort_scripts_by", PROPERTY_HINT_ENUM, "Name,Path"));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index d2677c6a4a..03fc4da7ce 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -187,6 +187,8 @@ class ScriptEditor : public PanelContainer {
HSplitContainer *script_split;
ItemList *members_overview;
bool members_overview_enabled;
+ ItemList *help_overview;
+ bool help_overview_enabled;
VSplitContainer *list_split;
TabContainer *tab_container;
EditorFileDialog *file_dialog;
@@ -294,6 +296,10 @@ class ScriptEditor : public PanelContainer {
void _members_overview_selected(int p_idx);
void _script_selected(int p_idx);
+ void _update_help_overview_visibility();
+ void _update_help_overview();
+ void _help_overview_selected(int p_idx);
+
void _find_scripts(Node *p_base, Node *p_current, Set<Ref<Script> > &used);
void _tree_changed();
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index cca5e1f6a0..78d544fdcf 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -59,11 +59,13 @@ public:
enum Mode {
MODE_NEW,
MODE_IMPORT,
- MODE_INSTALL
+ MODE_INSTALL,
+ MODE_RENAME
};
private:
Mode mode;
+ Button *browse;
Label *pp, *pn;
Label *error;
LineEdit *project_path;
@@ -91,20 +93,20 @@ private:
return "";
}
- if (mode != MODE_IMPORT) {
+ if (mode == MODE_IMPORT || mode == MODE_RENAME) {
- if (d->file_exists("project.godot")) {
+ if (valid_path != "" && !d->file_exists("project.godot")) {
- error->set_text(TTR("Invalid project path, project.godot must not exist."));
+ error->set_text(TTR("Invalid project path, project.godot must exist."));
memdelete(d);
return "";
}
} else {
- if (valid_path != "" && !d->file_exists("project.godot")) {
+ if (d->file_exists("project.godot")) {
- error->set_text(TTR("Invalid project path, project.godot must exist."));
+ error->set_text(TTR("Invalid project path, project.godot must not exist."));
memdelete(d);
return "";
}
@@ -172,6 +174,17 @@ private:
void _text_changed(const String &p_text) {
_test_path();
+ error->set_text("");
+ if (p_text == "") {
+
+ error->set_text(TTR("Name cannot be empty"));
+ get_ok()->set_disabled(true);
+ return;
+ }
+ get_ok()->set_disabled(false);
+ }
+
+ void _name_changed(const String &p_text) {
}
void ok_pressed() {
@@ -182,138 +195,165 @@ private:
return;
}
- if (mode == MODE_IMPORT) {
- // nothing to do
+ if (mode == MODE_RENAME) {
+
+ String dir = _test_path();
+ if (dir == "") {
+ error->set_text(TTR("Invalid project path (changed anything?)."));
+ return;
+ }
+
+ ProjectSettings *current = memnew(ProjectSettings);
+ current->add_singleton(ProjectSettings::Singleton("Current"));
+
+ if (current->setup(dir, "")) {
+ error->set_text(TTR("Couldn't get project.godot in project path."));
+ } else {
+ ProjectSettings::CustomMap edited_settings;
+ edited_settings["application/config/name"] = project_name->get_text();
+
+ if (current->save_custom(dir.plus_file("/project.godot"), edited_settings, Vector<String>(), true)) {
+ error->set_text(TTR("Couldn't edit project.godot in project path."));
+ }
+ }
+
+ hide();
+ emit_signal("project_renamed");
} else {
- if (mode == MODE_NEW) {
- ProjectSettings::CustomMap initial_settings;
- initial_settings["application/config/name"] = project_name->get_text();
- initial_settings["application/config/icon"] = "res://icon.png";
- initial_settings["rendering/environment/default_environment"] = "res://default_env.tres";
+ if (mode == MODE_IMPORT) {
+ // nothing to do
+ } else {
+ if (mode == MODE_NEW) {
- if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("/project.godot"), initial_settings, Vector<String>(), false)) {
- error->set_text(TTR("Couldn't create project.godot in project path."));
- } else {
- ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
+ ProjectSettings::CustomMap initial_settings;
+ initial_settings["application/config/name"] = project_name->get_text();
+ initial_settings["application/config/icon"] = "res://icon.png";
+ initial_settings["rendering/environment/default_environment"] = "res://default_env.tres";
- FileAccess *f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE);
- if (!f) {
+ if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("/project.godot"), initial_settings, Vector<String>(), false)) {
error->set_text(TTR("Couldn't create project.godot in project path."));
} else {
- f->store_line("[gd_resource type=\"Environment\" load_steps=2 format=2]");
- f->store_line("[sub_resource type=\"ProceduralSky\" id=1]");
- f->store_line("[resource]");
- f->store_line("background_mode = 2");
- f->store_line("background_sky = SubResource( 1 )");
- memdelete(f);
+ ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
+
+ FileAccess *f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE);
+ if (!f) {
+ error->set_text(TTR("Couldn't create project.godot in project path."));
+ } else {
+ f->store_line("[gd_resource type=\"Environment\" load_steps=2 format=2]");
+ f->store_line("[sub_resource type=\"ProceduralSky\" id=1]");
+ f->store_line("[resource]");
+ f->store_line("background_mode = 2");
+ f->store_line("background_sky = SubResource( 1 )");
+ memdelete(f);
+ }
}
- }
- } else if (mode == MODE_INSTALL) {
+ } else if (mode == MODE_INSTALL) {
- FileAccess *src_f = NULL;
- zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
+ FileAccess *src_f = NULL;
+ zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
- unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io);
- if (!pkg) {
+ unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io);
+ if (!pkg) {
- dialog_error->set_text(TTR("Error opening package file, not in zip format."));
- return;
- }
+ dialog_error->set_text(TTR("Error opening package file, not in zip format."));
+ return;
+ }
- int ret = unzGoToFirstFile(pkg);
+ int ret = unzGoToFirstFile(pkg);
- Vector<String> failed_files;
+ Vector<String> failed_files;
- int idx = 0;
- while (ret == UNZ_OK) {
+ int idx = 0;
+ while (ret == UNZ_OK) {
- //get filename
- unz_file_info info;
- char fname[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ //get filename
+ unz_file_info info;
+ char fname[16384];
+ ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
- String path = fname;
+ String path = fname;
- int depth = 1; //stuff from github comes with tag
- bool skip = false;
- while (depth > 0) {
- int pp = path.find("/");
- if (pp == -1) {
- skip = true;
- break;
+ int depth = 1; //stuff from github comes with tag
+ bool skip = false;
+ while (depth > 0) {
+ int pp = path.find("/");
+ if (pp == -1) {
+ skip = true;
+ break;
+ }
+ path = path.substr(pp + 1, path.length());
+ depth--;
}
- path = path.substr(pp + 1, path.length());
- depth--;
- }
- if (skip || path == String()) {
- //
- } else if (path.ends_with("/")) { // a dir
+ if (skip || path == String()) {
+ //
+ } else if (path.ends_with("/")) { // a dir
- path = path.substr(0, path.length() - 1);
+ path = path.substr(0, path.length() - 1);
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- da->make_dir(dir.plus_file(path));
- memdelete(da);
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ da->make_dir(dir.plus_file(path));
+ memdelete(da);
- } else {
+ } else {
- Vector<uint8_t> data;
- data.resize(info.uncompressed_size);
+ Vector<uint8_t> data;
+ data.resize(info.uncompressed_size);
- //read
- unzOpenCurrentFile(pkg);
- unzReadCurrentFile(pkg, data.ptr(), data.size());
- unzCloseCurrentFile(pkg);
+ //read
+ unzOpenCurrentFile(pkg);
+ unzReadCurrentFile(pkg, data.ptr(), data.size());
+ unzCloseCurrentFile(pkg);
- FileAccess *f = FileAccess::open(dir.plus_file(path), FileAccess::WRITE);
+ FileAccess *f = FileAccess::open(dir.plus_file(path), FileAccess::WRITE);
- if (f) {
- f->store_buffer(data.ptr(), data.size());
- memdelete(f);
- } else {
- failed_files.push_back(path);
+ if (f) {
+ f->store_buffer(data.ptr(), data.size());
+ memdelete(f);
+ } else {
+ failed_files.push_back(path);
+ }
}
- }
- idx++;
- ret = unzGoToNextFile(pkg);
- }
+ idx++;
+ ret = unzGoToNextFile(pkg);
+ }
- unzClose(pkg);
+ unzClose(pkg);
- if (failed_files.size()) {
- String msg = TTR("The following files failed extraction from package:") + "\n\n";
- for (int i = 0; i < failed_files.size(); i++) {
+ if (failed_files.size()) {
+ String msg = TTR("The following files failed extraction from package:") + "\n\n";
+ for (int i = 0; i < failed_files.size(); i++) {
- if (i > 15) {
- msg += "\nAnd " + itos(failed_files.size() - i) + " more files.";
- break;
+ if (i > 15) {
+ msg += "\nAnd " + itos(failed_files.size() - i) + " more files.";
+ break;
+ }
+ msg += failed_files[i] + "\n";
}
- msg += failed_files[i] + "\n";
- }
- dialog_error->set_text(msg);
- dialog_error->popup_centered_minsize();
+ dialog_error->set_text(msg);
+ dialog_error->popup_centered_minsize();
- } else {
- dialog_error->set_text(TTR("Package Installed Successfully!"));
- dialog_error->popup_centered_minsize();
+ } else {
+ dialog_error->set_text(TTR("Package Installed Successfully!"));
+ dialog_error->popup_centered_minsize();
+ }
}
}
- }
- dir = dir.replace("\\", "/");
- if (dir.ends_with("/"))
- dir = dir.substr(0, dir.length() - 1);
- String proj = dir.replace("/", "::");
- EditorSettings::get_singleton()->set("projects/" + proj, dir);
- EditorSettings::get_singleton()->save();
+ dir = dir.replace("\\", "/");
+ if (dir.ends_with("/"))
+ dir = dir.substr(0, dir.length() - 1);
+ String proj = dir.replace("/", "::");
+ EditorSettings::get_singleton()->set("projects/" + proj, dir);
+ EditorSettings::get_singleton()->save();
- hide();
- emit_signal("project_created", dir);
+ hide();
+ emit_signal("project_created", dir);
+ }
}
protected:
@@ -325,6 +365,7 @@ protected:
ClassDB::bind_method("_path_selected", &NewProjectDialog::_path_selected);
ClassDB::bind_method("_file_selected", &NewProjectDialog::_file_selected);
ADD_SIGNAL(MethodInfo("project_created"));
+ ADD_SIGNAL(MethodInfo("project_renamed"));
}
public:
@@ -340,44 +381,85 @@ public:
mode = p_mode;
}
- void show_dialog() {
-
- project_path->clear();
- project_name->clear();
+ void set_project_path(const String &p_path) {
+ project_path->set_text(p_path);
+ }
- if (mode == MODE_IMPORT) {
- set_title(TTR("Import Existing Project"));
- get_ok()->set_text(TTR("Import"));
- pp->set_text(TTR("Project Path (Must Exist):"));
- pn->set_text(TTR("Project Name:"));
- pn->hide();
- project_name->hide();
+ void show_dialog() {
- popup_centered(Size2(500, 125) * EDSCALE);
+ if (mode == MODE_RENAME) {
- } else if (mode == MODE_NEW) {
+ project_path->set_editable(false);
+ browse->set_disabled(true);
- set_title(TTR("Create New Project"));
- get_ok()->set_text(TTR("Create"));
+ set_title(TTR("Rename Project"));
+ get_ok()->set_text(TTR("Rename"));
pp->set_text(TTR("Project Path:"));
pn->set_text(TTR("Project Name:"));
pn->show();
project_name->show();
- popup_centered(Size2(500, 145) * EDSCALE);
- } else if (mode == MODE_INSTALL) {
+ String dir = _test_path();
+ if (dir == "") {
+ error->set_text(TTR("Invalid project path (changed anything?)."));
+ return;
+ }
+ ProjectSettings *current = memnew(ProjectSettings);
+ current->add_singleton(ProjectSettings::Singleton("Current"));
- set_title(TTR("Install Project:") + " " + zip_title);
- get_ok()->set_text(TTR("Install"));
- pp->set_text(TTR("Project Path:"));
- pn->hide();
- project_name->hide();
+ if (current->setup(dir, "")) {
+ error->set_text(TTR("Couldn't get project.godot in project path."));
+ } else {
+ if (current->has("application/config/name")) {
+ String appname = current->get("application/config/name");
+ project_name->set_text(appname);
+ }
+ }
popup_centered(Size2(500, 125) * EDSCALE);
- }
- project_path->grab_focus();
+ project_name->grab_focus();
- _test_path();
+ } else {
+
+ project_path->clear();
+ project_name->clear();
+ project_path->set_editable(true);
+ browse->set_disabled(false);
+
+ if (mode == MODE_IMPORT) {
+ set_title(TTR("Import Existing Project"));
+ get_ok()->set_text(TTR("Import"));
+ pp->set_text(TTR("Project Path (Must Exist):"));
+ pn->set_text(TTR("Project Name:"));
+ pn->hide();
+ project_name->hide();
+
+ popup_centered(Size2(500, 125) * EDSCALE);
+
+ } else if (mode == MODE_NEW) {
+
+ set_title(TTR("Create New Project"));
+ get_ok()->set_text(TTR("Create"));
+ pp->set_text(TTR("Project Path:"));
+ pn->set_text(TTR("Project Name:"));
+ pn->show();
+ project_name->show();
+
+ popup_centered(Size2(500, 145) * EDSCALE);
+ } else if (mode == MODE_INSTALL) {
+
+ set_title(TTR("Install Project:") + " " + zip_title);
+ get_ok()->set_text(TTR("Install"));
+ pp->set_text(TTR("Project Path:"));
+ pn->hide();
+ project_name->hide();
+
+ popup_centered(Size2(500, 125) * EDSCALE);
+ }
+ project_path->grab_focus();
+
+ _test_path();
+ }
}
NewProjectDialog() {
@@ -399,7 +481,7 @@ public:
pphb->add_child(project_path);
project_path->set_h_size_flags(SIZE_EXPAND_FILL);
- Button *browse = memnew(Button);
+ browse = memnew(Button);
pphb->add_child(browse);
browse->set_text(TTR("Browse"));
browse->connect("pressed", this, "_browse_path");
@@ -495,6 +577,7 @@ void ProjectManager::_update_project_buttons() {
erase_btn->set_disabled(selected_list.size() < 1);
open_btn->set_disabled(selected_list.size() < 1);
+ rename_btn->set_disabled(selected_list.size() < 1);
}
void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
@@ -889,6 +972,10 @@ void ProjectManager::_load_recent_projects() {
tabs->set_current_tab(0);
}
+void ProjectManager::_on_project_renamed() {
+ _load_recent_projects();
+}
+
void ProjectManager::_on_project_created(const String &dir) {
bool has_already = false;
for (int i = 0; i < scroll_childs->get_child_count(); i++) {
@@ -1091,6 +1178,21 @@ void ProjectManager::_import_project() {
npdialog->show_dialog();
}
+void ProjectManager::_rename_project() {
+
+ if (selected_list.size() == 0) {
+ return;
+ }
+
+ for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) {
+ const String &selected = E->key();
+ String path = EditorSettings::get_singleton()->get("projects/" + selected);
+ npdialog->set_project_path(path);
+ npdialog->set_mode(NewProjectDialog::MODE_RENAME);
+ npdialog->show_dialog();
+ }
+}
+
void ProjectManager::_erase_project_confirm() {
if (selected_list.size() == 0) {
@@ -1185,10 +1287,12 @@ void ProjectManager::_bind_methods() {
ClassDB::bind_method("_scan_begin", &ProjectManager::_scan_begin);
ClassDB::bind_method("_import_project", &ProjectManager::_import_project);
ClassDB::bind_method("_new_project", &ProjectManager::_new_project);
+ ClassDB::bind_method("_rename_project", &ProjectManager::_rename_project);
ClassDB::bind_method("_erase_project", &ProjectManager::_erase_project);
ClassDB::bind_method("_erase_project_confirm", &ProjectManager::_erase_project_confirm);
ClassDB::bind_method("_exit_dialog", &ProjectManager::_exit_dialog);
ClassDB::bind_method("_load_recent_projects", &ProjectManager::_load_recent_projects);
+ ClassDB::bind_method("_on_project_renamed", &ProjectManager::_on_project_renamed);
ClassDB::bind_method("_on_project_created", &ProjectManager::_on_project_created);
ClassDB::bind_method("_update_scroll_pos", &ProjectManager::_update_scroll_pos);
ClassDB::bind_method("_panel_draw", &ProjectManager::_panel_draw);
@@ -1349,6 +1453,12 @@ ProjectManager::ProjectManager() {
tree_vb->add_child(import);
import->connect("pressed", this, "_import_project");
+ Button *rename = memnew(Button);
+ rename->set_text(TTR("Rename"));
+ tree_vb->add_child(rename);
+ rename->connect("pressed", this, "_rename_project");
+ rename_btn = rename;
+
Button *erase = memnew(Button);
erase->set_text(TTR("Remove"));
tree_vb->add_child(erase);
@@ -1404,6 +1514,7 @@ ProjectManager::ProjectManager() {
npdialog = memnew(NewProjectDialog);
gui_base->add_child(npdialog);
+ npdialog->connect("project_renamed", this, "_on_project_renamed");
npdialog->connect("project_created", this, "_on_project_created");
_load_recent_projects();
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 9fcf10a0d9..67fe0b503f 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -45,6 +45,7 @@ class ProjectManager : public Control {
Button *erase_btn;
Button *open_btn;
+ Button *rename_btn;
Button *run_btn;
FileDialog *scan_dir;
@@ -79,6 +80,7 @@ class ProjectManager : public Control {
void _open_project_confirm();
void _import_project();
void _new_project();
+ void _rename_project();
void _erase_project();
void _erase_project_confirm();
void _update_project_buttons();
@@ -87,6 +89,7 @@ class ProjectManager : public Control {
void _load_recent_projects();
void _on_project_created(const String &dir);
+ void _on_project_renamed();
void _update_scroll_pos(const String &dir);
void _scan_dir(DirAccess *da, float pos, float total, List<String> *r_projects);
diff --git a/modules/gdnative/gd_native_library_editor.cpp b/modules/gdnative/gd_native_library_editor.cpp
new file mode 100644
index 0000000000..8aa931d6c9
--- /dev/null
+++ b/modules/gdnative/gd_native_library_editor.cpp
@@ -0,0 +1,120 @@
+#include "gd_native_library_editor.h"
+#include "gdnative.h"
+
+void GDNativeLibraryEditor::_find_gdnative_singletons(EditorFileSystemDirectory *p_dir, const Set<String> &enabled_list) {
+
+
+ // check children
+
+ for (int i = 0; i < p_dir->get_file_count(); i++) {
+ String file_type = p_dir->get_file_type(i);
+
+ if (file_type != "GDNativeLibrary") {
+ continue;
+ }
+
+ Ref<GDNativeLibrary> lib = ResourceLoader::load(p_dir->get_file_path(i));
+ if (lib.is_valid() && lib->is_singleton_gdnative()) {
+ String path = p_dir->get_file_path(i);
+ TreeItem *ti = libraries->create_item(libraries->get_root());
+ ti->set_text(0,path.get_file());
+ ti->set_tooltip(0,path);
+ ti->set_metadata(0,path);
+ ti->set_cell_mode(1,TreeItem::CELL_MODE_RANGE);
+ ti->set_text(1,"Disabled,Enabled");
+ bool enabled = enabled_list.has(path)?true:false;
+
+ ti->set_range(1,enabled?1:0);
+ ti->set_custom_color(1,enabled?Color(0,1,0):Color(1,0,0));
+ }
+ }
+
+ // check subdirectories
+ for (int i = 0; i < p_dir->get_subdir_count(); i++) {
+ _find_gdnative_singletons(p_dir->get_subdir(i),enabled_list);
+ }
+
+
+}
+
+void GDNativeLibraryEditor::_update_libraries() {
+
+ updating=true;
+ libraries->clear();
+ libraries->create_item(); //rppt
+
+ Vector<String> enabled_paths;
+ if (ProjectSettings::get_singleton()->has("gdnative/singletons")) {
+ enabled_paths=ProjectSettings::get_singleton()->get("gdnative/singletons");
+ }
+ Set<String> enabled_list;
+ for(int i=0;i<enabled_paths.size();i++) {
+ enabled_list.insert(enabled_paths[i]);
+ }
+
+ EditorFileSystemDirectory *fs = EditorFileSystem::get_singleton()->get_filesystem();
+ if (fs) {
+ _find_gdnative_singletons(fs,enabled_list);
+ }
+
+ updating=false;
+
+}
+
+void GDNativeLibraryEditor::_item_edited() {
+ if (updating)
+ return;
+
+ TreeItem *item = libraries->get_edited();
+ if (!item)
+ return;
+
+ bool enabled = item->get_range(1);
+ String path = item->get_metadata(0);
+
+ Vector<String> enabled_paths;
+ if (ProjectSettings::get_singleton()->has("gdnative/singletons")) {
+ enabled_paths=ProjectSettings::get_singleton()->get("gdnative/singletons");
+ }
+
+ if (enabled) {
+ if (enabled_paths.find(path)==-1) {
+ enabled_paths.push_back(path);
+ }
+ } else {
+ enabled_paths.erase(path);
+ }
+
+ if (enabled_paths.size()) {
+ ProjectSettings::get_singleton()->set("gdnative/singletons",enabled_paths);
+ } else {
+ ProjectSettings::get_singleton()->set("gdnative/singletons",Variant());
+ }
+}
+
+void GDNativeLibraryEditor::_notification(int p_what) {
+
+ if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+ if (is_visible_in_tree()) {
+ _update_libraries();
+ }
+ }
+}
+
+void GDNativeLibraryEditor::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_item_edited"),&GDNativeLibraryEditor::_item_edited);
+}
+
+GDNativeLibraryEditor::GDNativeLibraryEditor()
+{
+ libraries = memnew( Tree );
+ libraries->set_columns(2);
+ libraries->set_column_titles_visible(true);
+ libraries->set_column_title(0,TTR("Library"));
+ libraries->set_column_title(1,TTR("Status"));
+ libraries->set_hide_root(true);
+ add_margin_child(TTR("Libraries: "),libraries,true);
+ updating=false;
+ libraries->connect("item_edited",this,"_item_edited");
+}
diff --git a/modules/gdnative/gd_native_library_editor.h b/modules/gdnative/gd_native_library_editor.h
new file mode 100644
index 0000000000..a6c8f31790
--- /dev/null
+++ b/modules/gdnative/gd_native_library_editor.h
@@ -0,0 +1,26 @@
+#ifndef GD_NATIVE_LIBRARY_EDITOR_H
+#define GD_NATIVE_LIBRARY_EDITOR_H
+
+#ifdef TOOLS_ENABLED
+#include "editor/project_settings_editor.h"
+#include "editor/editor_file_system.h"
+
+class GDNativeLibraryEditor : public VBoxContainer
+{
+ Tree *libraries;
+
+ bool updating;
+ void _update_libraries();
+
+ void _find_gdnative_singletons(EditorFileSystemDirectory *p_dir,const Set<String>& enabled_list);
+ void _item_edited();
+protected:
+
+ void _notification(int p_what);
+ static void _bind_methods();
+public:
+ GDNativeLibraryEditor();
+};
+
+#endif
+#endif // GD_NATIVE_LIBRARY_EDITOR_H
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 559e9fa455..dc0da5021d 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -43,7 +43,7 @@
#ifdef TOOLS_ENABLED
#include "editor/editor_node.h"
-
+#include "gd_native_library_editor.h"
// Class used to discover singleton gdnative files
void actual_discoverer_handler();
@@ -99,6 +99,7 @@ Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
void actual_discoverer_handler() {
EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
+
Set<String> file_paths = get_gdnative_singletons(dir);
Array files;
@@ -115,7 +116,13 @@ void actual_discoverer_handler() {
GDNativeSingletonDiscover *discoverer = NULL;
-void discoverer_callback() {
+static void editor_init_callback() {
+
+ GDNativeLibraryEditor *library_editor = memnew( GDNativeLibraryEditor );
+ library_editor->set_name(TTR("GDNative"));
+ ProjectSettingsEditor::get_singleton()->get_tabs()->add_child(library_editor);
+
+
discoverer = memnew(GDNativeSingletonDiscover);
EditorFileSystem::get_singleton()->connect("filesystem_changed", discoverer, "get_class");
}
@@ -184,7 +191,7 @@ void register_gdnative_types() {
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
- EditorNode::add_init_callback(discoverer_callback);
+ EditorNode::add_init_callback(editor_init_callback);
}
#endif
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 093f01c49f..39f23fcf50 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -2002,7 +2002,7 @@ void VisualScriptEngineSingleton::_bind_methods() {
cc += E->get().name;
}
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "/constant", PROPERTY_HINT_ENUM, cc), "set_singleton", "get_singleton");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "constant", PROPERTY_HINT_ENUM, cc), "set_singleton", "get_singleton");
}
VisualScriptEngineSingleton::VisualScriptEngineSingleton() {
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 6eb2422f36..80fab9442b 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -59,10 +59,10 @@ Files extracted from upstream source:
Use UI font if exists, because it has tight vertial metrix and good for UI.
-### Adobe Source Code Pro Regular
+### Mononoki Regular
-- Upstream: https://github.com/adobe-fonts/source-code-pro
-- Version: 2.030
+- Upstream: https://github.com/madmalik/mononoki
+- Version: 1.2
- License: OFL-1.1
### DroidSans*.ttf
diff --git a/thirdparty/fonts/LICENSE.SourceCodePro.txt b/thirdparty/fonts/LICENSE_Mononoki
index f430ee5dbe..6ef130c5ef 100644
--- a/thirdparty/fonts/LICENSE.SourceCodePro.txt
+++ b/thirdparty/fonts/LICENSE_Mononoki
@@ -1,8 +1,9 @@
-Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
+Copyright (c) 2013, Matthias Tellen matthias.tellen@googlemail.com,
+with Reserved Font Name monoOne.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
-
-This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
-----------------------------------------------------------
@@ -91,4 +92,3 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
-
diff --git a/thirdparty/fonts/mononoki_Regular.ttf b/thirdparty/fonts/mononoki_Regular.ttf
new file mode 100644
index 0000000000..9510ac85d1
--- /dev/null
+++ b/thirdparty/fonts/mononoki_Regular.ttf
Binary files differ
diff --git a/thirdparty/fonts/source_code_pro.otf b/thirdparty/fonts/source_code_pro.otf
deleted file mode 100644
index 1bae0027ff..0000000000
--- a/thirdparty/fonts/source_code_pro.otf
+++ /dev/null
Binary files differ