diff options
41 files changed, 586 insertions, 187 deletions
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/script_language.h b/core/script_language.h index 25767a2f7a..c243ef781b 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -202,6 +202,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/doc/classes/@Global Scope.xml b/doc/classes/@Global Scope.xml index 9d0133faf4..20f323bb4f 100644 --- a/doc/classes/@Global Scope.xml +++ b/doc/classes/@Global Scope.xml @@ -863,199 +863,199 @@ <constant name="KEY_MASK_GROUP_SWITCH" value="1073741824"> Group Switch Key Mask </constant> - <constant name="BUTTON_LEFT" value="1" enum=""> + <constant name="BUTTON_LEFT" value="1"> Left Mouse Button </constant> - <constant name="BUTTON_RIGHT" value="2" enum=""> + <constant name="BUTTON_RIGHT" value="2"> Right Mouse Button </constant> - <constant name="BUTTON_MIDDLE" value="3" enum=""> + <constant name="BUTTON_MIDDLE" value="3"> Middle Mouse Button </constant> - <constant name="BUTTON_WHEEL_UP" value="4" enum=""> + <constant name="BUTTON_WHEEL_UP" value="4"> Mouse wheel up </constant> - <constant name="BUTTON_WHEEL_DOWN" value="5" enum=""> + <constant name="BUTTON_WHEEL_DOWN" value="5"> Mouse wheel down </constant> - <constant name="BUTTON_WHEEL_LEFT" value="6" enum=""> + <constant name="BUTTON_WHEEL_LEFT" value="6"> Mouse wheel left button </constant> - <constant name="BUTTON_WHEEL_RIGHT" value="7" enum=""> + <constant name="BUTTON_WHEEL_RIGHT" value="7"> Mouse wheel right button </constant> - <constant name="BUTTON_MASK_LEFT" value="1" enum=""> + <constant name="BUTTON_MASK_LEFT" value="1"> Left Mouse Button Mask </constant> - <constant name="BUTTON_MASK_RIGHT" value="2" enum=""> + <constant name="BUTTON_MASK_RIGHT" value="2"> Right Mouse Button Mask </constant> - <constant name="BUTTON_MASK_MIDDLE" value="4" enum=""> + <constant name="BUTTON_MASK_MIDDLE" value="4"> Middle Mouse Button Mask </constant> - <constant name="JOY_BUTTON_0" value="0" enum=""> + <constant name="JOY_BUTTON_0" value="0"> Joypad Button 0 </constant> - <constant name="JOY_BUTTON_1" value="1" enum=""> + <constant name="JOY_BUTTON_1" value="1"> Joypad Button 1 </constant> - <constant name="JOY_BUTTON_2" value="2" enum=""> + <constant name="JOY_BUTTON_2" value="2"> Joypad Button 2 </constant> - <constant name="JOY_BUTTON_3" value="3" enum=""> + <constant name="JOY_BUTTON_3" value="3"> Joypad Button 3 </constant> - <constant name="JOY_BUTTON_4" value="4" enum=""> + <constant name="JOY_BUTTON_4" value="4"> Joypad Button 4 </constant> - <constant name="JOY_BUTTON_5" value="5" enum=""> + <constant name="JOY_BUTTON_5" value="5"> Joypad Button 5 </constant> - <constant name="JOY_BUTTON_6" value="6" enum=""> + <constant name="JOY_BUTTON_6" value="6"> Joypad Button 6 </constant> - <constant name="JOY_BUTTON_7" value="7" enum=""> + <constant name="JOY_BUTTON_7" value="7"> Joypad Button 7 </constant> - <constant name="JOY_BUTTON_8" value="8" enum=""> + <constant name="JOY_BUTTON_8" value="8"> Joypad Button 8 </constant> - <constant name="JOY_BUTTON_9" value="9" enum=""> + <constant name="JOY_BUTTON_9" value="9"> Joypad Button 9 </constant> - <constant name="JOY_BUTTON_10" value="10" enum=""> + <constant name="JOY_BUTTON_10" value="10"> Joypad Button 10 </constant> - <constant name="JOY_BUTTON_11" value="11" enum=""> + <constant name="JOY_BUTTON_11" value="11"> Joypad Button 11 </constant> - <constant name="JOY_BUTTON_12" value="12" enum=""> + <constant name="JOY_BUTTON_12" value="12"> Joypad Button 12 </constant> - <constant name="JOY_BUTTON_13" value="13" enum=""> + <constant name="JOY_BUTTON_13" value="13"> Joypad Button 13 </constant> - <constant name="JOY_BUTTON_14" value="14" enum=""> + <constant name="JOY_BUTTON_14" value="14"> Joypad Button 14 </constant> - <constant name="JOY_BUTTON_15" value="15" enum=""> + <constant name="JOY_BUTTON_15" value="15"> Joypad Button 15 </constant> - <constant name="JOY_BUTTON_MAX" value="16" enum=""> + <constant name="JOY_BUTTON_MAX" value="16"> Joypad Button 16 </constant> - <constant name="JOY_SONY_CIRCLE" value="1" enum=""> + <constant name="JOY_SONY_CIRCLE" value="1"> DUALSHOCK circle button </constant> - <constant name="JOY_SONY_X" value="0" enum=""> + <constant name="JOY_SONY_X" value="0"> DUALSHOCK X button </constant> - <constant name="JOY_SONY_SQUARE" value="2" enum=""> + <constant name="JOY_SONY_SQUARE" value="2"> DUALSHOCK square button </constant> - <constant name="JOY_SONY_TRIANGLE" value="3" enum=""> + <constant name="JOY_SONY_TRIANGLE" value="3"> DUALSHOCK triangle button </constant> - <constant name="JOY_XBOX_B" value="1" enum=""> + <constant name="JOY_XBOX_B" value="1"> XBOX controller B button </constant> - <constant name="JOY_XBOX_A" value="0" enum=""> + <constant name="JOY_XBOX_A" value="0"> XBOX controller A button </constant> - <constant name="JOY_XBOX_X" value="2" enum=""> + <constant name="JOY_XBOX_X" value="2"> XBOX controller X button </constant> - <constant name="JOY_XBOX_Y" value="3" enum=""> + <constant name="JOY_XBOX_Y" value="3"> XBOX controller Y button </constant> - <constant name="JOY_DS_A" value="1" enum=""> + <constant name="JOY_DS_A" value="1"> DualShock controller A button </constant> - <constant name="JOY_DS_B" value="0" enum=""> + <constant name="JOY_DS_B" value="0"> DualShock controller B button </constant> - <constant name="JOY_DS_X" value="3" enum=""> + <constant name="JOY_DS_X" value="3"> DualShock controller X button </constant> - <constant name="JOY_DS_Y" value="2" enum=""> + <constant name="JOY_DS_Y" value="2"> DualShock controller Y button </constant> - <constant name="JOY_SELECT" value="10" enum=""> + <constant name="JOY_SELECT" value="10"> Joypad Button Select </constant> - <constant name="JOY_START" value="11" enum=""> + <constant name="JOY_START" value="11"> Joypad Button Start </constant> - <constant name="JOY_DPAD_UP" value="12" enum=""> + <constant name="JOY_DPAD_UP" value="12"> Joypad DPad Up </constant> - <constant name="JOY_DPAD_DOWN" value="13" enum=""> + <constant name="JOY_DPAD_DOWN" value="13"> Joypad DPad Down </constant> - <constant name="JOY_DPAD_LEFT" value="14" enum=""> + <constant name="JOY_DPAD_LEFT" value="14"> Joypad DPad Left </constant> - <constant name="JOY_DPAD_RIGHT" value="15" enum=""> + <constant name="JOY_DPAD_RIGHT" value="15"> Joypad DPad Right </constant> - <constant name="JOY_L" value="4" enum=""> + <constant name="JOY_L" value="4"> Joypad Left Shoulder Button </constant> - <constant name="JOY_L2" value="6" enum=""> + <constant name="JOY_L2" value="6"> Joypad Left Trigger </constant> - <constant name="JOY_L3" value="8" enum=""> + <constant name="JOY_L3" value="8"> Joypad Left Stick Click </constant> - <constant name="JOY_R" value="5" enum=""> + <constant name="JOY_R" value="5"> Joypad Right Shoulder Button </constant> - <constant name="JOY_R2" value="7" enum=""> + <constant name="JOY_R2" value="7"> Joypad Right Trigger </constant> - <constant name="JOY_R3" value="9" enum=""> + <constant name="JOY_R3" value="9"> Joypad Right Stick Click </constant> - <constant name="JOY_AXIS_0" value="0" enum=""> + <constant name="JOY_AXIS_0" value="0"> Joypad Left Stick Horizontal Axis </constant> - <constant name="JOY_AXIS_1" value="1" enum=""> + <constant name="JOY_AXIS_1" value="1"> Joypad Left Stick Vertical Axis </constant> - <constant name="JOY_AXIS_2" value="2" enum=""> + <constant name="JOY_AXIS_2" value="2"> Joypad Right Stick Horizontal Axis </constant> - <constant name="JOY_AXIS_3" value="3" enum=""> + <constant name="JOY_AXIS_3" value="3"> Joypad Right Stick Vertical Axis </constant> - <constant name="JOY_AXIS_4" value="4" enum=""> + <constant name="JOY_AXIS_4" value="4"> </constant> - <constant name="JOY_AXIS_5" value="5" enum=""> + <constant name="JOY_AXIS_5" value="5"> </constant> - <constant name="JOY_AXIS_6" value="6" enum=""> + <constant name="JOY_AXIS_6" value="6"> Joypad Left Trigger Analog Axis </constant> - <constant name="JOY_AXIS_7" value="7" enum=""> + <constant name="JOY_AXIS_7" value="7"> Joypad Right Trigger Analog Axis </constant> - <constant name="JOY_AXIS_MAX" value="8" enum=""> + <constant name="JOY_AXIS_MAX" value="8"> </constant> - <constant name="JOY_ANALOG_LX" value="0" enum=""> + <constant name="JOY_ANALOG_LX" value="0"> Joypad Left Stick Horizontal Axis </constant> - <constant name="JOY_ANALOG_LY" value="1" enum=""> + <constant name="JOY_ANALOG_LY" value="1"> Joypad Left Stick Vertical Axis </constant> - <constant name="JOY_ANALOG_RX" value="2" enum=""> + <constant name="JOY_ANALOG_RX" value="2"> Joypad Right Stick Horizontal Axis </constant> - <constant name="JOY_ANALOG_RY" value="3" enum=""> + <constant name="JOY_ANALOG_RY" value="3"> Joypad Right Stick Vertical Axis </constant> - <constant name="JOY_ANALOG_L2" value="6" enum=""> + <constant name="JOY_ANALOG_L2" value="6"> Joypad Left Analog Trigger </constant> - <constant name="JOY_ANALOG_R2" value="7" enum=""> + <constant name="JOY_ANALOG_R2" value="7"> Joypad Right Analog Trigger </constant> <constant name="OK" value="0"> @@ -1377,7 +1377,7 @@ Variable is of type [PoolColorArray]. </constant> <constant name="TYPE_MAX" value="27"> - </constant> Marker for end of type constants. + </constant> </constants> </class> diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index da8f0f235b..c276a8f661 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -39,8 +39,8 @@ return [{"name": "my_option", "default_value": false}] func load(src, dst, opts, r_platform_variants, r_gen_files): - var f = File.new() - if f.open(src, File.READ) != OK: + var file = File.new() + if file.open(src, File.READ) != OK: return FAILED var mesh = Mesh.new() diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml index 2918200633..4d40d5af9a 100644 --- a/doc/classes/Environment.xml +++ b/doc/classes/Environment.xml @@ -238,6 +238,12 @@ <description> </description> </method> + <method name="get_ssao_blur" qualifiers="const"> + <return type="int" enum="Environment.SSAOBlur"> + </return> + <description> + </description> + </method> <method name="get_ssao_color" qualifiers="const"> <return type="Color"> </return> @@ -250,6 +256,12 @@ <description> </description> </method> + <method name="get_ssao_edge_sharpness" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="get_ssao_intensity" qualifiers="const"> <return type="float"> </return> @@ -262,6 +274,12 @@ <description> </description> </method> + <method name="get_ssao_quality" qualifiers="const"> + <return type="int" enum="Environment.SSAOQuality"> + </return> + <description> + </description> + </method> <method name="get_ssao_radius" qualifiers="const"> <return type="float"> </return> @@ -408,12 +426,6 @@ <description> </description> </method> - <method name="is_ssao_blur_enabled" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="is_ssao_enabled" qualifiers="const"> <return type="bool"> </return> @@ -813,7 +825,7 @@ <method name="set_ssao_blur"> <return type="void"> </return> - <argument index="0" name="enabled" type="bool"> + <argument index="0" name="mode" type="int" enum="Environment.SSAOBlur"> </argument> <description> </description> @@ -834,6 +846,14 @@ <description> </description> </method> + <method name="set_ssao_edge_sharpness"> + <return type="void"> + </return> + <argument index="0" name="edge_sharpness" type="float"> + </argument> + <description> + </description> + </method> <method name="set_ssao_enabled"> <return type="void"> </return> @@ -858,6 +878,14 @@ <description> </description> </method> + <method name="set_ssao_quality"> + <return type="void"> + </return> + <argument index="0" name="quality" type="int" enum="Environment.SSAOQuality"> + </argument> + <description> + </description> + </method> <method name="set_ssao_radius"> <return type="void"> </return> @@ -1172,10 +1200,12 @@ </member> <member name="ssao_bias" type="float" setter="set_ssao_bias" getter="get_ssao_bias"> </member> - <member name="ssao_blur" type="bool" setter="set_ssao_blur" getter="is_ssao_blur_enabled"> + <member name="ssao_blur" type="int" setter="set_ssao_blur" getter="is_ssao_blur_enabled" enum="Environment.SSAOBlur"> </member> <member name="ssao_color" type="Color" setter="set_ssao_color" getter="get_ssao_color"> </member> + <member name="ssao_edge_sharpness" type="float" setter="set_ssao_edge_sharpness" getter="get_ssao_edge_sharpness"> + </member> <member name="ssao_enabled" type="bool" setter="set_ssao_enabled" getter="is_ssao_enabled"> </member> <member name="ssao_intensity" type="float" setter="set_ssao_intensity" getter="get_ssao_intensity"> @@ -1184,6 +1214,8 @@ </member> <member name="ssao_light_affect" type="float" setter="set_ssao_direct_light_affect" getter="get_ssao_direct_light_affect"> </member> + <member name="ssao_quality" type="int" setter="set_ssao_quality" getter="get_ssao_quality" enum="Environment.SSAOQuality"> + </member> <member name="ssao_radius" type="float" setter="set_ssao_radius" getter="get_ssao_radius"> </member> <member name="ssao_radius2" type="float" setter="set_ssao_radius2" getter="get_ssao_radius2"> @@ -1253,5 +1285,19 @@ <constant name="DOF_BLUR_QUALITY_HIGH" value="2"> High depth-of-field blur quality. </constant> + <constant name="SSAO_BLUR_DISABLED" value="0"> + </constant> + <constant name="SSAO_BLUR_1x1" value="1"> + </constant> + <constant name="SSAO_BLUR_2x2" value="2"> + </constant> + <constant name="SSAO_BLUR_3x3" value="3"> + </constant> + <constant name="SSAO_QUALITY_LOW" value="0"> + </constant> + <constant name="SSAO_QUALITY_MEDIUM" value="1"> + </constant> + <constant name="SSAO_QUALITY_HIGH" value="2"> + </constant> </constants> </class> diff --git a/doc/classes/ParallaxLayer.xml b/doc/classes/ParallaxLayer.xml index 8de7e05578..f1e6f9e046 100644 --- a/doc/classes/ParallaxLayer.xml +++ b/doc/classes/ParallaxLayer.xml @@ -64,7 +64,7 @@ The ParallaxLayer's [Texture] mirroring. Useful for creating an infinite scrolling background. If an axis is set to [code]0[/code] the [Texture] will not be mirrored. Default value: [code](0, 0)[/code]. </member> <member name="motion_offset" type="Vector2" setter="set_motion_offset" getter="get_motion_offset"> - The ParallaxLayer's offset relative to the parent ParallaxBackground's [member ParallaxBackground.scroll_offset]. + The ParallaxLayer's offset relative to the parent ParallaxBackground's [member ParallaxBackground.scroll_offset]. </member> <member name="motion_scale" type="Vector2" setter="set_motion_scale" getter="get_motion_scale"> Multiplies the ParallaxLayer's motion. If an axis is set to [code]0[/code] it will not scroll. diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml index d351cdfbc0..056d7d10fa 100644 --- a/doc/classes/Quat.xml +++ b/doc/classes/Quat.xml @@ -127,7 +127,7 @@ <argument index="1" name="t" type="float"> </argument> <description> - Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°. + Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°. </description> </method> <method name="xform"> diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast.xml index fc96a183eb..3f999f7fe2 100644 --- a/doc/classes/RayCast.xml +++ b/doc/classes/RayCast.xml @@ -85,6 +85,14 @@ Returns the collision mask for this ray. </description> </method> + <method name="get_collision_mask_bit" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="bit" type="int"> + </argument> + <description> + </description> + </method> <method name="get_collision_normal" qualifiers="const"> <return type="Vector3"> </return> @@ -156,6 +164,16 @@ Set the mask to filter objects. Only objects in at least one collision layer enabled in the mask will be detected. </description> </method> + <method name="set_collision_mask_bit"> + <return type="void"> + </return> + <argument index="0" name="bit" type="int"> + </argument> + <argument index="1" name="value" type="bool"> + </argument> + <description> + </description> + </method> <method name="set_enabled"> <return type="void"> </return> diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml index 8fef07a859..45a83f7ded 100644 --- a/doc/classes/RayCast2D.xml +++ b/doc/classes/RayCast2D.xml @@ -84,6 +84,14 @@ Returns the collision mask for this ray. </description> </method> + <method name="get_collision_mask_bit" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="bit" type="int"> + </argument> + <description> + </description> + </method> <method name="get_collision_normal" qualifiers="const"> <return type="Vector2"> </return> @@ -162,6 +170,16 @@ Set the mask to filter objects. Only objects in at least one collision layer enabled in the mask will be detected. </description> </method> + <method name="set_collision_mask_bit"> + <return type="void"> + </return> + <argument index="0" name="bit" type="int"> + </argument> + <argument index="1" name="value" type="bool"> + </argument> + <description> + </description> + </method> <method name="set_enabled"> <return type="void"> </return> diff --git a/doc/classes/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/editor/editor_settings.cpp b/editor/editor_settings.cpp index 64febd24ba..799a8a2eb8 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -706,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/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/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/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..e424d32575 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -908,6 +908,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..e6ea4fed80 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -271,6 +271,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/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 9d37703357..bcb998aee0 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -131,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.h b/modules/gdscript/gd_script.h index 5e1a8b19ac..6573d6b345 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -386,6 +386,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 7143177c3f..855f7e9670 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -286,11 +286,13 @@ Ref<Script> CSharpLanguage::get_template(const String &p_class_name, const Strin "// }\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; } @@ -302,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) { diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 6b8475fb61..8700b7fc5c 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -270,6 +270,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 1d1bcfb03f..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; } @@ -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/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 48145495e4..6d8ee2bd47 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2412,6 +2412,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..f2f5168b63 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -569,6 +569,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/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/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 3bdfe097c9..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" |