summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-11-01 00:24:30 +0100
committerRémi Verschelde <rverschelde@gmail.com>2016-11-01 00:35:16 +0100
commitf34151ff0f91e8f0df8eaf829334b2205eb7da3c (patch)
tree2d074bb474b4b093c849ad2f6317dcc4ae5784f5
parent817dd7ccbb166b27c93706dffc5c0c0d59fd87f8 (diff)
style: Various other PEP8 fixes in Python files
Done with `autopep8 --select=E7`, fixes: - E701 - Put colon-separated compound statement on separate lines. - E702 - Put semicolon-separated compound statement on separate lines. - E703 - Put semicolon-separated compound statement on separate lines. - E711 - Fix comparison with None. - E712 - Fix (trivial case of) comparison with boolean. - E713 - Fix (trivial case of) non-membership check. - E721 - Fix various deprecated code (via lib2to3).
-rw-r--r--SConstruct22
-rw-r--r--bin/SCsub2
-rw-r--r--core/SCsub8
-rw-r--r--doc/tools/doc_merge.py30
-rw-r--r--doc/tools/makedoku.py2
-rw-r--r--doc/tools/makehtml.py28
-rw-r--r--drivers/SCsub22
-rw-r--r--drivers/gles2/shaders/SCsub10
-rw-r--r--drivers/png/SCsub2
-rwxr-xr-xmethods.py446
-rw-r--r--modules/openssl/SCsub2
-rw-r--r--platform/android/detect.py4
-rw-r--r--platform/iphone/SCsub2
-rw-r--r--platform/javascript/detect.py2
-rw-r--r--platform/windows/detect.py6
-rw-r--r--platform/winrt/detect.py2
-rw-r--r--scene/SCsub16
-rw-r--r--scene/resources/SCsub2
-rw-r--r--scene/resources/default_theme/make_header.py50
-rw-r--r--servers/SCsub12
-rw-r--r--tools/SCsub14
-rw-r--r--tools/editor/SCsub8
-rw-r--r--tools/editor/icons/SCsub36
-rwxr-xr-xtools/scripts/file-hex-array.py3
-rw-r--r--tools/scripts/make_glwrapper.py10
25 files changed, 371 insertions, 370 deletions
diff --git a/SConstruct b/SConstruct
index a1c013422e..0d8a84b6e8 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-EnsureSConsVersion(0, 14);
+EnsureSConsVersion(0, 14)
import string
@@ -37,7 +37,7 @@ for x in glob.glob("platform/*"):
global_defaults.append(x[9:])
if (detect.is_active()):
active_platforms.append(detect.get_name())
- active_platform_ids.append(x);
+ active_platform_ids.append(x)
if (detect.can_build()):
x = x.replace("platform/", "") # rest of world
x = x.replace("platform\\", "") # win32
@@ -64,7 +64,7 @@ elif (os.name == "nt"):
if (os.getenv("VCINSTALLDIR") == None or platform_arg == "android"):
custom_tools = ['mingw']
-env_base = Environment(tools=custom_tools);
+env_base = Environment(tools=custom_tools)
if 'TERM' in os.environ:
env_base['ENV']['TERM'] = os.environ['TERM']
env_base.AppendENVPath('PATH', os.getenv('PATH'))
@@ -140,9 +140,9 @@ opts.Add('glew', 'GLEW library for the gl_context (system/builtin)', 'builtin')
opts.Add('xaudio2', 'XAudio2 audio driver (yes/no)', 'no')
opts.Add("CXX", "C++ Compiler")
opts.Add("CC", "C Compiler")
-opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler");
-opts.Add("CFLAGS", "Custom flags for the C compiler");
-opts.Add("LINKFLAGS", "Custom flags for the linker");
+opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler")
+opts.Add("CFLAGS", "Custom flags for the C compiler")
+opts.Add("LINKFLAGS", "Custom flags for the linker")
opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.', '')
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
@@ -180,11 +180,11 @@ sys.modules.pop('detect')
"""
if (env_base['target'] == 'debug'):
- env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']);
+ env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
if (env_base['deprecated'] != 'no'):
- env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED']);
+ env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED'])
env_base.platforms = {}
@@ -264,7 +264,7 @@ if selected_platform in platform_list:
sys.exit(255)
suffix += ".opt"
- env.Append(CCFLAGS=['-DNDEBUG']);
+ env.Append(CCFLAGS=['-DNDEBUG'])
elif (env["target"] == "release_debug"):
if (env["tools"] == "yes"):
@@ -312,7 +312,7 @@ if selected_platform in platform_list:
sys.modules.pop('config')
if (env.use_ptrcall):
- env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']);
+ env.Append(CPPFLAGS=['-DPTRCALL_ENABLED'])
# to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64'])
@@ -349,7 +349,7 @@ if selected_platform in platform_list:
SConscript("modules/SCsub")
SConscript("main/SCsub")
- SConscript("platform/" + selected_platform + "/SCsub"); # build selected platform
+ SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
# Microsoft Visual Studio Project Generation
if (env['vsproj']) == "yes":
diff --git a/bin/SCsub b/bin/SCsub
index 6b29a44fd9..52f7e3bb39 100644
--- a/bin/SCsub
+++ b/bin/SCsub
@@ -3,4 +3,4 @@
Import('env')
Export('env')
-SConscript('tests/SCsub');
+SConscript('tests/SCsub')
diff --git a/core/SCsub b/core/SCsub
index 558df83d05..caae3a1c9b 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -57,10 +57,10 @@ Export('env')
import make_binders
env.Command(['method_bind.inc', 'method_bind_ext.inc'], 'make_binders.py', make_binders.run)
-SConscript('os/SCsub');
-SConscript('math/SCsub');
-SConscript('io/SCsub');
-SConscript('bind/SCsub');
+SConscript('os/SCsub')
+SConscript('math/SCsub')
+SConscript('io/SCsub')
+SConscript('bind/SCsub')
lib = env.Library("core", env.core_sources)
diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py
index d9f7cc9daa..57ac4bdcdd 100644
--- a/doc/tools/doc_merge.py
+++ b/doc/tools/doc_merge.py
@@ -26,11 +26,11 @@ def write_string(_f, text, newline=True):
def escape(ret):
- ret = ret.replace("&", "&amp;");
- ret = ret.replace("<", "&gt;");
- ret = ret.replace(">", "&lt;");
- ret = ret.replace("'", "&apos;");
- ret = ret.replace("\"", "&quot;");
+ ret = ret.replace("&", "&amp;")
+ ret = ret.replace("<", "&gt;")
+ ret = ret.replace(">", "&lt;")
+ ret = ret.replace("'", "&apos;")
+ ret = ret.replace("\"", "&quot;")
return ret
@@ -138,22 +138,22 @@ def write_class(c):
for a in list(m):
if (a.tag == "return"):
typ = get_tag(a, "type")
- write_string(f, '<return' + typ + '>');
- write_string(f, '</return>');
+ write_string(f, '<return' + typ + '>')
+ write_string(f, '</return>')
elif (a.tag == "argument"):
default = get_tag(a, "default")
- write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>');
- write_string(f, '</argument>');
+ write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>')
+ write_string(f, '</argument>')
- write_string(f, '<description>');
+ write_string(f, '<description>')
if (old_class != None):
old_method_descr = find_method_descr(old_class, m.attrib["name"])
if (old_method_descr):
write_string(f, escape(escape(old_method_descr.strip())))
- write_string(f, '</description>');
+ write_string(f, '</description>')
dec_tab()
write_string(f, "</method>")
dec_tab()
@@ -173,15 +173,15 @@ def write_class(c):
for a in list(m):
if (a.tag == "argument"):
- write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">');
- write_string(f, '</argument>');
+ write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">')
+ write_string(f, '</argument>')
- write_string(f, '<description>');
+ write_string(f, '<description>')
if (old_class != None):
old_signal_descr = find_signal_descr(old_class, m.attrib["name"])
if (old_signal_descr):
write_string(f, escape(old_signal_descr.strip()))
- write_string(f, '</description>');
+ write_string(f, '</description>')
dec_tab()
write_string(f, "</signal>")
dec_tab()
diff --git a/doc/tools/makedoku.py b/doc/tools/makedoku.py
index 49a960c43a..ad3bfd791d 100644
--- a/doc/tools/makedoku.py
+++ b/doc/tools/makedoku.py
@@ -17,7 +17,7 @@ if len(input_list) < 1:
def validate_tag(elem, tag):
if (elem.tag != tag):
- print("Tag mismatch, expected '" + tag + "', got " + elem.tag);
+ print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
sys.exit(255)
diff --git a/doc/tools/makehtml.py b/doc/tools/makehtml.py
index 369f559f25..3ecb8220cb 100644
--- a/doc/tools/makehtml.py
+++ b/doc/tools/makehtml.py
@@ -40,7 +40,7 @@ if len(input_list) < 1:
def validate_tag(elem, tag):
if (elem.tag != tag):
- print("Tag mismatch, expected '" + tag + "', got " + elem.tag);
+ print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
sys.exit(255)
@@ -90,7 +90,7 @@ def make_html_top(body, bottom=False):
def make_html_class_list(class_list, columns):
div = ET.Element("div")
- div.attrib["class"] = "ClassList";
+ div.attrib["class"] = "ClassList"
h1 = ET.SubElement(div, "h2")
h1.text = "Alphabetical Class List"
@@ -463,7 +463,7 @@ def make_method_def(name, m, declare, event=False):
def make_html_class(node):
div = ET.Element("div")
- div.attrib["class"] = "class";
+ div.attrib["class"] = "class"
a = ET.SubElement(div, "a")
a.attrib["name"] = node.attrib["name"]
@@ -482,7 +482,7 @@ def make_html_class(node):
ET.SubElement(div, "br")
div2 = ET.SubElement(div, "div")
- div2.attrib["class"] = "inheritance";
+ div2.attrib["class"] = "inheritance"
span = ET.SubElement(div2, "span")
span.text = "Inherits: "
@@ -493,7 +493,7 @@ def make_html_class(node):
ET.SubElement(div, "br")
div3 = ET.SubElement(div, "div")
- div3.attrib["class"] = "category";
+ div3.attrib["class"] = "category"
span = ET.SubElement(div3, "span")
span.attrib["class"] = "category"
@@ -520,7 +520,7 @@ def make_html_class(node):
h4.text = "Public Methods:"
method_table = ET.SubElement(div, "table")
- method_table.attrib["class"] = "method_list";
+ method_table.attrib["class"] = "method_list"
for m in list(methods):
#li = ET.SubElement(div2, "li")
@@ -533,7 +533,7 @@ def make_html_class(node):
h4.text = "Events:"
event_table = ET.SubElement(div, "table")
- event_table.attrib["class"] = "method_list";
+ event_table.attrib["class"] = "method_list"
for m in list(events):
#li = ET.SubElement(div2, "li")
@@ -545,13 +545,13 @@ def make_html_class(node):
h4 = ET.SubElement(div, "h4")
h4.text = "Public Variables:"
div2 = ET.SubElement(div, "div")
- div2.attrib["class"] = "member_list";
+ div2.attrib["class"] = "member_list"
for c in list(members):
li = ET.SubElement(div2, "li")
div3 = ET.SubElement(li, "div")
- div3.attrib["class"] = "member";
+ div3.attrib["class"] = "member"
make_type(c.attrib["type"], div3)
span = ET.SubElement(div3, "span")
span.attrib["class"] = "identifier member_name"
@@ -566,12 +566,12 @@ def make_html_class(node):
h4 = ET.SubElement(div, "h4")
h4.text = "Constants:"
div2 = ET.SubElement(div, "div")
- div2.attrib["class"] = "constant_list";
+ div2.attrib["class"] = "constant_list"
for c in list(constants):
li = ET.SubElement(div2, "li")
div3 = ET.SubElement(li, "div")
- div3.attrib["class"] = "constant";
+ div3.attrib["class"] = "constant"
span = ET.SubElement(div3, "span")
span.attrib["class"] = "identifier constant_name"
@@ -614,10 +614,10 @@ def make_html_class(node):
descr = m.find("description")
if (descr == None or descr.text.strip() == ""):
- continue;
+ continue
div2 = ET.SubElement(div, "div")
- div2.attrib["class"] = "method_doc";
+ div2.attrib["class"] = "method_doc"
div2.append(make_method_def(node.attrib["name"], m, True))
#anchor = ET.SubElement(div2, "a")
@@ -675,7 +675,7 @@ for cn in class_names:
css.attrib["type"] = "text/css"
body2 = ET.SubElement(html2, "body")
make_html_top(body2)
- body2.append(make_html_class(c));
+ body2.append(make_html_class(c))
make_html_bottom(body2)
et_out = ET.ElementTree(html2)
et_out.write(c.attrib["name"] + ".html")
diff --git a/drivers/SCsub b/drivers/SCsub
index 4ff770c7d0..08a189272f 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -5,31 +5,31 @@ Import('env')
env.drivers_sources = []
if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
- SConscript("zlib/SCsub");
+ SConscript("zlib/SCsub")
# OS drivers
-SConscript('unix/SCsub');
-SConscript('windows/SCsub');
+SConscript('unix/SCsub')
+SConscript('windows/SCsub')
# Sounds drivers
-SConscript('alsa/SCsub');
-SConscript('pulseaudio/SCsub');
+SConscript('alsa/SCsub')
+SConscript('pulseaudio/SCsub')
if (env["platform"] == "windows"):
- SConscript("rtaudio/SCsub");
+ SConscript("rtaudio/SCsub")
if (env["xaudio2"] == "yes"):
- SConscript("xaudio2/SCsub");
+ SConscript("xaudio2/SCsub")
# Graphics drivers
-SConscript('gles2/SCsub');
-SConscript('gl_context/SCsub');
+SConscript('gles2/SCsub')
+SConscript('gl_context/SCsub')
# Core dependencies
-SConscript("png/SCsub");
+SConscript("png/SCsub")
# Tools override
# FIXME: Should likely be integrated in the tools/ codebase
if (env["tools"] == "yes"):
- SConscript("convex_decomp/SCsub");
+ SConscript("convex_decomp/SCsub")
if env['vsproj'] == "yes":
env.AddToVSProject(env.drivers_sources)
diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub
index 26b6f7f06a..bf4ec9485d 100644
--- a/drivers/gles2/shaders/SCsub
+++ b/drivers/gles2/shaders/SCsub
@@ -3,10 +3,10 @@
Import('env')
if env['BUILDERS'].has_key('GLSL120GLES'):
- env.GLSL120GLES('material.glsl');
- env.GLSL120GLES('canvas.glsl');
- env.GLSL120GLES('canvas_shadow.glsl');
- env.GLSL120GLES('blur.glsl');
- env.GLSL120GLES('copy.glsl');
+ env.GLSL120GLES('material.glsl')
+ env.GLSL120GLES('canvas.glsl')
+ env.GLSL120GLES('canvas_shadow.glsl')
+ env.GLSL120GLES('blur.glsl')
+ env.GLSL120GLES('copy.glsl')
Export('env')
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index d3ece65196..aedde3e2b7 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -33,7 +33,7 @@ if (env["libpng"] == "builtin"):
import os
if ("neon_enabled" in env and env["neon_enabled"]) and os.name != "nt":
env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
- env_neon = env_png.Clone();
+ env_neon = env_png.Clone()
if "S_compiler" in env:
env_neon['CC'] = env['S_compiler']
neon_sources = []
diff --git a/methods.py b/methods.py
index 269e076409..91afd9e70b 100755
--- a/methods.py
+++ b/methods.py
@@ -2,8 +2,8 @@ import os
def add_source_files(self, sources, filetype, lib_env=None, shared=False):
- import glob;
- import string;
+ import glob
+ import string
# if not lib_objects:
if not lib_env:
lib_env = self
@@ -101,8 +101,8 @@ def build_glsl_header(filename):
# texture unit
texunit = str(int(line[line.find(":") + 1:].strip()))
uline = line[:line.lower().find("//")]
- uline = uline.replace("uniform", "");
- uline = uline.replace(";", "");
+ uline = uline.replace("uniform", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -120,9 +120,9 @@ def build_glsl_header(filename):
# ubo
uboidx = str(int(line[line.find(":") + 1:].strip()))
uline = line[:line.lower().find("//")]
- uline = uline[uline.find("uniform") + len("uniform"):];
- uline = uline.replace(";", "");
- uline = uline.replace("{", "");
+ uline = uline[uline.find("uniform") + len("uniform"):]
+ uline = uline.replace(";", "")
+ uline = uline.replace("{", "")
lines = uline.split(",")
for x in lines:
@@ -137,8 +137,8 @@ def build_glsl_header(filename):
ubo_names += [x]
else:
- uline = line.replace("uniform", "");
- uline = uline.replace(";", "");
+ uline = line.replace("uniform", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -152,9 +152,9 @@ def build_glsl_header(filename):
uniforms += [x]
if ((line.strip().find("in ") == 0 or line.strip().find("attribute ") == 0) and line.find("attrib:") != -1):
- uline = line.replace("in ", "");
- uline = uline.replace("attribute ", "");
- uline = uline.replace(";", "");
+ uline = line.replace("in ", "")
+ uline = uline.replace("attribute ", "")
+ uline = uline.replace(";", "")
uline = uline[uline.find(" "):].strip()
if (uline.find("//") != -1):
@@ -165,8 +165,8 @@ def build_glsl_header(filename):
attributes += [(name, bind)]
if (line.strip().find("out ") == 0):
- uline = line.replace("out", "").strip();
- uline = uline.replace(";", "");
+ uline = line.replace("out", "").strip()
+ uline = uline.replace(";", "")
uline = uline[uline.find(" "):].strip()
if (uline.find("//") != -1):
@@ -190,12 +190,12 @@ def build_glsl_header(filename):
line = fs.readline()
line_offset += 1
- fs.close();
+ fs.close()
out_file = filename + ".h"
fd = open(out_file, "w")
- fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
+ fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
out_file_base = out_file
out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
@@ -205,47 +205,47 @@ def build_glsl_header(filename):
fd.write("#ifndef " + out_file_ifdef + "\n")
fd.write("#define " + out_file_ifdef + "\n")
- out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "ShaderGL";
- fd.write("\n\n");
- fd.write("#include \"drivers/opengl/shader_gl.h\"\n\n\n");
- fd.write("class " + out_file_class + " : public ShaderGL {\n\n");
- fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n");
- fd.write("public:\n\n");
+ out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "ShaderGL"
+ fd.write("\n\n")
+ fd.write("#include \"drivers/opengl/shader_gl.h\"\n\n\n")
+ fd.write("class " + out_file_class + " : public ShaderGL {\n\n")
+ fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n")
+ fd.write("public:\n\n")
if (len(conditionals)):
- fd.write("\tenum Conditionals {\n");
+ fd.write("\tenum Conditionals {\n")
for x in conditionals:
- fd.write("\t\t" + x + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x + ",\n")
+ fd.write("\t};\n\n")
if (len(uniforms)):
- fd.write("\tenum Uniforms {\n");
+ fd.write("\tenum Uniforms {\n")
for x in uniforms:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ fd.write("\t};\n\n")
- fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n");
+ fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n")
if (len(conditionals)):
- fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n");
- fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n")
+ fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n")
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
@@ -276,7 +276,7 @@ def build_glsl_header(filename):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU
@@ -307,7 +307,7 @@ def build_glsl_header(filename):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
@@ -321,18 +321,18 @@ def build_glsl_header(filename):
}
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
- }; """);
+ }; """)
- fd.write("\n\n#undef _FU\n\n\n");
+ fd.write("\n\n#undef _FU\n\n\n")
- fd.write("\tvirtual void init() {\n\n");
+ fd.write("\tvirtual void init() {\n\n")
if (len(conditionals)):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(conditionals)):
for x in conditionals:
- fd.write("\t\t\t\"#define " + x + "\\n\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"#define " + x + "\\n\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -341,8 +341,8 @@ def build_glsl_header(filename):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(uniforms)):
for x in uniforms:
- fd.write("\t\t\t\"" + x + "\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
@@ -350,62 +350,62 @@ def build_glsl_header(filename):
fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
for x in attributes:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
if (len(fbos)):
fd.write("\t\tstatic FBOPair _fbo_pairs[]={\n")
for x in fbos:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic FBOPair *_fbo_pairs=NULL;\n")
if (len(ubos)):
fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
for x in ubos:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
if (len(texunits)):
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
for x in texunits:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
fd.write("\t\tstatic const char* _vertex_code=\"\\\n")
for x in vertex_lines:
- fd.write("\t\t\t" + x + "\n");
- fd.write("\t\t\";\n\n");
+ fd.write("\t\t\t" + x + "\n")
+ fd.write("\t\t\";\n\n")
fd.write("\t\tstatic const int _vertex_code_start=" + str(vertex_offset) + ";\n")
fd.write("\t\tstatic const char* _fragment_code=\"\\\n")
for x in fragment_lines:
- fd.write("\t\t\t" + x + "\n");
- fd.write("\t\t\";\n\n");
+ fd.write("\t\t\t" + x + "\n")
+ fd.write("\t\t\";\n\n")
fd.write("\t\tstatic const int _fragment_code_start=" + str(fragment_offset) + ";\n")
fd.write("\t\tsetup(_conditional_strings," + str(len(conditionals)) + ",_uniform_strings," + str(len(uniforms)) + ",_attribute_pairs," + str(len(attributes)) + ",_fbo_pairs," + str(len(fbos)) + ",_ubo_pairs," + str(len(ubos)) + ",_texunit_pairs," + str(len(texunits)) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
fd.write("\t};\n\n")
- fd.write("};\n\n");
- fd.write("#endif\n\n");
- fd.close();
+ fd.write("};\n\n")
+ fd.write("#endif\n\n")
+ fd.close()
def build_glsl_headers(target, source, env):
for x in source:
- build_glsl_header(str(x));
+ build_glsl_header(str(x))
return 0
@@ -455,8 +455,8 @@ def build_hlsl_dx9_header(filename):
if (not ifdefline in conditionals):
conditionals += [ifdefline]
if (line.find("uniform") != -1):
- uline = line.replace("uniform", "");
- uline = uline.replace(";", "");
+ uline = line.replace("uniform", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -483,12 +483,12 @@ def build_hlsl_dx9_header(filename):
line = fs.readline()
line_offset += 1
- fs.close();
+ fs.close()
out_file = filename + ".h"
fd = open(out_file, "w")
- fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
+ fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
out_file_base = out_file
out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
@@ -498,47 +498,47 @@ def build_hlsl_dx9_header(filename):
fd.write("#ifndef " + out_file_ifdef + "\n")
fd.write("#define " + out_file_ifdef + "\n")
- out_file_class = out_file_base.replace(".hlsl.h", "").title().replace("_", "").replace(".", "") + "ShaderDX9";
- fd.write("\n\n");
- fd.write("#include \"drivers/directx9/shader_dx9.h\"\n\n\n");
- fd.write("class " + out_file_class + " : public ShaderDX9 {\n\n");
- fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n");
- fd.write("public:\n\n");
+ out_file_class = out_file_base.replace(".hlsl.h", "").title().replace("_", "").replace(".", "") + "ShaderDX9"
+ fd.write("\n\n")
+ fd.write("#include \"drivers/directx9/shader_dx9.h\"\n\n\n")
+ fd.write("class " + out_file_class + " : public ShaderDX9 {\n\n")
+ fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n")
+ fd.write("public:\n\n")
if (len(conditionals)):
- fd.write("\tenum Conditionals {\n");
+ fd.write("\tenum Conditionals {\n")
for x in conditionals:
- fd.write("\t\t" + x + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x + ",\n")
+ fd.write("\t};\n\n")
if (len(uniforms)):
- fd.write("\tenum Uniforms {\n");
+ fd.write("\tenum Uniforms {\n")
for x in uniforms:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ fd.write("\t};\n\n")
if (len(conditionals)):
- fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n");
-
- fd.write("\t#define _FU if (!_uniform_valid(p_uniform)) return; ERR_FAIL_COND( get_active()!=this );\n\n ");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, bool p_value) { _FU set_uniformb(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n")
+
+ fd.write("\t#define _FU if (!_uniform_valid(p_uniform)) return; ERR_FAIL_COND( get_active()!=this );\n\n ")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, bool p_value) { _FU set_uniformb(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU float col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; set_uniformfv(p_uniform,col); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU float vec2[4]={p_vec2.x,p_vec2.y,0,0}; set_uniformfv(p_uniform,vec2); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU float vec3[4]={p_vec3.x,p_vec3.y,p_vec3.z,0}; set_uniformfv(p_uniform,vec3); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU float vec2[4]={p_a,p_b,0,0}; set_uniformfv(p_uniform,vec2); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU float vec3[4]={p_a,p_b,p_c,0}; set_uniformfv(p_uniform,vec3); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU float vec4[4]={p_a,p_b,p_c,p_d}; set_uniformfv(p_uniform,vec4); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU float col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; set_uniformfv(p_uniform,col); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU float vec2[4]={p_vec2.x,p_vec2.y,0,0}; set_uniformfv(p_uniform,vec2); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU float vec3[4]={p_vec3.x,p_vec3.y,p_vec3.z,0}; set_uniformfv(p_uniform,vec3); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU float vec2[4]={p_a,p_b,0,0}; set_uniformfv(p_uniform,vec2); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU float vec3[4]={p_a,p_b,p_c,0}; set_uniformfv(p_uniform,vec3); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU float vec4[4]={p_a,p_b,p_c,p_d}; set_uniformfv(p_uniform,vec4); }\n\n")
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
@@ -567,7 +567,7 @@ def build_hlsl_dx9_header(filename):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
@@ -581,18 +581,18 @@ def build_hlsl_dx9_header(filename):
}
set_uniformfv(p_uniform,&matrix[0],4);
- }; """);
+ }; """)
- fd.write("\n\n#undef _FU\n\n\n");
+ fd.write("\n\n#undef _FU\n\n\n")
- fd.write("\tvirtual void init(IDirect3DDevice9 *p_device,ShaderSupport p_version) {\n\n");
+ fd.write("\tvirtual void init(IDirect3DDevice9 *p_device,ShaderSupport p_version) {\n\n")
if (len(conditionals)):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(conditionals)):
for x in conditionals:
- fd.write("\t\t\t\"" + x + "\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -601,49 +601,49 @@ def build_hlsl_dx9_header(filename):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(uniforms)):
for x in uniforms:
- fd.write("\t\t\t\"" + x + "\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write("\t\t};\n\n")
fd.write("\t\tstatic const bool _fragment_uniforms[]={\n")
if (len(uniforms)):
for x in fragment_uniforms:
if (x):
- fd.write("\t\t\ttrue,\n");
+ fd.write("\t\t\ttrue,\n")
else:
- fd.write("\t\t\tfalse,\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\tfalse,\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
fd.write("\t\tstatic const bool *_fragment_uniforms=NULL;\n")
fd.write("\t\tstatic const char* _vertex_code=\"\\\n")
for x in vertex_lines:
- fd.write("\t\t\t" + x + "\n");
- fd.write("\t\t\";\n\n");
+ fd.write("\t\t\t" + x + "\n")
+ fd.write("\t\t\";\n\n")
fd.write("\t\tstatic const int _vertex_code_start=" + str(vertex_offset) + ";\n")
fd.write("\t\tstatic const char* _fragment_code=\"\\\n")
for x in fragment_lines:
- fd.write("\t\t\t" + x + "\n");
- fd.write("\t\t\";\n\n");
+ fd.write("\t\t\t" + x + "\n")
+ fd.write("\t\t\";\n\n")
fd.write("\t\tstatic const int _fragment_code_start=" + str(fragment_offset) + ";\n")
fd.write("\t\tsetup(p_device,p_version,_conditional_strings," + str(len(conditionals)) + ",_uniform_strings," + str(len(uniforms)) + ",_fragment_uniforms,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
fd.write("\t};\n\n")
- fd.write("};\n\n");
- fd.write("#endif\n\n");
- fd.close();
+ fd.write("};\n\n")
+ fd.write("#endif\n\n")
+ fd.close()
def build_hlsl_dx9_headers(target, source, env):
for x in source:
- build_hlsl_dx9_header(str(x));
+ build_hlsl_dx9_header(str(x))
return 0
@@ -717,14 +717,14 @@ def include_file_in_legacygl_header(filename, header_data, depth):
ifdefline = ifdefline.replace(")", "").strip()
if (line.find("_EN_") != -1):
- enumbase = ifdefline[:ifdefline.find("_EN_")];
+ enumbase = ifdefline[:ifdefline.find("_EN_")]
ifdefline = ifdefline.replace("_EN_", "_")
line = line.replace("_EN_", "_")
# print(enumbase+":"+ifdefline);
if (enumbase not in header_data.enums):
header_data.enums[enumbase] = []
if (ifdefline not in header_data.enums[enumbase]):
- header_data.enums[enumbase].append(ifdefline);
+ header_data.enums[enumbase].append(ifdefline)
elif (not ifdefline in header_data.conditionals):
header_data.conditionals += [ifdefline]
@@ -737,9 +737,9 @@ def include_file_in_legacygl_header(filename, header_data, depth):
else:
texunit = str(int(texunitstr))
uline = line[:line.lower().find("//")]
- uline = uline.replace("uniform", "");
- uline = uline.replace("highp", "");
- uline = uline.replace(";", "");
+ uline = uline.replace("uniform", "")
+ uline = uline.replace("highp", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -754,8 +754,8 @@ def include_file_in_legacygl_header(filename, header_data, depth):
header_data.texunit_names += [x]
elif (line.find("uniform") != -1):
- uline = line.replace("uniform", "");
- uline = uline.replace(";", "");
+ uline = line.replace("uniform", "")
+ uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
@@ -769,10 +769,10 @@ def include_file_in_legacygl_header(filename, header_data, depth):
header_data.uniforms += [x]
if ((line.strip().find("in ") == 0 or line.strip().find("attribute ") == 0) and line.find("attrib:") != -1):
- uline = line.replace("in ", "");
- uline = uline.replace("attribute ", "");
- uline = uline.replace("highp ", "");
- uline = uline.replace(";", "");
+ uline = line.replace("in ", "")
+ uline = uline.replace("attribute ", "")
+ uline = uline.replace("highp ", "")
+ uline = uline.replace(";", "")
uline = uline[uline.find(" "):].strip()
if (uline.find("//") != -1):
@@ -796,7 +796,7 @@ def include_file_in_legacygl_header(filename, header_data, depth):
line = fs.readline()
header_data.line_offset += 1
- fs.close();
+ fs.close()
return header_data
@@ -811,7 +811,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
enum_constants = []
- fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
+ fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
out_file_base = out_file
out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
@@ -821,49 +821,49 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("#ifndef " + out_file_ifdef + class_suffix + "_120\n")
fd.write("#define " + out_file_ifdef + class_suffix + "_120\n")
- out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix;
- fd.write("\n\n");
- fd.write("#include \"" + include + "\"\n\n\n");
- fd.write("class " + out_file_class + " : public Shader" + class_suffix + " {\n\n");
- fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n");
+ out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix
+ fd.write("\n\n")
+ fd.write("#include \"" + include + "\"\n\n\n")
+ fd.write("class " + out_file_class + " : public Shader" + class_suffix + " {\n\n")
+ fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n")
- fd.write("public:\n\n");
+ fd.write("public:\n\n")
if (len(header_data.conditionals)):
- fd.write("\tenum Conditionals {\n");
+ fd.write("\tenum Conditionals {\n")
for x in header_data.conditionals:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ fd.write("\t};\n\n")
if (len(header_data.uniforms)):
- fd.write("\tenum Uniforms {\n");
+ fd.write("\tenum Uniforms {\n")
for x in header_data.uniforms:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ fd.write("\t};\n\n")
- fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n");
+ fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n")
if (len(header_data.conditionals)):
- fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n");
- fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n")
+ fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
#fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n");
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n")
+ fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n")
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
@@ -894,7 +894,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU
@@ -925,7 +925,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
}
- """);
+ """)
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
@@ -939,17 +939,17 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
}
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
- }; """);
+ }; """)
- fd.write("\n\n#undef _FU\n\n\n");
+ fd.write("\n\n#undef _FU\n\n\n")
- fd.write("\tvirtual void init() {\n\n");
+ fd.write("\tvirtual void init() {\n\n")
- enum_value_count = 0;
+ enum_value_count = 0
if (len(header_data.enums)):
- fd.write("\t\t//Written using math, given nonstandarity of 64 bits integer constants..\n");
+ fd.write("\t\t//Written using math, given nonstandarity of 64 bits integer constants..\n")
fd.write("\t\tstatic const Enum _enums[]={\n")
bitofs = len(header_data.conditionals)
@@ -958,7 +958,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
for xv in header_data.enums:
x = header_data.enums[xv]
bits = 1
- amt = len(x);
+ amt = len(x)
# print(x)
while(2**bits < amt):
bits += 1
@@ -975,18 +975,18 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
strs += "NULL}"
- fd.write("\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n");
+ fd.write("\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n")
bitofs += bits
- fd.write("\t\t};\n\n");
+ fd.write("\t\t};\n\n")
fd.write("\t\tstatic const EnumValue _enum_values[]={\n")
- enum_value_count = len(enum_vals);
+ enum_value_count = len(enum_vals)
for x in enum_vals:
- fd.write("\t\t\t{" + x["set_mask"] + "," + x["clear_mask"] + "},\n");
+ fd.write("\t\t\t{" + x["set_mask"] + "," + x["clear_mask"] + "},\n")
- fd.write("\t\t};\n\n");
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const Enum *_enums=NULL;\n")
fd.write("\t\tstatic const EnumValue *_enum_values=NULL;\n")
@@ -996,8 +996,8 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(header_data.conditionals)):
for x in header_data.conditionals:
- fd.write("\t\t\t\"#define " + x + "\\n\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"#define " + x + "\\n\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
@@ -1006,8 +1006,8 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(header_data.uniforms)):
for x in header_data.uniforms:
- fd.write("\t\t\t\"" + x + "\",\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
@@ -1016,36 +1016,36 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
for x in header_data.attributes:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
if (len(header_data.texunits)):
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
for x in header_data.texunits:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n");
- fd.write("\t\t};\n\n");
+ fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
fd.write("\t\tstatic const char _vertex_code[]={\n")
for x in header_data.vertex_lines:
for i in range(len(x)):
- fd.write(str(ord(x[i])) + ",");
+ fd.write(str(ord(x[i])) + ",")
- fd.write(str(ord('\n')) + ",");
- fd.write("\t\t0};\n\n");
+ fd.write(str(ord('\n')) + ",")
+ fd.write("\t\t0};\n\n")
fd.write("\t\tstatic const int _vertex_code_start=" + str(header_data.vertex_offset) + ";\n")
fd.write("\t\tstatic const char _fragment_code[]={\n")
for x in header_data.fragment_lines:
for i in range(len(x)):
- fd.write(str(ord(x[i])) + ",");
+ fd.write(str(ord(x[i])) + ",")
- fd.write(str(ord('\n')) + ",");
- fd.write("\t\t0};\n\n");
+ fd.write(str(ord('\n')) + ",")
+ fd.write("\t\t0};\n\n")
fd.write("\t\tstatic const int _fragment_code_start=" + str(header_data.fragment_offset) + ";\n")
@@ -1060,20 +1060,20 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\tenum EnumConditionals {\n")
for x in enum_constants:
- fd.write("\t\t" + x.upper() + ",\n");
- fd.write("\t};\n\n");
+ fd.write("\t\t" + x.upper() + ",\n")
+ fd.write("\t};\n\n")
fd.write("\tvoid set_enum_conditional(EnumConditionals p_cond) { _set_enum_conditional(p_cond); }\n")
- fd.write("};\n\n");
- fd.write("#endif\n\n");
- fd.close();
+ fd.write("};\n\n")
+ fd.write("#endif\n\n")
+ fd.close()
def build_legacygl_headers(target, source, env):
for x in source:
- build_legacygl_header(str(x), include="drivers/legacygl/shader_lgl.h", class_suffix="LGL", output_attribs=False);
+ build_legacygl_header(str(x), include="drivers/legacygl/shader_lgl.h", class_suffix="LGL", output_attribs=False)
return 0
@@ -1120,22 +1120,22 @@ def parse_cg_file(fname, uniforms, sizes, conditionals):
type = res.groups(1)
name = res.groups(2)
- uniforms.append(name);
+ uniforms.append(name)
if (type.find("texobj") != -1):
- sizes.append(1);
+ sizes.append(1)
else:
- t = re.match(r"float(\d)x(\d)", type);
+ t = re.match(r"float(\d)x(\d)", type)
if t:
sizes.append(int(t.groups(1)) * int(t.groups(2)))
else:
- t = re.match(r"float(\d)", type);
+ t = re.match(r"float(\d)", type)
sizes.append(int(t.groups(1)))
if line.find("[branch]") != -1:
- conditionals.append(name);
+ conditionals.append(name)
- line = fs.readline();
+ line = fs.readline()
def build_cg_shader(sname):
@@ -1144,36 +1144,36 @@ def build_cg_shader(sname):
vp_uniform_sizes = []
vp_conditionals = []
- parse_cg_file("vp_" + sname + ".cg", vp_uniforms, vp_uniform_sizes, vp_conditionals);
+ parse_cg_file("vp_" + sname + ".cg", vp_uniforms, vp_uniform_sizes, vp_conditionals)
fp_uniforms = []
fp_uniform_sizes = []
fp_conditionals = []
- parse_cg_file("fp_" + sname + ".cg", fp_uniforms, fp_uniform_sizes, fp_conditionals);
+ parse_cg_file("fp_" + sname + ".cg", fp_uniforms, fp_uniform_sizes, fp_conditionals)
- fd = open("shader_" + sname + ".cg.h", "w");
+ fd = open("shader_" + sname + ".cg.h", "w")
- fd.write('\n#include "shader_cell.h"\n');
- fd.write("\nclass Shader_" + sname + " : public ShaderCell {\n");
- fd.write("\n\tstatic struct VertexUniforms[] = {\n");
+ fd.write('\n#include "shader_cell.h"\n')
+ fd.write("\nclass Shader_" + sname + " : public ShaderCell {\n")
+ fd.write("\n\tstatic struct VertexUniforms[] = {\n")
- offset = 0;
+ offset = 0
for i in range(0, len(vp_uniforms)):
fd.write('\t\t{ "%s", %d, %d },\n' % (vp_uniforms[i], offset, vp_uniform_sizes[i]))
- offset = offset + vp_uniform_sizes[i];
- fd.write("\t};\n\n");
+ offset = offset + vp_uniform_sizes[i]
+ fd.write("\t};\n\n")
- fd.write("public:\n\n");
+ fd.write("public:\n\n")
- fd.write("\tenum {\n");
+ fd.write("\tenum {\n")
for i in range(0, len(vp_uniforms)):
fd.write('\t\tVP_%s,\n' % vp_uniforms[i].upper())
- fd.write("\t};\n");
+ fd.write("\t};\n")
import glob
@@ -1440,13 +1440,13 @@ def save_active_platforms(apnames, ap):
for x in ap:
pth = x + "/logo.png"
# print("open path: "+pth)
- pngf = open(pth, "rb");
- b = pngf.read(1);
+ pngf = open(pth, "rb")
+ b = pngf.read(1)
str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
str += " static const unsigned char _" + x[9:] + "_logo[]={"
while(len(b) == 1):
str += hex(ord(b))
- b = pngf.read(1);
+ b = pngf.read(1)
if (len(b) == 1):
str += ","
diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub
index 75ea9b6bde..bac80fb76e 100644
--- a/modules/openssl/SCsub
+++ b/modules/openssl/SCsub
@@ -682,6 +682,6 @@ env_openssl.add_source_files(env.modules_sources, "*.c")
# platform/winrt need to know openssl is available, pass to main env
if "platform" in env and env["platform"] == "winrt":
env.Append(CPPPATH=[thirdparty_dir])
- env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
+ env.Append(CPPFLAGS=['-DOPENSSL_ENABLED'])
Export('env')
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 5de4f11445..d52bb57c0f 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -49,7 +49,7 @@ def create(env):
if "applelink" in tools:
tools.remove("applelink")
env.Tool('gcc')
- return env.Clone(tools=tools);
+ return env.Clone(tools=tools)
def configure(env):
@@ -124,7 +124,7 @@ def configure(env):
else:
env.extra_suffix = ".armv7" + env.extra_suffix
- gcc_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + env["NDK_TARGET"] + "/prebuilt/";
+ gcc_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + env["NDK_TARGET"] + "/prebuilt/"
if (sys.platform.startswith("linux")):
if (platform.machine().endswith('64')):
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index 7e71faa377..38f789259c 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -23,7 +23,7 @@ iphone_lib = [
#iphone_lib = env.Library('iphone', iphone_lib)
-env_ios = env.Clone();
+env_ios = env.Clone()
if env['ios_gles22_override'] == "yes":
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 04a6bc9cc3..ec99392987 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -39,7 +39,7 @@ def get_flags():
def configure(env):
- env['ENV'] = os.environ;
+ env['ENV'] = os.environ
env.use_windows_spawn_fix('javascript')
env.Append(CPPPATH=['#platform/javascript'])
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 93d29a3606..0576b0bfa9 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -267,7 +267,7 @@ def configure(env):
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
- env['ENV'] = os.environ;
+ env['ENV'] = os.environ
# This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
@@ -323,10 +323,10 @@ def configure(env):
env.Append(LINKFLAGS=['-static'])
env.Append(LINKFLAGS=['-static-libgcc'])
env.Append(LINKFLAGS=['-static-libstdc++'])
- mingw_prefix = env["mingw_prefix"];
+ mingw_prefix = env["mingw_prefix"]
else:
env.Append(LINKFLAGS=['-static'])
- mingw_prefix = env["mingw_prefix_64"];
+ mingw_prefix = env["mingw_prefix_64"]
nulstr = ""
diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py
index 15ac429687..2156e593e8 100644
--- a/platform/winrt/detect.py
+++ b/platform/winrt/detect.py
@@ -49,7 +49,7 @@ def configure(env):
sys.exit()
arch = ""
- env['ENV'] = os.environ;
+ env['ENV'] = os.environ
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
diff --git a/scene/SCsub b/scene/SCsub
index 4a89eef469..bd2da1eab9 100644
--- a/scene/SCsub
+++ b/scene/SCsub
@@ -7,14 +7,14 @@ env.add_source_files(env.scene_sources, "*.cpp")
Export('env')
-SConscript('main/SCsub');
-SConscript('gui/SCsub');
-SConscript('3d/SCsub');
-SConscript('2d/SCsub');
-SConscript('animation/SCsub');
-SConscript('audio/SCsub');
-SConscript('resources/SCsub');
-SConscript('io/SCsub');
+SConscript('main/SCsub')
+SConscript('gui/SCsub')
+SConscript('3d/SCsub')
+SConscript('2d/SCsub')
+SConscript('animation/SCsub')
+SConscript('audio/SCsub')
+SConscript('resources/SCsub')
+SConscript('io/SCsub')
lib = env.Library("scene", env.scene_sources)
diff --git a/scene/resources/SCsub b/scene/resources/SCsub
index 9c1e72f04f..60b16cd0d4 100644
--- a/scene/resources/SCsub
+++ b/scene/resources/SCsub
@@ -7,4 +7,4 @@ env.add_source_files(env.scene_sources, "*.c")
Export('env')
-SConscript("default_theme/SCsub");
+SConscript("default_theme/SCsub")
diff --git a/scene/resources/default_theme/make_header.py b/scene/resources/default_theme/make_header.py
index 41d5e2e259..68c9e92527 100644
--- a/scene/resources/default_theme/make_header.py
+++ b/scene/resources/default_theme/make_header.py
@@ -1,71 +1,71 @@
-import os;
-import glob;
-import string;
+import os
+import glob
+import string
# Generate include files
f = open("theme_data.h", "wb")
-f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n");
+f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n")
-f.write("\n\n");
+f.write("\n\n")
# Generate png image block
-pixmaps = glob.glob("*.png");
+pixmaps = glob.glob("*.png")
-pixmaps.sort();
+pixmaps.sort()
-f.write("\n\n\n");
+f.write("\n\n\n")
for x in pixmaps:
- var_str = x[:-4] + "_png";
+ var_str = x[:-4] + "_png"
- f.write("static const unsigned char " + var_str + "[]={\n");
+ f.write("static const unsigned char " + var_str + "[]={\n")
- pngf = open(x, "rb");
+ pngf = open(x, "rb")
- b = pngf.read(1);
+ b = pngf.read(1)
while(len(b) == 1):
f.write(hex(ord(b)))
- b = pngf.read(1);
+ b = pngf.read(1)
if (len(b) == 1):
f.write(",")
- f.write("\n};\n\n\n");
- pngf.close();
+ f.write("\n};\n\n\n")
+ pngf.close()
# Generate shaders block
shaders = glob.glob("*.gsl")
-shaders.sort();
+shaders.sort()
-f.write("\n\n\n");
+f.write("\n\n\n")
for x in shaders:
- var_str = x[:-4] + "_shader_code";
+ var_str = x[:-4] + "_shader_code"
- f.write("static const char *" + var_str + "=\n");
+ f.write("static const char *" + var_str + "=\n")
- sf = open(x, "rb");
+ sf = open(x, "rb")
- b = sf.readline();
+ b = sf.readline()
while(b != ""):
if (b.endswith("\r\n")):
b = b[:-2]
if (b.endswith("\n")):
b = b[:-1]
f.write(" \"" + b)
- b = sf.readline();
+ b = sf.readline()
if (b != ""):
f.write("\"\n")
- f.write("\";\n\n\n");
- sf.close();
+ f.write("\";\n\n\n")
+ sf.close()
-f.close();
+f.close()
diff --git a/servers/SCsub b/servers/SCsub
index 8fab6c1dc2..eefa6278c4 100644
--- a/servers/SCsub
+++ b/servers/SCsub
@@ -7,12 +7,12 @@ env.add_source_files(env.servers_sources, "*.cpp")
Export('env')
-SConscript('physics/SCsub');
-SConscript('physics_2d/SCsub');
-SConscript('visual/SCsub');
-SConscript('audio/SCsub');
-SConscript('spatial_sound/SCsub');
-SConscript('spatial_sound_2d/SCsub');
+SConscript('physics/SCsub')
+SConscript('physics_2d/SCsub')
+SConscript('visual/SCsub')
+SConscript('audio/SCsub')
+SConscript('spatial_sound/SCsub')
+SConscript('spatial_sound_2d/SCsub')
lib = env.Library("servers", env.servers_sources)
diff --git a/tools/SCsub b/tools/SCsub
index f11aa34ee6..43cad794d4 100644
--- a/tools/SCsub
+++ b/tools/SCsub
@@ -47,11 +47,11 @@ def make_translations_header(target, source, env):
xl_names.append([name, len(buf), str(decomp_size)])
g.write("struct EditorTranslationList {\n")
- g.write("\tconst char* lang;\n");
- g.write("\tint comp_size;\n");
- g.write("\tint uncomp_size;\n");
- g.write("\tconst unsigned char* data;\n");
- g.write("};\n\n");
+ g.write("\tconst char* lang;\n")
+ g.write("\tint comp_size;\n")
+ g.write("\tint uncomp_size;\n")
+ g.write("\tconst unsigned char* data;\n")
+ g.write("};\n\n")
g.write("static EditorTranslationList _editor_translations[]={\n")
for x in xl_names:
g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n")
@@ -112,8 +112,8 @@ if (env["tools"] != "no"):
env.Depends('#tools/editor/builtin_fonts.h', flist)
env.Command('#tools/editor/builtin_fonts.h', flist, make_fonts_header)
- SConscript('editor/SCsub');
- SConscript('collada/SCsub');
+ SConscript('editor/SCsub')
+ SConscript('collada/SCsub')
SConscript('doc/SCsub')
lib = env.Library("tool", env.tool_sources)
diff --git a/tools/editor/SCsub b/tools/editor/SCsub
index 625103eaee..caf45d25be 100644
--- a/tools/editor/SCsub
+++ b/tools/editor/SCsub
@@ -74,7 +74,7 @@ if (env["tools"] == "yes"):
env.add_source_files(env.tool_sources, "*.cpp")
Export('env')
- SConscript('icons/SCsub');
- SConscript('plugins/SCsub');
- SConscript('fileserver/SCsub');
- SConscript('io_plugins/SCsub');
+ SConscript('icons/SCsub')
+ SConscript('plugins/SCsub')
+ SConscript('fileserver/SCsub')
+ SConscript('io_plugins/SCsub')
diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub
index f27350a184..af6ebd67fd 100644
--- a/tools/editor/icons/SCsub
+++ b/tools/editor/icons/SCsub
@@ -22,42 +22,42 @@ def make_editor_icons_action(target, source, env):
for x in pixmaps:
x = str(x)
- var_str = os.path.basename(x)[:-4] + "_png";
+ var_str = os.path.basename(x)[:-4] + "_png"
# print(var_str)
- s.write("static const unsigned char " + var_str + "[]={\n");
+ s.write("static const unsigned char " + var_str + "[]={\n")
- pngf = open(x, "rb");
+ pngf = open(x, "rb")
- b = pngf.read(1);
+ b = pngf.read(1)
while(len(b) == 1):
s.write(hex(ord(b)))
- b = pngf.read(1);
+ b = pngf.read(1)
if (len(b) == 1):
s.write(",")
- s.write("\n};\n\n");
+ s.write("\n};\n\n")
- pngf.close();
- var_str = os.path.basename(x)[:-4] + "_hidpi_png";
+ pngf.close()
+ var_str = os.path.basename(x)[:-4] + "_hidpi_png"
try:
pngf = open(os.path.dirname(x) + "/2x/" + os.path.basename(x), "rb")
- s.write("static const unsigned char " + var_str + "[]={\n");
+ s.write("static const unsigned char " + var_str + "[]={\n")
- b = pngf.read(1);
+ b = pngf.read(1)
while(len(b) == 1):
s.write(hex(ord(b)))
- b = pngf.read(1);
+ b = pngf.read(1)
if (len(b) == 1):
s.write(",")
- s.write("\n};\n\n\n");
+ s.write("\n};\n\n\n")
hidpi_list.append(x)
except:
- s.write("static const unsigned char* " + var_str + "=NULL;\n\n\n");
+ s.write("static const unsigned char* " + var_str + "=NULL;\n\n\n")
s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n")
s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n")
@@ -74,12 +74,12 @@ def make_editor_icons_action(target, source, env):
for x in pixmaps:
x = os.path.basename(str(x))
- type = x[5:-4].title().replace("_", "");
- var_str = x[:-4] + "_png";
- var_str_hidpi = x[:-4] + "_hidpi_png";
- s.write("\tp_theme->set_icon(\"" + type + "\",\"EditorIcons\",make_icon(" + var_str + "," + var_str_hidpi + "));\n");
+ type = x[5:-4].title().replace("_", "")
+ var_str = x[:-4] + "_png"
+ var_str_hidpi = x[:-4] + "_hidpi_png"
+ s.write("\tp_theme->set_icon(\"" + type + "\",\"EditorIcons\",make_icon(" + var_str + "," + var_str_hidpi + "));\n")
- s.write("\n\n}\n\n");
+ s.write("\n\n}\n\n")
f = open(dst, "wb")
f.write(s.getvalue())
diff --git a/tools/scripts/file-hex-array.py b/tools/scripts/file-hex-array.py
index da95c9505f..a6cdfe541f 100755
--- a/tools/scripts/file-hex-array.py
+++ b/tools/scripts/file-hex-array.py
@@ -9,7 +9,8 @@ def tof(filepath):
content = content.replace("0x", "")
content = content.split(',')
for i in range(len(content)):
- if len(content[i]) == 1: content[i] = "0" + content[i]
+ if len(content[i]) == 1:
+ content[i] = "0" + content[i]
content = "".join(content)
with open(filepath + ".file", 'wb') as f:
content = f.write(content.decode("hex"))
diff --git a/tools/scripts/make_glwrapper.py b/tools/scripts/make_glwrapper.py
index bae0eeeadc..5694d2327e 100644
--- a/tools/scripts/make_glwrapper.py
+++ b/tools/scripts/make_glwrapper.py
@@ -61,7 +61,7 @@ for x in (range(len(sys.argv) - 1)):
if (glpos == -1):
continue
- ret = line[:glpos].strip();
+ ret = line[:glpos].strip()
line = line[glpos:].strip()
namepos = line.find("(")
@@ -127,14 +127,14 @@ header_code = """\
f.write("#include <stddef.h>\n\n\n")
-f.write(header_code);
+f.write(header_code)
f.write("#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n")
f.write("#if defined(_WIN32) && !defined(__CYGWIN__)\n")
f.write("#define GLWRP_APIENTRY __stdcall\n")
-f.write("#else\n");
+f.write("#else\n")
f.write("#define GLWRP_APIENTRY \n")
-f.write("#endif\n\n");
+f.write("#endif\n\n")
for x in types:
f.write(x + "\n")
@@ -150,7 +150,7 @@ for x in functions:
f.write("#define " + x["name"] + " __wrapper_" + x["name"] + "\n")
f.write("\n\n")
-f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n");
+f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n")
f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n")
f.write("#ifdef __cplusplus\n}\n#endif\n")