diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/SCsub | 12 | ||||
-rw-r--r-- | editor/create_dialog.cpp | 6 | ||||
-rw-r--r-- | editor/doc/doc_data.cpp | 6 | ||||
-rw-r--r-- | editor/editor_builders.py | 262 | ||||
-rw-r--r-- | editor/editor_help.cpp | 24 | ||||
-rw-r--r-- | editor/project_export.cpp | 47 | ||||
-rw-r--r-- | editor/project_export.h | 1 |
7 files changed, 74 insertions, 284 deletions
diff --git a/editor/SCsub b/editor/SCsub index d9bdf42d6f..6a4b06a97a 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -81,18 +81,6 @@ if env['tools']: env.Depends('#editor/builtin_fonts.gen.h', flist) env.CommandNoCache('#editor/builtin_fonts.gen.h', flist, run_in_subprocess(editor_builders.make_fonts_header)) - # Authors - env.Depends('#editor/authors.gen.h', "../AUTHORS.md") - env.CommandNoCache('#editor/authors.gen.h', "../AUTHORS.md", run_in_subprocess(editor_builders.make_authors_header)) - - # Donors - env.Depends('#editor/donors.gen.h', "../DONORS.md") - env.CommandNoCache('#editor/donors.gen.h', "../DONORS.md", run_in_subprocess(editor_builders.make_donors_header)) - - # License - env.Depends('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"]) - env.CommandNoCache('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], run_in_subprocess(editor_builders.make_license_header)) - env.add_source_files(env.editor_sources, "*.cpp") env.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"]) diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 8433f4ff7b..fd607e5b63 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -497,7 +497,11 @@ Object *CreateDialog::instance_selected() { if (custom != String()) { if (ScriptServer::is_global_class(custom)) { - return EditorNode::get_editor_data().script_class_instance(custom); + Object *obj = EditorNode::get_editor_data().script_class_instance(custom); + Node *n = Object::cast_to<Node>(obj); + if (n) + n->set_name(custom); + return obj; } return EditorNode::get_editor_data().instance_custom_type(selected->get_text(0), custom); } else { diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index fe1cf3484e..bbe52bdc76 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -382,7 +382,11 @@ void DocData::generate(bool p_basic_types) { PropertyInfo arginfo = EV->get().arguments[i]; ArgumentDoc argument; argument.name = arginfo.name; - argument.type = Variant::get_type_name(arginfo.type); + if (arginfo.type == Variant::OBJECT && arginfo.class_name != StringName()) { + argument.type = arginfo.class_name.operator String(); + } else { + argument.type = Variant::get_type_name(arginfo.type); + } signal.arguments.push_back(argument); } diff --git a/editor/editor_builders.py b/editor/editor_builders.py index 6c2f9e298e..fa037980c2 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -146,267 +146,5 @@ def make_translations_header(target, source, env): g.close() - -def make_authors_header(target, source, env): - - sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"] - sections_id = ["dev_founders", "dev_lead", "dev_manager", "dev_names"] - - src = source[0] - dst = target[0] - f = open_utf8(src, "r") - g = open_utf8(dst, "w") - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_AUTHORS_H\n") - g.write("#define _EDITOR_AUTHORS_H\n") - - current_section = "" - reading = False - - def close_section(): - g.write("\t0\n") - g.write("};\n") - - for line in f: - if reading: - if line.startswith(" "): - g.write("\t\"" + escape_string(line.strip()) + "\",\n") - continue - if line.startswith("## "): - if reading: - close_section() - reading = False - for i in range(len(sections)): - if line.strip().endswith(sections[i]): - current_section = escape_string(sections_id[i]) - reading = True - g.write("static const char *" + current_section + "[] = {\n") - break - - if reading: - close_section() - - g.write("#endif\n") - - g.close() - f.close() - -def make_donors_header(target, source, env): - - sections = ["Platinum sponsors", "Gold sponsors", "Mini sponsors", "Gold donors", "Silver donors", "Bronze donors"] - sections_id = ["donor_s_plat", "donor_s_gold", "donor_s_mini", "donor_gold", "donor_silver", "donor_bronze"] - - src = source[0] - dst = target[0] - f = open_utf8(src, "r") - g = open_utf8(dst, "w") - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_DONORS_H\n") - g.write("#define _EDITOR_DONORS_H\n") - - current_section = "" - reading = False - - def close_section(): - g.write("\t0\n") - g.write("};\n") - - for line in f: - if reading >= 0: - if line.startswith(" "): - g.write("\t\"" + escape_string(line.strip()) + "\",\n") - continue - if line.startswith("## "): - if reading: - close_section() - reading = False - for i in range(len(sections)): - if line.strip().endswith(sections[i]): - current_section = escape_string(sections_id[i]) - reading = True - g.write("static const char *" + current_section + "[] = {\n") - break - - if reading: - close_section() - - g.write("#endif\n") - - g.close() - f.close() - - -def make_license_header(target, source, env): - - src_copyright = source[0] - src_license = source[1] - dst = target[0] - f = open_utf8(src_license, "r") - fc = open_utf8(src_copyright, "r") - g = open_utf8(dst, "w") - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_LICENSE_H\n") - g.write("#define _EDITOR_LICENSE_H\n") - g.write("static const char *about_license =") - - for line in f: - escaped_string = escape_string(line.strip()) - g.write("\n\t\"" + escaped_string + "\\n\"") - - g.write(";\n") - - tp_current = 0 - tp_file = "" - tp_comment = "" - tp_copyright = "" - tp_license = "" - - tp_licensename = "" - tp_licensebody = "" - - tp = [] - tp_licensetext = [] - for line in fc: - if line.startswith("#"): - continue - - if line.startswith("Files:"): - tp_file = line[6:].strip() - tp_current = 1 - elif line.startswith("Comment:"): - tp_comment = line[8:].strip() - tp_current = 2 - elif line.startswith("Copyright:"): - tp_copyright = line[10:].strip() - tp_current = 3 - elif line.startswith("License:"): - if tp_current != 0: - tp_license = line[8:].strip() - tp_current = 4 - else: - tp_licensename = line[8:].strip() - tp_current = 5 - elif line.startswith(" "): - if tp_current == 1: - tp_file += "\n" + line.strip() - elif tp_current == 3: - tp_copyright += "\n" + line.strip() - elif tp_current == 5: - if line.strip() == ".": - tp_licensebody += "\n" - else: - tp_licensebody += line[1:] - else: - if tp_current != 0: - if tp_current == 5: - tp_licensetext.append([tp_licensename, tp_licensebody]) - - tp_licensename = "" - tp_licensebody = "" - else: - added = False - for i in tp: - if i[0] == tp_comment: - i[1].append([tp_file, tp_copyright, tp_license]) - added = True - break - if not added: - tp.append([tp_comment,[[tp_file, tp_copyright, tp_license]]]) - - tp_file = [] - tp_comment = "" - tp_copyright = [] - tp_license = "" - tp_current = 0 - - tp_licensetext.append([tp_licensename, tp_licensebody]) - - about_thirdparty = "" - about_tp_copyright_count = "" - about_tp_license = "" - about_tp_copyright = "" - about_tp_file = "" - - for i in tp: - about_thirdparty += "\t\"" + i[0] + "\",\n" - about_tp_copyright_count += str(len(i[1])) + ", " - for j in i[1]: - file_body = "" - copyright_body = "" - for k in j[0].split("\n"): - if file_body != "": - file_body += "\\n\"\n" - escaped_string = escape_string(k.strip()) - file_body += "\t\"" + escaped_string - for k in j[1].split("\n"): - if copyright_body != "": - copyright_body += "\\n\"\n" - escaped_string = escape_string(k.strip()) - copyright_body += "\t\"" + escaped_string - - about_tp_file += "\t" + file_body + "\",\n" - about_tp_copyright += "\t" + copyright_body + "\",\n" - about_tp_license += "\t\"" + j[2] + "\",\n" - - about_license_name = "" - about_license_body = "" - - for i in tp_licensetext: - body = "" - for j in i[1].split("\n"): - if body != "": - body += "\\n\"\n" - escaped_string = escape_string(j.strip()) - body += "\t\"" + escaped_string - - about_license_name += "\t\"" + i[0] + "\",\n" - about_license_body += "\t" + body + "\",\n" - - g.write("static const char *about_thirdparty[] = {\n") - g.write(about_thirdparty) - g.write("\t0\n") - g.write("};\n") - g.write("#define THIRDPARTY_COUNT " + str(len(tp)) + "\n") - - g.write("static const int about_tp_copyright_count[] = {\n\t") - g.write(about_tp_copyright_count) - g.write("0\n};\n") - - g.write("static const char *about_tp_file[] = {\n") - g.write(about_tp_file) - g.write("\t0\n") - g.write("};\n") - - g.write("static const char *about_tp_copyright[] = {\n") - g.write(about_tp_copyright) - g.write("\t0\n") - g.write("};\n") - - g.write("static const char *about_tp_license[] = {\n") - g.write(about_tp_license) - g.write("\t0\n") - g.write("};\n") - - g.write("static const char *about_license_name[] = {\n") - g.write(about_license_name) - g.write("\t0\n") - g.write("};\n") - g.write("#define LICENSE_COUNT " + str(len(tp_licensetext)) + "\n") - - g.write("static const char *about_license_body[] = {\n") - g.write(about_license_body) - g.write("\t0\n") - g.write("};\n") - - g.write("#endif\n") - - g.close() - fc.close() - f.close() - - if __name__ == '__main__': subprocess_main(globals()) diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 5a0a49d577..d84b9bff91 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -225,7 +225,6 @@ bool EditorHelpSearch::IncrementalSearch::work(uint64_t slot) { void EditorHelpSearch::_update_search() { search_options->clear(); - search_options->set_hide_root(true); String term = search_box->get_text(); if (term.length() < 2) @@ -307,6 +306,7 @@ EditorHelpSearch::EditorHelpSearch() { search_box->connect("text_changed", this, "_text_changed"); search_box->connect("gui_input", this, "_sbox_input"); search_options = memnew(Tree); + search_options->set_hide_root(true); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); @@ -397,6 +397,16 @@ void EditorHelpIndex::_notification(int p_what) { //_update_icons search_box->set_right_icon(get_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); + + bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines"); + Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color"); + + if (enable_rl) { + class_list->add_constant_override("draw_relationship_lines", 1); + class_list->add_color_override("relationship_line_color", rl_color); + } else { + class_list->add_constant_override("draw_relationship_lines", 0); + } } } @@ -410,7 +420,6 @@ void EditorHelpIndex::_update_class_list() { class_list->clear(); tree_item_map.clear(); TreeItem *root = class_list->create_item(); - class_list->set_hide_root(true); String filter = search_box->get_text().strip_edges(); String to_select = ""; @@ -489,10 +498,21 @@ EditorHelpIndex::EditorHelpIndex() { class_list = memnew(Tree); vbc->add_margin_child(TTR("Class List:") + " ", class_list, true); + class_list->set_hide_root(true); class_list->set_v_size_flags(SIZE_EXPAND_FILL); class_list->connect("item_activated", this, "_tree_item_selected"); + bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines"); + Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color"); + + if (enable_rl) { + class_list->add_constant_override("draw_relationship_lines", 1); + class_list->add_color_override("relationship_line_color", rl_color); + } else { + class_list->add_constant_override("draw_relationship_lines", 0); + } + get_ok()->set_text(TTR("Open")); set_title(TTR("Search Classes")); } diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 019d5d382c..df79317549 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -723,6 +723,25 @@ void ProjectExportDialog::_open_export_template_manager() { hide(); } +void ProjectExportDialog::_validate_export_path(const String &p_path) { + // Disable export via OK button or Enter key if LineEdit has an empty filename + bool invalid_path = (p_path.get_file().get_basename() == ""); + + // Check if state change before needlessly messing with signals + if (invalid_path && export_project->get_ok()->is_disabled()) + return; + if (!invalid_path && !export_project->get_ok()->is_disabled()) + return; + + if (invalid_path) { + export_project->get_ok()->set_disabled(true); + export_project->get_line_edit()->disconnect("text_entered", export_project, "_file_entered"); + } else { + export_project->get_ok()->set_disabled(false); + export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered"); + } +} + void ProjectExportDialog::_export_project() { Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current()); @@ -732,12 +751,19 @@ void ProjectExportDialog::_export_project() { export_project->set_access(FileDialog::ACCESS_FILESYSTEM); export_project->clear_filters(); - export_project->set_current_file(default_filename); String extension = platform->get_binary_extension(current); - if (extension != String()) { export_project->add_filter("*." + extension + " ; " + platform->get_name() + " Export"); + export_project->set_current_file(default_filename + "." + extension); + } else { + export_project->set_current_file(default_filename); + } + + // Ensure that signal is connected if previous attempt left it disconnected with _validate_export_path + if (!export_project->get_line_edit()->is_connected("text_entered", export_project, "_file_entered")) { + export_project->get_ok()->set_disabled(false); + export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered"); } export_project->set_mode(FileDialog::MODE_SAVE_FILE); @@ -746,7 +772,7 @@ void ProjectExportDialog::_export_project() { void ProjectExportDialog::_export_project_to_path(const String &p_path) { // Save this name for use in future exports (but drop the file extension) - default_filename = p_path.get_basename().get_file(); + default_filename = p_path.get_file().get_basename(); EditorSettings::get_singleton()->set_project_metadata("export_options", "default_filename", default_filename); Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current()); @@ -785,11 +811,13 @@ void ProjectExportDialog::_bind_methods() { ClassDB::bind_method("_export_pck_zip", &ProjectExportDialog::_export_pck_zip); ClassDB::bind_method("_export_pck_zip_selected", &ProjectExportDialog::_export_pck_zip_selected); ClassDB::bind_method("_open_export_template_manager", &ProjectExportDialog::_open_export_template_manager); + ClassDB::bind_method("_validate_export_path", &ProjectExportDialog::_validate_export_path); ClassDB::bind_method("_export_project", &ProjectExportDialog::_export_project); ClassDB::bind_method("_export_project_to_path", &ProjectExportDialog::_export_project_to_path); ClassDB::bind_method("_custom_features_changed", &ProjectExportDialog::_custom_features_changed); ClassDB::bind_method("_tab_changed", &ProjectExportDialog::_tab_changed); } + ProjectExportDialog::ProjectExportDialog() { set_title(TTR("Export")); @@ -942,6 +970,9 @@ ProjectExportDialog::ProjectExportDialog() { get_cancel()->set_text(TTR("Close")); get_ok()->set_text(TTR("Export PCK/Zip")); export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export"); + export_button->connect("pressed", this, "_export_project"); + // Disable initially before we select a valid preset + export_button->set_disabled(true); export_pck_zip = memnew(FileDialog); export_pck_zip->add_filter("*.zip ; ZIP File"); @@ -981,7 +1012,7 @@ ProjectExportDialog::ProjectExportDialog() { export_project->set_access(FileDialog::ACCESS_FILESYSTEM); add_child(export_project); export_project->connect("file_selected", this, "_export_project_to_path"); - export_button->connect("pressed", this, "_export_project"); + export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path"); export_debug = memnew(CheckButton); export_debug->set_text(TTR("Export With Debug")); @@ -997,10 +1028,14 @@ ProjectExportDialog::ProjectExportDialog() { editor_icons = "EditorIcons"; - default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", String()); - + default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", ""); + // If no default set, use project name if (default_filename == "") { + // If no project name defined, use a sane default default_filename = ProjectSettings::get_singleton()->get("application/config/name"); + if (default_filename == "") { + default_filename = "UnnamedProject"; + } } } diff --git a/editor/project_export.h b/editor/project_export.h index 1f8723febd..552c6d7faf 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -136,6 +136,7 @@ private: void _export_pck_zip(); void _export_pck_zip_selected(const String &p_path); + void _validate_export_path(const String &p_path); void _export_project(); void _export_project_to_path(const String &p_path); |