summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYRIGHT.txt11
-rw-r--r--editor/SCsub12
-rw-r--r--editor/editor_builders.py262
-rw-r--r--servers/visual/shader_language.cpp47
4 files changed, 37 insertions, 295 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 4ba80941e0..49c602eb84 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -10,8 +10,9 @@
# all corresponding files (also recursively in subfolders), apart from those
# with a more explicit copyright statement.
#
-# Licenses are given with their SPDX identifier, and are all included in
-# plain text at the end of this file (in alphabetical order).
+# Licenses are given with their debian/copyright short name (or SPDX identifier
+# if no standard short name exists) and are all included in plain text at the
+# end of this file (in alphabetical order).
#
# Disclaimer for thirdparty libraries:
# ------------------------------------
@@ -139,7 +140,7 @@ Files: ./thirdparty/cvtt/
Comment: Convection Texture Tools Stand-Alone Kernels
Copyright: 2018, Eric Lasota
2018, Microsoft Corp.
-License: MIT
+License: Expat
Files: ./thirdparty/enet/
Comment: ENet
@@ -373,7 +374,7 @@ Files: ./thirdparty/tinyexr/
Comment: TinyEXR
Copyright: 2014-2017, Syoyo Fujita
2002, Industrial Light & Magic, a division of Lucas Digital Ltd. LLC
-License: BSD-3-Clause
+License: BSD-3-clause
Files: ./thirdparty/zlib/
Comment: zlib
@@ -383,7 +384,7 @@ License: Zlib
Files: ./thirdparty/zstd/
Comment: Zstandard
Copyright: 2016-2018, Facebook, Inc.
-License: BSD-3-Clause
+License: BSD-3-clause
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/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/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index ffb130048f..9500f35732 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -2368,9 +2368,9 @@ int ShaderLanguage::get_cardinality(DataType p_type) {
2,
3,
4,
- 2,
- 3,
4,
+ 9,
+ 16,
1,
1,
1,
@@ -3307,7 +3307,9 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
ERR_FAIL_COND_V(op->arguments[0]->type != Node::TYPE_VARIABLE, p_node);
- DataType base = get_scalar_type(op->get_datatype());
+ DataType type = op->get_datatype();
+ DataType base = get_scalar_type(type);
+ int cardinality = get_cardinality(type);
Vector<ConstantNode::Value> values;
@@ -3318,19 +3320,9 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
ConstantNode *cn = static_cast<ConstantNode *>(op->arguments[i]);
if (get_scalar_type(cn->datatype) == base) {
-
- int cardinality = get_cardinality(op->arguments[i]->get_datatype());
- if (cn->values.size() == cardinality) {
-
- for (int j = 0; j < cn->values.size(); j++) {
- values.push_back(cn->values[j]);
- }
- } else if (cn->values.size() == 1) {
-
- for (int j = 0; j < cardinality; j++) {
- values.push_back(cn->values[0]);
- }
- } // else: should be filtered by the parser as it's an invalid constructor
+ for (int j = 0; j < cn->values.size(); j++) {
+ values.push_back(cn->values[j]);
+ }
} else if (get_scalar_type(cn->datatype) == cn->datatype) {
ConstantNode::Value v;
@@ -3347,6 +3339,29 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
}
}
+ if (values.size() == 1) {
+ if (type >= TYPE_MAT2 && type <= TYPE_MAT4) {
+ ConstantNode::Value value = values[0];
+ ConstantNode::Value zero;
+ zero.real = 0.0f;
+ int size = 2 + (type - TYPE_MAT2);
+
+ values.clear();
+ for (int i = 0; i < size; i++) {
+ for (int j = 0; j < size; j++) {
+ values.push_back(i == j ? value : zero);
+ }
+ }
+ } else {
+ for (int i = 1; i < cardinality; i++) {
+ values.push_back(values[0]);
+ }
+ }
+ } else if (values.size() != cardinality) {
+ ERR_PRINT("Failed to reduce expression, values and cardinality mismatch.");
+ return p_node;
+ }
+
ConstantNode *cn = alloc_node<ConstantNode>();
cn->datatype = op->get_datatype();
cn->values = values;