summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS.md2
-rw-r--r--DONORS.md51
-rw-r--r--core/error_macros.cpp7
-rw-r--r--core/error_macros.h41
-rw-r--r--core/global_constants.cpp150
-rw-r--r--core/io/http_client.cpp12
-rw-r--r--core/io/http_client.h2
-rw-r--r--core/map.h1
-rw-r--r--core/math/a_star.cpp1
-rw-r--r--core/os/input_event.h4
-rw-r--r--core/script_language.cpp1
-rw-r--r--core/script_language.h3
-rw-r--r--core/set.h1
-rw-r--r--core/translation.cpp13
-rw-r--r--core/translation.h4
-rw-r--r--core/typedefs.h4
-rw-r--r--doc/classes/@Global Scope.xml134
-rw-r--r--doc/classes/AudioEffectFilter.xml2
-rw-r--r--doc/classes/BaseButton.xml11
-rw-r--r--doc/classes/Camera2D.xml10
-rw-r--r--doc/classes/CubeMap.xml8
-rw-r--r--doc/classes/EditorImportPlugin.xml4
-rw-r--r--doc/classes/Environment.xml62
-rw-r--r--doc/classes/HTTPClient.xml18
-rw-r--r--doc/classes/ParallaxLayer.xml2
-rw-r--r--doc/classes/Quat.xml2
-rw-r--r--doc/classes/RayCast.xml18
-rw-r--r--doc/classes/RayCast2D.xml18
-rw-r--r--doc/classes/Script.xml6
-rw-r--r--doc/classes/SpatialMaterial.xml2
-rw-r--r--doc/classes/TextEdit.xml16
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp2
-rw-r--r--drivers/gles3/shaders/scene.glsl6
-rw-r--r--editor/code_editor.cpp1
-rw-r--r--editor/editor_node.cpp10
-rw-r--r--editor/editor_settings.cpp3
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp1
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp90
-rw-r--r--editor/plugins/texture_region_editor_plugin.h4
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp45
-rw-r--r--editor/project_settings_editor.cpp211
-rw-r--r--editor/project_settings_editor.h13
-rw-r--r--editor/script_create_dialog.cpp35
-rw-r--r--editor/script_create_dialog.h1
-rw-r--r--editor/script_editor_debugger.cpp63
-rw-r--r--editor/script_editor_debugger.h2
-rw-r--r--main/performance.cpp38
-rw-r--r--main/performance.h8
-rw-r--r--modules/gdnative/include/pluginscript/godot_pluginscript.h1
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp7
-rw-r--r--modules/gdnative/nativescript/nativescript.h3
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.cpp4
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.h1
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp5
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.h2
-rw-r--r--modules/gdscript/gd_editor.cpp11
-rw-r--r--modules/gdscript/gd_parser.cpp3
-rw-r--r--modules/gdscript/gd_script.cpp5
-rw-r--r--modules/gdscript/gd_script.h2
-rw-r--r--modules/mono/csharp_script.cpp23
-rw-r--r--modules/mono/csharp_script.h2
-rw-r--r--modules/mono/editor/bindings_generator.cpp48
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp23
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp22
-rw-r--r--modules/mono/editor/mono_bottom_panel.h2
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp12
-rw-r--r--modules/mono/mono_gd/gd_mono_method.cpp41
-rw-r--r--modules/visual_script/visual_script.cpp9
-rw-r--r--modules/visual_script/visual_script.h3
-rw-r--r--platform/javascript/audio_driver_javascript.cpp79
-rw-r--r--platform/javascript/audio_driver_javascript.h16
-rw-r--r--platform/osx/os_osx.h3
-rw-r--r--platform/osx/os_osx.mm17
-rw-r--r--scene/2d/navigation_polygon.cpp2
-rw-r--r--scene/2d/ray_cast_2d.cpp18
-rw-r--r--scene/2d/ray_cast_2d.h3
-rw-r--r--scene/3d/SCsub3
-rw-r--r--scene/3d/light.cpp6
-rw-r--r--scene/3d/ray_cast.cpp18
-rw-r--r--scene/3d/ray_cast.h3
-rw-r--r--scene/gui/nine_patch_rect.cpp (renamed from scene/gui/patch_9_rect.cpp)4
-rw-r--r--scene/gui/nine_patch_rect.h (renamed from scene/gui/patch_9_rect.h)8
-rw-r--r--scene/gui/text_edit.cpp18
-rw-r--r--scene/gui/text_edit.h4
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/register_scene_types.cpp11
-rw-r--r--scene/resources/environment.cpp5
-rw-r--r--scene/resources/material.cpp10
-rw-r--r--scene/resources/material.h2
-rw-r--r--servers/visual/shader_types.cpp2
91 files changed, 1166 insertions, 442 deletions
diff --git a/AUTHORS.md b/AUTHORS.md
index bf833d1435..3fd8227fa7 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -47,9 +47,11 @@ name is available.
Geequlim
Gen (dbsGen)
George Marques (vnen)
+ Gerrit Großkopf (Grosskopf)
Gilles Roudiere (groud)
Guilherme Felipe (guilhermefelipecgs)
Hein-Pieter van Braam (hpvb)
+ Hiroshi Ogawa (hi-ogawa)
Hubert Jarosz (Marqin)
Hugo Locurcio (Calinou)
Ignacio Etcheverry (neikeq)
diff --git a/DONORS.md b/DONORS.md
index 57902fb2fc..784cf58255 100644
--- a/DONORS.md
+++ b/DONORS.md
@@ -20,28 +20,38 @@ None so far, but your company could be the first! :)
## Mini sponsors
- Arron Washington
- Chris Phyffer
+ Andreas
+ Andreas Hirschauer
Christian Uldall Pedersen
+ E Hewert
Hein-Pieter van Braam
Matthieu Huvé
+ Nathan Warden
Neal Gompa (Conan Kudo)
Olimpiu Metiu
Ruslan Mustakov
+ Slobodan Milnovic
## Gold donors
Alexander Otto
+ Asdf
+ Blair Allen
+ cheese65536
Jake Bo
Javier
- Nathan Warden
+ Manuele Finocchiaro
+ Officine Pixel S.n.c.
Ranoller
Rémi Verschelde
Stephan Lanfermann
Andreas Schüle
+ Austen McRae
Bernhard Liebl
+ Gerald E Butler
Jordan M Lucas
+ Kris Michael
BanjoNode2D
Chris Serino
@@ -53,16 +63,20 @@ None so far, but your company could be the first! :)
Henrique Alves
Laurence Bannister
Leo
+ mhilbrunner
Przemysław Gołąb (n-pigeon)
Robert Willes
Robin Arys
+ ScottMakesGames
summerblind
Testus Maximus
Thomas Bjarnelöf
+ Xavier Tan
Amanda Haldy
Andreas Haas
Bryanna M
+ Chris Brown
Cody Parker
D
Ezra Theunissen
@@ -70,25 +84,32 @@ None so far, but your company could be the first! :)
François Cantin
Hendrik Mans
Jeppe Zapp
- Johannes Wuensch
Justin Arnold
Justo Delgado Baudí
Leandro Voltolino
+ Lucien Boudy
Myles
- Robert Podgorski
- Scott Beacon
+ Noah
+ Trent McPheron
x1212
## Silver donors
+ 1D_Inc
+ Alessandro Senese
Alex Barsukov
+ Anthony Bongiovanni
Avencherus
Bastian Böhm
Ben Vercammen
Bryan Stevenson
+ Christian Baune
+ Christian Winter
Collin Shooltz
+ Dominik Wetzel
Fabian Becker
fengjiongmax
+ Fredy Romero Sam
Geequlim
Gerrit Großkopf
Guldoman
@@ -96,14 +117,16 @@ None so far, but your company could be the first! :)
HeartBeast
Heribert Hirth
Hunter Jones
- imekon
- Jacob McKenney
Jonathon
Josh 'Cheeseness' Bush
+ JuDelCo
Julian Murgia
Juraj Móza
+ KC Chan
Kevin Boyer
+ Kevin Kamper Meejach Petersen
Klavdij Voncina
+ Kobi Malul
Lisandro Lorea
magodev
Martin Novák
@@ -113,26 +136,36 @@ None so far, but your company could be the first! :)
Max R.R. Collada
Michael Gringauz
Mikael Olsson
+ MoM
Moritz Laass
nee
+ Neil Blakey-Milner
+ Nik Lee
+ Niko Leopold
nvgrod
Pablo Seibelt
Pan Ip
+ Patrick Nafarrete
Paul Mason
Paweł Kowal
+ Pete Goodwin
Pietro Vertechi
rayos
Richman Stewart
Roger Smith
+ Ryan Estes
Sam Van Campenhout
Sam Vila
Sasori Olkof
+ Scott D. Yelich
Sootstone
Tavo Tell
+ TheHappieCat
+ Theo Cranmore
Tom Larrow
- Trent McPheron
Troy Bonneau
UltyX
+ Wout Standaert
Xananax & karroffel
## Bronze donors
diff --git a/core/error_macros.cpp b/core/error_macros.cpp
index 170a22e8dd..7d85aa9001 100644
--- a/core/error_macros.cpp
+++ b/core/error_macros.cpp
@@ -97,3 +97,10 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
_err_error_exists = false;
}
}
+
+void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, bool fatal) {
+
+ String fstr(fatal ? "FATAL: " : "");
+ String err(fstr + "Index" + p_index_str + "=" + itos(p_index) + " out of size (" + p_size_str + "=" + itos(p_size) + ")");
+ _err_print_error(p_function, p_file, p_line, err.utf8().get_data());
+}
diff --git a/core/error_macros.h b/core/error_macros.h
index 1fa7f2c134..8d2f588706 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -76,6 +76,7 @@ void add_error_handler(ErrorHandlerList *p_handler);
void remove_error_handler(ErrorHandlerList *p_handler);
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
+void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, bool fatal = false);
#ifndef _STR
#define _STR(m_x) #m_x
@@ -129,13 +130,13 @@ extern bool _err_error_exists;
// (*): See https://stackoverflow.com/questions/257418/do-while-0-what-is-it-good-for
-#define ERR_FAIL_INDEX(m_index, m_size) \
- do { \
- if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Index " _STR(m_index) " out of size (" _STR(m_size) ")."); \
- return; \
- } else \
- _err_error_exists = false; \
+#define ERR_FAIL_INDEX(m_index, m_size) \
+ do { \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
+ return; \
+ } else \
+ _err_error_exists = false; \
} while (0); // (*)
/** An index has failed if m_index<0 or m_index >=m_size, the function exists.
@@ -143,24 +144,24 @@ extern bool _err_error_exists;
* appropriate error condition from error_macros.h
*/
-#define ERR_FAIL_INDEX_V(m_index, m_size, m_retval) \
- do { \
- if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Index " _STR(m_index) " out of size (" _STR(m_size) ")."); \
- return m_retval; \
- } else \
- _err_error_exists = false; \
+#define ERR_FAIL_INDEX_V(m_index, m_size, m_retval) \
+ do { \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
+ return m_retval; \
+ } else \
+ _err_error_exists = false; \
} while (0); // (*)
/** Use this one if there is no sensible fallback, that is, the error is unrecoverable.
* We'll return a null reference and try to keep running.
*/
-#define CRASH_BAD_INDEX(m_index, m_size) \
- do { \
- if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
- _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Index " _STR(m_index) " out of size (" _STR(m_size) ")."); \
- GENERATE_TRAP \
- } \
+#define CRASH_BAD_INDEX(m_index, m_size) \
+ do { \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), true); \
+ GENERATE_TRAP \
+ } \
} while (0); // (*)
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 6f58af2ccf..8bddeae69a 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -86,6 +86,8 @@ static Vector<_GlobalConstant> _global_constants;
VARIANT_ENUM_CAST(KeyList);
VARIANT_ENUM_CAST(KeyModifierMask);
+VARIANT_ENUM_CAST(ButtonList);
+VARIANT_ENUM_CAST(JoystickList);
void register_global_constants() {
@@ -367,82 +369,82 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
// mouse
- BIND_GLOBAL_CONSTANT(BUTTON_LEFT);
- BIND_GLOBAL_CONSTANT(BUTTON_RIGHT);
- BIND_GLOBAL_CONSTANT(BUTTON_MIDDLE);
- BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_UP);
- BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_DOWN);
- BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_LEFT);
- BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_RIGHT);
- BIND_GLOBAL_CONSTANT(BUTTON_MASK_LEFT);
- BIND_GLOBAL_CONSTANT(BUTTON_MASK_RIGHT);
- BIND_GLOBAL_CONSTANT(BUTTON_MASK_MIDDLE);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_LEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_RIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MIDDLE);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_UP);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_DOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_LEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_RIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_LEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_RIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_MIDDLE);
//joypads
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_0);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_1);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_2);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_3);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_4);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_5);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_6);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_7);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_8);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_9);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_10);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_11);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_12);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_13);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_14);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_15);
- BIND_GLOBAL_CONSTANT(JOY_BUTTON_MAX);
-
- BIND_GLOBAL_CONSTANT(JOY_SONY_CIRCLE);
- BIND_GLOBAL_CONSTANT(JOY_SONY_X);
- BIND_GLOBAL_CONSTANT(JOY_SONY_SQUARE);
- BIND_GLOBAL_CONSTANT(JOY_SONY_TRIANGLE);
-
- BIND_GLOBAL_CONSTANT(JOY_XBOX_B);
- BIND_GLOBAL_CONSTANT(JOY_XBOX_A);
- BIND_GLOBAL_CONSTANT(JOY_XBOX_X);
- BIND_GLOBAL_CONSTANT(JOY_XBOX_Y);
-
- BIND_GLOBAL_CONSTANT(JOY_DS_A);
- BIND_GLOBAL_CONSTANT(JOY_DS_B);
- BIND_GLOBAL_CONSTANT(JOY_DS_X);
- BIND_GLOBAL_CONSTANT(JOY_DS_Y);
-
- BIND_GLOBAL_CONSTANT(JOY_SELECT);
- BIND_GLOBAL_CONSTANT(JOY_START);
- BIND_GLOBAL_CONSTANT(JOY_DPAD_UP);
- BIND_GLOBAL_CONSTANT(JOY_DPAD_DOWN);
- BIND_GLOBAL_CONSTANT(JOY_DPAD_LEFT);
- BIND_GLOBAL_CONSTANT(JOY_DPAD_RIGHT);
- BIND_GLOBAL_CONSTANT(JOY_L);
- BIND_GLOBAL_CONSTANT(JOY_L2);
- BIND_GLOBAL_CONSTANT(JOY_L3);
- BIND_GLOBAL_CONSTANT(JOY_R);
- BIND_GLOBAL_CONSTANT(JOY_R2);
- BIND_GLOBAL_CONSTANT(JOY_R3);
-
- BIND_GLOBAL_CONSTANT(JOY_AXIS_0);
- BIND_GLOBAL_CONSTANT(JOY_AXIS_1);
- BIND_GLOBAL_CONSTANT(JOY_AXIS_2);
- BIND_GLOBAL_CONSTANT(JOY_AXIS_3);
- BIND_GLOBAL_CONSTANT(JOY_AXIS_4);
- BIND_GLOBAL_CONSTANT(JOY_AXIS_5);
- BIND_GLOBAL_CONSTANT(JOY_AXIS_6);
- BIND_GLOBAL_CONSTANT(JOY_AXIS_7);
- BIND_GLOBAL_CONSTANT(JOY_AXIS_MAX);
-
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_LX);
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_LY);
-
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_RX);
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_RY);
-
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_L2);
- BIND_GLOBAL_CONSTANT(JOY_ANALOG_R2);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_0);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_1);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_2);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_3);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_4);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_5);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_6);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_7);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_8);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_9);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_10);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_11);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_12);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_13);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_14);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_15);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_MAX);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CIRCLE);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_X);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_SQUARE);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_TRIANGLE);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_B);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_A);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_X);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_Y);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_A);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_B);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_X);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_Y);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_SELECT);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_START);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_UP);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_DOWN);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_LEFT);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_RIGHT);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_L);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_L2);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_L3);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_R);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_R2);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_R3);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_0);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_1);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_2);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_3);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_4);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_5);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_6);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_7);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_MAX);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_LX);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_LY);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_RX);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_RY);
+
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_L2);
+ BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_R2);
// error list
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index b8c0a2b616..46d52384e5 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -189,16 +189,6 @@ Error HTTPClient::request(Method p_method, const String &p_url, const Vector<Str
return OK;
}
-Error HTTPClient::send_body_text(const String &p_body) {
-
- return OK;
-}
-
-Error HTTPClient::send_body_data(const PoolByteArray &p_body) {
-
- return OK;
-}
-
bool HTTPClient::has_response() const {
return response_headers.size() != 0;
@@ -629,8 +619,6 @@ void HTTPClient::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_connection"), &HTTPClient::get_connection);
ClassDB::bind_method(D_METHOD("request_raw", "method", "url", "headers", "body"), &HTTPClient::request_raw);
ClassDB::bind_method(D_METHOD("request", "method", "url", "headers", "body"), &HTTPClient::request, DEFVAL(String()));
- ClassDB::bind_method(D_METHOD("send_body_text", "body"), &HTTPClient::send_body_text);
- ClassDB::bind_method(D_METHOD("send_body_data", "body"), &HTTPClient::send_body_data);
ClassDB::bind_method(D_METHOD("close"), &HTTPClient::close);
ClassDB::bind_method(D_METHOD("has_response"), &HTTPClient::has_response);
diff --git a/core/io/http_client.h b/core/io/http_client.h
index 023370ae81..f8a3349e6e 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -169,8 +169,6 @@ public:
Error request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const PoolVector<uint8_t> &p_body);
Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const String &p_body = String());
- Error send_body_text(const String &p_body);
- Error send_body_data(const PoolByteArray &p_body);
void close();
diff --git a/core/map.h b/core/map.h
index f01062ebed..fb24a5868c 100644
--- a/core/map.h
+++ b/core/map.h
@@ -438,7 +438,6 @@ private:
Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : p_node->_next;
Element *node = (rp->left == _data._nil) ? rp->right : rp->left;
- node->parent = rp->parent;
Element *sibling;
if (rp == rp->parent->left) {
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 4f80fb2491..ffe1089965 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -443,4 +443,5 @@ AStar::AStar() {
AStar::~AStar() {
pass = 1;
+ clear();
}
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 5dc0f91d5f..f2c8cc802d 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -44,7 +44,7 @@
* The events are pretty obvious.
*/
-enum {
+enum ButtonList {
BUTTON_LEFT = 1,
BUTTON_RIGHT = 2,
BUTTON_MIDDLE = 3,
@@ -58,7 +58,7 @@ enum {
};
-enum {
+enum JoystickList {
JOY_BUTTON_0 = 0,
JOY_BUTTON_1 = 1,
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 5ead91f26e..384e41e4bd 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -58,7 +58,6 @@ void Script::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_script_signal", "signal_name"), &Script::has_script_signal);
ClassDB::bind_method(D_METHOD("is_tool"), &Script::is_tool);
- ClassDB::bind_method(D_METHOD("get_node_type"), &Script::get_node_type);
}
void ScriptServer::set_scripting_enabled(bool p_enabled) {
diff --git a/core/script_language.h b/core/script_language.h
index 25767a2f7a..5da72d0492 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -107,8 +107,6 @@ public:
virtual bool is_tool() const = 0;
- virtual String get_node_type() const = 0;
-
virtual ScriptLanguage *get_language() const = 0;
virtual bool has_script_signal(const StringName &p_signal) const = 0;
@@ -202,6 +200,7 @@ public:
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const = 0;
virtual Script *create_script() const = 0;
virtual bool has_named_classes() const = 0;
+ virtual bool supports_builtin_mode() const = 0;
virtual bool can_inherit_from_file() { return false; }
virtual int find_function(const String &p_function, const String &p_code) const = 0;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const = 0;
diff --git a/core/set.h b/core/set.h
index 0f48e07520..331979d4e3 100644
--- a/core/set.h
+++ b/core/set.h
@@ -424,7 +424,6 @@ private:
Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : p_node->_next;
Element *node = (rp->left == _data._nil) ? rp->right : rp->left;
- node->parent = rp->parent;
Element *sibling;
if (rp == rp->parent->left) {
diff --git a/core/translation.cpp b/core/translation.cpp
index 27e3b202d0..54dbaf6ed5 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -957,6 +957,12 @@ String TranslationServer::get_locale() const {
return locale;
}
+String TranslationServer::get_locale_name(const String &p_locale) const {
+
+ if (!locale_name_map.has(p_locale)) return String();
+ return locale_name_map[p_locale];
+}
+
void TranslationServer::add_translation(const Ref<Translation> &p_translation) {
translations.insert(p_translation);
@@ -1122,6 +1128,8 @@ void TranslationServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_locale", "locale"), &TranslationServer::set_locale);
ClassDB::bind_method(D_METHOD("get_locale"), &TranslationServer::get_locale);
+ ClassDB::bind_method(D_METHOD("get_locale_name", "locale"), &TranslationServer::get_locale_name);
+
ClassDB::bind_method(D_METHOD("translate", "message"), &TranslationServer::translate);
ClassDB::bind_method(D_METHOD("add_translation", "translation"), &TranslationServer::add_translation);
@@ -1147,4 +1155,9 @@ TranslationServer::TranslationServer()
: locale("en"),
enabled(true) {
singleton = this;
+
+ for (int i = 0; locale_list[i]; ++i) {
+
+ locale_name_map.insert(locale_list[i], locale_names[i]);
+ }
}
diff --git a/core/translation.h b/core/translation.h
index cf59583ad6..5fec1d9f45 100644
--- a/core/translation.h
+++ b/core/translation.h
@@ -73,6 +73,8 @@ class TranslationServer : public Object {
Set<Ref<Translation> > translations;
Ref<Translation> tool_translation;
+ Map<String, String> locale_name_map;
+
bool enabled;
static TranslationServer *singleton;
@@ -91,6 +93,8 @@ public:
void set_locale(const String &p_locale);
String get_locale() const;
+ String get_locale_name(const String &p_locale) const;
+
void add_translation(const Ref<Translation> &p_translation);
void remove_translation(const Ref<Translation> &p_translation);
diff --git a/core/typedefs.h b/core/typedefs.h
index bf5c8b0f75..c509edf9fe 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -98,11 +98,11 @@ T *_nullptr() {
#undef OK
#endif
+#include "int_types.h"
+
#include "error_list.h"
#include "error_macros.h"
-#include "int_types.h"
-
/** Generic ABS function, for math uses please use Math::abs */
#ifndef ABS
diff --git a/doc/classes/@Global Scope.xml b/doc/classes/@Global Scope.xml
index 9d0133faf4..20f323bb4f 100644
--- a/doc/classes/@Global Scope.xml
+++ b/doc/classes/@Global Scope.xml
@@ -863,199 +863,199 @@
<constant name="KEY_MASK_GROUP_SWITCH" value="1073741824">
Group Switch Key Mask
</constant>
- <constant name="BUTTON_LEFT" value="1" enum="">
+ <constant name="BUTTON_LEFT" value="1">
Left Mouse Button
</constant>
- <constant name="BUTTON_RIGHT" value="2" enum="">
+ <constant name="BUTTON_RIGHT" value="2">
Right Mouse Button
</constant>
- <constant name="BUTTON_MIDDLE" value="3" enum="">
+ <constant name="BUTTON_MIDDLE" value="3">
Middle Mouse Button
</constant>
- <constant name="BUTTON_WHEEL_UP" value="4" enum="">
+ <constant name="BUTTON_WHEEL_UP" value="4">
Mouse wheel up
</constant>
- <constant name="BUTTON_WHEEL_DOWN" value="5" enum="">
+ <constant name="BUTTON_WHEEL_DOWN" value="5">
Mouse wheel down
</constant>
- <constant name="BUTTON_WHEEL_LEFT" value="6" enum="">
+ <constant name="BUTTON_WHEEL_LEFT" value="6">
Mouse wheel left button
</constant>
- <constant name="BUTTON_WHEEL_RIGHT" value="7" enum="">
+ <constant name="BUTTON_WHEEL_RIGHT" value="7">
Mouse wheel right button
</constant>
- <constant name="BUTTON_MASK_LEFT" value="1" enum="">
+ <constant name="BUTTON_MASK_LEFT" value="1">
Left Mouse Button Mask
</constant>
- <constant name="BUTTON_MASK_RIGHT" value="2" enum="">
+ <constant name="BUTTON_MASK_RIGHT" value="2">
Right Mouse Button Mask
</constant>
- <constant name="BUTTON_MASK_MIDDLE" value="4" enum="">
+ <constant name="BUTTON_MASK_MIDDLE" value="4">
Middle Mouse Button Mask
</constant>
- <constant name="JOY_BUTTON_0" value="0" enum="">
+ <constant name="JOY_BUTTON_0" value="0">
Joypad Button 0
</constant>
- <constant name="JOY_BUTTON_1" value="1" enum="">
+ <constant name="JOY_BUTTON_1" value="1">
Joypad Button 1
</constant>
- <constant name="JOY_BUTTON_2" value="2" enum="">
+ <constant name="JOY_BUTTON_2" value="2">
Joypad Button 2
</constant>
- <constant name="JOY_BUTTON_3" value="3" enum="">
+ <constant name="JOY_BUTTON_3" value="3">
Joypad Button 3
</constant>
- <constant name="JOY_BUTTON_4" value="4" enum="">
+ <constant name="JOY_BUTTON_4" value="4">
Joypad Button 4
</constant>
- <constant name="JOY_BUTTON_5" value="5" enum="">
+ <constant name="JOY_BUTTON_5" value="5">
Joypad Button 5
</constant>
- <constant name="JOY_BUTTON_6" value="6" enum="">
+ <constant name="JOY_BUTTON_6" value="6">
Joypad Button 6
</constant>
- <constant name="JOY_BUTTON_7" value="7" enum="">
+ <constant name="JOY_BUTTON_7" value="7">
Joypad Button 7
</constant>
- <constant name="JOY_BUTTON_8" value="8" enum="">
+ <constant name="JOY_BUTTON_8" value="8">
Joypad Button 8
</constant>
- <constant name="JOY_BUTTON_9" value="9" enum="">
+ <constant name="JOY_BUTTON_9" value="9">
Joypad Button 9
</constant>
- <constant name="JOY_BUTTON_10" value="10" enum="">
+ <constant name="JOY_BUTTON_10" value="10">
Joypad Button 10
</constant>
- <constant name="JOY_BUTTON_11" value="11" enum="">
+ <constant name="JOY_BUTTON_11" value="11">
Joypad Button 11
</constant>
- <constant name="JOY_BUTTON_12" value="12" enum="">
+ <constant name="JOY_BUTTON_12" value="12">
Joypad Button 12
</constant>
- <constant name="JOY_BUTTON_13" value="13" enum="">
+ <constant name="JOY_BUTTON_13" value="13">
Joypad Button 13
</constant>
- <constant name="JOY_BUTTON_14" value="14" enum="">
+ <constant name="JOY_BUTTON_14" value="14">
Joypad Button 14
</constant>
- <constant name="JOY_BUTTON_15" value="15" enum="">
+ <constant name="JOY_BUTTON_15" value="15">
Joypad Button 15
</constant>
- <constant name="JOY_BUTTON_MAX" value="16" enum="">
+ <constant name="JOY_BUTTON_MAX" value="16">
Joypad Button 16
</constant>
- <constant name="JOY_SONY_CIRCLE" value="1" enum="">
+ <constant name="JOY_SONY_CIRCLE" value="1">
DUALSHOCK circle button
</constant>
- <constant name="JOY_SONY_X" value="0" enum="">
+ <constant name="JOY_SONY_X" value="0">
DUALSHOCK X button
</constant>
- <constant name="JOY_SONY_SQUARE" value="2" enum="">
+ <constant name="JOY_SONY_SQUARE" value="2">
DUALSHOCK square button
</constant>
- <constant name="JOY_SONY_TRIANGLE" value="3" enum="">
+ <constant name="JOY_SONY_TRIANGLE" value="3">
DUALSHOCK triangle button
</constant>
- <constant name="JOY_XBOX_B" value="1" enum="">
+ <constant name="JOY_XBOX_B" value="1">
XBOX controller B button
</constant>
- <constant name="JOY_XBOX_A" value="0" enum="">
+ <constant name="JOY_XBOX_A" value="0">
XBOX controller A button
</constant>
- <constant name="JOY_XBOX_X" value="2" enum="">
+ <constant name="JOY_XBOX_X" value="2">
XBOX controller X button
</constant>
- <constant name="JOY_XBOX_Y" value="3" enum="">
+ <constant name="JOY_XBOX_Y" value="3">
XBOX controller Y button
</constant>
- <constant name="JOY_DS_A" value="1" enum="">
+ <constant name="JOY_DS_A" value="1">
DualShock controller A button
</constant>
- <constant name="JOY_DS_B" value="0" enum="">
+ <constant name="JOY_DS_B" value="0">
DualShock controller B button
</constant>
- <constant name="JOY_DS_X" value="3" enum="">
+ <constant name="JOY_DS_X" value="3">
DualShock controller X button
</constant>
- <constant name="JOY_DS_Y" value="2" enum="">
+ <constant name="JOY_DS_Y" value="2">
DualShock controller Y button
</constant>
- <constant name="JOY_SELECT" value="10" enum="">
+ <constant name="JOY_SELECT" value="10">
Joypad Button Select
</constant>
- <constant name="JOY_START" value="11" enum="">
+ <constant name="JOY_START" value="11">
Joypad Button Start
</constant>
- <constant name="JOY_DPAD_UP" value="12" enum="">
+ <constant name="JOY_DPAD_UP" value="12">
Joypad DPad Up
</constant>
- <constant name="JOY_DPAD_DOWN" value="13" enum="">
+ <constant name="JOY_DPAD_DOWN" value="13">
Joypad DPad Down
</constant>
- <constant name="JOY_DPAD_LEFT" value="14" enum="">
+ <constant name="JOY_DPAD_LEFT" value="14">
Joypad DPad Left
</constant>
- <constant name="JOY_DPAD_RIGHT" value="15" enum="">
+ <constant name="JOY_DPAD_RIGHT" value="15">
Joypad DPad Right
</constant>
- <constant name="JOY_L" value="4" enum="">
+ <constant name="JOY_L" value="4">
Joypad Left Shoulder Button
</constant>
- <constant name="JOY_L2" value="6" enum="">
+ <constant name="JOY_L2" value="6">
Joypad Left Trigger
</constant>
- <constant name="JOY_L3" value="8" enum="">
+ <constant name="JOY_L3" value="8">
Joypad Left Stick Click
</constant>
- <constant name="JOY_R" value="5" enum="">
+ <constant name="JOY_R" value="5">
Joypad Right Shoulder Button
</constant>
- <constant name="JOY_R2" value="7" enum="">
+ <constant name="JOY_R2" value="7">
Joypad Right Trigger
</constant>
- <constant name="JOY_R3" value="9" enum="">
+ <constant name="JOY_R3" value="9">
Joypad Right Stick Click
</constant>
- <constant name="JOY_AXIS_0" value="0" enum="">
+ <constant name="JOY_AXIS_0" value="0">
Joypad Left Stick Horizontal Axis
</constant>
- <constant name="JOY_AXIS_1" value="1" enum="">
+ <constant name="JOY_AXIS_1" value="1">
Joypad Left Stick Vertical Axis
</constant>
- <constant name="JOY_AXIS_2" value="2" enum="">
+ <constant name="JOY_AXIS_2" value="2">
Joypad Right Stick Horizontal Axis
</constant>
- <constant name="JOY_AXIS_3" value="3" enum="">
+ <constant name="JOY_AXIS_3" value="3">
Joypad Right Stick Vertical Axis
</constant>
- <constant name="JOY_AXIS_4" value="4" enum="">
+ <constant name="JOY_AXIS_4" value="4">
</constant>
- <constant name="JOY_AXIS_5" value="5" enum="">
+ <constant name="JOY_AXIS_5" value="5">
</constant>
- <constant name="JOY_AXIS_6" value="6" enum="">
+ <constant name="JOY_AXIS_6" value="6">
Joypad Left Trigger Analog Axis
</constant>
- <constant name="JOY_AXIS_7" value="7" enum="">
+ <constant name="JOY_AXIS_7" value="7">
Joypad Right Trigger Analog Axis
</constant>
- <constant name="JOY_AXIS_MAX" value="8" enum="">
+ <constant name="JOY_AXIS_MAX" value="8">
</constant>
- <constant name="JOY_ANALOG_LX" value="0" enum="">
+ <constant name="JOY_ANALOG_LX" value="0">
Joypad Left Stick Horizontal Axis
</constant>
- <constant name="JOY_ANALOG_LY" value="1" enum="">
+ <constant name="JOY_ANALOG_LY" value="1">
Joypad Left Stick Vertical Axis
</constant>
- <constant name="JOY_ANALOG_RX" value="2" enum="">
+ <constant name="JOY_ANALOG_RX" value="2">
Joypad Right Stick Horizontal Axis
</constant>
- <constant name="JOY_ANALOG_RY" value="3" enum="">
+ <constant name="JOY_ANALOG_RY" value="3">
Joypad Right Stick Vertical Axis
</constant>
- <constant name="JOY_ANALOG_L2" value="6" enum="">
+ <constant name="JOY_ANALOG_L2" value="6">
Joypad Left Analog Trigger
</constant>
- <constant name="JOY_ANALOG_R2" value="7" enum="">
+ <constant name="JOY_ANALOG_R2" value="7">
Joypad Right Analog Trigger
</constant>
<constant name="OK" value="0">
@@ -1377,7 +1377,7 @@
Variable is of type [PoolColorArray].
</constant>
<constant name="TYPE_MAX" value="27">
- </constant>
Marker for end of type constants.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/AudioEffectFilter.xml b/doc/classes/AudioEffectFilter.xml
index 9ce1a93121..82d572b81b 100644
--- a/doc/classes/AudioEffectFilter.xml
+++ b/doc/classes/AudioEffectFilter.xml
@@ -75,7 +75,7 @@
<member name="db" type="int" setter="set_db" getter="get_db" enum="AudioEffectFilter.FilterDB">
</member>
<member name="gain" type="float" setter="set_gain" getter="get_gain">
- Gain amount of the frequences after the filter.
+ Gain amount of the frequencies after the filter.
</member>
<member name="resonance" type="float" setter="set_resonance" getter="get_resonance">
Amount of boost in the overtones near the cutoff frequency.
diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml
index 2ad46579b2..1b6583a834 100644
--- a/doc/classes/BaseButton.xml
+++ b/doc/classes/BaseButton.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="BaseButton" inherits="Control" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Provides a base class for different kinds of buttons.
+ Base class for different kinds of buttons.
</brief_description>
<description>
- BaseButton is the abstract base class for buttons, so it shouldn't be used directly (It doesn't display anything). Other types of buttons inherit from it.
+ BaseButton is the abstract base class for buttons, so it shouldn't be used directly (it doesn't display anything). Other types of buttons inherit from it.
</description>
<tutorials>
</tutorials>
@@ -152,18 +152,25 @@
</methods>
<members>
<member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="BaseButton.ActionMode">
+ Determines when the button is considered clicked, one of the ACTION_MODE_* constants.
</member>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled">
+ If [code]true[/code] the button is in disabled state and can't be clicked or toggled.
</member>
<member name="enabled_focus_mode" type="int" setter="set_enabled_focus_mode" getter="get_enabled_focus_mode" enum="Control.FocusMode">
+ Focus access mode to use when switching between enabled/disabled (see [method Control.set_focus_mode] and [member disabled]).
</member>
<member name="group" type="ButtonGroup" setter="set_button_group" getter="get_button_group">
+ [ButtonGroup] associated to the button.
</member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
+ If [code]true[/code] the button's state is pressed. Means the button is pressed down or toggled (if toggle_mode is active).
</member>
<member name="shortcut" type="ShortCut" setter="set_shortcut" getter="get_shortcut">
+ [Shortcut] associated to the button.
</member>
<member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode">
+ If [code]true[/code] the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.
</member>
</members>
<signals>
diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml
index 93140a0df6..352e270e77 100644
--- a/doc/classes/Camera2D.xml
+++ b/doc/classes/Camera2D.xml
@@ -348,10 +348,13 @@
If [code]true[/code] the camera only moves when reaching the vertical drag margins. If [code]false[/code] the camera moves vertically regardless of margins. Default value: [code]true[/code].
</member>
<member name="editor_draw_drag_margin" type="bool" setter="set_margin_drawing_enabled" getter="is_margin_drawing_enabled">
+ If [code]true[/code] draws the camera's drag margin rectangle in the editor. Default value: [code]false[/code]
</member>
<member name="editor_draw_limits" type="bool" setter="set_limit_drawing_enabled" getter="is_limit_drawing_enabled">
+ If [code]true[/code] draws the camera's limits rectangle in the editor. Default value: [code]true[/code]
</member>
<member name="editor_draw_screen" type="bool" setter="set_screen_drawing_enabled" getter="is_screen_drawing_enabled">
+ If [code]true[/code] draws the camera's screen rectangle in the editor. Default value: [code]false[/code]
</member>
<member name="limit_bottom" type="int" setter="set_limit" getter="get_limit">
Bottom scroll limit in pixels. The camera stops moving when reaching this value.
@@ -363,6 +366,7 @@
Right scroll limit in pixels. The camera stops moving when reaching this value.
</member>
<member name="limit_smoothed" type="bool" setter="set_limit_smoothing_enabled" getter="is_limit_smoothing_enabled">
+ If [code]true[/code] the camera smoothly stops when reaches its limits. Default value: [code]false[/code]
</member>
<member name="limit_top" type="int" setter="set_limit" getter="get_limit">
Top scroll limit in pixels. The camera stops moving when reaching this value.
@@ -371,13 +375,13 @@
The camera's offset, useful for looking around or camera shake animations.
</member>
<member name="rotating" type="bool" setter="set_rotating" getter="is_rotating">
- If [code]true[/code] the camera can rotate during gameplay. Default value: [code]false[/code].
+ If [code]true[/code] the camera rotates with the target. Default value: [code]false[/code]
</member>
<member name="smoothing_enabled" type="bool" setter="set_enable_follow_smoothing" getter="is_follow_smoothing_enabled">
- If [code]true[/code] the camera's velocity changes gradually, preventing sudden starts and stops. Default value: [code]false[/code].
+ If [code]true[/code] the camera smoothly moves towards the target at [member smoothing_speed]. Default value: [code]false[/code]
</member>
<member name="smoothing_speed" type="float" setter="set_follow_smoothing" getter="get_follow_smoothing">
- How fast the camera's velocity changes if smoothing is enabled.
+ Speed in pixels per second of the camera's smoothing effect when [member smoothing_enabled] is [code]true[/code]
</member>
<member name="zoom" type="Vector2" setter="set_zoom" getter="get_zoom">
The camera's zoom relative to the viewport. Values larger than [code]Vector2(1, 1)[/code] zoom out and smaller values zoom in. For an example, use [code]Vector2(0.5, 0.5)[/code] for a 2x zoom in, and [code]Vector2(4, 4)[/code] for a 4x zoom out.
diff --git a/doc/classes/CubeMap.xml b/doc/classes/CubeMap.xml
index 5626554193..b173bba3c6 100644
--- a/doc/classes/CubeMap.xml
+++ b/doc/classes/CubeMap.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CubeMap" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A CubeMap is a 6 sided 3D texture.
</brief_description>
<description>
+ A CubeMap is a 6 sided 3D texture typically used for faking reflections. It can be used to make an object look as if it's reflecting its surroundings. This usually delivers much better performance than other reflection methods.
</description>
<tutorials>
</tutorials>
@@ -19,6 +21,7 @@
<return type="int">
</return>
<description>
+ Returns the CubeMap's height.
</description>
</method>
<method name="get_lossy_storage_quality" qualifiers="const">
@@ -33,6 +36,7 @@
<argument index="0" name="side" type="int" enum="CubeMap.Side">
</argument>
<description>
+ Returns an [Image] for a side of the CubeMap using one of the [code]SIDE_*[/code] constants or an integer 0-5.
</description>
</method>
<method name="get_storage" qualifiers="const">
@@ -45,6 +49,7 @@
<return type="int">
</return>
<description>
+ Returns the CubeMap's width.
</description>
</method>
<method name="set_flags">
@@ -71,6 +76,7 @@
<argument index="1" name="image" type="Image">
</argument>
<description>
+ Sets an [Image] for a side of the CubeMap using one of the [code]SIDE_*[/code] constants or an integer 0-5.
</description>
</method>
<method name="set_storage">
@@ -84,8 +90,10 @@
</methods>
<members>
<member name="lossy_storage_quality" type="float" setter="set_lossy_storage_quality" getter="get_lossy_storage_quality">
+ The lossy storage quality of the CubeMap if the storage mode is set to STORAGE_COMPRESS_LOSSY.
</member>
<member name="storage_mode" type="int" setter="set_storage" getter="get_storage" enum="CubeMap.Storage">
+ The CubeMap's storage mode. See [code]STORAGE_*[/code] constants.
</member>
</members>
<constants>
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml
index da8f0f235b..c276a8f661 100644
--- a/doc/classes/EditorImportPlugin.xml
+++ b/doc/classes/EditorImportPlugin.xml
@@ -39,8 +39,8 @@
return [{"name": "my_option", "default_value": false}]
func load(src, dst, opts, r_platform_variants, r_gen_files):
- var f = File.new()
- if f.open(src, File.READ) != OK:
+ var file = File.new()
+ if file.open(src, File.READ) != OK:
return FAILED
var mesh = Mesh.new()
diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml
index 2918200633..4d40d5af9a 100644
--- a/doc/classes/Environment.xml
+++ b/doc/classes/Environment.xml
@@ -238,6 +238,12 @@
<description>
</description>
</method>
+ <method name="get_ssao_blur" qualifiers="const">
+ <return type="int" enum="Environment.SSAOBlur">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_ssao_color" qualifiers="const">
<return type="Color">
</return>
@@ -250,6 +256,12 @@
<description>
</description>
</method>
+ <method name="get_ssao_edge_sharpness" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_ssao_intensity" qualifiers="const">
<return type="float">
</return>
@@ -262,6 +274,12 @@
<description>
</description>
</method>
+ <method name="get_ssao_quality" qualifiers="const">
+ <return type="int" enum="Environment.SSAOQuality">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_ssao_radius" qualifiers="const">
<return type="float">
</return>
@@ -408,12 +426,6 @@
<description>
</description>
</method>
- <method name="is_ssao_blur_enabled" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
<method name="is_ssao_enabled" qualifiers="const">
<return type="bool">
</return>
@@ -813,7 +825,7 @@
<method name="set_ssao_blur">
<return type="void">
</return>
- <argument index="0" name="enabled" type="bool">
+ <argument index="0" name="mode" type="int" enum="Environment.SSAOBlur">
</argument>
<description>
</description>
@@ -834,6 +846,14 @@
<description>
</description>
</method>
+ <method name="set_ssao_edge_sharpness">
+ <return type="void">
+ </return>
+ <argument index="0" name="edge_sharpness" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_ssao_enabled">
<return type="void">
</return>
@@ -858,6 +878,14 @@
<description>
</description>
</method>
+ <method name="set_ssao_quality">
+ <return type="void">
+ </return>
+ <argument index="0" name="quality" type="int" enum="Environment.SSAOQuality">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_ssao_radius">
<return type="void">
</return>
@@ -1172,10 +1200,12 @@
</member>
<member name="ssao_bias" type="float" setter="set_ssao_bias" getter="get_ssao_bias">
</member>
- <member name="ssao_blur" type="bool" setter="set_ssao_blur" getter="is_ssao_blur_enabled">
+ <member name="ssao_blur" type="int" setter="set_ssao_blur" getter="is_ssao_blur_enabled" enum="Environment.SSAOBlur">
</member>
<member name="ssao_color" type="Color" setter="set_ssao_color" getter="get_ssao_color">
</member>
+ <member name="ssao_edge_sharpness" type="float" setter="set_ssao_edge_sharpness" getter="get_ssao_edge_sharpness">
+ </member>
<member name="ssao_enabled" type="bool" setter="set_ssao_enabled" getter="is_ssao_enabled">
</member>
<member name="ssao_intensity" type="float" setter="set_ssao_intensity" getter="get_ssao_intensity">
@@ -1184,6 +1214,8 @@
</member>
<member name="ssao_light_affect" type="float" setter="set_ssao_direct_light_affect" getter="get_ssao_direct_light_affect">
</member>
+ <member name="ssao_quality" type="int" setter="set_ssao_quality" getter="get_ssao_quality" enum="Environment.SSAOQuality">
+ </member>
<member name="ssao_radius" type="float" setter="set_ssao_radius" getter="get_ssao_radius">
</member>
<member name="ssao_radius2" type="float" setter="set_ssao_radius2" getter="get_ssao_radius2">
@@ -1253,5 +1285,19 @@
<constant name="DOF_BLUR_QUALITY_HIGH" value="2">
High depth-of-field blur quality.
</constant>
+ <constant name="SSAO_BLUR_DISABLED" value="0">
+ </constant>
+ <constant name="SSAO_BLUR_1x1" value="1">
+ </constant>
+ <constant name="SSAO_BLUR_2x2" value="2">
+ </constant>
+ <constant name="SSAO_BLUR_3x3" value="3">
+ </constant>
+ <constant name="SSAO_QUALITY_LOW" value="0">
+ </constant>
+ <constant name="SSAO_QUALITY_MEDIUM" value="1">
+ </constant>
+ <constant name="SSAO_QUALITY_HIGH" value="2">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index e75aee0126..f148545848 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -169,24 +169,6 @@
Sends body raw, as a byte array, does not encode it in any way.
</description>
</method>
- <method name="send_body_data">
- <return type="int" enum="Error">
- </return>
- <argument index="0" name="body" type="PoolByteArray">
- </argument>
- <description>
- Stub function
- </description>
- </method>
- <method name="send_body_text">
- <return type="int" enum="Error">
- </return>
- <argument index="0" name="body" type="String">
- </argument>
- <description>
- Stub function
- </description>
- </method>
<method name="set_blocking_mode">
<return type="void">
</return>
diff --git a/doc/classes/ParallaxLayer.xml b/doc/classes/ParallaxLayer.xml
index 8de7e05578..f1e6f9e046 100644
--- a/doc/classes/ParallaxLayer.xml
+++ b/doc/classes/ParallaxLayer.xml
@@ -64,7 +64,7 @@
The ParallaxLayer's [Texture] mirroring. Useful for creating an infinite scrolling background. If an axis is set to [code]0[/code] the [Texture] will not be mirrored. Default value: [code](0, 0)[/code].
</member>
<member name="motion_offset" type="Vector2" setter="set_motion_offset" getter="get_motion_offset">
- The ParallaxLayer's offset relative to the parent ParallaxBackground's [member ParallaxBackground.scroll_offset].
+ The ParallaxLayer's offset relative to the parent ParallaxBackground's [member ParallaxBackground.scroll_offset].
</member>
<member name="motion_scale" type="Vector2" setter="set_motion_scale" getter="get_motion_scale">
Multiplies the ParallaxLayer's motion. If an axis is set to [code]0[/code] it will not scroll.
diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml
index d351cdfbc0..056d7d10fa 100644
--- a/doc/classes/Quat.xml
+++ b/doc/classes/Quat.xml
@@ -127,7 +127,7 @@
<argument index="1" name="t" type="float">
</argument>
<description>
- Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.
+ Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.
</description>
</method>
<method name="xform">
diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast.xml
index fc96a183eb..3f999f7fe2 100644
--- a/doc/classes/RayCast.xml
+++ b/doc/classes/RayCast.xml
@@ -85,6 +85,14 @@
Returns the collision mask for this ray.
</description>
</method>
+ <method name="get_collision_mask_bit" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="bit" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="get_collision_normal" qualifiers="const">
<return type="Vector3">
</return>
@@ -156,6 +164,16 @@
Set the mask to filter objects. Only objects in at least one collision layer enabled in the mask will be detected.
</description>
</method>
+ <method name="set_collision_mask_bit">
+ <return type="void">
+ </return>
+ <argument index="0" name="bit" type="int">
+ </argument>
+ <argument index="1" name="value" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_enabled">
<return type="void">
</return>
diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml
index 8fef07a859..45a83f7ded 100644
--- a/doc/classes/RayCast2D.xml
+++ b/doc/classes/RayCast2D.xml
@@ -84,6 +84,14 @@
Returns the collision mask for this ray.
</description>
</method>
+ <method name="get_collision_mask_bit" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="bit" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="get_collision_normal" qualifiers="const">
<return type="Vector2">
</return>
@@ -162,6 +170,16 @@
Set the mask to filter objects. Only objects in at least one collision layer enabled in the mask will be detected.
</description>
</method>
+ <method name="set_collision_mask_bit">
+ <return type="void">
+ </return>
+ <argument index="0" name="bit" type="int">
+ </argument>
+ <argument index="1" name="value" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_enabled">
<return type="void">
</return>
diff --git a/doc/classes/Script.xml b/doc/classes/Script.xml
index 307afba8a7..c13e009976 100644
--- a/doc/classes/Script.xml
+++ b/doc/classes/Script.xml
@@ -19,12 +19,6 @@
Returns true if the script can be instanced.
</description>
</method>
- <method name="get_node_type" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
<method name="get_source_code" qualifiers="const">
<return type="String">
</return>
diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml
index da89c37ff4..db47875050 100644
--- a/doc/classes/SpatialMaterial.xml
+++ b/doc/classes/SpatialMaterial.xml
@@ -1085,7 +1085,7 @@
</constant>
<constant name="DIFFUSE_TOON" value="4">
</constant>
- <constant name="SPECULAR_GGX" value="0">
+ <constant name="SPECULAR_SCHLICK_GGX" value="0">
</constant>
<constant name="SPECULAR_BLINN" value="1">
</constant>
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index 9a500af347..43e5158515 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -239,6 +239,12 @@
Returns true if highlight all occurrences is enabled.
</description>
</method>
+ <method name="is_highlight_current_line_enabled" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="is_overriding_selected_font_color" qualifiers="const">
<return type="bool">
</return>
@@ -340,6 +346,14 @@
Set to enable highlighting all occurrences of the current selection.
</description>
</method>
+ <method name="set_highlight_current_line">
+ <return type="void">
+ </return>
+ <argument index="0" name="enabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_max_chars">
<return type="void">
</return>
@@ -435,6 +449,8 @@
</member>
<member name="highlight_all_occurrences" type="bool" setter="set_highlight_all_occurrences" getter="is_highlight_all_occurrences_enabled">
</member>
+ <member name="highlight_current_line" type="bool" setter="set_highlight_current_line" getter="is_highlight_current_line_enabled">
+ </member>
<member name="override_selected_font_color" type="bool" setter="set_override_selected_font_color" getter="is_overriding_selected_font_color">
</member>
<member name="show_line_numbers" type="bool" setter="set_show_line_numbers" getter="is_show_line_numbers_enabled">
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index 6c0e4f74ff..5fe7b53a7d 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -838,7 +838,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_ggx"] = "#define SPECULAR_GGX\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index bf0ebae3e3..e4d76753cb 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1065,7 +1065,7 @@ LIGHT_SHADER_CODE
#elif defined(SPECULAR_DISABLED)
//none..
-#elif defined(SPECULAR_GGX)
+#elif defined(SPECULAR_SCHLICK_GGX)
// shlick+ggx as default
vec3 H = normalize(V + L);
@@ -1102,10 +1102,10 @@ LIGHT_SHADER_CODE
#if defined(LIGHT_USE_CLEARCOAT)
if (clearcoat_gloss > 0.0) {
-# if !defined(SPECULAR_GGX) && !defined(SPECULAR_BLINN)
+# if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN)
vec3 H = normalize(V + L);
# endif
-# if !defined(SPECULAR_GGX)
+# if !defined(SPECULAR_SCHLICK_GGX)
float cNdotH = max(dot(N,H), 0.0);
float cLdotH = max(dot(L,H), 0.0);
float cLdotH5 = SchlickFresnel(cLdotH);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index ee1faf5a55..0100c221c4 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1089,6 +1089,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_length_guideline_column"));
text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting"));
text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences"));
+ text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line"));
text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink"));
text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter"));
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b77525c0ba..3513126a9b 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2670,12 +2670,12 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled)
String addon_path = "res://addons/" + p_addon + "/plugin.cfg";
Error err = cf->load(addon_path);
if (err != OK) {
- show_warning(TTR("Unable to enable addon plugin at: '") + addon_path + TTR("' parsing of config failed."));
+ show_warning(vformat(TTR("Unable to enable addon plugin at: '%s' parsing of config failed."), addon_path));
return;
}
if (!cf->has_section_key("plugin", "script")) {
- show_warning(TTR("Unable to find script field for addon plugin at: 'res://addons/") + p_addon + "''.");
+ show_warning(vformat(TTR("Unable to find script field for addon plugin at: 'res://addons/%s'."), p_addon));
return;
}
@@ -2685,18 +2685,18 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled)
Ref<Script> script = ResourceLoader::load(path);
if (script.is_null()) {
- show_warning(TTR("Unable to load addon script from path: '") + path + "'.");
+ show_warning(vformat(TTR("Unable to load addon script from path: '%s'."), path));
return;
}
//could check inheritance..
if (String(script->get_instance_base_type()) != "EditorPlugin") {
- show_warning(TTR("Unable to load addon script from path: '") + path + "' Base type is not EditorPlugin.");
+ show_warning(vformat(TTR("Unable to load addon script from path: '%s' Base type is not EditorPlugin."), path));
return;
}
if (!script->is_tool()) {
- show_warning(TTR("Unable to load addon script from path: '") + path + "' Script is not in tool mode.");
+ show_warning(vformat(TTR("Unable to load addon script from path: '%s' Script is not in tool mode."), path));
return;
}
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 7c45e19f5f..799a8a2eb8 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -632,6 +632,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_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/cursor/scroll_past_end_of_file", false);
_initial_set("text_editor/indent/type", 0);
@@ -705,7 +706,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_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.15);
+ _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);
hints["editors/3d/navigation_feel/translation_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 70a6954fb5..5782edd321 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -45,7 +45,7 @@
#include "scene/2d/screen_button.h"
#include "scene/2d/sprite.h"
#include "scene/gui/grid_container.h"
-#include "scene/gui/patch_9_rect.h"
+#include "scene/gui/nine_patch_rect.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index b0ee1a32ca..f7dcc4b52d 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -348,6 +348,7 @@ void ShaderEditor::_editor_settings_changed() {
shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers"));
shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting"));
shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences"));
+ shader_editor->get_text_edit()->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line"));
shader_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink"));
shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/theme/line_spacing"));
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 740772e204..8870166dba 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -48,8 +48,8 @@ void TextureRegionEditor::_region_draw() {
Ref<Texture> base_tex = NULL;
if (node_sprite)
base_tex = node_sprite->get_texture();
- else if (node_patch9)
- base_tex = node_patch9->get_texture();
+ else if (node_ninepatch)
+ base_tex = node_ninepatch->get_texture();
else if (obj_styleBox.is_valid())
base_tex = obj_styleBox->get_texture();
else if (atlas_tex.is_valid())
@@ -177,12 +177,12 @@ void TextureRegionEditor::_region_draw() {
updating_scroll = false;
float margins[4];
- if (node_patch9 || obj_styleBox.is_valid()) {
- if (node_patch9) {
- margins[0] = node_patch9->get_patch_margin(MARGIN_TOP);
- margins[1] = node_patch9->get_patch_margin(MARGIN_BOTTOM);
- margins[2] = node_patch9->get_patch_margin(MARGIN_LEFT);
- margins[3] = node_patch9->get_patch_margin(MARGIN_RIGHT);
+ if (node_ninepatch || obj_styleBox.is_valid()) {
+ if (node_ninepatch) {
+ margins[0] = node_ninepatch->get_patch_margin(MARGIN_TOP);
+ margins[1] = node_ninepatch->get_patch_margin(MARGIN_BOTTOM);
+ margins[2] = node_ninepatch->get_patch_margin(MARGIN_LEFT);
+ margins[3] = node_ninepatch->get_patch_margin(MARGIN_RIGHT);
} else if (obj_styleBox.is_valid()) {
margins[0] = obj_styleBox->get_margin_size(MARGIN_TOP);
margins[1] = obj_styleBox->get_margin_size(MARGIN_BOTTOM);
@@ -225,14 +225,14 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (mb->get_button_index() == BUTTON_LEFT) {
if (mb->is_pressed()) {
- if (node_patch9 || obj_styleBox.is_valid()) {
+ if (node_ninepatch || obj_styleBox.is_valid()) {
edited_margin = -1;
float margins[4];
- if (node_patch9) {
- margins[0] = node_patch9->get_patch_margin(MARGIN_TOP);
- margins[1] = node_patch9->get_patch_margin(MARGIN_BOTTOM);
- margins[2] = node_patch9->get_patch_margin(MARGIN_LEFT);
- margins[3] = node_patch9->get_patch_margin(MARGIN_RIGHT);
+ if (node_ninepatch) {
+ margins[0] = node_ninepatch->get_patch_margin(MARGIN_TOP);
+ margins[1] = node_ninepatch->get_patch_margin(MARGIN_BOTTOM);
+ margins[2] = node_ninepatch->get_patch_margin(MARGIN_LEFT);
+ margins[3] = node_ninepatch->get_patch_margin(MARGIN_RIGHT);
} else if (obj_styleBox.is_valid()) {
margins[0] = obj_styleBox->get_margin_size(MARGIN_TOP);
margins[1] = obj_styleBox->get_margin_size(MARGIN_BOTTOM);
@@ -272,8 +272,8 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
Rect2 r;
if (node_sprite)
r = node_sprite->get_region_rect();
- else if (node_patch9)
- r = node_patch9->get_region_rect();
+ else if (node_ninepatch)
+ r = node_ninepatch->get_region_rect();
else if (obj_styleBox.is_valid())
r = obj_styleBox->get_region_rect();
else if (atlas_tex.is_valid())
@@ -285,9 +285,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (node_sprite) {
undo_redo->add_do_method(node_sprite, "set_region_rect", rect);
undo_redo->add_undo_method(node_sprite, "set_region_rect", node_sprite->get_region_rect());
- } else if (node_patch9) {
- undo_redo->add_do_method(node_patch9, "set_region_rect", rect);
- undo_redo->add_undo_method(node_patch9, "set_region_rect", node_patch9->get_region_rect());
+ } else if (node_ninepatch) {
+ undo_redo->add_do_method(node_ninepatch, "set_region_rect", rect);
+ undo_redo->add_undo_method(node_ninepatch, "set_region_rect", node_ninepatch->get_region_rect());
} else if (obj_styleBox.is_valid()) {
undo_redo->add_do_method(obj_styleBox.ptr(), "set_region_rect", rect);
undo_redo->add_undo_method(obj_styleBox.ptr(), "set_region_rect", obj_styleBox->get_region_rect());
@@ -310,8 +310,8 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
drag = true;
if (node_sprite)
rect_prev = node_sprite->get_region_rect();
- else if (node_patch9)
- rect_prev = node_patch9->get_region_rect();
+ else if (node_ninepatch)
+ rect_prev = node_ninepatch->get_region_rect();
else if (obj_styleBox.is_valid())
rect_prev = obj_styleBox->get_region_rect();
else if (atlas_tex.is_valid())
@@ -334,9 +334,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (edited_margin >= 0) {
undo_redo->create_action("Set Margin");
static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
- if (node_patch9) {
- undo_redo->add_do_method(node_patch9, "set_patch_margin", m[edited_margin], node_patch9->get_patch_margin(m[edited_margin]));
- undo_redo->add_undo_method(node_patch9, "set_patch_margin", m[edited_margin], prev_margin);
+ if (node_ninepatch) {
+ undo_redo->add_do_method(node_ninepatch, "set_patch_margin", m[edited_margin], node_ninepatch->get_patch_margin(m[edited_margin]));
+ undo_redo->add_undo_method(node_ninepatch, "set_patch_margin", m[edited_margin], prev_margin);
} else if (obj_styleBox.is_valid()) {
undo_redo->add_do_method(obj_styleBox.ptr(), "set_margin_size", m[edited_margin], obj_styleBox->get_margin_size(m[edited_margin]));
undo_redo->add_undo_method(obj_styleBox.ptr(), "set_margin_size", m[edited_margin], prev_margin);
@@ -351,11 +351,11 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
} else if (atlas_tex.is_valid()) {
undo_redo->add_do_method(atlas_tex.ptr(), "set_region", atlas_tex->get_region());
undo_redo->add_undo_method(atlas_tex.ptr(), "set_region", rect_prev);
- } else if (node_patch9) {
+ } else if (node_ninepatch) {
// FIXME: Is this intentional?
- } else if (node_patch9) {
- undo_redo->add_do_method(node_patch9, "set_region_rect", node_patch9->get_region_rect());
- undo_redo->add_undo_method(node_patch9, "set_region_rect", rect_prev);
+ } else if (node_ninepatch) {
+ undo_redo->add_do_method(node_ninepatch, "set_region_rect", node_ninepatch->get_region_rect());
+ undo_redo->add_undo_method(node_ninepatch, "set_region_rect", rect_prev);
} else if (obj_styleBox.is_valid()) {
undo_redo->add_do_method(obj_styleBox.ptr(), "set_region_rect", obj_styleBox->get_region_rect());
undo_redo->add_undo_method(obj_styleBox.ptr(), "set_region_rect", rect_prev);
@@ -375,8 +375,8 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
drag = false;
if (edited_margin >= 0) {
static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
- if (node_patch9)
- node_patch9->set_patch_margin(m[edited_margin], prev_margin);
+ if (node_ninepatch)
+ node_ninepatch->set_patch_margin(m[edited_margin], prev_margin);
if (obj_styleBox.is_valid())
obj_styleBox->set_margin_size(m[edited_margin], prev_margin);
edited_margin = -1;
@@ -422,8 +422,8 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (new_margin < 0)
new_margin = 0;
static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
- if (node_patch9)
- node_patch9->set_patch_margin(m[edited_margin], new_margin);
+ if (node_ninepatch)
+ node_ninepatch->set_patch_margin(m[edited_margin], new_margin);
if (obj_styleBox.is_valid())
obj_styleBox->set_margin_size(m[edited_margin], new_margin);
} else {
@@ -573,8 +573,8 @@ void TextureRegionEditor::_zoom_out() {
void TextureRegionEditor::apply_rect(const Rect2 &rect) {
if (node_sprite)
node_sprite->set_region_rect(rect);
- else if (node_patch9)
- node_patch9->set_region_rect(rect);
+ else if (node_ninepatch)
+ node_ninepatch->set_region_rect(rect);
else if (obj_styleBox.is_valid())
obj_styleBox->set_region_rect(rect);
else if (atlas_tex.is_valid())
@@ -593,8 +593,8 @@ void TextureRegionEditor::_notification(int p_what) {
}
void TextureRegionEditor::_node_removed(Object *p_obj) {
- if (p_obj == node_sprite || p_obj == node_patch9 || p_obj == obj_styleBox.ptr() || p_obj == atlas_tex.ptr()) {
- node_patch9 = NULL;
+ if (p_obj == node_sprite || p_obj == node_ninepatch || p_obj == obj_styleBox.ptr() || p_obj == atlas_tex.ptr()) {
+ node_ninepatch = NULL;
node_sprite = NULL;
obj_styleBox = Ref<StyleBox>(NULL);
atlas_tex = Ref<AtlasTexture>(NULL);
@@ -623,15 +623,15 @@ void TextureRegionEditor::_bind_methods() {
void TextureRegionEditor::edit(Object *p_obj) {
if (node_sprite)
node_sprite->remove_change_receptor(this);
- if (node_patch9)
- node_patch9->remove_change_receptor(this);
+ if (node_ninepatch)
+ node_ninepatch->remove_change_receptor(this);
if (obj_styleBox.is_valid())
obj_styleBox->remove_change_receptor(this);
if (atlas_tex.is_valid())
atlas_tex->remove_change_receptor(this);
if (p_obj) {
node_sprite = Object::cast_to<Sprite>(p_obj);
- node_patch9 = Object::cast_to<NinePatchRect>(p_obj);
+ node_ninepatch = Object::cast_to<NinePatchRect>(p_obj);
if (Object::cast_to<StyleBoxTexture>(p_obj))
obj_styleBox = Ref<StyleBoxTexture>(Object::cast_to<StyleBoxTexture>(p_obj));
if (Object::cast_to<AtlasTexture>(p_obj))
@@ -640,7 +640,7 @@ void TextureRegionEditor::edit(Object *p_obj) {
_edit_region();
} else {
node_sprite = NULL;
- node_patch9 = NULL;
+ node_ninepatch = NULL;
obj_styleBox = Ref<StyleBoxTexture>(NULL);
atlas_tex = Ref<AtlasTexture>(NULL);
}
@@ -659,8 +659,8 @@ void TextureRegionEditor::_edit_region() {
Ref<Texture> texture = NULL;
if (node_sprite)
texture = node_sprite->get_texture();
- else if (node_patch9)
- texture = node_patch9->get_texture();
+ else if (node_ninepatch)
+ texture = node_ninepatch->get_texture();
else if (obj_styleBox.is_valid())
texture = obj_styleBox->get_texture();
else if (atlas_tex.is_valid())
@@ -726,8 +726,8 @@ void TextureRegionEditor::_edit_region() {
if (node_sprite)
rect = node_sprite->get_region_rect();
- else if (node_patch9)
- rect = node_patch9->get_region_rect();
+ else if (node_ninepatch)
+ rect = node_ninepatch->get_region_rect();
else if (obj_styleBox.is_valid())
rect = obj_styleBox->get_region_rect();
else if (atlas_tex.is_valid())
@@ -747,7 +747,7 @@ Vector2 TextureRegionEditor::snap_point(Vector2 p_target) const {
TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
node_sprite = NULL;
- node_patch9 = NULL;
+ node_ninepatch = NULL;
obj_styleBox = Ref<StyleBoxTexture>(NULL);
atlas_tex = Ref<AtlasTexture>(NULL);
editor = p_editor;
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 0789dde1c1..2058dad791 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -37,7 +37,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/sprite.h"
-#include "scene/gui/patch_9_rect.h"
+#include "scene/gui/nine_patch_rect.h"
#include "scene/resources/style_box.h"
#include "scene/resources/texture.h"
@@ -82,7 +82,7 @@ class TextureRegionEditor : public Control {
Vector2 snap_step;
Vector2 snap_separation;
- NinePatchRect *node_patch9;
+ NinePatchRect *node_ninepatch;
Sprite *node_sprite;
Ref<StyleBoxTexture> obj_styleBox;
Ref<AtlasTexture> atlas_tex;
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index d12b3f1e0e..9235dafaa6 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -945,6 +945,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
Point2i new_over_tile = node->world_to_map(xform_inv.xform(mm->get_position()));
+ Point2i old_over_tile = over_tile;
if (new_over_tile != over_tile) {
@@ -963,17 +964,43 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (tool == TOOL_PAINTING) {
+ // Paint using bresenham line to prevent holes in painting if the user moves fast
+
+ Vector<Point2i> points = line(old_over_tile.x, over_tile.x, old_over_tile.y, over_tile.y);
int id = get_selected_tile();
- if (id != TileMap::INVALID_CELL) {
+
+ for (int i = 0; i < points.size(); ++i) {
+
+ Point2i pos = points[i];
if (!paint_undo.has(over_tile)) {
- paint_undo[over_tile] = _get_op_from_cell(over_tile);
+ paint_undo[pos] = _get_op_from_cell(pos);
}
- _set_cell(over_tile, id, flip_h, flip_v, transpose);
+ _set_cell(pos, id, flip_h, flip_v, transpose);
+ }
- return true;
+ return true;
+ }
+
+ if (tool == TOOL_ERASING) {
+
+ // erase using bresenham line to prevent holes in painting if the user moves fast
+
+ Vector<Point2i> points = line(old_over_tile.x, over_tile.x, old_over_tile.y, over_tile.y);
+
+ for (int i = 0; i < points.size(); ++i) {
+
+ Point2i pos = points[i];
+
+ if (!paint_undo.has(over_tile)) {
+ paint_undo[pos] = _get_op_from_cell(pos);
+ }
+
+ _set_cell(pos, TileMap::INVALID_CELL);
}
+
+ return true;
}
if (tool == TOOL_SELECTING) {
@@ -1044,16 +1071,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
- if (tool == TOOL_ERASING) {
-
- if (!paint_undo.has(over_tile)) {
- paint_undo[over_tile] = _get_op_from_cell(over_tile);
- }
-
- _set_cell(over_tile, TileMap::INVALID_CELL);
-
- return true;
- }
if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
_pick_tile(over_tile);
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 723d7b14ff..1284788425 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -1127,7 +1127,11 @@ void ProjectSettingsEditor::_translation_res_option_changed() {
ERR_FAIL_COND(!remaps.has(key));
PoolStringArray r = remaps[key];
ERR_FAIL_INDEX(idx, r.size());
- r.set(idx, path + ":" + langs[which]);
+ if (translation_locales_idxs_remap.size() > 0) {
+ r.set(idx, path + ":" + langs[translation_locales_idxs_remap[which]]);
+ } else {
+ r.set(idx, path + ":" + langs[which]);
+ }
remaps[key] = r;
updating_translations = true;
@@ -1203,6 +1207,88 @@ void ProjectSettingsEditor::_translation_res_option_delete(Object *p_item, int p
undo_redo->commit_action();
}
+void ProjectSettingsEditor::_translation_filter_option_changed() {
+
+ int sel_id = translation_locale_filter_mode->get_selected_id();
+ TreeItem *t = translation_filter->get_selected();
+ String locale = t->get_tooltip(0);
+ bool checked = t->is_checked(0);
+
+ Variant prev;
+ Array f_locales_all;
+
+ if (ProjectSettings::get_singleton()->has_setting("locale/locale_filter")) {
+ f_locales_all = ProjectSettings::get_singleton()->get("locale/locale_filter");
+ prev = f_locales_all;
+
+ if (f_locales_all.size() != 2) {
+ f_locales_all.clear();
+ f_locales_all.append(sel_id);
+ f_locales_all.append(Array());
+ }
+ } else {
+ f_locales_all.append(sel_id);
+ f_locales_all.append(Array());
+ }
+
+ Array f_locales = f_locales_all[1];
+ int l_idx = f_locales.find(locale);
+
+ if (checked) {
+ if (l_idx == -1) {
+ f_locales.append(locale);
+ }
+ } else {
+ if (l_idx != -1) {
+ f_locales.remove(l_idx);
+ }
+ }
+
+ f_locales = f_locales.sort();
+
+ undo_redo->create_action(TTR("Changed Locale Filter"));
+ undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/locale_filter", f_locales_all);
+ undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/locale_filter", prev);
+ undo_redo->add_do_method(this, "_update_translations");
+ undo_redo->add_undo_method(this, "_update_translations");
+ undo_redo->add_do_method(this, "_settings_changed");
+ undo_redo->add_undo_method(this, "_settings_changed");
+ undo_redo->commit_action();
+}
+
+void ProjectSettingsEditor::_translation_filter_mode_changed(int p_mode) {
+
+ int sel_id = translation_locale_filter_mode->get_selected_id();
+
+ Variant prev;
+ Array f_locales_all;
+
+ if (ProjectSettings::get_singleton()->has_setting("locale/locale_filter")) {
+ f_locales_all = ProjectSettings::get_singleton()->get("locale/locale_filter");
+ prev = f_locales_all;
+
+ if (f_locales_all.size() != 2) {
+ f_locales_all.clear();
+ f_locales_all.append(sel_id);
+ f_locales_all.append(Array());
+ } else {
+ f_locales_all[0] = sel_id;
+ }
+ } else {
+ f_locales_all.append(sel_id);
+ f_locales_all.append(Array());
+ }
+
+ undo_redo->create_action(TTR("Changed Locale Filter Mode"));
+ undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/locale_filter", f_locales_all);
+ undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/locale_filter", prev);
+ undo_redo->add_do_method(this, "_update_translations");
+ undo_redo->add_undo_method(this, "_update_translations");
+ undo_redo->add_do_method(this, "_settings_changed");
+ undo_redo->add_undo_method(this, "_settings_changed");
+ undo_redo->commit_action();
+}
+
void ProjectSettingsEditor::_update_translations() {
//update translations
@@ -1229,6 +1315,61 @@ void ProjectSettingsEditor::_update_translations() {
}
}
+ Vector<String> langs = TranslationServer::get_all_locales();
+ Vector<String> names = TranslationServer::get_all_locale_names();
+
+ //update filter tab
+ Array l_filter_all;
+
+ bool is_arr_empty = true;
+ if (ProjectSettings::get_singleton()->has_setting("locale/locale_filter")) {
+
+ l_filter_all = ProjectSettings::get_singleton()->get("locale/locale_filter");
+
+ if (l_filter_all.size() == 2) {
+
+ translation_locale_filter_mode->select(l_filter_all[0]);
+ is_arr_empty = false;
+ }
+ }
+ if (is_arr_empty) {
+
+ l_filter_all.append(0);
+ l_filter_all.append(Array());
+ translation_locale_filter_mode->select(0);
+ }
+
+ int filter_mode = l_filter_all[0];
+ Array l_filter = l_filter_all[1];
+
+ int s = names.size();
+ if (!translation_locales_list_created) {
+
+ translation_locales_list_created = true;
+ translation_filter->clear();
+ root = translation_filter->create_item(NULL);
+ translation_filter->set_hide_root(true);
+ translation_filter_treeitems.resize(s);
+
+ for (int i = 0; i < s; i++) {
+ String n = names[i];
+ String l = langs[i];
+ TreeItem *t = translation_filter->create_item(root);
+ t->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
+ t->set_text(0, n);
+ t->set_editable(0, true);
+ t->set_tooltip(0, l);
+ t->set_checked(0, l_filter.has(l));
+ translation_filter_treeitems[i] = t;
+ }
+ } else {
+ for (int i = 0; i < s; i++) {
+
+ TreeItem *t = translation_filter_treeitems[i];
+ t->set_checked(0, l_filter.has(t->get_tooltip(0)));
+ }
+ }
+
//update translation remaps
String remap_selected;
@@ -1244,13 +1385,30 @@ void ProjectSettingsEditor::_update_translations() {
translation_remap_options->set_hide_root(true);
translation_res_option_add_button->set_disabled(true);
- Vector<String> langs = TranslationServer::get_all_locales();
- Vector<String> names = TranslationServer::get_all_locale_names();
- String langnames;
+ translation_locales_idxs_remap.clear();
+ translation_locales_idxs_remap.resize(l_filter.size());
+ int fl_idx_count = translation_locales_idxs_remap.size();
+
+ String langnames = "";
+ int l_idx = 0;
for (int i = 0; i < names.size(); i++) {
- if (i > 0)
- langnames += ",";
- langnames += names[i];
+
+ if (filter_mode == SHOW_ONLY_SELECTED_LOCALES && fl_idx_count != 0) {
+ if (l_filter.size() > 0) {
+
+ if (l_filter.find(langs[i]) != -1) {
+ if (langnames.length() > 0)
+ langnames += ",";
+ langnames += names[i];
+ translation_locales_idxs_remap[l_idx] = i;
+ l_idx++;
+ }
+ }
+ } else {
+ if (i > 0)
+ langnames += ",";
+ langnames += names[i];
+ }
}
if (ProjectSettings::get_singleton()->has_setting("locale/translation_remaps")) {
@@ -1295,11 +1453,18 @@ void ProjectSettingsEditor::_update_translations() {
t2->set_editable(1, true);
t2->set_metadata(1, path);
int idx = langs.find(locale);
- print_line("find " + locale + " at " + itos(idx));
+ //print_line("find " + locale + " at " + itos(idx));
if (idx < 0)
idx = 0;
- t2->set_range(1, idx);
+ int f_idx = translation_locales_idxs_remap.find(idx);
+ if (f_idx != -1 && fl_idx_count > 0 && filter_mode == SHOW_ONLY_SELECTED_LOCALES) {
+
+ t2->set_range(1, f_idx);
+ } else {
+
+ t2->set_range(1, idx);
+ }
}
}
}
@@ -1381,6 +1546,9 @@ void ProjectSettingsEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_translation_res_delete"), &ProjectSettingsEditor::_translation_res_delete);
ClassDB::bind_method(D_METHOD("_translation_res_option_delete"), &ProjectSettingsEditor::_translation_res_option_delete);
+ ClassDB::bind_method(D_METHOD("_translation_filter_option_changed"), &ProjectSettingsEditor::_translation_filter_option_changed);
+ ClassDB::bind_method(D_METHOD("_translation_filter_mode_changed"), &ProjectSettingsEditor::_translation_filter_mode_changed);
+
ClassDB::bind_method(D_METHOD("_clear_search_box"), &ProjectSettingsEditor::_clear_search_box);
ClassDB::bind_method(D_METHOD("_toggle_search_bar"), &ProjectSettingsEditor::_toggle_search_bar);
@@ -1601,6 +1769,8 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
translations->set_tab_align(TabContainer::ALIGN_LEFT);
translations->set_name(TTR("Localization"));
tab_container->add_child(translations);
+ //remap for properly select language in popup
+ translation_locales_idxs_remap = Vector<int>();
{
@@ -1684,6 +1854,29 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
}
{
+ VBoxContainer *tvb = memnew(VBoxContainer);
+ translations->add_child(tvb);
+ tvb->set_name(TTR("Locales Filter"));
+ VBoxContainer *tmc = memnew(VBoxContainer);
+ tmc->set_v_size_flags(SIZE_EXPAND_FILL);
+ tvb->add_child(tmc);
+
+ translation_locale_filter_mode = memnew(OptionButton);
+ translation_locale_filter_mode->add_item(TTR("Show all locales"), SHOW_ALL_LOCALES);
+ translation_locale_filter_mode->add_item(TTR("Show only selected locales"), SHOW_ONLY_SELECTED_LOCALES);
+ translation_locale_filter_mode->select(0);
+ tmc->add_margin_child(TTR("Filter mode:"), translation_locale_filter_mode);
+ translation_locale_filter_mode->connect("item_selected", this, "_translation_filter_mode_changed");
+
+ translation_filter = memnew(Tree);
+ translation_filter->set_v_size_flags(SIZE_EXPAND_FILL);
+ translation_filter->set_columns(1);
+ tmc->add_child(memnew(Label(TTR("Locales:"))));
+ tmc->add_child(translation_filter);
+ translation_filter->connect("item_edited", this, "_translation_filter_option_changed");
+ }
+
+ {
autoload_settings = memnew(EditorAutoloadSettings);
autoload_settings->set_name(TTR("AutoLoad"));
tab_container->add_child(autoload_settings);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 7f9b18a968..a86cfee813 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -49,6 +49,11 @@ class ProjectSettingsEditor : public AcceptDialog {
INPUT_MOUSE_BUTTON
};
+ enum LocaleFilter {
+ SHOW_ALL_LOCALES,
+ SHOW_ONLY_SELECTED_LOCALES,
+ };
+
TabContainer *tab_container;
Timer *timer;
@@ -95,6 +100,11 @@ class ProjectSettingsEditor : public AcceptDialog {
EditorFileDialog *translation_res_option_file_open;
Tree *translation_remap;
Tree *translation_remap_options;
+ Tree *translation_filter;
+ bool translation_locales_list_created;
+ OptionButton *translation_locale_filter_mode;
+ Vector<TreeItem *> translation_filter_treeitems;
+ Vector<int> translation_locales_idxs_remap;
EditorAutoloadSettings *autoload_settings;
@@ -142,6 +152,9 @@ class ProjectSettingsEditor : public AcceptDialog {
void _translation_res_option_changed();
void _translation_res_option_delete(Object *p_item, int p_column, int p_button);
+ void _translation_filter_option_changed();
+ void _translation_filter_mode_changed(int p_mode);
+
void _toggle_search_bar(bool p_pressed);
void _clear_search_box();
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 00f44ad9b0..c19b80e649 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -145,9 +145,13 @@ void ScriptCreateDialog::ok_pressed() {
void ScriptCreateDialog::_create_new() {
- String cname;
- if (has_named_classes)
- cname = class_name->get_text();
+ String cname_param;
+
+ if (has_named_classes) {
+ cname_param = class_name->get_text();
+ } else {
+ cname_param = ProjectSettings::get_singleton()->localize_path(file_path->get_text()).get_file().get_basename();
+ }
Ref<Script> scr;
if (script_template != "") {
@@ -159,13 +163,16 @@ void ScriptCreateDialog::_create_new() {
return;
}
scr = scr->duplicate();
- ScriptServer::get_language(language_menu->get_selected())->make_template(cname, parent_name->get_text(), scr);
+ ScriptServer::get_language(language_menu->get_selected())->make_template(cname_param, parent_name->get_text(), scr);
} else {
- scr = ScriptServer::get_language(language_menu->get_selected())->get_template(cname, parent_name->get_text());
+ scr = ScriptServer::get_language(language_menu->get_selected())->get_template(cname_param, parent_name->get_text());
}
- if (cname != "")
- scr->set_name(cname);
+ if (has_named_classes) {
+ String cname = class_name->get_text();
+ if (cname.length())
+ scr->set_name(cname);
+ }
if (!is_built_in) {
String lpath = ProjectSettings::get_singleton()->localize_path(file_path->get_text());
@@ -201,12 +208,20 @@ void ScriptCreateDialog::_lang_changed(int l) {
l = language_menu->get_selected();
ScriptLanguage *language = ScriptServer::get_language(l);
+
if (language->has_named_classes()) {
has_named_classes = true;
} else {
has_named_classes = false;
}
+ if (language->supports_builtin_mode()) {
+ supports_built_in = true;
+ } else {
+ supports_built_in = false;
+ is_built_in = false;
+ }
+
if (ScriptServer::get_language(l)->can_inherit_from_file()) {
can_inherit_from_file = true;
} else {
@@ -496,6 +511,9 @@ void ScriptCreateDialog::_update_dialog() {
}
}
+ if (!supports_built_in)
+ internal->set_pressed(false);
+
/* Is Script created or loaded from existing file */
if (is_new_script_created) {
@@ -503,7 +521,7 @@ void ScriptCreateDialog::_update_dialog() {
get_ok()->set_text(TTR("Create"));
parent_name->set_editable(true);
parent_browse_button->set_disabled(false);
- internal->set_disabled(false);
+ internal->set_disabled(!supports_built_in);
if (is_built_in) {
_msg_path_valid(true, TTR("Built-in script (into scene file)"));
} else {
@@ -734,6 +752,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
is_path_valid = false;
has_named_classes = false;
+ supports_built_in = false;
can_inherit_from_file = false;
is_built_in = false;
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index d16c523f0a..c7bbc82d47 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -62,6 +62,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
bool is_new_script_created;
bool is_path_valid;
bool has_named_classes;
+ bool supports_built_in;
bool can_inherit_from_file;
bool is_parent_name_valid;
bool is_class_name_valid;
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index ef61aad341..bc2423fffd 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -574,7 +574,38 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
for (int i = 0; i < arr.size(); i++) {
p[i] = arr[i];
if (i < perf_items.size()) {
- perf_items[i]->set_text(1, rtos(p[i]));
+
+ float v = p[i];
+ String vs = rtos(v);
+ String tt = vs;
+ switch (Performance::MonitorType((int)perf_items[i]->get_metadata(1))) {
+ case Performance::MONITOR_TYPE_MEMORY: {
+ // for the time being, going above GBs is a bad sign.
+ String unit = "B";
+ if ((int)v > 1073741824) {
+ unit = "GB";
+ v /= 1073741824.0;
+ } else if ((int)v > 1048576) {
+ unit = "MB";
+ v /= 1048576.0;
+ } else if ((int)v > 1024) {
+ unit = "KB";
+ v /= 1024.0;
+ }
+ tt += " bytes";
+ vs = rtos(v) + " " + unit;
+ } break;
+ case Performance::MONITOR_TYPE_TIME: {
+ tt += " seconds";
+ vs += " s";
+ } break;
+ default: {
+ tt += " " + perf_items[i]->get_text(0);
+ } break;
+ }
+
+ perf_items[i]->set_text(1, vs);
+ perf_items[i]->set_tooltip(1, tt);
if (p[i] > perf_max[i])
perf_max[i] = p[i];
}
@@ -775,7 +806,7 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType
reason->set_tooltip(p_reason);
}
-void ScriptEditorDebugger::_performance_select(Object *, int, bool) {
+void ScriptEditorDebugger::_performance_select() {
perf_draw->update();
}
@@ -785,7 +816,7 @@ void ScriptEditorDebugger::_performance_draw() {
Vector<int> which;
for (int i = 0; i < perf_items.size(); i++) {
- if (perf_items[i]->is_selected(0))
+ if (perf_items[i]->is_checked(0))
which.push_back(i);
}
@@ -816,14 +847,14 @@ void ScriptEditorDebugger::_performance_draw() {
r.position += graph_sb->get_offset();
r.size -= graph_sb->get_minimum_size();
int pi = which[i];
- Color c = get_color("success_color", "Editor");
- c.set_hsv(Math::fmod(c.get_h() + pi * 0.7654, 1), c.get_s(), c.get_v());
- //c = c.linear_interpolate(get_color("base_color", "Editor"), 0.9);
+ Color c = get_color("accent_color", "Editor");
+ float h = (float)which[i] / (float)(perf_items.size());
+ c.set_hsv(Math::fmod(h + 0.4, 0.9), c.get_s() * 0.9, c.get_v() * 1.4);
- c.a = 0.8;
- perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent()), perf_items[pi]->get_text(0), c, r.size.x);
c.a = 0.6;
- perf_draw->draw_string(graph_font, r.position + Point2(graph_font->get_char_size('X').width, graph_font->get_ascent() + graph_font->get_height()), perf_items[pi]->get_text(1), c, r.size.y);
+ perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent()), perf_items[pi]->get_text(0), c, r.size.x);
+ c.a = 0.9;
+ perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent() + graph_font->get_height()), perf_items[pi]->get_text(1), c, r.size.y);
float spacing = point_sep / float(cols);
float from = r.size.width;
@@ -1785,13 +1816,12 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
perf_monitors->set_column_title(1, TTR("Value"));
perf_monitors->set_column_titles_visible(true);
hsp->add_child(perf_monitors);
- perf_monitors->set_select_mode(Tree::SELECT_MULTI);
- perf_monitors->connect("multi_selected", this, "_performance_select");
+ perf_monitors->connect("item_edited", this, "_performance_select");
perf_draw = memnew(Control);
perf_draw->connect("draw", this, "_performance_draw");
hsp->add_child(perf_draw);
hsp->set_name(TTR("Monitors"));
- hsp->set_split_offset(300);
+ hsp->set_split_offset(340 * EDSCALE);
tabs->add_child(hsp);
perf_max.resize(Performance::MONITOR_MAX);
@@ -1801,6 +1831,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
for (int i = 0; i < Performance::MONITOR_MAX; i++) {
String n = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i));
+ Performance::MonitorType mtype = Performance::get_singleton()->get_monitor_type(Performance::Monitor(i));
String base = n.get_slice("/", 0);
String name = n.get_slice("/", 1);
if (!bases.has(base)) {
@@ -1808,12 +1839,16 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
b->set_text(0, base.capitalize());
b->set_editable(0, false);
b->set_selectable(0, false);
+ b->set_expand_right(0, true);
bases[base] = b;
}
TreeItem *it = perf_monitors->create_item(bases[base]);
- it->set_editable(0, false);
- it->set_selectable(0, true);
+ it->set_metadata(1, mtype);
+ it->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
+ it->set_editable(0, true);
+ it->set_selectable(0, false);
+ it->set_selectable(1, false);
it->set_text(0, name.capitalize());
perf_items.push_back(it);
perf_max[i] = 0;
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index d0faab5892..d18a625eef 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -142,7 +142,7 @@ class ScriptEditorDebugger : public Control {
bool live_debug;
void _performance_draw();
- void _performance_select(Object *, int, bool);
+ void _performance_select();
void _stack_dump_frame_selected();
void _output_clear();
diff --git a/main/performance.cpp b/main/performance.cpp
index c4b62559c7..39b42e803c 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -153,6 +153,44 @@ float Performance::get_monitor(Monitor p_monitor) const {
return 0;
}
+Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const {
+ ERR_FAIL_INDEX_V(p_monitor, MONITOR_MAX, MONITOR_TYPE_QUANTITY);
+ // ugly
+ static const MonitorType types[MONITOR_MAX] = {
+
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_TIME,
+ MONITOR_TYPE_TIME,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_QUANTITY,
+
+ };
+
+ return types[p_monitor];
+}
+
void Performance::set_process_time(float p_pt) {
_process_time = p_pt;
diff --git a/main/performance.h b/main/performance.h
index 900e6434b7..21fbd7a1d2 100644
--- a/main/performance.h
+++ b/main/performance.h
@@ -79,9 +79,17 @@ public:
MONITOR_MAX
};
+ enum MonitorType {
+ MONITOR_TYPE_QUANTITY,
+ MONITOR_TYPE_MEMORY,
+ MONITOR_TYPE_TIME
+ };
+
float get_monitor(Monitor p_monitor) const;
String get_monitor_name(Monitor p_monitor) const;
+ MonitorType get_monitor_type(Monitor p_monitor) const;
+
void set_process_time(float p_pt);
void set_physics_process_time(float p_pt);
diff --git a/modules/gdnative/include/pluginscript/godot_pluginscript.h b/modules/gdnative/include/pluginscript/godot_pluginscript.h
index ec109bac83..d1c210529c 100644
--- a/modules/gdnative/include/pluginscript/godot_pluginscript.h
+++ b/modules/gdnative/include/pluginscript/godot_pluginscript.h
@@ -129,6 +129,7 @@ typedef struct {
const char **comment_delimiters; // NULL terminated array
const char **string_delimiters; // NULL terminated array
godot_bool has_named_classes;
+ godot_bool supports_builtin_mode;
godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name);
godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_pool_string_array *r_functions);
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index aa1fdc32da..c1df7def2e 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -270,10 +270,6 @@ bool NativeScript::is_tool() const {
return false;
}
-String NativeScript::get_node_type() const {
- return ""; // NOTE(karroffel): uhm?
-}
-
ScriptLanguage *NativeScript::get_language() const {
return NativeScriptLanguage::get_singleton();
}
@@ -908,6 +904,9 @@ Script *NativeScriptLanguage::create_script() const {
bool NativeScriptLanguage::has_named_classes() const {
return true;
}
+bool NativeScriptLanguage::supports_builtin_mode() const {
+ return true;
+}
int NativeScriptLanguage::find_function(const String &p_function, const String &p_code) const {
return -1;
}
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index b5db641179..e8fc9e6880 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -142,8 +142,6 @@ public:
virtual bool is_tool() const;
- virtual String get_node_type() const;
-
virtual ScriptLanguage *get_language() const;
virtual bool has_script_signal(const StringName &p_signal) const;
@@ -271,6 +269,7 @@ public:
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
+ virtual bool supports_builtin_mode() const;
virtual int find_function(const String &p_function, const String &p_code) const;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp
index d4b86ae5b4..40feb5ae43 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_language.cpp
@@ -133,6 +133,10 @@ bool PluginScriptLanguage::has_named_classes() const {
return _desc.has_named_classes;
}
+bool PluginScriptLanguage::supports_builtin_mode() const {
+ return _desc.supports_builtin_mode;
+}
+
int PluginScriptLanguage::find_function(const String &p_function, const String &p_code) const {
if (_desc.find_function) {
return _desc.find_function(_data, (godot_string *)&p_function, (godot_string *)&p_code);
diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h
index a48dde97ce..79b95ff4e6 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.h
+++ b/modules/gdnative/pluginscript/pluginscript_language.h
@@ -77,6 +77,7 @@ public:
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
+ virtual bool supports_builtin_mode() const;
virtual bool can_inherit_from_file() { return true; }
virtual int find_function(const String &p_function, const String &p_code) const;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index 7dd10a8bdf..4169b07f63 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -346,11 +346,6 @@ bool PluginScript::get_property_default_value(const StringName &p_property, Vari
return false;
}
-String PluginScript::get_node_type() const {
- // Even GDscript doesn't know what to put here !
- return ""; // ?
-}
-
ScriptLanguage *PluginScript::get_language() const {
return _language;
}
diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h
index e6b8643cd9..5600bca5ef 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.h
+++ b/modules/gdnative/pluginscript/pluginscript_script.h
@@ -103,8 +103,6 @@ public:
bool is_tool() const { return _tool; }
- virtual String get_node_type() const;
-
virtual ScriptLanguage *get_language() const;
virtual bool has_script_signal(const StringName &p_signal) const;
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index b0408917a4..bcb998aee0 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -61,7 +61,11 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
"func _ready():\n" +
"%TS%# Called every time the node is added to the scene.\n" +
"%TS%# Initialization here\n" +
- "%TS%pass\n";
+ "%TS%pass\n\n" +
+ "#func _process(delta):\n" +
+ "#%TS%# Called every frame. Delta is time since last frame.\n" +
+ "#%TS%# Update game logic here.\n" +
+ "#%TS%pass\n";
_template = _template.replace("%BASE%", p_base_class_name);
_template = _template.replace("%TS%", _get_indentation());
@@ -127,6 +131,11 @@ bool GDScriptLanguage::has_named_classes() const {
return false;
}
+bool GDScriptLanguage::supports_builtin_mode() const {
+
+ return true;
+}
+
int GDScriptLanguage::find_function(const String &p_function, const String &p_code) const {
GDTokenizerText tokenizer;
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 36aaa1f807..94385dc0d0 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -1906,7 +1906,8 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) {
// all the constants like strings and numbers
default: {
Node *value = _parse_and_reduce_expression(pattern, p_static);
- if (error_set) {
+ if (!value) {
+ _set_error("Expect constant expression or variables in a pattern");
return NULL;
}
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index cf6529d5ae..3f3818ffb9 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -609,11 +609,6 @@ Error GDScript::reload(bool p_keep_state) {
return OK;
}
-String GDScript::get_node_type() const {
-
- return ""; // ?
-}
-
ScriptLanguage *GDScript::get_language() const {
return GDScriptLanguage::get_singleton();
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 5e1a8b19ac..e0d142014a 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -172,7 +172,6 @@ public:
virtual Error reload(bool p_keep_state = false);
- virtual String get_node_type() const;
void set_script_path(const String &p_path) { path = p_path; } //because subclasses need a path too...
Error load_source_code(const String &p_path);
Error load_byte_code(const String &p_path);
@@ -386,6 +385,7 @@ public:
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
+ virtual bool supports_builtin_mode() const;
virtual bool can_inherit_from_file() { return true; }
virtual int find_function(const String &p_function, const String &p_code) const;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index ba8c7df9cc..8d4e19469a 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -277,13 +277,22 @@ Ref<Script> CSharpLanguage::get_template(const String &p_class_name, const Strin
" // Initialization here\n"
" \n"
" }\n"
+ "\n"
+ "// public override void _Process(float delta)\n"
+ "// {\n"
+ "// // Called every frame. Delta is time since last frame.\n"
+ "// // Update game logic here.\n"
+ "// \n"
+ "// }\n"
"}\n";
- script_template = script_template.replace("%BASE_CLASS_NAME%", p_base_class_name).replace("%CLASS_NAME%", p_class_name);
+ script_template = script_template.replace("%BASE_CLASS_NAME%", p_base_class_name)
+ .replace("%CLASS_NAME%", p_class_name);
Ref<CSharpScript> script;
script.instance();
script->set_source_code(script_template);
+ script->set_name(p_class_name);
return script;
}
@@ -295,7 +304,12 @@ Script *CSharpLanguage::create_script() const {
bool CSharpLanguage::has_named_classes() const {
- return true;
+ return false;
+}
+
+bool CSharpLanguage::supports_builtin_mode() const {
+
+ return false;
}
static String variant_type_to_managed_name(const String &p_var_type_name) {
@@ -1706,11 +1720,6 @@ Error CSharpScript::reload(bool p_keep_state) {
return ERR_FILE_MISSING_DEPENDENCIES;
}
-String CSharpScript::get_node_type() const {
-
- return ""; // ?
-}
-
ScriptLanguage *CSharpScript::get_language() const {
return CSharpLanguage::get_singleton();
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 6b8475fb61..65a6450da5 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -138,7 +138,6 @@ public:
virtual bool is_tool() const { return tool; }
virtual Ref<Script> get_base_script() const;
- virtual String get_node_type() const;
virtual ScriptLanguage *get_language() const;
/* TODO */ virtual void get_script_method_list(List<MethodInfo> *p_list) const {}
@@ -270,6 +269,7 @@ public:
/* TODO */ virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { return true; }
virtual Script *create_script() const;
virtual bool has_named_classes() const;
+ virtual bool supports_builtin_mode() const;
/* TODO? */ virtual int find_function(const String &p_function, const String &p_code) const { return -1; }
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
/* TODO? */ Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, String &r_call_hint) { return ERR_UNAVAILABLE; }
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 95e75f9103..6cb4d09a51 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -438,6 +438,9 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
return sln_error;
}
+ if (verbose_output)
+ OS::get_singleton()->print("Core API solution and C# project generated successfully!\n");
+
return OK;
}
@@ -530,6 +533,9 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir,
return sln_error;
}
+ if (verbose_output)
+ OS::get_singleton()->print("Editor API solution and C# project generated successfully!\n");
+
return OK;
}
@@ -778,8 +784,8 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
cs_file.push_back(itype.proxy_name);
cs_file.push_back("(IntPtr " BINDINGS_PTR_FIELD ")\n" OPEN_BLOCK_L2 "this." BINDINGS_PTR_FIELD " = " BINDINGS_PTR_FIELD ";\n" CLOSE_BLOCK_L2);
- cs_file.push_back(MEMBER_BEGIN "public bool HasValidHandle()\n" OPEN_BLOCK_L2
- "return " BINDINGS_PTR_FIELD " == IntPtr.Zero;\n" CLOSE_BLOCK_L2);
+ cs_file.push_back(MEMBER_BEGIN "public IntPtr NativeInstance\n" OPEN_BLOCK_L2
+ "get { return " BINDINGS_PTR_FIELD "; }\n" CLOSE_BLOCK_L2);
} else if (itype.is_singleton) {
// Add the type name and the singleton pointer as static fields
@@ -841,8 +847,8 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
// Add methods
if (!is_derived_type) {
- cs_file.push_back(MEMBER_BEGIN "public bool HasValidHandle()\n" OPEN_BLOCK_L2
- "return " BINDINGS_PTR_FIELD " == IntPtr.Zero;\n" CLOSE_BLOCK_L2);
+ cs_file.push_back(MEMBER_BEGIN "public IntPtr NativeInstance\n" OPEN_BLOCK_L2
+ "get { return " BINDINGS_PTR_FIELD "; }\n" CLOSE_BLOCK_L2);
cs_file.push_back(MEMBER_BEGIN "internal static IntPtr " CS_SMETHOD_GETINSTANCE "(Object instance)\n" OPEN_BLOCK_L2
"return instance == null ? IntPtr.Zero : instance." BINDINGS_PTR_FIELD ";\n" CLOSE_BLOCK_L2);
@@ -1389,13 +1395,20 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
cpp_file.push_back(CLOSE_BLOCK "}\n");
- return _save_file(path_join(p_output_dir, "mono_glue.gen.cpp"), cpp_file);
+ Error save_err = _save_file(path_join(p_output_dir, "mono_glue.gen.cpp"), cpp_file);
+ if (save_err != OK)
+ return save_err;
+
+ OS::get_singleton()->print("Mono glue generated successfully!\n");
+
+ return OK;
}
Error BindingsGenerator::_save_file(const String &p_path, const List<String> &p_content) {
FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE);
+ ERR_EXPLAIN("Cannot open file: " + p_path);
ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
for (const List<String>::Element *E = p_content.front(); E; E = E->next()) {
@@ -1471,7 +1484,8 @@ void BindingsGenerator::_populate_object_type_interfaces() {
itype.memory_own = itype.is_reference;
if (!ClassDB::is_class_exposed(type_cname)) {
- WARN_PRINTS("Ignoring type " + String(type_cname) + " because it's not exposed");
+ if (verbose_output)
+ WARN_PRINTS("Ignoring type " + String(type_cname) + " because it's not exposed");
class_list.pop_front();
continue;
}
@@ -1535,9 +1549,11 @@ void BindingsGenerator::_populate_object_type_interfaces() {
// which could actually will return something differnet.
// Let's put this to notify us if that ever happens.
if (itype.name != "Object" || imethod.name != "free") {
- WARN_PRINTS("Notification: New unexpected virtual non-overridable method found.\n"
- "We only expected Object.free, but found " +
- itype.name + "." + imethod.name);
+ if (verbose_output) {
+ WARN_PRINTS("Notification: New unexpected virtual non-overridable method found.\n"
+ "We only expected Object.free, but found " +
+ itype.name + "." + imethod.name);
+ }
}
} else {
ERR_PRINTS("Missing MethodBind for non-virtual method: " + itype.name + "." + imethod.name);
@@ -2043,7 +2059,8 @@ BindingsGenerator::BindingsGenerator() {
void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) {
- int options_count = 3;
+ const int NUM_OPTIONS = 3;
+ int options_left = NUM_OPTIONS;
String mono_glue_option = "--generate-mono-glue";
String cs_core_api_option = "--generate-cs-core-api";
@@ -2053,7 +2070,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
const List<String>::Element *elem = p_cmdline_args.front();
- while (elem && options_count) {
+ while (elem && options_left) {
if (elem->get() == mono_glue_option) {
@@ -2066,7 +2083,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
ERR_PRINTS("--generate-mono-glue: No output directory specified");
}
- --options_count;
+ --options_left;
} else if (elem->get() == cs_core_api_option) {
@@ -2079,7 +2096,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
ERR_PRINTS(cs_core_api_option + ": No output directory specified");
}
- --options_count;
+ --options_left;
} else if (elem->get() == cs_editor_api_option) {
@@ -2096,13 +2113,16 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
ERR_PRINTS(cs_editor_api_option + ": No output directory specified");
}
- --options_count;
+ --options_left;
}
elem = elem->next();
}
verbose_output = false;
+
+ if (options_left != NUM_OPTIONS)
+ exit(0);
}
#endif
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
index 1bad8a3f85..d3808769fb 100644
--- a/modules/mono/editor/godotsharp_builds.cpp
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -395,10 +395,11 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
}
if (!exited) {
- ERR_PRINT("BuildProcess::start called, but process still running");
exited = true;
- build_tab->on_build_exec_failed("!exited");
- return;
+ String message = "Tried to start build process, but it is already running";
+ build_tab->on_build_exec_failed(message);
+ ERR_EXPLAIN(message);
+ ERR_FAIL();
}
exited = false;
@@ -410,10 +411,12 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (d->file_exists(issues_file)) {
Error err = d->remove(issues_file);
if (err != OK) {
- ERR_PRINTS("Cannot remove file: " + logs_dir.plus_file(issues_file));
exited = true;
- build_tab->on_build_exec_failed("Cannot remove file: " + issues_file);
- return;
+ String file_path = ProjectSettings::get_singleton()->localize_path(logs_dir).plus_file(issues_file);
+ String message = "Cannot remove issues file: " + file_path;
+ build_tab->on_build_exec_failed(message);
+ ERR_EXPLAIN(message);
+ ERR_FAIL();
}
}
@@ -434,7 +437,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (ex) {
exited = true;
- build_tab->on_build_exec_failed("The build constructor threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex));
+ String message = "The build constructor threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex);
+ build_tab->on_build_exec_failed(message);
+ ERR_EXPLAIN(message);
ERR_FAIL();
}
@@ -452,7 +457,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (ex) {
exited = true;
- build_tab->on_build_exec_failed("The build method threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex));
+ String message = "The build method threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex);
+ build_tab->on_build_exec_failed(message);
+ ERR_EXPLAIN(message);
ERR_FAIL();
}
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
index 07109eaac7..8d6a618ee8 100644
--- a/modules/mono/editor/mono_bottom_panel.cpp
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -280,7 +280,11 @@ void MonoBuildTab::_update_issues_list() {
String tooltip;
tooltip += String("Message: ") + issue.message;
- tooltip += String("\nCode: ") + issue.code;
+
+ if (issue.code.length()) {
+ tooltip += String("\nCode: ") + issue.code;
+ }
+
tooltip += String("\nType: ") + (issue.warning ? "warning" : "error");
String text;
@@ -356,23 +360,21 @@ void MonoBuildTab::on_build_exit(BuildResult result) {
MonoBottomPanel::get_singleton()->raise_build_tab(this);
}
-void MonoBuildTab::on_build_exec_failed(const String &p_cause, const String &p_detailed) {
+void MonoBuildTab::on_build_exec_failed(const String &p_cause) {
build_exited = true;
build_result = RESULT_ERROR;
issues_list->clear();
- String tooltip;
+ BuildIssue issue;
+ issue.message = p_cause;
+ issue.warning = false;
- tooltip += "Message: " + (p_detailed.length() ? p_detailed : p_cause);
- tooltip += "\nType: error";
+ error_count += 1;
+ issues.push_back(issue);
- int line_break_idx = p_cause.find("\n");
- issues_list->add_item(line_break_idx == -1 ? p_cause : p_cause.substr(0, line_break_idx),
- get_icon("Error", "EditorIcons"));
- int index = issues_list->get_item_count() - 1;
- issues_list->set_item_tooltip(index, tooltip);
+ _update_issues_list();
MonoBottomPanel::get_singleton()->raise_build_tab(this);
}
diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h
index 909fa4b385..83da5b9809 100644
--- a/modules/mono/editor/mono_bottom_panel.h
+++ b/modules/mono/editor/mono_bottom_panel.h
@@ -134,7 +134,7 @@ public:
void on_build_start();
void on_build_exit(BuildResult result);
- void on_build_exec_failed(const String &p_cause, const String &p_detailed = String());
+ void on_build_exec_failed(const String &p_cause);
void restart_build();
void stop_build();
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index d7aedbbcf0..4b5f5eb137 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "gd_mono.h"
+#include <mono/metadata/exception.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/mono-debug.h>
#include <mono/metadata/mono-gc.h>
@@ -47,6 +48,15 @@
#include "../editor/godotsharp_editor.h"
#endif
+void gdmono_unhandled_exception_hook(MonoObject *exc, void *user_data) {
+
+ (void)user_data; // UNUSED
+
+ ERR_PRINT(GDMonoUtils::get_exception_name_and_message(exc).utf8());
+ mono_print_unhandled_exception(exc);
+ abort();
+}
+
#ifdef MONO_PRINT_HANDLER_ENABLED
void gdmono_MonoPrintCallback(const char *string, mono_bool is_stdout) {
@@ -214,6 +224,8 @@ void GDMono::initialize() {
// The following assemblies are not required at initialization
_load_all_script_assemblies();
+ mono_install_unhandled_exception_hook(gdmono_unhandled_exception_hook, NULL);
+
OS::get_singleton()->print("Mono: ALL IS GOOD\n");
}
diff --git a/modules/mono/mono_gd/gd_mono_method.cpp b/modules/mono/mono_gd/gd_mono_method.cpp
index 6468e0d3d9..eb97d62900 100644
--- a/modules/mono/mono_gd/gd_mono_method.cpp
+++ b/modules/mono/mono_gd/gd_mono_method.cpp
@@ -83,9 +83,32 @@ MonoObject *GDMonoMethod::invoke(MonoObject *p_object, const Variant **p_params,
mono_array_set(params, MonoObject *, i, boxed_param);
}
- return mono_runtime_invoke_array(mono_method, p_object, params, r_exc);
+ MonoObject *exc = NULL;
+ MonoObject *ret = mono_runtime_invoke_array(mono_method, p_object, params, &exc);
+
+ if (exc) {
+ if (r_exc) {
+ *r_exc = exc;
+ } else {
+ ERR_PRINT(GDMonoUtils::get_exception_name_and_message(exc).utf8());
+ mono_print_unhandled_exception(exc);
+ }
+ }
+
+ return ret;
} else {
- mono_runtime_invoke(mono_method, p_object, NULL, r_exc);
+ MonoObject *exc = NULL;
+ mono_runtime_invoke(mono_method, p_object, NULL, &exc);
+
+ if (exc) {
+ if (r_exc) {
+ *r_exc = exc;
+ } else {
+ ERR_PRINT(GDMonoUtils::get_exception_name_and_message(exc).utf8());
+ mono_print_unhandled_exception(exc);
+ }
+ }
+
return NULL;
}
}
@@ -96,7 +119,19 @@ MonoObject *GDMonoMethod::invoke(MonoObject *p_object, MonoObject **r_exc) {
}
MonoObject *GDMonoMethod::invoke_raw(MonoObject *p_object, void **p_params, MonoObject **r_exc) {
- return mono_runtime_invoke(mono_method, p_object, p_params, r_exc);
+ MonoObject *exc = NULL;
+ MonoObject *ret = mono_runtime_invoke(mono_method, p_object, p_params, &exc);
+
+ if (exc) {
+ if (r_exc) {
+ *r_exc = exc;
+ } else {
+ ERR_PRINT(GDMonoUtils::get_exception_name_and_message(exc).utf8());
+ mono_print_unhandled_exception(exc);
+ }
+ }
+
+ return ret;
}
bool GDMonoMethod::has_attribute(GDMonoClass *p_attr_class) {
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 48145495e4..765fe4c2f2 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -974,11 +974,6 @@ bool VisualScript::is_tool() const {
return false;
}
-String VisualScript::get_node_type() const {
-
- return String();
-}
-
ScriptLanguage *VisualScript::get_language() const {
return VisualScriptLanguage::singleton;
@@ -2412,6 +2407,10 @@ bool VisualScriptLanguage::has_named_classes() const {
return false;
}
+bool VisualScriptLanguage::supports_builtin_mode() const {
+
+ return true;
+}
int VisualScriptLanguage::find_function(const String &p_function, const String &p_code) const {
return -1;
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 4ae50ee829..0f60b103c9 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -339,8 +339,6 @@ public:
virtual bool is_tool() const;
- virtual String get_node_type() const;
-
virtual ScriptLanguage *get_language() const;
virtual bool has_script_signal(const StringName &p_signal) const;
@@ -569,6 +567,7 @@ public:
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
+ virtual bool supports_builtin_mode() const;
virtual int find_function(const String &p_function, const String &p_code) const;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index 4c0e5fd966..cd3974669f 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "audio_driver_javascript.h"
+#include <emscripten.h>
#include <string.h>
#define MAX_NUMBER_INTERFACES 3
@@ -38,22 +39,91 @@
//AudioDriverJavaScript* AudioDriverJavaScript::s_ad=NULL;
+AudioDriverJavaScript *AudioDriverJavaScript::singleton_js = NULL;
const char *AudioDriverJavaScript::get_name() const {
return "JavaScript";
}
+extern "C" {
+
+void js_audio_driver_mix_function(int p_frames) {
+
+ //print_line("MIXI! "+itos(p_frames));
+ AudioDriverJavaScript::singleton_js->mix_to_js(p_frames);
+}
+}
+
+void AudioDriverJavaScript::mix_to_js(int p_frames) {
+
+ int todo = p_frames;
+ int offset = 0;
+
+ while (todo) {
+
+ int tomix = MIN(todo, INTERNAL_BUFFER_SIZE);
+
+ audio_server_process(p_frames, stream_buffer);
+ for (int i = 0; i < tomix * internal_buffer_channels; i++) {
+ internal_buffer[i] = float(stream_buffer[i] >> 16) * 32768.0;
+ }
+
+ /* clang-format off */
+ EM_ASM_({
+ var data = HEAPF32.subarray($0 / 4, $0 / 4 + $2 * 2);
+
+ for (var channel = 0; channel < _as_output_buffer.numberOfChannels; channel++) {
+ var outputData = _as_output_buffer.getChannelData(channel);
+ // Loop through samples
+ for (var sample = 0; sample < $2; sample++) {
+ // make output equal to the same as the input
+ outputData[sample + $1] = data[sample * 2 + channel];
+ }
+ }
+ }, internal_buffer, offset, tomix);
+ /* clang-format on */
+
+ todo -= tomix;
+ offset += tomix;
+ }
+}
+
Error AudioDriverJavaScript::init() {
return OK;
}
void AudioDriverJavaScript::start() {
+
+ internal_buffer_channels = 2;
+ internal_buffer = memnew_arr(float, INTERNAL_BUFFER_SIZE *internal_buffer_channels);
+ stream_buffer = memnew_arr(int32_t, INTERNAL_BUFFER_SIZE * 4); //max 4 channels
+
+ /* clang-format off */
+ EM_ASM(
+ _as_audioctx = new (window.AudioContext || window.webkitAudioContext)();
+
+ audio_server_mix_function = Module.cwrap('js_audio_driver_mix_function', 'void', ['number']);
+ );
+
+ int buffer_latency = 16384;
+ EM_ASM_( {
+ _as_script_node = _as_audioctx.createScriptProcessor($0, 0, 2);
+ _as_script_node.connect(_as_audioctx.destination);
+ console.log(_as_script_node.bufferSize);
+
+ _as_script_node.onaudioprocess = function(audioProcessingEvent) {
+ // The output buffer contains the samples that will be modified and played
+ _as_output_buffer = audioProcessingEvent.outputBuffer;
+ audio_server_mix_function(_as_output_buffer.getChannelData(0).length);
+ }
+ }, buffer_latency);
+ /* clang-format on */
}
int AudioDriverJavaScript::get_mix_rate() const {
- return 44100;
+ return mix_rate;
}
AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const {
@@ -63,7 +133,7 @@ AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const {
void AudioDriverJavaScript::lock() {
- /*
+ /*no locking, as threads are not supported
if (active && mutex)
mutex->lock();
*/
@@ -71,7 +141,7 @@ void AudioDriverJavaScript::lock() {
void AudioDriverJavaScript::unlock() {
- /*
+ /*no locking, as threads are not supported
if (active && mutex)
mutex->unlock();
*/
@@ -81,4 +151,7 @@ void AudioDriverJavaScript::finish() {
}
AudioDriverJavaScript::AudioDriverJavaScript() {
+
+ mix_rate = 44100;
+ singleton_js = this;
}
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index c5cebe800f..c3adeca07b 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -35,7 +35,23 @@
#include "os/mutex.h"
class AudioDriverJavaScript : public AudioDriver {
+
+ enum {
+ INTERNAL_BUFFER_SIZE = 4096,
+ STREAM_SCALE_BITS = 12
+
+ };
+
+ int mix_rate;
+ float *internal_buffer;
+ int internal_buffer_channels;
+ int internal_buffer_size;
+ int32_t *stream_buffer;
+
public:
+ void mix_to_js(int p_frames);
+ static AudioDriverJavaScript *singleton_js;
+
virtual const char *get_name() const;
virtual Error init();
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 05adfeb0f5..420bb50af9 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -219,6 +219,9 @@ public:
virtual bool _check_internal_feature_support(const String &p_feature);
+ virtual void set_use_vsync(bool p_enable);
+ virtual bool is_vsync_enabled() const;
+
void run();
void set_mouse_mode(MouseMode p_mode);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 2c81a02014..e1a01d2b59 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1954,6 +1954,23 @@ Error OS_OSX::move_to_trash(const String &p_path) {
return OK;
}
+void OS_OSX::set_use_vsync(bool p_enable) {
+ CGLContextObj ctx = CGLGetCurrentContext();
+ if (ctx) {
+ GLint swapInterval = p_enable ? 1 : 0;
+ CGLSetParameter(ctx, kCGLCPSwapInterval, &swapInterval);
+ }
+}
+
+bool OS_OSX::is_vsync_enabled() const {
+ GLint swapInterval = 0;
+ CGLContextObj ctx = CGLGetCurrentContext();
+ if (ctx) {
+ CGLGetParameter(ctx, kCGLCPSwapInterval, &swapInterval);
+ }
+ return swapInterval ? true : false;
+}
+
OS_OSX *OS_OSX::singleton = NULL;
OS_OSX::OS_OSX() {
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 35f94bff59..c53241e985 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -452,7 +452,7 @@ String NavigationPolygonInstance::get_configuration_warning() const {
return String();
}
- c = Object::cast_to<Node2D>(get_parent());
+ c = Object::cast_to<Node2D>(c->get_parent());
}
return TTR("NavigationPolygonInstance must be a child or grandchild to a Navigation2D node. It only provides navigation data.");
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index fa656bdcd3..ff23b3183b 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -61,6 +61,21 @@ void RayCast2D::set_type_mask(uint32_t p_mask) {
type_mask = p_mask;
}
+void RayCast2D::set_collision_mask_bit(int p_bit, bool p_value) {
+
+ uint32_t mask = get_collision_mask();
+ if (p_value)
+ mask |= 1 << p_bit;
+ else
+ mask &= ~(1 << p_bit);
+ set_collision_mask(mask);
+}
+
+bool RayCast2D::get_collision_mask_bit(int p_bit) const {
+
+ return get_collision_mask() & (1 << p_bit);
+}
+
uint32_t RayCast2D::get_type_mask() const {
return type_mask;
@@ -279,6 +294,9 @@ void RayCast2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &RayCast2D::set_collision_mask);
ClassDB::bind_method(D_METHOD("get_collision_mask"), &RayCast2D::get_collision_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &RayCast2D::set_collision_mask_bit);
+ ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &RayCast2D::get_collision_mask_bit);
+
ClassDB::bind_method(D_METHOD("set_type_mask", "mask"), &RayCast2D::set_type_mask);
ClassDB::bind_method(D_METHOD("get_type_mask"), &RayCast2D::get_type_mask);
diff --git a/scene/2d/ray_cast_2d.h b/scene/2d/ray_cast_2d.h
index da1be84307..c13ddfdc58 100644
--- a/scene/2d/ray_cast_2d.h
+++ b/scene/2d/ray_cast_2d.h
@@ -64,6 +64,9 @@ public:
void set_collision_mask(uint32_t p_mask);
uint32_t get_collision_mask() const;
+ void set_collision_mask_bit(int p_bit, bool p_value);
+ bool get_collision_mask_bit(int p_bit) const;
+
void set_type_mask(uint32_t p_mask);
uint32_t get_type_mask() const;
diff --git a/scene/3d/SCsub b/scene/3d/SCsub
index 72739b527e..4008f4f196 100644
--- a/scene/3d/SCsub
+++ b/scene/3d/SCsub
@@ -7,6 +7,9 @@ if env['disable_3d']:
env.scene_sources.append("3d/spatial.cpp")
env.scene_sources.append("3d/skeleton.cpp")
+ env.scene_sources.append("3d/particles.cpp")
+ env.scene_sources.append("3d/visual_instance.cpp")
+ env.scene_sources.append("3d/scenario_fx.cpp")
else:
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index e994f4c79e..02d10523e7 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -369,12 +369,6 @@ DirectionalLight::DirectionalLight()
set_shadow_depth_range(SHADOW_DEPTH_RANGE_STABLE);
blend_splits = false;
-
-#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint())
- // Create light with a default natural "sun" orientation in editor, instead of looking horizontally on X
- set_rotation_in_degrees(Vector3(-50, 25, 30));
-#endif
}
void OmniLight::set_shadow_mode(ShadowMode p_mode) {
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index 296bddf0a3..9f61cc64ea 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -63,6 +63,21 @@ void RayCast::set_type_mask(uint32_t p_mask) {
type_mask = p_mask;
}
+void RayCast::set_collision_mask_bit(int p_bit, bool p_value) {
+
+ uint32_t mask = get_collision_mask();
+ if (p_value)
+ mask |= 1 << p_bit;
+ else
+ mask &= ~(1 << p_bit);
+ set_collision_mask(mask);
+}
+
+bool RayCast::get_collision_mask_bit(int p_bit) const {
+
+ return get_collision_mask() & (1 << p_bit);
+}
+
uint32_t RayCast::get_type_mask() const {
return type_mask;
@@ -248,6 +263,9 @@ void RayCast::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &RayCast::set_collision_mask);
ClassDB::bind_method(D_METHOD("get_collision_mask"), &RayCast::get_collision_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &RayCast::set_collision_mask_bit);
+ ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &RayCast::get_collision_mask_bit);
+
ClassDB::bind_method(D_METHOD("set_type_mask", "mask"), &RayCast::set_type_mask);
ClassDB::bind_method(D_METHOD("get_type_mask"), &RayCast::get_type_mask);
diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h
index cd3cf3c913..cac1596264 100644
--- a/scene/3d/ray_cast.h
+++ b/scene/3d/ray_cast.h
@@ -72,6 +72,9 @@ public:
void set_collision_mask(uint32_t p_mask);
uint32_t get_collision_mask() const;
+ void set_collision_mask_bit(int p_bit, bool p_value);
+ bool get_collision_mask_bit(int p_bit) const;
+
void set_type_mask(uint32_t p_mask);
uint32_t get_type_mask() const;
diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/nine_patch_rect.cpp
index 92c34dd3f9..c02d80bba8 100644
--- a/scene/gui/patch_9_rect.cpp
+++ b/scene/gui/nine_patch_rect.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* patch_9_rect.cpp */
+/* nine_patch_rect.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,7 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "patch_9_rect.h"
+#include "nine_patch_rect.h"
#include "servers/visual_server.h"
diff --git a/scene/gui/patch_9_rect.h b/scene/gui/nine_patch_rect.h
index 808b7a1f5d..809daf9db3 100644
--- a/scene/gui/patch_9_rect.h
+++ b/scene/gui/nine_patch_rect.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* patch_9_rect.h */
+/* nine_patch_rect.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,8 +27,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PATCH_9_FRAME_H
-#define PATCH_9_FRAME_H
+#ifndef NINE_PATCH_RECT_H
+#define NINE_PATCH_RECT_H
#include "scene/gui/control.h"
/**
@@ -81,4 +81,4 @@ public:
};
VARIANT_ENUM_CAST(NinePatchRect::AxisStretchMode)
-#endif // PATCH_9_FRAME_H
+#endif // NINE_PATCH_RECT_H
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 977ba2da7c..acf6d55eb5 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -734,7 +734,7 @@ void TextEdit::_notification(int p_what) {
if (str.length() == 0) {
// draw line background if empty as we won't loop at at all
- if (line == cursor.line) {
+ if (line == cursor.line && highlight_current_line) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_end, get_row_height()), cache.current_line_color);
}
@@ -965,7 +965,7 @@ void TextEdit::_notification(int p_what) {
//current line highlighting
bool in_selection = (selection.active && line >= selection.from_line && line <= selection.to_line && (line > selection.from_line || j >= selection.from_column) && (line < selection.to_line || j < selection.to_column));
- if (line == cursor.line) {
+ if (line == cursor.line && highlight_current_line) {
// if its the first char draw behind line numbers
if (j == 0) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, (char_ofs + char_margin), get_row_height()), cache.current_line_color);
@@ -4732,6 +4732,15 @@ int TextEdit::get_breakpoint_gutter_width() const {
return cache.breakpoint_gutter_width;
}
+void TextEdit::set_highlight_current_line(bool p_enabled) {
+ highlight_current_line = p_enabled;
+ update();
+}
+
+bool TextEdit::is_highlight_current_line_enabled() const {
+ return highlight_current_line;
+}
+
bool TextEdit::is_text_field() const {
return true;
@@ -4859,6 +4868,9 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_syntax_coloring", "enable"), &TextEdit::set_syntax_coloring);
ClassDB::bind_method(D_METHOD("is_syntax_coloring_enabled"), &TextEdit::is_syntax_coloring_enabled);
+ ClassDB::bind_method(D_METHOD("set_highlight_current_line", "enabled"), &TextEdit::set_highlight_current_line);
+ ClassDB::bind_method(D_METHOD("is_highlight_current_line_enabled"), &TextEdit::is_highlight_current_line_enabled);
+
ClassDB::bind_method(D_METHOD("set_smooth_scroll_enable", "enable"), &TextEdit::set_smooth_scroll_enabled);
ClassDB::bind_method(D_METHOD("is_smooth_scroll_enabled"), &TextEdit::is_smooth_scroll_enabled);
ClassDB::bind_method(D_METHOD("set_v_scroll_speed", "speed"), &TextEdit::set_v_scroll_speed);
@@ -4870,6 +4882,7 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("menu_option", "option"), &TextEdit::menu_option);
ClassDB::bind_method(D_METHOD("get_menu"), &TextEdit::get_menu);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_current_line"), "set_highlight_current_line", "is_highlight_current_line_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "syntax_highlighting"), "set_syntax_coloring", "is_syntax_coloring_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), "set_show_line_numbers", "is_show_line_numbers_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_all_occurrences"), "set_highlight_all_occurrences", "is_highlight_all_occurrences_enabled");
@@ -4991,6 +5004,7 @@ TextEdit::TextEdit() {
auto_brace_completion_enabled = false;
brace_matching_enabled = false;
highlight_all_occurrences = false;
+ highlight_current_line = false;
indent_using_spaces = false;
space_indent = " ";
auto_indent = false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 03f412729d..b4b14d0139 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -253,6 +253,7 @@ class TextEdit : public Control {
bool scroll_past_end_of_file_enabled;
bool auto_brace_completion_enabled;
bool brace_matching_enabled;
+ bool highlight_current_line;
bool auto_indent;
bool cut_copy_line;
bool insert_mode;
@@ -514,6 +515,9 @@ public:
void set_show_line_numbers(bool p_show);
bool is_show_line_numbers_enabled() const;
+ void set_highlight_current_line(bool p_enabled);
+ bool is_highlight_current_line_enabled() const;
+
void set_line_numbers_zero_padded(bool p_zero_padded);
void set_show_line_length_guideline(bool p_show);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 931dcfed91..5c6f2b0d01 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1126,7 +1126,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
if (p_item->cells[i].selected && select_mode != SELECT_ROW) {
- Rect2i r(item_rect.position, item_rect.size);
+ Rect2i r(cell_rect.position, cell_rect.size);
if (p_item->cells[i].text.size() > 0) {
float icon_width = p_item->cells[i].get_icon_size().width;
r.position.x += icon_width;
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 75268aad1f..4d3e2c709c 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -86,7 +86,7 @@
#include "scene/gui/option_button.h"
#include "scene/gui/panel.h"
#include "scene/gui/panel_container.h"
-#include "scene/gui/patch_9_rect.h"
+#include "scene/gui/nine_patch_rect.h"
#include "scene/gui/popup_menu.h"
#include "scene/gui/progress_bar.h"
#include "scene/gui/reference_rect.h"
@@ -152,6 +152,10 @@
#include "scene/resources/world_2d.h"
#include "scene/scene_string_names.h"
+#include "scene/3d/particles.h"
+#include "scene/3d/scenario_fx.h"
+#include "scene/3d/spatial.h"
+
#ifndef _3D_DISABLED
#include "scene/3d/area.h"
#include "scene/3d/arvr_nodes.h"
@@ -169,7 +173,6 @@
#include "scene/3d/multimesh_instance.h"
#include "scene/3d/navigation.h"
#include "scene/3d/navigation_mesh.h"
-#include "scene/3d/particles.h"
#include "scene/3d/path.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/physics_joint.h"
@@ -180,9 +183,7 @@
#include "scene/3d/reflection_probe.h"
#include "scene/3d/remote_transform.h"
#include "scene/3d/room_instance.h"
-#include "scene/3d/scenario_fx.h"
#include "scene/3d/skeleton.h"
-#include "scene/3d/spatial.h"
#include "scene/3d/sprite_3d.h"
#include "scene/3d/vehicle_body.h"
#include "scene/3d/visibility_notifier.h"
@@ -551,7 +552,9 @@ void register_scene_types() {
ClassDB::register_class<AudioStreamPlayer>();
ClassDB::register_class<AudioStreamPlayer2D>();
+#ifndef _3D_DISABLED
ClassDB::register_class<AudioStreamPlayer3D>();
+#endif
ClassDB::register_virtual_class<VideoStream>();
ClassDB::register_class<AudioStreamSample>();
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 910a2ad2fd..232f690074 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -1165,6 +1165,11 @@ void Environment::_bind_methods() {
BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_MEDIUM);
BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_HIGH);
+ BIND_ENUM_CONSTANT(SSAO_BLUR_DISABLED);
+ BIND_ENUM_CONSTANT(SSAO_BLUR_1x1);
+ BIND_ENUM_CONSTANT(SSAO_BLUR_2x2);
+ BIND_ENUM_CONSTANT(SSAO_BLUR_3x3);
+
BIND_ENUM_CONSTANT(SSAO_QUALITY_LOW);
BIND_ENUM_CONSTANT(SSAO_QUALITY_MEDIUM);
BIND_ENUM_CONSTANT(SSAO_QUALITY_HIGH);
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index b22a019319..12434b39fa 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -377,7 +377,7 @@ void SpatialMaterial::_update_shader() {
case DIFFUSE_TOON: code += ",diffuse_toon"; break;
}
switch (specular_mode) {
- case SPECULAR_GGX: code += ",specular_ggx"; break;
+ case SPECULAR_SCHLICK_GGX: code += ",specular_schlick_ggx"; break;
case SPECULAR_BLINN: code += ",specular_blinn"; break;
case SPECULAR_PHONG: code += ",specular_phong"; break;
case SPECULAR_TOON: code += ",specular_toon"; break;
@@ -1278,7 +1278,7 @@ void SpatialMaterial::_validate_property(PropertyInfo &property) const {
property.usage = 0;
}
- if (property.name == "proximity_fade_distacne" && !proximity_fade_enabled) {
+ if (property.name == "proximity_fade_distance" && !proximity_fade_enabled) {
property.usage = 0;
}
@@ -1819,7 +1819,7 @@ void SpatialMaterial::_bind_methods() {
ADD_GROUP("Parameters", "params_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Burley,Lambert,Lambert Wrap,Oren Nayar,Toon"), "set_diffuse_mode", "get_diffuse_mode");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "params_specular_mode", PROPERTY_HINT_ENUM, "GGX,Blinn,Phong,Toon,Disabled"), "set_specular_mode", "get_specular_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "params_specular_mode", PROPERTY_HINT_ENUM, "SchlickGGX,Blinn,Phong,Toon,Disabled"), "set_specular_mode", "get_specular_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul"), "set_blend_mode", "get_blend_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_cull_mode", PROPERTY_HINT_ENUM, "Back,Front,Disabled"), "set_cull_mode", "get_cull_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_depth_draw_mode", PROPERTY_HINT_ENUM, "Opaque Only,Always,Never,Opaque Pre-Pass"), "set_depth_draw_mode", "get_depth_draw_mode");
@@ -2006,7 +2006,7 @@ void SpatialMaterial::_bind_methods() {
BIND_ENUM_CONSTANT(DIFFUSE_OREN_NAYAR);
BIND_ENUM_CONSTANT(DIFFUSE_TOON);
- BIND_ENUM_CONSTANT(SPECULAR_GGX);
+ BIND_ENUM_CONSTANT(SPECULAR_SCHLICK_GGX);
BIND_ENUM_CONSTANT(SPECULAR_BLINN);
BIND_ENUM_CONSTANT(SPECULAR_PHONG);
BIND_ENUM_CONSTANT(SPECULAR_TOON);
@@ -2087,7 +2087,7 @@ SpatialMaterial::SpatialMaterial()
flags[i] = 0;
}
diffuse_mode = DIFFUSE_LAMBERT;
- specular_mode = SPECULAR_GGX;
+ specular_mode = SPECULAR_SCHLICK_GGX;
for (int i = 0; i < FEATURE_MAX; i++) {
features[i] = false;
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 942fb42363..2425f1a174 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -193,7 +193,7 @@ public:
};
enum SpecularMode {
- SPECULAR_GGX,
+ SPECULAR_SCHLICK_GGX,
SPECULAR_BLINN,
SPECULAR_PHONG,
SPECULAR_TOON,
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index bd8a67c0a3..7489ca7e3e 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -159,7 +159,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_burley");
shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_toon");
- shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_ggx");
+ shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_schlick_ggx");
shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_blinn");
shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_phong");
shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_toon");