summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--SConstruct5
-rw-r--r--compat.py68
-rw-r--r--core/color.h2
-rw-r--r--core/command_queue_mt.h2
-rw-r--r--core/core_builders.py70
-rw-r--r--core/core_string_names.h2
-rw-r--r--core/cowdata.h10
-rw-r--r--core/debugger/script_debugger.h2
-rw-r--r--core/error_list.h2
-rw-r--r--core/error_macros.h2
-rw-r--r--core/hash_map.h2
-rw-r--r--core/hashfuncs.h3
-rw-r--r--core/image.h2
-rw-r--r--core/int_types.h7
-rw-r--r--core/io/image_loader.h2
-rw-r--r--core/io/logger.h2
-rw-r--r--core/io/marshalls.h2
-rw-r--r--core/io/multiplayer_api.h6
-rw-r--r--core/io/networked_multiplayer_peer.h2
-rw-r--r--core/io/resource_loader.h2
-rw-r--r--core/io/resource_saver.h2
-rw-r--r--core/io/stream_peer_tcp.h2
-rw-r--r--core/io/xml_parser.h2
-rw-r--r--core/list.h6
-rw-r--r--core/map.h2
-rw-r--r--core/math/a_star.h6
-rw-r--r--core/math/audio_frame.h6
-rw-r--r--core/math/camera_matrix.h2
-rw-r--r--core/math/disjoint_set.h2
-rw-r--r--core/math/geometry.h2
-rw-r--r--core/math/octree.h2
-rw-r--r--core/math/quat.h2
-rw-r--r--core/math/triangulate.h2
-rw-r--r--core/message_queue.cpp4
-rw-r--r--core/method_bind.h2
-rw-r--r--core/node_path.h2
-rw-r--r--core/oa_hash_map.h2
-rw-r--r--core/object.cpp20
-rw-r--r--core/object.h3
-rw-r--r--core/os/copymem.h2
-rw-r--r--core/os/dir_access.h2
-rw-r--r--core/os/file_access.h2
-rw-r--r--core/os/input_event.h2
-rw-r--r--core/os/keyboard.h2
-rw-r--r--core/os/main_loop.h2
-rw-r--r--core/os/memory.h2
-rw-r--r--core/os/midi_driver.h2
-rw-r--r--core/os/mutex.h2
-rw-r--r--core/os/os.h2
-rw-r--r--core/os/rw_lock.h6
-rw-r--r--core/os/semaphore.h2
-rw-r--r--core/os/thread.h2
-rw-r--r--core/os/thread_dummy.h2
-rw-r--r--core/os/thread_safe.h2
-rw-r--r--core/pool_allocator.h2
-rw-r--r--core/print_string.h2
-rw-r--r--core/project_settings.h6
-rw-r--r--core/register_core_types.h2
-rw-r--r--core/resource.h2
-rw-r--r--core/rid.h2
-rw-r--r--core/ring_buffer.h6
-rw-r--r--core/safe_refcount.h2
-rw-r--r--core/script_language.h3
-rw-r--r--core/set.h2
-rw-r--r--core/simple_type.h2
-rw-r--r--core/string_buffer.h2
-rw-r--r--core/type_info.h6
-rw-r--r--core/ucaps.h3
-rw-r--r--core/variant.h3
-rw-r--r--core/vector.h2
-rw-r--r--core/version.h6
-rw-r--r--doc/Makefile7
-rw-r--r--doc/classes/Object.xml11
-rw-r--r--drivers/alsa/audio_driver_alsa.h10
-rw-r--r--editor/SCsub9
-rw-r--r--editor/collada/SCsub5
-rw-r--r--editor/doc/SCsub5
-rw-r--r--editor/doc/doc_dump.cpp308
-rw-r--r--editor/doc/doc_dump.h41
-rw-r--r--editor/doc_data.cpp (renamed from editor/doc/doc_data.cpp)0
-rw-r--r--editor/doc_data.h (renamed from editor/doc/doc_data.h)0
-rw-r--r--editor/editor_builders.py17
-rw-r--r--editor/editor_help.h2
-rw-r--r--editor/file_type_cache.cpp104
-rw-r--r--editor/file_type_cache.h57
-rw-r--r--editor/icons/editor_icons_builders.py3
-rw-r--r--editor/import/collada.cpp (renamed from editor/collada/collada.cpp)0
-rw-r--r--editor/import/collada.h (renamed from editor/collada/collada.h)0
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--editor/plugins/skeleton_ik_editor_plugin.cpp5
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp32
-rw-r--r--editor/project_settings_editor.h6
-rw-r--r--main/main.cpp4
-rw-r--r--main/main_builders.py7
-rw-r--r--main/tests/test_main.cpp3
-rw-r--r--main/tests/test_main.h3
-rw-r--r--main/tests/test_oa_hash_map.cpp3
-rw-r--r--main/tests/test_oa_hash_map.h1
-rw-r--r--main/tests/test_ordered_hash_map.cpp2
-rw-r--r--main/tests/test_ordered_hash_map.h4
-rw-r--r--methods.py21
-rw-r--r--modules/assimp/register_types.h5
-rw-r--r--modules/basis_universal/register_types.h5
-rw-r--r--modules/bmp/register_types.h5
-rw-r--r--modules/csg/register_types.h5
-rw-r--r--modules/cvtt/register_types.h9
-rw-r--r--modules/dds/register_types.h5
-rw-r--r--modules/enet/register_types.h5
-rw-r--r--modules/etc/register_types.h5
-rw-r--r--modules/freetype/SCsub4
-rw-r--r--modules/freetype/register_types.h5
-rw-r--r--modules/gdnative/arvr/register_types.h5
-rw-r--r--modules/gdnative/nativescript/register_types.h5
-rw-r--r--modules/gdnative/net/register_types.h5
-rw-r--r--modules/gdnative/pluginscript/register_types.h5
-rw-r--r--modules/gdnative/register_types.h5
-rw-r--r--modules/gdnative/videodecoder/register_types.h5
-rw-r--r--modules/gdnavigation/register_types.h5
-rw-r--r--modules/gdscript/language_server/lsp.hpp2
-rw-r--r--modules/gdscript/register_types.h5
-rw-r--r--modules/glslang/register_types.h6
-rw-r--r--modules/gridmap/register_types.h5
-rw-r--r--modules/hdr/register_types.h5
-rw-r--r--modules/jpg/register_types.h5
-rw-r--r--modules/jsonrpc/register_types.h5
-rwxr-xr-xmodules/mbedtls/register_types.h5
-rw-r--r--modules/mobile_vr/register_types.h5
-rw-r--r--modules/mono/build_scripts/make_android_mono_config.py3
-rw-r--r--modules/mono/build_scripts/mono_reg_utils.py9
-rw-r--r--modules/mono/editor/bindings_generator.h2
-rw-r--r--modules/ogg/register_types.h5
-rw-r--r--modules/opensimplex/register_types.h5
-rw-r--r--modules/opus/register_types.h5
-rw-r--r--modules/pvr/register_types.h5
-rw-r--r--modules/regex/register_types.h5
-rw-r--r--modules/squish/register_types.h5
-rw-r--r--modules/stb_vorbis/register_types.h5
-rw-r--r--modules/svg/register_types.h5
-rw-r--r--modules/tga/register_types.h5
-rw-r--r--modules/theora/register_types.h5
-rw-r--r--modules/tinyexr/register_types.h5
-rw-r--r--modules/upnp/register_types.h5
-rw-r--r--modules/vhacd/register_types.h5
-rw-r--r--modules/visual_script/register_types.h5
-rw-r--r--modules/vorbis/register_types.h5
-rw-r--r--modules/webm/register_types.h5
-rw-r--r--modules/webp/register_types.h5
-rw-r--r--modules/webrtc/register_types.h5
-rw-r--r--modules/websocket/register_types.h5
-rw-r--r--modules/xatlas_unwrap/register_types.h5
-rw-r--r--platform/SCsub4
-rw-r--r--platform/android/api/api.h5
-rw-r--r--platform/android/export/export.h5
-rw-r--r--platform/iphone/export/export.h5
-rw-r--r--platform/iphone/platform_refcount.h48
-rw-r--r--platform/javascript/api/api.h5
-rw-r--r--platform/osx/export/export.h5
-rw-r--r--platform/uwp/export/export.h5
-rw-r--r--platform/x11/detect_prime.cpp2
-rw-r--r--platform/x11/export/export.h5
-rw-r--r--platform/x11/joypad_linux.cpp5
-rw-r--r--platform/x11/os_x11.cpp6
-rw-r--r--platform_methods.py5
-rw-r--r--scene/2d/audio_stream_player_2d.cpp2
-rw-r--r--scene/2d/path_texture.cpp90
-rw-r--r--scene/2d/path_texture.h64
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/3d/skeleton.cpp8
-rw-r--r--scene/3d/skeleton.h1
-rw-r--r--scene/animation/skeleton_ik.cpp7
-rw-r--r--scene/gui/color_picker.cpp17
-rw-r--r--scene/gui/line_edit.cpp21
-rw-r--r--scene/gui/rich_text_label.cpp2
-rw-r--r--scene/resources/canvas.cpp46
-rw-r--r--scene/resources/canvas.h48
-rw-r--r--scene/resources/sky_material.cpp2
-rw-r--r--scene/resources/space_2d.cpp66
-rw-r--r--scene/resources/space_2d.h56
-rw-r--r--scene/resources/visual_shader.cpp56
-rw-r--r--servers/audio/reverb_sw.cpp538
-rw-r--r--servers/audio/reverb_sw.h88
-rw-r--r--servers/audio/voice_rb_sw.h141
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp59
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_rd.h23
-rw-r--r--servers/visual/rasterizer_rd/shader_rd.cpp1
-rw-r--r--servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl51
-rw-r--r--servers/visual/rasterizer_rd/shaders/sky.glsl56
-rw-r--r--servers/visual/shader_types.cpp47
-rw-r--r--servers/visual/visual_server_light_baker.cpp34
-rw-r--r--servers/visual/visual_server_light_baker.h52
191 files changed, 778 insertions, 2176 deletions
diff --git a/README.md b/README.md
index 1202dabc8c..f9855beaf6 100644
--- a/README.md
+++ b/README.md
@@ -71,3 +71,4 @@ for more info.
[![Code Triagers Badge](https://www.codetriage.com/godotengine/godot/badges/users.svg)](https://www.codetriage.com/godotengine/godot)
[![Translate on Weblate](https://hosted.weblate.org/widgets/godot-engine/-/godot/svg-badge.svg)](https://hosted.weblate.org/engage/godot-engine/?utm_source=widget)
[![Total alerts on LGTM](https://img.shields.io/lgtm/alerts/g/godotengine/godot.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/godotengine/godot/alerts)
+[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/godotengine/godot)](https://www.tickgit.com/browse?repo=github.com/godotengine/godot)
diff --git a/SConstruct b/SConstruct
index 4ebc33f593..84400e800d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,6 +1,7 @@
#!/usr/bin/env python
-EnsureSConsVersion(0, 98, 1)
+EnsureSConsVersion(3, 0, 0)
+EnsurePythonVersion(3, 5)
# System
import glob
@@ -13,7 +14,7 @@ import methods
import gles_builders
from platform_methods import run_in_subprocess
-# scan possible build platforms
+# Scan possible build platforms
platform_list = [] # list of platforms
platform_opts = {} # options for each platform
diff --git a/compat.py b/compat.py
deleted file mode 100644
index de99eef9c2..0000000000
--- a/compat.py
+++ /dev/null
@@ -1,68 +0,0 @@
-import sys
-
-if sys.version_info < (3,):
- def isbasestring(s):
- return isinstance(s, basestring)
- def open_utf8(filename, mode):
- return open(filename, mode)
- def byte_to_str(x):
- return str(ord(x))
- import cStringIO
- def StringIO():
- return cStringIO.StringIO()
- def encode_utf8(x):
- return x
- def decode_utf8(x):
- return x
- def iteritems(d):
- return d.iteritems()
- def itervalues(d):
- return d.itervalues()
- def escape_string(s):
- if isinstance(s, unicode):
- s = s.encode('ascii')
- result = ''
- for c in s:
- if not (32 <= ord(c) < 127) or c in ('\\', '"'):
- result += '\\%03o' % ord(c)
- else:
- result += c
- return result
-
-else:
- def isbasestring(s):
- return isinstance(s, (str, bytes))
- def open_utf8(filename, mode):
- return open(filename, mode, encoding="utf-8")
- def byte_to_str(x):
- return str(x)
- import io
- def StringIO():
- return io.StringIO()
- import codecs
- def encode_utf8(x):
- return codecs.utf_8_encode(x)[0]
- def decode_utf8(x):
- return codecs.utf_8_decode(x)[0]
- def iteritems(d):
- return iter(d.items())
- def itervalues(d):
- return iter(d.values())
- def charcode_to_c_escapes(c):
- rev_result = []
- while c >= 256:
- c, low = (c // 256, c % 256)
- rev_result.append('\\%03o' % low)
- rev_result.append('\\%03o' % c)
- return ''.join(reversed(rev_result))
- def escape_string(s):
- result = ''
- if isinstance(s, str):
- s = s.encode('utf-8')
- for c in s:
- if not(32 <= c < 127) or c in (ord('\\'), ord('"')):
- result += charcode_to_c_escapes(c)
- else:
- result += chr(c)
- return result
-
diff --git a/core/color.h b/core/color.h
index a7ab94ab08..16dc721072 100644
--- a/core/color.h
+++ b/core/color.h
@@ -239,4 +239,4 @@ bool Color::operator<(const Color &p_color) const {
return r < p_color.r;
}
-#endif
+#endif // COLOR_H
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 90231546ef..cc08ae7004 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -508,4 +508,4 @@ public:
#undef CMD_SYNC_TYPE
#undef DECL_CMD_SYNC
-#endif
+#endif // COMMAND_QUEUE_MT_H
diff --git a/core/core_builders.py b/core/core_builders.py
index 7720183595..a06b61cb9b 100644
--- a/core/core_builders.py
+++ b/core/core_builders.py
@@ -4,23 +4,41 @@ All such functions are invoked in a subprocess on Windows to prevent build flaki
"""
from platform_methods import subprocess_main
-from compat import iteritems, itervalues, open_utf8, escape_string, byte_to_str
-def make_certs_header(target, source, env):
+def escape_string(s):
+ def charcode_to_c_escapes(c):
+ rev_result = []
+ while c >= 256:
+ c, low = (c // 256, c % 256)
+ rev_result.append('\\%03o' % low)
+ rev_result.append('\\%03o' % c)
+ return ''.join(reversed(rev_result))
+
+ result = ''
+ if isinstance(s, str):
+ s = s.encode('utf-8')
+ for c in s:
+ if not(32 <= c < 127) or c in (ord('\\'), ord('"')):
+ result += charcode_to_c_escapes(c)
+ else:
+ result += chr(c)
+ return result
+
+def make_certs_header(target, source, env):
src = source[0]
dst = target[0]
f = open(src, "rb")
- g = open_utf8(dst, "w")
+ g = open(dst, "w", encoding="utf-8")
buf = f.read()
decomp_size = len(buf)
import zlib
buf = zlib.compress(buf)
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _CERTS_RAW_H\n")
- g.write("#define _CERTS_RAW_H\n")
+ g.write("#ifndef CERTS_COMPRESSED_GEN_H\n")
+ g.write("#define CERTS_COMPRESSED_GEN_H\n")
# System certs path. Editor will use them if defined. (for package maintainers)
path = env['system_certs_path']
@@ -32,9 +50,9 @@ def make_certs_header(target, source, env):
g.write("static const int _certs_uncompressed_size = " + str(decomp_size) + ";\n")
g.write("static const unsigned char _certs_compressed[] = {\n")
for i in range(len(buf)):
- g.write("\t" + byte_to_str(buf[i]) + ",\n")
+ g.write("\t" + str(buf[i]) + ",\n")
g.write("};\n")
- g.write("#endif")
+ g.write("#endif // CERTS_COMPRESSED_GEN_H")
g.close()
f.close()
@@ -46,12 +64,12 @@ def make_authors_header(target, source, env):
src = source[0]
dst = target[0]
- f = open_utf8(src, "r")
- g = open_utf8(dst, "w")
+ f = open(src, "r", encoding="utf-8")
+ g = open(dst, "w", encoding="utf-8")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _EDITOR_AUTHORS_H\n")
- g.write("#define _EDITOR_AUTHORS_H\n")
+ g.write("#ifndef AUTHORS_GEN_H\n")
+ g.write("#define AUTHORS_GEN_H\n")
reading = False
@@ -78,7 +96,7 @@ def make_authors_header(target, source, env):
if reading:
close_section()
- g.write("#endif\n")
+ g.write("#endif // AUTHORS_GEN_H\n")
g.close()
f.close()
@@ -92,12 +110,12 @@ def make_donors_header(target, source, env):
src = source[0]
dst = target[0]
- f = open_utf8(src, "r")
- g = open_utf8(dst, "w")
+ f = open(src, "r", encoding="utf-8")
+ g = open(dst, "w", encoding="utf-8")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _EDITOR_DONORS_H\n")
- g.write("#define _EDITOR_DONORS_H\n")
+ g.write("#ifndef DONORS_GEN_H\n")
+ g.write("#define DONORS_GEN_H\n")
reading = False
@@ -124,7 +142,7 @@ def make_donors_header(target, source, env):
if reading:
close_section()
- g.write("#endif\n")
+ g.write("#endif // DONORS_GEN_H\n")
g.close()
f.close()
@@ -163,7 +181,7 @@ def make_license_header(target, source, env):
projects = OrderedDict()
license_list = []
- with open_utf8(src_copyright, "r") as copyright_file:
+ with open(src_copyright, "r", encoding="utf-8") as copyright_file:
reader = LicenseReader(copyright_file)
part = {}
while reader.current:
@@ -183,21 +201,21 @@ def make_license_header(target, source, env):
reader.next_line()
data_list = []
- for project in itervalues(projects):
+ for project in iter(projects.values()):
for part in project:
part["file_index"] = len(data_list)
data_list += part["Files"]
part["copyright_index"] = len(data_list)
data_list += part["Copyright"]
- with open_utf8(dst, "w") as f:
+ with open(dst, "w", encoding="utf-8") as f:
f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- f.write("#ifndef _EDITOR_LICENSE_H\n")
- f.write("#define _EDITOR_LICENSE_H\n")
+ f.write("#ifndef LICENSE_GEN_H\n")
+ f.write("#define LICENSE_GEN_H\n")
f.write("const char *const GODOT_LICENSE_TEXT =")
- with open_utf8(src_license, "r") as license_file:
+ with open(src_license, "r", encoding="utf-8") as license_file:
for line in license_file:
escaped_string = escape_string(line.strip())
f.write("\n\t\t\"" + escaped_string + "\\n\"")
@@ -225,7 +243,7 @@ def make_license_header(target, source, env):
f.write("const ComponentCopyrightPart COPYRIGHT_PROJECT_PARTS[] = {\n")
part_index = 0
part_indexes = {}
- for project_name, project in iteritems(projects):
+ for project_name, project in iter(projects.items()):
part_indexes[project_name] = part_index
for part in project:
f.write("\t{ \"" + escape_string(part["License"][0]) + "\", "
@@ -239,7 +257,7 @@ def make_license_header(target, source, env):
f.write("const int COPYRIGHT_INFO_COUNT = " + str(len(projects)) + ";\n")
f.write("const ComponentCopyright COPYRIGHT_INFO[] = {\n")
- for project_name, project in iteritems(projects):
+ for project_name, project in iter(projects.items()):
f.write("\t{ \"" + escape_string(project_name) + "\", "
+ "&COPYRIGHT_PROJECT_PARTS[" + str(part_indexes[project_name]) + "], "
+ str(len(project)) + " },\n")
@@ -262,7 +280,7 @@ def make_license_header(target, source, env):
f.write("\t\"\",\n\n")
f.write("};\n\n")
- f.write("#endif\n")
+ f.write("#endif // LICENSE_GEN_H\n")
if __name__ == '__main__':
diff --git a/core/core_string_names.h b/core/core_string_names.h
index 42416d3f75..dce0244631 100644
--- a/core/core_string_names.h
+++ b/core/core_string_names.h
@@ -97,4 +97,4 @@ public:
StringName notification;
};
-#endif // SCENE_STRING_NAMES_H
+#endif // CORE_STRING_NAMES_H
diff --git a/core/cowdata.h b/core/cowdata.h
index fba3f64899..5de78be6d7 100644
--- a/core/cowdata.h
+++ b/core/cowdata.h
@@ -28,15 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef COWDATA_H_
-#define COWDATA_H_
-
-#include <string.h>
+#ifndef COWDATA_H
+#define COWDATA_H
#include "core/error_macros.h"
#include "core/os/memory.h"
#include "core/safe_refcount.h"
+#include <string.h>
+
template <class T>
class Vector;
class String;
@@ -371,4 +371,4 @@ CowData<T>::~CowData() {
_unref(_ptr);
}
-#endif /* COW_H_ */
+#endif // COWDATA_H
diff --git a/core/debugger/script_debugger.h b/core/debugger/script_debugger.h
index 2273073bf4..a60b57c637 100644
--- a/core/debugger/script_debugger.h
+++ b/core/debugger/script_debugger.h
@@ -77,4 +77,4 @@ public:
ScriptDebugger() {}
};
-#endif
+#endif // SCRIPT_DEBUGGER_H
diff --git a/core/error_list.h b/core/error_list.h
index b464a93341..a0218cf045 100644
--- a/core/error_list.h
+++ b/core/error_list.h
@@ -90,4 +90,4 @@ enum Error {
ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
};
-#endif
+#endif // ERROR_LIST_H
diff --git a/core/error_macros.h b/core/error_macros.h
index 8818dcbe77..18c46c9e7d 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -623,4 +623,4 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
} else \
((void)0)
-#endif
+#endif // ERROR_MACROS_H
diff --git a/core/hash_map.h b/core/hash_map.h
index c9d3a690e7..e40b00a67a 100644
--- a/core/hash_map.h
+++ b/core/hash_map.h
@@ -599,4 +599,4 @@ public:
}
};
-#endif
+#endif // HASH_MAP_H
diff --git a/core/hashfuncs.h b/core/hashfuncs.h
index d6cf04e560..219b8b2658 100644
--- a/core/hashfuncs.h
+++ b/core/hashfuncs.h
@@ -38,6 +38,7 @@
#include "core/string_name.h"
#include "core/typedefs.h"
#include "core/ustring.h"
+
/**
* Hashing functions
*/
@@ -171,4 +172,4 @@ struct HashMapComparatorDefault {
}
};
-#endif
+#endif // HASHFUNCS_H
diff --git a/core/image.h b/core/image.h
index 4dc4bf1328..9453f41334 100644
--- a/core/image.h
+++ b/core/image.h
@@ -396,4 +396,4 @@ VARIANT_ENUM_CAST(Image::UsedChannels)
VARIANT_ENUM_CAST(Image::AlphaMode)
VARIANT_ENUM_CAST(Image::RoughnessChannel)
-#endif
+#endif // IMAGE_H
diff --git a/core/int_types.h b/core/int_types.h
index e7de053766..71caa2202d 100644
--- a/core/int_types.h
+++ b/core/int_types.h
@@ -28,6 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef INT_TYPES_H
+#define INT_TYPES_H
+
#ifdef _MSC_VER
typedef signed __int8 int8_t;
@@ -54,4 +57,6 @@ typedef unsigned long long uint64_t;
#include <stdint.h>
#endif
-#endif
+#endif // _MSC_VER
+
+#endif // INT_TYPES_H
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index 3ba028b99c..29352e9cd4 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -79,4 +79,4 @@ public:
virtual String get_resource_type(const String &p_path) const;
};
-#endif
+#endif // IMAGE_LOADER_H
diff --git a/core/io/logger.h b/core/io/logger.h
index ab2f9d8bc7..7028551185 100644
--- a/core/io/logger.h
+++ b/core/io/logger.h
@@ -107,4 +107,4 @@ public:
virtual ~CompositeLogger();
};
-#endif
+#endif // LOGGER_H
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index 484f0755de..7d95bc4f86 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -202,4 +202,4 @@ public:
Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = NULL, bool p_allow_objects = false);
Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false);
-#endif
+#endif // MARSHALLS_H
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index 52f918aefa..4eb4a53e99 100644
--- a/core/io/multiplayer_api.h
+++ b/core/io/multiplayer_api.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef MULTIPLAYER_PROTOCOL_H
-#define MULTIPLAYER_PROTOCOL_H
+#ifndef MULTIPLAYER_API_H
+#define MULTIPLAYER_API_H
#include "core/io/networked_multiplayer_peer.h"
#include "core/reference.h"
@@ -148,4 +148,4 @@ public:
VARIANT_ENUM_CAST(MultiplayerAPI::RPCMode);
-#endif // MULTIPLAYER_PROTOCOL_H
+#endif // MULTIPLAYER_API_H
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index bffd544589..c1f1924051 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/core/io/networked_multiplayer_peer.h
@@ -80,4 +80,4 @@ public:
VARIANT_ENUM_CAST(NetworkedMultiplayerPeer::TransferMode)
VARIANT_ENUM_CAST(NetworkedMultiplayerPeer::ConnectionStatus)
-#endif // NetworkedMultiplayerPeer_H
+#endif // NETWORKED_MULTIPLAYER_PEER_H
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index 5ba9e26858..a97b72e7df 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -200,4 +200,4 @@ public:
static void finalize();
};
-#endif
+#endif // RESOURCE_LOADER_H
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index e749f54cfa..2ddebf0581 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -90,4 +90,4 @@ public:
static void remove_custom_savers();
};
-#endif
+#endif // RESOURCE_SAVER_H
diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h
index 327aa3cc3b..86df9ab8cf 100644
--- a/core/io/stream_peer_tcp.h
+++ b/core/io/stream_peer_tcp.h
@@ -93,4 +93,4 @@ public:
VARIANT_ENUM_CAST(StreamPeerTCP::Status);
-#endif
+#endif // STREAM_PEER_TCP_H
diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h
index 47e276da28..26c3e6802f 100644
--- a/core/io/xml_parser.h
+++ b/core/io/xml_parser.h
@@ -121,4 +121,4 @@ public:
~XMLParser();
};
-#endif
+#endif // XML_PARSER_H
diff --git a/core/list.h b/core/list.h
index 5a7c9e572c..d441c0230d 100644
--- a/core/list.h
+++ b/core/list.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GLOBALS_LIST_H
-#define GLOBALS_LIST_H
+#ifndef LIST_H
+#define LIST_H
#include "core/error_macros.h"
#include "core/os/memory.h"
@@ -708,4 +708,4 @@ public:
};
};
-#endif
+#endif // LIST_H
diff --git a/core/map.h b/core/map.h
index b97f735f1b..010c47b0fb 100644
--- a/core/map.h
+++ b/core/map.h
@@ -682,4 +682,4 @@ public:
}
};
-#endif
+#endif // MAP_H
diff --git a/core/math/a_star.h b/core/math/a_star.h
index cc6c4619e9..8c10ace33c 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef ASTAR_H
-#define ASTAR_H
+#ifndef A_STAR_H
+#define A_STAR_H
#include "core/oa_hash_map.h"
#include "core/reference.h"
@@ -210,4 +210,4 @@ public:
~AStar2D();
};
-#endif // ASTAR_H
+#endif // A_STAR_H
diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h
index 6477d029d5..e1dbb385e4 100644
--- a/core/math/audio_frame.h
+++ b/core/math/audio_frame.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef AUDIOFRAME_H
-#define AUDIOFRAME_H
+#ifndef AUDIO_FRAME_H
+#define AUDIO_FRAME_H
#include "core/math/vector2.h"
#include "core/typedefs.h"
@@ -140,4 +140,4 @@ struct AudioFrame {
_ALWAYS_INLINE_ AudioFrame() {}
};
-#endif
+#endif // AUDIO_FRAME_H
diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h
index 60f7d15974..c10193bc84 100644
--- a/core/math/camera_matrix.h
+++ b/core/math/camera_matrix.h
@@ -124,4 +124,4 @@ Vector3 CameraMatrix::xform(const Vector3 &p_vec3) const {
return ret / w;
}
-#endif
+#endif // CAMERA_MATRIX_H
diff --git a/core/math/disjoint_set.h b/core/math/disjoint_set.h
index fb89941ce4..32b9875e4c 100644
--- a/core/math/disjoint_set.h
+++ b/core/math/disjoint_set.h
@@ -152,4 +152,4 @@ void DisjointSet<T, C, AL>::get_members(Vector<T> &out_members, T representative
}
}
-#endif
+#endif // DISJOINT_SET_H
diff --git a/core/math/geometry.h b/core/math/geometry.h
index 6453d16181..becbcdbf0f 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -1019,4 +1019,4 @@ private:
static Vector<Vector<Point2>> _polypath_offset(const Vector<Point2> &p_polypath, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type);
};
-#endif
+#endif // GEOMETRY_H
diff --git a/core/math/octree.h b/core/math/octree.h
index 5478bdaf77..b47c052b68 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -1375,4 +1375,4 @@ Octree<T, use_pairs, AL>::Octree(real_t p_unit_size) {
unpair_callback_userdata = NULL;
}
-#endif
+#endif // OCTREE_H
diff --git a/core/math/quat.h b/core/math/quat.h
index 11ae03dffb..b3135ad1ca 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -231,4 +231,4 @@ bool Quat::operator!=(const Quat &p_quat) const {
return x != p_quat.x || y != p_quat.y || z != p_quat.z || w != p_quat.w;
}
-#endif
+#endif // QUAT_H
diff --git a/core/math/triangulate.h b/core/math/triangulate.h
index f9bcb37141..c453b77ecf 100644
--- a/core/math/triangulate.h
+++ b/core/math/triangulate.h
@@ -58,4 +58,4 @@ private:
static bool snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V, bool relaxed);
};
-#endif
+#endif // TRIANGULATE_H
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index 37207483fe..26f5b23416 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -343,14 +343,14 @@ bool MessageQueue::is_flushing() const {
MessageQueue::MessageQueue() {
- ERR_FAIL_COND_MSG(singleton != NULL, "MessageQueue singleton already exist.");
+ ERR_FAIL_COND_MSG(singleton != NULL, "A MessageQueue singleton already exists.");
singleton = this;
flushing = false;
buffer_end = 0;
buffer_max_used = 0;
buffer_size = GLOBAL_DEF_RST("memory/limits/message_queue/max_size_kb", DEFAULT_QUEUE_SIZE_KB);
- ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/message_queue/max_size_kb", PropertyInfo(Variant::INT, "memory/limits/message_queue/max_size_kb", PROPERTY_HINT_RANGE, "0,2048,1,or_greater"));
+ ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/message_queue/max_size_kb", PropertyInfo(Variant::INT, "memory/limits/message_queue/max_size_kb", PROPERTY_HINT_RANGE, "1024,4096,1,or_greater"));
buffer_size *= 1024;
buffer = memnew_arr(uint8_t, buffer_size);
}
diff --git a/core/method_bind.h b/core/method_bind.h
index 726ce512f8..a1ab4e58fc 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -405,4 +405,4 @@ class __UnexistingClass;
#include "method_bind.gen.inc"
-#endif
+#endif // METHOD_BIND_H
diff --git a/core/node_path.h b/core/node_path.h
index 05b6d844ff..76de36cd9f 100644
--- a/core/node_path.h
+++ b/core/node_path.h
@@ -97,4 +97,4 @@ public:
~NodePath();
};
-#endif
+#endif // NODE_PATH_H
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
index 7ceba26be8..447b0db0eb 100644
--- a/core/oa_hash_map.h
+++ b/core/oa_hash_map.h
@@ -369,4 +369,4 @@ public:
}
};
-#endif
+#endif // OA_HASH_MAP_H
diff --git a/core/object.cpp b/core/object.cpp
index 140ee811fe..188c0ee5c2 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1324,6 +1324,25 @@ Array Object::_get_incoming_connections() const {
return ret;
}
+bool Object::has_signal(const StringName &p_name) const {
+ if (!script.is_null()) {
+ Ref<Script> scr = script;
+ if (scr.is_valid() && scr->has_script_signal(p_name)) {
+ return true;
+ }
+ }
+
+ if (ClassDB::has_signal(get_class_name(), p_name)) {
+ return true;
+ }
+
+ if (_has_user_signal(p_name)) {
+ return true;
+ }
+
+ return false;
+}
+
void Object::get_signal_list(List<MethodInfo> *p_signals) const {
if (!script.is_null()) {
@@ -1696,6 +1715,7 @@ void Object::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_method", "method"), &Object::has_method);
+ ClassDB::bind_method(D_METHOD("has_signal", "signal"), &Object::has_signal);
ClassDB::bind_method(D_METHOD("get_signal_list"), &Object::_get_signal_list);
ClassDB::bind_method(D_METHOD("get_signal_connection_list", "signal"), &Object::_get_signal_connection_list);
ClassDB::bind_method(D_METHOD("get_incoming_connections"), &Object::_get_incoming_connections);
diff --git a/core/object.h b/core/object.h
index 59d3f06cfe..0826686fb3 100644
--- a/core/object.h
+++ b/core/object.h
@@ -694,6 +694,7 @@ public:
void add_user_signal(const MethodInfo &p_signal);
Error emit_signal(const StringName &p_name, VARIANT_ARG_LIST);
Error emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount);
+ bool has_signal(const StringName &p_name) const;
void get_signal_list(List<MethodInfo> *p_signals) const;
void get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const;
void get_all_signal_connections(List<Connection> *p_connections) const;
@@ -816,4 +817,4 @@ public:
//needed by macros
#include "core/class_db.h"
-#endif
+#endif // OBJECT_H
diff --git a/core/os/copymem.h b/core/os/copymem.h
index 1d6631ddb8..04ea3caeff 100644
--- a/core/os/copymem.h
+++ b/core/os/copymem.h
@@ -47,4 +47,4 @@
#endif
-#endif
+#endif // COPYMEM_H
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index aac6c67f0a..059f7aad2f 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -149,4 +149,4 @@ struct DirAccessRef {
}
};
-#endif
+#endif // DIR_ACCESS_H
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 36a947c691..4a82637ecc 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -196,4 +196,4 @@ struct FileAccessRef {
}
};
-#endif
+#endif // FILE_ACCESS_H
diff --git a/core/os/input_event.h b/core/os/input_event.h
index c105fcd1c1..21549d811f 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -622,4 +622,4 @@ public:
InputEventMIDI();
};
-#endif
+#endif // INPUT_EVENT_H
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index bac32e01dd..5d11e6a378 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -325,4 +325,4 @@ int keycode_get_count();
int keycode_get_value_by_index(int p_index);
const char *keycode_get_name_by_index(int p_index);
-#endif
+#endif // KEYBOARD_H
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index b1120aee8a..3fdfb77af2 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -81,4 +81,4 @@ public:
virtual ~MainLoop();
};
-#endif
+#endif // MAIN_LOOP_H
diff --git a/core/os/memory.h b/core/os/memory.h
index 207149b57e..dcaedd92ba 100644
--- a/core/os/memory.h
+++ b/core/os/memory.h
@@ -206,4 +206,4 @@ struct _GlobalNilClass {
static _GlobalNil _nil;
};
-#endif
+#endif // MEMORY_H
diff --git a/core/os/midi_driver.h b/core/os/midi_driver.h
index 4f53feb43e..b7377a8a40 100644
--- a/core/os/midi_driver.h
+++ b/core/os/midi_driver.h
@@ -58,4 +58,4 @@ public:
virtual ~MIDIDriver() {}
};
-#endif
+#endif // MIDI_DRIVER_H
diff --git a/core/os/mutex.h b/core/os/mutex.h
index b44b1994de..526549dd93 100644
--- a/core/os/mutex.h
+++ b/core/os/mutex.h
@@ -105,4 +105,4 @@ using BinaryMutex = MutexImpl<FakeMutex>; // Non-recursive, handle with care
#endif // !NO_THREADS
-#endif
+#endif // MUTEX_H
diff --git a/core/os/os.h b/core/os/os.h
index 1d3619b1e6..3e2ee7affd 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -527,4 +527,4 @@ public:
virtual ~OS();
};
-#endif
+#endif // OS_H
diff --git a/core/os/rw_lock.h b/core/os/rw_lock.h
index 21648b6cbc..64dfbef20c 100644
--- a/core/os/rw_lock.h
+++ b/core/os/rw_lock.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef RWLOCK_H
-#define RWLOCK_H
+#ifndef RW_LOCK_H
+#define RW_LOCK_H
#include "core/error_list.h"
@@ -79,4 +79,4 @@ public:
}
};
-#endif // RWLOCK_H
+#endif // RW_LOCK_H
diff --git a/core/os/semaphore.h b/core/os/semaphore.h
index 6f194d4887..3d9d1ab984 100644
--- a/core/os/semaphore.h
+++ b/core/os/semaphore.h
@@ -80,4 +80,4 @@ public:
#endif
-#endif
+#endif // SEMAPHORE_H
diff --git a/core/os/thread.h b/core/os/thread.h
index 0803fd1190..76d296bcf7 100644
--- a/core/os/thread.h
+++ b/core/os/thread.h
@@ -77,4 +77,4 @@ public:
virtual ~Thread();
};
-#endif
+#endif // THREAD_H
diff --git a/core/os/thread_dummy.h b/core/os/thread_dummy.h
index da8188f983..066ee498ac 100644
--- a/core/os/thread_dummy.h
+++ b/core/os/thread_dummy.h
@@ -61,4 +61,4 @@ public:
static void make_default();
};
-#endif
+#endif // THREAD_DUMMY_H
diff --git a/core/os/thread_safe.h b/core/os/thread_safe.h
index 0221edf491..670ee8b125 100644
--- a/core/os/thread_safe.h
+++ b/core/os/thread_safe.h
@@ -38,4 +38,4 @@
#define _THREAD_SAFE_LOCK_ _thread_safe_.lock();
#define _THREAD_SAFE_UNLOCK_ _thread_safe_.unlock();
-#endif
+#endif // THREAD_SAFE_H
diff --git a/core/pool_allocator.h b/core/pool_allocator.h
index e34f5b1104..8c1710ebe0 100644
--- a/core/pool_allocator.h
+++ b/core/pool_allocator.h
@@ -148,4 +148,4 @@ public:
virtual ~PoolAllocator();
};
-#endif
+#endif // POOL_ALLOCATOR_H
diff --git a/core/print_string.h b/core/print_string.h
index c2cf1c293b..d83cc35dd6 100644
--- a/core/print_string.h
+++ b/core/print_string.h
@@ -60,4 +60,4 @@ extern void print_line(String p_string);
extern void print_error(String p_string);
extern void print_verbose(String p_string);
-#endif
+#endif // PRINT_STRING_H
diff --git a/core/project_settings.h b/core/project_settings.h
index 8695df560e..7b3ca18c62 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GLOBAL_CONFIG_H
-#define GLOBAL_CONFIG_H
+#ifndef PROJECT_SETTINGS_H
+#define PROJECT_SETTINGS_H
#include "core/object.h"
#include "core/os/thread_safe.h"
@@ -166,4 +166,4 @@ Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restar
#define GLOBAL_DEF_RST(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true)
#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get(m_var)
-#endif
+#endif // PROJECT_SETTINGS_H
diff --git a/core/register_core_types.h b/core/register_core_types.h
index 22c0025f0c..bdd335f33c 100644
--- a/core/register_core_types.h
+++ b/core/register_core_types.h
@@ -36,4 +36,4 @@ void register_core_settings();
void register_core_singletons();
void unregister_core_types();
-#endif
+#endif // REGISTER_CORE_TYPES_H
diff --git a/core/resource.h b/core/resource.h
index 4b79a39d9d..9f83848c04 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -167,4 +167,4 @@ public:
static int get_cached_resource_count();
};
-#endif
+#endif // RESOURCE_H
diff --git a/core/rid.h b/core/rid.h
index 0c4a96efed..3cc0ee3084 100644
--- a/core/rid.h
+++ b/core/rid.h
@@ -75,4 +75,4 @@ public:
}
};
-#endif
+#endif // RID_H
diff --git a/core/ring_buffer.h b/core/ring_buffer.h
index f5f43607fe..620a3a3846 100644
--- a/core/ring_buffer.h
+++ b/core/ring_buffer.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef RINGBUFFER_H
-#define RINGBUFFER_H
+#ifndef RING_BUFFER_H
+#define RING_BUFFER_H
#include "core/vector.h"
@@ -221,4 +221,4 @@ public:
~RingBuffer<T>(){};
};
-#endif
+#endif // RING_BUFFER_H
diff --git a/core/safe_refcount.h b/core/safe_refcount.h
index 887282f556..953a877397 100644
--- a/core/safe_refcount.h
+++ b/core/safe_refcount.h
@@ -208,4 +208,4 @@ public:
}
};
-#endif
+#endif // SAFE_REFCOUNT_H
diff --git a/core/script_language.h b/core/script_language.h
index bb7d74dd83..6219a423d0 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -459,4 +459,5 @@ public:
PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script, Object *p_owner);
~PlaceHolderScriptInstance();
};
-#endif
+
+#endif // SCRIPT_LANGUAGE_H
diff --git a/core/set.h b/core/set.h
index aee3f4bc7a..5ddfb87b74 100644
--- a/core/set.h
+++ b/core/set.h
@@ -634,4 +634,4 @@ public:
}
};
-#endif
+#endif // SET_H
diff --git a/core/simple_type.h b/core/simple_type.h
index f637504db8..da031854c6 100644
--- a/core/simple_type.h
+++ b/core/simple_type.h
@@ -51,4 +51,4 @@ struct GetSimpleTypeT<T const> {
typedef T type_t;
};
-#endif
+#endif // SIMPLE_TYPE_H
diff --git a/core/string_buffer.h b/core/string_buffer.h
index d80a975c7f..a140f0abf7 100644
--- a/core/string_buffer.h
+++ b/core/string_buffer.h
@@ -163,4 +163,4 @@ int64_t StringBuffer<SHORT_BUFFER_SIZE>::as_int() {
return String::to_int(current_buffer_ptr());
}
-#endif
+#endif // STRING_BUFFER_H
diff --git a/core/type_info.h b/core/type_info.h
index 3b08ff3cae..7e4b192b27 100644
--- a/core/type_info.h
+++ b/core/type_info.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GET_TYPE_INFO_H
-#define GET_TYPE_INFO_H
+#ifndef TYPE_INFO_H
+#define TYPE_INFO_H
#ifdef DEBUG_METHODS_ENABLED
@@ -273,4 +273,4 @@ inline StringName __constant_get_enum_name(T param, const String &p_constant) {
#endif // DEBUG_METHODS_ENABLED
-#endif // GET_TYPE_INFO_H
+#endif // TYPE_INFO_H
diff --git a/core/ucaps.h b/core/ucaps.h
index 013f264d2f..ad71731617 100644
--- a/core/ucaps.h
+++ b/core/ucaps.h
@@ -1413,4 +1413,5 @@ static int _find_lower(int ch) {
return ch;
}
-#endif
+
+#endif // UCAPS_H
diff --git a/core/variant.h b/core/variant.h
index 614d39e84a..d38130e3a3 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -516,4 +516,5 @@ const Variant::ObjData &Variant::_get_obj() const {
}
String vformat(const String &p_text, const Variant &p1 = Variant(), const Variant &p2 = Variant(), const Variant &p3 = Variant(), const Variant &p4 = Variant(), const Variant &p5 = Variant());
-#endif
+
+#endif // VARIANT_H
diff --git a/core/vector.h b/core/vector.h
index 51a73e4ae4..7277179621 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -181,4 +181,4 @@ bool Vector<T>::push_back(T p_elem) {
return false;
}
-#endif
+#endif // VECTOR_H
diff --git a/core/version.h b/core/version.h
index 42c85c1b13..1198f62db4 100644
--- a/core/version.h
+++ b/core/version.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GODOT_VERSION_H
-#define GODOT_VERSION_H
+#ifndef VERSION_H
+#define VERSION_H
#include "core/version_generated.gen.h"
@@ -68,4 +68,4 @@
// Example: "Godot v3.1.4.stable.official.mono"
#define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_FULL_BUILD
-#endif // GODOT_VERSION_H
+#endif // VERSION_H
diff --git a/doc/Makefile b/doc/Makefile
index 7f3f7ea939..9534da9bd5 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -13,13 +13,6 @@ doxygen:
mkdir -p $(OUTPUTDIR)/doxygen
doxygen Doxyfile
-markdown:
- rm -rf $(OUTPUTDIR)/markdown
- mkdir -p $(OUTPUTDIR)/markdown
- pushd $(OUTPUTDIR)/markdown
- python2 $(TOOLSDIR)/makemd.py $(CLASSES)
- popd
-
rst:
rm -rf $(OUTPUTDIR)/rst
mkdir -p $(OUTPUTDIR)/rst
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index a3faccae1a..33f5fc0f35 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -311,13 +311,22 @@
Returns [code]true[/code] if the object contains the given [code]method[/code].
</description>
</method>
+ <method name="has_signal" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="signal" type="String">
+ </argument>
+ <description>
+ Returns [code]true[/code] if the given [code]signal[/code] exists.
+ </description>
+ </method>
<method name="has_user_signal" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="signal" type="StringName">
</argument>
<description>
- Returns [code]true[/code] if the given user-defined [code]signal[/code] exists.
+ Returns [code]true[/code] if the given user-defined [code]signal[/code] exists. Only signals added using [method add_user_signal] are taken into account.
</description>
</method>
<method name="is_blocking_signals" qualifiers="const">
diff --git a/drivers/alsa/audio_driver_alsa.h b/drivers/alsa/audio_driver_alsa.h
index a8caf0fbae..50bd9e853d 100644
--- a/drivers/alsa/audio_driver_alsa.h
+++ b/drivers/alsa/audio_driver_alsa.h
@@ -28,12 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "servers/audio_server.h"
-
#ifdef ALSA_ENABLED
+#ifndef AUDIO_DRIVER_ALSA_H
+#define AUDIO_DRIVER_ALSA_H
+
#include "core/os/mutex.h"
#include "core/os/thread.h"
+#include "servers/audio_server.h"
#include <alsa/asoundlib.h>
@@ -87,4 +89,6 @@ public:
~AudioDriverALSA();
};
-#endif
+#endif // AUDIO_DRIVER_ALSA_H
+
+#endif // ALSA_ENABLED
diff --git a/editor/SCsub b/editor/SCsub
index e54383350e..61562d70d3 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -7,13 +7,12 @@ env.editor_sources = []
import os
import os.path
from platform_methods import run_in_subprocess
-from compat import open_utf8
import editor_builders
def _make_doc_data_class_path(to_path):
# NOTE: It is safe to generate this file here, since this is still executed serially
- g = open_utf8(os.path.join(to_path, "doc_data_class_path.gen.h"), "w")
+ g = open(os.path.join(to_path, "doc_data_class_path.gen.h"), "w", encoding="utf-8")
g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n")
g.write("struct _DocDataClassPath { const char* name; const char* path; };\n")
@@ -37,7 +36,7 @@ if env['tools']:
reg_exporters += '}\n'
# NOTE: It is safe to generate this file here, since this is still executed serially
- with open_utf8("register_exporters.gen.cpp", "w") as f:
+ with open("register_exporters.gen.cpp", "w", encoding="utf-8") as f:
f.write(reg_exporters_inc)
f.write(reg_exporters)
@@ -56,7 +55,7 @@ if env['tools']:
except OSError:
pass
- _make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor/doc"))
+ _make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor"))
docs = sorted(docs)
env.Depends("#editor/doc_data_compressed.gen.h", docs)
@@ -85,8 +84,6 @@ if env['tools']:
env.add_source_files(env.editor_sources, "*.cpp")
- SConscript('collada/SCsub')
- SConscript('doc/SCsub')
SConscript('debugger/SCsub')
SConscript('fileserver/SCsub')
SConscript('icons/SCsub')
diff --git a/editor/collada/SCsub b/editor/collada/SCsub
deleted file mode 100644
index 2b1e889fb0..0000000000
--- a/editor/collada/SCsub
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/doc/SCsub b/editor/doc/SCsub
deleted file mode 100644
index 2b1e889fb0..0000000000
--- a/editor/doc/SCsub
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp
deleted file mode 100644
index b0a89ff4b8..0000000000
--- a/editor/doc/doc_dump.cpp
+++ /dev/null
@@ -1,308 +0,0 @@
-/*************************************************************************/
-/* doc_dump.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "doc_dump.h"
-
-#include "core/os/file_access.h"
-#include "core/version.h"
-#include "scene/main/node.h"
-
-static void _write_string(FileAccess *f, int p_tablevel, const String &p_string) {
-
- String tab;
- for (int i = 0; i < p_tablevel; i++)
- tab += "\t";
- f->store_string(tab + p_string + "\n");
-}
-
-struct _ConstantSort {
-
- String name;
- int value;
- bool operator<(const _ConstantSort &p_c) const {
-
- String left_a = name.find("_") == -1 ? name : name.substr(0, name.find("_"));
- String left_b = p_c.name.find("_") == -1 ? p_c.name : p_c.name.substr(0, p_c.name.find("_"));
- if (left_a == left_b)
- return value < p_c.value;
- else
- return left_a < left_b;
- }
-};
-
-static String _escape_string(const String &p_str) {
-
- String ret = p_str;
- ret = ret.replace("&", "&amp;");
- ret = ret.replace("<", "&gt;");
- ret = ret.replace(">", "&lt;");
- ret = ret.replace("'", "&apos;");
- ret = ret.replace("\"", "&quot;");
- for (char i = 1; i < 32; i++) {
-
- char chr[2] = { i, 0 };
- ret = ret.replace(chr, "&#" + String::num(i) + ";");
- }
- ret = ret.utf8();
- return ret;
-}
-void DocDump::dump(const String &p_file) {
-
- List<StringName> class_list;
- ClassDB::get_class_list(&class_list);
-
- class_list.sort_custom<StringName::AlphCompare>();
-
- FileAccess *f = FileAccess::open(p_file, FileAccess::WRITE);
-
- _write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
- _write_string(f, 0, String("<doc version=\"") + VERSION_BRANCH + "\" name=\"Engine Types\">");
-
- while (class_list.size()) {
-
- String name = class_list.front()->get();
-
- String header = "<class name=\"" + name + "\"";
- String inherits = ClassDB::get_parent_class(name);
- if (inherits != "")
- header += " inherits=\"" + inherits + "\"";
- _write_string(f, 0, header);
-
- _write_string(f, 1, "<brief_description>");
- _write_string(f, 1, "</brief_description>");
-
- _write_string(f, 1, "<description>");
- _write_string(f, 1, "</description>");
-
- _write_string(f, 1, "<methods>");
-
- List<MethodInfo> method_list;
- ClassDB::get_method_list(name, &method_list, true);
- method_list.sort();
-
- for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
- if (E->get().name == "" || E->get().name[0] == '_')
- continue; //hidden
-
- MethodBind *m = ClassDB::get_method(name, E->get().name);
-
- String qualifiers;
- if (E->get().flags & METHOD_FLAG_CONST)
- qualifiers += "qualifiers=\"const\"";
-
- _write_string(f, 2, "<method name=\"" + _escape_string(E->get().name) + "\" " + qualifiers + " >");
-
- for (int i = -1; i < E->get().arguments.size(); i++) {
-
- PropertyInfo arginfo;
-
- if (i == -1) {
-
- arginfo = E->get().return_val;
- String type_name = (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) ? arginfo.hint_string : Variant::get_type_name(arginfo.type);
-
- if (arginfo.type == Variant::NIL)
- continue;
- _write_string(f, 3, "<return type=\"" + type_name + "\">");
- } else {
-
- arginfo = E->get().arguments[i];
-
- String type_name;
-
- if (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE)
- type_name = arginfo.hint_string;
- else if (arginfo.type == Variant::NIL)
- type_name = "Variant";
- else
- type_name = Variant::get_type_name(arginfo.type);
-
- if (m && m->has_default_argument(i)) {
- Variant default_arg = m->get_default_argument(i);
- String default_arg_text = String(_escape_string(m->get_default_argument(i)));
-
- switch (default_arg.get_type()) {
-
- case Variant::NIL:
- default_arg_text = "NULL";
- break;
- // atomic types
- case Variant::BOOL:
- if (bool(default_arg))
- default_arg_text = "true";
- else
- default_arg_text = "false";
- break;
- case Variant::INT:
- case Variant::FLOAT:
- //keep it
- break;
- case Variant::STRING:
- case Variant::STRING_NAME:
- default_arg_text = "@\"" + default_arg_text + "\"";
- break;
- case Variant::NODE_PATH:
- default_arg_text = "\"" + default_arg_text + "\"";
- break;
- case Variant::TRANSFORM:
- if (default_arg.operator Transform() == Transform()) {
- default_arg_text = "";
- }
-
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
- break;
-
- case Variant::VECTOR2:
- case Variant::RECT2:
- case Variant::VECTOR3:
- case Variant::PLANE:
- case Variant::QUAT:
- case Variant::AABB:
- case Variant::BASIS:
- case Variant::COLOR:
- case Variant::PACKED_BYTE_ARRAY:
- case Variant::PACKED_INT32_ARRAY:
- case Variant::PACKED_FLOAT32_ARRAY:
- case Variant::PACKED_INT64_ARRAY:
- case Variant::PACKED_FLOAT64_ARRAY:
- case Variant::PACKED_STRING_ARRAY:
- case Variant::PACKED_VECTOR3_ARRAY:
- case Variant::PACKED_COLOR_ARRAY:
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
- break;
- case Variant::OBJECT:
- case Variant::DICTIONARY:
- case Variant::ARRAY:
- case Variant::_RID:
-
- default: {
- }
- }
-
- _write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + _escape_string(arginfo.name) + "\" type=\"" + type_name + "\" default=\"" + _escape_string(default_arg_text) + "\">");
- } else
- _write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + arginfo.name + "\" type=\"" + type_name + "\">");
- }
-
- String hint;
- switch (arginfo.hint) {
- case PROPERTY_HINT_DIR: hint = "A directory."; break;
- case PROPERTY_HINT_RANGE: hint = "Range - min: " + arginfo.hint_string.get_slice(",", 0) + " max: " + arginfo.hint_string.get_slice(",", 1) + " step: " + arginfo.hint_string.get_slice(",", 2); break;
- case PROPERTY_HINT_ENUM:
- hint = "Values: ";
- for (int j = 0; j < arginfo.hint_string.get_slice_count(","); j++) {
- if (j > 0) hint += ", ";
- hint += arginfo.hint_string.get_slice(",", j) + "=" + itos(j);
- }
- break;
- case PROPERTY_HINT_LENGTH: hint = "Length: " + arginfo.hint_string; break;
- case PROPERTY_HINT_FLAGS:
- hint = "Values: ";
- for (int j = 0; j < arginfo.hint_string.get_slice_count(","); j++) {
- if (j > 0) hint += ", ";
- hint += arginfo.hint_string.get_slice(",", j) + "=" + itos((uint64_t)1 << j);
- }
- break;
- case PROPERTY_HINT_FILE: hint = "A file:"; break;
- default: {
- }
- //case PROPERTY_HINT_RESOURCE_TYPE: hint="Type: "+arginfo.hint_string; break;
- };
- if (hint != "")
- _write_string(f, 4, hint);
-
- _write_string(f, 3, (i == -1) ? "</return>" : "</argument>");
- }
-
- _write_string(f, 3, "<description>");
- _write_string(f, 3, "</description>");
-
- _write_string(f, 2, "</method>");
- }
-
- _write_string(f, 1, "</methods>");
-
- List<MethodInfo> signal_list;
- ClassDB::get_signal_list(name, &signal_list, true);
-
- if (signal_list.size()) {
-
- _write_string(f, 1, "<signals>");
- for (List<MethodInfo>::Element *EV = signal_list.front(); EV; EV = EV->next()) {
-
- _write_string(f, 2, "<signal name=\"" + EV->get().name + "\">");
- for (int i = 0; i < EV->get().arguments.size(); i++) {
- PropertyInfo arginfo = EV->get().arguments[i];
- _write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + arginfo.name + "\" type=\"" + Variant::get_type_name(arginfo.type) + "\">");
- _write_string(f, 3, "</argument>");
- }
- _write_string(f, 3, "<description>");
- _write_string(f, 3, "</description>");
-
- _write_string(f, 2, "</signal>");
- }
-
- _write_string(f, 1, "</signals>");
- }
-
- _write_string(f, 1, "<constants>");
-
- List<String> constant_list;
- ClassDB::get_integer_constant_list(name, &constant_list, true);
-
- /* constants are sorted in a special way */
-
- List<_ConstantSort> constant_sort;
-
- for (List<String>::Element *E = constant_list.front(); E; E = E->next()) {
- _ConstantSort cs;
- cs.name = E->get();
- cs.value = ClassDB::get_integer_constant(name, E->get());
- constant_sort.push_back(cs);
- }
-
- constant_sort.sort();
-
- for (List<_ConstantSort>::Element *E = constant_sort.front(); E; E = E->next()) {
-
- _write_string(f, 2, "<constant name=\"" + E->get().name + "\" value=\"" + itos(E->get().value) + "\">");
- _write_string(f, 2, "</constant>");
- }
-
- _write_string(f, 1, "</constants>");
- _write_string(f, 0, "</class>");
-
- class_list.erase(name);
- }
-
- _write_string(f, 0, "</doc>");
- f->close();
- memdelete(f);
-}
diff --git a/editor/doc/doc_dump.h b/editor/doc/doc_dump.h
deleted file mode 100644
index f8f1b6f805..0000000000
--- a/editor/doc/doc_dump.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*************************************************************************/
-/* doc_dump.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef DOC_DUMP_H
-#define DOC_DUMP_H
-
-#include "core/class_db.h"
-
-class DocDump {
-public:
- static void dump(const String &p_file);
-};
-
-#endif // DOC_DUMP_H
diff --git a/editor/doc/doc_data.cpp b/editor/doc_data.cpp
index 66134b4428..66134b4428 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc_data.cpp
diff --git a/editor/doc/doc_data.h b/editor/doc_data.h
index 073705f0b1..073705f0b1 100644
--- a/editor/doc/doc_data.h
+++ b/editor/doc_data.h
diff --git a/editor/editor_builders.py b/editor/editor_builders.py
index e8c23acf9e..44c3e50dfc 100644
--- a/editor/editor_builders.py
+++ b/editor/editor_builders.py
@@ -6,24 +6,23 @@ All such functions are invoked in a subprocess on Windows to prevent build flaki
import os
import os.path
from platform_methods import subprocess_main
-from compat import encode_utf8, byte_to_str, open_utf8
def make_doc_header(target, source, env):
dst = target[0]
- g = open_utf8(dst, "w")
+ g = open(dst, "w", encoding="utf-8")
buf = ""
docbegin = ""
docend = ""
for src in source:
if not src.endswith(".xml"):
continue
- with open_utf8(src, "r") as f:
+ with open(src, "r", encoding="utf-8") as f:
content = f.read()
buf += content
- buf = encode_utf8(docbegin + buf + docend)
+ buf = (docbegin + buf + docend).encode("utf-8")
decomp_size = len(buf)
import zlib
buf = zlib.compress(buf)
@@ -35,7 +34,7 @@ def make_doc_header(target, source, env):
g.write("static const int _doc_data_uncompressed_size = " + str(decomp_size) + ";\n")
g.write("static const unsigned char _doc_data_compressed[] = {\n")
for i in range(len(buf)):
- g.write("\t" + byte_to_str(buf[i]) + ",\n")
+ g.write("\t" + str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
@@ -47,7 +46,7 @@ def make_fonts_header(target, source, env):
dst = target[0]
- g = open_utf8(dst, "w")
+ g = open(dst, "w", encoding="utf-8")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _EDITOR_FONTS_H\n")
@@ -64,7 +63,7 @@ def make_fonts_header(target, source, env):
g.write("static const int _font_" + name + "_size = " + str(len(buf)) + ";\n")
g.write("static const unsigned char _font_" + name + "[] = {\n")
for j in range(len(buf)):
- g.write("\t" + byte_to_str(buf[j]) + ",\n")
+ g.write("\t" + str(buf[j]) + ",\n")
g.write("};\n")
@@ -77,7 +76,7 @@ def make_translations_header(target, source, env, category):
dst = target[0]
- g = open_utf8(dst, "w")
+ g = open(dst, "w", encoding="utf-8")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef _{}_TRANSLATIONS_H\n".format(category.upper()))
@@ -98,7 +97,7 @@ def make_translations_header(target, source, env, category):
g.write("static const unsigned char _{}_translation_{}_compressed[] = {{\n".format(category, name))
for j in range(len(buf)):
- g.write("\t" + byte_to_str(buf[j]) + ",\n")
+ g.write("\t" + str(buf[j]) + ",\n")
g.write("};\n")
diff --git a/editor/editor_help.h b/editor/editor_help.h
index a690e10e7e..0d3ecf9bd0 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -32,7 +32,7 @@
#define EDITOR_HELP_H
#include "editor/code_editor.h"
-#include "editor/doc/doc_data.h"
+#include "editor/doc_data.h"
#include "editor/editor_plugin.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/menu_button.h"
diff --git a/editor/file_type_cache.cpp b/editor/file_type_cache.cpp
deleted file mode 100644
index 52ab80cc48..0000000000
--- a/editor/file_type_cache.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*************************************************************************/
-/* file_type_cache.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "file_type_cache.h"
-
-#include "core/os/file_access.h"
-#include "core/project_settings.h"
-
-FileTypeCache *FileTypeCache::singleton = NULL;
-
-bool FileTypeCache::has_file(const String &p_path) const {
-
- GLOBAL_LOCK_FUNCTION
- return file_type_map.has(p_path);
-}
-
-String FileTypeCache::get_file_type(const String &p_path) const {
-
- GLOBAL_LOCK_FUNCTION
- ERR_FAIL_COND_V(!file_type_map.has(p_path), "");
- return file_type_map[p_path];
-}
-void FileTypeCache::set_file_type(const String &p_path, const String &p_type) {
-
- GLOBAL_LOCK_FUNCTION
- file_type_map[p_path] = p_type;
-}
-
-void FileTypeCache::load() {
-
- GLOBAL_LOCK_FUNCTION
- String project = ProjectSettings::get_singleton()->get_resource_path();
- FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::READ);
-
- if (!f) {
-
- WARN_PRINT("Can't open file_type_cache.cch.");
- return;
- }
-
- file_type_map.clear();
- while (!f->eof_reached()) {
-
- String path = f->get_line();
- if (f->eof_reached())
- break;
- String type = f->get_line();
- set_file_type(path, type);
- }
-
- memdelete(f);
-}
-
-void FileTypeCache::save() {
-
- GLOBAL_LOCK_FUNCTION
- String project = ProjectSettings::get_singleton()->get_resource_path();
- FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::WRITE);
-
- ERR_FAIL_COND_MSG(!f, "Can't open file_type_cache.cch for writing, not saving file type cache!");
-
- const String *K = NULL;
-
- while ((K = file_type_map.next(K))) {
-
- f->store_line(*K);
- f->store_line(file_type_map[*K]);
- }
-
- memdelete(f);
-}
-
-FileTypeCache::FileTypeCache() {
-
- ERR_FAIL_COND_MSG(singleton, "FileTypeCache singleton already exist.");
- singleton = this;
-}
diff --git a/editor/file_type_cache.h b/editor/file_type_cache.h
deleted file mode 100644
index 216effea00..0000000000
--- a/editor/file_type_cache.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*************************************************************************/
-/* file_type_cache.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef FILE_TYPE_CACHE_H
-#define FILE_TYPE_CACHE_H
-
-#include "core/object.h"
-
-class FileTypeCache : Object {
-
- GDCLASS(FileTypeCache, Object);
-
- HashMap<String, String> file_type_map;
-
- static FileTypeCache *singleton;
-
-public:
- static FileTypeCache *get_singleton() { return singleton; }
-
- bool has_file(const String &p_path) const;
- String get_file_type(const String &p_path) const;
- void set_file_type(const String &p_path, const String &p_type);
-
- void load();
- void save();
-
- FileTypeCache();
-};
-
-#endif // FILE_TYPE_CACHE_H
diff --git a/editor/icons/editor_icons_builders.py b/editor/icons/editor_icons_builders.py
index ea2c2e57d1..a00f21c265 100644
--- a/editor/icons/editor_icons_builders.py
+++ b/editor/icons/editor_icons_builders.py
@@ -3,9 +3,10 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
+
import os
+from io import StringIO
from platform_methods import subprocess_main
-from compat import StringIO
def make_editor_icons_action(target, source, env):
diff --git a/editor/collada/collada.cpp b/editor/import/collada.cpp
index 8ef9d17083..8ef9d17083 100644
--- a/editor/collada/collada.cpp
+++ b/editor/import/collada.cpp
diff --git a/editor/collada/collada.h b/editor/import/collada.h
index 4707d7d779..4707d7d779 100644
--- a/editor/collada/collada.h
+++ b/editor/import/collada.h
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 3cc6e7a50c..f7da8c27f9 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -31,8 +31,8 @@
#include "editor_import_collada.h"
#include "core/os/os.h"
-#include "editor/collada/collada.h"
#include "editor/editor_node.h"
+#include "editor/import/collada.h"
#include "scene/3d/camera.h"
#include "scene/3d/light.h"
#include "scene/3d/mesh_instance.h"
diff --git a/editor/plugins/skeleton_ik_editor_plugin.cpp b/editor/plugins/skeleton_ik_editor_plugin.cpp
index b031bd71d3..418e10a0f0 100644
--- a/editor/plugins/skeleton_ik_editor_plugin.cpp
+++ b/editor/plugins/skeleton_ik_editor_plugin.cpp
@@ -44,10 +44,7 @@ void SkeletonIKEditorPlugin::_play() {
skeleton_ik->start();
} else {
skeleton_ik->stop();
-
- for (int i = 0; i < skeleton_ik->get_parent_skeleton()->get_bone_count(); ++i) {
- skeleton_ik->get_parent_skeleton()->set_bone_global_pose_override(i, Transform(), 0);
- }
+ skeleton_ik->get_parent_skeleton()->clear_bones_global_pose_override();
}
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 9100e28352..a10e1c1d2c 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -2669,6 +2669,38 @@ VisualShaderEditor::VisualShaderEditor() {
add_options.push_back(AddOption("Transform", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "transform"), "transform", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
add_options.push_back(AddOption("Velocity", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "velocity"), "velocity", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ // SKY INPUTS
+
+ add_options.push_back(AddOption("AtCubeMapPass", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "at_cubemap_pass"), "at_cubemap_pass", VisualShaderNode::PORT_TYPE_BOOLEAN, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("AtHalfResPass", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "at_half_res_pass"), "at_half_res_pass", VisualShaderNode::PORT_TYPE_BOOLEAN, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("AtQuarterResPass", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "at_quarter_res_pass"), "at_quarter_res_pass", VisualShaderNode::PORT_TYPE_BOOLEAN, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("EyeDir", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "eyedir"), "eyedir", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("HalfResColor", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "half_res_color"), "half_res_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("HalfResAlpha", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "half_res_alpha"), "half_res_alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light0Color", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light0_color"), "light0_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light0Direction", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light0_direction"), "light0_direction", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light0Enabled", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light0_enabled"), "light0_enabled", VisualShaderNode::PORT_TYPE_BOOLEAN, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light0Energy", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light0_energy"), "light0_energy", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light1Color", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light1_color"), "light1_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light1Direction", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light1_direction"), "light1_direction", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light1Enabled", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light1_enabled"), "light1_enabled", VisualShaderNode::PORT_TYPE_BOOLEAN, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light1Energy", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light1_energy"), "light1_energy", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light2Color", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light2_color"), "light2_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light2Direction", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light2_direction"), "light2_direction", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light2Enabled", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light2_enabled"), "light2_enabled", VisualShaderNode::PORT_TYPE_BOOLEAN, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light2Energy", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light2_energy"), "light2_energy", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light3Color", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light3_color"), "light3_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light3Direction", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light3_direction"), "light3_direction", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light3Enabled", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light3_enabled"), "light3_enabled", VisualShaderNode::PORT_TYPE_BOOLEAN, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Light3Energy", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "light3_energy"), "light3_energy", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Position", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "position"), "position", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("QuarterResColor", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "quarter_res_color"), "quarter_res_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("QuarterResAlpha", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "quarter_res_alpha"), "quarter_res_alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Radiance", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "radiance"), "radiance", VisualShaderNode::PORT_TYPE_SAMPLER, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "screen_uv"), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("SkyCoords", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "sky_coords"), "sky_coords", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+ add_options.push_back(AddOption("Time", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SKY));
+
// SCALAR
add_options.push_back(AddOption("FloatFunc", "Scalar", "Common", "VisualShaderNodeFloatFunc", TTR("Float function."), -1, VisualShaderNode::PORT_TYPE_SCALAR));
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 52e7612acd..2cecb13198 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PROJECT_SETTINGS_H
-#define PROJECT_SETTINGS_H
+#ifndef PROJECT_SETTINGS_EDITOR_H
+#define PROJECT_SETTINGS_EDITOR_H
#include "core/undo_redo.h"
#include "editor/editor_autoload_settings.h"
@@ -204,4 +204,4 @@ public:
ProjectSettingsEditor(EditorData *p_data);
};
-#endif // PROJECT_SETTINGS_H
+#endif // PROJECT_SETTINGS_EDITOR_H
diff --git a/main/main.cpp b/main/main.cpp
index 887d423d52..0047d05771 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -71,8 +71,8 @@
#include "servers/register_server_types.h"
#ifdef TOOLS_ENABLED
-#include "editor/doc/doc_data.h"
-#include "editor/doc/doc_data_class_path.gen.h"
+#include "editor/doc_data.h"
+#include "editor/doc_data_class_path.gen.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/progress_dialog.h"
diff --git a/main/main_builders.py b/main/main_builders.py
index c48aaaa572..e24070ccc3 100644
--- a/main/main_builders.py
+++ b/main/main_builders.py
@@ -4,7 +4,6 @@ All such functions are invoked in a subprocess on Windows to prevent build flaki
"""
from platform_methods import subprocess_main
-from compat import byte_to_str
from collections import OrderedDict
@@ -22,7 +21,7 @@ def make_splash(target, source, env):
g.write('static const Color boot_splash_bg_color = Color(0.14, 0.14, 0.14);\n')
g.write("static const unsigned char boot_splash_png[] = {\n")
for i in range(len(buf)):
- g.write(byte_to_str(buf[i]) + ",\n")
+ g.write(str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
@@ -41,7 +40,7 @@ def make_splash_editor(target, source, env):
g.write('static const Color boot_splash_editor_bg_color = Color(0.14, 0.14, 0.14);\n')
g.write("static const unsigned char boot_splash_editor_png[] = {\n")
for i in range(len(buf)):
- g.write(byte_to_str(buf[i]) + ",\n")
+ g.write(str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
@@ -59,7 +58,7 @@ def make_app_icon(target, source, env):
g.write("#define APP_ICON_H\n")
g.write("static const unsigned char app_icon_png[] = {\n")
for i in range(len(buf)):
- g.write(byte_to_str(buf[i]) + ",\n")
+ g.write(str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index 2c2e6e8b45..beb955d045 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -28,8 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "test_main.h"
+
#include "core/list.h"
-#include "core/os/main_loop.h"
#ifdef DEBUG_ENABLED
diff --git a/main/tests/test_main.h b/main/tests/test_main.h
index 56db3ea2a5..bdb1668d21 100644
--- a/main/tests/test_main.h
+++ b/main/tests/test_main.h
@@ -32,9 +32,10 @@
#define TEST_MAIN_H
#include "core/list.h"
+#include "core/os/main_loop.h"
#include "core/ustring.h"
const char **tests_get_names();
MainLoop *test_main(String p_test, const List<String> &p_args);
-#endif
+#endif // TEST_MAIN_H
diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp
index edb57f2a9f..ac53f124d2 100644
--- a/main/tests/test_oa_hash_map.cpp
+++ b/main/tests/test_oa_hash_map.cpp
@@ -30,9 +30,8 @@
#include "test_oa_hash_map.h"
-#include "core/os/os.h"
-
#include "core/oa_hash_map.h"
+#include "core/os/os.h"
namespace TestOAHashMap {
diff --git a/main/tests/test_oa_hash_map.h b/main/tests/test_oa_hash_map.h
index 60cde961c5..eb2b3d1e99 100644
--- a/main/tests/test_oa_hash_map.h
+++ b/main/tests/test_oa_hash_map.h
@@ -37,4 +37,5 @@ namespace TestOAHashMap {
MainLoop *test();
}
+
#endif // TEST_OA_HASH_MAP_H
diff --git a/main/tests/test_ordered_hash_map.cpp b/main/tests/test_ordered_hash_map.cpp
index cc779119bc..a5553217e2 100644
--- a/main/tests/test_ordered_hash_map.cpp
+++ b/main/tests/test_ordered_hash_map.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "test_ordered_hash_map.h"
+
#include "core/ordered_hash_map.h"
#include "core/os/os.h"
#include "core/pair.h"
diff --git a/main/tests/test_ordered_hash_map.h b/main/tests/test_ordered_hash_map.h
index 03e559107e..f251da0ba2 100644
--- a/main/tests/test_ordered_hash_map.h
+++ b/main/tests/test_ordered_hash_map.h
@@ -31,9 +31,11 @@
#ifndef TEST_ORDERED_HASH_MAP_H
#define TEST_ORDERED_HASH_MAP_H
+#include "core/os/main_loop.h"
+
namespace TestOrderedHashMap {
MainLoop *test();
}
-#endif
+#endif // TEST_ORDERED_HASH_MAP_H
diff --git a/methods.py b/methods.py
index 56c495468d..dc82c97361 100644
--- a/methods.py
+++ b/methods.py
@@ -2,12 +2,11 @@ import os
import re
import glob
import subprocess
-from compat import iteritems, isbasestring, decode_utf8
def add_source_files(self, sources, files, warn_duplicates=True):
# Convert string to list of absolute paths (including expanding wildcard)
- if isbasestring(files):
+ if isinstance(files, (str, bytes)):
# Keep SCons project-absolute path as they are (no wildcard support)
if files.startswith('#'):
if '*' in files:
@@ -62,6 +61,9 @@ def update_version(module_version_string=""):
# NOTE: It is safe to generate this file here, since this is still executed serially
f = open("core/version_generated.gen.h", "w")
+ f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ f.write("#ifndef VERSION_GENERATED_GEN_H\n")
+ f.write("#define VERSION_GENERATED_GEN_H\n")
f.write("#define VERSION_SHORT_NAME \"" + str(version.short_name) + "\"\n")
f.write("#define VERSION_NAME \"" + str(version.name) + "\"\n")
f.write("#define VERSION_MAJOR " + str(version.major) + "\n")
@@ -72,10 +74,14 @@ def update_version(module_version_string=""):
f.write("#define VERSION_MODULE_CONFIG \"" + str(version.module_config) + module_version_string + "\"\n")
f.write("#define VERSION_YEAR " + str(version.year) + "\n")
f.write("#define VERSION_WEBSITE \"" + str(version.website) + "\"\n")
+ f.write("#endif // VERSION_GENERATED_GEN_H\n")
f.close()
# NOTE: It is safe to generate this file here, since this is still executed serially
fhash = open("core/version_hash.gen.h", "w")
+ fhash.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ fhash.write("#ifndef VERSION_HASH_GEN_H\n")
+ fhash.write("#define VERSION_HASH_GEN_H\n")
githash = ""
gitfolder = ".git"
@@ -93,7 +99,8 @@ def update_version(module_version_string=""):
else:
githash = head
- fhash.write("#define VERSION_HASH \"" + githash + "\"")
+ fhash.write("#define VERSION_HASH \"" + githash + "\"\n")
+ fhash.write("#endif // VERSION_HASH_GEN_H\n")
fhash.close()
@@ -232,7 +239,7 @@ def use_windows_spawn_fix(self, platform=None):
cmdline = cmd + " " + newargs
rv = 0
- env = {str(key): str(value) for key, value in iteritems(env)}
+ env = {str(key): str(value) for key, value in iter(env.items())}
if len(cmdline) > 32000 and cmd.endswith("ar"):
cmdline = cmd + " " + args[1] + " " + args[2] + " "
for i in range(3, len(args)):
@@ -522,7 +529,7 @@ def detect_darwin_sdk_path(platform, env):
if not env[var_name]:
try:
- sdk_path = decode_utf8(subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip())
+ sdk_path = subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip().decode("utf-8")
if sdk_path:
env[var_name] = sdk_path
except (subprocess.CalledProcessError, OSError):
@@ -532,7 +539,7 @@ def detect_darwin_sdk_path(platform, env):
def is_vanilla_clang(env):
if not using_clang(env):
return False
- version = decode_utf8(subprocess.check_output([env['CXX'], '--version']).strip())
+ version = subprocess.check_output([env['CXX'], '--version']).strip().decode("utf-8")
return not version.startswith("Apple")
@@ -545,7 +552,7 @@ def get_compiler_version(env):
# Not using -dumpversion as some GCC distros only return major, and
# Clang used to return hardcoded 4.2.1: # https://reviews.llvm.org/D56803
try:
- version = decode_utf8(subprocess.check_output([env.subst(env['CXX']), '--version']).strip())
+ version = subprocess.check_output([env.subst(env['CXX']), '--version']).strip().decode("utf-8")
except (subprocess.CalledProcessError, OSError):
print("Couldn't parse CXX environment variable to infer compiler version.")
return None
diff --git a/modules/assimp/register_types.h b/modules/assimp/register_types.h
index f363744c0a..f399a7acc6 100644
--- a/modules/assimp/register_types.h
+++ b/modules/assimp/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef ASSIMP_REGISTER_TYPES_H
+#define ASSIMP_REGISTER_TYPES_H
+
void register_assimp_types();
void unregister_assimp_types();
+
+#endif // ASSIMP_REGISTER_TYPES_H
diff --git a/modules/basis_universal/register_types.h b/modules/basis_universal/register_types.h
index 977374fbfc..5053dc27ce 100644
--- a/modules/basis_universal/register_types.h
+++ b/modules/basis_universal/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef BASIS_UNIVERSAL_REGISTER_TYPES_H
+#define BASIS_UNIVERSAL_REGISTER_TYPES_H
+
void register_basis_universal_types();
void unregister_basis_universal_types();
+
+#endif // BASIS_UNIVERSAL_REGISTER_TYPES_H
diff --git a/modules/bmp/register_types.h b/modules/bmp/register_types.h
index 398716eaa1..e7561dc32d 100644
--- a/modules/bmp/register_types.h
+++ b/modules/bmp/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef BMP_REGISTER_TYPES_H
+#define BMP_REGISTER_TYPES_H
+
void register_bmp_types();
void unregister_bmp_types();
+
+#endif // BMP_REGISTER_TYPES_H
diff --git a/modules/csg/register_types.h b/modules/csg/register_types.h
index 4eadeea254..926e598561 100644
--- a/modules/csg/register_types.h
+++ b/modules/csg/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef CSG_REGISTER_TYPES_H
+#define CSG_REGISTER_TYPES_H
+
void register_csg_types();
void unregister_csg_types();
+
+#endif // CSG_REGISTER_TYPES_H
diff --git a/modules/cvtt/register_types.h b/modules/cvtt/register_types.h
index 93f684cdd1..8472980c6a 100644
--- a/modules/cvtt/register_types.h
+++ b/modules/cvtt/register_types.h
@@ -29,6 +29,13 @@
/*************************************************************************/
#ifdef TOOLS_ENABLED
+
+#ifndef CVTT_REGISTER_TYPES_H
+#define CVTT_REGISTER_TYPES_H
+
void register_cvtt_types();
void unregister_cvtt_types();
-#endif
+
+#endif // CVTT_REGISTER_TYPES_H
+
+#endif // TOOLS_ENABLED
diff --git a/modules/dds/register_types.h b/modules/dds/register_types.h
index 1808a4af36..3cb7b5c2a6 100644
--- a/modules/dds/register_types.h
+++ b/modules/dds/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef DDS_REGISTER_TYPES_H
+#define DDS_REGISTER_TYPES_H
+
void register_dds_types();
void unregister_dds_types();
+
+#endif // DDS_REGISTER_TYPES_H
diff --git a/modules/enet/register_types.h b/modules/enet/register_types.h
index 19f8c5a352..cac0a4f7ee 100644
--- a/modules/enet/register_types.h
+++ b/modules/enet/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef ENET_REGISTER_TYPES_H
+#define ENET_REGISTER_TYPES_H
+
void register_enet_types();
void unregister_enet_types();
+
+#endif // ENET_REGISTER_TYPES_H
diff --git a/modules/etc/register_types.h b/modules/etc/register_types.h
index fac83e7d17..247c7213af 100644
--- a/modules/etc/register_types.h
+++ b/modules/etc/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef ETC_REGISTER_TYPES_H
+#define ETC_REGISTER_TYPES_H
+
void register_etc_types();
void unregister_etc_types();
+
+#endif // ETC_REGISTER_TYPES_H
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 7b66aa1c76..9e1853c4cd 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -3,8 +3,6 @@
Import('env')
Import('env_modules')
-from compat import isbasestring
-
env_freetype = env_modules.Clone()
# Thirdparty source files
@@ -93,7 +91,7 @@ if env['builtin_freetype']:
# and then plain strings for system library. We insert between the two.
inserted = False
for idx, linklib in enumerate(env["LIBS"]):
- if isbasestring(linklib): # first system lib such as "X11", otherwise SCons lib object
+ if isinstance(linklib, (str, bytes)): # first system lib such as "X11", otherwise SCons lib object
env["LIBS"].insert(idx, lib)
inserted = True
break
diff --git a/modules/freetype/register_types.h b/modules/freetype/register_types.h
index 336969d079..aa8088d2e8 100644
--- a/modules/freetype/register_types.h
+++ b/modules/freetype/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef FREETYPE_REGISTER_TYPES_H
+#define FREETYPE_REGISTER_TYPES_H
+
void register_freetype_types();
void unregister_freetype_types();
+
+#endif // FREETYPE_REGISTER_TYPES_H
diff --git a/modules/gdnative/arvr/register_types.h b/modules/gdnative/arvr/register_types.h
index 815f112fbf..b0de6f7c14 100644
--- a/modules/gdnative/arvr/register_types.h
+++ b/modules/gdnative/arvr/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef ARVR_REGISTER_TYPES_H
+#define ARVR_REGISTER_TYPES_H
+
void register_arvr_types();
void unregister_arvr_types();
+
+#endif // ARVR_REGISTER_TYPES_H
diff --git a/modules/gdnative/nativescript/register_types.h b/modules/gdnative/nativescript/register_types.h
index 8fcecb9836..088bf38dd5 100644
--- a/modules/gdnative/nativescript/register_types.h
+++ b/modules/gdnative/nativescript/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef NATIVESCRIPT_REGISTER_TYPES_H
+#define NATIVESCRIPT_REGISTER_TYPES_H
+
void register_nativescript_types();
void unregister_nativescript_types();
+
+#endif // NATIVESCRIPT_REGISTER_TYPES_H
diff --git a/modules/gdnative/net/register_types.h b/modules/gdnative/net/register_types.h
index 526bc49deb..70b266f9b9 100644
--- a/modules/gdnative/net/register_types.h
+++ b/modules/gdnative/net/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef NET_REGISTER_TYPES_H
+#define NET_REGISTER_TYPES_H
+
void register_net_types();
void unregister_net_types();
+
+#endif // NET_REGISTER_TYPES_H
diff --git a/modules/gdnative/pluginscript/register_types.h b/modules/gdnative/pluginscript/register_types.h
index a4f7284b54..c6a64b4f40 100644
--- a/modules/gdnative/pluginscript/register_types.h
+++ b/modules/gdnative/pluginscript/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef PLUGINSCRIPT_REGISTER_TYPES_H
+#define PLUGINSCRIPT_REGISTER_TYPES_H
+
void register_pluginscript_types();
void unregister_pluginscript_types();
+
+#endif // PLUGINSCRIPT_REGISTER_TYPES_H
diff --git a/modules/gdnative/register_types.h b/modules/gdnative/register_types.h
index 0091ef3f96..b5c182f8b7 100644
--- a/modules/gdnative/register_types.h
+++ b/modules/gdnative/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef GDNATIVE_REGISTER_TYPES_H
+#define GDNATIVE_REGISTER_TYPES_H
+
void register_gdnative_types();
void unregister_gdnative_types();
+
+#endif // GDNATIVE_REGISTER_TYPES_H
diff --git a/modules/gdnative/videodecoder/register_types.h b/modules/gdnative/videodecoder/register_types.h
index d81d5c497b..b1a83d4071 100644
--- a/modules/gdnative/videodecoder/register_types.h
+++ b/modules/gdnative/videodecoder/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef VIDEODECODER_REGISTER_TYPES_H
+#define VIDEODECODER_REGISTER_TYPES_H
+
void register_videodecoder_types();
void unregister_videodecoder_types();
+
+#endif // VIDEODECODER_REGISTER_TYPES_H
diff --git a/modules/gdnavigation/register_types.h b/modules/gdnavigation/register_types.h
index bd15eaaada..cdbff1b937 100644
--- a/modules/gdnavigation/register_types.h
+++ b/modules/gdnavigation/register_types.h
@@ -32,5 +32,10 @@
@author AndreaCatania
*/
+#ifndef GDNAVIGATION_REGISTER_TYPES_H
+#define GDNAVIGATION_REGISTER_TYPES_H
+
void register_gdnavigation_types();
void unregister_gdnavigation_types();
+
+#endif // GDNAVIGATION_REGISTER_TYPES_H
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp
index a2dcc48820..914c9742e1 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/lsp.hpp
@@ -33,7 +33,7 @@
#include "core/class_db.h"
#include "core/list.h"
-#include "editor/doc/doc_data.h"
+#include "editor/doc_data.h"
namespace lsp {
diff --git a/modules/gdscript/register_types.h b/modules/gdscript/register_types.h
index 55920e8b97..18e57c1211 100644
--- a/modules/gdscript/register_types.h
+++ b/modules/gdscript/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef GDSCRIPT_REGISTER_TYPES_H
+#define GDSCRIPT_REGISTER_TYPES_H
+
void register_gdscript_types();
void unregister_gdscript_types();
+
+#endif // GDSCRIPT_REGISTER_TYPES_H
diff --git a/modules/glslang/register_types.h b/modules/glslang/register_types.h
index 37a1ef67f2..2437e2b27a 100644
--- a/modules/glslang/register_types.h
+++ b/modules/glslang/register_types.h
@@ -28,7 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef GLSLANG_REGISTER_TYPES_H
+#define GLSLANG_REGISTER_TYPES_H
+
#define MODULE_GLSLANG_HAS_PREREGISTER
+
void preregister_glslang_types();
void register_glslang_types();
void unregister_glslang_types();
+
+#endif // GLSLANG_REGISTER_TYPES_H
diff --git a/modules/gridmap/register_types.h b/modules/gridmap/register_types.h
index bc720f460c..c0e3c39ca8 100644
--- a/modules/gridmap/register_types.h
+++ b/modules/gridmap/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef GRIDMAP_REGISTER_TYPES_H
+#define GRIDMAP_REGISTER_TYPES_H
+
void register_gridmap_types();
void unregister_gridmap_types();
+
+#endif // GRIDMAP_REGISTER_TYPES_H
diff --git a/modules/hdr/register_types.h b/modules/hdr/register_types.h
index c1c69a1e27..02441516ec 100644
--- a/modules/hdr/register_types.h
+++ b/modules/hdr/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef HDR_REGISTER_TYPES_H
+#define HDR_REGISTER_TYPES_H
+
void register_hdr_types();
void unregister_hdr_types();
+
+#endif // HDR_REGISTER_TYPES_H
diff --git a/modules/jpg/register_types.h b/modules/jpg/register_types.h
index 291098fae2..52cd378b3a 100644
--- a/modules/jpg/register_types.h
+++ b/modules/jpg/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef JPG_REGISTER_TYPES_H
+#define JPG_REGISTER_TYPES_H
+
void register_jpg_types();
void unregister_jpg_types();
+
+#endif // JPG_REGISTER_TYPES_H
diff --git a/modules/jsonrpc/register_types.h b/modules/jsonrpc/register_types.h
index 958f16344a..854d73a21f 100644
--- a/modules/jsonrpc/register_types.h
+++ b/modules/jsonrpc/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef JSONRPC_REGISTER_TYPES_H
+#define JSONRPC_REGISTER_TYPES_H
+
void register_jsonrpc_types();
void unregister_jsonrpc_types();
+
+#endif // JSONRPC_REGISTER_TYPES_H
diff --git a/modules/mbedtls/register_types.h b/modules/mbedtls/register_types.h
index f179d39438..90c81b1682 100755
--- a/modules/mbedtls/register_types.h
+++ b/modules/mbedtls/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef MBEDTLS_REGISTER_TYPES_H
+#define MBEDTLS_REGISTER_TYPES_H
+
void register_mbedtls_types();
void unregister_mbedtls_types();
+
+#endif // MBEDTLS_REGISTER_TYPES_H
diff --git a/modules/mobile_vr/register_types.h b/modules/mobile_vr/register_types.h
index 602fae1f4e..33f608b6ed 100644
--- a/modules/mobile_vr/register_types.h
+++ b/modules/mobile_vr/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef MOBILE_VR_REGISTER_TYPES_H
+#define MOBILE_VR_REGISTER_TYPES_H
+
void register_mobile_vr_types();
void unregister_mobile_vr_types();
+
+#endif // MOBILE_VR_REGISTER_TYPES_H
diff --git a/modules/mono/build_scripts/make_android_mono_config.py b/modules/mono/build_scripts/make_android_mono_config.py
index 0afd939c57..4f5a496891 100644
--- a/modules/mono/build_scripts/make_android_mono_config.py
+++ b/modules/mono/build_scripts/make_android_mono_config.py
@@ -1,7 +1,6 @@
def generate_compressed_config(config_src, output_dir):
import os.path
- from compat import byte_to_str
# Source file
with open(os.path.join(output_dir, 'android_mono_config.gen.cpp'), 'w') as cpp:
@@ -16,7 +15,7 @@ def generate_compressed_config(config_src, output_dir):
for i, buf_idx in enumerate(range(compr_size)):
if i > 0:
bytes_seq_str += ', '
- bytes_seq_str += byte_to_str(buf[buf_idx])
+ bytes_seq_str += str(buf[buf_idx])
cpp.write('''/* THIS FILE IS GENERATED DO NOT EDIT */
#include "android_mono_config.h"
diff --git a/modules/mono/build_scripts/mono_reg_utils.py b/modules/mono/build_scripts/mono_reg_utils.py
index b2c48f0a61..3bae11b167 100644
--- a/modules/mono/build_scripts/mono_reg_utils.py
+++ b/modules/mono/build_scripts/mono_reg_utils.py
@@ -1,14 +1,9 @@
import os
import platform
-from compat import decode_utf8
-
if os.name == 'nt':
import sys
- if sys.version_info < (3,):
- import _winreg as winreg
- else:
- import winreg
+ import winreg
def _reg_open_key(key, subkey):
@@ -81,7 +76,7 @@ def find_msbuild_tools_path_reg():
lines = subprocess.check_output([vswhere] + vswhere_args).splitlines()
for line in lines:
- parts = decode_utf8(line).split(':', 1)
+ parts = line.decode("utf-8").split(':', 1)
if len(parts) < 2 or parts[0] != 'installationPath':
continue
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index b133923c25..bebe489d02 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -33,7 +33,7 @@
#include "core/class_db.h"
#include "core/string_builder.h"
-#include "editor/doc/doc_data.h"
+#include "editor/doc_data.h"
#include "editor/editor_help.h"
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
diff --git a/modules/ogg/register_types.h b/modules/ogg/register_types.h
index 09095c9b62..849d27bb06 100644
--- a/modules/ogg/register_types.h
+++ b/modules/ogg/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef OGG_REGISTER_TYPES_H
+#define OGG_REGISTER_TYPES_H
+
void register_ogg_types();
void unregister_ogg_types();
+
+#endif // OGG_REGISTER_TYPES_H
diff --git a/modules/opensimplex/register_types.h b/modules/opensimplex/register_types.h
index 56e128f09e..51c6815eae 100644
--- a/modules/opensimplex/register_types.h
+++ b/modules/opensimplex/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef OPENSIMPLEX_REGISTER_TYPES_H
+#define OPENSIMPLEX_REGISTER_TYPES_H
+
void register_opensimplex_types();
void unregister_opensimplex_types();
+
+#endif // OPENSIMPLEX_REGISTER_TYPES_H
diff --git a/modules/opus/register_types.h b/modules/opus/register_types.h
index 445be4e166..ad6e083c82 100644
--- a/modules/opus/register_types.h
+++ b/modules/opus/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef OPUS_REGISTER_TYPES_H
+#define OPUS_REGISTER_TYPES_H
+
void register_opus_types();
void unregister_opus_types();
+
+#endif // OPUS_REGISTER_TYPES_H
diff --git a/modules/pvr/register_types.h b/modules/pvr/register_types.h
index 06c54f50b1..8318996a46 100644
--- a/modules/pvr/register_types.h
+++ b/modules/pvr/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef PVR_REGISTER_TYPES_H
+#define PVR_REGISTER_TYPES_H
+
void register_pvr_types();
void unregister_pvr_types();
+
+#endif // PVR_REGISTER_TYPES_H
diff --git a/modules/regex/register_types.h b/modules/regex/register_types.h
index 99a6bbeb2c..cf377cdf5f 100644
--- a/modules/regex/register_types.h
+++ b/modules/regex/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef REGEX_REGISTER_TYPES_H
+#define REGEX_REGISTER_TYPES_H
+
void register_regex_types();
void unregister_regex_types();
+
+#endif // REGEX_REGISTER_TYPES_H
diff --git a/modules/squish/register_types.h b/modules/squish/register_types.h
index 0845e2b500..ab56c54d4a 100644
--- a/modules/squish/register_types.h
+++ b/modules/squish/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef SQUISH_REGISTER_TYPES_H
+#define SQUISH_REGISTER_TYPES_H
+
void register_squish_types();
void unregister_squish_types();
+
+#endif // SQUISH_REGISTER_TYPES_H
diff --git a/modules/stb_vorbis/register_types.h b/modules/stb_vorbis/register_types.h
index f6147abd01..f5a1dd31bc 100644
--- a/modules/stb_vorbis/register_types.h
+++ b/modules/stb_vorbis/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef STB_VORBIS_REGISTER_TYPES_H
+#define STB_VORBIS_REGISTER_TYPES_H
+
void register_stb_vorbis_types();
void unregister_stb_vorbis_types();
+
+#endif // STB_VORBIS_REGISTER_TYPES_H
diff --git a/modules/svg/register_types.h b/modules/svg/register_types.h
index aa50540552..a3d914e0cb 100644
--- a/modules/svg/register_types.h
+++ b/modules/svg/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef SVG_REGISTER_TYPES_H
+#define SVG_REGISTER_TYPES_H
+
void register_svg_types();
void unregister_svg_types();
+
+#endif // SVG_REGISTER_TYPES_H
diff --git a/modules/tga/register_types.h b/modules/tga/register_types.h
index beef05a590..94a77d295e 100644
--- a/modules/tga/register_types.h
+++ b/modules/tga/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef TGA_REGISTER_TYPES_H
+#define TGA_REGISTER_TYPES_H
+
void register_tga_types();
void unregister_tga_types();
+
+#endif // TGA_REGISTER_TYPES_H
diff --git a/modules/theora/register_types.h b/modules/theora/register_types.h
index 66eb49aed1..4f0670b2c7 100644
--- a/modules/theora/register_types.h
+++ b/modules/theora/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef THEORA_REGISTER_TYPES_H
+#define THEORA_REGISTER_TYPES_H
+
void register_theora_types();
void unregister_theora_types();
+
+#endif // THEORA_REGISTER_TYPES_H
diff --git a/modules/tinyexr/register_types.h b/modules/tinyexr/register_types.h
index 2028cd4a33..9739488312 100644
--- a/modules/tinyexr/register_types.h
+++ b/modules/tinyexr/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef TINYEXR_REGISTER_TYPES_H
+#define TINYEXR_REGISTER_TYPES_H
+
void register_tinyexr_types();
void unregister_tinyexr_types();
+
+#endif // TINYEXR_REGISTER_TYPES_H
diff --git a/modules/upnp/register_types.h b/modules/upnp/register_types.h
index 4d752e4a94..0c71db9ffa 100644
--- a/modules/upnp/register_types.h
+++ b/modules/upnp/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef UPNP_REGISTER_TYPES_H
+#define UPNP_REGISTER_TYPES_H
+
void register_upnp_types();
void unregister_upnp_types();
+
+#endif // UPNP_REGISTER_TYPES_H
diff --git a/modules/vhacd/register_types.h b/modules/vhacd/register_types.h
index de56620813..d02a990901 100644
--- a/modules/vhacd/register_types.h
+++ b/modules/vhacd/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef VHACD_REGISTER_TYPES_H
+#define VHACD_REGISTER_TYPES_H
+
void register_vhacd_types();
void unregister_vhacd_types();
+
+#endif // VHACD_REGISTER_TYPES_H
diff --git a/modules/visual_script/register_types.h b/modules/visual_script/register_types.h
index 546c2fbff3..c18c2930b1 100644
--- a/modules/visual_script/register_types.h
+++ b/modules/visual_script/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef VISUAL_SCRIPT_REGISTER_TYPES_H
+#define VISUAL_SCRIPT_REGISTER_TYPES_H
+
void register_visual_script_types();
void unregister_visual_script_types();
+
+#endif // VISUAL_SCRIPT_REGISTER_TYPES_H
diff --git a/modules/vorbis/register_types.h b/modules/vorbis/register_types.h
index 83d4904a87..7fa0dfdeef 100644
--- a/modules/vorbis/register_types.h
+++ b/modules/vorbis/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef VORBIS_REGISTER_TYPES_H
+#define VORBIS_REGISTER_TYPES_H
+
void register_vorbis_types();
void unregister_vorbis_types();
+
+#endif // VORBIS_REGISTER_TYPES_H
diff --git a/modules/webm/register_types.h b/modules/webm/register_types.h
index 962a0dab4e..6a02e3a87a 100644
--- a/modules/webm/register_types.h
+++ b/modules/webm/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef WEBM_REGISTER_TYPES_H
+#define WEBM_REGISTER_TYPES_H
+
void register_webm_types();
void unregister_webm_types();
+
+#endif // WEBM_REGISTER_TYPES_H
diff --git a/modules/webp/register_types.h b/modules/webp/register_types.h
index 9591b91558..d574d7be1d 100644
--- a/modules/webp/register_types.h
+++ b/modules/webp/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef WEBP_REGISTER_TYPES_H
+#define WEBP_REGISTER_TYPES_H
+
void register_webp_types();
void unregister_webp_types();
+
+#endif // WEBP_REGISTER_TYPES_H
diff --git a/modules/webrtc/register_types.h b/modules/webrtc/register_types.h
index e6b50506e5..8f5b9e8452 100644
--- a/modules/webrtc/register_types.h
+++ b/modules/webrtc/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef WEBRTC_REGISTER_TYPES_H
+#define WEBRTC_REGISTER_TYPES_H
+
void register_webrtc_types();
void unregister_webrtc_types();
+
+#endif // WEBRTC_REGISTER_TYPES_H
diff --git a/modules/websocket/register_types.h b/modules/websocket/register_types.h
index b254b9dae8..bb7be57ab3 100644
--- a/modules/websocket/register_types.h
+++ b/modules/websocket/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef WEBSOCKET_REGISTER_TYPES_H
+#define WEBSOCKET_REGISTER_TYPES_H
+
void register_websocket_types();
void unregister_websocket_types();
+
+#endif // WEBSOCKET_REGISTER_TYPES_H
diff --git a/modules/xatlas_unwrap/register_types.h b/modules/xatlas_unwrap/register_types.h
index 3f2181fa63..fe924bab96 100644
--- a/modules/xatlas_unwrap/register_types.h
+++ b/modules/xatlas_unwrap/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef XATLAS_UNWRAP_REGISTER_TYPES_H
+#define XATLAS_UNWRAP_REGISTER_TYPES_H
+
void register_xatlas_unwrap_types();
void unregister_xatlas_unwrap_types();
+
+#endif // XATLAS_UNWRAP_REGISTER_TYPES_H
diff --git a/platform/SCsub b/platform/SCsub
index 38bab59d74..40cacce674 100644
--- a/platform/SCsub
+++ b/platform/SCsub
@@ -1,7 +1,5 @@
#!/usr/bin/env python
-from compat import open_utf8
-
Import('env')
env.platform_sources = []
@@ -21,7 +19,7 @@ reg_apis += '}\n\n'
unreg_apis += '}\n'
# NOTE: It is safe to generate this file here, since this is still execute serially
-with open_utf8('register_platform_apis.gen.cpp', 'w') as f:
+with open('register_platform_apis.gen.cpp', 'w', encoding="utf-8") as f:
f.write(reg_apis_inc)
f.write(reg_apis)
f.write(unreg_apis)
diff --git a/platform/android/api/api.h b/platform/android/api/api.h
index c7296d92a7..5e951b9c88 100644
--- a/platform/android/api/api.h
+++ b/platform/android/api/api.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef ANDROID_API_H
+#define ANDROID_API_H
+
void register_android_api();
void unregister_android_api();
+
+#endif // ANDROID_API_H
diff --git a/platform/android/export/export.h b/platform/android/export/export.h
index ce786cc8b6..d11ab9f49e 100644
--- a/platform/android/export/export.h
+++ b/platform/android/export/export.h
@@ -28,4 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef ANDROID_EXPORT_H
+#define ANDROID_EXPORT_H
+
void register_android_exporter();
+
+#endif // ANDROID_EXPORT_H
diff --git a/platform/iphone/export/export.h b/platform/iphone/export/export.h
index 77b2a07bd1..043d21f533 100644
--- a/platform/iphone/export/export.h
+++ b/platform/iphone/export/export.h
@@ -28,4 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef IPHONE_EXPORT_H
+#define IPHONE_EXPORT_H
+
void register_iphone_exporter();
+
+#endif // IPHONE_EXPORT_H
diff --git a/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h
deleted file mode 100644
index 9029418462..0000000000
--- a/platform/iphone/platform_refcount.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*************************************************************************/
-/* platform_refcount.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "core/safe_refcount.h"
-
-#ifdef IPHONE_ENABLED
-
-#define REFCOUNT_T int
-#define REFCOUNT_GET_T int const volatile &
-
-#include <libkern/OSAtomic.h>
-
-inline int atomic_conditional_increment(volatile int *v) {
- return (*v == 0) ? 0 : OSAtomicIncrement32(v);
-}
-
-inline int atomic_decrement(volatile int *v) {
- return OSAtomicDecrement32(v);
-}
-
-#endif
diff --git a/platform/javascript/api/api.h b/platform/javascript/api/api.h
index 164d679205..8afe0f33ce 100644
--- a/platform/javascript/api/api.h
+++ b/platform/javascript/api/api.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef JAVASCRIPT_API_H
+#define JAVASCRIPT_API_H
+
void register_javascript_api();
void unregister_javascript_api();
+
+#endif // JAVASCRIPT_API_H
diff --git a/platform/osx/export/export.h b/platform/osx/export/export.h
index 7b8832cb01..4ddcec09fb 100644
--- a/platform/osx/export/export.h
+++ b/platform/osx/export/export.h
@@ -28,4 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef OSX_EXPORT_H
+#define OSX_EXPORT_H
+
void register_osx_exporter();
+
+#endif // OSX_EXPORT_H
diff --git a/platform/uwp/export/export.h b/platform/uwp/export/export.h
index ce03bc0aeb..1a1555d8ee 100644
--- a/platform/uwp/export/export.h
+++ b/platform/uwp/export/export.h
@@ -28,4 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef UWP_EXPORT_H
+#define UWP_EXPORT_H
+
void register_uwp_exporter();
+
+#endif // UWP_EXPORT_H
diff --git a/platform/x11/detect_prime.cpp b/platform/x11/detect_prime.cpp
index a0e5f835c0..d79fd00118 100644
--- a/platform/x11/detect_prime.cpp
+++ b/platform/x11/detect_prime.cpp
@@ -31,6 +31,8 @@
#ifdef X11_ENABLED
#if defined(OPENGL_ENABLED)
+#include "detect_prime.h"
+
#include "core/print_string.h"
#include "core/ustring.h"
diff --git a/platform/x11/export/export.h b/platform/x11/export/export.h
index d94ea114a8..4049e6a8bf 100644
--- a/platform/x11/export/export.h
+++ b/platform/x11/export/export.h
@@ -28,4 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef X11_EXPORT_H
+#define X11_EXPORT_H
+
void register_x11_exporter();
+
+#endif // X11_EXPORT_H
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index a9fe7275c2..1aacc6a250 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -340,7 +340,10 @@ void JoypadLinux::open_joypad(const char *p_path) {
(test_bit(ABS_X, absbit) || test_bit(ABS_Y, absbit) || test_bit(ABS_HAT0X, absbit) ||
test_bit(ABS_GAS, absbit) || test_bit(ABS_RUDDER, absbit)) &&
(test_bit(BTN_A, keybit) || test_bit(BTN_THUMBL, keybit) ||
- test_bit(BTN_TRIGGER, keybit) || test_bit(BTN_1, keybit)))) {
+ test_bit(BTN_TRIGGER, keybit) || test_bit(BTN_1, keybit))) &&
+ !(test_bit(EV_ABS, evbit) &&
+ test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit) &&
+ test_bit(ABS_RX, absbit) && test_bit(ABS_RY, absbit))) {
close(fd);
return;
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index e1f7691cf6..772913980b 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -267,6 +267,9 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
unsigned long valuemask = CWBorderPixel | CWColormap | CWEventMask;
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, visualInfo->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, visualInfo->depth, InputOutput, visualInfo->visual, valuemask, &windowAttributes);
+ wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
+ XSetWMProtocols(x11_display, x11_window, &wm_delete, 1);
+
//set_class_hint(x11_display, x11_window);
XMapWindow(x11_display, x11_window);
XFlush(x11_display);
@@ -476,9 +479,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
/* set the titlebar name */
XStoreName(x11_display, x11_window, "Godot");
- wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
- XSetWMProtocols(x11_display, x11_window, &wm_delete, 1);
-
im_active = false;
im_position = Vector2();
diff --git a/platform_methods.py b/platform_methods.py
index 4300216427..eed76bc8a8 100644
--- a/platform_methods.py
+++ b/platform_methods.py
@@ -7,10 +7,7 @@ import subprocess
# NOTE: The multiprocessing module is not compatible with SCons due to conflict on cPickle
-if sys.version_info[0] < 3:
- JSON_SERIALIZABLE_TYPES = (bool, int, long, float, basestring)
-else:
- JSON_SERIALIZABLE_TYPES = (bool, int, float, str)
+JSON_SERIALIZABLE_TYPES = (bool, int, float, str)
def run_in_subprocess(builder_function):
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index aa4ed233fb..3ef4dfe5f1 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -87,7 +87,7 @@ void AudioStreamPlayer2D::_mix_audio() {
AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol;
AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol;
AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
- AudioFrame vol = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : current.vol;
+ AudioFrame vol = vol_prev;
int cc = AudioServer::get_singleton()->get_channel_count();
diff --git a/scene/2d/path_texture.cpp b/scene/2d/path_texture.cpp
deleted file mode 100644
index 590f70a1b2..0000000000
--- a/scene/2d/path_texture.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*************************************************************************/
-/* path_texture.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "path_texture.h"
-
-void PathTexture::set_begin_texture(const Ref<Texture2D> &p_texture) {
-
- begin = p_texture;
- update();
-}
-
-Ref<Texture2D> PathTexture::get_begin_texture() const {
-
- return begin;
-}
-
-void PathTexture::set_repeat_texture(const Ref<Texture2D> &p_texture) {
-
- repeat = p_texture;
- update();
-}
-Ref<Texture2D> PathTexture::get_repeat_texture() const {
-
- return repeat;
-}
-
-void PathTexture::set_end_texture(const Ref<Texture2D> &p_texture) {
-
- end = p_texture;
- update();
-}
-Ref<Texture2D> PathTexture::get_end_texture() const {
-
- return end;
-}
-
-void PathTexture::set_subdivisions(int p_amount) {
-
- ERR_FAIL_INDEX(p_amount, 32);
- subdivs = p_amount;
- update();
-}
-
-int PathTexture::get_subdivisions() const {
-
- return subdivs;
-}
-
-void PathTexture::set_overlap(int p_amount) {
-
- overlap = p_amount;
- update();
-}
-int PathTexture::get_overlap() const {
-
- return overlap;
-}
-
-PathTexture::PathTexture() {
-
- overlap = 0;
- subdivs = 1;
-}
diff --git a/scene/2d/path_texture.h b/scene/2d/path_texture.h
deleted file mode 100644
index 014d0dc959..0000000000
--- a/scene/2d/path_texture.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*************************************************************************/
-/* path_texture.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef PATH_TEXTURE_H
-#define PATH_TEXTURE_H
-
-#include "scene/2d/node_2d.h"
-
-class PathTexture : public Node2D {
- GDCLASS(PathTexture, Node2D);
-
- Ref<Texture2D> begin;
- Ref<Texture2D> repeat;
- Ref<Texture2D> end;
- int subdivs;
- bool overlap;
-
-public:
- void set_begin_texture(const Ref<Texture2D> &p_texture);
- Ref<Texture2D> get_begin_texture() const;
-
- void set_repeat_texture(const Ref<Texture2D> &p_texture);
- Ref<Texture2D> get_repeat_texture() const;
-
- void set_end_texture(const Ref<Texture2D> &p_texture);
- Ref<Texture2D> get_end_texture() const;
-
- void set_subdivisions(int p_amount);
- int get_subdivisions() const;
-
- void set_overlap(int p_amount);
- int get_overlap() const;
-
- PathTexture();
-};
-
-#endif // PATH_TEXTURE_H
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 855d254bd6..f0a61a905c 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -213,7 +213,7 @@ void AudioStreamPlayer3D::_mix_audio() {
AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol[k];
AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol[k];
AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
- AudioFrame vol = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : current.vol[k];
+ AudioFrame vol = vol_prev;
if (!AudioServer::get_singleton()->thread_has_channel_mix_buffer(current.bus_index, k))
continue; //may have been deleted, will be updated on process
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index b2252bcb04..8e954ddc80 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -396,6 +396,13 @@ void Skeleton::_notification(int p_what) {
}
}
+void Skeleton::clear_bones_global_pose_override() {
+ for (int i = 0; i < bones.size(); i += 1) {
+ bones.write[i].global_pose_override_amount = 0;
+ }
+ _make_dirty();
+}
+
void Skeleton::set_bone_global_pose_override(int p_bone, const Transform &p_pose, float p_amount, bool p_persistent) {
ERR_FAIL_INDEX(p_bone, bones.size());
@@ -909,6 +916,7 @@ void Skeleton::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_bone_pose", "bone_idx"), &Skeleton::get_bone_pose);
ClassDB::bind_method(D_METHOD("set_bone_pose", "bone_idx", "pose"), &Skeleton::set_bone_pose);
+ ClassDB::bind_method(D_METHOD("clear_bones_global_pose_override"), &Skeleton::clear_bones_global_pose_override);
ClassDB::bind_method(D_METHOD("set_bone_global_pose_override", "bone_idx", "pose", "amount", "persistent"), &Skeleton::set_bone_global_pose_override, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_bone_global_pose", "bone_idx"), &Skeleton::get_bone_global_pose);
diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h
index 76fd96f30a..11fc9fff2e 100644
--- a/scene/3d/skeleton.h
+++ b/scene/3d/skeleton.h
@@ -178,6 +178,7 @@ public:
Transform get_bone_rest(int p_bone) const;
Transform get_bone_global_pose(int p_bone) const;
+ void clear_bones_global_pose_override();
void set_bone_global_pose_override(int p_bone, const Transform &p_pose, float p_amount, bool p_persistent = false);
void set_bone_enabled(int p_bone, bool p_enabled);
diff --git a/scene/animation/skeleton_ik.cpp b/scene/animation/skeleton_ik.cpp
index 5cdb38b5c2..5800b41ae6 100644
--- a/scene/animation/skeleton_ik.cpp
+++ b/scene/animation/skeleton_ik.cpp
@@ -144,8 +144,9 @@ void FabrikInverseKinematic::update_chain(const Skeleton *p_sk, ChainItem *p_cha
p_chain_item->initial_transform = p_sk->get_bone_global_pose(p_chain_item->bone);
p_chain_item->current_pos = p_chain_item->initial_transform.origin;
- for (int i = p_chain_item->children.size() - 1; 0 <= i; --i) {
- update_chain(p_sk, &p_chain_item->children.write[i]);
+ ChainItem *items = p_chain_item->children.ptrw();
+ for (int i = 0; i < p_chain_item->children.size(); i += 1) {
+ update_chain(p_sk, items + i);
}
}
@@ -286,6 +287,8 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove
return; // Skip solving
}
+ p_task->skeleton->clear_bones_global_pose_override();
+
make_goal(p_task, p_task->skeleton->get_global_transform().affine_inverse().scaled(p_task->skeleton->get_global_transform().get_basis().get_scale()), blending_delta);
update_chain(p_task->skeleton, &p_task->chain.chain_root);
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index cbbad79811..a8b5ac6909 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -624,26 +624,33 @@ void ColorPicker::_screen_pick_pressed() {
}
void ColorPicker::_focus_enter() {
- if (c_text->has_focus()) {
+ bool has_ctext_focus = c_text->has_focus();
+ if (has_ctext_focus) {
c_text->select_all();
- return;
+ } else {
+ c_text->select(0, 0);
}
+
for (int i = 0; i < 4; i++) {
- if (values[i]->get_line_edit()->has_focus()) {
+ if (values[i]->get_line_edit()->has_focus() && !has_ctext_focus) {
values[i]->get_line_edit()->select_all();
- break;
+ } else {
+ values[i]->get_line_edit()->select(0, 0);
}
}
}
void ColorPicker::_focus_exit() {
for (int i = 0; i < 4; i++) {
- values[i]->get_line_edit()->select(0, 0);
+ if (!values[i]->get_line_edit()->get_menu()->is_visible())
+ values[i]->get_line_edit()->select(0, 0);
}
c_text->select(0, 0);
}
void ColorPicker::_html_focus_exit() {
+ if (c_text->get_menu()->is_visible())
+ return;
_html_entered(c_text->get_text());
_focus_exit();
}
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 73380c6b1b..7ee4dab3c9 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -307,7 +307,6 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->hide_virtual_keyboard();
- return;
} break;
case KEY_BACKSPACE: {
@@ -633,7 +632,7 @@ void LineEdit::drop_data(const Point2 &p_point, const Variant &p_data) {
Ref<Font> font = get_font("font");
if (font != NULL) {
for (int i = selection.begin; i < selection.end; i++)
- cached_width -= font->get_char_size(text[i]).width;
+ cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width;
}
text.erase(selection.begin, selected);
@@ -1093,11 +1092,7 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
int char_w = 0;
if (font != NULL) {
- if (is_secret()) {
- char_w = font->get_char_size(secret_character[0]).width;
- } else {
- char_w = font->get_char_size(text[ofs]).width;
- }
+ char_w = font->get_char_size(pass ? secret_character[0] : text[ofs]).width;
}
pixel_ofs += char_w;
@@ -1149,7 +1144,7 @@ int LineEdit::get_cursor_pixel_pos() {
while (ofs < cursor_pos) {
if (font != NULL) {
- pixel_ofs += font->get_char_size(text[ofs]).width;
+ pixel_ofs += font->get_char_size(pass ? secret_character[0] : text[ofs]).width;
}
ofs++;
}
@@ -1208,7 +1203,7 @@ void LineEdit::delete_char() {
Ref<Font> font = get_font("font");
if (font != NULL) {
- cached_width -= font->get_char_size(text[cursor_pos - 1]).width;
+ cached_width -= font->get_char_size(pass ? secret_character[0] : text[cursor_pos - 1]).width;
}
text.erase(cursor_pos - 1, 1);
@@ -1228,7 +1223,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
Ref<Font> font = get_font("font");
if (font != NULL) {
for (int i = p_from_column; i < p_to_column; i++)
- cached_width -= font->get_char_size(text[i]).width;
+ cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width;
}
} else {
cached_width = 0;
@@ -1352,7 +1347,11 @@ void LineEdit::set_cursor_position(int p_pos) {
// Do not do this, because if the cursor is at the end, its just fine that it takes no space.
// accum_width = font->get_char_size(' ').width;
} else {
- accum_width += font->get_char_size(text[i], i + 1 < text.length() ? text[i + 1] : 0).width; // Anything should do.
+ if (pass) {
+ accum_width += font->get_char_size(secret_character[0], i + 1 < text.length() ? secret_character[0] : 0).width;
+ } else {
+ accum_width += font->get_char_size(text[i], i + 1 < text.length() ? text[i + 1] : 0).width; // Anything should do.
+ }
}
if (accum_width > window_width)
break;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index bc1510d6f6..e4651ef473 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2507,7 +2507,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p
if (it->type == ITEM_TEXT) {
ItemText *t = static_cast<ItemText *>(it);
- int sp = t->text.find(p_string, charidx);
+ int sp = t->text.findn(p_string, charidx);
if (sp != -1) {
selection.from = it;
selection.from_char = sp;
diff --git a/scene/resources/canvas.cpp b/scene/resources/canvas.cpp
deleted file mode 100644
index 1dbd02ea28..0000000000
--- a/scene/resources/canvas.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*************************************************************************/
-/* canvas.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "canvas.h"
-#include "servers/visual_server.h"
-
-RID Canvas::get_rid() const {
-
- return canvas;
-}
-
-Canvas::Canvas() {
-
- canvas = VisualServer::get_singleton()->canvas_create();
-}
-
-Canvas::~Canvas() {
- VisualServer::get_singleton()->free(canvas);
-}
diff --git a/scene/resources/canvas.h b/scene/resources/canvas.h
deleted file mode 100644
index 621911fe0a..0000000000
--- a/scene/resources/canvas.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*************************************************************************/
-/* canvas.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef CANVAS_H
-#define CANVAS_H
-
-#include "core/resource.h"
-
-class Canvas : public Resource {
-
- GDCLASS(Canvas, Resource);
-
- RID canvas;
-
-public:
- virtual RID get_rid() const;
- Canvas();
- ~Canvas();
-};
-
-#endif // CANVAS_H
diff --git a/scene/resources/sky_material.cpp b/scene/resources/sky_material.cpp
index 5d8ceacbf2..c3e51460c6 100644
--- a/scene/resources/sky_material.cpp
+++ b/scene/resources/sky_material.cpp
@@ -293,6 +293,8 @@ ProceduralSkyMaterial::ProceduralSkyMaterial() {
}
ProceduralSkyMaterial::~ProceduralSkyMaterial() {
+ VS::get_singleton()->free(shader);
+ VS::get_singleton()->material_set_shader(_get_material(), RID());
}
/////////////////////////////////////////
diff --git a/scene/resources/space_2d.cpp b/scene/resources/space_2d.cpp
deleted file mode 100644
index 376e926548..0000000000
--- a/scene/resources/space_2d.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*************************************************************************/
-/* space_2d.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "space_2d.h"
-
-RID Space2D::get_rid() const {
-
- return space;
-}
-
-void Space2D::set_active(bool p_active) {
-
- active = p_active;
- Physics2DServer::get_singleton()->space_set_active(space, active);
-}
-
-bool Space2D::is_active() const {
-
- return active;
-}
-
-void Space2D::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("set_active", "active"), &Space2D::set_active);
- ClassDB::bind_method(D_METHOD("is_active"), &Space2D::is_active);
-
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "is_active");
-}
-
-Space2D::Space2D() {
-
- active = false;
- space = Physics2DServer::get_singleton()->space_create();
-}
-
-Space2D::~Space2D() {
-
- Physics2DServer::get_singleton()->free(space);
-}
diff --git a/scene/resources/space_2d.h b/scene/resources/space_2d.h
deleted file mode 100644
index ff88c40348..0000000000
--- a/scene/resources/space_2d.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*************************************************************************/
-/* space_2d.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef SPACE_2D_H
-#define SPACE_2D_H
-
-#include "core/resource.h"
-#include "servers/physics_2d_server.h"
-
-class Space2D : public Resource {
-
- GDCLASS(Space2D, Resource);
- bool active;
- RID space;
-
-protected:
- static void _bind_methods();
-
-public:
- void set_active(bool p_active);
- bool is_active() const;
-
- virtual RID get_rid() const;
-
- Space2D();
- ~Space2D();
-};
-
-#endif // SPACE_2D_H
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 407325c199..fecef88792 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1034,7 +1034,7 @@ bool VisualShader::_get(const StringName &p_name, Variant &r_ret) const {
void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
//mode
- p_list->push_back(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Spatial,CanvasItem,Particles"));
+ p_list->push_back(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Spatial,CanvasItem,Particles,Sky"));
//render modes
Map<String, String> blend_mode_enums;
@@ -1299,8 +1299,8 @@ void VisualShader::_update_shader() const {
StringBuilder code;
Vector<VisualShader::DefaultTextureParam> default_tex_params;
Set<StringName> classes;
- List<int> insertion_pos;
- static const char *shader_mode_str[Shader::MODE_MAX] = { "spatial", "canvas_item", "particles" };
+ Map<int, int> insertion_pos;
+ static const char *shader_mode_str[Shader::MODE_MAX] = { "spatial", "canvas_item", "particles", "sky" };
global_code += String() + "shader_type " + shader_mode_str[shader_mode] + ";\n";
@@ -1357,6 +1357,11 @@ void VisualShader::_update_shader() const {
String global_expressions;
for (int i = 0, index = 0; i < TYPE_MAX; i++) {
+
+ if (!ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader_mode)).has(func_name[i])) {
+ continue;
+ }
+
for (Map<int, Node>::Element *E = graph[i].nodes.front(); E; E = E->next()) {
Ref<VisualShaderNodeGlobalExpression> global_expression = Object::cast_to<VisualShaderNodeGlobalExpression>(E->get().node.ptr());
if (global_expression.is_valid()) {
@@ -1373,6 +1378,10 @@ void VisualShader::_update_shader() const {
for (int i = 0; i < TYPE_MAX; i++) {
+ if (!ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader_mode)).has(func_name[i])) {
+ continue;
+ }
+
//make it faster to go around through shader
VMap<ConnectionKey, const List<Connection>::Element *> input_connections;
VMap<ConnectionKey, const List<Connection>::Element *> output_connections;
@@ -1396,7 +1405,7 @@ void VisualShader::_update_shader() const {
Set<int> processed;
Error err = _write_node(Type(i), global_code, global_code_per_node, global_code_per_func, code, default_tex_params, input_connections, output_connections, NODE_ID_OUTPUT, processed, false, classes);
ERR_FAIL_COND(err != OK);
- insertion_pos.push_back(code.get_string_length());
+ insertion_pos.insert(i, code.get_string_length());
code += "}\n";
}
@@ -1408,6 +1417,9 @@ void VisualShader::_update_shader() const {
final_code += global_expressions;
String tcode = code;
for (int i = 0; i < TYPE_MAX; i++) {
+ if (!ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader_mode)).has(func_name[i])) {
+ continue;
+ }
tcode = tcode.insert(insertion_pos[i], global_code_per_func[Type(i)]);
}
final_code += tcode;
@@ -1643,6 +1655,38 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" },
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" },
+
+ // Sky, Fragment
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_BOOLEAN, "at_cubemap_pass", "AT_CUBEMAP_PASS" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_BOOLEAN, "at_half_res_pass", "AT_HALF_RES_PASS" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_BOOLEAN, "at_quarter_res_pass", "AT_QUARTER_RES_PASS" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "eyedir", "EYEDIR" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "half_res_color", "HALF_RES_COLOR.rgb" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "half_res_alpha", "HALF_RES_COLOR.a" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "light0_color", "LIGHT0_COLOR" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "light0_direction", "LIGHT0_DIRECTION" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_BOOLEAN, "light0_enabled", "LIGHT0_ENABLED" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "light0_energy", "LIGHT0_ENERGY" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "light1_color", "LIGHT1_COLOR" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "light1_direction", "LIGHT1_DIRECTION" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_BOOLEAN, "light1_enabled", "LIGHT1_ENABLED" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "light1_energy", "LIGHT1_ENERGY" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "light2_color", "LIGHT2_COLOR" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "light2_direction", "LIGHT2_DIRECTION" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_BOOLEAN, "light2_enabled", "LIGHT2_ENABLED" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "light2_energy", "LIGHT2_ENERGY" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "light3_color", "LIGHT3_COLOR" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "light3_direction", "LIGHT3_DIRECTION" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_BOOLEAN, "light3_enabled", "LIGHT3_ENABLED" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "light3_energy", "LIGHT3_ENERGY" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "position", "POSITION" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "quarter_res_color", "QUARTER_RES_COLOR.rgb" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "quarter_res_alpha", "QUARTER_RES_COLOR.a" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SAMPLER, "radiance", "RADIANCE" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "screen_uv", "vec3(SCREEN_UV, 0.0)" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "sky_coords", "vec3(SKY_COORDS, 0.0)" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" },
+
{ Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL },
};
@@ -1986,6 +2030,10 @@ const VisualShaderNodeOutput::Port VisualShaderNodeOutput::ports[] = {
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR, "custom", "CUSTOM.rgb" },
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "custom_alpha", "CUSTOM.a" },
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "transform", "TRANSFORM" },
+ // Sky, Fragment
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR" },
+ { Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "ALPHA" },
+
{ Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL },
};
diff --git a/servers/audio/reverb_sw.cpp b/servers/audio/reverb_sw.cpp
deleted file mode 100644
index 3bf0b0ea96..0000000000
--- a/servers/audio/reverb_sw.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-/*************************************************************************/
-/* reverb_sw.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "reverb_sw.h"
-
-#include "core/print_string.h"
-
-#include <stdlib.h>
-
-#define SETMIN(x, y) (x) = MIN((x), (y))
-
-#define rangeloop(c, min, max) \
- for ((c) = (min); (c) < (max); (c)++)
-
-#define MULSHIFT_S32(Factor1, Factor2, Bits) \
- ((int)(((int64_t)(Factor1) * (Factor2)) >> (Bits)))
-
-struct ReverbParamsSW {
- unsigned int BufferSize; // Required buffer size
- int gLPF; // Coefficient
- int gEcho0; // Coefficient
- int gEcho1; // Coefficient
- int gEcho2; // Coefficient
- int gEcho3; // Coefficient
- int gWall; // Coefficient
- int gReva; // Coefficient
- int gRevb; // Coefficient
- int gInputL; // Coefficient
- int gInputR; // Coefficient
- unsigned int nRevaOldL; // Offset
- unsigned int nRevaOldR; // Offset
- unsigned int nRevbOldL; // Offset
- unsigned int nRevbOldR; // Offset
- unsigned int nLwlNew; // Offset
- unsigned int nRwrNew; // Offset
- unsigned int nEcho0L; // Offset
- unsigned int nEcho0R; // Offset
- unsigned int nEcho1L; // Offset
- unsigned int nEcho1R; // Offset
- unsigned int nLwlOld; // Offset
- unsigned int nRwrOld; // Offset
- unsigned int nLwrNew; // Offset
- unsigned int nRwlNew; // Offset
- unsigned int nEcho2L; // Offset
- unsigned int nEcho2R; // Offset
- unsigned int nEcho3L; // Offset
- unsigned int nEcho3R; // Offset
- unsigned int nLwrOld; // Offset
- unsigned int nRwlOld; // Offset
- unsigned int nRevaNewL; // Offset
- unsigned int nRevaNewR; // Offset
- unsigned int nRevbNewL; // Offset
- unsigned int nRevbNewR; // Offset
-};
-
-static ReverbParamsSW reverb_params_Room = {
- 0x26C0 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x6D80, 0x54B8, -0x4130, 0x0000, 0x0000, -0x4580,
- //gReva gRevb gInputL gInputR
- 0x5800, 0x5300, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x01B4 - 0x007D, 0x0136 - 0x007D, 0x00B8 - 0x005B, 0x005C - 0x005B,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x04D6, 0x0333, 0x03F0, 0x0227, 0x0374, 0x01EF,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x0334, 0x01B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x0000, 0x0000, 0x01B4, 0x0136, 0x00B8, 0x005C
-};
-
-static ReverbParamsSW reverb_params_StudioSmall = {
- 0x1F40 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x70F0, 0x4FA8, -0x4320, 0x4410, -0x3F10, -0x6400,
- //gReva gRevb gInputL gInputR
- 0x5280, 0x4EC0, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x00B4 - 0x0033, 0x0080 - 0x0033, 0x004C - 0x0025, 0x0026 - 0x0025,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x03E4, 0x031B, 0x03A4, 0x02AF, 0x0372, 0x0266,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x031C, 0x025D, 0x025C, 0x018E, 0x022F, 0x0135, 0x01D2, 0x00B7,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x018F, 0x00B5, 0x00B4, 0x0080, 0x004C, 0x0026
-};
-
-static ReverbParamsSW reverb_params_StudioMedium = {
- 0x4840 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x70F0, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x4B40,
- //gReva gRevb gInputL gInputR
- 0x5280, 0x4EC0, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x0264 - 0x00B1, 0x01B2 - 0x00B1, 0x0100 - 0x007F, 0x0080 - 0x007F,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x0904, 0x076B, 0x0824, 0x065F, 0x07A2, 0x0616,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x076C, 0x05ED, 0x05EC, 0x042E, 0x050F, 0x0305, 0x0462, 0x02B7,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x042F, 0x0265, 0x0264, 0x01B2, 0x0100, 0x0080
-};
-
-static ReverbParamsSW reverb_params_StudioLarge = {
- 0x6FE0 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x6F60, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x5980,
- //gReva gRevb gInputL gInputR
- 0x5680, 0x52C0, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x031C - 0x00E3, 0x0238 - 0x00E3, 0x0154 - 0x00A9, 0x00AA - 0x00A9,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x0DFB, 0x0B58, 0x0D09, 0x0A3C, 0x0BD9, 0x0973,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x0B59, 0x08DA, 0x08D9, 0x05E9, 0x07EC, 0x04B0, 0x06EF, 0x03D2,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x05EA, 0x031D, 0x031C, 0x0238, 0x0154, 0x00AA
-};
-
-static ReverbParamsSW reverb_params_Hall = {
- 0xADE0 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x6000, 0x5000, 0x4C00, -0x4800, -0x4400, -0x4000,
- //gReva gRevb gInputL gInputR
- 0x6000, 0x5C00, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x05C0 - 0x01A5, 0x041A - 0x01A5, 0x0274 - 0x0139, 0x013A - 0x0139,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x15BA, 0x11BB, 0x14C2, 0x10BD, 0x11BC, 0x0DC1,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x11C0, 0x0DC3, 0x0DC0, 0x09C1, 0x0BC4, 0x07C1, 0x0A00, 0x06CD,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x09C2, 0x05C1, 0x05C0, 0x041A, 0x0274, 0x013A
-};
-
-static ReverbParamsSW reverb_params_SpaceEcho = {
- 0xF6C0 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x7E00, 0x5000, -0x4C00, -0x5000, 0x4C00, -0x5000,
- //gReva gRevb gInputL gInputR
- 0x6000, 0x5400, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x0AE0 - 0x033D, 0x07A2 - 0x033D, 0x0464 - 0x0231, 0x0232 - 0x0231,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x1ED6, 0x1A31, 0x1D14, 0x183B, 0x1BC2, 0x16B2,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x1A32, 0x15EF, 0x15EE, 0x1055, 0x1334, 0x0F2D, 0x11F6, 0x0C5D,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x1056, 0x0AE1, 0x0AE0, 0x07A2, 0x0464, 0x0232
-};
-
-static ReverbParamsSW reverb_params_Echo = {
- 0x18040 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x7FFF, 0x7FFF, 0x0000, 0x0000, 0x0000, -0x7F00,
- //gReva gRevb gInputL gInputR
- 0x0000, 0x0000, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x1004 - 0x0001, 0x1002 - 0x0001, 0x0004 - 0x0001, 0x0002 - 0x0001,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x1FFF, 0x0FFF, 0x1005, 0x0005, 0x0000, 0x0000,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x1005, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x0000, 0x0000, 0x1004, 0x1002, 0x0004, 0x0002
-};
-
-static ReverbParamsSW reverb_params_Delay = {
- 0x18040 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x7FFF, 0x7FFF, 0x0000, 0x0000, 0x0000, 0x0000,
- //gReva gRevb gInputL gInputR
- 0x0000, 0x0000, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x1004 - 0x0001, 0x1002 - 0x0001, 0x0004 - 0x0001, 0x0002 - 0x0001,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x1FFF, 0x0FFF, 0x1005, 0x0005, 0x0000, 0x0000,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x1005, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x0000, 0x0000, 0x1004, 0x1002, 0x0004, 0x0002
-};
-
-static ReverbParamsSW reverb_params_HalfEcho = {
- 0x3C00 / 2,
- //gLPF gEcho0 gEcho1 gEcho2 gEcho3 gWall
- 0x70F0, 0x4FA8, -0x4320, 0x4510, -0x4110, -0x7B00,
- //gReva gRevb gInputL gInputR
- 0x5F80, 0x54C0, -0x8000, -0x8000,
- //nRevaOldL nRevaOldR nRevbOldL nRevbOldR
- 0x0058 - 0x0017, 0x0040 - 0x0017, 0x0028 - 0x0013, 0x0014 - 0x0013,
- //nLwlNew nRwrNew nEcho0L nEcho0R nEcho1L nEcho1R
- 0x0371, 0x02AF, 0x02E5, 0x01DF, 0x02B0, 0x01D7,
- //nLwlOld nRwrOld nLwrNew nRwlNew nEcho2L nEcho2R nEcho3L nEcho3R
- 0x0358, 0x026A, 0x01D6, 0x011E, 0x012D, 0x00B1, 0x011F, 0x0059,
- //nLwrOld nRwlOld nRevaNewL nRevaNewR nRevbNewL nRevbNewR
- 0x01A0, 0x00E3, 0x0058, 0x0040, 0x0028, 0x0014
-};
-
-static ReverbParamsSW *reverb_param_modes[] = {
- &reverb_params_Room,
- &reverb_params_StudioSmall,
- &reverb_params_StudioMedium,
- &reverb_params_StudioLarge,
- &reverb_params_Hall,
- &reverb_params_SpaceEcho,
- &reverb_params_Echo,
- &reverb_params_Delay,
- &reverb_params_HalfEcho,
-};
-
-bool ReverbSW::process(int *p_input, int *p_output, int p_frames, int p_stereo_stride) {
-
- // p_input must point to a non-looping buffer.
- // BOTH p_input and p_output must be touched (use ClearModuleBuffer).
-
- if (!reverb_buffer)
- return false;
-
-// LOCAL MACROS
-#undef LM_SETSRCOFFSET
-#define LM_SETSRCOFFSET(x) \
- (x) = current_params->x + Offset; \
- if ((x) >= reverb_buffer_size) { \
- (x) -= reverb_buffer_size; \
- } \
- SETMIN(aSample, reverb_buffer_size - (x));
-
-/*
-#undef LM_SETSRCOFFSET2
-#define LM_SETSRCOFFSET2(x,y) \
- (x) = ((y) << 3) >> HZShift; \
- (x) += Offset; \
- if ( (x) >= reverb_buffer_size ) { \
- (x) -= reverb_buffer_size; \
- } \
- SETMIN ( aSample, reverb_buffer_size - (x) );
-*/
-#undef LM_SRCADVANCE
-#define LM_SRCADVANCE(x) \
- (x) += aSample;
-
-#undef LM_MUL
-#define LM_MUL(x, y) \
- MULSHIFT_S32(x, current_params->y, 15)
-
-#undef LM_REVERB
-#define LM_REVERB(x) reverb_buffer[(x) + cSample]
-
- // LOCAL VARIABLES
-
- unsigned int Offset;
-
- int lwl, lwr, rwl, rwr;
- //unsigned char HZShift;
-
- // CODE
-
- lwl = state.lwl;
- lwr = state.lwr;
- rwl = state.rwl;
- rwr = state.rwr;
- Offset = state.Offset;
-
- int max = 0;
-
- while (p_frames) {
-
- // Offsets
-
- unsigned int nLwlOld;
- unsigned int nRwrOld;
- unsigned int nLwlNew;
- unsigned int nRwrNew;
-
- unsigned int nLwrOld;
- unsigned int nRwlOld;
- unsigned int nLwrNew;
- unsigned int nRwlNew;
-
- unsigned int nEcho0L;
- unsigned int nEcho1L;
- unsigned int nEcho2L;
- unsigned int nEcho3L;
-
- unsigned int nEcho0R;
- unsigned int nEcho1R;
- unsigned int nEcho2R;
- unsigned int nEcho3R;
-
- unsigned int nRevaOldL;
- unsigned int nRevaOldR;
- unsigned int nRevbOldL;
- unsigned int nRevbOldR;
-
- unsigned int nRevaNewL;
- unsigned int nRevaNewR;
- unsigned int nRevbNewL;
- unsigned int nRevbNewR;
-
- // Other variables
-
- unsigned int aSample = p_frames;
-
- // Set initial offsets
-
- LM_SETSRCOFFSET(nLwlOld);
- LM_SETSRCOFFSET(nRwrOld);
- LM_SETSRCOFFSET(nLwlNew);
- LM_SETSRCOFFSET(nRwrNew);
- LM_SETSRCOFFSET(nLwrOld);
- LM_SETSRCOFFSET(nRwlOld);
- LM_SETSRCOFFSET(nLwrNew);
- LM_SETSRCOFFSET(nRwlNew);
- LM_SETSRCOFFSET(nEcho0L);
- LM_SETSRCOFFSET(nEcho1L);
- LM_SETSRCOFFSET(nEcho2L);
- LM_SETSRCOFFSET(nEcho3L);
- LM_SETSRCOFFSET(nEcho0R);
- LM_SETSRCOFFSET(nEcho1R);
- LM_SETSRCOFFSET(nEcho2R);
- LM_SETSRCOFFSET(nEcho3R);
- LM_SETSRCOFFSET(nRevaOldL);
- LM_SETSRCOFFSET(nRevaOldR);
- LM_SETSRCOFFSET(nRevbOldL);
- LM_SETSRCOFFSET(nRevbOldR);
- LM_SETSRCOFFSET(nRevaNewL);
- LM_SETSRCOFFSET(nRevaNewR);
- LM_SETSRCOFFSET(nRevbNewL);
- LM_SETSRCOFFSET(nRevbNewR);
-
- //SETMIN ( aSample, p_output.Size - p_output.Offset );
-
- for (unsigned int cSample = 0; cSample < aSample; cSample++) {
-
- int tempL0, tempL1, tempR0, tempR1;
-
- tempL1 = p_input[(cSample << p_stereo_stride)] >> 8;
- tempR1 = p_input[(cSample << p_stereo_stride) + 1] >> 8;
-
- tempL0 = LM_MUL(tempL1, gInputL);
- tempR0 = LM_MUL(tempR1, gInputR);
-
- /*
- Left -> Wall -> Left Reflection
- */
- tempL1 = tempL0 + LM_MUL(LM_REVERB(nLwlOld), gWall);
- tempR1 = tempR0 + LM_MUL(LM_REVERB(nRwrOld), gWall);
- lwl += LM_MUL(tempL1 - lwl, gLPF);
- rwr += LM_MUL(tempR1 - rwr, gLPF);
- LM_REVERB(nLwlNew) = lwl;
- LM_REVERB(nRwrNew) = rwr;
- /*
- Left -> Wall -> Right Reflection
- */
- tempL1 = tempL0 + LM_MUL(LM_REVERB(nRwlOld), gWall);
- tempR1 = tempR0 + LM_MUL(LM_REVERB(nLwrOld), gWall);
- lwr += LM_MUL(tempL1 - lwr, gLPF);
- rwl += LM_MUL(tempR1 - rwl, gLPF);
- LM_REVERB(nLwrNew) = lwr;
- LM_REVERB(nRwlNew) = rwl;
- /*
- Early Echo(Early Reflection)
- */
- tempL0 =
- LM_MUL(LM_REVERB(nEcho0L), gEcho0) +
- LM_MUL(LM_REVERB(nEcho1L), gEcho1) +
- LM_MUL(LM_REVERB(nEcho2L), gEcho2) +
- LM_MUL(LM_REVERB(nEcho3L), gEcho3);
- tempR0 =
- LM_MUL(LM_REVERB(nEcho0R), gEcho0) +
- LM_MUL(LM_REVERB(nEcho1R), gEcho1) +
- LM_MUL(LM_REVERB(nEcho2R), gEcho2) +
- LM_MUL(LM_REVERB(nEcho3R), gEcho3);
- /*
- Late Reverb
- */
- tempL1 = LM_REVERB(nRevaOldL);
- tempR1 = LM_REVERB(nRevaOldR);
- tempL0 -= LM_MUL(tempL1, gReva);
- tempR0 -= LM_MUL(tempR1, gReva);
- LM_REVERB(nRevaNewL) = tempL0;
- LM_REVERB(nRevaNewR) = tempR0;
- tempL0 = LM_MUL(tempL0, gReva) + tempL1;
- tempR0 = LM_MUL(tempR0, gReva) + tempR1;
- tempL1 = LM_REVERB(nRevbOldL);
- tempR1 = LM_REVERB(nRevbOldR);
- tempL0 -= LM_MUL(tempL1, gRevb);
- tempR0 -= LM_MUL(tempR1, gRevb);
- LM_REVERB(nRevbNewL) = tempL0;
- LM_REVERB(nRevbNewR) = tempR0;
- tempL0 = LM_MUL(tempL0, gRevb) + tempL1;
- tempR0 = LM_MUL(tempR0, gRevb) + tempR1;
- /*
- Output
- */
-
- max |= abs(tempL0);
- max |= abs(tempR0);
-
- p_output[(cSample << p_stereo_stride)] += tempL0 << 8;
- p_output[(cSample << p_stereo_stride) + 1] += tempR0 << 8;
- }
-
- // Advance offsets
-
- Offset += aSample;
- if (Offset >= reverb_buffer_size) {
- Offset -= reverb_buffer_size;
- }
-
- p_input += aSample << p_stereo_stride;
- p_output += aSample << p_stereo_stride;
-
- p_frames -= aSample;
- }
-
- state.lwl = lwl;
- state.lwr = lwr;
- state.rwl = rwl;
- state.rwr = rwr;
- state.Offset = Offset;
-
- return (max & 0x7FFFFF00) != 0; // audio was mixed?
-}
-
-void ReverbSW::adjust_current_params() {
-
- *current_params = *reverb_param_modes[mode];
-
- uint32_t maxofs = 0;
-
-#define LM_CONFIG_PARAM(x) \
- current_params->x = (int)(((int64_t)current_params->x * (int64_t)mix_rate * 8L) / (int64_t)44100); \
- if (current_params->x > maxofs) \
- maxofs = current_params->x;
-
- LM_CONFIG_PARAM(nLwlOld);
- LM_CONFIG_PARAM(nRwrOld);
- LM_CONFIG_PARAM(nLwlNew);
- LM_CONFIG_PARAM(nRwrNew);
- LM_CONFIG_PARAM(nLwrOld);
- LM_CONFIG_PARAM(nRwlOld);
- LM_CONFIG_PARAM(nLwrNew);
- LM_CONFIG_PARAM(nRwlNew);
- LM_CONFIG_PARAM(nEcho0L);
- LM_CONFIG_PARAM(nEcho1L);
- LM_CONFIG_PARAM(nEcho2L);
- LM_CONFIG_PARAM(nEcho3L);
- LM_CONFIG_PARAM(nEcho0R);
- LM_CONFIG_PARAM(nEcho1R);
- LM_CONFIG_PARAM(nEcho2R);
- LM_CONFIG_PARAM(nEcho3R);
- LM_CONFIG_PARAM(nRevaOldL);
- LM_CONFIG_PARAM(nRevaOldR);
- LM_CONFIG_PARAM(nRevbOldL);
- LM_CONFIG_PARAM(nRevbOldR);
- LM_CONFIG_PARAM(nRevaNewL);
- LM_CONFIG_PARAM(nRevaNewR);
- LM_CONFIG_PARAM(nRevbNewL);
- LM_CONFIG_PARAM(nRevbNewR);
-
- int needed_buffer_size = maxofs + 1;
- if (reverb_buffer)
- memdelete_arr(reverb_buffer);
-
- reverb_buffer = memnew_arr(int, needed_buffer_size);
- reverb_buffer_size = needed_buffer_size;
-
- for (uint32_t i = 0; i < reverb_buffer_size; i++)
- reverb_buffer[i] = 0;
-
- state.reset();
-}
-
-void ReverbSW::set_mode(ReverbMode p_mode) {
-
- if (mode == p_mode)
- return;
-
- mode = p_mode;
-
- adjust_current_params();
-}
-
-void ReverbSW::set_mix_rate(int p_mix_rate) {
-
- if (p_mix_rate == mix_rate)
- return;
-
- mix_rate = p_mix_rate;
-
- adjust_current_params();
-}
-
-ReverbSW::ReverbSW() {
-
- reverb_buffer = 0;
- reverb_buffer_size = 0;
- mode = REVERB_MODE_ROOM;
- mix_rate = 1;
- current_params = memnew(ReverbParamsSW);
-}
-
-ReverbSW::~ReverbSW() {
-
- if (reverb_buffer)
- memdelete_arr(reverb_buffer);
-
- memdelete(current_params);
-}
diff --git a/servers/audio/reverb_sw.h b/servers/audio/reverb_sw.h
deleted file mode 100644
index 13c63e602a..0000000000
--- a/servers/audio/reverb_sw.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************/
-/* reverb_sw.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef REVERB_SW_H
-#define REVERB_SW_H
-
-#include "core/os/memory.h"
-#include "core/typedefs.h"
-
-struct ReverbParamsSW;
-
-class ReverbSW {
-public:
- enum ReverbMode {
- REVERB_MODE_ROOM,
- REVERB_MODE_STUDIO_SMALL,
- REVERB_MODE_STUDIO_MEDIUM,
- REVERB_MODE_STUDIO_LARGE,
- REVERB_MODE_HALL,
- REVERB_MODE_SPACE_ECHO,
- REVERB_MODE_ECHO,
- REVERB_MODE_DELAY,
- REVERB_MODE_HALF_ECHO
- };
-
-private:
- struct State {
- int lwl;
- int lwr;
- int rwl;
- int rwr;
- unsigned int Offset;
- void reset() {
- lwl = 0;
- lwr = 0;
- rwl = 0;
- rwr = 0;
- Offset = 0;
- }
- State() { reset(); }
- } state;
-
- ReverbParamsSW *current_params;
-
- int *reverb_buffer;
- unsigned int reverb_buffer_size;
- ReverbMode mode;
- int mix_rate;
-
- void adjust_current_params();
-
-public:
- void set_mode(ReverbMode p_mode);
- bool process(int *p_input, int *p_output, int p_frames, int p_stereo_stride = 1); // return tru if audio was created
- void set_mix_rate(int p_mix_rate);
-
- ReverbSW();
- ~ReverbSW();
-};
-
-#endif
diff --git a/servers/audio/voice_rb_sw.h b/servers/audio/voice_rb_sw.h
deleted file mode 100644
index c51076035c..0000000000
--- a/servers/audio/voice_rb_sw.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*************************************************************************/
-/* voice_rb_sw.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef VOICE_RB_SW_H
-#define VOICE_RB_SW_H
-
-#include "core/os/os.h"
-#include "servers/audio_server.h"
-class VoiceRBSW {
-public:
- enum {
- VOICE_RB_SIZE = 1024
- };
-
- struct Command {
-
- enum Type {
- CMD_NONE,
- CMD_PLAY,
- CMD_STOP,
- CMD_SET_VOLUME,
- CMD_SET_PAN,
- CMD_SET_FILTER,
- CMD_SET_CHORUS,
- CMD_SET_REVERB,
- CMD_SET_MIX_RATE,
- CMD_SET_POSITIONAL,
- CMD_CHANGE_ALL_FX_VOLUMES
- };
-
- Type type;
- RID voice;
-
- struct {
-
- RID sample;
-
- } play;
-
- union {
-
- struct {
-
- float volume;
- } volume;
-
- struct {
-
- float pan, depth, height;
- } pan;
-
- struct {
-
- AS::FilterType type;
- float cutoff;
- float resonance;
- float gain;
- } filter;
-
- struct {
- float send;
- } chorus;
- struct {
- float send;
- AS::ReverbRoomType room;
- } reverb;
-
- struct {
-
- int mix_rate;
- } mix_rate;
-
- struct {
-
- bool positional;
- } positional;
- };
-
- Command() { type = CMD_NONE; }
- };
-
-private:
- Command voice_cmd_rb[VOICE_RB_SIZE];
- volatile int read_pos;
- volatile int write_pos;
-
-public:
- _FORCE_INLINE_ bool commands_left() const { return read_pos != write_pos; }
- _FORCE_INLINE_ Command pop_command() {
- ERR_FAIL_COND_V(read_pos == write_pos, Command());
- Command cmd = voice_cmd_rb[read_pos];
- read_pos = (read_pos + 1) % VOICE_RB_SIZE;
- return cmd;
- }
- _FORCE_INLINE_ void push_command(const Command &p_command) {
-
- bool full = ((write_pos + 1) % VOICE_RB_SIZE) == read_pos;
- if (full) {
-#ifdef DEBUG_ENABLED
- if (OS::get_singleton()->is_stdout_verbose()) {
- ERR_FAIL_COND_MSG(((write_pos + 1) % VOICE_RB_SIZE) == read_pos, "Audio ring buffer full (too many commands).");
- }
-#endif
- return;
- }
-
- voice_cmd_rb[write_pos] = p_command;
- write_pos = (write_pos + 1) % VOICE_RB_SIZE;
- }
-
- VoiceRBSW() { read_pos = write_pos = 0; }
-};
-
-#endif // VOICE_RB_SW_H
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
index 41682d3135..395b73ca9b 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -410,16 +410,18 @@ RID RasterizerSceneRD::_get_sky_textures(Sky *p_sky, SkyTextureSetVersion p_vers
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 1; // half res
- if (p_sky->half_res_pass.is_valid() && (p_version != SKY_TEXTURE_SET_HALF_RES) && (p_version < SKY_TEXTURE_SET_CUBEMAP_HALF_RES0 || p_version > SKY_TEXTURE_SET_CUBEMAP_HALF_RES5)) {
- if (p_version >= SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0) {
- u.ids.push_back(p_sky->reflection.layers[0].mipmaps[1].views[p_version - SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0]);
- } else if (p_version >= SKY_TEXTURE_SET_CUBEMAP0) {
- u.ids.push_back(p_sky->reflection.layers[0].mipmaps[1].views[p_version - SKY_TEXTURE_SET_CUBEMAP0]);
+ if (p_sky->half_res_pass.is_valid() && p_version != SKY_TEXTURE_SET_HALF_RES && p_version != SKY_TEXTURE_SET_CUBEMAP_HALF_RES) {
+ if (p_version >= SKY_TEXTURE_SET_CUBEMAP) {
+ u.ids.push_back(p_sky->reflection.layers[0].views[1]);
} else {
u.ids.push_back(p_sky->half_res_pass);
}
} else {
- u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ if (p_version < SKY_TEXTURE_SET_CUBEMAP) {
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ } else {
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_CUBEMAP_BLACK));
+ }
}
uniforms.push_back(u);
}
@@ -427,16 +429,18 @@ RID RasterizerSceneRD::_get_sky_textures(Sky *p_sky, SkyTextureSetVersion p_vers
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 2; // quarter res
- if (p_sky->quarter_res_pass.is_valid() && (p_version != SKY_TEXTURE_SET_QUARTER_RES) && (p_version < SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0 || p_version > SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES5)) {
- if (p_version >= SKY_TEXTURE_SET_CUBEMAP_HALF_RES0) {
- u.ids.push_back(p_sky->reflection.layers[0].mipmaps[2].views[p_version - SKY_TEXTURE_SET_CUBEMAP_HALF_RES0]);
- } else if (p_version >= SKY_TEXTURE_SET_CUBEMAP0) {
- u.ids.push_back(p_sky->reflection.layers[0].mipmaps[2].views[p_version - SKY_TEXTURE_SET_CUBEMAP0]);
+ if (p_sky->quarter_res_pass.is_valid() && p_version != SKY_TEXTURE_SET_QUARTER_RES && p_version != SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES) {
+ if (p_version >= SKY_TEXTURE_SET_CUBEMAP) {
+ u.ids.push_back(p_sky->reflection.layers[0].views[2]);
} else {
u.ids.push_back(p_sky->quarter_res_pass);
}
} else {
- u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ if (p_version < SKY_TEXTURE_SET_CUBEMAP) {
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
+ } else {
+ u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_CUBEMAP_BLACK));
+ }
}
uniforms.push_back(u);
}
@@ -733,7 +737,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
cm = correction * cm;
if (shader_data->uses_quarter_res) {
- RenderPipelineVertexFormatCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_QUARTER_RES];
+ RenderPipelineVertexFormatCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_CUBEMAP_QUARTER_RES];
Vector<Color> clear_colors;
clear_colors.push_back(Color(0.0, 0.0, 0.0));
@@ -742,7 +746,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
for (int i = 0; i < 6; i++) {
Transform local_view;
local_view.set_look_at(Vector3(0, 0, 0), view_normals[i], view_up[i]);
- RID texture_uniform_set = _get_sky_textures(sky, SkyTextureSetVersion(SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0 + i));
+ RID texture_uniform_set = _get_sky_textures(sky, SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[2].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
storage->get_effects()->render_sky(cubemap_draw_list, time, sky->reflection.layers[0].mipmaps[2].framebuffers[i], sky_scene_state.sampler_uniform_set, sky_scene_state.light_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
@@ -751,7 +755,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
}
if (shader_data->uses_half_res) {
- RenderPipelineVertexFormatCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_HALF_RES];
+ RenderPipelineVertexFormatCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_CUBEMAP_HALF_RES];
Vector<Color> clear_colors;
clear_colors.push_back(Color(0.0, 0.0, 0.0));
@@ -760,7 +764,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
for (int i = 0; i < 6; i++) {
Transform local_view;
local_view.set_look_at(Vector3(0, 0, 0), view_normals[i], view_up[i]);
- RID texture_uniform_set = _get_sky_textures(sky, SkyTextureSetVersion(SKY_TEXTURE_SET_CUBEMAP_HALF_RES0 + i));
+ RID texture_uniform_set = _get_sky_textures(sky, SKY_TEXTURE_SET_CUBEMAP_HALF_RES);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[1].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
storage->get_effects()->render_sky(cubemap_draw_list, time, sky->reflection.layers[0].mipmaps[1].framebuffers[i], sky_scene_state.sampler_uniform_set, sky_scene_state.light_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
@@ -774,7 +778,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
for (int i = 0; i < 6; i++) {
Transform local_view;
local_view.set_look_at(Vector3(0, 0, 0), view_normals[i], view_up[i]);
- RID texture_uniform_set = _get_sky_textures(sky, SkyTextureSetVersion(SKY_TEXTURE_SET_CUBEMAP0 + i));
+ RID texture_uniform_set = _get_sky_textures(sky, SKY_TEXTURE_SET_CUBEMAP);
cubemap_draw_list = RD::get_singleton()->draw_list_begin(sky->reflection.layers[0].mipmaps[0].framebuffers[i], RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD);
storage->get_effects()->render_sky(cubemap_draw_list, time, sky->reflection.layers[0].mipmaps[0].framebuffers[i], sky_scene_state.sampler_uniform_set, sky_scene_state.light_uniform_set, pipeline, material->uniform_set, texture_uniform_set, cm, local_view.basis, multiplier, p_transform.origin);
@@ -829,9 +833,6 @@ void RasterizerSceneRD::SkyShaderData::set_code(const String &p_code) {
actions.render_mode_flags["use_half_res_pass"] = &uses_half_res;
actions.render_mode_flags["use_quarter_res_pass"] = &uses_quarter_res;
- // TODO: Consider using usage flags instead
- //actions.usage_flag_pointers["HALF_RES_TEXTURE"] = &uses_half_res;
- //actions.usage_flag_pointers["QUARTER_RES_TEXTURE"] = &uses_quarter_res;
actions.usage_flag_pointers["TIME"] = &uses_time;
actions.usage_flag_pointers["POSITION"] = &uses_position;
@@ -3905,10 +3906,12 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
// Initialize sky
Vector<String> sky_modes;
- sky_modes.push_back("\n#define AT_CUBEMAP_PASS false\n#define AT_HALF_RES_PASS false\n#define AT_QUARTER_RES_PASS false\n"); // Full size
- sky_modes.push_back("\n#define AT_CUBEMAP_PASS false\n#define AT_HALF_RES_PASS true\n#define AT_QUARTER_RES_PASS false\n"); // Half Res
- sky_modes.push_back("\n#define AT_CUBEMAP_PASS false\n#define AT_HALF_RES_PASS false\n#define AT_QUARTER_RES_PASS true\n"); // Quarter res
- sky_modes.push_back("\n#define AT_CUBEMAP_PASS true\n#define AT_HALF_RES_PASS false\n#define AT_QUARTER_RES_PASS false\n"); // Cubemap
+ sky_modes.push_back(""); // Full size
+ sky_modes.push_back("\n#define USE_HALF_RES_PASS\n"); // Half Res
+ sky_modes.push_back("\n#define USE_QUARTER_RES_PASS\n"); // Quarter res
+ sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n"); // Cubemap
+ sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n#define USE_HALF_RES_PASS\n"); // Half Res Cubemap
+ sky_modes.push_back("\n#define USE_CUBEMAP_PASS\n#define USE_QUARTER_RES_PASS\n"); // Quarter res Cubemap
sky_shader.shader.initialize(sky_modes, defines);
}
@@ -3926,8 +3929,8 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
actions.renames["SKY_COORDS"] = "panorama_coords";
actions.renames["SCREEN_UV"] = "uv";
actions.renames["TIME"] = "params.time";
- actions.renames["HALF_RES_TEXTURE"] = "half_res";
- actions.renames["QUARTER_RES_TEXTURE"] = "quarter_res";
+ actions.renames["HALF_RES_COLOR"] = "half_res_color";
+ actions.renames["QUARTER_RES_COLOR"] = "quarter_res_color";
actions.renames["RADIANCE"] = "radiance";
actions.renames["LIGHT0_ENABLED"] = "directional_lights.data[0].enabled";
actions.renames["LIGHT0_DIRECTION"] = "directional_lights.data[0].direction";
@@ -3949,8 +3952,8 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
actions.renames["AT_HALF_RES_PASS"] = "AT_HALF_RES_PASS";
actions.renames["AT_QUARTER_RES_PASS"] = "AT_QUARTER_RES_PASS";
actions.custom_samplers["RADIANCE"] = "material_samplers[3]";
- actions.custom_samplers["SUBPASS2"] = "material_samplers[1]";
- actions.custom_samplers["SUBPASS4"] = "material_samplers[1]";
+ actions.usage_defines["HALF_RES_COLOR"] = "\n#define USES_HALF_RES_COLOR\n";
+ actions.usage_defines["QUARTER_RES_COLOR"] = "\n#define USES_QUARTER_RES_COLOR\n";
actions.sampler_array_name = "material_samplers";
actions.base_texture_binding_index = 1;
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.h b/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
index e779854327..7332f93dc5 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
@@ -149,6 +149,8 @@ private:
SKY_VERSION_HALF_RES,
SKY_VERSION_QUARTER_RES,
SKY_VERSION_CUBEMAP,
+ SKY_VERSION_CUBEMAP_HALF_RES,
+ SKY_VERSION_CUBEMAP_QUARTER_RES,
SKY_VERSION_MAX
};
@@ -222,24 +224,9 @@ private:
SKY_TEXTURE_SET_BACKGROUND,
SKY_TEXTURE_SET_HALF_RES,
SKY_TEXTURE_SET_QUARTER_RES,
- SKY_TEXTURE_SET_CUBEMAP0,
- SKY_TEXTURE_SET_CUBEMAP1,
- SKY_TEXTURE_SET_CUBEMAP2,
- SKY_TEXTURE_SET_CUBEMAP3,
- SKY_TEXTURE_SET_CUBEMAP4,
- SKY_TEXTURE_SET_CUBEMAP5,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES0,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES1,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES2,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES3,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES4,
- SKY_TEXTURE_SET_CUBEMAP_HALF_RES5,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES0,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES1,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES2,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES3,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES4,
- SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES5,
+ SKY_TEXTURE_SET_CUBEMAP,
+ SKY_TEXTURE_SET_CUBEMAP_HALF_RES,
+ SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES,
SKY_TEXTURE_SET_MAX
};
diff --git a/servers/visual/rasterizer_rd/shader_rd.cpp b/servers/visual/rasterizer_rd/shader_rd.cpp
index 857a29f7f4..74edaee983 100644
--- a/servers/visual/rasterizer_rd/shader_rd.cpp
+++ b/servers/visual/rasterizer_rd/shader_rd.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "shader_rd.h"
+
#include "core/string_builder.h"
#include "rasterizer_rd.h"
#include "servers/visual/rendering_device.h"
diff --git a/servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl b/servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl
index e0b0899dfa..193d0a8a3c 100644
--- a/servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl
+++ b/servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl
@@ -94,35 +94,36 @@ void main() {
// determine which texel this is
#ifndef USE_TEXTURE_ARRAY
- int level = 0;
+ // NOTE (macOS/MoltenVK): Do not rename, "level" variable name conflicts with the Metal "level(float lod)" mipmap sampling function name.
+ int mip_level = 0;
if (id.x < (128 * 128)) {
- level = 0;
+ mip_level = 0;
} else if (id.x < (128 * 128 + 64 * 64)) {
- level = 1;
+ mip_level = 1;
id.x -= (128 * 128);
} else if (id.x < (128 * 128 + 64 * 64 + 32 * 32)) {
- level = 2;
+ mip_level = 2;
id.x -= (128 * 128 + 64 * 64);
} else if (id.x < (128 * 128 + 64 * 64 + 32 * 32 + 16 * 16)) {
- level = 3;
+ mip_level = 3;
id.x -= (128 * 128 + 64 * 64 + 32 * 32);
} else if (id.x < (128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8)) {
- level = 4;
+ mip_level = 4;
id.x -= (128 * 128 + 64 * 64 + 32 * 32 + 16 * 16);
} else if (id.x < (128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8 + 4 * 4)) {
- level = 5;
+ mip_level = 5;
id.x -= (128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8);
} else if (id.x < (128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2)) {
- level = 6;
+ mip_level = 6;
id.x -= (128 * 128 + 64 * 64 + 32 * 32 + 16 * 16 + 8 * 8 + 4 * 4);
} else {
return;
}
- int res = BASE_RESOLUTION >> level;
+ int res = BASE_RESOLUTION >> mip_level;
#else // Using Texture Arrays so all levels are the same resolution
int res = BASE_RESOLUTION;
- int level = int(id.x / (BASE_RESOLUTION * BASE_RESOLUTION));
- id.x -= level * BASE_RESOLUTION * BASE_RESOLUTION;
+ int mip_level = int(id.x / (BASE_RESOLUTION * BASE_RESOLUTION));
+ id.x -= mip_level * BASE_RESOLUTION * BASE_RESOLUTION;
#endif
// determine dir / pos for the texel
@@ -212,29 +213,29 @@ void main() {
vec4 coeffsWeight[3];
for (int iCoeff = 0; iCoeff < 3; iCoeff++) {
- coeffsDir0[iCoeff] = data.coeffs[level][0][iCoeff][index];
- coeffsDir1[iCoeff] = data.coeffs[level][1][iCoeff][index];
- coeffsDir2[iCoeff] = data.coeffs[level][2][iCoeff][index];
- coeffsLevel[iCoeff] = data.coeffs[level][3][iCoeff][index];
- coeffsWeight[iCoeff] = data.coeffs[level][4][iCoeff][index];
+ coeffsDir0[iCoeff] = data.coeffs[mip_level][0][iCoeff][index];
+ coeffsDir1[iCoeff] = data.coeffs[mip_level][1][iCoeff][index];
+ coeffsDir2[iCoeff] = data.coeffs[mip_level][2][iCoeff][index];
+ coeffsLevel[iCoeff] = data.coeffs[mip_level][3][iCoeff][index];
+ coeffsWeight[iCoeff] = data.coeffs[mip_level][4][iCoeff][index];
}
for (int iSubTap = 0; iSubTap < 4; iSubTap++) {
- // determine sample attributes (dir, weight, level)
+ // determine sample attributes (dir, weight, mip_level)
vec3 sample_dir = frameX * (coeffsDir0[0][iSubTap] + coeffsDir0[1][iSubTap] * theta2 + coeffsDir0[2][iSubTap] * phi2) + frameY * (coeffsDir1[0][iSubTap] + coeffsDir1[1][iSubTap] * theta2 + coeffsDir1[2][iSubTap] * phi2) + frameZ * (coeffsDir2[0][iSubTap] + coeffsDir2[1][iSubTap] * theta2 + coeffsDir2[2][iSubTap] * phi2);
float sample_level = coeffsLevel[0][iSubTap] + coeffsLevel[1][iSubTap] * theta2 + coeffsLevel[2][iSubTap] * phi2;
float sample_weight = coeffsWeight[0][iSubTap] + coeffsWeight[1][iSubTap] * theta2 + coeffsWeight[2][iSubTap] * phi2;
#else
- vec4 coeffsDir0 = data.coeffs[level][0][index];
- vec4 coeffsDir1 = data.coeffs[level][1][index];
- vec4 coeffsDir2 = data.coeffs[level][2][index];
- vec4 coeffsLevel = data.coeffs[level][3][index];
- vec4 coeffsWeight = data.coeffs[level][4][index];
+ vec4 coeffsDir0 = data.coeffs[mip_level][0][index];
+ vec4 coeffsDir1 = data.coeffs[mip_level][1][index];
+ vec4 coeffsDir2 = data.coeffs[mip_level][2][index];
+ vec4 coeffsLevel = data.coeffs[mip_level][3][index];
+ vec4 coeffsWeight = data.coeffs[mip_level][4][index];
for (int iSubTap = 0; iSubTap < 4; iSubTap++) {
- // determine sample attributes (dir, weight, level)
+ // determine sample attributes (dir, weight, mip_level)
vec3 sample_dir = frameX * coeffsDir0[iSubTap] + frameY * coeffsDir1[iSubTap] + frameZ * coeffsDir2[iSubTap];
float sample_level = coeffsLevel[iSubTap];
@@ -248,7 +249,7 @@ void main() {
sample_dir /= max(abs(sample_dir[0]), max(abs(sample_dir[1]), abs(sample_dir[2])));
sample_level += 0.75 * log2(dot(sample_dir, sample_dir));
#ifndef USE_TEXTURE_ARRAY
- sample_level += float(level) / 6.0; // Hack to increase the perceived roughness and reduce upscaling artifacts
+ sample_level += float(mip_level) / 6.0; // Hack to increase the perceived roughness and reduce upscaling artifacts
#endif
// sample cubemap
color.xyz += textureLod(source_cubemap, normalize(sample_dir), sample_level).xyz * sample_weight;
@@ -266,7 +267,7 @@ void main() {
id.xy *= uvec2(2, 2);
#endif
- switch (level) {
+ switch (mip_level) {
case 0:
imageStore(dest_cubemap0, ivec3(id), color);
#ifdef USE_TEXTURE_ARRAY
diff --git a/servers/visual/rasterizer_rd/shaders/sky.glsl b/servers/visual/rasterizer_rd/shaders/sky.glsl
index b73f9345e7..3f433eb2ee 100644
--- a/servers/visual/rasterizer_rd/shaders/sky.glsl
+++ b/servers/visual/rasterizer_rd/shaders/sky.glsl
@@ -43,6 +43,19 @@ layout(push_constant, binding = 1, std430) uniform Params {
}
params;
+#define SAMPLER_NEAREST_CLAMP 0
+#define SAMPLER_LINEAR_CLAMP 1
+#define SAMPLER_NEAREST_WITH_MIPMAPS_CLAMP 2
+#define SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP 3
+#define SAMPLER_NEAREST_WITH_MIPMAPS_ANISOTROPIC_CLAMP 4
+#define SAMPLER_LINEAR_WITH_MIPMAPS_ANISOTROPIC_CLAMP 5
+#define SAMPLER_NEAREST_REPEAT 6
+#define SAMPLER_LINEAR_REPEAT 7
+#define SAMPLER_NEAREST_WITH_MIPMAPS_REPEAT 8
+#define SAMPLER_LINEAR_WITH_MIPMAPS_REPEAT 9
+#define SAMPLER_NEAREST_WITH_MIPMAPS_ANISOTROPIC_REPEAT 10
+#define SAMPLER_LINEAR_WITH_MIPMAPS_ANISOTROPIC_REPEAT 11
+
layout(set = 0, binding = 0) uniform sampler material_samplers[12];
#ifdef USE_MATERIAL_UNIFORMS
@@ -56,8 +69,31 @@ MATERIAL_UNIFORMS
#endif
layout(set = 2, binding = 0) uniform textureCube radiance;
+#ifdef USE_CUBEMAP_PASS
+layout(set = 2, binding = 1) uniform textureCube half_res;
+layout(set = 2, binding = 2) uniform textureCube quarter_res;
+#else
layout(set = 2, binding = 1) uniform texture2D half_res;
layout(set = 2, binding = 2) uniform texture2D quarter_res;
+#endif
+
+#ifdef USE_CUBEMAP_PASS
+#define AT_CUBEMAP_PASS true
+#else
+#define AT_CUBEMAP_PASS false
+#endif
+
+#ifdef USE_HALF_RES_PASS
+#define AT_HALF_RES_PASS true
+#else
+#define AT_HALF_RES_PASS false
+#endif
+
+#ifdef USE_QUARTER_RES_PASS
+#define AT_QUARTER_RES_PASS true
+#else
+#define AT_QUARTER_RES_PASS false
+#endif
struct DirectionalLightData {
vec3 direction;
@@ -101,6 +137,26 @@ void main() {
vec3 color = vec3(0.0, 0.0, 0.0);
float alpha = 1.0; // Only available to subpasses
+ vec4 half_res_color = vec4(1.0);
+ vec4 quarter_res_color = vec4(1.0);
+
+#ifdef USE_CUBEMAP_PASS
+ float using_cubemap = 1.0;
+#ifdef USES_HALF_RES_COLOR
+ half_res_color = texture(samplerCube(half_res, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), cube_normal);
+#endif
+#ifdef USES_QUARTER_RES_COLOR
+ quarter_res_color = texture(samplerCube(quarter_res, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), cube_normal);
+#endif
+#else
+ float using_cubemap = 0.0;
+#ifdef USES_HALF_RES_COLOR
+ half_res_color = textureLod(sampler2D(half_res, material_samplers[SAMPLER_LINEAR_CLAMP]), uv, 0.0);
+#endif
+#ifdef USES_QUARTER_RES_COLOR
+ quarter_res_color = textureLod(sampler2D(quarter_res, material_samplers[SAMPLER_LINEAR_CLAMP]), uv, 0.0);
+#endif
+#endif
// unused, just here to make our compiler happy, make sure we don't execute any light code the user adds in..
#ifndef REALLYINCLUDETHIS
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index 7307f7527a..041ad799d0 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -288,34 +288,35 @@ ShaderTypes::ShaderTypes() {
/************ SKY **************************/
shader_modes[VS::SHADER_SKY].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["RADIANCE"] = constt(ShaderLanguage::TYPE_SAMPLERCUBE);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_HALF_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_QUARTER_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_CUBEMAP_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["EYEDIR"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["SKY_COORDS"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["HALF_RES_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["QUARTER_RES_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["RADIANCE"] = constt(ShaderLanguage::TYPE_SAMPLERCUBE);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["AT_HALF_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["AT_QUARTER_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["AT_CUBEMAP_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT0_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT0_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT0_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT0_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT1_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT1_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT1_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT1_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT2_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT2_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT2_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT2_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT3_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT3_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT3_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["LIGHT3_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["HALF_RES_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["QUARTER_RES_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[VS::SHADER_SKY].modes.push_back("use_half_res_pass");
shader_modes[VS::SHADER_SKY].modes.push_back("use_quarter_res_pass");
diff --git a/servers/visual/visual_server_light_baker.cpp b/servers/visual/visual_server_light_baker.cpp
deleted file mode 100644
index 4f9ade5017..0000000000
--- a/servers/visual/visual_server_light_baker.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*************************************************************************/
-/* visual_server_light_baker.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "visual_server_light_baker.h"
-
-VisualServerLightBaker::VisualServerLightBaker() {
-}
diff --git a/servers/visual/visual_server_light_baker.h b/servers/visual/visual_server_light_baker.h
deleted file mode 100644
index d88090c473..0000000000
--- a/servers/visual/visual_server_light_baker.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************************************/
-/* visual_server_light_baker.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef VISUALSERVERLIGHTBAKER_H
-#define VISUALSERVERLIGHTBAKER_H
-
-#include "servers/visual_server.h"
-
-class VisualServerLightBaker {
-public:
- struct BakeCell {
-
- uint32_t cells[8];
- uint32_t neighbours[7]; //one unused
- uint32_t albedo; //albedo in RGBE
- uint32_t emission; //emissive light in RGBE
- uint32_t light[4]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast)
- float alpha; //used for upsampling
- uint32_t directional_pass; //used for baking directional
- };
-
- VisualServerLightBaker();
-};
-
-#endif // VISUALSERVERLIGHTBAKER_H