From 21f6cc75a1f6b6c90ae750facd2fbd922211533b Mon Sep 17 00:00:00 2001 From: Poommetee Ketson Date: Mon, 3 Jul 2017 01:17:47 +0700 Subject: [PATCH] Authors/About: support for multiple sections --- editor/SCsub | 31 ++++++++--- editor/editor_node.cpp | 115 ++++++++++++++++++++++++----------------- 2 files changed, 93 insertions(+), 53 deletions(-) diff --git a/editor/SCsub b/editor/SCsub index ffdeed1523d..a26f6bba77d 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -143,6 +143,9 @@ def make_translations_header(target, source, env): 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].srcnode().abspath dst = target[0].srcnode().abspath f = open(src, "rb") @@ -151,19 +154,35 @@ def make_authors_header(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _EDITOR_AUTHORS_H\n") g.write("#define _EDITOR_AUTHORS_H\n") - g.write("static const char *dev_names[] = {\n") + current_section = "" name_count = -1 + + def close_section(): + g.write("\t0\n") + g.write("};\n") + g.write("#define " + current_section.upper() + "_COUNT " + str(name_count) + "\n") + for line in f: if name_count >= 0: if line.startswith(" "): g.write("\t\"" + line.strip() + "\",\n") name_count += 1 - elif line.strip() == "## Developers": - name_count = 0 - g.write("\t0\n") - g.write("};\n") - g.write("#define AUTHORS_COUNT " + str(name_count) + "\n") + continue + if line.startswith("## "): + if name_count >= 0: + close_section() + name_count = -1 + for i in range(len(sections)): + if line.strip().endswith(sections[i]): + current_section = sections_id[i] + name_count = 0 + g.write("static const char *" + current_section + "[] = {\n") + break + + if name_count >= 0: + close_section() + g.write("#endif\n") if (env["tools"] == "yes"): diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 77050acd7c6..22746905691 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2646,7 +2646,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { OS::get_singleton()->shell_open("https://godotengine.org/community"); } break; case HELP_ABOUT: { - about->popup_centered_minsize(Size2(500, 130) * EDSCALE); + about->popup_centered_minsize(Size2(780, 500) * EDSCALE); } break; case SOURCES_REIMPORT: { @@ -6042,52 +6042,73 @@ EditorNode::EditorNode() { export_template_manager = memnew(ExportTemplateManager); gui_base->add_child(export_template_manager); - about = memnew(AcceptDialog); - about->set_title(TTR("Thanks from the Godot community!")); - about->get_ok()->set_text(TTR("Thanks!")); - about->set_hide_on_ok(true); - gui_base->add_child(about); - VBoxContainer *vbc = memnew(VBoxContainer); - HBoxContainer *hbc = memnew(HBoxContainer); - hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); - hbc->set_alignment(BoxContainer::ALIGN_CENTER); - about->add_child(vbc); - vbc->add_child(hbc); - Label *about_text = memnew(Label); - about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + TTR("Godot Engine contributors") + "\n"); - TextureRect *logo = memnew(TextureRect); - logo->set_texture(gui_base->get_icon("Logo", "EditorIcons")); - hbc->add_child(logo); - hbc->add_child(about_text); - TabContainer *tc = memnew(TabContainer); - tc->set_custom_minimum_size(Vector2(740, 300)); - vbc->add_child(tc); - ScrollContainer *dev_base = memnew(ScrollContainer); - dev_base->set_name(TTR("Developers")); - tc->add_child(dev_base); - HBoxContainer *dev_hbc = memnew(HBoxContainer); - dev_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); - dev_base->add_child(dev_hbc); - for (int i = 0; i < 3; i++) { - Label *dev_label = memnew(Label); - dev_label->set_h_size_flags(Control::SIZE_EXPAND); - dev_label->set_v_size_flags(Control::SIZE_FILL); - dev_hbc->add_child(dev_label); - } - int dev_name_index = 0; - int dev_name_column = 0; - const int dev_index_max = AUTHORS_COUNT / 3 + (AUTHORS_COUNT % 3 == 0 ? 0 : 1); - String dev_name = ""; - const char **dev_names_ptr = dev_names; - while (*dev_names_ptr) { - dev_name += String::utf8(*dev_names_ptr++); - if (++dev_name_index == dev_index_max || !*dev_names_ptr) { - dev_hbc->get_child(dev_name_column)->cast_to