summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp15
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/core_string_names.cpp47
-rw-r--r--core/dvector.h12
-rw-r--r--core/func_ref.cpp5
-rw-r--r--core/io/file_access_compressed.cpp35
-rw-r--r--core/io/file_access_zip.cpp89
-rw-r--r--core/io/logger.cpp13
-rw-r--r--core/io/marshalls.cpp5
-rw-r--r--core/io/packet_peer.cpp7
-rw-r--r--core/io/packet_peer_udp.cpp13
-rw-r--r--core/io/resource_format_binary.cpp11
-rw-r--r--core/io/stream_peer_tcp.cpp11
-rw-r--r--core/io/tcp_server.cpp5
-rw-r--r--core/math/expression.cpp14
-rw-r--r--core/math/expression.h4
-rw-r--r--core/math/plane.h5
-rw-r--r--core/math/quat.h28
-rw-r--r--core/os/dir_access.cpp6
-rw-r--r--core/os/main_loop.cpp1
-rw-r--r--core/os/main_loop.h1
-rw-r--r--core/os/os.h3
-rw-r--r--core/reference.cpp4
-rw-r--r--core/variant_parser.h3
-rw-r--r--doc/classes/AudioServer.xml9
-rw-r--r--doc/classes/AudioStreamSample.xml3
-rw-r--r--doc/classes/MainLoop.xml2
-rw-r--r--doc/classes/OS.xml24
-rw-r--r--doc/classes/WorldEnvironment.xml2
-rwxr-xr-xdoc/tools/makerst.py2
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp37
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp26
-rw-r--r--drivers/coremidi/core_midi.cpp6
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp15
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h51
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h150
-rw-r--r--drivers/gles2/shaders/scene.glsl7
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h160
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h228
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp2
-rw-r--r--drivers/gles3/shaders/scene.glsl3
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp47
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp13
-rw-r--r--drivers/unix/file_access_unix.cpp9
-rw-r--r--drivers/unix/net_socket_posix.cpp8
-rw-r--r--drivers/wasapi/audio_driver_wasapi.h22
-rw-r--r--drivers/windows/file_access_windows.cpp9
-rw-r--r--drivers/windows/thread_windows.cpp5
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp38
-rw-r--r--editor/collada/collada.h41
-rw-r--r--editor/editor_audio_buses.cpp40
-rw-r--r--editor/editor_audio_buses.h4
-rw-r--r--editor/editor_export.cpp9
-rw-r--r--editor/editor_export.h6
-rw-r--r--editor/editor_help_search.cpp24
-rw-r--r--editor/editor_plugin.cpp10
-rw-r--r--editor/editor_sectioned_inspector.cpp15
-rw-r--r--editor/editor_settings.cpp154
-rw-r--r--editor/editor_settings.h32
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp11
-rw-r--r--editor/import/editor_scene_importer_gltf.h28
-rw-r--r--editor/import/resource_importer_wav.cpp14
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp10
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h6
-rw-r--r--editor/plugins/script_text_editor.cpp4
-rw-r--r--modules/csg/csg_shape.cpp13
-rw-r--r--modules/csg/csg_shape.h1
-rw-r--r--platform/osx/os_osx.h7
-rw-r--r--platform/osx/os_osx.mm39
-rw-r--r--scene/2d/canvas_item.cpp15
-rw-r--r--scene/2d/canvas_item.h2
-rw-r--r--scene/3d/sprite_3d.cpp4
-rw-r--r--scene/gui/line_edit.cpp16
-rw-r--r--scene/gui/line_edit.h1
-rw-r--r--scene/gui/spin_box.cpp34
-rw-r--r--scene/gui/spin_box.h4
-rw-r--r--scene/gui/text_edit.cpp16
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/main/scene_tree.cpp1
-rw-r--r--scene/resources/audio_stream_sample.cpp7
-rw-r--r--scene/resources/audio_stream_sample.h3
-rw-r--r--scene/resources/material.cpp61
-rw-r--r--scene/resources/material.h2
-rw-r--r--scene/resources/particles_material.cpp15
-rw-r--r--scene/resources/particles_material.h2
-rw-r--r--scene/resources/primitive_meshes.cpp44
-rw-r--r--scene/resources/surface_tool.cpp2
-rw-r--r--servers/audio_server.cpp8
-rw-r--r--servers/audio_server.h2
-rw-r--r--servers/visual/shader_types.cpp5
91 files changed, 1012 insertions, 921 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 0032c43179..8641af84d9 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -378,12 +378,20 @@ bool _OS::get_borderless_window() const {
void _OS::set_ime_active(const bool p_active) {
- return OS::get_singleton()->set_ime_active(p_active);
+ OS::get_singleton()->set_ime_active(p_active);
}
void _OS::set_ime_position(const Point2 &p_pos) {
- return OS::get_singleton()->set_ime_position(p_pos);
+ OS::get_singleton()->set_ime_position(p_pos);
+}
+
+Point2 _OS::get_ime_selection() const {
+ return OS::get_singleton()->get_ime_selection();
+}
+
+String _OS::get_ime_text() const {
+ return OS::get_singleton()->get_ime_text();
}
void _OS::set_use_file_access_save_and_swap(bool p_enable) {
@@ -1134,7 +1142,10 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_window_per_pixel_transparency_enabled"), &_OS::get_window_per_pixel_transparency_enabled);
ClassDB::bind_method(D_METHOD("set_window_per_pixel_transparency_enabled", "enabled"), &_OS::set_window_per_pixel_transparency_enabled);
+ ClassDB::bind_method(D_METHOD("set_ime_active", "active"), &_OS::set_ime_active);
ClassDB::bind_method(D_METHOD("set_ime_position", "position"), &_OS::set_ime_position);
+ ClassDB::bind_method(D_METHOD("get_ime_selection"), &_OS::get_ime_selection);
+ ClassDB::bind_method(D_METHOD("get_ime_text"), &_OS::get_ime_text);
ClassDB::bind_method(D_METHOD("set_screen_orientation", "orientation"), &_OS::set_screen_orientation);
ClassDB::bind_method(D_METHOD("get_screen_orientation"), &_OS::get_screen_orientation);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 720b14bf56..4cdf09d522 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -195,6 +195,8 @@ public:
virtual void set_ime_active(const bool p_active);
virtual void set_ime_position(const Point2 &p_pos);
+ virtual Point2 get_ime_selection() const;
+ virtual String get_ime_text() const;
Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
bool native_video_is_playing();
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp
index ba596f7f16..8a3fdade64 100644
--- a/core/core_string_names.cpp
+++ b/core/core_string_names.cpp
@@ -47,28 +47,27 @@ CoreStringNames::CoreStringNames() :
#ifdef TOOLS_ENABLED
_sections_unfolded(StaticCString::create("_sections_unfolded")),
#endif
- _custom_features(StaticCString::create("_custom_features")) {
-
- x = StaticCString::create("x");
- y = StaticCString::create("y");
- z = StaticCString::create("z");
- w = StaticCString::create("w");
- r = StaticCString::create("r");
- g = StaticCString::create("g");
- b = StaticCString::create("b");
- a = StaticCString::create("a");
- position = StaticCString::create("position");
- size = StaticCString::create("size");
- end = StaticCString::create("end");
- basis = StaticCString::create("basis");
- origin = StaticCString::create("origin");
- normal = StaticCString::create("normal");
- d = StaticCString::create("d");
- h = StaticCString::create("h");
- s = StaticCString::create("s");
- v = StaticCString::create("v");
- r8 = StaticCString::create("r8");
- g8 = StaticCString::create("g8");
- b8 = StaticCString::create("b8");
- a8 = StaticCString::create("a8");
+ _custom_features(StaticCString::create("_custom_features")),
+ x(StaticCString::create("x")),
+ y(StaticCString::create("y")),
+ z(StaticCString::create("z")),
+ w(StaticCString::create("w")),
+ r(StaticCString::create("r")),
+ g(StaticCString::create("g")),
+ b(StaticCString::create("b")),
+ a(StaticCString::create("a")),
+ position(StaticCString::create("position")),
+ size(StaticCString::create("size")),
+ end(StaticCString::create("end")),
+ basis(StaticCString::create("basis")),
+ origin(StaticCString::create("origin")),
+ normal(StaticCString::create("normal")),
+ d(StaticCString::create("d")),
+ h(StaticCString::create("h")),
+ s(StaticCString::create("s")),
+ v(StaticCString::create("v")),
+ r8(StaticCString::create("r8")),
+ g8(StaticCString::create("g8")),
+ b8(StaticCString::create("b8")),
+ a8(StaticCString::create("a8")) {
}
diff --git a/core/dvector.h b/core/dvector.h
index 2830c57ec0..9760dcbcad 100644
--- a/core/dvector.h
+++ b/core/dvector.h
@@ -56,12 +56,12 @@ struct MemoryPool {
Alloc *free_list;
- Alloc() {
- mem = NULL;
- lock = 0;
- pool_id = POOL_ALLOCATOR_INVALID_ID;
- size = 0;
- free_list = NULL;
+ Alloc() :
+ lock(0),
+ mem(NULL),
+ pool_id(POOL_ALLOCATOR_INVALID_ID),
+ size(0),
+ free_list(NULL) {
}
};
diff --git a/core/func_ref.cpp b/core/func_ref.cpp
index c707f1c4cb..d9d1a2b799 100644
--- a/core/func_ref.cpp
+++ b/core/func_ref.cpp
@@ -69,7 +69,6 @@ void FuncRef::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function);
}
-FuncRef::FuncRef() {
-
- id = 0;
+FuncRef::FuncRef() :
+ id(0) {
}
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 645d97ae7e..a3633dc1f4 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -373,24 +373,23 @@ uint64_t FileAccessCompressed::_get_modified_time(const String &p_file) {
return 0;
}
-FileAccessCompressed::FileAccessCompressed() {
-
- f = NULL;
- magic = "GCMP";
- cmode = Compression::MODE_ZSTD;
- writing = false;
- write_ptr = 0;
- write_buffer_size = 0;
- write_max = 0;
- block_size = 0;
- read_eof = false;
- at_end = false;
- read_total = 0;
- read_ptr = NULL;
- read_block = 0;
- read_block_count = 0;
- read_block_size = 0;
- read_pos = 0;
+FileAccessCompressed::FileAccessCompressed() :
+ cmode(Compression::MODE_ZSTD),
+ writing(false),
+ write_ptr(0),
+ write_buffer_size(0),
+ write_max(0),
+ block_size(0),
+ read_eof(false),
+ at_end(false),
+ read_ptr(NULL),
+ read_block(0),
+ read_block_count(0),
+ read_block_size(0),
+ read_pos(0),
+ read_total(0),
+ magic("GCMP"),
+ f(NULL) {
}
FileAccessCompressed::~FileAccessCompressed() {
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 7b6385c3ff..d99cdf0d86 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -43,31 +43,31 @@ static void *godot_open(void *data, const char *p_fname, int mode) {
if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
return NULL;
- };
+ }
FileAccess *f = (FileAccess *)data;
f->open(p_fname, FileAccess::READ);
return f->is_open() ? data : NULL;
-};
+}
static uLong godot_read(void *data, void *fdata, void *buf, uLong size) {
FileAccess *f = (FileAccess *)data;
f->get_buffer((uint8_t *)buf, size);
return size;
-};
+}
static uLong godot_write(voidpf opaque, voidpf stream, const void *buf, uLong size) {
return 0;
-};
+}
static long godot_tell(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
return f->get_position();
-};
+}
static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
@@ -84,36 +84,36 @@ static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
break;
default:
break;
- };
+ }
f->seek(pos);
return 0;
-};
+}
static int godot_close(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
f->close();
return 0;
-};
+}
static int godot_testerror(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
return f->get_error() != OK ? 1 : 0;
-};
+}
static voidpf godot_alloc(voidpf opaque, uInt items, uInt size) {
return memalloc(items * size);
-};
+}
static void godot_free(voidpf opaque, voidpf address) {
memfree(address);
-};
+}
-}; // extern "C"
+} // extern "C"
void ZipArchive::close_handle(unzFile p_file) const {
@@ -122,7 +122,7 @@ void ZipArchive::close_handle(unzFile p_file) const {
unzCloseCurrentFile(p_file);
unzClose(p_file);
memdelete(f);
-};
+}
unzFile ZipArchive::get_file_handle(String p_file) const {
@@ -155,10 +155,10 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
unzClose(pkg);
ERR_FAIL_V(NULL);
- };
+ }
return pkg;
-};
+}
bool ZipArchive::try_open_pack(const String &p_path) {
@@ -215,36 +215,36 @@ bool ZipArchive::try_open_pack(const String &p_path) {
if ((i + 1) < gi.number_entry) {
unzGoToNextFile(zfile);
- };
- };
+ }
+ }
return true;
-};
+}
bool ZipArchive::file_exists(String p_name) const {
return files.has(p_name);
-};
+}
FileAccess *ZipArchive::get_file(const String &p_path, PackedData::PackedFile *p_file) {
return memnew(FileAccessZip(p_path, *p_file));
-};
+}
ZipArchive *ZipArchive::get_singleton() {
if (instance == NULL) {
instance = memnew(ZipArchive);
- };
+ }
return instance;
-};
+}
ZipArchive::ZipArchive() {
instance = this;
//fa_create_func = FileAccess::get_create_func();
-};
+}
ZipArchive::~ZipArchive() {
@@ -253,10 +253,10 @@ ZipArchive::~ZipArchive() {
FileAccess *f = (FileAccess *)unzGetOpaque(packages[i].zfile);
unzClose(packages[i].zfile);
memdelete(f);
- };
+ }
packages.clear();
-};
+}
Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
@@ -272,7 +272,7 @@ Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
ERR_FAIL_COND_V(err != UNZ_OK, FAILED);
return OK;
-};
+}
void FileAccessZip::close() {
@@ -283,50 +283,50 @@ void FileAccessZip::close() {
ERR_FAIL_COND(!arch);
arch->close_handle(zfile);
zfile = NULL;
-};
+}
bool FileAccessZip::is_open() const {
return zfile != NULL;
-};
+}
void FileAccessZip::seek(size_t p_position) {
ERR_FAIL_COND(!zfile);
unzSeekCurrentFile(zfile, p_position);
-};
+}
void FileAccessZip::seek_end(int64_t p_position) {
ERR_FAIL_COND(!zfile);
unzSeekCurrentFile(zfile, get_len() + p_position);
-};
+}
size_t FileAccessZip::get_position() const {
ERR_FAIL_COND_V(!zfile, 0);
return unztell(zfile);
-};
+}
size_t FileAccessZip::get_len() const {
ERR_FAIL_COND_V(!zfile, 0);
return file_info.uncompressed_size;
-};
+}
bool FileAccessZip::eof_reached() const {
ERR_FAIL_COND_V(!zfile, true);
return at_eof;
-};
+}
uint8_t FileAccessZip::get_8() const {
uint8_t ret = 0;
get_buffer(&ret, 1);
return ret;
-};
+}
int FileAccessZip::get_buffer(uint8_t *p_dst, int p_length) const {
@@ -339,20 +339,20 @@ int FileAccessZip::get_buffer(uint8_t *p_dst, int p_length) const {
if (read < p_length)
at_eof = true;
return read;
-};
+}
Error FileAccessZip::get_error() const {
if (!zfile) {
return ERR_UNCONFIGURED;
- };
+ }
if (eof_reached()) {
return ERR_FILE_EOF;
- };
+ }
return OK;
-};
+}
void FileAccessZip::flush() {
@@ -362,22 +362,21 @@ void FileAccessZip::flush() {
void FileAccessZip::store_8(uint8_t p_dest) {
ERR_FAIL();
-};
+}
bool FileAccessZip::file_exists(const String &p_name) {
return false;
-};
-
-FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) {
+}
- zfile = NULL;
+FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) :
+ zfile(NULL) {
_open(p_path, FileAccess::READ);
-};
+}
FileAccessZip::~FileAccessZip() {
close();
-};
+}
#endif
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 01755c8ee9..3c4b4a1ac3 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -179,11 +179,10 @@ void RotatedFileLogger::rotate_file() {
file = FileAccess::open(base_path, FileAccess::WRITE);
}
-RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) {
- file = NULL;
- base_path = p_base_path.simplify_path();
- max_files = p_max_files > 0 ? p_max_files : 1;
-
+RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) :
+ base_path(p_base_path.simplify_path()),
+ max_files(p_max_files > 0 ? p_max_files : 1),
+ file(NULL) {
rotate_file();
}
@@ -240,8 +239,8 @@ void StdLogger::logv(const char *p_format, va_list p_list, bool p_err) {
StdLogger::~StdLogger() {}
-CompositeLogger::CompositeLogger(Vector<Logger *> p_loggers) {
- loggers = p_loggers;
+CompositeLogger::CompositeLogger(Vector<Logger *> p_loggers) :
+ loggers(p_loggers) {
}
void CompositeLogger::logv(const char *p_format, va_list p_list, bool p_err) {
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 6338cee39d..c71903c94d 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -55,9 +55,8 @@ ObjectID EncodedObjectAsID::get_object_id() const {
return id;
}
-EncodedObjectAsID::EncodedObjectAsID() {
-
- id = 0;
+EncodedObjectAsID::EncodedObjectAsID() :
+ id(0) {
}
#define ENCODE_MASK 0xFF
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index b6dd4eaf6f..aadcca01d5 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -35,10 +35,9 @@
/* helpers / binders */
-PacketPeer::PacketPeer() {
-
- allow_object_decoding = false;
- last_get_error = OK;
+PacketPeer::PacketPeer() :
+ last_get_error(OK),
+ allow_object_decoding(false) {
}
void PacketPeer::set_allow_object_decoding(bool p_enable) {
diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp
index d33ba6f855..2e916d6a48 100644
--- a/core/io/packet_peer_udp.cpp
+++ b/core/io/packet_peer_udp.cpp
@@ -239,13 +239,12 @@ void PacketPeerUDP::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_dest_address", "host", "port"), &PacketPeerUDP::_set_dest_address);
}
-PacketPeerUDP::PacketPeerUDP() {
-
- _sock = Ref<NetSocket>(NetSocket::create());
- blocking = true;
- packet_port = 0;
- queue_count = 0;
- peer_port = 0;
+PacketPeerUDP::PacketPeerUDP() :
+ packet_port(0),
+ queue_count(0),
+ peer_port(0),
+ blocking(true),
+ _sock(Ref<NetSocket>(NetSocket::create())) {
rb.resize(16);
}
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 6f3a8c3d2e..b91268dab2 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -970,12 +970,11 @@ String ResourceInteractiveLoaderBinary::recognize(FileAccess *p_f) {
return type;
}
-ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() {
-
- f = NULL;
- stage = 0;
- error = OK;
- translation_remapped = false;
+ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() :
+ translation_remapped(false),
+ f(NULL),
+ error(OK),
+ stage(0) {
}
ResourceInteractiveLoaderBinary::~ResourceInteractiveLoaderBinary() {
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 28561e8cbc..4b86735aa3 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -349,12 +349,11 @@ void StreamPeerTCP::_bind_methods() {
BIND_ENUM_CONSTANT(STATUS_ERROR);
}
-StreamPeerTCP::StreamPeerTCP() {
-
- _sock = Ref<NetSocket>(NetSocket::create());
- status = STATUS_NONE;
- peer_host = IP_Address();
- peer_port = 0;
+StreamPeerTCP::StreamPeerTCP() :
+ _sock(Ref<NetSocket>(NetSocket::create())),
+ status(STATUS_NONE),
+ peer_host(IP_Address()),
+ peer_port(0) {
}
StreamPeerTCP::~StreamPeerTCP() {
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index b8194cb17f..be9176779e 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -116,9 +116,8 @@ void TCP_Server::stop() {
}
}
-TCP_Server::TCP_Server() {
-
- _sock = Ref<NetSocket>(NetSocket::create());
+TCP_Server::TCP_Server() :
+ _sock(Ref<NetSocket>(NetSocket::create())) {
}
TCP_Server::~TCP_Server() {
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 0cfb54234c..7f3439e956 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -2157,13 +2157,13 @@ void Expression::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_error_text"), &Expression::get_error_text);
}
-Expression::Expression() {
- output_type = Variant::NIL;
- error_set = true;
- root = NULL;
- nodes = NULL;
- sequenced = false;
- execution_error = false;
+Expression::Expression() :
+ output_type(Variant::NIL),
+ sequenced(false),
+ error_set(true),
+ root(NULL),
+ nodes(NULL),
+ execution_error(false) {
}
Expression::~Expression() {
diff --git a/core/math/expression.h b/core/math/expression.h
index ac2416d0dd..7f81542480 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -116,7 +116,9 @@ private:
Variant::Type type;
String name;
- Input() { type = Variant::NIL; }
+ Input() :
+ type(Variant::NIL) {
+ }
};
Vector<Input> inputs;
diff --git a/core/math/plane.h b/core/math/plane.h
index 4eedebb79e..5182dc67dd 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -74,10 +74,11 @@ public:
_FORCE_INLINE_ bool operator!=(const Plane &p_plane) const;
operator String() const;
- _FORCE_INLINE_ Plane() { d = 0; }
+ _FORCE_INLINE_ Plane() :
+ d(0) {}
_FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) :
normal(p_a, p_b, p_c),
- d(p_d){};
+ d(p_d) {}
_FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
_FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3 &p_normal);
diff --git a/core/math/quat.h b/core/math/quat.h
index c4f9b3a732..59a15f460b 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -115,20 +115,20 @@ public:
z = p_z;
w = p_w;
}
- inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) {
- x = p_x;
- y = p_y;
- z = p_z;
- w = p_w;
+ inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) :
+ x(p_x),
+ y(p_y),
+ z(p_z),
+ w(p_w) {
}
Quat(const Vector3 &axis, const real_t &angle) { set_axis_angle(axis, angle); }
Quat(const Vector3 &euler) { set_euler(euler); }
- Quat(const Quat &q) {
- x = q.x;
- y = q.y;
- z = q.z;
- w = q.w;
+ Quat(const Quat &q) :
+ x(q.x),
+ y(q.y),
+ z(q.z),
+ w(q.w) {
}
Quat(const Vector3 &v0, const Vector3 &v1) // shortest arc
@@ -153,9 +153,11 @@ public:
}
}
- inline Quat() {
- x = y = z = 0;
- w = 1;
+ inline Quat() :
+ x(0),
+ y(0),
+ z(0),
+ w(1) {
}
};
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index ce70b859eb..8f4f2b6920 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -349,9 +349,9 @@ class DirChanger {
String original_dir;
public:
- DirChanger(DirAccess *p_da, String p_dir) {
- da = p_da;
- original_dir = p_da->get_current_dir();
+ DirChanger(DirAccess *p_da, String p_dir) :
+ da(p_da),
+ original_dir(p_da->get_current_dir()) {
p_da->change_dir(p_dir);
}
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index 0945cdd512..6e0b914367 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -60,6 +60,7 @@ void MainLoop::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED);
BIND_CONSTANT(NOTIFICATION_WM_ABOUT);
BIND_CONSTANT(NOTIFICATION_CRASH);
+ BIND_CONSTANT(NOTIFICATION_OS_IME_UPDATE);
};
void MainLoop::set_init_script(const Ref<Script> &p_init_script) {
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index 43f74302a8..e9b331ee45 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -65,6 +65,7 @@ public:
NOTIFICATION_TRANSLATION_CHANGED = 90,
NOTIFICATION_WM_ABOUT = 91,
NOTIFICATION_CRASH = 92,
+ NOTIFICATION_OS_IME_UPDATE = 93,
};
virtual void input_event(const Ref<InputEvent> &p_event);
diff --git a/core/os/os.h b/core/os/os.h
index 53a5ebde01..05ec3ac424 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -242,7 +242,8 @@ public:
virtual void set_ime_active(const bool p_active) {}
virtual void set_ime_position(const Point2 &p_pos) {}
- virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp) {}
+ virtual Point2 get_ime_selection() const { return Point2(); }
+ virtual String get_ime_text() const { return String(); }
virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) { return ERR_UNAVAILABLE; }
virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; }
diff --git a/core/reference.cpp b/core/reference.cpp
index b79ad0bf3d..6ccc444b93 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -139,8 +139,8 @@ void WeakRef::set_ref(const REF &p_ref) {
ref = p_ref.is_valid() ? p_ref->get_instance_id() : 0;
}
-WeakRef::WeakRef() {
- ref = 0;
+WeakRef::WeakRef() :
+ ref(0) {
}
void WeakRef::_bind_methods() {
diff --git a/core/variant_parser.h b/core/variant_parser.h
index 531c1d59cd..e183169ed8 100644
--- a/core/variant_parser.h
+++ b/core/variant_parser.h
@@ -45,7 +45,8 @@ public:
CharType saved;
- Stream() { saved = 0; }
+ Stream() :
+ saved(0) {}
virtual ~Stream() {}
};
diff --git a/doc/classes/AudioServer.xml b/doc/classes/AudioServer.xml
index 3ae5454e65..e1939e679d 100644
--- a/doc/classes/AudioServer.xml
+++ b/doc/classes/AudioServer.xml
@@ -61,6 +61,15 @@
Generates an [AudioBusLayout] using the available busses and effects.
</description>
</method>
+ <method name="get_bus_channels" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="bus_idx" type="int">
+ </argument>
+ <description>
+ Returns the amount of channels of the bus at index [code]bus_idx[/code].
+ </description>
+ </method>
<method name="get_bus_count" qualifiers="const">
<return type="int">
</return>
diff --git a/doc/classes/AudioStreamSample.xml b/doc/classes/AudioStreamSample.xml
index 9e56cc6016..77d5f14ab7 100644
--- a/doc/classes/AudioStreamSample.xml
+++ b/doc/classes/AudioStreamSample.xml
@@ -62,5 +62,8 @@
<constant name="LOOP_PING_PONG" value="2" enum="LoopMode">
Audio loops the data between loop_begin and loop_end playing back and forth.
</constant>
+ <constant name="LOOP_BACKWARD" value="3" enum="LoopMode">
+ Audio loops the data between loop_begin and loop_end playing backward only.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml
index ad763e6532..01836cff95 100644
--- a/doc/classes/MainLoop.xml
+++ b/doc/classes/MainLoop.xml
@@ -136,5 +136,7 @@
</constant>
<constant name="NOTIFICATION_CRASH" value="92">
</constant>
+ <constant name="NOTIFICATION_OS_IME_UPDATE" value="93">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index e218949757..3cca19c6cb 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -210,6 +210,20 @@
Returns the path to the current engine executable.
</description>
</method>
+ <method name="get_ime_text" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns IME intermediate text.
+ </description>
+ </method>
+ <method name="get_ime_selection" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <description>
+ Returns IME selection range.
+ </description>
+ </method>
<method name="get_latin_keyboard_variant" qualifiers="const">
<return type="String">
</return>
@@ -663,12 +677,22 @@
Sets the game's icon.
</description>
</method>
+ <method name="set_ime_active">
+ <return type="void">
+ </return>
+ <argument index="0" name="active" type="bool">
+ </argument>
+ <description>
+ Sets whether IME input mode should be enabled.
+ </description>
+ </method>
<method name="set_ime_position">
<return type="void">
</return>
<argument index="0" name="position" type="Vector2">
</argument>
<description>
+ Sets position of IME suggestion list popup (in window coordinates).
</description>
</method>
<method name="set_thread_name">
diff --git a/doc/classes/WorldEnvironment.xml b/doc/classes/WorldEnvironment.xml
index 45e1af4e42..8c212502d6 100644
--- a/doc/classes/WorldEnvironment.xml
+++ b/doc/classes/WorldEnvironment.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="WorldEnvironment" inherits="Node" category="Core" version="3.1">
<brief_description>
- Default environment properties for the entire scene (post-processing effects, lightning and background settings).
+ Default environment properties for the entire scene (post-processing effects, lighting and background settings).
</brief_description>
<description>
The [code]WorldEnvironment[/code] node is used to configure the default [Environment] for the scene.
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 7b7cc52547..9e83dfb55e 100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -280,7 +280,7 @@ def rstize_text(text, cclass):
escape_post = True
# Properly escape things like `[Node]s`
- if escape_post and post_text and post_text[0].isalnum(): # not punctuation, escape
+ if escape_post and post_text and (post_text[0].isalnum() or post_text[0] == "("): # not punctuation, escape
post_text = '\ ' + post_text
next_brac_pos = post_text.find('[', 0)
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 50697b8834..2e3861f500 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -159,7 +159,7 @@ Error AudioDriverALSA::init() {
}
return err;
-};
+}
void AudioDriverALSA::thread_func(void *p_udata) {
@@ -232,25 +232,25 @@ void AudioDriverALSA::thread_func(void *p_udata) {
ad->stop_counting_ticks();
ad->unlock();
- };
+ }
ad->thread_exited = true;
-};
+}
void AudioDriverALSA::start() {
active = true;
-};
+}
int AudioDriverALSA::get_mix_rate() const {
return mix_rate;
-};
+}
AudioDriver::SpeakerMode AudioDriverALSA::get_speaker_mode() const {
return speaker_mode;
-};
+}
Array AudioDriverALSA::get_device_list() {
@@ -302,14 +302,14 @@ void AudioDriverALSA::lock() {
if (!thread || !mutex)
return;
mutex->lock();
-};
+}
void AudioDriverALSA::unlock() {
if (!thread || !mutex)
return;
mutex->unlock();
-};
+}
void AudioDriverALSA::finish_device() {
@@ -337,18 +337,15 @@ void AudioDriverALSA::finish() {
finish_device();
}
-AudioDriverALSA::AudioDriverALSA() {
-
- mutex = NULL;
- thread = NULL;
- pcm_handle = NULL;
-
- device_name = "Default";
- new_device = "Default";
-};
-
-AudioDriverALSA::~AudioDriverALSA(){
+AudioDriverALSA::AudioDriverALSA() :
+ thread(NULL),
+ mutex(NULL),
+ pcm_handle(NULL),
+ device_name("Default"),
+ new_device("Default") {
+}
-};
+AudioDriverALSA::~AudioDriverALSA() {
+}
#endif
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 850b90d59b..726cee10a4 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -684,22 +684,18 @@ String AudioDriverCoreAudio::capture_get_device() {
#endif
-AudioDriverCoreAudio::AudioDriverCoreAudio() {
- audio_unit = NULL;
- input_unit = NULL;
- active = false;
- mutex = NULL;
-
- mix_rate = 0;
- channels = 2;
- capture_channels = 2;
-
- buffer_frames = 0;
-
+AudioDriverCoreAudio::AudioDriverCoreAudio() :
+ audio_unit(NULL),
+ input_unit(NULL),
+ active(false),
+ mutex(NULL),
+ device_name("Default"),
+ capture_device_name("Default"),
+ mix_rate(0),
+ channels(2),
+ capture_channels(2),
+ buffer_frames(0) {
samples_in.clear();
-
- device_name = "Default";
- capture_device_name = "Default";
}
AudioDriverCoreAudio::~AudioDriverCoreAudio(){};
diff --git a/drivers/coremidi/core_midi.cpp b/drivers/coremidi/core_midi.cpp
index 2ebbabaa38..a20aec04b5 100644
--- a/drivers/coremidi/core_midi.cpp
+++ b/drivers/coremidi/core_midi.cpp
@@ -112,13 +112,11 @@ PoolStringArray MIDIDriverCoreMidi::get_connected_inputs() {
return list;
}
-MIDIDriverCoreMidi::MIDIDriverCoreMidi() {
-
- client = 0;
+MIDIDriverCoreMidi::MIDIDriverCoreMidi() :
+ client(0) {
}
MIDIDriverCoreMidi::~MIDIDriverCoreMidi() {
-
close();
}
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 7addbaa9fe..25d7df8ebc 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -2017,6 +2017,8 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas);
+ Vector2 viewport_size = state.viewport_size;
+
Vector2 screen_pixel_size = state.screen_pixel_size;
bool use_radiance_map = false;
@@ -2335,6 +2337,8 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
state.scene_shader.set_uniform(SceneShaderGLES2::TIME, storage->frame.time[0]);
+ state.scene_shader.set_uniform(SceneShaderGLES2::VIEWPORT_SIZE, viewport_size);
+
state.scene_shader.set_uniform(SceneShaderGLES2::SCREEN_PIXEL_SIZE, screen_pixel_size);
}
@@ -2506,8 +2510,6 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
}
current_fb = probe->fbo[p_reflection_probe_pass];
- state.screen_pixel_size.x = 1.0 / probe->probe_ptr->resolution;
- state.screen_pixel_size.y = 1.0 / probe->probe_ptr->resolution;
viewport_width = probe->probe_ptr->resolution;
viewport_height = probe->probe_ptr->resolution;
@@ -2518,11 +2520,16 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
state.render_no_shadows = false;
current_fb = storage->frame.current_rt->fbo;
env = environment_owner.getornull(p_environment);
- state.screen_pixel_size.x = 1.0 / storage->frame.current_rt->width;
- state.screen_pixel_size.y = 1.0 / storage->frame.current_rt->height;
+
viewport_width = storage->frame.current_rt->width;
viewport_height = storage->frame.current_rt->height;
}
+
+ state.viewport_size.x = viewport_width;
+ state.viewport_size.y = viewport_height;
+ state.screen_pixel_size.x = 1.0 / viewport_width;
+ state.screen_pixel_size.y = 1.0 / viewport_height;
+
//push back the directional lights
if (p_light_cull_count) {
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
index ba406183c7..4236554d9d 100644
--- a/drivers/gles2/rasterizer_scene_gles2.h
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -211,6 +211,8 @@ public:
bool render_no_shadows;
+ Vector2 viewport_size;
+
Vector2 screen_pixel_size;
} state;
@@ -369,33 +371,28 @@ public:
float fog_height_max;
float fog_height_curve;
- Environment() {
- bg_mode = VS::ENV_BG_CLEAR_COLOR;
- sky_custom_fov = 0.0;
- bg_energy = 1.0;
- sky_ambient = 0;
- ambient_energy = 1.0;
- ambient_sky_contribution = 0.0;
- canvas_max_layer = 0;
-
- fog_enabled = false;
- fog_color = Color(0.5, 0.5, 0.5);
- fog_sun_color = Color(0.8, 0.8, 0.0);
- fog_sun_amount = 0;
-
- fog_depth_enabled = true;
-
- fog_depth_begin = 10;
- fog_depth_end = 0;
- fog_depth_curve = 1;
-
- fog_transmit_enabled = true;
- fog_transmit_curve = 1;
-
- fog_height_enabled = false;
- fog_height_min = 0;
- fog_height_max = 100;
- fog_height_curve = 1;
+ Environment() :
+ bg_mode(VS::ENV_BG_CLEAR_COLOR),
+ sky_custom_fov(0.0),
+ bg_energy(1.0),
+ sky_ambient(0),
+ ambient_energy(1.0),
+ ambient_sky_contribution(0.0),
+ canvas_max_layer(0),
+ fog_enabled(false),
+ fog_color(Color(0.5, 0.5, 0.5)),
+ fog_sun_color(Color(0.8, 0.8, 0.0)),
+ fog_sun_amount(0),
+ fog_depth_enabled(true),
+ fog_depth_begin(10),
+ fog_depth_end(0),
+ fog_depth_curve(1),
+ fog_transmit_enabled(true),
+ fog_transmit_curve(1),
+ fog_height_enabled(false),
+ fog_height_min(0),
+ fog_height_max(100),
+ fog_height_curve(1) {
}
};
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index 5bdc65a0b5..ec7616b9f3 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -131,10 +131,9 @@ public:
}
} render, render_final, snap;
- Info() {
-
- texture_mem = 0;
- vertex_mem = 0;
+ Info() :
+ texture_mem(0),
+ vertex_mem(0) {
render.reset();
render_final.reset();
}
@@ -254,30 +253,31 @@ public:
VisualServer::TextureDetectCallback detect_normal;
void *detect_normal_ud;
- Texture() {
- alloc_width = 0;
- alloc_height = 0;
- target = 0;
-
- stored_cube_sides = 0;
- ignore_mipmaps = false;
- render_target = NULL;
- flags = width = height = 0;
- tex_id = 0;
- data_size = 0;
- format = Image::FORMAT_L8;
- active = false;
- compressed = false;
- total_data_size = 0;
- mipmaps = 0;
- detect_3d = NULL;
- detect_3d_ud = NULL;
- detect_srgb = NULL;
- detect_srgb_ud = NULL;
- detect_normal = NULL;
- detect_normal_ud = NULL;
- proxy = NULL;
- redraw_if_visible = false;
+ Texture() :
+ proxy(NULL),
+ flags(0),
+ width(0),
+ height(0),
+ alloc_width(0),
+ alloc_height(0),
+ format(Image::FORMAT_L8),
+ target(0),
+ data_size(0),
+ total_data_size(0),
+ ignore_mipmaps(false),
+ compressed(false),
+ mipmaps(0),
+ active(false),
+ tex_id(0),
+ stored_cube_sides(0),
+ render_target(NULL),
+ redraw_if_visible(false),
+ detect_3d(NULL),
+ detect_3d_ud(NULL),
+ detect_srgb(NULL),
+ detect_srgb_ud(NULL),
+ detect_normal(NULL),
+ detect_normal_ud(NULL) {
}
_ALWAYS_INLINE_ Texture *get_ptr() {
@@ -615,20 +615,15 @@ public:
int total_data_size;
- Surface() {
- array_byte_size = 0;
- index_array_byte_size = 0;
-
- array_len = 0;
- index_array_len = 0;
-
- mesh = NULL;
-
- primitive = VS::PRIMITIVE_POINTS;
-
- active = false;
-
- total_data_size = 0;
+ Surface() :
+ mesh(NULL),
+ array_len(0),
+ index_array_len(0),
+ array_byte_size(0),
+ index_array_byte_size(0),
+ primitive(VS::PRIMITIVE_POINTS),
+ active(false),
+ total_data_size(0) {
}
};
@@ -658,9 +653,9 @@ public:
}
}
- Mesh() {
- blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED;
- blend_shape_count = 0;
+ Mesh() :
+ blend_shape_count(0),
+ blend_shape_mode(VS::BLEND_SHAPE_MODE_NORMALIZED) {
}
};
@@ -731,22 +726,18 @@ public:
bool dirty_data;
MultiMesh() :
+ size(0),
+ transform_format(VS::MULTIMESH_TRANSFORM_2D),
+ color_format(VS::MULTIMESH_COLOR_NONE),
+ custom_data_format(VS::MULTIMESH_CUSTOM_DATA_NONE),
update_list(this),
- mesh_list(this) {
- dirty_aabb = true;
- dirty_data = true;
-
- xform_floats = 0;
- color_floats = 0;
- custom_data_floats = 0;
-
- visible_instances = -1;
-
- size = 0;
-
- transform_format = VS::MULTIMESH_TRANSFORM_2D;
- color_format = VS::MULTIMESH_COLOR_NONE;
- custom_data_format = VS::MULTIMESH_CUSTOM_DATA_NONE;
+ mesh_list(this),
+ visible_instances(-1),
+ xform_floats(0),
+ color_floats(0),
+ custom_data_floats(0),
+ dirty_aabb(true),
+ dirty_data(true) {
}
};
@@ -847,10 +838,10 @@ public:
Set<RasterizerScene::InstanceBase *> instances;
Skeleton() :
+ use_2d(false),
+ size(0),
+ tex_id(0),
update_list(this) {
- tex_id = 0;
- size = 0;
- use_2d = false;
}
};
@@ -1121,11 +1112,11 @@ public:
GLuint color;
- Effect() {
- fbo = 0;
- width = 0;
- height = 0;
- color = 0;
+ Effect() :
+ fbo(0),
+ width(0),
+ height(0),
+ color(0) {
}
};
@@ -1140,22 +1131,17 @@ public:
RID texture;
- RenderTarget() {
- fbo = 0;
-
- color = 0;
- depth = 0;
-
- width = 0;
- height = 0;
-
- for (int i = 0; i < RENDER_TARGET_FLAG_MAX; i++) {
+ RenderTarget() :
+ fbo(0),
+ color(0),
+ depth(0),
+ width(0),
+ height(0),
+ used_in_frame(false),
+ msaa(VS::VIEWPORT_MSAA_DISABLED) {
+ for (int i = 0; i < RENDER_TARGET_FLAG_MAX; ++i) {
flags[i] = false;
}
-
- used_in_frame = false;
-
- msaa = VS::VIEWPORT_MSAA_DISABLED;
}
};
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 15b90a7771..30dc55cc4c 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -84,6 +84,8 @@ uniform highp mat4 world_transform;
uniform highp float time;
+uniform highp vec2 viewport_size;
+
#ifdef RENDER_DEPTH
uniform float light_bias;
uniform float light_normal_bias;
@@ -677,6 +679,8 @@ uniform highp mat4 world_transform;
uniform highp float time;
+uniform highp vec2 viewport_size;
+
#if defined(SCREEN_UV_USED)
uniform vec2 screen_pixel_size;
#endif
@@ -1380,6 +1384,7 @@ void main() {
discard;
#endif
highp vec3 vertex = vertex_interp;
+ vec3 view = -normalize(vertex_interp);
vec3 albedo = vec3(1.0);
vec3 transmission = vec3(0.0);
float metallic = 0.0;
@@ -1453,7 +1458,7 @@ FRAGMENT_SHADER_CODE
vec3 diffuse_light = vec3(0.0, 0.0, 0.0);
vec3 ambient_light = vec3(0.0, 0.0, 0.0);
- vec3 eye_position = -normalize(vertex_interp);
+ vec3 eye_position = view;
#if defined(ALPHA_SCISSOR_USED)
if (alpha < alpha_scissor) {
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 0e6027c4ad..1d84fb487b 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -450,89 +450,77 @@ public:
float fog_height_max;
float fog_height_curve;
- Environment() {
- bg_mode = VS::ENV_BG_CLEAR_COLOR;
- sky_custom_fov = 0.0;
- bg_energy = 1.0;
- sky_ambient = 0;
- ambient_energy = 1.0;
- ambient_sky_contribution = 0.0;
- canvas_max_layer = 0;
-
- ssr_enabled = false;
- ssr_max_steps = 64;
- ssr_fade_in = 0.15;
- ssr_fade_out = 2.0;
- ssr_depth_tolerance = 0.2;
- ssr_roughness = true;
-
- ssao_enabled = false;
- ssao_intensity = 1.0;
- ssao_radius = 1.0;
- ssao_intensity2 = 1.0;
- ssao_radius2 = 0.0;
- ssao_bias = 0.01;
- ssao_light_affect = 0;
- ssao_ao_channel_affect = 0;
- ssao_filter = VS::ENV_SSAO_BLUR_3x3;
- ssao_quality = VS::ENV_SSAO_QUALITY_LOW;
- ssao_bilateral_sharpness = 4;
-
- tone_mapper = VS::ENV_TONE_MAPPER_LINEAR;
- tone_mapper_exposure = 1.0;
- tone_mapper_exposure_white = 1.0;
- auto_exposure = false;
- auto_exposure_speed = 0.5;
- auto_exposure_min = 0.05;
- auto_exposure_max = 8;
- auto_exposure_grey = 0.4;
-
- glow_enabled = false;
- glow_levels = (1 << 2) | (1 << 4);
- glow_intensity = 0.8;
- glow_strength = 1.0;
- glow_bloom = 0.0;
- glow_blend_mode = VS::GLOW_BLEND_MODE_SOFTLIGHT;
- glow_hdr_bleed_threshold = 1.0;
- glow_hdr_bleed_scale = 2.0;
- glow_hdr_luminance_cap = 12.0;
- glow_bicubic_upscale = false;
-
- dof_blur_far_enabled = false;
- dof_blur_far_distance = 10;
- dof_blur_far_transition = 5;
- dof_blur_far_amount = 0.1;
- dof_blur_far_quality = VS::ENV_DOF_BLUR_QUALITY_MEDIUM;
-
- dof_blur_near_enabled = false;
- dof_blur_near_distance = 2;
- dof_blur_near_transition = 1;
- dof_blur_near_amount = 0.1;
- dof_blur_near_quality = VS::ENV_DOF_BLUR_QUALITY_MEDIUM;
-
- adjustments_enabled = false;
- adjustments_brightness = 1.0;
- adjustments_contrast = 1.0;
- adjustments_saturation = 1.0;
-
- fog_enabled = false;
- fog_color = Color(0.5, 0.5, 0.5);
- fog_sun_color = Color(0.8, 0.8, 0.0);
- fog_sun_amount = 0;
-
- fog_depth_enabled = true;
-
- fog_depth_begin = 10;
- fog_depth_end = 0;
- fog_depth_curve = 1;
-
- fog_transmit_enabled = true;
- fog_transmit_curve = 1;
-
- fog_height_enabled = false;
- fog_height_min = 0;
- fog_height_max = 100;
- fog_height_curve = 1;
+ Environment() :
+ bg_mode(VS::ENV_BG_CLEAR_COLOR),
+ sky_custom_fov(0.0),
+ bg_energy(1.0),
+ sky_ambient(0),
+ ambient_energy(1.0),
+ ambient_sky_contribution(0.0),
+ canvas_max_layer(0),
+ ssr_enabled(false),
+ ssr_max_steps(64),
+ ssr_fade_in(0.15),
+ ssr_fade_out(2.0),
+ ssr_depth_tolerance(0.2),
+ ssr_roughness(true),
+ ssao_enabled(false),
+ ssao_intensity(1.0),
+ ssao_radius(1.0),
+ ssao_intensity2(1.0),
+ ssao_radius2(0.0),
+ ssao_bias(0.01),
+ ssao_light_affect(0),
+ ssao_ao_channel_affect(0),
+ ssao_quality(VS::ENV_SSAO_QUALITY_LOW),
+ ssao_bilateral_sharpness(4),
+ ssao_filter(VS::ENV_SSAO_BLUR_3x3),
+ glow_enabled(false),
+ glow_levels((1 << 2) | (1 << 4)),
+ glow_intensity(0.8),
+ glow_strength(1.0),
+ glow_bloom(0.0),
+ glow_blend_mode(VS::GLOW_BLEND_MODE_SOFTLIGHT),
+ glow_hdr_bleed_threshold(1.0),
+ glow_hdr_bleed_scale(2.0),
+ glow_hdr_luminance_cap(12.0),
+ glow_bicubic_upscale(false),
+ tone_mapper(VS::ENV_TONE_MAPPER_LINEAR),
+ tone_mapper_exposure(1.0),
+ tone_mapper_exposure_white(1.0),
+ auto_exposure(false),
+ auto_exposure_speed(0.5),
+ auto_exposure_min(0.05),
+ auto_exposure_max(8),
+ auto_exposure_grey(0.4),
+ dof_blur_far_enabled(false),
+ dof_blur_far_distance(10),
+ dof_blur_far_transition(5),
+ dof_blur_far_amount(0.1),
+ dof_blur_far_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM),
+ dof_blur_near_enabled(false),
+ dof_blur_near_distance(2),
+ dof_blur_near_transition(1),
+ dof_blur_near_amount(0.1),
+ dof_blur_near_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM),
+ adjustments_enabled(false),
+ adjustments_brightness(1.0),
+ adjustments_contrast(1.0),
+ adjustments_saturation(1.0),
+ fog_enabled(false),
+ fog_color(Color(0.5, 0.5, 0.5)),
+ fog_sun_color(Color(0.8, 0.8, 0.0)),
+ fog_sun_amount(0),
+ fog_depth_enabled(true),
+ fog_depth_begin(10),
+ fog_depth_end(0),
+ fog_depth_curve(1),
+ fog_transmit_enabled(true),
+ fog_transmit_curve(1),
+ fog_height_enabled(false),
+ fog_height_min(0),
+ fog_height_max(100),
+ fog_height_curve(1) {
}
};
@@ -643,9 +631,9 @@ public:
Vector3 bounds;
Transform transform_to_data;
- GIProbeInstance() {
- probe = NULL;
- tex_cache = 0;
+ GIProbeInstance() :
+ probe(NULL),
+ tex_cache(0) {
}
};
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 398ffdeb82..958086f6c7 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -285,29 +285,30 @@ public:
VisualServer::TextureDetectCallback detect_normal;
void *detect_normal_ud;
- Texture() {
-
- using_srgb = false;
- stored_cube_sides = 0;
- ignore_mipmaps = false;
- render_target = NULL;
- flags = width = height = 0;
- tex_id = 0;
- data_size = 0;
- format = Image::FORMAT_L8;
- active = false;
- compressed = false;
- total_data_size = 0;
- target = GL_TEXTURE_2D;
- mipmaps = 0;
- detect_3d = NULL;
- detect_3d_ud = NULL;
- detect_srgb = NULL;
- detect_srgb_ud = NULL;
- detect_normal = NULL;
- detect_normal_ud = NULL;
- proxy = NULL;
- redraw_if_visible = false;
+ Texture() :
+ proxy(NULL),
+ flags(0),
+ width(0),
+ height(0),
+ format(Image::FORMAT_L8),
+ target(GL_TEXTURE_2D),
+ data_size(0),
+ compressed(false),
+ total_data_size(0),
+ ignore_mipmaps(false),
+ mipmaps(0),
+ active(false),
+ tex_id(0),
+ using_srgb(false),
+ redraw_if_visible(false),
+ stored_cube_sides(0),
+ render_target(NULL),
+ detect_3d(NULL),
+ detect_3d_ud(NULL),
+ detect_srgb(NULL),
+ detect_srgb_ud(NULL),
+ detect_normal(NULL),
+ detect_normal_ud(NULL) {
}
_ALWAYS_INLINE_ Texture *get_ptr() {
@@ -553,16 +554,16 @@ public:
bool is_animated_cache;
Material() :
+ shader(NULL),
+ ubo_id(0),
+ ubo_size(0),
list(this),
- dirty_list(this) {
- can_cast_shadow_cache = false;
- is_animated_cache = false;
- shader = NULL;
- line_width = 1.0;
- ubo_id = 0;
- ubo_size = 0;
- last_pass = 0;
- render_priority = 0;
+ dirty_list(this),
+ line_width(1.0),
+ render_priority(0),
+ last_pass(0),
+ can_cast_shadow_cache(false),
+ is_animated_cache(false) {
}
};
@@ -661,27 +662,24 @@ public:
int total_data_size;
- Surface() {
-
- array_byte_size = 0;
- index_array_byte_size = 0;
- mesh = NULL;
- format = 0;
- array_id = 0;
- vertex_id = 0;
- index_id = 0;
- array_len = 0;
+ Surface() :
+ mesh(NULL),
+ format(0),
+ array_id(0),
+ vertex_id(0),
+ index_id(0),
+ index_wireframe_id(0),
+ array_wireframe_id(0),
+ instancing_array_wireframe_id(0),
+ index_wireframe_len(0),
+ array_len(0),
+ index_array_len(0),
+ array_byte_size(0),
+ index_array_byte_size(0),
+ primitive(VS::PRIMITIVE_POINTS),
+ active(false),
+ total_data_size(0) {
type = GEOMETRY_SURFACE;
- primitive = VS::PRIMITIVE_POINTS;
- index_array_len = 0;
- active = false;
-
- total_data_size = 0;
-
- index_wireframe_id = 0;
- array_wireframe_id = 0;
- instancing_array_wireframe_id = 0;
- index_wireframe_len = 0;
}
~Surface() {
@@ -708,11 +706,11 @@ public:
}
}
- Mesh() {
- blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED;
- blend_shape_count = 0;
- last_pass = 0;
- active = false;
+ Mesh() :
+ active(false),
+ blend_shape_count(0),
+ blend_shape_mode(VS::BLEND_SHAPE_MODE_NORMALIZED),
+ last_pass(0) {
}
};
@@ -780,19 +778,19 @@ public:
bool dirty_data;
MultiMesh() :
+ size(0),
+ transform_format(VS::MULTIMESH_TRANSFORM_2D),
+ color_format(VS::MULTIMESH_COLOR_NONE),
+ custom_data_format(VS::MULTIMESH_CUSTOM_DATA_NONE),
update_list(this),
- mesh_list(this) {
- dirty_aabb = true;
- dirty_data = true;
- xform_floats = 0;
- color_floats = 0;
- custom_data_floats = 0;
- visible_instances = -1;
- size = 0;
- buffer = 0;
- transform_format = VS::MULTIMESH_TRANSFORM_2D;
- color_format = VS::MULTIMESH_COLOR_NONE;
- custom_data_format = VS::MULTIMESH_CUSTOM_DATA_NONE;
+ mesh_list(this),
+ buffer(0),
+ visible_instances(-1),
+ xform_floats(0),
+ color_floats(0),
+ custom_data_floats(0),
+ dirty_aabb(true),
+ dirty_data(true) {
}
};
@@ -889,11 +887,10 @@ public:
Transform2D base_transform_2d;
Skeleton() :
+ use_2d(false),
+ size(0),
+ texture(0),
update_list(this) {
- size = 0;
-
- use_2d = false;
- texture = 0;
}
};
@@ -1174,37 +1171,31 @@ public:
Transform emission_transform;
Particles() :
- particle_element(this) {
- cycle_number = 0;
- emitting = false;
- one_shot = false;
- amount = 0;
- lifetime = 1.0;
- pre_process_time = 0.0;
- explosiveness = 0.0;
- randomness = 0.0;
- use_local_coords = true;
- fixed_fps = 0;
- fractional_delta = false;
- frame_remainder = 0;
- histories_enabled = false;
- speed_scale = 1.0;
- random_seed = 0;
-
- restart_request = false;
-
- custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8));
-
- draw_order = VS::PARTICLES_DRAW_ORDER_INDEX;
+ inactive(true),
+ inactive_time(0.0),
+ emitting(false),
+ one_shot(false),
+ amount(0),
+ lifetime(1.0),
+ pre_process_time(0.0),
+ explosiveness(0.0),
+ randomness(0.0),
+ restart_request(false),
+ custom_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))),
+ use_local_coords(true),
+ draw_order(VS::PARTICLES_DRAW_ORDER_INDEX),
+ histories_enabled(false),
+ particle_element(this),
+ prev_ticks(0),
+ random_seed(0),
+ cycle_number(0),
+ speed_scale(1.0),
+ fixed_fps(0),
+ fractional_delta(false),
+ frame_remainder(0),
+ clear(true) {
particle_buffers[0] = 0;
particle_buffers[1] = 0;
-
- prev_ticks = 0;
-
- clear = true;
- inactive = true;
- inactive_time = 0.0;
-
glGenBuffers(2, particle_buffers);
glGenVertexArrays(2, particle_vaos);
}
@@ -1309,9 +1300,9 @@ public:
GLuint color;
int levels;
- MipMaps() {
- color = 0;
- levels = 0;
+ MipMaps() :
+ color(0),
+ levels(0) {
}
};
@@ -1326,10 +1317,10 @@ public:
Vector<GLuint> depth_mipmap_fbos; //fbos for depth mipmapsla ver
- SSAO() {
+ SSAO() :
+ linear_depth(0) {
blur_fbo[0] = 0;
blur_fbo[1] = 0;
- linear_depth = 0;
}
} ssao;
@@ -1341,7 +1332,8 @@ public:
GLuint fbo;
GLuint color;
- Exposure() { fbo = 0; }
+ Exposure() :
+ fbo(0) {}
} exposure;
uint64_t last_exposure_tick;
@@ -1355,26 +1347,22 @@ public:
RID texture;
- RenderTarget() {
-
- msaa = VS::VIEWPORT_MSAA_DISABLED;
- width = 0;
- height = 0;
- depth = 0;
- fbo = 0;
+ RenderTarget() :
+ fbo(0),
+ depth(0),
+ last_exposure_tick(0),
+ width(0),
+ height(0),
+ used_in_frame(false),
+ msaa(VS::VIEWPORT_MSAA_DISABLED) {
exposure.fbo = 0;
buffers.fbo = 0;
- used_in_frame = false;
-
for (int i = 0; i < RENDER_TARGET_FLAG_MAX; i++) {
flags[i] = false;
}
flags[RENDER_TARGET_HDR] = true;
-
buffers.active = false;
buffers.effects_active = false;
-
- last_exposure_tick = 0;
}
};
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index adb145711d..2a2280e8a4 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -786,7 +786,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
/** CANVAS ITEM SHADER **/
actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
- actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv_interp";
+ actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "gl_PointSize";
actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 407e7ec591..ff273e4e9f 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1565,6 +1565,7 @@ void main() {
//lay out everything, whathever is unused is optimized away anyway
highp vec3 vertex = vertex_interp;
+ vec3 view = -normalize(vertex_interp);
vec3 albedo = vec3(1.0);
vec3 transmission = vec3(0.0);
float metallic = 0.0;
@@ -1699,7 +1700,7 @@ FRAGMENT_SHADER_CODE
vec3 ambient_light;
vec3 env_reflection_light = vec3(0.0, 0.0, 0.0);
- vec3 eye_vec = -normalize(vertex_interp);
+ vec3 eye_vec = view;
#ifdef USE_RADIANCE_MAP
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 720824d451..4988557dcb 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -743,35 +743,28 @@ String AudioDriverPulseAudio::capture_get_device() {
return name;
}
-AudioDriverPulseAudio::AudioDriverPulseAudio() {
-
- pa_ml = NULL;
- pa_ctx = NULL;
- pa_str = NULL;
- pa_rec_str = NULL;
-
- mutex = NULL;
- thread = NULL;
-
- device_name = "Default";
- new_device = "Default";
- default_device = "";
-
+AudioDriverPulseAudio::AudioDriverPulseAudio() :
+ thread(NULL),
+ mutex(NULL),
+ pa_ml(NULL),
+ pa_ctx(NULL),
+ pa_str(NULL),
+ pa_rec_str(NULL),
+ device_name("Default"),
+ new_device("Default"),
+ default_device(""),
+ mix_rate(0),
+ buffer_frames(0),
+ pa_buffer_size(0),
+ channels(0),
+ pa_ready(0),
+ pa_status(0),
+ active(false),
+ thread_exited(false),
+ exit_thread(false),
+ latency(0) {
samples_in.clear();
samples_out.clear();
-
- mix_rate = 0;
- buffer_frames = 0;
- pa_buffer_size = 0;
- channels = 0;
- pa_ready = 0;
- pa_status = 0;
-
- active = false;
- thread_exited = false;
- exit_thread = false;
-
- latency = 0;
}
AudioDriverPulseAudio::~AudioDriverPulseAudio() {
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index bc6ceb1e7e..80537315af 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -194,13 +194,12 @@ void AudioDriverRtAudio::finish() {
}
}
-AudioDriverRtAudio::AudioDriverRtAudio() {
-
- active = false;
- mutex = NULL;
- dac = NULL;
- mix_rate = DEFAULT_MIX_RATE;
- speaker_mode = SPEAKER_MODE_STEREO;
+AudioDriverRtAudio::AudioDriverRtAudio() :
+ speaker_mode(SPEAKER_MODE_STEREO),
+ mutex(NULL),
+ dac(NULL),
+ mix_rate(DEFAULT_MIX_RATE),
+ active(false) {
}
#endif
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 3b97b95f7c..10f6be3cbe 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -309,11 +309,10 @@ FileAccess *FileAccessUnix::create_libc() {
CloseNotificationFunc FileAccessUnix::close_notification_func = NULL;
-FileAccessUnix::FileAccessUnix() {
-
- f = NULL;
- flags = 0;
- last_error = OK;
+FileAccessUnix::FileAccessUnix() :
+ f(NULL),
+ flags(0),
+ last_error(OK) {
}
FileAccessUnix::~FileAccessUnix() {
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
index 833b17f122..740b1edb9c 100644
--- a/drivers/unix/net_socket_posix.cpp
+++ b/drivers/unix/net_socket_posix.cpp
@@ -167,10 +167,10 @@ void NetSocketPosix::cleanup() {
#endif
}
-NetSocketPosix::NetSocketPosix() {
- _sock = SOCK_EMPTY;
- _ip_type = IP::TYPE_NONE;
- _is_stream = false;
+NetSocketPosix::NetSocketPosix() :
+ _sock(SOCK_EMPTY),
+ _ip_type(IP::TYPE_NONE),
+ _is_stream(false) {
}
NetSocketPosix::~NetSocketPosix() {
diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h
index 3d94f3ba49..71f56cfb5b 100644
--- a/drivers/wasapi/audio_driver_wasapi.h
+++ b/drivers/wasapi/audio_driver_wasapi.h
@@ -58,17 +58,17 @@ class AudioDriverWASAPI : public AudioDriver {
String device_name;
String new_device;
- AudioDeviceWASAPI() {
- audio_client = NULL;
- render_client = NULL;
- capture_client = NULL;
- active = false;
- format_tag = 0;
- bits_per_sample = 0;
- channels = 0;
- frame_size = 0;
- device_name = "Default";
- new_device = "Default";
+ AudioDeviceWASAPI() :
+ audio_client(NULL),
+ render_client(NULL),
+ capture_client(NULL),
+ active(false),
+ format_tag(0),
+ bits_per_sample(0),
+ channels(0),
+ frame_size(0),
+ device_name("Default"),
+ new_device("Default") {
}
};
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 2582478259..a289945aa7 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -307,11 +307,10 @@ uint64_t FileAccessWindows::_get_modified_time(const String &p_file) {
}
}
-FileAccessWindows::FileAccessWindows() {
-
- f = NULL;
- flags = 0;
- last_error = OK;
+FileAccessWindows::FileAccessWindows() :
+ f(NULL),
+ flags(0),
+ last_error(OK) {
}
FileAccessWindows::~FileAccessWindows() {
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp
index 52dcfacdf8..dbccad3b5d 100644
--- a/drivers/windows/thread_windows.cpp
+++ b/drivers/windows/thread_windows.cpp
@@ -93,9 +93,8 @@ void ThreadWindows::make_default() {
wait_to_finish_func = wait_to_finish_func_windows;
}
-ThreadWindows::ThreadWindows() {
-
- handle = NULL;
+ThreadWindows::ThreadWindows() :
+ handle(NULL) {
}
ThreadWindows::~ThreadWindows() {
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index 452a1105ca..ce2f0db0fc 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.cpp
+++ b/drivers/xaudio2/audio_driver_xaudio2.cpp
@@ -91,7 +91,7 @@ Error AudioDriverXAudio2::init() {
thread = Thread::create(AudioDriverXAudio2::thread_func, this);
return OK;
-};
+}
void AudioDriverXAudio2::thread_func(void *p_udata) {
@@ -131,10 +131,10 @@ void AudioDriverXAudio2::thread_func(void *p_udata) {
WaitForSingleObject(ad->voice_callback.buffer_end_event, INFINITE);
}
}
- };
+ }
ad->thread_exited = true;
-};
+}
void AudioDriverXAudio2::start() {
@@ -144,17 +144,17 @@ void AudioDriverXAudio2::start() {
ERR_EXPLAIN("XAudio2 start error " + itos(hr));
ERR_FAIL();
}
-};
+}
int AudioDriverXAudio2::get_mix_rate() const {
return mix_rate;
-};
+}
AudioDriver::SpeakerMode AudioDriverXAudio2::get_speaker_mode() const {
return speaker_mode;
-};
+}
float AudioDriverXAudio2::get_latency() {
@@ -172,13 +172,13 @@ void AudioDriverXAudio2::lock() {
if (!thread || !mutex)
return;
mutex->lock();
-};
+}
void AudioDriverXAudio2::unlock() {
if (!thread || !mutex)
return;
mutex->unlock();
-};
+}
void AudioDriverXAudio2::finish() {
@@ -195,12 +195,12 @@ void AudioDriverXAudio2::finish() {
if (samples_in) {
memdelete_arr(samples_in);
- };
+ }
if (samples_out[0]) {
for (int i = 0; i < AUDIO_BUFFERS; i++) {
memdelete_arr(samples_out[i]);
}
- };
+ }
mastering_voice->DestroyVoice();
@@ -208,20 +208,18 @@ void AudioDriverXAudio2::finish() {
if (mutex)
memdelete(mutex);
thread = NULL;
-};
-
-AudioDriverXAudio2::AudioDriverXAudio2() {
+}
- mutex = NULL;
- thread = NULL;
+AudioDriverXAudio2::AudioDriverXAudio2() :
+ thread(NULL),
+ mutex(NULL),
+ current_buffer(0) {
wave_format = { 0 };
for (int i = 0; i < AUDIO_BUFFERS; i++) {
xaudio_buffer[i] = { 0 };
samples_out[i] = 0;
}
- current_buffer = 0;
-};
-
-AudioDriverXAudio2::~AudioDriverXAudio2(){
+}
-};
+AudioDriverXAudio2::~AudioDriverXAudio2() {
+}
diff --git a/editor/collada/collada.h b/editor/collada/collada.h
index b777fa04c2..2d5819902c 100644
--- a/editor/collada/collada.h
+++ b/editor/collada/collada.h
@@ -110,14 +110,13 @@ public:
float z_near;
float z_far;
- CameraData() {
-
- mode = MODE_PERSPECTIVE;
- perspective.y_fov = 0;
+ CameraData() :
+ mode(MODE_PERSPECTIVE),
+ aspect(1),
+ z_near(0.1),
+ z_far(100) {
perspective.x_fov = 0;
- aspect = 1;
- z_near = 0.1;
- z_far = 100;
+ perspective.y_fov = 0;
}
};
@@ -141,16 +140,14 @@ public:
float spot_angle;
float spot_exp;
- LightData() {
-
- mode = MODE_AMBIENT;
- color = Color(1, 1, 1, 1);
- constant_att = 0;
- linear_att = 0;
- quad_att = 0;
-
- spot_angle = 45;
- spot_exp = 1;
+ LightData() :
+ mode(MODE_AMBIENT),
+ color(Color(1, 1, 1, 1)),
+ constant_att(0),
+ linear_att(0),
+ quad_att(0),
+ spot_angle(45),
+ spot_exp(1) {
}
};
@@ -580,11 +577,11 @@ public:
float animation_length;
- State() {
- unit_scale = 1.0;
- up_axis = Vector3::AXIS_Y;
- import_flags = 0;
- animation_length = 0;
+ State() :
+ import_flags(0),
+ unit_scale(1.0),
+ up_axis(Vector3::AXIS_Y),
+ animation_length(0) {
}
} state;
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 6cd81626c7..b1f5bc4908 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -36,11 +36,35 @@
#include "filesystem_dock.h"
#include "servers/audio_server.h"
+void EditorAudioBus::_update_visible_channels() {
+
+ int i = 0;
+ for (; i < cc; i++) {
+
+ if (!channel[i].vu_l->is_visible()) {
+ channel[i].vu_l->show();
+ }
+ if (!channel[i].vu_r->is_visible()) {
+ channel[i].vu_r->show();
+ }
+ }
+
+ for (; i < CHANNELS_MAX; i++) {
+
+ if (channel[i].vu_l->is_visible()) {
+ channel[i].vu_l->hide();
+ }
+ if (channel[i].vu_r->is_visible()) {
+ channel[i].vu_r->hide();
+ }
+ }
+}
+
void EditorAudioBus::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
- for (int i = 0; i < cc; i++) {
+ for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
@@ -72,6 +96,11 @@ void EditorAudioBus::_notification(int p_what) {
if (p_what == NOTIFICATION_PROCESS) {
+ if (cc != AudioServer::get_singleton()->get_bus_channels(get_index())) {
+ cc = AudioServer::get_singleton()->get_bus_channels(get_index());
+ _update_visible_channels();
+ }
+
for (int i = 0; i < cc; i++) {
float real_peak[2] = { -100, -100 };
bool activity_found = false;
@@ -113,7 +142,7 @@ void EditorAudioBus::_notification(int p_what) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].peak_l = -100;
channel[i].peak_r = -100;
channel[i].prev_active = true;
@@ -124,7 +153,7 @@ void EditorAudioBus::_notification(int p_what) {
if (p_what == NOTIFICATION_THEME_CHANGED) {
- for (int i = 0; i < cc; i++) {
+ for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
@@ -709,9 +738,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
slider->connect("value_changed", this, "_volume_db_changed");
hb->add_child(slider);
- cc = AudioServer::get_singleton()->get_channel_count();
-
- for (int i = 0; i < cc; i++) {
+ cc = 0;
+ for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].vu_l = memnew(TextureProgress);
channel[i].vu_l->set_fill_mode(TextureProgress::FILL_BOTTOM_TO_TOP);
hb->add_child(channel[i].vu_l);
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index 4cdcb65d7b..02038fbe18 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -59,6 +59,7 @@ class EditorAudioBus : public PanelContainer {
VSlider *slider;
int cc;
+ static const int CHANNELS_MAX = 4;
struct {
bool prev_active;
@@ -68,7 +69,7 @@ class EditorAudioBus : public PanelContainer {
TextureProgress *vu_l;
TextureProgress *vu_r;
- } channel[4];
+ } channel[CHANNELS_MAX];
TextureRect *scale;
OptionButton *send;
@@ -102,6 +103,7 @@ class EditorAudioBus : public PanelContainer {
void _effect_selected();
void _delete_effect_pressed(int p_option);
void _effect_rmb(const Vector2 &p_pos);
+ void _update_visible_channels();
virtual Variant get_drag_data(const Point2 &p_point);
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 9df0f30ca4..71315f1377 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -222,11 +222,10 @@ String EditorExportPreset::get_custom_features() const {
return custom_features;
}
-EditorExportPreset::EditorExportPreset() {
-
- export_path = "";
- export_filter = EXPORT_ALL_RESOURCES;
- runnable = false;
+EditorExportPreset::EditorExportPreset() :
+ export_filter(EXPORT_ALL_RESOURCES),
+ export_path(""),
+ runnable(false) {
}
///////////////////////////////////
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 483af489a3..881e86fb12 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -206,9 +206,9 @@ public:
PropertyInfo option;
Variant default_value;
- ExportOption(const PropertyInfo &p_info, const Variant &p_default) {
- option = p_info;
- default_value = p_default;
+ ExportOption(const PropertyInfo &p_info, const Variant &p_default) :
+ option(p_info),
+ default_value(p_default) {
}
ExportOption() {}
};
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 4e4c5143f2..a9f7be0fff 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -130,7 +130,7 @@ void EditorHelpSearch::_notification(int p_what) {
} break;
case NOTIFICATION_POPUP_HIDE: {
- results_tree->clear();
+ results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
get_ok()->set_disabled(true);
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect());
} break;
@@ -579,18 +579,12 @@ bool EditorHelpSearch::Runner::work(uint64_t slot) {
return true;
}
-EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree, const String &p_term, int p_search_flags) {
-
- ui_service = p_icon_service;
- results_tree = p_results_tree;
- term = p_term.strip_edges();
- search_flags = p_search_flags;
-
- if ((search_flags & SEARCH_CASE_SENSITIVE) == 0)
- term = term.to_lower();
-
- empty_icon = ui_service->get_icon("ArrowRight", "EditorIcons");
- disabled_color = ui_service->get_color("disabled_font_color", "Editor");
-
- phase = 0;
+EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree, const String &p_term, int p_search_flags) :
+ phase(0),
+ ui_service(p_icon_service),
+ results_tree(p_results_tree),
+ term((p_search_flags & SEARCH_CASE_SENSITIVE) == 0 ? p_term.strip_edges().to_lower() : p_term.strip_edges()),
+ search_flags(p_search_flags),
+ empty_icon(ui_service->get_icon("ArrowRight", "EditorIcons")),
+ disabled_color(ui_service->get_color("disabled_font_color", "Editor")) {
}
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 86b2db877e..cd024ff870 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -829,11 +829,11 @@ void EditorPlugin::_bind_methods() {
BIND_ENUM_CONSTANT(DOCK_SLOT_MAX);
}
-EditorPlugin::EditorPlugin() {
- undo_redo = NULL;
- input_event_forwarding_always_enabled = false;
- force_draw_over_forwarding_enabled = false;
- last_main_screen_name = "";
+EditorPlugin::EditorPlugin() :
+ undo_redo(NULL),
+ input_event_forwarding_always_enabled(false),
+ force_draw_over_forwarding_enabled(false),
+ last_main_screen_name("") {
}
EditorPlugin::~EditorPlugin() {
diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp
index 9d3ab59116..a28d071d77 100644
--- a/editor/editor_sectioned_inspector.cpp
+++ b/editor/editor_sectioned_inspector.cpp
@@ -298,19 +298,18 @@ EditorInspector *SectionedInspector::get_inspector() {
return inspector;
}
-SectionedInspector::SectionedInspector() {
-
- obj = -1;
-
- search_box = NULL;
-
+SectionedInspector::SectionedInspector() :
+ obj(-1),
+ sections(memnew(Tree)),
+ filter(memnew(SectionedInspectorFilter)),
+ inspector(memnew(EditorInspector)),
+ search_box(NULL) {
add_constant_override("autohide", 1); // Fixes the dragger always showing up
VBoxContainer *left_vb = memnew(VBoxContainer);
left_vb->set_custom_minimum_size(Size2(170, 0) * EDSCALE);
add_child(left_vb);
- sections = memnew(Tree);
sections->set_v_size_flags(SIZE_EXPAND_FILL);
sections->set_hide_root(true);
@@ -321,8 +320,6 @@ SectionedInspector::SectionedInspector() {
right_vb->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(right_vb);
- filter = memnew(SectionedInspectorFilter);
- inspector = memnew(EditorInspector);
inspector->set_v_size_flags(SIZE_EXPAND_FILL);
right_vb->add_child(inspector, true);
inspector->set_use_doc_hints(true);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 4a373aafd9..7fa5019cb7 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -256,6 +256,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_THREAD_SAFE_METHOD_
+ /* Languages */
+
{
String lang_hint = "en";
String host_lang = OS::get_singleton()->get_locale();
@@ -291,11 +293,13 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/editor/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
}
+ /* Interface */
+
+ // Editor
_initial_set("interface/editor/display_scale", 0);
hints["interface/editor/display_scale"] = PropertyInfo(Variant::INT, "interface/editor/display_scale", PROPERTY_HINT_ENUM, "Auto,75%,100%,125%,150%,175%,200%,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/custom_display_scale", 1.0f);
hints["interface/editor/custom_display_scale"] = PropertyInfo(Variant::REAL, "interface/editor/custom_display_scale", PROPERTY_HINT_RANGE, "0.75,3,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- _initial_set("interface/scene_tabs/show_script_button", false);
_initial_set("interface/editor/main_font_size", 14);
hints["interface/editor/main_font_size"] = PropertyInfo(Variant::INT, "interface/editor/main_font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/code_font_size", 14);
@@ -317,12 +321,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/editor/dim_amount"] = PropertyInfo(Variant::REAL, "interface/editor/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/dim_transition_time", 0.08f);
hints["interface/editor/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/editor/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT);
-
_initial_set("interface/editor/separate_distraction_mode", false);
-
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
_initial_set("interface/editor/quit_confirmation", true);
+ // Theme
_initial_set("interface/theme/preset", "Default");
hints["interface/theme/preset"] = PropertyInfo(Variant::STRING, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Alien,Arc,Godot 2,Grey,Light,Solarized (Dark),Solarized (Light),Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/theme/icon_and_font_color", 0);
@@ -342,35 +345,78 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/theme/custom_theme", "");
hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ // Scene tabs
_initial_set("interface/scene_tabs/show_extension", false);
_initial_set("interface/scene_tabs/show_thumbnail_on_hover", true);
_initial_set("interface/scene_tabs/resize_if_many_tabs", true);
_initial_set("interface/scene_tabs/minimum_width", 50);
hints["interface/scene_tabs/minimum_width"] = PropertyInfo(Variant::INT, "interface/scene_tabs/minimum_width", PROPERTY_HINT_RANGE, "50,500,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/scene_tabs/show_script_button", false);
+
+ /* Filesystem */
+ // Directories
_initial_set("filesystem/directories/autoscan_project_path", "");
hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR);
_initial_set("filesystem/directories/default_project_path", OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS));
hints["filesystem/directories/default_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/default_project_path", PROPERTY_HINT_GLOBAL_DIR);
- _initial_set("filesystem/directories/default_project_export_path", "");
- hints["filesystem/directories/default_project_export_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/default_project_export_path", PROPERTY_HINT_GLOBAL_DIR);
- _initial_set("interface/scene_tabs/show_script_button", false);
+ // On save
+ _initial_set("filesystem/on_save/compress_binary_resources", true);
+ _initial_set("filesystem/on_save/safe_save_on_backup_then_rename", true);
+
+ // File dialog
+ _initial_set("filesystem/file_dialog/show_hidden_files", false);
+ _initial_set("filesystem/file_dialog/display_mode", 0);
+ hints["filesystem/file_dialog/display_mode"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
+ _initial_set("filesystem/file_dialog/thumbnail_size", 64);
+ hints["filesystem/file_dialog/thumbnail_size"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
+
+ // Import
+ _initial_set("filesystem/import/pvrtc_texture_tool", "");
+#ifdef WINDOWS_ENABLED
+ hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "*.exe");
+#else
+ hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "");
+#endif
+ _initial_set("filesystem/import/pvrtc_fast_conversion", false);
+
+ /* Docks */
+
+ // SceneTree
+ _initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
+ _initial_set("docks/scene_tree/draw_relationship_lines", true);
+ _initial_set("docks/scene_tree/relationship_line_color", Color::html("464646"));
+
+ // FileSystem
+ _initial_set("docks/filesystem/display_mode", 0);
+ hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Tree only, Split");
+ _initial_set("docks/filesystem/thumbnail_size", 64);
+ hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
+ _initial_set("docks/filesystem/files_display_mode", 0);
+ hints["docks/filesystem/files_display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/files_display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
+ _initial_set("docks/filesystem/always_show_folders", true);
+
+ // Property editor
+ _initial_set("docks/property_editor/auto_refresh_interval", 0.3);
+
+ /* Text editor */
+
+ // Theme
_initial_set("text_editor/theme/color_theme", "Adaptive");
hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default,Custom");
-
_initial_set("text_editor/theme/line_spacing", 6);
_initial_set("text_editor/theme/selection_color", Color::html("40808080"));
_load_default_text_editor_theme();
+ // Highlighting
_initial_set("text_editor/highlighting/syntax_highlighting", true);
-
_initial_set("text_editor/highlighting/highlight_all_occurrences", true);
_initial_set("text_editor/highlighting/highlight_current_line", true);
_initial_set("text_editor/highlighting/highlight_type_safe_lines", true);
- _initial_set("text_editor/cursor/scroll_past_end_of_file", false);
+ // Indent
_initial_set("text_editor/indent/type", 0);
hints["text_editor/indent/type"] = PropertyInfo(Variant::INT, "text_editor/indent/type", PROPERTY_HINT_ENUM, "Tabs,Spaces");
_initial_set("text_editor/indent/size", 4);
@@ -380,6 +426,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/indent/draw_indent_guides", true);
_initial_set("text_editor/indent/draw_tabs", true);
+ // Line numbers
_initial_set("text_editor/line_numbers/show_line_numbers", true);
_initial_set("text_editor/line_numbers/line_numbers_zero_padded", false);
_initial_set("text_editor/line_numbers/show_breakpoint_gutter", true);
@@ -389,35 +436,45 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/line_numbers/line_length_guideline_column", 80);
hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 1");
+ // Open scripts
_initial_set("text_editor/open_scripts/smooth_scrolling", true);
_initial_set("text_editor/open_scripts/v_scroll_speed", 80);
_initial_set("text_editor/open_scripts/show_members_overview", true);
+ // Files
_initial_set("text_editor/files/trim_trailing_whitespace_on_save", false);
- _initial_set("text_editor/completion/idle_parse_delay", 2);
+ _initial_set("text_editor/files/autosave_interval_secs", 0);
+ _initial_set("text_editor/files/restore_scripts_on_load", true);
+
+ // Tools
_initial_set("text_editor/tools/create_signal_callbacks", true);
_initial_set("text_editor/tools/sort_members_outline_alphabetically", false);
- _initial_set("text_editor/files/autosave_interval_secs", 0);
+ // Cursor
+ _initial_set("text_editor/cursor/scroll_past_end_of_file", false);
_initial_set("text_editor/cursor/block_caret", false);
_initial_set("text_editor/cursor/caret_blink", true);
_initial_set("text_editor/cursor/caret_blink_speed", 0.5);
hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::REAL, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.01");
_initial_set("text_editor/cursor/right_click_moves_caret", true);
+ // Completion
+ _initial_set("text_editor/completion/idle_parse_delay", 2);
_initial_set("text_editor/completion/auto_brace_complete", false);
_initial_set("text_editor/completion/put_callhint_tooltip_below_current_line", true);
_initial_set("text_editor/completion/callhint_tooltip_offset", Vector2());
- _initial_set("text_editor/files/restore_scripts_on_load", true);
_initial_set("text_editor/completion/complete_file_paths", true);
_initial_set("text_editor/completion/add_type_hints", false);
- _initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
- _initial_set("docks/scene_tree/draw_relationship_lines", true);
- _initial_set("docks/scene_tree/relationship_line_color", Color::html("464646"));
+ // Help
+ _initial_set("text_editor/help/show_help_index", true);
+ /* Editors */
+
+ // GridMap
_initial_set("editors/grid_map/pick_distance", 5000.0);
+ // 3D
_initial_set("editors/3d/primary_grid_color", Color::html("909090"));
hints["editors/3d/primary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/primary_grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
@@ -434,7 +491,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/3d/default_z_near", 0.05);
_initial_set("editors/3d/default_z_far", 500.0);
- // navigation
+ // 3D: Navigation
_initial_set("editors/3d/navigation/navigation_scheme", 0);
_initial_set("editors/3d/navigation/invert_y_axis", false);
hints["editors/3d/navigation/navigation_scheme"] = PropertyInfo(Variant::INT, "editors/3d/navigation/navigation_scheme", PROPERTY_HINT_ENUM, "Godot,Maya,Modo");
@@ -448,14 +505,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["editors/3d/navigation/pan_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/pan_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
_initial_set("editors/3d/navigation/zoom_modifier", 4);
hints["editors/3d/navigation/zoom_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/zoom_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
-
- // _initial_set("editors/3d/navigation/emulate_numpad", false); not used at the moment
_initial_set("editors/3d/navigation/warped_mouse_panning", true);
- // navigation feel
+ // 3D: Navigation feel
_initial_set("editors/3d/navigation_feel/orbit_sensitivity", 0.4);
hints["editors/3d/navigation_feel/orbit_sensitivity"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/orbit_sensitivity", PROPERTY_HINT_RANGE, "0.0, 2, 0.01");
-
_initial_set("editors/3d/navigation_feel/orbit_inertia", 0.05);
hints["editors/3d/navigation_feel/orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
_initial_set("editors/3d/navigation_feel/translation_inertia", 0.15);
@@ -467,7 +521,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/3d/navigation_feel/manipulation_translation_inertia", 0.075);
hints["editors/3d/navigation_feel/manipulation_translation_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/manipulation_translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- // freelook
+ // 3D: Freelook
_initial_set("editors/3d/freelook/freelook_inertia", 0.1);
hints["editors/3d/freelook/freelook_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
_initial_set("editors/3d/freelook/freelook_base_speed", 5.0);
@@ -478,6 +532,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["editors/3d/freelook/freelook_modifier_speed_factor"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_modifier_speed_factor", PROPERTY_HINT_RANGE, "0.0, 10.0, 0.1");
_initial_set("editors/3d/freelook/freelook_speed_zoom_link", false);
+ // 2D
_initial_set("editors/2d/grid_color", Color(1.0, 1.0, 1.0, 0.07));
_initial_set("editors/2d/guides_color", Color(0.6, 0.0, 0.8));
_initial_set("editors/2d/bone_width", 5);
@@ -494,9 +549,19 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/2d/scroll_to_pan", false);
_initial_set("editors/2d/pan_speed", 20);
+ // Polygon editor
_initial_set("editors/poly_editor/point_grab_radius", 8);
_initial_set("editors/poly_editor/show_previous_outline", true);
+ // Animation
+ _initial_set("editors/animation/autorename_animation_tracks", true);
+ _initial_set("editors/animation/confirm_insert_track", true);
+ _initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));
+ _initial_set("editors/animation/onion_layers_future_color", Color(0, 1, 0));
+
+ /* Run */
+
+ // Window placement
_initial_set("run/window_placement/rect", 1);
hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
String screen_hints = "Same as Editor,Previous Monitor,Next Monitor";
@@ -507,54 +572,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("run/window_placement/screen", 0);
hints["run/window_placement/screen"] = PropertyInfo(Variant::INT, "run/window_placement/screen", PROPERTY_HINT_ENUM, screen_hints);
- _initial_set("filesystem/on_save/compress_binary_resources", true);
- _initial_set("filesystem/on_save/save_modified_external_resources", true);
-
- _initial_set("text_editor/tools/create_signal_callbacks", true);
-
- _initial_set("filesystem/file_dialog/show_hidden_files", false);
- _initial_set("filesystem/file_dialog/display_mode", 0);
- hints["filesystem/file_dialog/display_mode"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
-
- _initial_set("filesystem/file_dialog/thumbnail_size", 64);
- hints["filesystem/file_dialog/thumbnail_size"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
-
- _initial_set("docks/filesystem/display_mode", 0);
- hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Tree only, Split");
- _initial_set("docks/filesystem/thumbnail_size", 64);
- hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
- _initial_set("docks/filesystem/files_display_mode", 0);
- hints["docks/filesystem/files_display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/files_display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
- _initial_set("docks/filesystem/always_show_folders", true);
-
- _initial_set("editors/animation/autorename_animation_tracks", true);
- _initial_set("editors/animation/confirm_insert_track", true);
- _initial_set("editors/animation/onion_layers_past_color", Color(1, 0, 0));
- _initial_set("editors/animation/onion_layers_future_color", Color(0, 1, 0));
-
- _initial_set("docks/property_editor/texture_preview_width", 48);
- _initial_set("docks/property_editor/auto_refresh_interval", 0.3);
- _initial_set("text_editor/help/show_help_index", true);
-
- _initial_set("filesystem/import/ask_save_before_reimport", false);
-
- _initial_set("filesystem/import/pvrtc_texture_tool", "");
-#ifdef WINDOWS_ENABLED
- hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "*.exe");
-#else
- hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "");
-#endif
- _initial_set("filesystem/import/pvrtc_fast_conversion", false);
-
+ // Auto save
_initial_set("run/auto_save/save_before_running", true);
+
+ // Output
_initial_set("run/output/always_clear_output_on_play", true);
_initial_set("run/output/always_open_output_on_play", true);
_initial_set("run/output/always_close_output_on_stop", false);
- _initial_set("filesystem/resources/save_compressed_resources", true);
- _initial_set("filesystem/resources/auto_reload_modified_images", true);
- _initial_set("filesystem/import/automatic_reimport_on_sources_changed", true);
- _initial_set("filesystem/on_save/safe_save_on_backup_then_rename", true);
+ /* Extra config */
if (p_extra_config.is_valid()) {
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 7b0de9617c..dabe697f10 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -71,23 +71,23 @@ private:
bool hide_from_editor;
bool save;
bool restart_if_changed;
- VariantContainer() {
- variant = Variant();
- initial = Variant();
- order = 0;
- hide_from_editor = false;
- has_default_value = false;
- save = false;
- restart_if_changed = false;
+ VariantContainer() :
+ order(0),
+ variant(Variant()),
+ initial(Variant()),
+ has_default_value(false),
+ hide_from_editor(false),
+ save(false),
+ restart_if_changed(false) {
}
- VariantContainer(const Variant &p_variant, int p_order) {
- variant = p_variant;
- initial = Variant();
- order = p_order;
- hide_from_editor = false;
- has_default_value = false;
- save = false;
- restart_if_changed = false;
+ VariantContainer(const Variant &p_variant, int p_order) :
+ order(p_order),
+ variant(p_variant),
+ initial(Variant()),
+ has_default_value(false),
+ hide_from_editor(false),
+ save(false),
+ restart_if_changed(false) {
}
};
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 8e69090da3..93c462f747 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -771,7 +771,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
int binormal_pos = (binormal_src->stride ? binormal_src->stride : 3) * p.indices[src + binormal_ofs];
ERR_FAIL_INDEX_V(binormal_pos, binormal_src->array.size(), ERR_INVALID_DATA);
- Vector3 binormal = Vector3(-binormal_src->array[binormal_pos + 0], -binormal_src->array[binormal_pos + 1], -binormal_src->array[binormal_pos + 2]); // Due to Godots face order it seems we need to flip our binormal!
+ Vector3 binormal = Vector3(binormal_src->array[binormal_pos + 0], binormal_src->array[binormal_pos + 1], binormal_src->array[binormal_pos + 2]);
int tangent_pos = (tangent_src->stride ? tangent_src->stride : 3) * p.indices[src + tangent_ofs];
ERR_FAIL_INDEX_V(tangent_pos, tangent_src->array.size(), ERR_INVALID_DATA);
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 00ca86a43b..b5d646d5d4 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -899,16 +899,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
array[Mesh::ARRAY_NORMAL] = _decode_accessor_as_vec3(state, a["NORMAL"], true);
}
if (a.has("TANGENT")) {
- PoolVector<float> tans = _decode_accessor_as_floats(state, a["TANGENT"], true);
- { // we need our binormals inversed, so flip our w component.
- int ts = tans.size();
- PoolVector<float>::Write w = tans.write();
-
- for (int j = 3; j < ts; j += 4) {
- w[j] *= -1.0;
- }
- }
- array[Mesh::ARRAY_TANGENT] = tans;
+ array[Mesh::ARRAY_TANGENT] = _decode_accessor_as_floats(state, a["TANGENT"], true);
}
if (a.has("TEXCOORD_0")) {
array[Mesh::ARRAY_TEX_UV] = _decode_accessor_as_vec2(state, a["TEXCOORD_0"], true);
diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h
index 8258ec41fd..721db30112 100644
--- a/editor/import/editor_scene_importer_gltf.h
+++ b/editor/import/editor_scene_importer_gltf.h
@@ -114,14 +114,14 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
Vector<int> children;
Vector<Node *> godot_nodes;
- GLTFNode() {
- // child_of_skeleton = -1;
- // skeleton_skin = -1;
- mesh = -1;
- camera = -1;
- parent = -1;
- skin = -1;
- scale = Vector3(1, 1, 1);
+ GLTFNode() :
+ parent(-1),
+ mesh(-1),
+ camera(-1),
+ skin(-1),
+ //skeleton_skin(-1),
+ //child_of_skeleton(-1),
+ scale(Vector3(1, 1, 1)) {
}
};
@@ -134,12 +134,12 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
bool indices;
//matrices need to be transformed to this
- GLTFBufferView() {
- buffer = 0;
- byte_offset = 0;
- byte_length = 0;
- byte_stride = 0;
- indices = false;
+ GLTFBufferView() :
+ buffer(0),
+ byte_offset(0),
+ byte_length(0),
+ byte_stride(0),
+ indices(false) {
}
};
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 55f4cc7439..85ea0d343c 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -272,12 +272,18 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
for (int i = 0; i < 10; i++)
file->get_32(); // i wish to know why should i do this... no doc!
- // only read 0x00 (loop forward) and 0x01 (loop ping-pong) and skip anything else because
- // it's not supported (loop backward), reserved for future uses or sampler specific
+ // only read 0x00 (loop forward), 0x01 (loop ping-pong) and 0x02 (loop backward)
+ // Skip anything else because it's not supported, reserved for future uses or sampler specific
// from https://sites.google.com/site/musicgapi/technical-documents/wav-file-format#smpl (loop type values table)
int loop_type = file->get_32();
- if (loop_type == 0x00 || loop_type == 0x01) {
- loop = loop_type ? AudioStreamSample::LOOP_PING_PONG : AudioStreamSample::LOOP_FORWARD;
+ if (loop_type == 0x00 || loop_type == 0x01 || loop_type == 0x02) {
+ if (loop_type == 0x00) {
+ loop = AudioStreamSample::LOOP_FORWARD;
+ } else if (loop_type == 0x01) {
+ loop = AudioStreamSample::LOOP_PING_PONG;
+ } else if (loop_type == 0x02) {
+ loop = AudioStreamSample::LOOP_BACKWARD;
+ }
loop_begin = file->get_32();
loop_end = file->get_32();
}
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index a85f4456f7..cc030dac4c 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -826,13 +826,11 @@ void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) {
}
}
-AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class) {
-
- editor = p_node;
- polygon_editor = p_polygon_editor;
- klass = p_class;
+AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class) :
+ polygon_editor(p_polygon_editor),
+ editor(p_node),
+ klass(p_class) {
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(polygon_editor);
-
polygon_editor->hide();
}
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index e2daefdec6..e7934ea3a0 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -70,9 +70,9 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
String name;
String type;
Ref<Script> script;
- AddOption(const String &p_name = String(), const String &p_type = String()) {
- name = p_name;
- type = p_type;
+ AddOption(const String &p_name = String(), const String &p_type = String()) :
+ name(p_name),
+ type(p_type) {
}
};
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index b6dbc6fcf7..6d4b1d1b9c 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1078,7 +1078,7 @@ void ScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter)
if (p_highlighter != NULL)
highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(p_highlighter->get_name()), true);
else
- highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text("Standard"), true);
+ highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(TTR("Standard")), true);
}
void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
@@ -1512,7 +1512,7 @@ ScriptTextEditor::ScriptTextEditor() {
convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F6), EDIT_CAPITALIZE);
convert_case->connect("id_pressed", this, "_edit_option");
- highlighters["Standard"] = NULL;
+ highlighters[TTR("Standard")] = NULL;
highlighter_menu = memnew(PopupMenu);
highlighter_menu->set_name("highlighter_menu");
edit_menu->get_popup()->add_child(highlighter_menu);
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 4e35014459..f4b061f494 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -197,17 +197,6 @@ void CSGShape::mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvTexc
fvTexcOut[1] = t.y;
}
-void CSGShape::mikktSetTSpaceBasic(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert) {
- ShapeUpdateSurface &surface = *((ShapeUpdateSurface *)pContext->m_pUserData);
-
- int i = (iFace * 3 + iVert) * 4;
-
- surface.tansw[i++] = fvTangent[0];
- surface.tansw[i++] = fvTangent[1];
- surface.tansw[i++] = fvTangent[2];
- surface.tansw[i++] = fSign;
-}
-
void CSGShape::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT,
const tbool bIsOrientationPreserving, const int iFace, const int iVert) {
@@ -216,7 +205,7 @@ void CSGShape::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const f
int i = iFace * 3 + iVert;
Vector3 normal = surface.normalsw[i];
Vector3 tangent = Vector3(fvTangent[0], fvTangent[1], fvTangent[2]);
- Vector3 bitangent = Vector3(fvBiTangent[0], fvBiTangent[1], fvBiTangent[2]);
+ Vector3 bitangent = Vector3(-fvBiTangent[0], -fvBiTangent[1], -fvBiTangent[2]); // for some reason these are reversed, something with the coordinate system in Godot
float d = bitangent.dot(normal.cross(tangent));
i *= 4;
diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h
index 0a4bb5f665..7326f3d36a 100644
--- a/modules/csg/csg_shape.h
+++ b/modules/csg/csg_shape.h
@@ -97,7 +97,6 @@ private:
static void mikktGetPosition(const SMikkTSpaceContext *pContext, float fvPosOut[], const int iFace, const int iVert);
static void mikktGetNormal(const SMikkTSpaceContext *pContext, float fvNormOut[], const int iFace, const int iVert);
static void mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvTexcOut[], const int iFace, const int iVert);
- static void mikktSetTSpaceBasic(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert);
static void mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT,
const tbool bIsOrientationPreserving, const int iFace, const int iVert);
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 546c88e74a..ae2eb6288c 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -124,8 +124,8 @@ public:
Point2 im_position;
bool im_active;
- ImeCallback im_callback;
- void *im_target;
+ String im_text;
+ Point2 im_selection;
power_osx *power_manager;
@@ -245,7 +245,8 @@ public:
virtual void set_ime_active(const bool p_active);
virtual void set_ime_position(const Point2 &p_pos);
- virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp);
+ virtual Point2 get_ime_selection() const;
+ virtual String get_ime_text() const;
virtual String get_unique_id() const;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index e7b3e35381..f8dec3ec7a 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -427,11 +427,13 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
} else {
[markedText initWithString:aString];
}
- if (OS_OSX::singleton->im_callback) {
+ if (OS_OSX::singleton->im_active) {
imeMode = true;
- String ret;
- ret.parse_utf8([[markedText mutableString] UTF8String]);
- OS_OSX::singleton->im_callback(OS_OSX::singleton->im_target, ret, Point2(selectedRange.location, selectedRange.length));
+ OS_OSX::singleton->im_text.parse_utf8([[markedText mutableString] UTF8String]);
+ OS_OSX::singleton->im_selection = Point2(selectedRange.location, selectedRange.length);
+
+ if (OS_OSX::singleton->get_main_loop())
+ OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
}
}
@@ -443,8 +445,13 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)unmarkText {
imeMode = false;
[[markedText mutableString] setString:@""];
- if (OS_OSX::singleton->im_callback)
- OS_OSX::singleton->im_callback(OS_OSX::singleton->im_target, "", Point2());
+ if (OS_OSX::singleton->im_active) {
+ OS_OSX::singleton->im_text = String();
+ OS_OSX::singleton->im_selection = Point2();
+
+ if (OS_OSX::singleton->get_main_loop())
+ OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
+ }
}
- (NSArray *)validAttributesForMarkedText {
@@ -1136,12 +1143,14 @@ inline void sendPanEvent(double dx, double dy, int modifierFlags) {
@end
-void OS_OSX::set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp) {
- im_callback = p_callback;
- im_target = p_inp;
- if (!im_callback) {
- [window_view cancelComposition];
- }
+Point2 OS_OSX::get_ime_selection() const {
+
+ return im_selection;
+}
+
+String OS_OSX::get_ime_text() const {
+
+ return im_text;
}
String OS_OSX::get_unique_id() const {
@@ -1169,10 +1178,14 @@ String OS_OSX::get_unique_id() const {
}
void OS_OSX::set_ime_active(const bool p_active) {
+
im_active = p_active;
+ if (!im_active)
+ [window_view cancelComposition];
}
void OS_OSX::set_ime_position(const Point2 &p_pos) {
+
im_position = p_pos;
}
@@ -2637,8 +2650,6 @@ OS_OSX::OS_OSX() {
singleton = this;
im_active = false;
im_position = Point2();
- im_callback = NULL;
- im_target = NULL;
layered_window = false;
autoreleasePool = [[NSAutoreleasePool alloc] init];
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index d847fa2471..2534f676ca 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -42,7 +42,7 @@
#include "servers/visual_server.h"
Mutex *CanvasItemMaterial::material_mutex = NULL;
-SelfList<CanvasItemMaterial>::List CanvasItemMaterial::dirty_materials;
+SelfList<CanvasItemMaterial>::List *CanvasItemMaterial::dirty_materials = NULL;
Map<CanvasItemMaterial::MaterialKey, CanvasItemMaterial::ShaderData> CanvasItemMaterial::shader_map;
CanvasItemMaterial::ShaderNames *CanvasItemMaterial::shader_names = NULL;
@@ -52,6 +52,8 @@ void CanvasItemMaterial::init_shaders() {
material_mutex = Mutex::create();
#endif
+ dirty_materials = memnew(SelfList<CanvasItemMaterial>::List);
+
shader_names = memnew(ShaderNames);
shader_names->particles_anim_h_frames = "particles_anim_h_frames";
@@ -61,6 +63,9 @@ void CanvasItemMaterial::init_shaders() {
void CanvasItemMaterial::finish_shaders() {
+ memdelete(dirty_materials);
+ dirty_materials = NULL;
+
#ifndef NO_THREADS
memdelete(material_mutex);
#endif
@@ -68,7 +73,7 @@ void CanvasItemMaterial::finish_shaders() {
void CanvasItemMaterial::_update_shader() {
- dirty_materials.remove(&element);
+ dirty_materials->remove(&element);
MaterialKey mk = _compute_key();
if (mk.key == current_key.key)
@@ -157,9 +162,9 @@ void CanvasItemMaterial::flush_changes() {
if (material_mutex)
material_mutex->lock();
- while (dirty_materials.first()) {
+ while (dirty_materials->first()) {
- dirty_materials.first()->self()->_update_shader();
+ dirty_materials->first()->self()->_update_shader();
}
if (material_mutex)
@@ -172,7 +177,7 @@ void CanvasItemMaterial::_queue_shader_change() {
material_mutex->lock();
if (!element.in_list()) {
- dirty_materials.add(&element);
+ dirty_materials->add(&element);
}
if (material_mutex)
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 9fe7cb1e00..1a6016e6e1 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -109,7 +109,7 @@ private:
}
static Mutex *material_mutex;
- static SelfList<CanvasItemMaterial>::List dirty_materials;
+ static SelfList<CanvasItemMaterial>::List *dirty_materials;
SelfList<CanvasItemMaterial> element;
void _update_shader();
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 5bde224ce3..7b4c7de029 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -463,9 +463,9 @@ void Sprite3D::_draw() {
Plane tangent;
if (axis == Vector3::AXIS_X) {
- tangent = Plane(0, 0, -1, -1);
+ tangent = Plane(0, 0, -1, 1);
} else {
- tangent = Plane(1, 0, 0, -1);
+ tangent = Plane(1, 0, 0, 1);
}
RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS);
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 299c304c5f..42d7f1b080 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -831,7 +831,6 @@ void LineEdit::_notification(int p_what) {
OS::get_singleton()->set_ime_active(true);
OS::get_singleton()->set_ime_position(get_global_position() + Point2(using_placeholder ? 0 : x_ofs, y_ofs + caret_height));
- OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
}
} break;
case NOTIFICATION_FOCUS_ENTER: {
@@ -843,7 +842,6 @@ void LineEdit::_notification(int p_what) {
OS::get_singleton()->set_ime_active(true);
Point2 cursor_pos = Point2(get_cursor_position(), 1) * get_minimum_size().height;
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
- OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->show_virtual_keyboard(text, get_global_rect());
@@ -852,7 +850,6 @@ void LineEdit::_notification(int p_what) {
case NOTIFICATION_FOCUS_EXIT: {
OS::get_singleton()->set_ime_position(Point2());
- OS::get_singleton()->set_ime_intermediate_text_callback(NULL, NULL);
OS::get_singleton()->set_ime_active(false);
ime_text = "";
ime_selection = Point2();
@@ -861,6 +858,12 @@ void LineEdit::_notification(int p_what) {
OS::get_singleton()->hide_virtual_keyboard();
} break;
+ case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
+
+ ime_text = OS::get_singleton()->get_ime_text();
+ ime_selection = OS::get_singleton()->get_ime_selection();
+ update();
+ } break;
}
}
@@ -1461,13 +1464,6 @@ void LineEdit::set_right_icon(const Ref<Texture> &p_icon) {
update();
}
-void LineEdit::_ime_text_callback(void *p_self, String p_text, Point2 p_selection) {
- LineEdit *self = (LineEdit *)p_self;
- self->ime_text = p_text;
- self->ime_selection = p_selection;
- self->update();
-}
-
void LineEdit::_text_changed() {
if (expand_to_text_length)
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 5294d99da0..ddcdeda8c0 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -122,7 +122,6 @@ private:
Timer *caret_blink_timer;
- static void _ime_text_callback(void *p_self, String p_text, Point2 p_selection);
void _text_changed();
void _emit_text_change();
bool expand_to_text_length;
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index ace22dddff..4f43bb0581 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -110,6 +110,9 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
range_click_timer->start();
line_edit->grab_focus();
+
+ drag.allowed = true;
+ drag.capture_pos = mb->get_position();
} break;
case BUTTON_RIGHT: {
@@ -133,14 +136,7 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
}
}
- if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == 1) {
-
- //set_default_cursor_shape(CURSOR_VSIZE);
- Vector2 cpos = Vector2(mb->get_position().x, mb->get_position().y);
- drag.mouse_pos = cpos;
- }
-
- if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == 1) {
+ if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
//set_default_cursor_shape(CURSOR_ARROW);
range_click_timer->stop();
@@ -150,32 +146,24 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
warp_mouse(drag.capture_pos);
}
+ drag.allowed = false;
}
Ref<InputEventMouseMotion> mm = p_event;
- if (mm.is_valid() && mm->get_button_mask() & 1) {
-
- Vector2 cpos = mm->get_position();
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
if (drag.enabled) {
- float diff_y = drag.mouse_pos.y - cpos.y;
- diff_y = Math::pow(ABS(diff_y), 1.8f) * SGN(diff_y);
- diff_y *= 0.1;
-
- drag.mouse_pos = cpos;
- drag.base_val = CLAMP(drag.base_val + get_step() * diff_y, get_min(), get_max());
-
- set_value(drag.base_val);
-
- } else if (drag.mouse_pos.distance_to(cpos) > 2) {
+ drag.diff_y += mm->get_relative().y;
+ float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SGN(drag.diff_y);
+ set_value(CLAMP(drag.base_val + get_step() * diff_y, get_min(), get_max()));
+ } else if (drag.allowed && drag.capture_pos.distance_to(mm->get_position()) > 2) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
drag.enabled = true;
drag.base_val = get_value();
- drag.mouse_pos = cpos;
- drag.capture_pos = cpos;
+ drag.diff_y = 0;
}
}
}
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index f1ee26d9f3..6425af7158 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -54,10 +54,10 @@ class SpinBox : public Range {
struct Drag {
float base_val;
+ bool allowed;
bool enabled;
- Vector2 from;
- Vector2 mouse_pos;
Vector2 capture_pos;
+ float diff_y;
} drag;
void _line_edit_focus_exit();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 18c80ba9a3..1504ad7bf1 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1438,7 +1438,6 @@ void TextEdit::_notification(int p_what) {
if (has_focus()) {
OS::get_singleton()->set_ime_active(true);
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos + Point2(0, get_row_height()));
- OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
}
} break;
@@ -1451,7 +1450,6 @@ void TextEdit::_notification(int p_what) {
OS::get_singleton()->set_ime_active(true);
Point2 cursor_pos = Point2(cursor_get_column(), cursor_get_line()) * get_row_height();
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
- OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->show_virtual_keyboard(get_text(), get_global_rect());
@@ -1459,7 +1457,6 @@ void TextEdit::_notification(int p_what) {
case NOTIFICATION_FOCUS_EXIT: {
OS::get_singleton()->set_ime_position(Point2());
- OS::get_singleton()->set_ime_intermediate_text_callback(NULL, NULL);
OS::get_singleton()->set_ime_active(false);
ime_text = "";
ime_selection = Point2();
@@ -1467,14 +1464,13 @@ void TextEdit::_notification(int p_what) {
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->hide_virtual_keyboard();
} break;
- }
-}
+ case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
-void TextEdit::_ime_text_callback(void *p_self, String p_text, Point2 p_selection) {
- TextEdit *self = (TextEdit *)p_self;
- self->ime_text = p_text;
- self->ime_selection = p_selection;
- self->update();
+ ime_text = OS::get_singleton()->get_ime_text();
+ ime_selection = OS::get_singleton()->get_ime_selection();
+ update();
+ } break;
+ }
}
void TextEdit::_consume_pair_symbol(CharType ch) {
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 4d398f56b6..7ecb2be6e7 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -382,8 +382,6 @@ private:
void _scroll_lines_up();
void _scroll_lines_down();
- static void _ime_text_callback(void *p_self, String p_text, Point2 p_selection);
-
//void mouse_motion(const Point& p_pos, const Point& p_rel, int p_button_mask);
Size2 get_minimum_size() const;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 3f664bab10..be4878588e 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -639,6 +639,7 @@ void SceneTree::_notification(int p_notification) {
}
} break;
case NOTIFICATION_OS_MEMORY_WARNING:
+ case NOTIFICATION_OS_IME_UPDATE:
case NOTIFICATION_WM_MOUSE_ENTER:
case NOTIFICATION_WM_MOUSE_EXIT:
case NOTIFICATION_WM_FOCUS_IN:
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 9ee85b64b6..35132c1195 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -249,6 +249,10 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in
int32_t todo = p_frames;
+ if (base->loop_mode == AudioStreamSample::LOOP_BACKWARD) {
+ sign = -1;
+ }
+
float base_rate = AudioServer::get_singleton()->get_mix_rate();
float srate = base->mix_rate;
srate *= p_rate_scale;
@@ -621,7 +625,7 @@ void AudioStreamSample::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data");
ADD_PROPERTY(PropertyInfo(Variant::INT, "format", PROPERTY_HINT_ENUM, "8-Bit,16-Bit,IMA-ADPCM"), "set_format", "get_format");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_mode", PROPERTY_HINT_ENUM, "Disabled,Forward,Ping-Pong"), "set_loop_mode", "get_loop_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_mode", PROPERTY_HINT_ENUM, "Disabled,Forward,Ping-Pong,Backward"), "set_loop_mode", "get_loop_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_begin"), "set_loop_begin", "get_loop_begin");
ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_end"), "set_loop_end", "get_loop_end");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_rate"), "set_mix_rate", "get_mix_rate");
@@ -634,6 +638,7 @@ void AudioStreamSample::_bind_methods() {
BIND_ENUM_CONSTANT(LOOP_DISABLED);
BIND_ENUM_CONSTANT(LOOP_FORWARD);
BIND_ENUM_CONSTANT(LOOP_PING_PONG);
+ BIND_ENUM_CONSTANT(LOOP_BACKWARD);
}
AudioStreamSample::AudioStreamSample() {
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index a27acc92b7..2c39e0a11e 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -94,7 +94,8 @@ public:
enum LoopMode {
LOOP_DISABLED,
LOOP_FORWARD,
- LOOP_PING_PONG
+ LOOP_PING_PONG,
+ LOOP_BACKWARD
};
private:
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 5327ed318f..f6dc60900f 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -258,7 +258,7 @@ ShaderMaterial::~ShaderMaterial() {
/////////////////////////////////
Mutex *SpatialMaterial::material_mutex = NULL;
-SelfList<SpatialMaterial>::List SpatialMaterial::dirty_materials;
+SelfList<SpatialMaterial>::List *SpatialMaterial::dirty_materials = NULL;
Map<SpatialMaterial::MaterialKey, SpatialMaterial::ShaderData> SpatialMaterial::shader_map;
SpatialMaterial::ShaderNames *SpatialMaterial::shader_names = NULL;
@@ -268,6 +268,8 @@ void SpatialMaterial::init_shaders() {
material_mutex = Mutex::create();
#endif
+ dirty_materials = memnew(SelfList<SpatialMaterial>::List);
+
shader_names = memnew(ShaderNames);
shader_names->albedo = "albedo";
@@ -348,12 +350,15 @@ void SpatialMaterial::finish_shaders() {
memdelete(material_mutex);
#endif
+ memdelete(dirty_materials);
+ dirty_materials = NULL;
+
memdelete(shader_names);
}
void SpatialMaterial::_update_shader() {
- dirty_materials.remove(&element);
+ dirty_materials->remove(&element);
MaterialKey mk = _compute_key();
if (mk.key == current_key.key)
@@ -699,7 +704,7 @@ void SpatialMaterial::_update_shader() {
if (features[FEATURE_DEPTH_MAPPING] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //depthmap not supported with triplanar
code += "\t{\n";
- code += "\t\tvec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT*depth_flip.x,BINORMAL*depth_flip.y,NORMAL));\n"; // binormal is negative due to mikktspace
+ code += "\t\tvec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT*depth_flip.x,-BINORMAL*depth_flip.y,NORMAL));\n"; // binormal is negative due to mikktspace, flip 'unflips' it ;-)
if (deep_parallax) {
code += "\t\tfloat num_layers = mix(float(depth_max_layers),float(depth_min_layers), abs(dot(vec3(0.0, 0.0, 1.0), view_dir)));\n";
@@ -1002,9 +1007,9 @@ void SpatialMaterial::flush_changes() {
if (material_mutex)
material_mutex->lock();
- while (dirty_materials.first()) {
+ while (dirty_materials->first()) {
- dirty_materials.first()->self()->_update_shader();
+ dirty_materials->first()->self()->_update_shader();
}
if (material_mutex)
@@ -1017,7 +1022,7 @@ void SpatialMaterial::_queue_shader_change() {
material_mutex->lock();
if (!element.in_list()) {
- dirty_materials.add(&element);
+ dirty_materials->add(&element);
}
if (material_mutex)
@@ -1315,7 +1320,7 @@ void SpatialMaterial::set_flag(Flags p_flag, bool p_enabled) {
return;
flags[p_flag] = p_enabled;
- if (p_flag == FLAG_USE_ALPHA_SCISSOR) {
+ if (p_flag == FLAG_USE_ALPHA_SCISSOR || p_flag == FLAG_UNSHADED) {
_change_notify();
}
_queue_shader_change();
@@ -1421,6 +1426,48 @@ void SpatialMaterial::_validate_property(PropertyInfo &property) const {
if ((property.name == "depth_min_layers" || property.name == "depth_max_layers") && !deep_parallax) {
property.usage = 0;
}
+
+ if (flags[FLAG_UNSHADED]) {
+ if (property.name.begins_with("anisotropy")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("ao")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("clearcoat")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("emission")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("metallic")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("normal")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("rim")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("roughness")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("subsurf_scatter")) {
+ property.usage = 0;
+ }
+
+ if (property.name.begins_with("transmission")) {
+ property.usage = 0;
+ }
+ }
}
void SpatialMaterial::set_line_width(float p_line_width) {
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 54fceaddc1..921f3baeaa 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -360,7 +360,7 @@ private:
};
static Mutex *material_mutex;
- static SelfList<SpatialMaterial>::List dirty_materials;
+ static SelfList<SpatialMaterial>::List *dirty_materials;
static ShaderNames *shader_names;
SelfList<SpatialMaterial> element;
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index dae01e8d96..92c185712a 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -31,7 +31,7 @@
#include "particles_material.h"
Mutex *ParticlesMaterial::material_mutex = NULL;
-SelfList<ParticlesMaterial>::List ParticlesMaterial::dirty_materials;
+SelfList<ParticlesMaterial>::List *ParticlesMaterial::dirty_materials = NULL;
Map<ParticlesMaterial::MaterialKey, ParticlesMaterial::ShaderData> ParticlesMaterial::shader_map;
ParticlesMaterial::ShaderNames *ParticlesMaterial::shader_names = NULL;
@@ -41,6 +41,8 @@ void ParticlesMaterial::init_shaders() {
material_mutex = Mutex::create();
#endif
+ dirty_materials = memnew(SelfList<ParticlesMaterial>::List);
+
shader_names = memnew(ShaderNames);
shader_names->spread = "spread";
@@ -106,12 +108,15 @@ void ParticlesMaterial::finish_shaders() {
memdelete(material_mutex);
#endif
+ memdelete(dirty_materials);
+ dirty_materials = NULL;
+
memdelete(shader_names);
}
void ParticlesMaterial::_update_shader() {
- dirty_materials.remove(&element);
+ dirty_materials->remove(&element);
MaterialKey mk = _compute_key();
if (mk.key == current_key.key)
@@ -584,9 +589,9 @@ void ParticlesMaterial::flush_changes() {
if (material_mutex)
material_mutex->lock();
- while (dirty_materials.first()) {
+ while (dirty_materials->first()) {
- dirty_materials.first()->self()->_update_shader();
+ dirty_materials->first()->self()->_update_shader();
}
if (material_mutex)
@@ -599,7 +604,7 @@ void ParticlesMaterial::_queue_shader_change() {
material_mutex->lock();
if (!element.in_list()) {
- dirty_materials.add(&element);
+ dirty_materials->add(&element);
}
if (material_mutex)
diff --git a/scene/resources/particles_material.h b/scene/resources/particles_material.h
index 06ebb3c4dc..20b505532e 100644
--- a/scene/resources/particles_material.h
+++ b/scene/resources/particles_material.h
@@ -126,7 +126,7 @@ private:
}
static Mutex *material_mutex;
- static SelfList<ParticlesMaterial>::List dirty_materials;
+ static SelfList<ParticlesMaterial>::List *dirty_materials;
struct ShaderNames {
StringName spread;
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index dafdddd990..6dedb74fad 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -306,7 +306,7 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
Vector3 p = Vector3(x * radius * w, y * radius * w, z);
points.push_back(p + Vector3(0.0, 0.0, 0.5 * mid_height));
normals.push_back(p.normalized());
- ADD_TANGENT(-y, x, 0.0, -1.0)
+ ADD_TANGENT(-y, x, 0.0, 1.0)
uvs.push_back(Vector2(u, v * onethird));
point++;
@@ -345,7 +345,7 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
Vector3 p = Vector3(x * radius, y * radius, z);
points.push_back(p);
normals.push_back(Vector3(x, y, 0.0));
- ADD_TANGENT(-y, x, 0.0, -1.0)
+ ADD_TANGENT(-y, x, 0.0, 1.0)
uvs.push_back(Vector2(u, onethird + (v * onethird)));
point++;
@@ -385,7 +385,7 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
Vector3 p = Vector3(x * radius * w, y * radius * w, z);
points.push_back(p + Vector3(0.0, 0.0, -0.5 * mid_height));
normals.push_back(p.normalized());
- ADD_TANGENT(-y, x, 0.0, -1.0)
+ ADD_TANGENT(-y, x, 0.0, 1.0)
uvs.push_back(Vector2(u, twothirds + ((v - 1.0) * onethird)));
point++;
@@ -514,14 +514,14 @@ void CubeMesh::_create_mesh_array(Array &p_arr) const {
// front
points.push_back(Vector3(x, -y, -start_pos.z)); // double negative on the Z!
normals.push_back(Vector3(0.0, 0.0, 1.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0);
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0);
uvs.push_back(Vector2(u, v));
point++;
// back
points.push_back(Vector3(-x, -y, start_pos.z));
normals.push_back(Vector3(0.0, 0.0, -1.0));
- ADD_TANGENT(-1.0, 0.0, 0.0, -1.0);
+ ADD_TANGENT(-1.0, 0.0, 0.0, 1.0);
uvs.push_back(Vector2(twothirds + u, v));
point++;
@@ -568,14 +568,14 @@ void CubeMesh::_create_mesh_array(Array &p_arr) const {
// right
points.push_back(Vector3(-start_pos.x, -y, -z));
normals.push_back(Vector3(1.0, 0.0, 0.0));
- ADD_TANGENT(0.0, 0.0, -1.0, -1.0);
+ ADD_TANGENT(0.0, 0.0, -1.0, 1.0);
uvs.push_back(Vector2(onethird + u, v));
point++;
// left
points.push_back(Vector3(start_pos.x, -y, z));
normals.push_back(Vector3(-1.0, 0.0, 0.0));
- ADD_TANGENT(0.0, 0.0, 1.0, -1.0);
+ ADD_TANGENT(0.0, 0.0, 1.0, 1.0);
uvs.push_back(Vector2(u, 0.5 + v));
point++;
@@ -622,14 +622,14 @@ void CubeMesh::_create_mesh_array(Array &p_arr) const {
// top
points.push_back(Vector3(-x, -start_pos.y, -z));
normals.push_back(Vector3(0.0, 1.0, 0.0));
- ADD_TANGENT(-1.0, 0.0, 0.0, -1.0);
+ ADD_TANGENT(-1.0, 0.0, 0.0, 1.0);
uvs.push_back(Vector2(onethird + u, 0.5 + v));
point++;
// bottom
points.push_back(Vector3(x, start_pos.y, -z));
normals.push_back(Vector3(0.0, -1.0, 0.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0);
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0);
uvs.push_back(Vector2(twothirds + u, 0.5 + v));
point++;
@@ -773,7 +773,7 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const {
Vector3 p = Vector3(x * radius, y, z * radius);
points.push_back(p);
normals.push_back(Vector3(x, 0.0, z));
- ADD_TANGENT(z, 0.0, -x, -1.0)
+ ADD_TANGENT(z, 0.0, -x, 1.0)
uvs.push_back(Vector2(u, v * 0.5));
point++;
@@ -799,7 +799,7 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const {
thisrow = point;
points.push_back(Vector3(0.0, y, 0.0));
normals.push_back(Vector3(0.0, 1.0, 0.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0)
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0)
uvs.push_back(Vector2(0.25, 0.75));
point++;
@@ -816,7 +816,7 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const {
Vector3 p = Vector3(x * top_radius, y, z * top_radius);
points.push_back(p);
normals.push_back(Vector3(0.0, 1.0, 0.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0)
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0)
uvs.push_back(Vector2(u, v));
point++;
@@ -835,7 +835,7 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const {
thisrow = point;
points.push_back(Vector3(0.0, y, 0.0));
normals.push_back(Vector3(0.0, -1.0, 0.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0)
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0)
uvs.push_back(Vector2(0.75, 0.75));
point++;
@@ -852,7 +852,7 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const {
Vector3 p = Vector3(x * bottom_radius, y, z * bottom_radius);
points.push_back(p);
normals.push_back(Vector3(0.0, -1.0, 0.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0)
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0)
uvs.push_back(Vector2(u, v));
point++;
@@ -982,7 +982,7 @@ void PlaneMesh::_create_mesh_array(Array &p_arr) const {
points.push_back(Vector3(-x, 0.0, -z));
normals.push_back(Vector3(0.0, 1.0, 0.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0);
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0);
uvs.push_back(Vector2(1.0 - u, 1.0 - v)); /* 1.0 - uv to match orientation with Quad */
point++;
@@ -1108,14 +1108,14 @@ void PrismMesh::_create_mesh_array(Array &p_arr) const {
/* front */
points.push_back(Vector3(start_x + x, -y, -start_pos.z)); // double negative on the Z!
normals.push_back(Vector3(0.0, 0.0, 1.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0);
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0);
uvs.push_back(Vector2(offset_front + u, v));
point++;
/* back */
points.push_back(Vector3(start_x + scaled_size_x - x, -y, start_pos.z));
normals.push_back(Vector3(0.0, 0.0, -1.0));
- ADD_TANGENT(-1.0, 0.0, 0.0, -1.0);
+ ADD_TANGENT(-1.0, 0.0, 0.0, 1.0);
uvs.push_back(Vector2(twothirds + offset_back + u, v));
point++;
@@ -1187,14 +1187,14 @@ void PrismMesh::_create_mesh_array(Array &p_arr) const {
/* right */
points.push_back(Vector3(right, -y, -z));
normals.push_back(normal_right);
- ADD_TANGENT(0.0, 0.0, -1.0, -1.0);
+ ADD_TANGENT(0.0, 0.0, -1.0, 1.0);
uvs.push_back(Vector2(onethird + u, v));
point++;
/* left */
points.push_back(Vector3(left, -y, z));
normals.push_back(normal_left);
- ADD_TANGENT(0.0, 0.0, 1.0, -1.0);
+ ADD_TANGENT(0.0, 0.0, 1.0, 1.0);
uvs.push_back(Vector2(u, 0.5 + v));
point++;
@@ -1241,7 +1241,7 @@ void PrismMesh::_create_mesh_array(Array &p_arr) const {
/* bottom */
points.push_back(Vector3(x, start_pos.y, -z));
normals.push_back(Vector3(0.0, -1.0, 0.0));
- ADD_TANGENT(1.0, 0.0, 0.0, -1.0);
+ ADD_TANGENT(1.0, 0.0, 0.0, 1.0);
uvs.push_back(Vector2(twothirds + u, 0.5 + v));
point++;
@@ -1382,7 +1382,7 @@ void QuadMesh::_create_mesh_array(Array &p_arr) const {
tangents.set(i * 4 + 0, 1.0);
tangents.set(i * 4 + 1, 0.0);
tangents.set(i * 4 + 2, 0.0);
- tangents.set(i * 4 + 3, -1.0);
+ tangents.set(i * 4 + 3, 1.0);
static const Vector2 quad_uv[4] = {
Vector2(0, 1),
@@ -1468,7 +1468,7 @@ void SphereMesh::_create_mesh_array(Array &p_arr) const {
points.push_back(p);
normals.push_back(p.normalized());
};
- ADD_TANGENT(z, 0.0, -x, -1.0)
+ ADD_TANGENT(z, 0.0, -x, 1.0)
uvs.push_back(Vector2(u, v));
point++;
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 9907636e91..842252d5d9 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -853,7 +853,7 @@ void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, cons
if (vtx != NULL) {
vtx->tangent = Vector3(fvTangent[0], fvTangent[1], fvTangent[2]);
- vtx->binormal = Vector3(fvBiTangent[0], fvBiTangent[1], fvBiTangent[2]);
+ vtx->binormal = Vector3(-fvBiTangent[0], -fvBiTangent[1], -fvBiTangent[2]); // for some reason these are reversed, something with the coordinate system in Godot
}
}
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 6fd996c3d3..530976f084 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -737,6 +737,12 @@ float AudioServer::get_bus_volume_db(int p_bus) const {
return buses[p_bus]->volume_db;
}
+int AudioServer::get_bus_channels(int p_bus) const {
+
+ ERR_FAIL_INDEX_V(p_bus, buses.size(), 0);
+ return buses[p_bus]->channels.size();
+}
+
void AudioServer::set_bus_send(int p_bus, const StringName &p_send) {
ERR_FAIL_INDEX(p_bus, buses.size());
@@ -1267,6 +1273,8 @@ void AudioServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_bus_name", "bus_idx"), &AudioServer::get_bus_name);
ClassDB::bind_method(D_METHOD("get_bus_index", "bus_name"), &AudioServer::get_bus_index);
+ ClassDB::bind_method(D_METHOD("get_bus_channels", "bus_idx"), &AudioServer::get_bus_channels);
+
ClassDB::bind_method(D_METHOD("set_bus_volume_db", "bus_idx", "volume_db"), &AudioServer::set_bus_volume_db);
ClassDB::bind_method(D_METHOD("get_bus_volume_db", "bus_idx"), &AudioServer::get_bus_volume_db);
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 52fa84e3e6..642af9b252 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -299,6 +299,8 @@ public:
String get_bus_name(int p_bus) const;
int get_bus_index(const StringName &p_bus_name) const;
+ int get_bus_channels(int p_bus) const;
+
void set_bus_volume_db(int p_bus, float p_volume_db);
float get_bus_volume_db(int p_bus) const;
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index baafe2f8d0..b5e03b4826 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -86,6 +86,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
@@ -118,6 +119,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
@@ -126,6 +128,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
@@ -229,7 +232,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_VEC"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_HEIGHT"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_COLOR"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_UV"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_UV"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW_COLOR"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);