diff options
116 files changed, 1654 insertions, 591 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) @@ -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/command_queue_mt.h b/core/command_queue_mt.h index f99e16da15..e37d593f9f 100644 --- a/core/command_queue_mt.h +++ b/core/command_queue_mt.h @@ -227,6 +227,27 @@ class CommandQueueMT { virtual void call() { (instance->*method)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } }; + template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class P11, class P12> + struct Command12 : public CommandBase { + + T *instance; + M method; + typename GetSimpleTypeT<P1>::type_t p1; + typename GetSimpleTypeT<P2>::type_t p2; + typename GetSimpleTypeT<P3>::type_t p3; + typename GetSimpleTypeT<P4>::type_t p4; + typename GetSimpleTypeT<P5>::type_t p5; + typename GetSimpleTypeT<P6>::type_t p6; + typename GetSimpleTypeT<P7>::type_t p7; + typename GetSimpleTypeT<P8>::type_t p8; + typename GetSimpleTypeT<P9>::type_t p9; + typename GetSimpleTypeT<P10>::type_t p10; + typename GetSimpleTypeT<P11>::type_t p11; + typename GetSimpleTypeT<P12>::type_t p12; + + virtual void call() { (instance->*method)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } + }; + /* comands that return */ template <class T, class M, class R> @@ -906,6 +927,31 @@ public: if (sync) sync->post(); } + template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class P11, class P12> + void push(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12) { + + Command12<T, M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> *cmd = allocate_and_lock<Command12<T, M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> >(); + + cmd->instance = p_instance; + cmd->method = p_method; + cmd->p1 = p1; + cmd->p2 = p2; + cmd->p3 = p3; + cmd->p4 = p4; + cmd->p5 = p5; + cmd->p6 = p6; + cmd->p7 = p7; + cmd->p8 = p8; + cmd->p9 = p9; + cmd->p10 = p10; + cmd->p11 = p11; + cmd->p12 = p12; + + unlock(); + + if (sync) sync->post(); + } + /*** PUSH AND RET COMMANDS ***/ template <class T, class M, class R> 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/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 0d509e6e51..20f323bb4f 100644 --- a/doc/classes/@Global Scope.xml +++ b/doc/classes/@Global Scope.xml @@ -30,6 +30,7 @@ [Geometry] singleton </member> <member name="GodotSharp" type="GodotSharp" setter="" getter=""> + [GodotSharp] singleton </member> <member name="IP" type="IP" setter="" getter=""> [IP] singleton @@ -41,6 +42,7 @@ [InputMap] singleton </member> <member name="JSON" type="JSON" setter="" getter=""> + [JSON] singleton </member> <member name="Marshalls" type="Reference" setter="" getter=""> [Marshalls] singleton @@ -144,8 +146,10 @@ Printscreen Key </constant> <constant name="KEY_SYSREQ" value="16777227"> + System Request Key </constant> <constant name="KEY_CLEAR" value="16777228"> + Clear Key </constant> <constant name="KEY_HOME" value="16777229"> Home Key @@ -178,6 +182,7 @@ Control Key </constant> <constant name="KEY_META" value="16777239"> + Meta Key </constant> <constant name="KEY_ALT" value="16777240"> Alt Key @@ -285,24 +290,28 @@ Number 9 on Numpad </constant> <constant name="KEY_SUPER_L" value="16777260"> - Super Left key (windows key) + Left Super Key (Windows Key) </constant> <constant name="KEY_SUPER_R" value="16777261"> - Super Left key (windows key) + Right Super Key (Windows Key) </constant> <constant name="KEY_MENU" value="16777262"> Context menu key </constant> <constant name="KEY_HYPER_L" value="16777263"> + Left Hyper Key </constant> <constant name="KEY_HYPER_R" value="16777264"> + Right Hyper Key </constant> <constant name="KEY_HELP" value="16777265"> Help key </constant> <constant name="KEY_DIRECTION_L" value="16777266"> + Left Direction Key </constant> <constant name="KEY_DIRECTION_R" value="16777267"> + Right Direction Key </constant> <constant name="KEY_BACK" value="16777280"> Back key @@ -326,14 +335,19 @@ Volume up key </constant> <constant name="KEY_BASSBOOST" value="16777287"> + Bass Boost Key </constant> <constant name="KEY_BASSUP" value="16777288"> + Bass Up Key </constant> <constant name="KEY_BASSDOWN" value="16777289"> + Bass Down Key </constant> <constant name="KEY_TREBLEUP" value="16777290"> + Treble Up Key </constant> <constant name="KEY_TREBLEDOWN" value="16777291"> + Treble Down Key </constant> <constant name="KEY_MEDIAPLAY" value="16777292"> Media play key @@ -360,46 +374,67 @@ Search key </constant> <constant name="KEY_STANDBY" value="16777300"> + Standby Key </constant> <constant name="KEY_OPENURL" value="16777301"> + Open URL / Launch Browser Key </constant> <constant name="KEY_LAUNCHMAIL" value="16777302"> + Launch Mail Key </constant> <constant name="KEY_LAUNCHMEDIA" value="16777303"> + Launch Media Key </constant> <constant name="KEY_LAUNCH0" value="16777304"> + Launch Shortcut 0 Key </constant> <constant name="KEY_LAUNCH1" value="16777305"> + Launch Shortcut 1 Key </constant> <constant name="KEY_LAUNCH2" value="16777306"> + Launch Shortcut 2 Key </constant> <constant name="KEY_LAUNCH3" value="16777307"> + Launch Shortcut 3 Key </constant> <constant name="KEY_LAUNCH4" value="16777308"> + Launch Shortcut 4 Key </constant> <constant name="KEY_LAUNCH5" value="16777309"> + Launch Shortcut 5 Key </constant> <constant name="KEY_LAUNCH6" value="16777310"> + Launch Shortcut 6 Key </constant> <constant name="KEY_LAUNCH7" value="16777311"> + Launch Shortcut 7 Key </constant> <constant name="KEY_LAUNCH8" value="16777312"> + Launch Shortcut 8 Key </constant> <constant name="KEY_LAUNCH9" value="16777313"> + Launch Shortcut 9 Key </constant> <constant name="KEY_LAUNCHA" value="16777314"> + Launch Shortcut A Key </constant> <constant name="KEY_LAUNCHB" value="16777315"> + Launch Shortcut B Key </constant> <constant name="KEY_LAUNCHC" value="16777316"> + Launch Shortcut C Key </constant> <constant name="KEY_LAUNCHD" value="16777317"> + Launch Shortcut D Key </constant> <constant name="KEY_LAUNCHE" value="16777318"> + Launch Shortcut E Key </constant> <constant name="KEY_LAUNCHF" value="16777319"> + Launch Shortcut F Key </constant> <constant name="KEY_UNKNOWN" value="33554431"> + Unknown Key </constant> <constant name="KEY_SPACE" value="32"> Space Key @@ -594,6 +629,7 @@ _ key </constant> <constant name="KEY_QUOTELEFT" value="96"> + Left Quote Key </constant> <constant name="KEY_BRACELEFT" value="123"> { key @@ -619,6 +655,7 @@ <constant name="KEY_CURRENCY" value="164"> </constant> <constant name="KEY_YEN" value="165"> + Yen Key </constant> <constant name="KEY_BROKENBAR" value="166"> ¦ key @@ -647,6 +684,7 @@ ® key </constant> <constant name="KEY_MACRON" value="175"> + Macron Key </constant> <constant name="KEY_DEGREE" value="176"> ° key @@ -667,6 +705,7 @@ µ key </constant> <constant name="KEY_PARAGRAPH" value="182"> + Paragraph Key </constant> <constant name="KEY_PERIODCENTERED" value="183"> · key @@ -675,377 +714,475 @@ ¬ key </constant> <constant name="KEY_ONESUPERIOR" value="185"> + ¹ key </constant> <constant name="KEY_MASCULINE" value="186"> + ♂ key </constant> <constant name="KEY_GUILLEMOTRIGHT" value="187"> + » key </constant> <constant name="KEY_ONEQUARTER" value="188"> + ¼ key </constant> <constant name="KEY_ONEHALF" value="189"> ½ key </constant> <constant name="KEY_THREEQUARTERS" value="190"> + ¾ key </constant> <constant name="KEY_QUESTIONDOWN" value="191"> + ¿ key </constant> <constant name="KEY_AGRAVE" value="192"> + à key </constant> <constant name="KEY_AACUTE" value="193"> + á key </constant> <constant name="KEY_ACIRCUMFLEX" value="194"> + â key </constant> <constant name="KEY_ATILDE" value="195"> + ã key </constant> <constant name="KEY_ADIAERESIS" value="196"> + ä key </constant> <constant name="KEY_ARING" value="197"> + å key </constant> <constant name="KEY_AE" value="198"> + æ key </constant> <constant name="KEY_CCEDILLA" value="199"> + ç key </constant> <constant name="KEY_EGRAVE" value="200"> + è key </constant> <constant name="KEY_EACUTE" value="201"> + é key </constant> <constant name="KEY_ECIRCUMFLEX" value="202"> + ê key </constant> <constant name="KEY_EDIAERESIS" value="203"> + ë key </constant> <constant name="KEY_IGRAVE" value="204"> + ì key </constant> <constant name="KEY_IACUTE" value="205"> + í key </constant> <constant name="KEY_ICIRCUMFLEX" value="206"> + î key </constant> <constant name="KEY_IDIAERESIS" value="207"> + ë key </constant> <constant name="KEY_ETH" value="208"> + ð key </constant> <constant name="KEY_NTILDE" value="209"> + ñ key </constant> <constant name="KEY_OGRAVE" value="210"> + ò key </constant> <constant name="KEY_OACUTE" value="211"> + ó key </constant> <constant name="KEY_OCIRCUMFLEX" value="212"> + ô key </constant> <constant name="KEY_OTILDE" value="213"> + õ key </constant> <constant name="KEY_ODIAERESIS" value="214"> + ö key </constant> <constant name="KEY_MULTIPLY" value="215"> + × key </constant> <constant name="KEY_OOBLIQUE" value="216"> + ø key </constant> <constant name="KEY_UGRAVE" value="217"> + ù key </constant> <constant name="KEY_UACUTE" value="218"> + ú key </constant> <constant name="KEY_UCIRCUMFLEX" value="219"> + û key </constant> <constant name="KEY_UDIAERESIS" value="220"> + ü key </constant> <constant name="KEY_YACUTE" value="221"> + ý key </constant> <constant name="KEY_THORN" value="222"> + þ key </constant> <constant name="KEY_SSHARP" value="223"> + ß key </constant> <constant name="KEY_DIVISION" value="247"> + ÷ key </constant> <constant name="KEY_YDIAERESIS" value="255"> + ÿ key </constant> <constant name="KEY_CODE_MASK" value="33554431"> + Key Code Mask </constant> <constant name="KEY_MODIFIER_MASK" value="-16777216"> + Modifier Key Mask </constant> <constant name="KEY_MASK_SHIFT" value="33554432"> + Shift Key Mask </constant> <constant name="KEY_MASK_ALT" value="67108864"> + Alt Key Mask </constant> <constant name="KEY_MASK_META" value="134217728"> + Meta Key Mask </constant> <constant name="KEY_MASK_CTRL" value="268435456"> + CTRL Key Mask </constant> <constant name="KEY_MASK_CMD" value="268435456"> + CMD Key Mask </constant> <constant name="KEY_MASK_KPAD" value="536870912"> + Keypad Key Mask </constant> <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"> - Functions that return Error return OK when everything went ok. Most functions don't return error anyway and/or just print errors to stdout. + Functions that return Error return OK when no error occured. Most functions don't return errors and/or just print errors to STDOUT. </constant> <constant name="FAILED" value="1"> - Generic fail return error. + Generic error. </constant> <constant name="ERR_UNAVAILABLE" value="2"> + Unavailable error </constant> <constant name="ERR_UNCONFIGURED" value="3"> + Unconfigured error </constant> <constant name="ERR_UNAUTHORIZED" value="4"> + Unauthorized error </constant> <constant name="ERR_PARAMETER_RANGE_ERROR" value="5"> + Parameter range error </constant> <constant name="ERR_OUT_OF_MEMORY" value="6"> + Out of memory (OOM) error </constant> <constant name="ERR_FILE_NOT_FOUND" value="7"> + File: Not found error </constant> <constant name="ERR_FILE_BAD_DRIVE" value="8"> + File: Bad drive error </constant> <constant name="ERR_FILE_BAD_PATH" value="9"> + File: Bad path error </constant> <constant name="ERR_FILE_NO_PERMISSION" value="10"> + File: No permission error </constant> <constant name="ERR_FILE_ALREADY_IN_USE" value="11"> + File: Already in use error </constant> <constant name="ERR_FILE_CANT_OPEN" value="12"> + File: Can't open error </constant> <constant name="ERR_FILE_CANT_WRITE" value="13"> + File: Can't write error </constant> <constant name="ERR_FILE_CANT_READ" value="14"> + File: Can't read error </constant> <constant name="ERR_FILE_UNRECOGNIZED" value="15"> + File: Unrecognized error </constant> <constant name="ERR_FILE_CORRUPT" value="16"> + File: Corrupt error </constant> <constant name="ERR_FILE_MISSING_DEPENDENCIES" value="17"> + File: Missing dependencies error </constant> <constant name="ERR_FILE_EOF" value="18"> + File: End of file (EOF) error </constant> <constant name="ERR_CANT_OPEN" value="19"> + Can't open error </constant> <constant name="ERR_CANT_CREATE" value="20"> + Can't create error </constant> <constant name="ERR_PARSE_ERROR" value="43"> + Parse error </constant> <constant name="ERR_QUERY_FAILED" value="21"> + Query failed error </constant> <constant name="ERR_ALREADY_IN_USE" value="22"> + Already in use error </constant> <constant name="ERR_LOCKED" value="23"> + Locked error </constant> <constant name="ERR_TIMEOUT" value="24"> + Timeout error </constant> <constant name="ERR_CANT_ACQUIRE_RESOURCE" value="28"> + Can't acquire resource error </constant> <constant name="ERR_INVALID_DATA" value="30"> + Invalid data error </constant> <constant name="ERR_INVALID_PARAMETER" value="31"> + Invalid parameter error </constant> <constant name="ERR_ALREADY_EXISTS" value="32"> + Already exists error </constant> <constant name="ERR_DOES_NOT_EXIST" value="33"> + Does not exist error </constant> <constant name="ERR_DATABASE_CANT_READ" value="34"> + Database: Read error </constant> <constant name="ERR_DATABASE_CANT_WRITE" value="35"> + Database: Write error </constant> <constant name="ERR_COMPILATION_FAILED" value="36"> + Compilation failed error </constant> <constant name="ERR_METHOD_NOT_FOUND" value="37"> + Method not found error </constant> <constant name="ERR_LINK_FAILED" value="38"> + Linking failed error </constant> <constant name="ERR_SCRIPT_FAILED" value="39"> + Script failed error </constant> <constant name="ERR_CYCLIC_LINK" value="40"> + Cycling link (import cycle) error </constant> <constant name="ERR_BUSY" value="44"> + Busy error </constant> <constant name="ERR_HELP" value="46"> + Help error </constant> <constant name="ERR_BUG" value="47"> + Bug error </constant> <constant name="ERR_WTF" value="49"> + WTF error (something probably went really wrong) </constant> <constant name="PROPERTY_HINT_NONE" value="0"> No hint for edited property. @@ -1094,8 +1231,10 @@ <constant name="PROPERTY_HINT_COLOR_NO_ALPHA" value="19"> </constant> <constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSY" value="20"> + Hints that the image is compressed using lossy compression. </constant> <constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS" value="21"> + Hints that the image is compressed using lossless compression. </constant> <constant name="PROPERTY_USAGE_STORAGE" value="1"> Property will be used as storage (default). @@ -1135,20 +1274,26 @@ <constant name="PROPERTY_USAGE_NOEDITOR" value="5"> </constant> <constant name="METHOD_FLAG_NORMAL" value="1"> + Flag for normal method </constant> <constant name="METHOD_FLAG_EDITOR" value="2"> + Flag for editor method </constant> <constant name="METHOD_FLAG_NOSCRIPT" value="4"> </constant> <constant name="METHOD_FLAG_CONST" value="8"> + Flag for constant method </constant> <constant name="METHOD_FLAG_REVERSE" value="16"> </constant> <constant name="METHOD_FLAG_VIRTUAL" value="32"> + Flag for virtual method </constant> <constant name="METHOD_FLAG_FROM_SCRIPT" value="64"> + Flag for method from script </constant> <constant name="METHOD_FLAGS_DEFAULT" value="1"> + Default method flags </constant> <constant name="TYPE_NIL" value="0"> Variable is of type nil (only applied for null). @@ -1232,6 +1377,7 @@ Variable is of type [PoolColorArray]. </constant> <constant name="TYPE_MAX" value="27"> + Marker for end of type constants. </constant> </constants> </class> diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml index 6e11034073..ecd882cdb0 100644 --- a/doc/classes/ARVRAnchor.xml +++ b/doc/classes/ARVRAnchor.xml @@ -60,6 +60,7 @@ </methods> <members> <member name="anchor_id" type="int" setter="set_anchor_id" getter="get_anchor_id"> + The anchor's id. You can set this before the anchor itself exists. The first anchor gets an id of [code]1[/code], the second an id of [code]2[/code], etc. When anchors get removed, the engine can then assign the corresponding id to new anchors. The most common situation where anchors 'disappear' is when the AR server identifies that two anchors represent different parts of the same plane and merges them. </member> </members> <constants> diff --git a/doc/classes/ARVRController.xml b/doc/classes/ARVRController.xml index 557f915c1d..af1deda2f0 100644 --- a/doc/classes/ARVRController.xml +++ b/doc/classes/ARVRController.xml @@ -31,6 +31,7 @@ <return type="int" enum="ARVRPositionalTracker.TrackerHand"> </return> <description> + Returns the hand holding this controller, if known. See TRACKER_* constants in [ARVRPositionalTracker]. </description> </method> <method name="get_is_active" qualifiers="const"> @@ -77,6 +78,7 @@ </methods> <members> <member name="controller_id" type="int" setter="set_controller_id" getter="get_controller_id"> + The controller's id. The first controller that the [ARVRServer] detects will have id 1, the second id 2, the third id 3, etc. When a controller is turned off, it's slot is freed. This ensures controllers will keep the same id even when controllers with lower ids are turned off. </member> </members> <signals> diff --git a/doc/classes/ARVROrigin.xml b/doc/classes/ARVROrigin.xml index 28864bb3ae..226a69dea4 100644 --- a/doc/classes/ARVROrigin.xml +++ b/doc/classes/ARVROrigin.xml @@ -35,6 +35,8 @@ </methods> <members> <member name="world_scale" type="float" setter="set_world_scale" getter="get_world_scale"> + Allows you to adjust the scale to your game's units. Most AR/VR platforms assume a scale of 1 game world unit = 1 meter in the real world. + Note that this method is a passthrough to the [ARVRServer] itself. </member> </members> <constants> diff --git a/doc/classes/ARVRPositionalTracker.xml b/doc/classes/ARVRPositionalTracker.xml index 1379677344..686ac1db77 100644 --- a/doc/classes/ARVRPositionalTracker.xml +++ b/doc/classes/ARVRPositionalTracker.xml @@ -17,6 +17,7 @@ <return type="int" enum="ARVRPositionalTracker.TrackerHand"> </return> <description> + Returns the hand holding this tracker, if known. See TRACKER_* constants. </description> </method> <method name="get_joy_id" qualifiers="const"> @@ -80,10 +81,13 @@ </methods> <constants> <constant name="TRACKER_HAND_UNKNOWN" value="0"> + The hand this tracker is held in is unknown or not applicable. </constant> <constant name="TRACKER_LEFT_HAND" value="1"> + This tracker is the left hand controller. </constant> <constant name="TRACKER_RIGHT_HAND" value="2"> + This tracker is the right hand controller. </constant> </constants> </class> diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml index 0693851203..bb7ac2c052 100644 --- a/doc/classes/ARVRServer.xml +++ b/doc/classes/ARVRServer.xml @@ -121,6 +121,7 @@ </methods> <members> <member name="world_scale" type="float" setter="set_world_scale" getter="get_world_scale"> + Allows you to adjust the scale to your game's units. Most AR/VR platforms assume a scale of 1 game world unit = 1 meter in the real world. </member> </members> <signals> 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/Curve2D.xml b/doc/classes/Curve2D.xml index 4362887be3..99ec2b7d94 100644 --- a/doc/classes/Curve2D.xml +++ b/doc/classes/Curve2D.xml @@ -32,6 +32,7 @@ <return type="void"> </return> <description> + Removes all points from the curve. </description> </method> <method name="get_bake_interval" qualifiers="const"> @@ -191,8 +192,10 @@ </methods> <members> <member name="_data" type="Dictionary" setter="_set_data" getter="_get_data"> + The points describing the curve. Value is a [Dictionary] with the keys [code]in[/code], [code]out[/code], and [code]pos[/code]. The key pos is the position of a vertex of the curve, the key in is the vector from that position to the control point before this vertex, the key out is the vector from that position to the controlpoint after this vertex. </member> <member name="bake_interval" type="float" setter="set_bake_interval" getter="get_bake_interval"> + The distance in pixels between two adjacent cached points. Changing it forces the cache to be recomputed the next time the [method get_baked_points] or [method get_baked_length] function is called. The smaller the distance, the more points in the cache and the more memory it will consume, so use with care. </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/EditorScript.xml b/doc/classes/EditorScript.xml index 8856e3362a..245dbc078d 100644 --- a/doc/classes/EditorScript.xml +++ b/doc/classes/EditorScript.xml @@ -11,9 +11,9 @@ extends EditorScript func _run(): - print("Hello from the Godot Editor!") + print("Hello from the Godot Editor!") [/codeblock] - Note that the script is run in the Editor context, which means the output is visible in the console window started with the Editor (STDOUT) instead of the usual Godot *Output* dock. + Note that the script is run in the Editor context, which means the output is visible in the console window started with the Editor (STDOUT) instead of the usual Godot [i]Output[/i] dock. </description> <tutorials> </tutorials> 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/Node2D.xml b/doc/classes/Node2D.xml index 084bee92df..b00020b227 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -26,7 +26,7 @@ <argument index="0" name="pivot" type="Vector2"> </argument> <description> - Set the pivot position of the 2D node to 'pivot' value. Only some Node2Ds implement this method. + Sets the node's pivot position. </description> </method> <method name="get_angle_to" qualifiers="const"> @@ -143,7 +143,7 @@ <argument index="1" name="scaled" type="bool" default="false"> </argument> <description> - Apply a local translation on the node's X axis based on the process's 'delta'. If 'scaled' is false, normalizes the movement. + Applies a local translation on the node's X axis based on the [method Node._process]'s [code]delta[/code]. If [code]scaled[/code] is false, normalizes the movement. </description> </method> <method name="move_local_y"> @@ -154,7 +154,7 @@ <argument index="1" name="scaled" type="bool" default="false"> </argument> <description> - Apply a local translation on the node's Y axis based on the process's 'delta'. If 'scaled' is false, normalizes the movement. + Applies a local translation on the node's Y axis based on the [method Node._process]'s [code]delta[/code]. If [code]scaled[/code] is false, normalizes the movement. </description> </method> <method name="rotate"> @@ -163,7 +163,7 @@ <argument index="0" name="radians" type="float"> </argument> <description> - Apply a rotation to the node, in radians, starting from its current rotation. + Applies a rotation to the node, in radians, starting from its current rotation. </description> </method> <method name="set_global_position"> @@ -172,7 +172,7 @@ <argument index="0" name="position" type="Vector2"> </argument> <description> - Set the node's global position. + Sets the node's global position. </description> </method> <method name="set_global_rotation"> @@ -181,7 +181,7 @@ <argument index="0" name="radians" type="float"> </argument> <description> - Set the node's global rotation in radians. + Sets the node's global rotation in radians. </description> </method> <method name="set_global_rotation_in_degrees"> @@ -190,7 +190,7 @@ <argument index="0" name="degrees" type="float"> </argument> <description> - Set the node's global rotation in degrees. + Sets the node's global rotation in degrees. </description> </method> <method name="set_global_scale"> @@ -199,7 +199,7 @@ <argument index="0" name="scale" type="Vector2"> </argument> <description> - Set the node's global scale. + Sets the node's global scale. </description> </method> <method name="set_global_transform"> @@ -208,7 +208,7 @@ <argument index="0" name="xform" type="Transform2D"> </argument> <description> - Set the node's global [Transform2D]. + Sets the node's global [Transform2D]. </description> </method> <method name="set_position"> @@ -217,7 +217,7 @@ <argument index="0" name="position" type="Vector2"> </argument> <description> - Set the node's position. + Sets the node's position. </description> </method> <method name="set_rotation"> @@ -226,7 +226,7 @@ <argument index="0" name="radians" type="float"> </argument> <description> - Set the node's rotation in radians. + Sets the node's rotation in radians. </description> </method> <method name="set_rotation_in_degrees"> @@ -235,7 +235,7 @@ <argument index="0" name="degrees" type="float"> </argument> <description> - Set the node's rotation in degrees. + Sets the node's rotation in degrees. </description> </method> <method name="set_scale"> @@ -244,7 +244,7 @@ <argument index="0" name="scale" type="Vector2"> </argument> <description> - Set the node's scale. + Sets the node's scale. </description> </method> <method name="set_transform"> @@ -253,7 +253,7 @@ <argument index="0" name="xform" type="Transform2D"> </argument> <description> - Set the node's local [Transform2D]. + Sets the node's local [Transform2D]. </description> </method> <method name="set_z"> @@ -262,7 +262,7 @@ <argument index="0" name="z" type="int"> </argument> <description> - Set the node's Z-index. + Sets the node's Z-index. </description> </method> <method name="set_z_as_relative"> @@ -271,7 +271,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Make the node's Z-index relative to its parent's Z-index. If this node's Z-index is 2 and its parent's effective Z-index is 3, then this node's effective Z-index will be 2 + 3 = 5. + Makes the node's Z-index relative to its parent's Z-index. If this node's Z-index is 2 and its parent's effective Z-index is 3, then this node's effective Z-index will be 2 + 3 = 5. </description> </method> <method name="to_global" qualifiers="const"> @@ -280,6 +280,7 @@ <argument index="0" name="local_point" type="Vector2"> </argument> <description> + Converts a local point's coordinates to global coordinates. </description> </method> <method name="to_local" qualifiers="const"> @@ -288,6 +289,7 @@ <argument index="0" name="global_point" type="Vector2"> </argument> <description> + Converts a global point's coordinates to local coordinates. </description> </method> <method name="translate"> @@ -296,7 +298,7 @@ <argument index="0" name="offset" type="Vector2"> </argument> <description> - Translate the node locally by the 'offset' vector, starting from its current local position. + Translates the node by the given [code]offset[/code] in local coordinates. </description> </method> </methods> diff --git a/doc/classes/ParallaxBackground.xml b/doc/classes/ParallaxBackground.xml index a7d616129a..21b6150900 100644 --- a/doc/classes/ParallaxBackground.xml +++ b/doc/classes/ParallaxBackground.xml @@ -4,7 +4,7 @@ A node used to create a parallax scrolling background. </brief_description> <description> - A ParallaxBackground will use one or more [ParallaxLayer] nodes to create a parallax scrolling background. Each [ParallaxLayer] can be set to move at different speeds relative to the camera movement, this can be used to create an illusion of depth in a 2D game. + A ParallaxBackground uses one or more [ParallaxLayer] child nodes to create a parallax effect. Each [ParallaxLayer] can move at a different speed using [member ParallaxLayer.motion_offset]. This creates an illusion of depth in a 2D game. If not used with a [Camera2D], you must manually calculate the [member scroll_offset]. </description> <tutorials> </tutorials> @@ -108,16 +108,22 @@ </methods> <members> <member name="scroll_base_offset" type="Vector2" setter="set_scroll_base_offset" getter="get_scroll_base_offset"> + Base position offset of all [ParallaxLayer] children. </member> <member name="scroll_base_scale" type="Vector2" setter="set_scroll_base_scale" getter="get_scroll_base_scale"> + Base motion scale of all [ParallaxLayer] children. </member> <member name="scroll_ignore_camera_zoom" type="bool" setter="set_ignore_camera_zoom" getter="is_ignore_camera_zoom"> + If [code]true[/code] elements in [ParallaxLayer] child aren't affected by the zoom level of the camera. </member> <member name="scroll_limit_begin" type="Vector2" setter="set_limit_begin" getter="get_limit_begin"> + Top left limits for scrolling to begin. If the camera is outside of this limit the background will stop scrolling. Must be lower than [member scroll_limit_end] to work. </member> <member name="scroll_limit_end" type="Vector2" setter="set_limit_end" getter="get_limit_end"> + Right bottom limits for scrolling to end. If the camera is outside of this limit the background will stop scrolling. Must be higher than [member scroll_limit_begin] to work. </member> <member name="scroll_offset" type="Vector2" setter="set_scroll_offset" getter="get_scroll_offset"> + The ParallaxBackground's scroll value. Calculated automatically when using a [Camera2D], but can be used to manually manage scrolling when no camera is present. </member> </members> <constants> diff --git a/doc/classes/ParallaxLayer.xml b/doc/classes/ParallaxLayer.xml index 6cf5549c8f..f1e6f9e046 100644 --- a/doc/classes/ParallaxLayer.xml +++ b/doc/classes/ParallaxLayer.xml @@ -4,7 +4,8 @@ A parallax scrolling layer to be used with [ParallaxBackground]. </brief_description> <description> - A ParallaxLayer must be the child of a [ParallaxBackground] node. All child nodes will be affected by the parallax scrolling of this layer. + A ParallaxLayer must be the child of a [ParallaxBackground] node. Each ParallaxLayer can be set to move at different speeds relative to the camera movement or the [member ParallaxBackground.scroll_offset] value. + This node's children will be affected by its scroll offset. </description> <tutorials> </tutorials> @@ -60,10 +61,13 @@ </methods> <members> <member name="motion_mirroring" type="Vector2" setter="set_mirroring" getter="get_mirroring"> + 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]. </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. </member> </members> <constants> diff --git a/doc/classes/Path2D.xml b/doc/classes/Path2D.xml index 839e617375..722e0c1240 100644 --- a/doc/classes/Path2D.xml +++ b/doc/classes/Path2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Path2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Container for a [Curve2D]. + Contains a [Curve2D] path for [PathFollow2D] nodes to follow. </brief_description> <description> - This class is a container/Node-ification of a [Curve2D], so it can have [Node2D] properties and [Node] info. + Can have [PathFollow2D] child-nodes moving along the [Curve2D]. See [PathFollow2D] for more information on this usage. </description> <tutorials> </tutorials> @@ -30,6 +30,7 @@ </methods> <members> <member name="curve" type="Curve2D" setter="set_curve" getter="get_curve"> + A [Curve2D] describing the path. </member> </members> <constants> diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml index f07e143aa0..056d7d10fa 100644 --- a/doc/classes/Quat.xml +++ b/doc/classes/Quat.xml @@ -4,7 +4,10 @@ Quaternion. </brief_description> <description> - Quaternion is a 4 dimensional vector that is used to represent a rotation. It mainly exists to perform SLERP (spherical-linear interpolation) between two rotations. Multiplying quaternions also cheaply reproduces rotation sequences. However quaternions need to be often renormalized, or else they suffer from precision issues. + A 4-dimensional vector representing a rotation. + The vector represents a 4 dimensional complex number where multiplication of the basis elements is not commutative (multiplying i with j gives a different result than multiplying j with i). + Multiplying quaternions reproduces rotation sequences. However quaternions need to be often renormalized, or else they suffer from precision issues. + It can be used to perform SLERP (spherical-linear interpolation) between two rotations. </description> <tutorials> </tutorials> @@ -23,6 +26,7 @@ <argument index="3" name="w" type="float"> </argument> <description> + Returns a quaternion defined by these values. </description> </method> <method name="Quat"> @@ -57,6 +61,7 @@ <argument index="3" name="t" type="float"> </argument> <description> + Performs a cubic spherical-linear interpolation with another quaternion. </description> </method> <method name="dot"> @@ -111,7 +116,7 @@ <argument index="1" name="t" type="float"> </argument> <description> - Perform a spherical-linear interpolation with another quaternion. + Performs a spherical-linear interpolation with another quaternion. </description> </method> <method name="slerpni"> @@ -122,6 +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°. </description> </method> <method name="xform"> @@ -130,17 +136,22 @@ <argument index="0" name="v" type="Vector3"> </argument> <description> + Transforms the vector [code]v[/code] by this quaternion. </description> </method> </methods> <members> <member name="w" type="float" setter="" getter=""> + W component of the quaternion. Default value: [code]1[/code] </member> <member name="x" type="float" setter="" getter=""> + X component of the quaternion. Default value: [code]0[/code] </member> <member name="y" type="float" setter="" getter=""> + Y component of the quaternion. Default value: [code]0[/code] </member> <member name="z" type="float" setter="" getter=""> + Z component of the quaternion. Default value: [code]0[/code] </member> </members> <constants> 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/Rect2.xml b/doc/classes/Rect2.xml index 13b786908e..5af8c82a7b 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -4,7 +4,7 @@ 2D Axis-aligned bounding box. </brief_description> <description> - Rect2 provides an 2D Axis-Aligned Bounding Box. It consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. </description> <tutorials> </tutorials> @@ -19,7 +19,7 @@ <argument index="1" name="size" type="Vector2"> </argument> <description> - Construct a [code]Rect2[/code] by position and size. + Constructs a [code]Rect2[/code] by position and size. </description> </method> <method name="Rect2"> @@ -34,7 +34,7 @@ <argument index="3" name="height" type="float"> </argument> <description> - Construct a [code]Rect2[/code] by x, y, width and height. + Constructs a [code]Rect2[/code] by x, y, width, and height. </description> </method> <method name="clip"> @@ -52,7 +52,7 @@ <argument index="0" name="b" type="Rect2"> </argument> <description> - Returns true if this [code]Rect2[/code] completely encloses another one. + Returns [code]true[/code] if this [code]Rect2[/code] completely encloses another one. </description> </method> <method name="expand"> @@ -61,14 +61,14 @@ <argument index="0" name="to" type="Vector2"> </argument> <description> - Return this [code]Rect2[/code] expanded to include a given point. + Returns this [code]Rect2[/code] expanded to include a given point. </description> </method> <method name="get_area"> <return type="float"> </return> <description> - Get the area of the [code]Rect2[/code]. + Returns the area of the [code]Rect2[/code]. </description> </method> <method name="grow"> @@ -77,7 +77,7 @@ <argument index="0" name="by" type="float"> </argument> <description> - Return a copy of the [code]Rect2[/code] grown a given amount of units towards all the sides. + Returns a copy of the [code]Rect2[/code] grown a given amount of units towards all the sides. </description> </method> <method name="grow_individual"> @@ -92,6 +92,7 @@ <argument index="3" name=" bottom" type="float"> </argument> <description> + Returns a copy of the [code]Rect2[/code] grown a given amount of units towards each direction individually. </description> </method> <method name="grow_margin"> @@ -102,13 +103,14 @@ <argument index="1" name="by" type="float"> </argument> <description> + Returns a copy of the [code]Rect2[/code] grown a given amount of units towards the [Margin] direction. </description> </method> <method name="has_no_area"> <return type="bool"> </return> <description> - Return true if the [code]Rect2[/code] is flat or empty. + Returns [code]true[/code] if the [code]Rect2[/code] is flat or empty. </description> </method> <method name="has_point"> @@ -117,7 +119,7 @@ <argument index="0" name="point" type="Vector2"> </argument> <description> - Return true if the [code]Rect2[/code] contains a point. + Returns [code]true[/code] if the [code]Rect2[/code] contains a point. </description> </method> <method name="intersects"> @@ -126,7 +128,7 @@ <argument index="0" name="b" type="Rect2"> </argument> <description> - Return true if the [code]Rect2[/code] overlaps with another. + Returns [code]true[/code] if the [code]Rect2[/code] overlaps with another. </description> </method> <method name="merge"> @@ -135,7 +137,7 @@ <argument index="0" name="b" type="Rect2"> </argument> <description> - Combine this [code]Rect2[/code] with another, a larger one is returned that contains both. + Returns a larger Rect2 that contains this Rect2 and [code]with[/code]. </description> </method> </methods> diff --git a/doc/classes/Rect3.xml b/doc/classes/Rect3.xml index 7adf4377aa..a56dac57c7 100644 --- a/doc/classes/Rect3.xml +++ b/doc/classes/Rect3.xml @@ -4,7 +4,7 @@ Axis-Aligned Bounding Box. </brief_description> <description> - Rect3 provides an 3D Axis-Aligned Bounding Box. It consists of a position, a size, and several utility functions. It is typically used for simple (fast) overlap tests. + Rect3 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. </description> <tutorials> </tutorials> @@ -28,7 +28,7 @@ <argument index="0" name="with" type="Rect3"> </argument> <description> - Return true if this [code]Rect3[/code] completely encloses another one. + Returns [code]true[/code] if this [code]Rect3[/code] completely encloses another one. </description> </method> <method name="expand"> @@ -37,14 +37,14 @@ <argument index="0" name="to_point" type="Vector3"> </argument> <description> - Return this [code]Rect3[/code] expanded to include a given point. + Returns this [code]Rect3[/code] expanded to include a given point. </description> </method> <method name="get_area"> <return type="float"> </return> <description> - Get the area of the [code]Rect3[/code]. + Gets the area of the [code]Rect3[/code]. </description> </method> <method name="get_endpoint"> @@ -53,49 +53,49 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Get the position of the 8 endpoints of the [code]Rect3[/code] in space. + Gets the position of the 8 endpoints of the [code]Rect3[/code] in space. </description> </method> <method name="get_longest_axis"> <return type="Vector3"> </return> <description> - Return the normalized longest axis of the [code]Rect3[/code]. + Returns the normalized longest axis of the [code]Rect3[/code]. </description> </method> <method name="get_longest_axis_index"> <return type="int"> </return> <description> - Return the index of the longest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). + Returns the index of the longest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). </description> </method> <method name="get_longest_axis_size"> <return type="float"> </return> <description> - Return the scalar length of the longest axis of the [code]Rect3[/code]. + Returns the scalar length of the longest axis of the [code]Rect3[/code]. </description> </method> <method name="get_shortest_axis"> <return type="Vector3"> </return> <description> - Return the normalized shortest axis of the [code]Rect3[/code]. + Returns the normalized shortest axis of the [code]Rect3[/code]. </description> </method> <method name="get_shortest_axis_index"> <return type="int"> </return> <description> - Return the index of the shortest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). + Returns the index of the shortest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). </description> </method> <method name="get_shortest_axis_size"> <return type="float"> </return> <description> - Return the scalar length of the shortest axis of the [code]Rect3[/code]. + Returns the scalar length of the shortest axis of the [code]Rect3[/code]. </description> </method> <method name="get_support"> @@ -104,7 +104,7 @@ <argument index="0" name="dir" type="Vector3"> </argument> <description> - Return the support point in a given direction. This is useful for collision detection algorithms. + Returns the support point in a given direction. This is useful for collision detection algorithms. </description> </method> <method name="grow"> @@ -113,21 +113,21 @@ <argument index="0" name="by" type="float"> </argument> <description> - Return a copy of the [code]Rect3[/code] grown a given amount of units towards all the sides. + Returns a copy of the [code]Rect3[/code] grown a given amount of units towards all the sides. </description> </method> <method name="has_no_area"> <return type="bool"> </return> <description> - Return true if the [code]Rect3[/code] is flat or empty. + Returns [code]true[/code] if the [code]Rect3[/code] is flat or empty. </description> </method> <method name="has_no_surface"> <return type="bool"> </return> <description> - Return true if the [code]Rect3[/code] is empty. + Returns [code]true[/code] if the [code]Rect3[/code] is empty. </description> </method> <method name="has_point"> @@ -136,7 +136,7 @@ <argument index="0" name="point" type="Vector3"> </argument> <description> - Return true if the [code]Rect3[/code] contains a point. + Returns [code]true[/code] if the [code]Rect3[/code] contains a point. </description> </method> <method name="intersection"> @@ -145,7 +145,7 @@ <argument index="0" name="with" type="Rect3"> </argument> <description> - Return the intersection between two [code]Rect3[/code]. An empty Rect3 (size 0,0,0) is returned on failure. + Returns the intersection between two [code]Rect3[/code]. An empty Rect3 (size 0,0,0) is returned on failure. </description> </method> <method name="intersects"> @@ -154,7 +154,7 @@ <argument index="0" name="with" type="Rect3"> </argument> <description> - Return true if the [code]Rect3[/code] overlaps with another. + Returns [code]true[/code] if the [code]Rect3[/code] overlaps with another. </description> </method> <method name="intersects_plane"> @@ -163,7 +163,7 @@ <argument index="0" name="plane" type="Plane"> </argument> <description> - Return true if the [code]Rect3[/code] is at both sides of a plane. + Returns [code]true[/code] if the [code]Rect3[/code] is on both sides of a plane. </description> </method> <method name="intersects_segment"> @@ -174,7 +174,7 @@ <argument index="1" name="to" type="Vector3"> </argument> <description> - Return true if the [code]Rect3[/code] intersects the line segment between from and to + Returns [code]true[/code] if the [code]Rect3[/code] intersects the line segment between [code]from[/code] and [code]to[/code]. </description> </method> <method name="merge"> @@ -183,7 +183,7 @@ <argument index="0" name="with" type="Rect3"> </argument> <description> - Combine this [code]Rect3[/code] with another, a larger one is returned that contains both. + Returns a larger Rect3 that contains this Rect3 and [code]with[/code]. </description> </method> </methods> @@ -192,6 +192,7 @@ Ending corner. </member> <member name="position" type="Vector3" setter="" getter=""> + Beginning corner. </member> <member name="size" type="Vector3" setter="" getter=""> Size from position to end. diff --git a/doc/classes/RemoteTransform.xml b/doc/classes/RemoteTransform.xml index ecc136055e..67679bc9df 100644 --- a/doc/classes/RemoteTransform.xml +++ b/doc/classes/RemoteTransform.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RemoteTransform" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> <brief_description> + RemoteTransform mirrors the [Transform] of another [Spatial] derived Node in the scene. </brief_description> <description> + RemoteTransform mirrors the [Transform] of another [Spatial] derived Node (called the remote node) in the scene. + It can be set to track another Node's position, rotation and/or scale and update its own accordingly, using either global or local coordinates. </description> <tutorials> </tutorials> @@ -82,14 +85,19 @@ </methods> <members> <member name="remote_path" type="NodePath" setter="set_remote_node" getter="get_remote_node"> + The remote node's [NodePath]. </member> <member name="update_position" type="bool" setter="set_update_position" getter="get_update_position"> + If [code]true[/code] the remote node's position is mirrored. </member> <member name="update_rotation" type="bool" setter="set_update_rotation" getter="get_update_rotation"> + If [code]true[/code] the remote node's rotation is mirrored. </member> <member name="update_scale" type="bool" setter="set_update_scale" getter="get_update_scale"> + If [code]true[/code] the remote node's scale is mirrored. </member> <member name="use_global_coordinates" type="bool" setter="set_use_global_coordinates" getter="get_use_global_coordinates"> + If [code]true[/code] global coordinates are used. If [code]false[/code] local coordinates are used. Default value: [code]true[/code]. </member> </members> <constants> diff --git a/doc/classes/RemoteTransform2D.xml b/doc/classes/RemoteTransform2D.xml index 346b8de621..eac7427f9f 100644 --- a/doc/classes/RemoteTransform2D.xml +++ b/doc/classes/RemoteTransform2D.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RemoteTransform2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <brief_description> + RemoteTransform2D mirrors the [Transform2D] of another [CanvasItem] derived Node in the scene. </brief_description> <description> + RemoteTransform2D mirrors the [Transform2D] of another [CanvasItem] derived Node (called the remote node) in the scene. + It can be set to track another Node's position, rotation and/or and update its own accordingly, using either global or local coordinates. </description> <tutorials> </tutorials> @@ -82,14 +85,19 @@ </methods> <members> <member name="remote_path" type="NodePath" setter="set_remote_node" getter="get_remote_node"> + The remote node's [NodePath]. </member> <member name="update_position" type="bool" setter="set_update_position" getter="get_update_position"> + If [code]true[/code] the remote node's position is mirrored. </member> <member name="update_rotation" type="bool" setter="set_update_rotation" getter="get_update_rotation"> + If [code]true[/code] the remote node's rotation is mirrored. </member> <member name="update_scale" type="bool" setter="set_update_scale" getter="get_update_scale"> + If [code]true[/code] the remote node's scale is mirrored. </member> <member name="use_global_coordinates" type="bool" setter="set_use_global_coordinates" getter="get_use_global_coordinates"> + If [code]true[/code] global coordinates are used. If [code]false[/code] local coordinates are used. Default value: [code]true[/code]. </member> </members> <constants> 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/String.xml b/doc/classes/String.xml index c7c19997b9..546712f223 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -17,6 +17,7 @@ <argument index="0" name="from" type="bool"> </argument> <description> + Constructs a new String from the given [bool]. </description> </method> <method name="String"> @@ -25,6 +26,7 @@ <argument index="0" name="from" type="int"> </argument> <description> + Constructs a new String from the given [int]. </description> </method> <method name="String"> @@ -33,6 +35,7 @@ <argument index="0" name="from" type="float"> </argument> <description> + Constructs a new String from the given [float]. </description> </method> <method name="String"> @@ -41,6 +44,7 @@ <argument index="0" name="from" type="Vector2"> </argument> <description> + Constructs a new String from the given [Vector2]. </description> </method> <method name="String"> @@ -49,6 +53,7 @@ <argument index="0" name="from" type="Rect2"> </argument> <description> + Constructs a new String from the given [Rect2]. </description> </method> <method name="String"> @@ -57,6 +62,7 @@ <argument index="0" name="from" type="Vector3"> </argument> <description> + Constructs a new String from the given [Vector3]. </description> </method> <method name="String"> @@ -65,6 +71,7 @@ <argument index="0" name="from" type="Transform2D"> </argument> <description> + Constructs a new String from the given [Transform2D]. </description> </method> <method name="String"> @@ -73,6 +80,7 @@ <argument index="0" name="from" type="Plane"> </argument> <description> + Constructs a new String from the given [Plane]. </description> </method> <method name="String"> @@ -81,6 +89,7 @@ <argument index="0" name="from" type="Quat"> </argument> <description> + Constructs a new String from the given [Quat]. </description> </method> <method name="String"> @@ -89,6 +98,7 @@ <argument index="0" name="from" type="Rect3"> </argument> <description> + Constructs a new String from the given [Rect3]. </description> </method> <method name="String"> @@ -97,6 +107,7 @@ <argument index="0" name="from" type="Basis"> </argument> <description> + Constructs a new String from the given [Basis]. </description> </method> <method name="String"> @@ -105,6 +116,7 @@ <argument index="0" name="from" type="Transform"> </argument> <description> + Constructs a new String from the given [Transform]. </description> </method> <method name="String"> @@ -113,6 +125,7 @@ <argument index="0" name="from" type="Color"> </argument> <description> + Constructs a new String from the given [Color]. </description> </method> <method name="String"> @@ -121,6 +134,7 @@ <argument index="0" name="from" type="NodePath"> </argument> <description> + Constructs a new String from the given [NodePath]. </description> </method> <method name="String"> @@ -129,6 +143,7 @@ <argument index="0" name="from" type="RID"> </argument> <description> + Constructs a new String from the given [RID]. </description> </method> <method name="String"> @@ -137,6 +152,7 @@ <argument index="0" name="from" type="Dictionary"> </argument> <description> + Constructs a new String from the given [Dictionary]. </description> </method> <method name="String"> @@ -145,6 +161,7 @@ <argument index="0" name="from" type="Array"> </argument> <description> + Constructs a new String from the given [Array]. </description> </method> <method name="String"> @@ -153,6 +170,7 @@ <argument index="0" name="from" type="PoolByteArray"> </argument> <description> + Constructs a new String from the given [PoolByteArray]. </description> </method> <method name="String"> @@ -161,6 +179,7 @@ <argument index="0" name="from" type="PoolIntArray"> </argument> <description> + Constructs a new String from the given [PoolIntArray]. </description> </method> <method name="String"> @@ -169,6 +188,7 @@ <argument index="0" name="from" type="PoolRealArray"> </argument> <description> + Constructs a new String from the given [PoolRealArray]. </description> </method> <method name="String"> @@ -177,6 +197,7 @@ <argument index="0" name="from" type="PoolStringArray"> </argument> <description> + Constructs a new String from the given [PoolStringArray]. </description> </method> <method name="String"> @@ -185,6 +206,7 @@ <argument index="0" name="from" type="PoolVector2Array"> </argument> <description> + Constructs a new String from the given [PoolVector2Array]. </description> </method> <method name="String"> @@ -193,6 +215,7 @@ <argument index="0" name="from" type="PoolVector3Array"> </argument> <description> + Constructs a new String from the given [PoolVector3Array]. </description> </method> <method name="String"> @@ -201,6 +224,7 @@ <argument index="0" name="from" type="PoolColorArray"> </argument> <description> + Constructs a new String from the given [PoolColorArray]. </description> </method> <method name="begins_with"> @@ -209,35 +233,35 @@ <argument index="0" name="text" type="String"> </argument> <description> - Return true if the strings begins with the given string. + Returns [code]true[/code] if the string begins with the given string. </description> </method> <method name="bigrams"> <return type="PoolStringArray"> </return> <description> - Return the bigrams (pairs of consecutive letters) of this string. + Returns the bigrams (pairs of consecutive letters) of this string. </description> </method> <method name="c_escape"> <return type="String"> </return> <description> - Return a copy of the string with special characters escaped using the C language standard. + Returns a copy of the string with special characters escaped using the C language standard. </description> </method> <method name="c_unescape"> <return type="String"> </return> <description> - Return a copy of the string with escaped characters replaced by their meanings according to the C language standard. + Returns a copy of the string with escaped characters replaced by their meanings according to the C language standard. </description> </method> <method name="capitalize"> <return type="String"> </return> <description> - Change the case of some letters. Replace underscores with spaces, convert all letters to lowercase then capitalize first and every letter following the space character. For [code]capitalize camelCase mixed_with_underscores[/code] it will return [code]Capitalize Camelcase Mixed With Underscores[/code]. + Changes the case of some letters. Replaces underscores with spaces, converts all letters to lowercase, then capitalizes first and every letter following the space character. For [code]capitalize camelCase mixed_with_underscores[/code] it will return [code]Capitalize Camelcase Mixed With Underscores[/code]. </description> </method> <method name="casecmp_to"> @@ -246,14 +270,14 @@ <argument index="0" name="to" type="String"> </argument> <description> - Perform a case-sensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater. + Performs a case-sensitive comparison to another string. Returns [code]-1[/code] if less than, [code]+1[/code] if greater than, or [code]0[/code] if equal. </description> </method> <method name="empty"> <return type="bool"> </return> <description> - Return true if the string is empty. + Returns [code]true[/code] if the string is empty. </description> </method> <method name="ends_with"> @@ -262,7 +286,7 @@ <argument index="0" name="text" type="String"> </argument> <description> - Return true if the strings ends with the given string. + Returns [code]true[/code] if the string ends with the given string. </description> </method> <method name="erase"> @@ -271,7 +295,7 @@ <argument index="1" name="chars" type="int"> </argument> <description> - Erase [code]chars[/code] characters from the string starting from [code]position[/code]. + Erases [code]chars[/code] characters from the string starting from [code]position[/code]. </description> </method> <method name="find"> @@ -282,7 +306,7 @@ <argument index="1" name="from" type="int" default="0"> </argument> <description> - Find the first occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. + Finds the first occurrence of a substring. Returns the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. </description> </method> <method name="find_last"> @@ -291,7 +315,7 @@ <argument index="0" name="what" type="String"> </argument> <description> - Find the last occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. + Finds the last occurrence of a substring. Returns the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. </description> </method> <method name="findn"> @@ -302,7 +326,7 @@ <argument index="1" name="from" type="int" default="0"> </argument> <description> - Find the first occurrence of a substring but search as case-insensitive, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. + Finds the first occurrence of a substring, ignoring case. Returns the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. </description> </method> <method name="format"> @@ -313,48 +337,49 @@ <argument index="1" name="placeholder" type="String" default="{_}"> </argument> <description> + Formats the string by replacing all occurences of [code]placeholder[/code] with [code]values[/code]. </description> </method> <method name="get_base_dir"> <return type="String"> </return> <description> - If the string is a path to a file, return the base directory. + If the string is a valid file path, returns the base directory name. </description> </method> <method name="get_basename"> <return type="String"> </return> <description> - If the string is a path to a file, return the path to the file without the extension. + If the string is a valid file path, returns the full file path without the extension. </description> </method> <method name="get_extension"> <return type="String"> </return> <description> - If the string is a path to a file, return the extension. + If the string is a valid file path, returns the extension. </description> </method> <method name="get_file"> <return type="String"> </return> <description> - If the string is a path to a file, return the file and ignore the base directory. + If the string is a valid file path, returns the filename. </description> </method> <method name="hash"> <return type="int"> </return> <description> - Hash the string and return a 32 bits integer. + Hashes the string and returns a 32-bit integer. </description> </method> <method name="hex_to_int"> <return type="int"> </return> <description> - Convert a string containing a hexadecimal number into an int. + Converts a string containing a hexadecimal number into an integer. </description> </method> <method name="insert"> @@ -365,21 +390,21 @@ <argument index="1" name="what" type="String"> </argument> <description> - Insert a substring at a given position. + Inserts a substring at a given position. </description> </method> <method name="is_abs_path"> <return type="bool"> </return> <description> - If the string is a path to a file or directory, return true if the path is absolute. + If the string is a path to a file or directory, returns [code]true[/code] if the path is absolute. </description> </method> <method name="is_rel_path"> <return type="bool"> </return> <description> - If the string is a path to a file or directory, return true if the path is relative. + If the string is a path to a file or directory, returns [code]true[/code] if the path is relative. </description> </method> <method name="is_subsequence_of"> @@ -388,7 +413,7 @@ <argument index="0" name="text" type="String"> </argument> <description> - Check whether this string is a subsequence of the given string. + Returns [code]true[/code] if this string is a subsequence of the given string. </description> </method> <method name="is_subsequence_ofi"> @@ -397,49 +422,49 @@ <argument index="0" name="text" type="String"> </argument> <description> - Check whether this string is a subsequence of the given string, without considering case. + Returns [code]true[/code] if this string is a subsequence of the given string, without considering case. </description> </method> <method name="is_valid_float"> <return type="bool"> </return> <description> - Check whether the string contains a valid float. + Returns [code]true[/code] if this string contains a valid float. </description> </method> <method name="is_valid_html_color"> <return type="bool"> </return> <description> - Check whether the string contains a valid color in HTML notation. + Returns [code]true[/code] if this string contains a valid color in HTML notation. </description> </method> <method name="is_valid_identifier"> <return type="bool"> </return> <description> - Check whether the string is a valid identifier. As is common in programming languages, a valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit. + Returns [code]true[/code] if this string is a valid identifier. A valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit. </description> </method> <method name="is_valid_integer"> <return type="bool"> </return> <description> - Check whether the string contains a valid integer. + Returns [code]true[/code] if this string contains a valid integer. </description> </method> <method name="is_valid_ip_address"> <return type="bool"> </return> <description> - Check whether the string contains a valid IP address. + Returns [code]true[/code] if this string contains a valid IP address. </description> </method> <method name="json_escape"> <return type="String"> </return> <description> - Return a copy of the string with special characters escaped using the JSON standard. + Returns a copy of the string with special characters escaped using the JSON standard. </description> </method> <method name="left"> @@ -448,14 +473,14 @@ <argument index="0" name="position" type="int"> </argument> <description> - Return an amount of characters from the left of the string. + Returns a number of characters from the left of the string. </description> </method> <method name="length"> <return type="int"> </return> <description> - Return the length of the string in characters. + Returns the string's amount of characters. </description> </method> <method name="match"> @@ -464,7 +489,7 @@ <argument index="0" name="expr" type="String"> </argument> <description> - Do a simple expression match, where '*' matches zero or more arbitrary characters and '?' matches any single character except '.'. + Does a simple expression match, where '*' matches zero or more arbitrary characters and '?' matches any single character except '.'. </description> </method> <method name="matchn"> @@ -473,21 +498,21 @@ <argument index="0" name="expr" type="String"> </argument> <description> - Do a simple case insensitive expression match, using ? and * wildcards (see [method match]). + Does a simple case insensitive expression match, using ? and * wildcards (see [method match]). </description> </method> <method name="md5_buffer"> <return type="PoolByteArray"> </return> <description> - Return the MD5 hash of the string as an array of bytes. + Returns the MD5 hash of the string as an array of bytes. </description> </method> <method name="md5_text"> <return type="String"> </return> <description> - Return the MD5 hash of the string as a string. + Returns the MD5 hash of the string as a string. </description> </method> <method name="nocasecmp_to"> @@ -496,7 +521,7 @@ <argument index="0" name="to" type="String"> </argument> <description> - Perform a case-insensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater. + Performs a case-insensitive comparison to another string. Returns [code]-1[/code] if less than, [code]+1[/code] if greater than, or [code]0[/code] if equal. </description> </method> <method name="ord_at"> @@ -505,7 +530,7 @@ <argument index="0" name="at" type="int"> </argument> <description> - Return the character code at position [code]at[/code]. + Returns the character code at position [code]at[/code]. </description> </method> <method name="pad_decimals"> @@ -514,7 +539,7 @@ <argument index="0" name="digits" type="int"> </argument> <description> - Format a number to have an exact number of [code]digits[/code] after the decimal point. + Formats a number to have an exact number of [code]digits[/code] after the decimal point. </description> </method> <method name="pad_zeros"> @@ -523,7 +548,7 @@ <argument index="0" name="digits" type="int"> </argument> <description> - Format a number to have an exact number of [code]digits[/code] before the decimal point. + Formats a number to have an exact number of [code]digits[/code] before the decimal point. </description> </method> <method name="percent_decode"> @@ -537,7 +562,7 @@ <return type="String"> </return> <description> - Percent-encode a string. This is meant to encode parameters in a URL when sending a HTTP GET request and bodies of form-urlencoded POST request. + Percent-encodes a string. Encodes parameters in a URL when sending a HTTP GET request (and bodies of form-urlencoded POST requests). </description> </method> <method name="plus_file"> @@ -557,7 +582,7 @@ <argument index="1" name="forwhat" type="String"> </argument> <description> - Replace occurrences of a substring for different ones inside the string. + Replaces occurrences of a substring with the given one inside the string. </description> </method> <method name="replacen"> @@ -568,7 +593,7 @@ <argument index="1" name="forwhat" type="String"> </argument> <description> - Replace occurrences of a substring for different ones inside the string, but search case-insensitive. + Replaces occurrences of a substring with the given one inside the string. Ignores case. </description> </method> <method name="rfind"> @@ -579,7 +604,7 @@ <argument index="1" name="from" type="int" default="-1"> </argument> <description> - Perform a search for a substring, but start from the end of the string instead of the beginning. + Performs a search for a substring, but starts from the end of the string instead of the beginning. </description> </method> <method name="rfindn"> @@ -590,7 +615,7 @@ <argument index="1" name="from" type="int" default="-1"> </argument> <description> - Perform a search for a substring, but start from the end of the string instead of the beginning. Also search case-insensitive. + Performs a search for a substring, but starts from the end of the string instead of the beginning. Ignores case. </description> </method> <method name="right"> @@ -599,7 +624,7 @@ <argument index="0" name="position" type="int"> </argument> <description> - Return the right side of the string from a given position. + Returns the right side of the string from a given position. </description> </method> <method name="sha256_buffer"> @@ -612,7 +637,7 @@ <return type="String"> </return> <description> - Return the SHA-256 hash of the string as a string. + Returns the SHA-256 hash of the string as a string. </description> </method> <method name="similarity"> @@ -621,7 +646,7 @@ <argument index="0" name="text" type="String"> </argument> <description> - Return the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar. + Returns the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar. </description> </method> <method name="split"> @@ -632,7 +657,7 @@ <argument index="1" name="allow_empty" type="bool" default="True"> </argument> <description> - Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",". + Splits the string by a divisor string and returns an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",". </description> </method> <method name="split_floats"> @@ -643,7 +668,7 @@ <argument index="1" name="allow_empty" type="bool" default="True"> </argument> <description> - Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",". + Splits the string in floats by using a divisor string and returns an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",". </description> </method> <method name="strip_edges"> @@ -654,7 +679,7 @@ <argument index="1" name="right" type="bool" default="True"> </argument> <description> - Return a copy of the string stripped of any non-printable character at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively. + Returns a copy of the string stripped of any non-printable character at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively. </description> </method> <method name="substr"> @@ -665,63 +690,63 @@ <argument index="1" name="len" type="int"> </argument> <description> - Return part of the string from the position [code]from[/code], with length [code]len[/code]. + Returns part of the string from the position [code]from[/code] with length [code]len[/code]. </description> </method> <method name="to_ascii"> <return type="PoolByteArray"> </return> <description> - Convert the String (which is a character array) to PoolByteArray (which is an array of bytes). The conversion is speeded up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters. + Converts the String (which is a character array) to [PoolByteArray] (which is an array of bytes). The conversion is sped up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters. </description> </method> <method name="to_float"> <return type="float"> </return> <description> - Convert a string, containing a decimal number, into a [code]float[/code]. + Converts a string containing a decimal number into a [code]float[/code]. </description> </method> <method name="to_int"> <return type="int"> </return> <description> - Convert a string, containing an integer number, into an [code]int[/code]. + Converts a string containing an integer number into an [code]int[/code]. </description> </method> <method name="to_lower"> <return type="String"> </return> <description> - Return the string converted to lowercase. + Returns the string converted to lowercase. </description> </method> <method name="to_upper"> <return type="String"> </return> <description> - Return the string converted to uppercase. + Returns the string converted to uppercase. </description> </method> <method name="to_utf8"> <return type="PoolByteArray"> </return> <description> - Convert the String (which is an array of characters) to PoolByteArray (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii(). + Converts the String (which is an array of characters) to [PoolByteArray] (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii(). </description> </method> <method name="xml_escape"> <return type="String"> </return> <description> - Return a copy of the string with special characters escaped using the XML standard. + Returns a copy of the string with special characters escaped using the XML standard. </description> </method> <method name="xml_unescape"> <return type="String"> </return> <description> - Return a copy of the string with escaped characters replaced by their meanings according to the XML standard. + Returns a copy of the string with escaped characters replaced by their meanings according to the XML standard. </description> </method> </methods> 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/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index fdbdabafd3..a05bc5db9a 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -37,6 +37,7 @@ <argument index="0" name="to" type="Vector3"> </argument> <description> + Returns the vector's minimum angle to the vector [code]to[/code]. </description> </method> <method name="bounce"> @@ -61,7 +62,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the cross product with b. + Returns the cross product with [code]b[/code]. </description> </method> <method name="cubic_interpolate"> @@ -76,7 +77,7 @@ <argument index="3" name="t" type="float"> </argument> <description> - Perform a cubic interpolation between vectors pre_a, a, b, post_b (a is current), by the given amount (t). + Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount (t). </description> </method> <method name="distance_squared_to"> @@ -85,7 +86,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the squared distance (distance minus the last square root) to b. Prefer this function over distance_to if you need to sort vectors or need the squared distance for some formula. + Returns the squared distance to [code]b[/code]. Prefer this function over distance_to if you need to sort vectors or need the squared distance for some formula. </description> </method> <method name="distance_to"> @@ -94,7 +95,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the distance to b. + Returns the distance to b. </description> </method> <method name="dot"> @@ -103,7 +104,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the dot product with b. + Returns the dot product with b. </description> </method> <method name="floor"> @@ -131,14 +132,14 @@ <return type="float"> </return> <description> - Return the length of the vector. + Returns the length of the vector. </description> </method> <method name="length_squared"> <return type="float"> </return> <description> - Return the length of the vector, squared. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula. + Returns the length of the vector, squared. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula. </description> </method> <method name="linear_interpolate"> @@ -170,7 +171,7 @@ <return type="Vector3"> </return> <description> - Return a copy of the normalized vector to unit length. This is the same as v / v.length(). + Returns a copy of the normalized vector to unit length. This is the same as v / v.length(). </description> </method> <method name="outer"> @@ -179,7 +180,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the outer product with b. + Returns the outer product with b. </description> </method> <method name="reflect"> @@ -217,14 +218,14 @@ <argument index="0" name="by" type="float"> </argument> <description> - Return a copy of the vector, snapped to the lowest neared multiple. + Returns a copy of the vector, snapped to the lowest neared multiple. </description> </method> <method name="to_diagonal_matrix"> <return type="Basis"> </return> <description> - Return a diagonal matrix with the vector as main diagonal. + Returns a diagonal matrix with the vector as main diagonal. </description> </method> </methods> diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 39f027a5aa..ddcb04fa7d 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -895,7 +895,7 @@ void RasterizerSceneGLES3::environment_set_ssr(RID p_env, bool p_enable, int p_m env->ssr_roughness = p_roughness; } -void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur) { +void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) { Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); @@ -909,6 +909,8 @@ void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float env->ssao_light_affect = p_light_affect; env->ssao_color = p_color; env->ssao_filter = p_blur; + env->ssao_quality = p_quality; + env->ssao_bilateral_sharpness = p_bilateral_sharpness; } void RasterizerSceneGLES3::environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) { @@ -3186,6 +3188,15 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ glDisable(GL_CULL_FACE); glDisable(GL_BLEND); + if (env->ssao_enabled || env->ssr_enabled) { + + //copy normal and roughness to effect buffer + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glReadBuffer(GL_COLOR_ATTACHMENT2); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->buffers.effect_fbo); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT, GL_NEAREST); + } + if (env->ssao_enabled) { //copy diffuse to front buffer glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); @@ -3235,6 +3246,8 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ // do SSAO! state.ssao_shader.set_conditional(SsaoShaderGLES3::ENABLE_RADIUS2, env->ssao_radius2 > 0.001); state.ssao_shader.set_conditional(SsaoShaderGLES3::USE_ORTHOGONAL_PROJECTION, p_cam_projection.is_orthogonal()); + state.ssao_shader.set_conditional(SsaoShaderGLES3::SSAO_QUALITY_LOW, env->ssao_quality == VS::ENV_SSAO_QUALITY_LOW); + state.ssao_shader.set_conditional(SsaoShaderGLES3::SSAO_QUALITY_HIGH, env->ssao_quality == VS::ENV_SSAO_QUALITY_HIGH); state.ssao_shader.bind(); state.ssao_shader.set_uniform(SsaoShaderGLES3::CAMERA_Z_FAR, p_cam_projection.get_z_far()); state.ssao_shader.set_uniform(SsaoShaderGLES3::CAMERA_Z_NEAR, p_cam_projection.get_z_near()); @@ -3287,6 +3300,9 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::CAMERA_Z_FAR, p_cam_projection.get_z_far()); state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::CAMERA_Z_NEAR, p_cam_projection.get_z_near()); + state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::EDGE_SHARPNESS, env->ssao_bilateral_sharpness); + state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::FILTER_SCALE, int(env->ssao_filter)); + GLint axis[2] = { i, 1 - i }; glUniform2iv(state.ssao_blur_shader.get_uniform(SsaoBlurShaderGLES3::AXIS), 1, axis); glUniform2iv(state.ssao_blur_shader.get_uniform(SsaoBlurShaderGLES3::SCREEN_SIZE), 1, ss); @@ -3295,6 +3311,8 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->effects.ssao.blur_red[i]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->depth); + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->buffers.effect); glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->effects.ssao.blur_fbo[1 - i]); if (i == 0) { glClearBufferfv(GL_COLOR, 0, white.components); // specular @@ -3386,12 +3404,6 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ if (env->ssr_enabled) { - //copy normal and roughness to effect buffer - glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); - glReadBuffer(GL_COLOR_ATTACHMENT2); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->buffers.effect_fbo); - glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT, GL_NEAREST); - //blur diffuse into effect mipmaps using separatable convolution //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); _blur_effect_buffer(); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 28a5cef0ee..ff691ddcec 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -379,7 +379,9 @@ public: float ssao_bias; float ssao_light_affect; Color ssao_color; - bool ssao_filter; + VS::EnvironmentSSAOQuality ssao_quality; + float ssao_bilateral_sharpness; + VS::EnvironmentSSAOBlur ssao_filter; bool glow_enabled; int glow_levels; @@ -456,7 +458,9 @@ public: ssao_radius2 = 0.0; ssao_bias = 0.01; ssao_light_affect = 0; - ssao_filter = true; + ssao_filter = VS::ENV_SSAO_BLUR_3x3; + ssao_quality = VS::ENV_SSAO_QUALITY_LOW; + ssao_bilateral_sharpness = 4; tone_mapper = VS::ENV_TONE_MAPPER_LINEAR; tone_mapper_exposure = 1.0; @@ -532,7 +536,7 @@ public: virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture); virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness); - virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur); + virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness); virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale); 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 317ca91d98..e4d76753cb 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -169,7 +169,7 @@ void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color, float roughness, ino float dotNL = max(dot(N,L), 0.0 ); diffuse += dotNL * light_color / M_PI; - if (roughness < 1.0) { + if (roughness > 0.0) { vec3 H = normalize(V + L); float dotNH = max(dot(N,H), 0.0 ); @@ -1034,7 +1034,7 @@ LIGHT_SHADER_CODE } - if (roughness < 1.0) { + if (roughness > 0.0) { // FIXME: roughness == 0 should not disable specular light entirely // D @@ -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/drivers/gles3/shaders/ssao.glsl b/drivers/gles3/shaders/ssao.glsl index c668e63745..219f0957e0 100644 --- a/drivers/gles3/shaders/ssao.glsl +++ b/drivers/gles3/shaders/ssao.glsl @@ -13,8 +13,24 @@ void main() { #define TWO_PI 6.283185307179586476925286766559 +#ifdef SSAO_QUALITY_HIGH + +#define NUM_SAMPLES (80) + +#endif + +#ifdef SSAO_QUALITY_LOW + #define NUM_SAMPLES (15) +#endif + +#if !defined(SSAO_QUALITY_LOW) && !defined(SSAO_QUALITY_HIGH) + +#define NUM_SAMPLES (40) + +#endif + // If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower // miplevel to maintain reasonable spatial locality in the cache // If this number is too small (< 3), too many taps will land in the same pixel, and we'll get bad variance that manifests as flashing. @@ -212,12 +228,12 @@ void main() { //visibility=-C.z/camera_z_far; //return; - - //vec3 n_C = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; - +#if 0 + vec3 n_C = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; +#else vec3 n_C = reconstructCSFaceNormal(C); n_C = -n_C; - +#endif // Hash function used in the HPG12 AlchemyAO paper float randomPatternRotationAngle = mod(float((3 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 10), TWO_PI); diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl index c7c978dc37..472dc21acf 100644 --- a/drivers/gles3/shaders/ssao_blur.glsl +++ b/drivers/gles3/shaders/ssao_blur.glsl @@ -15,6 +15,7 @@ void main() { uniform sampler2D source_ssao; //texunit:0 uniform sampler2D source_depth; //texunit:1 +uniform sampler2D source_normal; //texunit:3 layout(location = 0) out float visibility; @@ -24,7 +25,7 @@ layout(location = 0) out float visibility; // Tunable Parameters: /** Increase to make depth edges crisper. Decrease to reduce flicker. */ -#define EDGE_SHARPNESS (4.0) +uniform float edge_sharpness; /** Step in 2-pixel intervals since we already blurred against neighbors in the first AO pass. This constant can be increased while R decreases to improve @@ -34,7 +35,8 @@ layout(location = 0) out float visibility; unobjectionable after shading was applied but eliminated most temporal incoherence from using small numbers of sample taps. */ -#define SCALE (3) + +uniform int filter_scale; /** Filter radius in pixels. This will be multiplied by SCALE. */ #define R (4) @@ -63,13 +65,14 @@ void main() { ivec2 ssC = ivec2(gl_FragCoord.xy); float depth = texelFetch(source_depth, ssC, 0).r; + //vec3 normal = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; depth = depth * 2.0 - 1.0; depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); float depth_divide = 1.0 / camera_z_far; - depth*=depth_divide; +// depth*=depth_divide; /* if (depth > camera_z_far*0.999) { @@ -92,20 +95,23 @@ void main() { // so the IF statement has no runtime cost if (r != 0) { - ivec2 ppos = ssC + axis * (r * SCALE); + ivec2 ppos = ssC + axis * (r * filter_scale); float value = texelFetch(source_ssao, clamp(ppos,ivec2(0),clamp_limit), 0).r; - float temp_depth = texelFetch(source_depth, clamp(ssC,ivec2(0),clamp_limit), 0).r; + ivec2 rpos = clamp(ppos,ivec2(0),clamp_limit); + float temp_depth = texelFetch(source_depth, rpos, 0).r; + //vec3 temp_normal = texelFetch(source_normal, rpos, 0).rgb * 2.0 - 1.0; temp_depth = temp_depth * 2.0 - 1.0; temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near)); - temp_depth *= depth_divide; +// temp_depth *= depth_divide; // spatial domain: offset gaussian tap float weight = 0.3 + gaussian[abs(r)]; + //weight *= max(0.0,dot(temp_normal,normal)); // range domain (the "bilateral" weight). As depth difference increases, decrease weight. weight *= max(0.0, 1.0 - - (EDGE_SHARPNESS * 2000.0) * abs(temp_depth - depth) + - edge_sharpness * abs(temp_depth - depth) ); sum += value * weight; 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_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp index 4b370295f3..0d9b137f99 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.cpp +++ b/modules/mono/mono_gd/gd_mono_assembly.cpp @@ -95,7 +95,9 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse (void)user_data; // UNUSED if (search_dirs.empty()) { +#ifdef TOOLS_DOMAIN search_dirs.push_back(GodotSharpDirs::get_res_temp_assemblies_dir()); +#endif search_dirs.push_back(GodotSharpDirs::get_res_assemblies_dir()); search_dirs.push_back(OS::get_singleton()->get_resource_dir()); search_dirs.push_back(OS::get_singleton()->get_executable_path().get_base_dir()); diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 81315ee87a..1643f8cfc5 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -183,19 +183,19 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { // GodotObject if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) { MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); break; } if (CACHED_CLASS(NodePath) == type_class) { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); break; } if (CACHED_CLASS(RID) == type_class) { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); break; } @@ -204,8 +204,6 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { } break; case MONO_TYPE_OBJECT: { - GDMonoClass *type_class = type.type_class; - // Variant switch (p_value.get_type()) { case Variant::BOOL: { @@ -237,11 +235,11 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color); case Variant::NODE_PATH: { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); } break; case Variant::_RID: { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); } break; case Variant::OBJECT: { MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *()); @@ -250,7 +248,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { } case Variant::DICTIONARY: { MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); } break; case Variant::ARRAY: SET_FROM_ARRAY_AND_BREAK(Array); case Variant::POOL_BYTE_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolByteArray); @@ -268,7 +266,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { case MONO_TYPE_GENERICINST: { if (CACHED_RAW_MONO_CLASS(Dictionary) == type.type_class->get_raw()) { MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); break; } } break; 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/regex/SCsub b/modules/regex/SCsub index 2bab144a28..18b4051afe 100644 --- a/modules/regex/SCsub +++ b/modules/regex/SCsub @@ -8,7 +8,7 @@ env_regex.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=0"]) env_regex.add_source_files(env.modules_sources, "*.cpp") if env['builtin_pcre2']: - jit_blacklist = ['javascript'] + jit_blacklist = ['javascript', 'uwp'] thirdparty_dir = '#thirdparty/pcre2/src/' thirdparty_flags = ['-DPCRE2_STATIC', '-DHAVE_CONFIG_H'] if 'platform' in env and env['platform'] not in jit_blacklist: 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/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 4c6fa7c8a1..232f690074 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -377,7 +377,7 @@ bool Environment::is_ssr_rough() const { void Environment::set_ssao_enabled(bool p_enable) { ssao_enabled = p_enable; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); _change_notify(); } @@ -389,7 +389,7 @@ bool Environment::is_ssao_enabled() const { void Environment::set_ssao_radius(float p_radius) { ssao_radius = p_radius; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_radius() const { @@ -399,7 +399,7 @@ float Environment::get_ssao_radius() const { void Environment::set_ssao_intensity(float p_intensity) { ssao_intensity = p_intensity; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_intensity() const { @@ -410,7 +410,7 @@ float Environment::get_ssao_intensity() const { void Environment::set_ssao_radius2(float p_radius) { ssao_radius2 = p_radius; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_radius2() const { @@ -420,7 +420,7 @@ float Environment::get_ssao_radius2() const { void Environment::set_ssao_intensity2(float p_intensity) { ssao_intensity2 = p_intensity; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_intensity2() const { @@ -430,7 +430,7 @@ float Environment::get_ssao_intensity2() const { void Environment::set_ssao_bias(float p_bias) { ssao_bias = p_bias; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_bias() const { @@ -440,7 +440,7 @@ float Environment::get_ssao_bias() const { void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) { ssao_direct_light_affect = p_direct_light_affect; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_direct_light_affect() const { @@ -450,7 +450,7 @@ float Environment::get_ssao_direct_light_affect() const { void Environment::set_ssao_color(const Color &p_color) { ssao_color = p_color; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } Color Environment::get_ssao_color() const { @@ -458,16 +458,38 @@ Color Environment::get_ssao_color() const { return ssao_color; } -void Environment::set_ssao_blur(bool p_enable) { +void Environment::set_ssao_blur(SSAOBlur p_blur) { - ssao_blur = p_enable; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + ssao_blur = p_blur; + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } -bool Environment::is_ssao_blur_enabled() const { +Environment::SSAOBlur Environment::get_ssao_blur() const { return ssao_blur; } +void Environment::set_ssao_quality(SSAOQuality p_quality) { + + ssao_quality = p_quality; + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); +} + +Environment::SSAOQuality Environment::get_ssao_quality() const { + + return ssao_quality; +} + +void Environment::set_ssao_edge_sharpness(float p_edge_sharpness) { + + ssao_edge_sharpness = p_edge_sharpness; + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); +} + +float Environment::get_ssao_edge_sharpness() const { + + return ssao_edge_sharpness; +} + void Environment::set_glow_enabled(bool p_enabled) { glow_enabled = p_enabled; @@ -988,8 +1010,14 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_ssao_color", "color"), &Environment::set_ssao_color); ClassDB::bind_method(D_METHOD("get_ssao_color"), &Environment::get_ssao_color); - ClassDB::bind_method(D_METHOD("set_ssao_blur", "enabled"), &Environment::set_ssao_blur); - ClassDB::bind_method(D_METHOD("is_ssao_blur_enabled"), &Environment::is_ssao_blur_enabled); + ClassDB::bind_method(D_METHOD("set_ssao_blur", "mode"), &Environment::set_ssao_blur); + ClassDB::bind_method(D_METHOD("get_ssao_blur"), &Environment::get_ssao_blur); + + ClassDB::bind_method(D_METHOD("set_ssao_quality", "quality"), &Environment::set_ssao_quality); + ClassDB::bind_method(D_METHOD("get_ssao_quality"), &Environment::get_ssao_quality); + + ClassDB::bind_method(D_METHOD("set_ssao_edge_sharpness", "edge_sharpness"), &Environment::set_ssao_edge_sharpness); + ClassDB::bind_method(D_METHOD("get_ssao_edge_sharpness"), &Environment::get_ssao_edge_sharpness); ADD_GROUP("SSAO", "ssao_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_enabled"), "set_ssao_enabled", "is_ssao_enabled"); @@ -1000,7 +1028,9 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_bias", PROPERTY_HINT_RANGE, "0.001,8,0.001"), "set_ssao_bias", "get_ssao_bias"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_light_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_direct_light_affect", "get_ssao_direct_light_affect"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ssao_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ssao_color", "get_ssao_color"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_blur"), "set_ssao_blur", "is_ssao_blur_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), "set_ssao_quality", "get_ssao_quality"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_blur", PROPERTY_HINT_ENUM, "Disabled,1x1,2x2,3x3"), "set_ssao_blur", "get_ssao_blur"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_edge_sharpness", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_ssao_edge_sharpness", "get_ssao_edge_sharpness"); ClassDB::bind_method(D_METHOD("set_dof_blur_far_enabled", "enabled"), &Environment::set_dof_blur_far_enabled); ClassDB::bind_method(D_METHOD("is_dof_blur_far_enabled"), &Environment::is_dof_blur_far_enabled); @@ -1134,6 +1164,15 @@ void Environment::_bind_methods() { BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_LOW); 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); } Environment::Environment() { @@ -1179,7 +1218,9 @@ Environment::Environment() { ssao_intensity2 = 1; ssao_bias = 0.01; ssao_direct_light_affect = false; - ssao_blur = true; + ssao_blur = SSAO_BLUR_3x3; + set_ssao_edge_sharpness(4); + set_ssao_quality(SSAO_QUALITY_LOW); glow_enabled = false; glow_levels = (1 << 2) | (1 << 4); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 5909846074..418949a6ad 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -71,6 +71,19 @@ public: DOF_BLUR_QUALITY_HIGH, }; + enum SSAOBlur { + SSAO_BLUR_DISABLED, + SSAO_BLUR_1x1, + SSAO_BLUR_2x2, + SSAO_BLUR_3x3 + }; + + enum SSAOQuality { + SSAO_QUALITY_LOW, + SSAO_QUALITY_MEDIUM, + SSAO_QUALITY_HIGH + }; + private: RID environment; @@ -114,7 +127,9 @@ private: float ssao_bias; float ssao_direct_light_affect; Color ssao_color; - bool ssao_blur; + SSAOBlur ssao_blur; + float ssao_edge_sharpness; + SSAOQuality ssao_quality; bool glow_enabled; int glow_levels; @@ -261,8 +276,14 @@ public: void set_ssao_color(const Color &p_color); Color get_ssao_color() const; - void set_ssao_blur(bool p_enable); - bool is_ssao_blur_enabled() const; + void set_ssao_blur(SSAOBlur p_blur); + SSAOBlur get_ssao_blur() const; + + void set_ssao_quality(SSAOQuality p_quality); + SSAOQuality get_ssao_quality() const; + + void set_ssao_edge_sharpness(float p_edge_sharpness); + float get_ssao_edge_sharpness() const; void set_glow_enabled(bool p_enabled); bool is_glow_enabled() const; @@ -370,5 +391,7 @@ VARIANT_ENUM_CAST(Environment::BGMode) VARIANT_ENUM_CAST(Environment::ToneMapper) VARIANT_ENUM_CAST(Environment::GlowBlendMode) VARIANT_ENUM_CAST(Environment::DOFBlurQuality) +VARIANT_ENUM_CAST(Environment::SSAOQuality) +VARIANT_ENUM_CAST(Environment::SSAOBlur) #endif // ENVIRONMENT_H 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/server_wrap_mt_common.h b/servers/server_wrap_mt_common.h index 267e5c63b9..51e7f446ea 100644 --- a/servers/server_wrap_mt_common.h +++ b/servers/server_wrap_mt_common.h @@ -775,3 +775,12 @@ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \ } \ } + +#define FUNC12(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12) \ + virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12) { \ + if (Thread::get_caller_id() != server_thread) { \ + command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \ + } else { \ + server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \ + } \ + } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index b3f6b243de..cd4b465d79 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -65,7 +65,7 @@ public: virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) = 0; virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0; - virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur) = 0; + virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0; virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) = 0; 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"); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 888fb29f93..302f13ee4f 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -652,6 +652,8 @@ public: void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } #define BIND11(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11) \ void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); } +#define BIND12(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \ + void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); } //from now on, calls forwarded to this singleton #define BINDBASE VSG::storage @@ -974,7 +976,7 @@ public: BIND2(environment_set_canvas_max_layer, RID, int) BIND4(environment_set_ambient_light, RID, const Color &, float, float) BIND7(environment_set_ssr, RID, bool, int, float, float, float, bool) - BIND10(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, bool) + BIND12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float) BIND6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality) BIND6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality) diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index caec890217..67d503dfca 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -387,7 +387,7 @@ public: FUNC2(environment_set_canvas_max_layer, RID, int) FUNC4(environment_set_ambient_light, RID, const Color &, float, float) FUNC7(environment_set_ssr, RID, bool, int, float, float, float, bool) - FUNC10(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, bool) + FUNC12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float) FUNC6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality) FUNC6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality) diff --git a/servers/visual_server.h b/servers/visual_server.h index 7b83bb929d..64ed540501 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -678,7 +678,21 @@ public: virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) = 0; virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0; - virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur) = 0; + + enum EnvironmentSSAOQuality { + ENV_SSAO_QUALITY_LOW, + ENV_SSAO_QUALITY_MEDIUM, + ENV_SSAO_QUALITY_HIGH, + }; + + enum EnvironmentSSAOBlur { + ENV_SSAO_BLUR_DISABLED, + ENV_SSAO_BLUR_1x1, + ENV_SSAO_BLUR_2x2, + ENV_SSAO_BLUR_3x3, + }; + + virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, EnvironmentSSAOQuality p_quality, EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0; virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) = 0; virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_curve, bool p_transmit, float p_transmit_curve) = 0; |