diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/SCsub | 149 | ||||
-rw-r--r-- | editor/editor_node.cpp | 102 | ||||
-rw-r--r-- | editor/editor_node.h | 5 | ||||
-rw-r--r-- | editor/import/resource_importer_wav.cpp | 11 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/shader_graph_editor_plugin.cpp | 2 |
8 files changed, 262 insertions, 21 deletions
diff --git a/editor/SCsub b/editor/SCsub index 47bdec2e0d..f0d378c097 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -187,9 +187,11 @@ def make_authors_header(target, source, env): def make_license_header(target, source, env): - src = source[0].srcnode().abspath + src_copyright = source[0].srcnode().abspath + src_license = source[1].srcnode().abspath dst = target[0].srcnode().abspath - f = open(src, "rb") + f = open(src_license, "rb") + fc = open(src_copyright, "rb") g = open(dst, "wb") g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") @@ -201,6 +203,145 @@ def make_license_header(target, source, env): g.write("\n\t\"" + line.strip().replace("\"", "\\\"") + "\\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 + + 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" + file_body += "\t\"" + k.strip().replace("\"", "\\\"") + for k in j[1].split("\n"): + if copyright_body != "": + copyright_body += "\\n\"\n" + copyright_body += "\t\"" + k.strip().replace("\"", "\\\"") + + 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" + body += "\t\"" + j.strip().replace("\"", "\\\"") + + 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") if (env["tools"] == "yes"): @@ -254,8 +395,8 @@ if (env["tools"] == "yes"): env.Command('#editor/authors.gen.h', "../AUTHORS.md", make_authors_header) # License - env.Depends('#editor/license.gen.h', "../LICENSE.txt") - env.Command('#editor/license.gen.h', "../LICENSE.txt", make_license_header) + env.Depends('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"]) + env.Command('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], make_license_header) env.add_source_files(env.editor_sources, "*.cpp") diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index c52a133e78..1df991ab24 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4948,6 +4948,13 @@ void EditorNode::_check_gui_base_size() { } } +void EditorNode::_license_tree_selected() { + + TreeItem *selected = _tpl_tree->get_selected(); + _tpl_text->select(0, 0, 0, 0); + _tpl_text->set_text(selected->get_metadata(0)); +} + void EditorNode::open_export_template_manager() { export_template_manager->popup_manager(); @@ -5037,6 +5044,8 @@ void EditorNode::_bind_methods() { ClassDB::bind_method(D_METHOD("_dim_timeout"), &EditorNode::_dim_timeout); ClassDB::bind_method(D_METHOD("_check_gui_base_size"), &EditorNode::_check_gui_base_size); + ClassDB::bind_method(D_METHOD("_license_tree_selected"), &EditorNode::_license_tree_selected); + ADD_SIGNAL(MethodInfo("play_pressed")); ADD_SIGNAL(MethodInfo("pause_pressed")); ADD_SIGNAL(MethodInfo("stop_pressed")); @@ -6110,15 +6119,6 @@ EditorNode::EditorNode() { dev_base->set_v_size_flags(Control::SIZE_EXPAND); tc->add_child(dev_base); - TextEdit *license = memnew(TextEdit); - license->set_name(TTR("License")); - license->set_h_size_flags(Control::SIZE_EXPAND_FILL); - license->set_v_size_flags(Control::SIZE_EXPAND_FILL); - license->set_wrap(true); - license->set_readonly(true); - license->set_text(String::utf8(about_license)); - tc->add_child(license); - VBoxContainer *dev_vbc = memnew(VBoxContainer); dev_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); dev_base->add_child(dev_vbc); @@ -6151,6 +6151,90 @@ EditorNode::EditorNode() { hs->set_modulate(Color(0, 0, 0, 0)); dev_vbc->add_child(hs); } + + TextEdit *license = memnew(TextEdit); + license->set_name(TTR("License")); + license->set_h_size_flags(Control::SIZE_EXPAND_FILL); + license->set_v_size_flags(Control::SIZE_EXPAND_FILL); + license->set_wrap(true); + license->set_readonly(true); + license->set_text(String::utf8(about_license)); + tc->add_child(license); + + VBoxContainer *license_thirdparty = memnew(VBoxContainer); + license_thirdparty->set_name(TTR("Thirdparty License")); + license_thirdparty->set_h_size_flags(Control::SIZE_EXPAND_FILL); + tc->add_child(license_thirdparty); + + Label *tpl_label = memnew(Label); + tpl_label->set_custom_minimum_size(Size2(0, 64 * EDSCALE)); + tpl_label->set_h_size_flags(Control::SIZE_EXPAND_FILL); + tpl_label->set_autowrap(true); + tpl_label->set_text(TTR("Godot Engine relies on a number of thirdparty free and open source libraries, all compatible with the terms of its MIT license. The following is an exhaustive list of all such thirdparty components with their respective copyright statements and license terms.")); + license_thirdparty->add_child(tpl_label); + + HSplitContainer *tpl_hbc = memnew(HSplitContainer); + tpl_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); + tpl_hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL); + tpl_hbc->set_split_offset(240 * EDSCALE); + license_thirdparty->add_child(tpl_hbc); + + _tpl_tree = memnew(Tree); + _tpl_tree->set_hide_root(true); + TreeItem *root = _tpl_tree->create_item(); + TreeItem *tpl_ti_all = _tpl_tree->create_item(root); + tpl_ti_all->set_text(0, TTR("All Components")); + TreeItem *tpl_ti_tp = _tpl_tree->create_item(root); + tpl_ti_tp->set_text(0, TTR("Components")); + tpl_ti_tp->set_selectable(0, false); + TreeItem *tpl_ti_lc = _tpl_tree->create_item(root); + tpl_ti_lc->set_text(0, TTR("Licenses")); + tpl_ti_lc->set_selectable(0, false); + int read_idx = 0; + String long_text = ""; + for (int i = 0; i < THIRDPARTY_COUNT; i++) { + + TreeItem *ti = _tpl_tree->create_item(tpl_ti_tp); + String thirdparty = String(about_thirdparty[i]); + ti->set_text(0, thirdparty); + String text = thirdparty + "\n"; + long_text += "- " + thirdparty + "\n\n"; + for (int j = 0; j < about_tp_copyright_count[i]; j++) { + + text += "\n Files:\n " + String(about_tp_file[read_idx]).replace("\n", "\n ") + "\n"; + String copyright = String::utf8(" \u00A9 ") + String::utf8(about_tp_copyright[read_idx]).replace("\n", String::utf8("\n \u00A9 ")); + text += copyright; + long_text += copyright; + String license = "\n License: " + String(about_tp_license[read_idx]) + "\n"; + text += license; + long_text += license + "\n"; + read_idx++; + } + ti->set_metadata(0, text); + } + for (int i = 0; i < LICENSE_COUNT; i++) { + + TreeItem *ti = _tpl_tree->create_item(tpl_ti_lc); + String licensename = String(about_license_name[i]); + ti->set_text(0, licensename); + long_text += "- " + licensename + "\n\n"; + String licensebody = String(about_license_body[i]); + ti->set_metadata(0, licensebody); + long_text += " " + licensebody.replace("\n", "\n ") + "\n\n"; + } + tpl_ti_all->set_metadata(0, long_text); + tpl_hbc->add_child(_tpl_tree); + + _tpl_text = memnew(TextEdit); + _tpl_text->set_h_size_flags(Control::SIZE_EXPAND_FILL); + _tpl_text->set_v_size_flags(Control::SIZE_EXPAND_FILL); + _tpl_text->set_wrap(true); + _tpl_text->set_readonly(true); + tpl_hbc->add_child(_tpl_text); + + _tpl_tree->connect("item_selected", this, "_license_tree_selected"); + tpl_ti_all->select(0); + _tpl_text->set_text(tpl_ti_all->get_metadata(0)); } warning = memnew(AcceptDialog); diff --git a/editor/editor_node.h b/editor/editor_node.h index 24acedbf26..49ac04243c 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -431,6 +431,9 @@ private: List<String> previous_scenes; bool opening_prev; + Tree *_tpl_tree; + TextEdit *_tpl_text; + void _dialog_action(String p_file); void _edit_current(); @@ -636,6 +639,8 @@ private: void _dim_timeout(); void _check_gui_base_size(); + void _license_tree_selected(); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 7841baa02e..18c4bed5dd 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -153,6 +153,8 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s uint16_t compression_code = file->get_16(); + //Issue: #7755 : Not a bug - usage of other formats (format codes) are unsupported in current importer version. + //Consider revision for engine version 3.0 if (compression_code != 1) { ERR_PRINT("Format not supported for WAVE file (not PCM). Save WAVE files as uncompressed PCM instead."); break; @@ -249,6 +251,15 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s if (chunkID[0] == 's' && chunkID[1] == 'm' && chunkID[2] == 'p' && chunkID[3] == 'l') { //loop point info! + /** + * Consider exploring next document: + * http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/RIFFNEW.pdf + * Especially on page: + * 16 - 17 + * Timestamp: + * 22:38 06.07.2017 GMT + **/ + for (int i = 0; i < 10; i++) file->get_32(); // i wish to know why should i do this... no doc! diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index e51254f84b..7ce884a455 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1170,7 +1170,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { canvas_item->edit_set_state(se->undo_state); if (canvas_item->cast_to<Node2D>()) canvas_item->cast_to<Node2D>()->edit_set_pivot(se->undo_pivot); - if (canvas_item->cast_to<Node2D>()) + if (canvas_item->cast_to<Control>()) canvas_item->cast_to<Control>()->set_pivot_offset(se->undo_pivot); } } diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index c74eaf21a1..2d05c8eba1 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -874,7 +874,7 @@ Ref<Texture> CurvePreviewGenerator::generate(const Ref<Resource> &p_from) { Color bg_color(0.1, 0.1, 0.1, 1.0); for (int i = 0; i < thumbnail_size; i++) { for (int j = 0; j < thumbnail_size; j++) { - im.put_pixel(i, j, bg_color); + im.set_pixel(i, j, bg_color); } } @@ -890,7 +890,7 @@ Ref<Texture> CurvePreviewGenerator::generate(const Ref<Resource> &p_from) { // Plot point if (y >= 0 && y < im.get_height()) { - im.put_pixel(x, y, line_color); + im.set_pixel(x, y, line_color); } // Plot vertical line to fix discontinuity (not 100% correct but enough for a preview) @@ -904,7 +904,7 @@ Ref<Texture> CurvePreviewGenerator::generate(const Ref<Resource> &p_from) { y1 = y; } for (int ly = y0; ly < y1; ++ly) { - im.put_pixel(x, ly, line_color); + im.set_pixel(x, ly, line_color); } } diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 11d804422a..7f8581535c 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -431,7 +431,7 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) { for (int i = 0; i < thumbnail_size; i++) { for (int j = 0; j < thumbnail_size; j++) { - img->put_pixel(i, j, bg_color); + img->set_pixel(i, j, bg_color); } } @@ -469,8 +469,8 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) { Color ul = color; ul.a *= 0.5; - img->put_pixel(col, line * 2, bg_color.blend(ul)); - img->put_pixel(col, line * 2 + 1, color); + img->set_pixel(col, line * 2, bg_color.blend(ul)); + img->set_pixel(col, line * 2 + 1, color); prev_is_text = _is_text_char(c); } diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp index 9c65ef667a..5506c035ec 100644 --- a/editor/plugins/shader_graph_editor_plugin.cpp +++ b/editor/plugins/shader_graph_editor_plugin.cpp @@ -1382,7 +1382,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int Color c = graph->default_get_value(type,p_id,param); for (int x=1;x<14;x++) for (int y=1;y<14;y++) - icon_color.put_pixel(x,y,c); + icon_color.set_pixel(x,y,c); Ref<ImageTexture> t; t.instance(); t->create_from_image(icon_color); |