diff options
author | MarianoGNU <marianognu.easyrpg@gmail.com> | 2015-10-17 23:38:33 -0300 |
---|---|---|
committer | MarianoGNU <marianognu.easyrpg@gmail.com> | 2015-10-17 23:38:33 -0300 |
commit | 4452e262539ad9d52a5980305584d897829986d1 (patch) | |
tree | cde7f3bdc36e727a21f55938a131083f84e043a6 /tools | |
parent | 68fb30aaea0acf3ff279831d2d77b2e7129e4b69 (diff) | |
parent | 97f483af0a3e040f73c2df957bd092af2f6c085b (diff) |
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'tools')
21 files changed, 739 insertions, 28 deletions
diff --git a/tools/docdump/locales/es/LC_MESSAGES/makedocs.mo b/tools/docdump/locales/es/LC_MESSAGES/makedocs.mo Binary files differnew file mode 100644 index 0000000000..8d7ea2689e --- /dev/null +++ b/tools/docdump/locales/es/LC_MESSAGES/makedocs.mo diff --git a/tools/docdump/locales/es/LC_MESSAGES/makedocs.po b/tools/docdump/locales/es/LC_MESSAGES/makedocs.po new file mode 100644 index 0000000000..82115dd897 --- /dev/null +++ b/tools/docdump/locales/es/LC_MESSAGES/makedocs.po @@ -0,0 +1,142 @@ +# Translations template for PROJECT. +# Copyright (C) 2015 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2015. +# +msgid "" +msgstr "" +"Project-Id-Version: makedocs\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2015-10-07 11:47-0600\n" +"PO-Revision-Date: 2015-10-07 13:10-0600\n" +"Last-Translator: Jorge Araya Navarro <elcorreo@deshackra.com>\n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.0\n" +"X-Generator: Poedit 1.8.4\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: makedocs.py:74 +msgid "" +"\"<code>{gclass}</code>(Go to page of class {gclass})\":/class_{lkclass}" +msgstr "" +"\"<code>{gclass}</code>(Ir a la pagina de la clase {gclass})\":/" +"class_{lkclass}" + +#: makedocs.py:76 +msgid "" +"\"<code>{gclass}.{method}</code>(Go to page {gclass}, section {method})\":/" +"class_{lkclass}#{lkmethod}" +msgstr "" +"\"<code>{gclass}.{method}</code>(Ir a la pagina {gclass}, sección " +"{method})\":/class_{lkclass}#{lkmethod}" + +#: makedocs.py:79 +msgid "\"<code>{method}</code>(Jump to method {method})\":#{lkmethod}" +msgstr "\"<code>{method}</code>(Saltar al método {method})\":#{lkmethod}" + +#: makedocs.py:81 +msgid " \"{rtype}(Go to page of class {rtype})\":/class_{link} " +msgstr " \"{rtype}(Ir a la pagina de la clase {rtype})\":/class_{link} " + +#: makedocs.py:82 +msgid "" +"\"*{funcname}*(Jump to description for node {funcname})\":#{link} <b>(</b> " +msgstr "" +"\"*{funcname}*(Saltar a la descripción para el nodo {funcname})\":#{link} " +"<b>(</b> " + +#: makedocs.py:87 +msgid "h4. Inherits: " +msgstr "h4. Hereda de: " + +#: makedocs.py:232 +msgid "<doc>'s version attribute missing" +msgstr "El atributo version de <doc> no existe" + +#: makedocs.py:246 +msgid "|_. Index symbol |_. Class name |_. Index symbol |_. Class name |\n" +msgstr "" +"|_. Índice de símbolo |_. Nombre de la clase |_. Índice de símbolo |_. " +"Nombre de la clase |\n" + +#: makedocs.py:305 +msgid "" +"h4. Category: {}\n" +"\n" +msgstr "" +"h4. Categoría: {}\n" +"\n" + +#: makedocs.py:310 +msgid "" +"h2. Brief Description\n" +"\n" +msgstr "" +"h2. Descripción breve\n" +"\n" + +#: makedocs.py:312 +msgid "" +"\"read more\":#more\n" +"\n" +msgstr "" +"\"Leer más\":#more\n" +"\n" + +#: makedocs.py:317 +msgid "" +"\n" +"h3. Member Functions\n" +"\n" +msgstr "" +"\n" +"h3. Funciones miembro\n" +"\n" + +#: makedocs.py:323 +msgid "" +"\n" +"h3. Signals\n" +"\n" +msgstr "" +"\n" +"h3. Señales\n" +"\n" + +#: makedocs.py:331 +msgid "" +"\n" +"h3. Numeric Constants\n" +"\n" +msgstr "" +"\n" +"h3. Constantes numéricas\n" +"\n" + +#: makedocs.py:347 +msgid "" +"\n" +"h3(#more). Description\n" +"\n" +msgstr "" +"\n" +"h3(#more). Descripción\n" +"\n" + +#: makedocs.py:351 +msgid "_Nothing here, yet..._\n" +msgstr "_Aún nada por aquí..._\n" + +#: makedocs.py:355 +msgid "" +"\n" +"h3. Member Function Description\n" +"\n" +msgstr "" +"\n" +"h3. Descripción de las funciones miembro\n" +"\n" diff --git a/tools/docdump/makedocs.pot b/tools/docdump/makedocs.pot new file mode 100644 index 0000000000..be3220f686 --- /dev/null +++ b/tools/docdump/makedocs.pot @@ -0,0 +1,108 @@ +# Translations template for PROJECT. +# Copyright (C) 2015 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2015. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: makedocs 0.1\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2015-10-07 11:47-0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.0\n" +"X-Generator: Poedit 1.8.4\n" + +#: makedocs.py:74 +msgid "\"<code>{gclass}</code>(Go to page of class {gclass})\":/class_{lkclass}" +msgstr "" + +#: makedocs.py:76 +msgid "\"<code>{gclass}.{method}</code>(Go to page {gclass}, section {method})\":/class_{lkclass}#{lkmethod}" +msgstr "" + +#: makedocs.py:79 +msgid "\"<code>{method}</code>(Jump to method {method})\":#{lkmethod}" +msgstr "" + +#: makedocs.py:81 +msgid " \"{rtype}(Go to page of class {rtype})\":/class_{link} " +msgstr "" + +#: makedocs.py:82 +msgid "\"*{funcname}*(Jump to description for node {funcname})\":#{link} <b>(</b> " +msgstr "" + +#: makedocs.py:87 +msgid "h4. Inherits: " +msgstr "" + +#: makedocs.py:232 +msgid "<doc>'s version attribute missing" +msgstr "" + +#: makedocs.py:246 +msgid "|_. Index symbol |_. Class name |_. Index symbol |_. Class name |\n" +msgstr "" + +#: makedocs.py:305 +msgid "" +"h4. Category: {}\n" +"\n" +msgstr "" + +#: makedocs.py:310 +msgid "" +"h2. Brief Description\n" +"\n" +msgstr "" + +#: makedocs.py:312 +msgid "" +"\"read more\":#more\n" +"\n" +msgstr "" + +#: makedocs.py:317 +msgid "" +"\n" +"h3. Member Functions\n" +"\n" +msgstr "" + +#: makedocs.py:323 +msgid "" +"\n" +"h3. Signals\n" +"\n" +msgstr "" + +#: makedocs.py:331 +msgid "" +"\n" +"h3. Numeric Constants\n" +"\n" +msgstr "" + +#: makedocs.py:347 +msgid "" +"\n" +"h3(#more). Description\n" +"\n" +msgstr "" + +#: makedocs.py:351 +msgid "_Nothing here, yet..._\n" +msgstr "" + +#: makedocs.py:355 +msgid "" +"\n" +"h3. Member Function Description\n" +"\n" +msgstr "" diff --git a/tools/docdump/makedocs.py b/tools/docdump/makedocs.py new file mode 100644 index 0000000000..be57891abc --- /dev/null +++ b/tools/docdump/makedocs.py @@ -0,0 +1,382 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +# +# makedocs.py: Generate documentation for Open Project Wiki +# Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. +# Contributor: Jorge Araya Navarro <elcorreo@deshackra.com> +# + +# IMPORTANT NOTICE: +# If you are going to modify anything from this file, please be sure to follow +# the Style Guide for Python Code or often called "PEP8". To do this +# automagically just install autopep8: +# +# $ sudo pip3 install autopep8 +# +# and run: +# +# $ autopep8 makedocs.py +# +# Before committing your changes. Also be sure to delete any trailing +# whitespace you may left. +# +# TODO: +# * Refactor code. +# * Adapt this script for generating content in other markup formats like +# DokuWiki, Markdown, etc. +# +# Also check other TODO entries in this script for more information on what is +# left to do. +import argparse +import gettext +import logging +import re +from itertools import zip_longest +from os import path, listdir +from xml.etree import ElementTree + + +# add an option to change the verbosity +logging.basicConfig(level=logging.INFO) + + +def getxmlfloc(): + """ Returns the supposed location of the XML file + """ + filepath = path.dirname(path.abspath(__file__)) + return path.join(filepath, "class_list.xml") + + +def langavailable(): + """ Return a list of languages available for translation + """ + filepath = path.join( + path.dirname(path.abspath(__file__)), "locales") + files = listdir(filepath) + choices = [x for x in files] + choices.insert(0, "none") + return choices + + +desc = "Generates documentation from a XML file to different markup languages" + +parser = argparse.ArgumentParser(description=desc) +parser.add_argument("--input", dest="xmlfp", default=getxmlfloc(), + help="Input XML file, default: {}".format(getxmlfloc())) +parser.add_argument("--output-dir", dest="outputdir", required=True, + help="Output directory for generated files") +parser.add_argument("--language", choices=langavailable(), default="none", + help=("Choose the language of translation" + " for the output files. Default is English (none). " + "Note: This is NOT for the documentation itself!")) +# TODO: add an option for outputting different markup formats + +args = parser.parse_args() +# Let's check if the file and output directory exists +if not path.isfile(args.xmlfp): + logging.critical("File not found: {}".format(args.xmlfp)) + exit(1) +elif not path.isdir(args.outputdir): + logging.critical("Path does not exist: {}".format(args.outputdir)) + exit(1) + +_ = gettext.gettext +if args.language != "none": + lang = gettext.translation(domain="makedocs", + localedir="locales", + languages=[args.language]) + lang.install() + + _ = lang.gettext + +# Strings +C_LINK = _("\"<code>{gclass}</code>(Go to page of class" + " {gclass})\":/class_{lkclass}") +MC_LINK = _("\"<code>{gclass}.{method}</code>(Go " + "to page {gclass}, section {method})\"" + ":/class_{lkclass}#{lkmethod}") +TM_JUMP = _("\"<code>{method}</code>(Jump to method" + " {method})\":#{lkmethod}") +GTC_LINK = _(" \"{rtype}(Go to page of class {rtype})\":/class_{link} ") +DFN_JUMP = _("\"*{funcname}*(Jump to description for" + " node {funcname})\":#{link} <b>(</b> ") +M_ARG_DEFAULT = C_LINK + " {name}={default}" +M_ARG = C_LINK + " {name}" + +OPENPROJ_INH = _("h4. Inherits: ") + C_LINK + "\n\n" + + +def tb(string): + """ Return a byte representation of a string + """ + return bytes(string, "UTF-8") + + +def sortkey(c): + """ Symbols are first, letters second + """ + if "_" == c.attrib["name"][0]: + return "A" + else: + return c.attrib["name"] + + +def toOP(text): + """ Convert commands in text to Open Project commands + """ + # TODO: Make this capture content between [command] ... [/command] + groups = re.finditer((r'\[html (?P<command>/?\w+/?)(\]| |=)?(\]| |=)?(?P<a' + 'rg>\w+)?(\]| |=)?(?P<value>"[^"]+")?/?\]'), text) + alignstr = "" + for group in groups: + gd = group.groupdict() + if gd["command"] == "br/": + text = text.replace(group.group(0), "\n\n", 1) + elif gd["command"] == "div": + if gd["value"] == '"center"': + alignstr = ("{display:block; margin-left:auto;" + " margin-right:auto;}") + elif gd["value"] == '"left"': + alignstr = "<" + elif gd["value"] == '"right"': + alignstr = ">" + text = text.replace(group.group(0), "\n\n", 1) + elif gd["command"] == "/div": + alignstr = "" + text = text.replace(group.group(0), "\n\n", 1) + elif gd["command"] == "img": + text = text.replace(group.group(0), "!{align}{src}!".format( + align=alignstr, src=gd["value"].strip('"')), 1) + elif gd["command"] == "b" or gd["command"] == "/b": + text = text.replace(group.group(0), "*", 1) + elif gd["command"] == "i" or gd["command"] == "/i": + text = text.replace(group.group(0), "_", 1) + elif gd["command"] == "u" or gd["command"] == "/u": + text = text.replace(group.group(0), "+", 1) + # Process other non-html commands + groups = re.finditer((r'\[method ((?P<class>[aA0-zZ9_]+)(?:\.))' + r'?(?P<method>[aA0-zZ9_]+)\]'), text) + for group in groups: + gd = group.groupdict() + if gd["class"]: + replacewith = (MC_LINK.format(gclass=gd["class"], + method=gd["method"], + lkclass=gd["class"].lower(), + lkmethod=gd["method"].lower())) + else: + # The method is located in the same wiki page + replacewith = (TM_JUMP.format(method=gd["method"], + lkmethod=gd["method"].lower())) + + text = text.replace(group.group(0), replacewith, 1) + # Finally, [Classes] are around brackets, make them direct links + groups = re.finditer(r'\[(?P<class>[az0-AZ0_]+)\]', text) + for group in groups: + gd = group.groupdict() + replacewith = (C_LINK. + format(gclass=gd["class"], + lkclass=gd["class"].lower())) + text = text.replace(group.group(0), replacewith, 1) + + return text + "\n\n" + + +def mkfn(node, is_signal=False): + """ Return a string containing a unsorted item for a function + """ + finalstr = "" + name = node.attrib["name"] + rtype = node.find("return") + if rtype: + rtype = rtype.attrib["type"] + else: + rtype = "void" + # write the return type and the function name first + finalstr += "* " + # return type + if not is_signal: + if rtype != "void": + finalstr += GTC_LINK.format( + rtype=rtype, + link=rtype.lower()) + else: + finalstr += " void " + + # function name + if not is_signal: + finalstr += DFN_JUMP.format( + funcname=name, + link=name.lower()) + else: + # Signals have no description + finalstr += "*{funcname}* <b>(</b>".format(funcname=name) + # loop for the arguments of the function, if any + args = [] + for arg in sorted( + node.iter(tag="argument"), + key=lambda a: int(a.attrib["index"])): + + ntype = arg.attrib["type"] + nname = arg.attrib["name"] + + if "default" in arg.attrib: + args.insert(-1, M_ARG_DEFAULT.format( + gclass=ntype, + lkclass=ntype.lower(), + name=nname, + default=arg.attrib["default"])) + else: + # No default value present + args.insert(-1, M_ARG.format(gclass=ntype, + lkclass=ntype.lower(), name=nname)) + # join the arguments together + finalstr += ", ".join(args) + # and, close the function with a ) + finalstr += " <b>)</b>" + # write the qualifier, if any + if "qualifiers" in node.attrib: + qualifier = node.attrib["qualifiers"] + finalstr += " " + qualifier + + finalstr += "\n" + + return finalstr + +# Let's begin +tree = ElementTree.parse(args.xmlfp) +root = tree.getroot() + +# Check version attribute exists in <doc> +if "version" not in root.attrib: + logging.critical(_("<doc>'s version attribute missing")) + exit(1) + +version = root.attrib["version"] +classes = sorted(root, key=sortkey) +# first column is always longer, second column of classes should be shorter +zclasses = zip_longest(classes[:int(len(classes) / 2 + 1)], + classes[int(len(classes) / 2 + 1):], + fillvalue="") + +# We write the class_list file and also each class file at once +with open(path.join(args.outputdir, "class_list.txt"), "wb") as fcl: + # Write header of table + fcl.write(tb("|^.\n")) + fcl.write(tb(_("|_. Index symbol |_. Class name " + "|_. Index symbol |_. Class name |\n"))) + fcl.write(tb("|-.\n")) + + indexletterl = "" + indexletterr = "" + for gdclassl, gdclassr in zclasses: + # write a row # + # write the index symbol column, left + if indexletterl != gdclassl.attrib["name"][0]: + indexletterl = gdclassl.attrib["name"][0] + fcl.write(tb("| *{}* |".format(indexletterl.upper()))) + else: + # empty cell + fcl.write(tb("| |")) + # write the class name column, left + fcl.write(tb(C_LINK.format( + gclass=gdclassl.attrib["name"], + lkclass=gdclassl.attrib["name"].lower()))) + + # write the index symbol column, right + if isinstance(gdclassr, ElementTree.Element): + if indexletterr != gdclassr.attrib["name"][0]: + indexletterr = gdclassr.attrib["name"][0] + fcl.write(tb("| *{}* |".format(indexletterr.upper()))) + else: + # empty cell + fcl.write(tb("| |")) + # We are dealing with an empty string + else: + # two empty cell + fcl.write(tb("| | |\n")) + # We won't get the name of the class since there is no ElementTree + # object for the right side of the tuple, so we iterate the next + # tuple instead + continue + + # write the class name column (if any), right + fcl.write(tb(C_LINK.format( + gclass=gdclassl.attrib["name"], + lkclass=gdclassl.attrib["name"].lower()) + "|\n")) + + # row written # + # now, let's write each class page for each class + for gdclass in [gdclassl, gdclassr]: + if not isinstance(gdclass, ElementTree.Element): + continue + + classname = gdclass.attrib["name"] + with open(path.join(args.outputdir, "{}.txt".format( + classname.lower())), "wb") as clsf: + # First level header with the name of the class + clsf.write(tb("h1. {}\n\n".format(classname))) + # lay the attributes + if "inherits" in gdclass.attrib: + inh = gdclass.attrib["inherits"].strip() + clsf.write(tb(OPENPROJ_INH.format(gclass=inh, + lkclass=inh.lower()))) + if "category" in gdclass.attrib: + clsf.write(tb(_("h4. Category: {}\n\n"). + format(gdclass.attrib["category"].strip()))) + # lay child nodes + briefd = gdclass.find("brief_description") + if briefd.text.strip(): + clsf.write(tb(_("h2. Brief Description\n\n"))) + clsf.write(tb(toOP(briefd.text.strip()) + + _("\"read more\":#more\n\n"))) + + # Write the list of member functions of this class + methods = gdclass.find("methods") + if methods and len(methods) > 0: + clsf.write(tb(_("\nh3. Member Functions\n\n"))) + for method in methods.iter(tag='method'): + clsf.write(tb(mkfn(method))) + + signals = gdclass.find("signals") + if signals and len(signals) > 0: + clsf.write(tb(_("\nh3. Signals\n\n"))) + for signal in signals.iter(tag='signal'): + clsf.write(tb(mkfn(signal, True))) + # TODO: <members> tag is necessary to process? it does not + # exists in class_list.xml file. + + consts = gdclass.find("constants") + if consts and len(consts) > 0: + clsf.write(tb(_("\nh3. Numeric Constants\n\n"))) + for const in sorted(consts, key=lambda k: + k.attrib["name"]): + if const.text.strip(): + clsf.write(tb("* *{name}* = *{value}* - {desc}\n". + format( + name=const.attrib["name"], + value=const.attrib["value"], + desc=const.text.strip()))) + else: + # Constant have no description + clsf.write(tb("* *{name}* = *{value}*\n". + format( + name=const.attrib["name"], + value=const.attrib["value"]))) + descrip = gdclass.find("description") + clsf.write(tb(_("\nh3(#more). Description\n\n"))) + if descrip.text: + clsf.write(tb(descrip.text.strip() + "\n")) + else: + clsf.write(tb(_("_Nothing here, yet..._\n"))) + + # and finally, the description for each method + if methods and len(methods) > 0: + clsf.write(tb(_("\nh3. Member Function Description\n\n"))) + for method in methods.iter(tag='method'): + clsf.write(tb("h4(#{n}). {name}\n\n".format( + n=method.attrib["name"].lower(), + name=method.attrib["name"]))) + clsf.write(tb(mkfn(method) + "\n")) + clsf.write(tb(toOP(method.find( + "description").text.strip()))) diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 96bd1ed27d..5df49bd327 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -2369,7 +2369,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { te->update(); track_editor->set_tooltip(""); - if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->cast_to<LineEdit>())) + if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) track_editor->call_deferred("grab_focus"); diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 213c18e1b0..46ed2194a8 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -547,6 +547,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); class_desc->add_newline(); class_desc->add_newline(); + class_desc->add_newline(); } @@ -563,6 +564,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v _add_text(cd.brief_description); class_desc->add_newline(); class_desc->add_newline(); + class_desc->add_newline(); } bool method_descr=false; @@ -637,7 +639,6 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v if (cd.properties.size()) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text("Members:"); @@ -715,9 +716,10 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->add_newline(); } - class_desc->add_newline(); class_desc->pop(); + class_desc->add_newline(); + class_desc->add_newline(); } if (cd.signals.size()) { @@ -779,6 +781,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); class_desc->add_newline(); + class_desc->add_newline(); } @@ -823,6 +826,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); class_desc->add_newline(); + class_desc->add_newline(); } @@ -830,6 +834,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v if (cd.description!="") { description_line=class_desc->get_line_count()-2; + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text("Description:"); @@ -837,10 +842,10 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); class_desc->add_newline(); - class_desc->add_newline(); _add_text(cd.description); class_desc->add_newline(); class_desc->add_newline(); + class_desc->add_newline(); } if (method_descr) { @@ -853,12 +858,16 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->add_newline(); class_desc->add_newline(); + class_desc->push_indent(1); for(int i=0;i<cd.methods.size();i++) { method_line[cd.methods[i].name]=class_desc->get_line_count()-2; + if( cd.methods[i].description != "") { + class_desc->add_newline(); + } class_desc->push_font(doc_code_font); _add_type(cd.methods[i].return_type); @@ -899,9 +908,12 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); - class_desc->add_newline(); - class_desc->add_newline(); - _add_text(cd.methods[i].description); + if( cd.methods[i].description != "") { + class_desc->add_text(" "); + _add_text(cd.methods[i].description); + class_desc->add_newline(); + class_desc->add_newline(); + } class_desc->add_newline(); class_desc->add_newline(); @@ -1392,6 +1404,8 @@ EditorHelp::EditorHelp(EditorNode *p_editor) { PanelContainer *pc = memnew( PanelContainer ); Ref<StyleBoxFlat> style( memnew( StyleBoxFlat ) ); style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/background_color") ); + style->set_default_margin(MARGIN_LEFT,20); + style->set_default_margin(MARGIN_TOP,20); pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit")); h_split->add_child(pc); class_desc = memnew( RichTextLabel ); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 9137503e1b..34e2510791 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -976,6 +976,7 @@ void EditorNode::_save_scene(String p_file) { //EditorFileSystem::get_singleton()->update_file(p_file,sdata->get_type()); set_current_version(editor_data.get_undo_redo().get_version()); _update_title(); + _update_scene_tabs(); } else { _dialog_display_file_error(p_file,err); @@ -1399,7 +1400,6 @@ void EditorNode::_dialog_action(String p_file) { } break; default: { //save scene? - if (file->get_mode()==FileDialog::MODE_SAVE_FILE) { //_save_scene(p_file); @@ -3452,6 +3452,9 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo Ref<SceneState> state = sdata->get_state(); state->set_path(lpath); new_scene->set_scene_inherited_state(state); + new_scene->set_filename(String()); + if (new_scene->get_scene_instance_state().is_valid()) + new_scene->get_scene_instance_state()->set_path(String()); } @@ -3931,6 +3934,7 @@ void EditorNode::_bind_methods() { ObjectTypeDB::bind_method("set_current_scene",&EditorNode::set_current_scene); ObjectTypeDB::bind_method("set_current_version",&EditorNode::set_current_version); ObjectTypeDB::bind_method("_scene_tab_changed",&EditorNode::_scene_tab_changed); + ObjectTypeDB::bind_method("_scene_tab_closed",&EditorNode::_scene_tab_closed); ObjectTypeDB::bind_method("_scene_tab_script_edited",&EditorNode::_scene_tab_script_edited); ObjectTypeDB::bind_method("_set_main_scene_state",&EditorNode::_set_main_scene_state); ObjectTypeDB::bind_method("_update_scene_tabs",&EditorNode::_update_scene_tabs); @@ -4385,6 +4389,17 @@ void EditorNode::_scene_tab_script_edited(int p_tab) { edit_resource(script); } +void EditorNode::_scene_tab_closed(int p_tab) { + set_current_scene(p_tab); + bool p_confirmed = true; + if (unsaved_cache) + p_confirmed = false; + + _menu_option_confirm(FILE_CLOSE, p_confirmed); + _update_scene_tabs(); +} + + void EditorNode::_scene_tab_changed(int p_tab) { @@ -4552,8 +4567,10 @@ EditorNode::EditorNode() { scene_tabs=memnew( Tabs ); scene_tabs->add_tab("unsaved"); scene_tabs->set_tab_align(Tabs::ALIGN_CENTER); + scene_tabs->set_tab_close_display_policy(Tabs::SHOW_HOVER); scene_tabs->connect("tab_changed",this,"_scene_tab_changed"); scene_tabs->connect("right_button_pressed",this,"_scene_tab_script_edited"); + scene_tabs->connect("tab_close", this, "_scene_tab_closed"); top_dark_vb->add_child(scene_tabs); //left left_l_hsplit = memnew( HSplitContainer ); @@ -4690,6 +4707,7 @@ EditorNode::EditorNode() { main_editor_tabs = memnew( Tabs ); main_editor_tabs->connect("tab_changed",this,"_editor_select"); + main_editor_tabs->set_tab_close_display_policy(Tabs::SHOW_NEVER); HBoxContainer *srth = memnew( HBoxContainer ); srt->add_child( srth ); Control *tec = memnew( Control ); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index d52e08191d..978e8390dc 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -501,6 +501,7 @@ class EditorNode : public Node { void _dock_split_dragged(int ofs); void _dock_popup_exit(); void _scene_tab_changed(int p_tab); + void _scene_tab_closed(int p_tab); void _scene_tab_script_edited(int p_tab); Dictionary _get_main_scene_state(); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 04c34d9a88..7417d707bb 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -74,6 +74,7 @@ void EditorPlugin::add_custom_control(CustomControlContainer p_location,Control case CONTAINER_CANVAS_EDITOR_SIDE: { CanvasItemEditor::get_singleton()->get_palette_split()->add_child(p_control); + CanvasItemEditor::get_singleton()->get_palette_split()->move_child(p_control,0); } break; case CONTAINER_CANVAS_EDITOR_BOTTOM: { diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index a771893bdd..651b30c724 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -474,6 +474,7 @@ void EditorSettings::_load_defaults() { set("scenetree_editor/duplicate_node_name_num_separator",0); hints["scenetree_editor/duplicate_node_name_num_separator"]=PropertyInfo(Variant::INT,"scenetree_editor/duplicate_node_name_num_separator",PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"); + set("gridmap_editor/pick_distance", 5000.0); set("3d_editor/default_fov",45.0); set("3d_editor/default_z_near",0.1); diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index 9491f957c3..9298b35b3b 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -710,7 +710,7 @@ void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& p_data,D *(out++) =0; for (i=0;i<datalen;i++) { - int step,diff,vpdiff,signed_nibble,p,mask; + int step,diff,vpdiff,mask; uint8_t nibble; int16_t xm_sample; diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 8fc2945450..d318f6f6fa 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -144,6 +144,9 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { if (!is_visible()) return; + if (p_ev.key.mod.control) + // prevent to change tool mode when control key is pressed + return; if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode==KEY_Q) _tool_select(TOOL_SELECT); if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode==KEY_W) @@ -1281,7 +1284,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { if (p_event.type==InputEvent::MOUSE_MOTION) { - if (!viewport->has_focus()) + if (!viewport->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) viewport->call_deferred("grab_focus"); const InputEventMouseMotion &m=p_event.mouse_motion; diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index a77ba9a605..c2b3ecfcda 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -25,7 +25,7 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES& p_from) { if (img.is_compressed()) { if (img.decompress()!=OK) return Ref<Texture>(); - } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGB) { + } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) { img.convert(Image::FORMAT_RGBA); } diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 1997b268a7..684e7e32ef 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -1246,7 +1246,7 @@ void ShaderGraphView::_duplicate_nodes_request() } -void ShaderGraphView::_duplicate_nodes(Array &p_nodes) +void ShaderGraphView::_duplicate_nodes(const Array &p_nodes) { List<int> n = List<int>(); for (int i=0; i<p_nodes.size();i++) diff --git a/tools/editor/plugins/shader_graph_editor_plugin.h b/tools/editor/plugins/shader_graph_editor_plugin.h index 800fdf1fea..39e9b29d45 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.h +++ b/tools/editor/plugins/shader_graph_editor_plugin.h @@ -149,7 +149,7 @@ class ShaderGraphView : public Node { void _end_node_move(); void _move_node(int p_id,const Vector2& p_to); void _duplicate_nodes_request(); - void _duplicate_nodes(Array &p_nodes); + void _duplicate_nodes(const Array &p_nodes); void _delete_nodes_request(); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 8fc6a6931e..3ab9339265 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -677,7 +677,8 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hili void SpatialEditorViewport::_smouseenter() { - surface->grab_focus(); + if (!surface->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) + surface->grab_focus(); } void SpatialEditorViewport::_sinput(const InputEvent &p_event) { diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index f1eecd53b0..9f47291433 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -245,7 +245,8 @@ public: project_name->clear(); if (import_mode) { - set_title("Import Existing Project:"); + set_title("Import Existing Project"); + get_ok()->set_text("Import"); pp->set_text("Project Path: (Must exist)"); pn->set_text("Project Name:"); pn->hide(); @@ -254,7 +255,8 @@ public: popup_centered(Size2(500,125)); } else { - set_title("Create New Project:"); + set_title("Create New Project"); + get_ok()->set_text("Create"); pp->set_text("Project Path:"); pn->set_text("Project Name:"); pn->show(); @@ -313,7 +315,6 @@ public: l->add_color_override("font_color",Color(1,0.4,0.3,0.8)); l->set_align(Label::ALIGN_CENTER); - get_ok()->set_text("Create"); DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); project_path->set_text(d->get_current_dir()); memdelete(d); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 5599305945..549a3f7ffb 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -1746,7 +1746,7 @@ bool PropertyEditor::_might_be_in_instance() { } -bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_prop,Variant& value) { +bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_prop, Variant& value) { Node *node = obj->cast_to<Node>(); @@ -1761,29 +1761,33 @@ bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_p // print_line("for prop - "+String(p_prop)); + while(node) { Ref<SceneState> ss; if (node==edited_scene) { ss=node->get_scene_inherited_state(); + } else { ss=node->get_scene_instance_state(); } -// print_line("at - "+String(edited_scene->get_path_to(node))); + // print_line("at - "+String(edited_scene->get_path_to(node))); if (ss.is_valid()) { + NodePath np = node->get_path_to(orig); int node_idx = ss->find_node_by_path(np); -// print_line("\t valid, nodeidx "+itos(node_idx)); + // print_line("\t valid, nodeidx "+itos(node_idx)); if (node_idx>=0) { bool lfound=false; Variant lvar; lvar=ss->get_property_value(node_idx,p_prop,lfound); if (lfound) { + found=true; value=lvar; -// print_line("\t found value "+String(value)); + // print_line("\t found value "+String(value)); } } } @@ -1800,7 +1804,47 @@ bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_p bool PropertyEditor::_is_property_different(const Variant& p_current, const Variant& p_orig,int p_usage) { + + { + Node *node = obj->cast_to<Node>(); + if (!node) + return false; + + Node* edited_scene =EditorNode::get_singleton()->get_edited_scene(); + bool found_state=false; + + // print_line("for prop - "+String(p_prop)); + + + while(node) { + + Ref<SceneState> ss; + + if (node==edited_scene) { + ss=node->get_scene_inherited_state(); + + } else { + ss=node->get_scene_instance_state(); + } + + if (ss.is_valid()) { + found_state=true; + } + if (node==edited_scene) { + //just in case + break; + } + node=node->get_owner(); + } + + if (!found_state) + return false; //pointless to check if we are not comparing against anything. + } + if (p_orig.get_type()==Variant::NIL) { + + + //special cases if (p_current.is_zero() && p_usage&PROPERTY_USAGE_STORE_IF_NONZERO) return false; diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 920ab599e9..510517de6f 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -875,7 +875,7 @@ bool SceneTreeDock::_validate_no_foreign() { } - if (edited_scene->get_scene_instance_state().is_valid() && edited_scene->get_scene_instance_state()->find_node_by_path(edited_scene->get_path_to(E->get()))>=0) { + if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get()))>=0) { accept->get_ok()->set_text("Makes Sense!"); accept->set_text("Can't operate on nodes the current scene inherits from!"); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index b746af7f0e..60395d5ff5 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -239,7 +239,7 @@ void SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { TreeItem *item = tree->create_item(p_parent); item->set_text(0, p_node->get_name() ); - if (can_rename && (p_node->get_owner() == get_scene_node() || p_node==get_scene_node())) + if (can_rename && !part_of_subscene /*(p_node->get_owner() == get_scene_node() || p_node==get_scene_node())*/) item->set_editable(0, true); item->set_selectable(0,true); diff --git a/tools/export/blender25/io_scene_dae/__init__.py b/tools/export/blender25/io_scene_dae/__init__.py index 5b561673c5..182ec21e63 100644 --- a/tools/export/blender25/io_scene_dae/__init__.py +++ b/tools/export/blender25/io_scene_dae/__init__.py @@ -104,11 +104,6 @@ class ExportDAE(bpy.types.Operator, ExportHelper): description="Export only objects on the active layers.", default=True, ) - use_exclude_ctrl_bones = BoolProperty( - name="Exclude Control Bones", - description="Exclude skeleton bones with names that begin with 'ctrl'.", - default=True, - ) use_anim = BoolProperty( name="Export Animation", description="Export keyframe animation", |