diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/func_ref.cpp | 6 | ||||
-rw-r--r-- | core/input_map.cpp | 4 | ||||
-rw-r--r-- | core/input_map.h | 8 | ||||
-rw-r--r-- | core/math/vector3.cpp | 10 | ||||
-rw-r--r-- | core/method_bind.h | 19 | ||||
-rw-r--r-- | core/object.cpp | 24 | ||||
-rw-r--r-- | core/object_type_db.h | 4 | ||||
-rw-r--r-- | core/os/input.cpp | 2 | ||||
-rw-r--r-- | core/os/input.h | 20 | ||||
-rw-r--r-- | core/os/input_event.cpp | 4 | ||||
-rw-r--r-- | core/os/os.cpp | 3 | ||||
-rw-r--r-- | core/os/os.h | 8 | ||||
-rw-r--r-- | core/script_debugger_remote.cpp | 6 | ||||
-rw-r--r-- | core/translation.cpp | 438 | ||||
-rw-r--r-- | core/undo_redo.cpp | 16 | ||||
-rw-r--r-- | core/variant.h | 2 | ||||
-rw-r--r-- | core/variant_call.cpp | 16 |
17 files changed, 494 insertions, 96 deletions
diff --git a/core/func_ref.cpp b/core/func_ref.cpp index 644d8b5b63..ca890111be 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -61,11 +61,7 @@ void FuncRef::_bind_methods() { MethodInfo mi; mi.name="call_func"; Vector<Variant> defargs; - for(int i=0;i<10;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_func:Variant",&FuncRef::call_func,mi,defargs); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_func:Variant",&FuncRef::call_func,mi,defargs); } diff --git a/core/input_map.cpp b/core/input_map.cpp index 08ee8138a3..3a0f9596f5 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -290,6 +290,10 @@ bool InputMap::event_is_joy_motion_action_pressed(const InputEvent& p_event) con } +const Map<StringName, InputMap::Action>& InputMap::get_action_map() const { + return input_map; +} + void InputMap::load_from_globals() { input_map.clear();; diff --git a/core/input_map.h b/core/input_map.h index dc5a911963..a224765d8c 100644 --- a/core/input_map.h +++ b/core/input_map.h @@ -35,12 +35,14 @@ class InputMap : public Object { OBJ_TYPE( InputMap, Object ); - static InputMap *singleton; - +public: struct Action { int id; List<InputEvent> inputs; }; +private: + static InputMap *singleton; + mutable Map<StringName, Action> input_map; mutable Map<int,StringName> input_id_map; @@ -72,7 +74,7 @@ public: bool event_is_action(const InputEvent& p_event, const StringName& p_action) const; bool event_is_joy_motion_action_pressed(const InputEvent& p_event) const; - + const Map<StringName, Action>& get_action_map() const; void load_from_globals(); void load_default(); diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 8afd73f482..b4a13d8f6d 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -65,13 +65,9 @@ int Vector3::max_axis() const { void Vector3::snap(float p_val) { - x+=p_val/2.0; - x-=Math::fmod(x,p_val); - y+=p_val/2.0; - y-=Math::fmod(y,p_val); - z+=p_val/2.0; - z-=Math::fmod(z,p_val); - + x=Math::stepify(x,p_val); + y=Math::stepify(y,p_val); + z=Math::stepify(z,p_val); } Vector3 Vector3::snapped(float p_val) const { diff --git a/core/method_bind.h b/core/method_bind.h index 072953743c..04ff5c22c6 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -52,6 +52,7 @@ enum MethodFlags { METHOD_FLAG_REVERSE=16, // used for events METHOD_FLAG_VIRTUAL=32, METHOD_FLAG_FROM_SCRIPT=64, + METHOD_FLAG_VARARG=128, METHOD_FLAGS_DEFAULT=METHOD_FLAG_NORMAL, }; @@ -229,7 +230,7 @@ public: Vector<StringName> get_argument_names() const; #endif void set_hint_flags(uint32_t p_hint) { hint_flags=p_hint; } - uint32_t get_hint_flags() const { return hint_flags|(is_const()?METHOD_FLAG_CONST:0); } + uint32_t get_hint_flags() const { return hint_flags|(is_const()?METHOD_FLAG_CONST:0)|(is_vararg()?METHOD_FLAG_VARARG:0); } virtual String get_instance_type() const=0; _FORCE_INLINE_ int get_argument_count() const { return argument_count; }; @@ -267,7 +268,7 @@ public: _FORCE_INLINE_ int get_method_id() const { return method_id; } _FORCE_INLINE_ bool is_const() const { return _const; } _FORCE_INLINE_ bool has_return() const { return _returns; } - + virtual bool is_vararg() const { return false; } void set_default_arguments(const Vector<Variant>& p_defargs); @@ -277,7 +278,7 @@ public: template<class T> -class MethodBindNative : public MethodBind { +class MethodBindVarArg : public MethodBind { public: typedef Variant (T::*NativeCall)(const Variant**,int ,Variant::CallError &); protected: @@ -319,7 +320,9 @@ public: } #ifdef PTRCALL_ENABLED - virtual void ptrcall(Object* p_object,const void** p_args,void* r_ret) {} //todo + virtual void ptrcall(Object* p_object,const void** p_args,void* r_ret) { + ERR_FAIL(); //can't call + } //todo #endif @@ -327,14 +330,16 @@ public: virtual bool is_const() const { return false; } virtual String get_instance_type() const { return T::get_type_static(); } - MethodBindNative() { call_method=NULL; _set_returns(true);} + virtual bool is_vararg() const { return true; } + + MethodBindVarArg() { call_method=NULL; _set_returns(true);} }; template<class T > -MethodBind* create_native_method_bind( Variant (T::*p_method)(const Variant**,int ,Variant::CallError &), const MethodInfo& p_info ) { +MethodBind* create_vararg_method_bind( Variant (T::*p_method)(const Variant**,int ,Variant::CallError &), const MethodInfo& p_info ) { - MethodBindNative<T > * a = memnew( (MethodBindNative<T >) ); + MethodBindVarArg<T > * a = memnew( (MethodBindVarArg<T >) ); a->set_method(p_method); a->set_method_info(p_info); return a; diff --git a/core/object.cpp b/core/object.cpp index b036efa501..81fdc2a90c 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1693,42 +1693,26 @@ void Object::_bind_methods() { MethodInfo mi; mi.name="emit_signal"; mi.arguments.push_back( PropertyInfo( Variant::STRING, "signal")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"emit_signal",&Object::_emit_signal,mi,defargs); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"emit_signal",&Object::_emit_signal,mi); } { MethodInfo mi; mi.name="call"; mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<10;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call:Variant",&Object::_call_bind,mi,defargs); + + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call:Variant",&Object::_call_bind,mi); } { MethodInfo mi; mi.name="call_deferred"; mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;i++) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"call_deferred",&Object::_call_deferred_bind,mi,defargs); + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_deferred",&Object::_call_deferred_bind,mi); } ObjectTypeDB::bind_method(_MD("callv:Variant","method","arg_array"),&Object::callv); diff --git a/core/object_type_db.h b/core/object_type_db.h index 3fcd38aa31..725b424c9a 100644 --- a/core/object_type_db.h +++ b/core/object_type_db.h @@ -415,13 +415,13 @@ public: #endif template<class M> - static MethodBind* bind_native_method(uint32_t p_flags, StringName p_name, M p_method,const MethodInfo& p_info=MethodInfo(),const Vector<Variant>& p_default_args=Vector<Variant>()) { + static MethodBind* bind_vararg_method(uint32_t p_flags, StringName p_name, M p_method,const MethodInfo& p_info=MethodInfo(),const Vector<Variant>& p_default_args=Vector<Variant>()) { GLOBAL_LOCK_FUNCTION; - MethodBind *bind = create_native_method_bind(p_method,p_info); + MethodBind *bind = create_vararg_method_bind(p_method,p_info); ERR_FAIL_COND_V(!bind,NULL); String rettype; diff --git a/core/os/input.cpp b/core/os/input.cpp index 531db73838..401ab7ffe2 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -53,6 +53,8 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_mouse_button_pressed","button"),&Input::is_mouse_button_pressed); ObjectTypeDB::bind_method(_MD("is_joy_button_pressed","device","button"),&Input::is_joy_button_pressed); ObjectTypeDB::bind_method(_MD("is_action_pressed","action"),&Input::is_action_pressed); + ObjectTypeDB::bind_method(_MD("is_action_just_pressed","action"),&Input::is_action_just_pressed); + ObjectTypeDB::bind_method(_MD("is_action_just_released","action"),&Input::is_action_just_released); ObjectTypeDB::bind_method(_MD("add_joy_mapping","mapping", "update_existing"),&Input::add_joy_mapping, DEFVAL(false)); ObjectTypeDB::bind_method(_MD("remove_joy_mapping","guid"),&Input::remove_joy_mapping); ObjectTypeDB::bind_method(_MD("is_joy_known","device"),&Input::is_joy_known); diff --git a/core/os/input.h b/core/os/input.h index 16bcc0ff9a..665fb4ad99 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -55,12 +55,14 @@ public: static Input *get_singleton(); - virtual bool is_key_pressed(int p_scancode)=0; - virtual bool is_mouse_button_pressed(int p_button)=0; - virtual bool is_joy_button_pressed(int p_device, int p_button)=0; - virtual bool is_action_pressed(const StringName& p_action)=0; - - virtual float get_joy_axis(int p_device,int p_axis)=0; + virtual bool is_key_pressed(int p_scancode) const=0; + virtual bool is_mouse_button_pressed(int p_button) const=0; + virtual bool is_joy_button_pressed(int p_device, int p_button) const=0; + virtual bool is_action_pressed(const StringName& p_action) const=0; + virtual bool is_action_just_pressed(const StringName& p_action) const=0; + virtual bool is_action_just_released(const StringName& p_action) const=0; + + virtual float get_joy_axis(int p_device,int p_axis) const=0; virtual String get_joy_name(int p_idx)=0; virtual Array get_connected_joysticks()=0; virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid)=0; @@ -80,9 +82,9 @@ public: virtual void warp_mouse_pos(const Vector2& p_to)=0; - virtual Vector3 get_accelerometer()=0; - virtual Vector3 get_magnetometer()=0; - virtual Vector3 get_gyroscope()=0; + virtual Vector3 get_accelerometer() const=0; + virtual Vector3 get_magnetometer() const=0; + virtual Vector3 get_gyroscope() const=0; virtual void action_press(const StringName& p_action)=0; virtual void action_release(const StringName& p_action)=0; diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index f4a6de0e96..9d920724e1 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -39,6 +39,8 @@ bool InputEvent::operator==(const InputEvent &p_event) const { } switch(type) { + case NONE: + return true; case KEY: return key.unicode == p_event.key.unicode && key.scancode == p_event.key.scancode @@ -77,6 +79,8 @@ bool InputEvent::operator==(const InputEvent &p_event) const { case ACTION: return action.action == p_event.action.action && action.pressed == p_event.action.pressed; + default: + ERR_PRINT("No logic to compare InputEvents of this type, this shouldn't happen."); } return false; diff --git a/core/os/os.cpp b/core/os/os.cpp index 5f86962048..ee32476234 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -587,6 +587,9 @@ OS::OS() { _time_scale=1.0; _pixel_snap=false; _allow_hidpi=true; + _fixed_frames=0; + _idle_frames=0; + _in_fixed=false; Math::seed(1234567); } diff --git a/core/os/os.h b/core/os/os.h index 2521d67e29..8e9293b3c8 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -62,6 +62,10 @@ class OS { bool _pixel_snap; bool _allow_hidpi; + uint64_t _fixed_frames; + uint64_t _idle_frames; + bool _in_fixed; + char *last_error; public: @@ -282,6 +286,10 @@ public: uint64_t get_frames_drawn(); + uint64_t get_fixed_frames() const { return _fixed_frames; } + uint64_t get_idle_frames() const { return _idle_frames; } + bool is_in_fixed_frame() const { return _in_fixed; } + bool is_stdout_verbose() const; enum CursorShape { diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 99d1e22c07..1ac0907967 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -219,7 +219,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { if (F->get().get_type()==Variant::OBJECT) { packet_peer_stream->put_var("*"+E->get()); - packet_peer_stream->put_var(safe_get_instance_id(F->get())); + String pretty_print = F->get().operator String(); + packet_peer_stream->put_var(pretty_print.ascii().get_data()); } else { packet_peer_stream->put_var(E->get()); packet_peer_stream->put_var(F->get()); @@ -242,7 +243,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { if (F->get().get_type()==Variant::OBJECT) { packet_peer_stream->put_var("*"+E->get()); - packet_peer_stream->put_var(safe_get_instance_id(F->get())); + String pretty_print = F->get().operator String(); + packet_peer_stream->put_var(pretty_print.ascii().get_data()); } else { packet_peer_stream->put_var(E->get()); packet_peer_stream->put_var(F->get()); diff --git a/core/translation.cpp b/core/translation.cpp index 01789747ea..4592d00598 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -32,11 +32,23 @@ #include "os/os.h" static const char* locale_list[]={ +"aa", // Afar +"aa_DJ", // Afar (Djibouti) +"aa_ER", // Afar (Eritrea) +"aa_ET", // Afar (Ethiopia) +"af", // Afrikaans +"af_ZA", // Afrikaans (South Africa) +"agr_PE", // Aguaruna (Peru) +"ak_GH", // Akan (Ghana) +"am_ET", // Amharic (Ethiopia) +"an_ES", // Aragonese (Spain) +"anp_IN", // Angika (India) "ar", // Arabic "ar_AE", // Arabic (United Arab Emirates) "ar_BH", // Arabic (Bahrain) "ar_DZ", // Arabic (Algeria) "ar_EG", // Arabic (Egypt) +"ar_IN", // Arabic (India) "ar_IQ", // Arabic (Iraq) "ar_JO", // Arabic (Jordan) "ar_KW", // Arabic (Kuwait) @@ -47,48 +59,91 @@ static const char* locale_list[]={ "ar_QA", // Arabic (Qatar) "ar_SA", // Arabic (Saudi Arabia) "ar_SD", // Arabic (Sudan) +"ar_SS", // Arabic (South Soudan) "ar_SY", // Arabic (Syria) "ar_TN", // Arabic (Tunisia) "ar_YE", // Arabic (Yemen) +"as_IN", // Assamese (India) +"ast_ES", // Asturian (Spain) +"ayc_PE", // Southern Aymara (Peru) +"ay_PE", // Aymara (Peru) +"az_AZ", // Azerbaijani (Azerbaijan) "be", // Belarusian "be_BY", // Belarusian (Belarus) +"bem_ZM", // Bemba (Zambia) +"ber_DZ", // Berber languages (Algeria) +"ber_MA", // Berber languages (Morocco) "bg", // Bulgarian "bg_BG", // Bulgarian (Bulgaria) +"bhb_IN", // Bhili (India) +"bho_IN", // Bhojpuri (India) +"bi_TV", // Bislama (Tuvalu) "bn", // Bengali "bn_BD", // Bengali (Bangladesh) "bn_IN", // Bengali (India) +"bo", // Tibetan +"bo_CN", // Tibetan (China) +"bo_IN", // Tibetan (India) +"br_FR", // Breton (France) +"brx_IN", // Bodo (India) +"bs_BA", // Bosnian (Bosnia and Herzegovina) +"byn_ER", // Bilin (Eritrea) "ca", // Catalan +"ca_AD", // Catalan (Andorra) "ca_ES", // Catalan (Spain) +"ca_FR", // Catalan (France) +"ca_IT", // Catalan (Italy) +"ce_RU", // Chechen (Russia) +"chr_US", // Cherokee (United States) +"cmn_TW", // Mandarin Chinese (Taiwan) +"crh_UA", // Crimean Tatar (Ukraine) +"csb_PL", // Kashubian (Poland) "cs", // Czech "cs_CZ", // Czech (Czech Republic) +"cv_RU", // Chuvash (Russia) +"cy_GB", // Welsh (United Kingdom) "da", // Danish "da_DK", // Danish (Denmark) "de", // German "de_AT", // German (Austria) +"de_BE", // German (Belgium) "de_CH", // German (Switzerland) "de_DE", // German (Germany) +"de_IT", // German (Italy) "de_LU", // German (Luxembourg) +"doi_IN", // Dogri (India) +"dv_MV", // Dhivehi (Maldives) +"dz_BT", // Dzongkha (Bhutan) "el", // Greek "el_CY", // Greek (Cyprus) "el_GR", // Greek (Greece) "en", // English +"en_AG", // English (Antigua and Barbuda) "en_AU", // English (Australia) +"en_BW", // English (Botswana) "en_CA", // English (Canada) +"en_DK", // English (Denmark) "en_GB", // English (United Kingdom) +"en_HK", // English (Hong Kong) "en_IE", // English (Ireland) +"en_IL", // English (Israel) "en_IN", // English (India) -"en_MT", // English (Malta) +"en_NG", // English (Nigeria) "en_NZ", // English (New Zealand) "en_PH", // English (Philippines) "en_SG", // English (Singapore) "en_US", // English (United States) "en_ZA", // English (South Africa) +"en_ZM", // English (Zambia) +"en_ZW", // English (Zimbabwe) +"eo", // Esperanto "es", // Spanish "es_AR", // Spanish (Argentina) "es_BO", // Spanish (Bolivia) "es_CL", // Spanish (Chile) "es_CO", // Spanish (Colombia) "es_CR", // Spanish (Costa Rica) +"es_CU", // Spanish (Cuba) "es_DO", // Spanish (Dominican Republic) "es_EC", // Spanish (Ecuador) "es_ES", // Spanish (Spain) @@ -106,100 +161,252 @@ static const char* locale_list[]={ "es_VE", // Spanish (Venezuela) "et", // Estonian "et_EE", // Estonian (Estonia) +"eu", // Basque +"eu_ES", // Basque (Spain) +"fa", // Persian +"fa_IR", // Persian (Iran) +"ff_SN", // Fulah (Senegal) "fi", // Finnish "fi_FI", // Finnish (Finland) +"fil_PH", // Filipino (Philippines) +"fo_FO", // Faroese (Faroe Islands) "fr", // French "fr_BE", // French (Belgium) "fr_CA", // French (Canada) "fr_CH", // French (Switzerland) "fr_FR", // French (France) "fr_LU", // French (Luxembourg) +"fur_IT", // Friulian (Italy) +"fy_DE", // Western Frisian (Germany) +"fy_NL", // Western Frisian (Netherlands) "ga", // Irish "ga_IE", // Irish (Ireland) -"hi", // Hindi (India) +"gd_GB", // Scottish Gaelic (United Kingdom) +"gez_ER", // Geez (Eritrea) +"gez_ET", // Geez (Ethiopia) +"gl_ES", // Galician (Spain) +"gu_IN", // Gujarati (India) +"gv_GB", // Manx (United Kingdom) +"hak_TW", // Hakka Chinese (Taiwan) +"ha_NG", // Hausa (Nigeria) +"he", // Hebrew +"he_IL", // Hebrew (Israel) +"hi", // Hindi "hi_IN", // Hindi (India) +"hne_IN", // Chhattisgarhi (India) "hr", // Croatian "hr_HR", // Croatian (Croatia) +"hsb_DE", // Upper Sorbian (Germany) +"ht_HT", // Haitian (Haiti) "hu", // Hungarian "hu_HU", // Hungarian (Hungary) -"in", // Indonesian -"in_ID", // Indonesian (Indonesia) +"hus_MX", // Huastec (Mexico) +"hy_AM", // Armenian (Armenia) +"ia_FR", // Interlingua (France) +"id", // Indonesian +"id_ID", // Indonesian (Indonesia) +"ig_NG", // Igbo (Nigeria) +"ik_CA", // Inupiaq (Canada) "is", // Icelandic "is_IS", // Icelandic (Iceland) "it", // Italian "it_CH", // Italian (Switzerland) "it_IT", // Italian (Italy) -"iw", // Hebrew -"iw_IL", // Hebrew (Israel) +"iu_CA", // Inuktitut (Canada) "ja", // Japanese "ja_JP", // Japanese (Japan) -"ja_JP_JP", // Japanese (Japan,JP) +"kab_DZ", // Kabyle (Algeria) +"ka_GE", // Georgian (Georgia) +"kk_KZ", // Kazakh (Kazakhstan) +"kl_GL", // Kalaallisut (Greenland) +"km_KH", // Central Khmer (Cambodia) +"kn_IN", // Kannada (India) +"kok_IN", // Konkani (India) "ko", // Korean "ko_KR", // Korean (South Korea) +"ks_IN", // Kashmiri (India) +"ku", // Kurdish +"ku_TR", // Kurdish (Turkey) +"kw_GB", // Cornish (United Kingdom) +"ky_KG", // Kirghiz (Kyrgyzstan) +"lb_LU", // Luxembourgish (Luxembourg) +"lg_UG", // Ganda (Uganda) +"li_BE", // Limburgan (Belgium) +"li_NL", // Limburgan (Netherlands) +"lij_IT", // Ligurian (Italy) +"ln_CD", // Lingala (Congo) +"lo_LA", // Lao (Laos) "lt", // Lithuanian "lt_LT", // Lithuanian (Lithuania) "lv", // Latvian "lv_LV", // Latvian (Latvia) +"lzh_TW", // Literary Chinese (Taiwan) +"mag_IN", // Magahi (India) +"mai_IN", // Maithili (India) +"mg_MG", // Malagasy (Madagascar) +"mh_MH", // Marshallese (Marshall Islands) +"mhr_RU", // Eastern Mari (Russia) +"mi_NZ", // Maori (New Zealand) +"miq_NI", // Mískito (Nicaragua) "mk", // Macedonian "mk_MK", // Macedonian (Macedonia) +"ml_IN", // Malayalam (India) +"mni_IN", // Manipuri (India) +"mn_MN", // Mongolian (Mongolia) +"mr_IN", // Marathi (India) "ms", // Malay "ms_MY", // Malay (Malaysia) "mt", // Maltese "mt_MT", // Maltese (Malta) +"my_MM", // Burmese (Myanmar) +"myv_RU", // Erzya (Russia) +"nah_MX", // Nahuatl languages (Mexico) +"nan_TW", // Min Nan Chinese (Taiwan) +"nb", // Norwegian Bokmål +"nb_NO", // Norwegian Bokmål (Norway) +"nds_DE", // Low German (Germany) +"nds_NL", // Low German (Netherlands) +"ne_NP", // Nepali (Nepal) +"nhn_MX", // Central Nahuatl (Mexico) +"niu_NU", // Niuean (Niue) +"niu_NZ", // Niuean (New Zealand) "nl", // Dutch +"nl_AW", // Dutch (Aruba) "nl_BE", // Dutch (Belgium) "nl_NL", // Dutch (Netherlands) -"no", // Norwegian -"no_NO", // Norwegian (Norway) -"no_NO_NY", // Norwegian (Norway,Nynorsk) +"nn", // Norwegian Nynorsk +"nn_NO", // Norwegian Nynorsk (Norway) +"nr_ZA", // South Ndebele (South Africa) +"nso_ZA", // Pedi (South Africa) +"oc_FR", // Occitan (France) +"om", // Oromo +"om_ET", // Oromo (Ethiopia) +"om_KE", // Oromo (Kenya) +"or_IN", // Oriya (India) +"os_RU", // Ossetian (Russia) +"pa_IN", // Panjabi (India) +"pap", // Papiamento +"pap_AN", // Papiamento (Netherlands Antilles) +"pap_AW", // Papiamento (Aruba) +"pap_CW", // Papiamento (Curaçao) +"pa_PK", // Panjabi (Pakistan) "pl", // Polish "pl_PL", // Polish (Poland) +"ps_AF", // Pushto (Afghanistan) "pt", // Portuguese "pt_BR", // Portuguese (Brazil) "pt_PT", // Portuguese (Portugal) +"quy_PE", // Ayacucho Quechua (Peru) +"quz_PE", // Cusco Quechua (Peru) +"raj_IN", // Rajasthani (India) "ro", // Romanian "ro_RO", // Romanian (Romania) "ru", // Russian "ru_RU", // Russian (Russia) +"ru_UA", // Russian (Ukraine) +"rw_RW", // Kinyarwanda (Rwanda) +"sa_IN", // Sanskrit (India) +"sat_IN", // Santali (India) +"sc_IT", // Sardinian (Italy) +"sd_IN", // Sindhi (India) +"se_NO", // Northern Sami (Norway) +"sgs_LT", // Samogitian (Lithuania) +"shs_CA", // Shuswap (Canada) +"sid_ET", // Sidamo (Ethiopia) +"si_LK", // Sinhala (Sri Lanka) "sk", // Slovak "sk_SK", // Slovak (Slovakia) "sl", // Slovenian "sl_SI", // Slovenian (Slovenia) +"so", // Somali +"so_DJ", // Somali (Djibouti) +"so_ET", // Somali (Ethiopia) +"so_KE", // Somali (Kenya) +"so_SO", // Somali (Somalia) +"son_ML", // Songhai languages (Mali) "sq", // Albanian "sq_AL", // Albanian (Albania) +"sq_KV", // Albanian (Kosovo) +"sq_MK", // Albanian (Macedonia) "sr", // Serbian -"sr_BA", // Serbian (Bosnia and Herzegovina) -"sr_CS", // Serbian (Serbia and Montenegro) "sr_ME", // Serbian (Montenegro) "sr_RS", // Serbian (Serbia) +"ss_ZA", // Swati (South Africa) +"st_ZA", // Southern Sotho (South Africa) "sv", // Swedish +"sv_FI", // Swedish (Finland) "sv_SE", // Swedish (Sweden) +"sw_KE", // Swahili (Kenya) +"sw_TZ", // Swahili (Tanzania) +"szl_PL", // Silesian (Poland) +"ta", // Tamil +"ta_IN", // Tamil (India) +"ta_LK", // Tamil (Sri Lanka) +"tcy_IN", // Tulu (India) +"te_IN", // Telugu (India) +"tg_TJ", // Tajik (Tajikistan) +"the_NP", // Chitwania Tharu (Nepal) "th", // Thai "th_TH", // Thai (Thailand) -"th_TH_TH", // Thai (Thailand,TH) +"ti", // Tigrinya +"ti_ER", // Tigrinya (Eritrea) +"ti_ET", // Tigrinya (Ethiopia) +"tig_ER", // Tigre (Eritrea) +"tk_TM", // Turkmen (Turkmenistan) +"tl_PH", // Tagalog (Philippines) +"tn_ZA", // Tswana (South Africa) "tr", // Turkish +"tr_CY", // Turkish (Cyprus) "tr_TR", // Turkish (Turkey) +"ts_ZA", // Tsonga (South Africa) +"tt_RU", // Tatar (Russia) +"ug_CN", // Uighur (China) "uk", // Ukrainian "uk_UA", // Ukrainian (Ukraine) +"unm_US", // Unami (United States) "ur", // Urdu "ur_IN", // Urdu (India) "ur_PK", // Urdu (Pakistan) +"uz", // Uzbek +"uz_UZ", // Uzbek (Uzbekistan) +"ve_ZA", // Venda (South Africa) "vi", // Vietnamese "vi_VN", // Vietnamese (Vietnam) +"wa_BE", // Walloon (Belgium) +"wae_CH", // Walser (Switzerland) +"wal_ET", // Wolaytta (Ethiopia) +"wo_SN", // Wolof (Senegal) +"xh_ZA", // Xhosa (South Africa) +"yi_US", // Yiddish (United States) +"yo_NG", // Yoruba (Nigeria) +"yue_HK", // Yue Chinese (Hong Kong) "zh", // Chinese "zh_CN", // Chinese (China) "zh_HK", // Chinese (Hong Kong) "zh_SG", // Chinese (Singapore) "zh_TW", // Chinese (Taiwan) +"zu_ZA", // Zulu (South Africa) 0 }; static const char* locale_names[]={ +"Afar", +"Afar (Djibouti)", +"Afar (Eritrea)", +"Afar (Ethiopia)", +"Afrikaans", +"Afrikaans (South Africa)", +"Aguaruna (Peru)", +"Akan (Ghana)", +"Amharic (Ethiopia)", +"Aragonese (Spain)", +"Angika (India)", "Arabic", "Arabic (United Arab Emirates)", "Arabic (Bahrain)", "Arabic (Algeria)", "Arabic (Egypt)", +"Arabic (India)", "Arabic (Iraq)", "Arabic (Jordan)", "Arabic (Kuwait)", @@ -210,48 +417,91 @@ static const char* locale_names[]={ "Arabic (Qatar)", "Arabic (Saudi Arabia)", "Arabic (Sudan)", +"Arabic (South Soudan)", "Arabic (Syria)", "Arabic (Tunisia)", "Arabic (Yemen)", +"Assamese (India)", +"Asturian (Spain)", +"Southern Aymara (Peru)", +"Aymara (Peru)", +"Azerbaijani (Azerbaijan)", "Belarusian", "Belarusian (Belarus)", +"Bemba (Zambia)", +"Berber languages (Algeria)", +"Berber languages (Morocco)", "Bulgarian", "Bulgarian (Bulgaria)", +"Bhili (India)", +"Bhojpuri (India)", +"Bislama (Tuvalu)", "Bengali", "Bengali (Bangladesh)", "Bengali (India)", +"Tibetan", +"Tibetan (China)", +"Tibetan (India)", +"Breton (France)", +"Bodo (India)", +"Bosnian (Bosnia and Herzegovina)", +"Bilin (Eritrea)", "Catalan", +"Catalan (Andorra)", "Catalan (Spain)", +"Catalan (France)", +"Catalan (Italy)", +"Chechen (Russia)", +"Cherokee (United States)", +"Mandarin Chinese (Taiwan)", +"Crimean Tatar (Ukraine)", +"Kashubian (Poland)", "Czech", "Czech (Czech Republic)", +"Chuvash (Russia)", +"Welsh (United Kingdom)", "Danish", "Danish (Denmark)", "German", "German (Austria)", +"German (Belgium)", "German (Switzerland)", "German (Germany)", +"German (Italy)", "German (Luxembourg)", +"Dogri (India)", +"Dhivehi (Maldives)", +"Dzongkha (Bhutan)", "Greek", "Greek (Cyprus)", "Greek (Greece)", "English", +"English (Antigua and Barbuda)", "English (Australia)", +"English (Botswana)", "English (Canada)", +"English (Denmark)", "English (United Kingdom)", +"English (Hong Kong)", "English (Ireland)", +"English (Israel)", "English (India)", -"English (Malta)", +"English (Nigeria)", "English (New Zealand)", "English (Philippines)", "English (Singapore)", "English (United States)", "English (South Africa)", +"English (Zambia)", +"English (Zimbabwe)", +"Esperanto", "Spanish", "Spanish (Argentina)", "Spanish (Bolivia)", "Spanish (Chile)", "Spanish (Colombia)", "Spanish (Costa Rica)", +"Spanish (Cuba)", "Spanish (Dominican Republic)", "Spanish (Ecuador)", "Spanish (Spain)", @@ -269,91 +519,231 @@ static const char* locale_names[]={ "Spanish (Venezuela)", "Estonian", "Estonian (Estonia)", +"Basque", +"Basque (Spain)", +"Persian", +"Persian (Iran)", +"Fulah (Senegal)", "Finnish", "Finnish (Finland)", +"Filipino (Philippines)", +"Faroese (Faroe Islands)", "French", "French (Belgium)", "French (Canada)", "French (Switzerland)", "French (France)", "French (Luxembourg)", +"Friulian (Italy)", +"Western Frisian (Germany)", +"Western Frisian (Netherlands)", "Irish", "Irish (Ireland)", +"Scottish Gaelic (United Kingdom)", +"Geez (Eritrea)", +"Geez (Ethiopia)", +"Galician (Spain)", +"Gujarati (India)", +"Manx (United Kingdom)", +"Hakka Chinese (Taiwan)", +"Hausa (Nigeria)", +"Hebrew", +"Hebrew (Israel)", +"Hindi", "Hindi (India)", -"Hindi (India)", +"Chhattisgarhi (India)", "Croatian", "Croatian (Croatia)", +"Upper Sorbian (Germany)", +"Haitian (Haiti)", "Hungarian", "Hungarian (Hungary)", +"Huastec (Mexico)", +"Armenian (Armenia)", +"Interlingua (France)", "Indonesian", "Indonesian (Indonesia)", +"Igbo (Nigeria)", +"Inupiaq (Canada)", "Icelandic", "Icelandic (Iceland)", "Italian", "Italian (Switzerland)", "Italian (Italy)", -"Hebrew", -"Hebrew (Israel)", +"Inuktitut (Canada)", "Japanese", "Japanese (Japan)", -"Japanese (Japan JP)", +"Kabyle (Algeria)", +"Georgian (Georgia)", +"Kazakh (Kazakhstan)", +"Kalaallisut (Greenland)", +"Central Khmer (Cambodia)", +"Kannada (India)", +"Konkani (India)", "Korean", "Korean (South Korea)", +"Kashmiri (India)", +"Kurdish", +"Kurdish (Turkey)", +"Cornish (United Kingdom)", +"Kirghiz (Kyrgyzstan)", +"Luxembourgish (Luxembourg)", +"Ganda (Uganda)", +"Limburgan (Belgium)", +"Limburgan (Netherlands)", +"Ligurian (Italy)", +"Lingala (Congo)", +"Lao (Laos)", "Lithuanian", "Lithuanian (Lithuania)", "Latvian", "Latvian (Latvia)", +"Literary Chinese (Taiwan)", +"Magahi (India)", +"Maithili (India)", +"Malagasy (Madagascar)", +"Marshallese (Marshall Islands)", +"Eastern Mari (Russia)", +"Maori (New Zealand)", +"Mískito (Nicaragua)", "Macedonian", "Macedonian (Macedonia)", +"Malayalam (India)", +"Manipuri (India)", +"Mongolian (Mongolia)", +"Marathi (India)", "Malay", "Malay (Malaysia)", "Maltese", "Maltese (Malta)", +"Burmese (Myanmar)", +"Erzya (Russia)", +"Nahuatl languages (Mexico)", +"Min Nan Chinese (Taiwan)", +"Norwegian Bokmål", +"Norwegian Bokmål (Norway)", +"Low German (Germany)", +"Low German (Netherlands)", +"Nepali (Nepal)", +"Central Nahuatl (Mexico)", +"Niuean (Niue)", +"Niuean (New Zealand)", "Dutch", +"Dutch (Aruba)", "Dutch (Belgium)", "Dutch (Netherlands)", -"Norwegian", -"Norwegian (Norway)", -"Norwegian (Norway Nynorsk)", +"Norwegian Nynorsk", +"Norwegian Nynorsk (Norway)", +"South Ndebele (South Africa)", +"Pedi (South Africa)", +"Occitan (France)", +"Oromo", +"Oromo (Ethiopia)", +"Oromo (Kenya)", +"Oriya (India)", +"Ossetian (Russia)", +"Panjabi (India)", +"Papiamento", +"Papiamento (Netherlands Antilles)", +"Papiamento (Aruba)", +"Papiamento (Curaçao)", +"Panjabi (Pakistan)", "Polish", "Polish (Poland)", +"Pushto (Afghanistan)", "Portuguese", "Portuguese (Brazil)", "Portuguese (Portugal)", +"Ayacucho Quechua (Peru)", +"Cusco Quechua (Peru)", +"Rajasthani (India)", "Romanian", "Romanian (Romania)", "Russian", "Russian (Russia)", +"Russian (Ukraine)", +"Kinyarwanda (Rwanda)", +"Sanskrit (India)", +"Santali (India)", +"Sardinian (Italy)", +"Sindhi (India)", +"Northern Sami (Norway)", +"Samogitian (Lithuania)", +"Shuswap (Canada)", +"Sidamo (Ethiopia)", +"Sinhala (Sri Lanka)", "Slovak", "Slovak (Slovakia)", "Slovenian", "Slovenian (Slovenia)", +"Somali", +"Somali (Djibouti)", +"Somali (Ethiopia)", +"Somali (Kenya)", +"Somali (Somalia)", +"Songhai languages (Mali)", "Albanian", "Albanian (Albania)", +"Albanian (Kosovo)", +"Albanian (Macedonia)", "Serbian", -"Serbian (Bosnia and Herzegovina)", -"Serbian (Serbia and Montenegro)", "Serbian (Montenegro)", "Serbian (Serbia)", +"Swati (South Africa)", +"Southern Sotho (South Africa)", "Swedish", +"Swedish (Finland)", "Swedish (Sweden)", +"Swahili (Kenya)", +"Swahili (Tanzania)", +"Silesian (Poland)", +"Tamil", +"Tamil (India)", +"Tamil (Sri Lanka)", +"Tulu (India)", +"Telugu (India)", +"Tajik (Tajikistan)", +"Chitwania Tharu (Nepal)", "Thai", "Thai (Thailand)", -"Thai (Thailand TH)", +"Tigrinya", +"Tigrinya (Eritrea)", +"Tigrinya (Ethiopia)", +"Tigre (Eritrea)", +"Turkmen (Turkmenistan)", +"Tagalog (Philippines)", +"Tswana (South Africa)", "Turkish", +"Turkish (Cyprus)", "Turkish (Turkey)", +"Tsonga (South Africa)", +"Tatar (Russia)", +"Uighur (China)", "Ukrainian", "Ukrainian (Ukraine)", +"Unami (United States)", "Urdu", "Urdu (India)", "Urdu (Pakistan)", +"Uzbek", +"Uzbek (Uzbekistan)", +"Venda (South Africa)", "Vietnamese", "Vietnamese (Vietnam)", +"Walloon (Belgium)", +"Walser (Switzerland)", +"Wolaytta (Ethiopia)", +"Wolof (Senegal)", +"Xhosa (South Africa)", +"Yiddish (United States)", +"Yoruba (Nigeria)", +"Yue Chinese (Hong Kong)", "Chinese", "Chinese (China)", "Chinese (Hong Kong)", "Chinese (Singapore)", "Chinese (Taiwan)", +"Zulu (South Africa)", 0 }; diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index 99740b365c..e8a71d4991 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -490,13 +490,9 @@ void UndoRedo::_bind_methods() { mi.name="add_do_method"; mi.arguments.push_back( PropertyInfo( Variant::OBJECT, "object")); mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;++i) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"add_do_method",&UndoRedo::_add_do_method,mi,defargs); + + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"add_do_method",&UndoRedo::_add_do_method,mi); } { @@ -504,13 +500,9 @@ void UndoRedo::_bind_methods() { mi.name="add_undo_method"; mi.arguments.push_back( PropertyInfo( Variant::OBJECT, "object")); mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - Vector<Variant> defargs; - for(int i=0;i<VARIANT_ARG_MAX;++i) { - mi.arguments.push_back( PropertyInfo( Variant::NIL, "arg"+itos(i))); - defargs.push_back(Variant()); - } - ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"add_undo_method",&UndoRedo::_add_undo_method,mi,defargs); + + ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"add_undo_method",&UndoRedo::_add_undo_method,mi); } ObjectTypeDB::bind_method(_MD("add_do_property","object", "property", "value:Variant"),&UndoRedo::add_do_property); diff --git a/core/variant.h b/core/variant.h index b8b028a760..90be593bd9 100644 --- a/core/variant.h +++ b/core/variant.h @@ -426,7 +426,7 @@ public: static void get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_list); static void get_numeric_constants_for_type(Variant::Type p_type, List<StringName> *p_constants); static bool has_numeric_constant(Variant::Type p_type, const StringName& p_value); - static int get_numeric_constant_value(Variant::Type p_type, const StringName& p_value); + static int get_numeric_constant_value(Variant::Type p_type, const StringName& p_value,bool *r_valid=NULL); typedef String (*ObjectDeConstruct)(const Variant& p_object,void *ud); typedef void (*ObjectConstruct)(const String& p_text,void *ud,Variant& r_value); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 069c20bc6e..e7e71e8251 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -54,10 +54,10 @@ struct _VariantCall { int arg_count; Vector<Variant> default_args; Vector<Variant::Type> arg_types; - -#ifdef DEBUG_ENABLED Vector<StringName> arg_names; Variant::Type return_type; + +#ifdef DEBUG_ENABLED bool returns; #endif VariantFunc func; @@ -1324,14 +1324,22 @@ bool Variant::has_numeric_constant(Variant::Type p_type, const StringName& p_val return cd.value.has(p_value); } -int Variant::get_numeric_constant_value(Variant::Type p_type, const StringName& p_value) { +int Variant::get_numeric_constant_value(Variant::Type p_type, const StringName& p_value, bool *r_valid) { + + if (r_valid) + *r_valid=false; ERR_FAIL_INDEX_V(p_type,Variant::VARIANT_MAX,0); _VariantCall::ConstantData& cd = _VariantCall::constant_data[p_type]; Map<StringName,int>::Element *E = cd.value.find(p_value); - ERR_FAIL_COND_V(!E,0); + if (!E) { + return -1; + } + if (r_valid) + *r_valid=true; + return E->get(); } |