diff options
69 files changed, 619 insertions, 132 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index dbfa04be4d..8a898f3b53 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -308,6 +308,14 @@ void _OS::set_window_position(const Point2 &p_position) { OS::get_singleton()->set_window_position(p_position); } +Size2 _OS::get_max_window_size() const { + return OS::get_singleton()->get_max_window_size(); +} + +Size2 _OS::get_min_window_size() const { + return OS::get_singleton()->get_min_window_size(); +} + Size2 _OS::get_window_size() const { return OS::get_singleton()->get_window_size(); } @@ -316,6 +324,14 @@ Size2 _OS::get_real_window_size() const { return OS::get_singleton()->get_real_window_size(); } +void _OS::set_max_window_size(const Size2 &p_size) { + OS::get_singleton()->set_max_window_size(p_size); +} + +void _OS::set_min_window_size(const Size2 &p_size) { + OS::get_singleton()->set_min_window_size(p_size); +} + void _OS::set_window_size(const Size2 &p_size) { OS::get_singleton()->set_window_size(p_size); } @@ -1139,6 +1155,10 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_window_position"), &_OS::get_window_position); ClassDB::bind_method(D_METHOD("set_window_position", "position"), &_OS::set_window_position); ClassDB::bind_method(D_METHOD("get_window_size"), &_OS::get_window_size); + ClassDB::bind_method(D_METHOD("get_max_window_size"), &_OS::get_max_window_size); + ClassDB::bind_method(D_METHOD("get_min_window_size"), &_OS::get_min_window_size); + ClassDB::bind_method(D_METHOD("set_max_window_size", "size"), &_OS::set_max_window_size); + ClassDB::bind_method(D_METHOD("set_min_window_size", "size"), &_OS::set_min_window_size); ClassDB::bind_method(D_METHOD("set_window_size", "size"), &_OS::set_window_size); ClassDB::bind_method(D_METHOD("get_window_safe_area"), &_OS::get_window_safe_area); ClassDB::bind_method(D_METHOD("set_window_fullscreen", "enabled"), &_OS::set_window_fullscreen); @@ -1284,6 +1304,8 @@ void _OS::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vsync_enabled"), "set_use_vsync", "is_vsync_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "low_processor_usage_mode"), "set_low_processor_usage_mode", "is_in_low_processor_usage_mode"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_screen_on"), "set_keep_screen_on", "is_keep_screen_on"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "min_window_size"), "set_min_window_size", "get_min_window_size"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "max_window_size"), "set_max_window_size", "get_max_window_size"); ADD_PROPERTY(PropertyInfo(Variant::INT, "screen_orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"), "set_screen_orientation", "get_screen_orientation"); ADD_GROUP("Window", "window_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_borderless"), "set_borderless_window", "get_borderless_window"); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 8f74d88be5..2751ff242c 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -175,9 +175,13 @@ public: virtual int get_screen_dpi(int p_screen = -1) const; virtual Point2 get_window_position() const; virtual void set_window_position(const Point2 &p_position); + virtual Size2 get_max_window_size() const; + virtual Size2 get_min_window_size() const; virtual Size2 get_window_size() const; virtual Size2 get_real_window_size() const; virtual Rect2 get_window_safe_area() const; + virtual void set_max_window_size(const Size2 &p_size); + virtual void set_min_window_size(const Size2 &p_size); virtual void set_window_size(const Size2 &p_size); virtual void set_window_fullscreen(bool p_enabled); virtual bool is_window_fullscreen() const; diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 0b6e9ae929..359446dde6 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -435,10 +435,16 @@ PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { } void AStar::set_point_disabled(int p_id, bool p_disabled) { + + ERR_FAIL_COND(!points.has(p_id)); + points[p_id]->enabled = !p_disabled; } bool AStar::is_point_disabled(int p_id) const { + + ERR_FAIL_COND_V(!points.has(p_id), false); + return !points[p_id]->enabled; } diff --git a/core/os/os.h b/core/os/os.h index b128e6424c..514e1e2ad3 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -205,8 +205,12 @@ public: virtual int get_screen_dpi(int p_screen = -1) const { return 72; } virtual Point2 get_window_position() const { return Vector2(); } virtual void set_window_position(const Point2 &p_position) {} + virtual Size2 get_max_window_size() const { return Size2(); }; + virtual Size2 get_min_window_size() const { return Size2(); }; virtual Size2 get_window_size() const = 0; virtual Size2 get_real_window_size() const { return get_window_size(); } + virtual void set_min_window_size(const Size2 p_size) {} + virtual void set_max_window_size(const Size2 p_size) {} virtual void set_window_size(const Size2 p_size) {} virtual void set_window_fullscreen(bool p_enabled) {} virtual bool is_window_fullscreen() const { return true; } diff --git a/doc/classes/CPUParticles2D.xml b/doc/classes/CPUParticles2D.xml index 4351a0b4d4..e6df2d2f27 100644 --- a/doc/classes/CPUParticles2D.xml +++ b/doc/classes/CPUParticles2D.xml @@ -270,8 +270,8 @@ <constant name="EMISSION_SHAPE_POINT" value="0" enum="EmissionShape"> All particles will be emitted from a single point. </constant> - <constant name="EMISSION_SHAPE_CIRCLE" value="1" enum="EmissionShape"> - Particles will be emitted on the perimeter of a circle. + <constant name="EMISSION_SHAPE_SPHERE" value="1" enum="EmissionShape"> + Particles will be emitted on the surface of a sphere flattened to two dimensions. </constant> <constant name="EMISSION_SHAPE_RECTANGLE" value="2" enum="EmissionShape"> Particles will be emitted in the area of a rectangle. diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index ba3a7fe6d8..f86897a6f0 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -46,7 +46,7 @@ <return type="void"> </return> <description> - Ensure selection is visible, adjusting the scroll position as necessary. + Ensure current selection is visible, adjusting the scroll position as necessary. </description> </method> <method name="get_item_at_position" qualifiers="const"> @@ -64,7 +64,7 @@ <return type="int"> </return> <description> - Returns count of items currently in the item list. + Returns the number of items currently in the list. </description> </method> <method name="get_item_custom_bg_color" qualifiers="const"> @@ -73,6 +73,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the [Color] set by [member set_custom_bg_color]. Default value is [code]Color(0, 0, 0, 0)[/code]. </description> </method> <method name="get_item_custom_fg_color" qualifiers="const"> @@ -81,6 +82,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the [Color] set by [member set_custom_fg_color]. Default value is [code]Color(0, 0, 0, 0)[/code]. </description> </method> <method name="get_item_icon" qualifiers="const"> @@ -89,6 +91,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the icon associated with the specified index. Default value is [code]null[/code] </description> </method> <method name="get_item_icon_modulate" qualifiers="const"> @@ -114,6 +117,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the metadata value of the specified index set by [member set_item_metadata]. </description> </method> <method name="get_item_text" qualifiers="const"> @@ -122,7 +126,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns the text for specified item index. + Returns the text associated with the specified index. </description> </method> <method name="get_item_tooltip" qualifiers="const"> @@ -131,21 +135,21 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns tooltip hint for specified item index. + Returns the tooltip hint associated with the specified index. </description> </method> <method name="get_selected_items"> <return type="PoolIntArray"> </return> <description> - Returns the list of selected indexes. + Returns an array with the indexes of the selected items. </description> </method> <method name="get_v_scroll"> <return type="VScrollBar"> </return> <description> - Returns the current vertical scroll bar for the List. + Returns the [Object] ID associated with the list. </description> </method> <method name="is_anything_selected"> @@ -161,7 +165,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns whether or not the item at the specified index is disabled + Returns whether or not the item at the specified index is disabled. </description> </method> <method name="is_item_icon_transposed" qualifiers="const"> @@ -207,7 +211,7 @@ <argument index="1" name="to_idx" type="int"> </argument> <description> - Moves item at index [code]from_idx[/code] to [code]to_idx[/code]. + Moves item from index [code]from_idx[/code] to [code]to_idx[/code]. </description> </method> <method name="remove_item"> @@ -216,7 +220,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Remove item at specified index from the list. + Removes the item specified by [code]idx[/code] index from the list. </description> </method> <method name="select"> @@ -239,6 +243,11 @@ <argument index="1" name="custom_bg_color" type="Color"> </argument> <description> + Sets the background color of the item specified by [code]idx[/code] index to the specified [Color]. + [codeblock] + var some_string = "Some text" + some_string.set_item_custom_bg_color(0,Color(1, 0, 0, 1) # This will set the background color of the first item of the control to red. + [/codeblock] </description> </method> <method name="set_item_custom_fg_color"> @@ -249,6 +258,11 @@ <argument index="1" name="custom_fg_color" type="Color"> </argument> <description> + Sets the foreground color of the item specified by [code]idx[/code] index to the specified [Color]. + [codeblock] + var some_string = "Some text" + some_string.set_item_custom_fg_color(0,Color(1, 0, 0, 1) # This will set the foreground color of the first item of the control to red. + [/codeblock] </description> </method> <method name="set_item_disabled"> @@ -259,8 +273,8 @@ <argument index="1" name="disabled" type="bool"> </argument> <description> - Disable (or enable) item at specified index. - Disabled items are not be selectable and do not fire activation (Enter or double-click) signals. + Disable (or enable) item at the specified index. + Disabled items are not be selectable and do not trigger activation (Enter or double-click) signals. </description> </method> <method name="set_item_icon"> @@ -271,7 +285,7 @@ <argument index="1" name="icon" type="Texture"> </argument> <description> - Set (or replace) icon of the item at the specified index. + Set (or replace) the icon's [Texture] associated with the specified index. </description> </method> <method name="set_item_icon_modulate"> @@ -282,7 +296,7 @@ <argument index="1" name="modulate" type="Color"> </argument> <description> - Sets a modulating [Color] for item's icon at the specified index. + Sets a modulating [Color] of the item associated with the specified index. </description> </method> <method name="set_item_icon_region"> @@ -313,7 +327,7 @@ <argument index="1" name="metadata" type="Variant"> </argument> <description> - Sets a value (of any type) to be stored with the item at the specified index. + Sets a value (of any type) to be stored with the item associated with the specified index. </description> </method> <method name="set_item_selectable"> @@ -324,7 +338,7 @@ <argument index="1" name="selectable" type="bool"> </argument> <description> - Allow or disallow selection of the item at the specified index. + Allow or disallow selection of the item associated with the specified index. </description> </method> <method name="set_item_text"> @@ -335,7 +349,7 @@ <argument index="1" name="text" type="String"> </argument> <description> - Sets text of item at specified index. + Sets text of the item associated with the specified index. </description> </method> <method name="set_item_tooltip"> @@ -346,7 +360,7 @@ <argument index="1" name="tooltip" type="String"> </argument> <description> - Sets tooltip hint for item at specified index. + Sets tooltip hint for the item associated with the specified index. </description> </method> <method name="set_item_tooltip_enabled"> @@ -357,7 +371,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> - Sets whether the tooltip is enabled for specified item index. + Sets whether the tooltip hint is enabled for specified item index. </description> </method> <method name="sort_items_by_text"> @@ -373,7 +387,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Ensure item at specified index is not selected. + Ensure the item associated with the specified index is not selected. </description> </method> <method name="unselect_all"> @@ -386,29 +400,38 @@ </methods> <members> <member name="allow_reselect" type="bool" setter="set_allow_reselect" getter="get_allow_reselect"> - If [code]true[/code], the currently selected item may be selected again. + If [code]true[/code], the currently selected item can be selected again. </member> <member name="allow_rmb_select" type="bool" setter="set_allow_rmb_select" getter="get_allow_rmb_select"> - If [code]true[/code], a right mouse button click can select items. + If [code]true[/code], right mouse button click can select items. </member> <member name="auto_height" type="bool" setter="set_auto_height" getter="has_auto_height"> + If [code]true[/code], the control will automatically resize the height to fit its content. </member> <member name="fixed_column_width" type="int" setter="set_fixed_column_width" getter="get_fixed_column_width"> + Sets the default column width in pixels. + If left to default value, each item will have a width equal to the width of its content and the columns will have an uneven width. </member> <member name="fixed_icon_size" type="Vector2" setter="set_fixed_icon_size" getter="get_fixed_icon_size"> + Sets the default icon size in pixels. </member> <member name="icon_mode" type="int" setter="set_icon_mode" getter="get_icon_mode" enum="ItemList.IconMode"> + Sets the default position of the icon to either [const ICON_MODE_LEFT] or [const ICON_MODE_TOP]. </member> <member name="icon_scale" type="float" setter="set_icon_scale" getter="get_icon_scale"> + Sets the icon size to its initial size multiplied by the specified scale. Default value is 1.0. </member> <member name="max_columns" type="int" setter="set_max_columns" getter="get_max_columns"> + Sets the maximum columns the list will have. + If set to anything other than the default, the content will be split among the specified columns. </member> <member name="max_text_lines" type="int" setter="set_max_text_lines" getter="get_max_text_lines"> </member> <member name="same_column_width" type="bool" setter="set_same_column_width" getter="is_same_column_width"> + If set to [code]true[/code], all columns will have the same width specified by [member fixed_column_width]. </member> <member name="select_mode" type="int" setter="set_select_mode" getter="get_select_mode" enum="ItemList.SelectMode"> - Allow single or multiple selection. See the [code]SELECT_*[/code] constants. + Allow single or multiple item selection. See the [code]SELECT_*[/code] constants. </member> </members> <signals> @@ -416,7 +439,7 @@ <argument index="0" name="index" type="int"> </argument> <description> - Fired when specified list item is activated via double click or Enter. + Triggered when specified list item is activated via double click or Enter. </description> </signal> <signal name="item_rmb_selected"> @@ -425,7 +448,7 @@ <argument index="1" name="at_position" type="Vector2"> </argument> <description> - Fired when specified list item has been selected via right mouse clicking. + Triggered when specified list item has been selected via right mouse clicking. The click position is also provided to allow appropriate popup of context menus at the correct location. [member allow_rmb_select] must be enabled. @@ -435,7 +458,7 @@ <argument index="0" name="index" type="int"> </argument> <description> - Fired when specified item has been selected. + Triggered when specified item has been selected. [member allow_reselect] must be enabled to reselect an item. </description> </signal> @@ -445,17 +468,20 @@ <argument index="1" name="selected" type="bool"> </argument> <description> - Fired when a multiple selection is altered on a list allowing multiple selection. + Triggered when a multiple selection is altered on a list allowing multiple selection. </description> </signal> <signal name="nothing_selected"> <description> + Triggered when a left mouse click is issued within the rect of the list but on empty space. </description> </signal> <signal name="rmb_clicked"> <argument index="0" name="at_position" type="Vector2"> </argument> <description> + Triggered when a right mouse click is issued within the rect of the list but on empty space. + [member allow_rmb_select] must be enabled. </description> </signal> </signals> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index e994c24582..2c680e828e 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -811,6 +811,12 @@ <member name="low_processor_usage_mode" type="bool" setter="set_low_processor_usage_mode" getter="is_in_low_processor_usage_mode"> If [code]true[/code], the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile. </member> + <member name="min_window_size" type="Vector2" setter="set_min_window_size" getter="get_min_window_size"> + The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. + </member> + <member name="max_window_size" type="Vector2" setter="set_max_window_size" getter="get_max_window_size"> + The maximum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. + </member> <member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="_OS.ScreenOrientation"> The current screen orientation. </member> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index 8ca553ccb8..3e4b70f8f8 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -32,7 +32,7 @@ <argument index="1" name="color" type="Color"> </argument> <description> - Add a keyword and its color. + Add a [code]keyword[/code] and its [Color]. </description> </method> <method name="can_fold" qualifiers="const"> @@ -48,21 +48,21 @@ <return type="void"> </return> <description> - Clear all the syntax coloring information. + Clears all the syntax coloring information. </description> </method> <method name="clear_undo_history"> <return type="void"> </return> <description> - Clear the undo history. + Clears the undo history. </description> </method> <method name="copy"> <return type="void"> </return> <description> - Copy the current selection. + Copy's the current text selection. </description> </method> <method name="cursor_get_column" qualifiers="const"> @@ -87,6 +87,8 @@ <argument index="1" name="adjust_viewport" type="bool" default="true"> </argument> <description> + Moves the cursor at the specified [code]column[/code] index. + If [code]adjust_viewport[/code] is set to true, the viewport will center at the cursor position after the move occurs. Default value is [code]true[/code]. </description> </method> <method name="cursor_set_line"> @@ -101,20 +103,23 @@ <argument index="3" name="wrap_index" type="int" default="0"> </argument> <description> + Moves the cursor at the specified [code]line[/code] index. + If [code]adjust_viewport[/code] is set to true, the viewport will center at the cursor position after the move occurs. Default value is [code]true[/code]. + If [code]can_be_hidden[/code] is set to true, the specified [code]line[/code] can be hidden using [member set_line_as_hidden]. Default value is [code]true[/code]. </description> </method> <method name="cut"> <return type="void"> </return> <description> - Cut the current selection. + Cut's the current selection. </description> </method> <method name="deselect"> <return type="void"> </return> <description> - Clears the current selection. + Deselects the current selection. </description> </method> <method name="fold_all_lines"> @@ -146,6 +151,7 @@ <argument index="0" name="keyword" type="String"> </argument> <description> + Returns the [Color] of the specified [code]keyword[/code]. </description> </method> <method name="get_line" qualifiers="const"> @@ -210,6 +216,7 @@ <return type="String"> </return> <description> + Returns a [String] text with the word under the mouse cursor location. </description> </method> <method name="has_keyword_color" qualifiers="const"> @@ -218,6 +225,7 @@ <argument index="0" name="keyword" type="String"> </argument> <description> + Returns whether the specified [code]keyword[/code] has a color set to it or not. </description> </method> <method name="insert_text_at_cursor"> @@ -226,7 +234,7 @@ <argument index="0" name="text" type="String"> </argument> <description> - Insert a given text at the cursor position. + Insert the specified text at the cursor position. </description> </method> <method name="is_folded" qualifiers="const"> @@ -235,7 +243,7 @@ <argument index="0" name="line" type="int"> </argument> <description> - Returns if the given line is folded. + Returns whether the line at the specified index is folded or not. </description> </method> <method name="is_line_hidden" qualifiers="const"> @@ -244,6 +252,7 @@ <argument index="0" name="line" type="int"> </argument> <description> + Returns whether the line at the specified index is hidden or not. </description> </method> <method name="is_selection_active" qualifiers="const"> @@ -259,6 +268,7 @@ <argument index="0" name="option" type="int"> </argument> <description> + Triggers a right click menu action by the specified index. See [enum MenuItems] for a list of available indexes. </description> </method> <method name="paste"> @@ -327,6 +337,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> + If [code]true[/code], hides the line of the specified index. </description> </method> <method name="toggle_fold_line"> @@ -358,6 +369,7 @@ <return type="void"> </return> <description> + Unhide all lines that were previously set to hidden by [member set_line_as_hidden]. </description> </method> </methods> @@ -392,8 +404,10 @@ If [code]true[/code], the fold gutter is visible. This enables folding groups of indented lines. </member> <member name="hiding_enabled" type="bool" setter="set_hiding_enabled" getter="is_hiding_enabled"> + If [code]true[/code], all lines that have been set to hidden by [member set_line_as_hidden], will not be visible. </member> <member name="highlight_all_occurrences" type="bool" setter="set_highlight_all_occurrences" getter="is_highlight_all_occurrences_enabled"> + If [code]true[/code], all occurrences of the selected text will be highlighted. </member> <member name="highlight_current_line" type="bool" setter="set_highlight_current_line" getter="is_highlight_current_line_enabled"> If [code]true[/code], the line containing the cursor is highlighted. @@ -407,8 +421,10 @@ If [code]true[/code], line numbers are displayed to the left of the text. </member> <member name="smooth_scrolling" type="bool" setter="set_smooth_scroll_enable" getter="is_smooth_scroll_enabled"> + If [code]true[/code], sets the [code]step[/code] of the scrollbars to [code]0.25[/code] which results in smoother scrolling. </member> <member name="syntax_highlighting" type="bool" setter="set_syntax_coloring" getter="is_syntax_coloring_enabled"> + If [code]true[/code], any custom color properties that have been set for this [TextEdit] will be visible. </member> <member name="text" type="String" setter="set_text" getter="get_text"> String value of the [TextEdit]. @@ -439,6 +455,7 @@ <argument index="1" name="info" type="String"> </argument> <description> + Emitted when the info icon is clicked. </description> </signal> <signal name="request_completion"> @@ -490,18 +507,23 @@ Undoes the previous action. </constant> <constant name="MENU_REDO" value="6" enum="MenuItems"> + Redoes the previous action. </constant> <constant name="MENU_MAX" value="7" enum="MenuItems"> + Represents the size of the [enum MenuItems] enum. </constant> </constants> <theme_items> <theme_item name="background_color" type="Color"> + Sets the background [Color] of this [TextEdit]. [member syntax_highlighting] has to be enabled. </theme_item> <theme_item name="bookmark_color" type="Color"> + Sets the [Color] of the bookmark marker. [member syntax_highlighting] has to be enabled. </theme_item> <theme_item name="brace_mismatch_color" type="Color"> </theme_item> <theme_item name="breakpoint_color" type="Color"> + Sets the [Color] of the breakpoints. [member breakpoint_gutter] has to be enabled. </theme_item> <theme_item name="caret_background_color" type="Color"> </theme_item> @@ -528,6 +550,7 @@ <theme_item name="completion_selected_color" type="Color"> </theme_item> <theme_item name="current_line_color" type="Color"> + Sets the current line highlight [Color]. [member highlight_current_line] has to be enabled. </theme_item> <theme_item name="executing_line_color" type="Color"> </theme_item> @@ -538,38 +561,48 @@ <theme_item name="folded" type="Texture"> </theme_item> <theme_item name="font" type="Font"> + Sets the default [Font]. </theme_item> <theme_item name="font_color" type="Color"> + Sets the font [Color]. </theme_item> <theme_item name="font_color_selected" type="Color"> </theme_item> <theme_item name="function_color" type="Color"> </theme_item> <theme_item name="line_number_color" type="Color"> + Sets the [Color] of the line numbers. [member show_line_numbers] has to be enabled. </theme_item> <theme_item name="line_spacing" type="int"> + Sets the spacing between the lines. </theme_item> <theme_item name="mark_color" type="Color"> + Sets the [Color] of marked text. </theme_item> <theme_item name="member_variable_color" type="Color"> </theme_item> <theme_item name="normal" type="StyleBox"> + Sets the [StyleBox] of this [TextEdit]. </theme_item> <theme_item name="number_color" type="Color"> </theme_item> <theme_item name="read_only" type="StyleBox"> + Sets the [StyleBox] of this [TextEdit] when [member read_only] is enabled. </theme_item> <theme_item name="safe_line_number_color" type="Color"> </theme_item> <theme_item name="selection_color" type="Color"> + Sets the highlight [Color] of text selections. </theme_item> <theme_item name="space" type="Texture"> </theme_item> <theme_item name="symbol_color" type="Color"> </theme_item> <theme_item name="tab" type="Texture"> + Sets a custom [Texture] for tab text characters. </theme_item> <theme_item name="word_highlighted_color" type="Color"> + Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled. </theme_item> </theme_items> </class> diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 01773a0bcd..e471993fc7 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1330,11 +1330,14 @@ void CodeTextEditor::_on_settings_change() { } void CodeTextEditor::_text_changed_idle_timeout() { - _validate_script(); emit_signal("validate_script"); } +void CodeTextEditor::validate_script() { + idle->start(); +} + void CodeTextEditor::_warning_label_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { diff --git a/editor/code_editor.h b/editor/code_editor.h index cf97f30b72..0ef8ec7061 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -242,6 +242,8 @@ public: void set_code_complete_func(CodeTextEditorCodeCompleteFunc p_code_complete_func, void *p_ud); + void validate_script(); + CodeTextEditor(); }; diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index a7975c86c5..913eb35f8a 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -81,7 +81,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin for (int i = 0; i < Variant::VARIANT_MAX; i++) { if (Variant::get_type_name(Variant::Type(i)) == p_name) { if (r_error) - *r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing buit-in type name."); + *r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing built-in type name."); return false; } diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 56358f059a..36a8772faf 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -721,7 +721,7 @@ void EditorFeatureProfileManager::_import_profiles(const Vector<String> &p_paths String dst_file = EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(basefile); if (FileAccess::exists(dst_file)) { - EditorNode::get_singleton()->show_warning(vformat(TTR("Profile '%s' already exists. Remote it first before importing, import aborted."), basefile.get_basename())); + EditorNode::get_singleton()->show_warning(vformat(TTR("Profile '%s' already exists. Remove it first before importing, import aborted."), basefile.get_basename())); return; } } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 372e5c7d05..b6d28dce29 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2319,7 +2319,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } } break; case FILE_EXPLORE_ANDROID_BUILD_TEMPLATES: { - OS::get_singleton()->shell_open(String("file://") + ProjectSettings::get_singleton()->get_resource_path().plus_file("android")); + OS::get_singleton()->shell_open("file://" + ProjectSettings::get_singleton()->get_resource_path().plus_file("android")); } break; case FILE_QUIT: case RUN_PROJECT_MANAGER: { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index fbf01a9405..3c24fd19b6 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -731,6 +731,8 @@ Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2 ERR_FAIL_COND_V(!p_control, Vector2()); Rect2 parent_rect = p_control->get_parent_anchorable_rect(); + ERR_FAIL_COND_V(parent_rect.size.x == 0, Vector2()); + ERR_FAIL_COND_V(parent_rect.size.y == 0, Vector2()); return (p_control->get_transform().xform(position) - parent_rect.position) / parent_rect.size; } @@ -3348,9 +3350,6 @@ void CanvasItemEditor::_notification(int p_what) { presets_menu->set_visible(true); anchor_mode_button->set_visible(true); - // Set the pressed state of the node - anchor_mode_button->set_pressed(anchors_mode); - // Disable if the selected node is child of a container if (has_container_parents) { presets_menu->set_disabled(true); @@ -3521,6 +3520,7 @@ void CanvasItemEditor::_selection_changed() { } } anchors_mode = (nbValidControls == nbAnchorsMode); + anchor_mode_button->set_pressed(anchors_mode); } void CanvasItemEditor::edit(CanvasItem *p_canvas_item) { @@ -3742,6 +3742,7 @@ void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_p undo_redo->commit_action(); anchors_mode = false; + anchor_mode_button->set_pressed(anchors_mode); } void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() { @@ -3766,6 +3767,7 @@ void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() { undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", use_anchors); anchors_mode = true; + anchor_mode_button->set_pressed(anchors_mode); } } @@ -3912,7 +3914,6 @@ void CanvasItemEditor::_button_toggle_anchor_mode(bool p_status) { } anchors_mode = p_status; - viewport->update(); } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 7456c5d016..df9ce73914 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -437,6 +437,8 @@ void ScriptEditor::_go_to_tab(int p_idx) { if (script != NULL) { notify_script_changed(script); } + + Object::cast_to<ScriptEditorBase>(c)->validate(); } if (Object::cast_to<EditorHelp>(c)) { @@ -2056,6 +2058,8 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra se->goto_line(p_line - 1); } } + _update_script_names(); + script_list->ensure_current_is_visible(); return true; } } diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 7cd347e2d0..549af1ca31 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -117,6 +117,8 @@ public: virtual Control *get_edit_menu() = 0; virtual void clear_edit_menu() = 0; + virtual void validate() = 0; + ScriptEditorBase() {} }; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index c7a438948d..ce0859a1f6 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1810,3 +1810,7 @@ void ScriptTextEditor::register_editor() { ScriptEditor::register_create_script_editor_function(create_editor); } + +void ScriptTextEditor::validate() { + this->code_editor->validate_script(); +} diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 7f5b6c065d..24d40a5eec 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -220,6 +220,8 @@ public: virtual void clear_edit_menu(); static void register_editor(); + virtual void validate(); + ScriptTextEditor(); }; diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index d036d7e965..eeef3397d2 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -654,3 +654,6 @@ TextEditor::TextEditor() { code_editor->get_text_edit()->set_drag_forwarding(this); } + +void TextEditor::validate() { +} diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index e06d816177..e91909e0ea 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -145,6 +145,8 @@ public: virtual Control *get_edit_menu(); virtual void clear_edit_menu(); + virtual void validate(); + static void register_editor(); TextEditor(); diff --git a/misc/scripts/fix_style.sh b/misc/scripts/fix_style.sh new file mode 100755 index 0000000000..7a335c21ea --- /dev/null +++ b/misc/scripts/fix_style.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# Command line arguments +run_clang_format=false +run_fix_headers=false +usage="Invalid argument. Usage:\n$0 <option>\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a" + +if [ -z "$1" ]; then + echo -e $usage + exit 0 +fi + +while [ $# -gt 0 ]; do + case "$1" in + --clang-format|-c) + run_clang_format=true + ;; + --headers|-h) + run_fix_headers=true + ;; + --all|-a) + run_clang_format=true + run_fix_headers=true + ;; + *) + echo -e $usage + exit 0 + esac + shift +done + +echo "Removing generated files, some have binary data and make clang-format freeze." +find -name "*.gen.*" -delete + +# Apply clang-format +if $run_clang_format; then + # Sync list with pre-commit hook + FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc .java .glsl" + + for extension in ${FILE_EXTS}; do + echo -e "Formatting ${extension} files..." + find \( -path "./.git" \ + -o -path "./thirdparty" \ + -o -path "./platform/android/java/src/com" \ + \) -prune \ + -o -name "*${extension}" \ + -exec clang-format -i {} \; + done +fi + +# Add missing copyright headers +if $run_fix_headers; then + echo "Fixing copyright headers in Godot code files..." + find \( -path "./.git" -o -path "./thirdparty" \) -prune \ + -o -regex '.*\.\(c\|h\|cpp\|hpp\|cc\|hh\|cxx\|m\|mm\|java\)' \ + > tmp-files + cat tmp-files | grep -v ".git\|thirdparty\|theme_data.h\|platform/android/java/src/com\|platform/android/java/src/org/godotengine/godot/input/InputManager" > files + python misc/scripts/fix_headers.py + rm -f tmp-files files +fi diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index f84f2c90cd..7c3bad6785 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -3759,4 +3759,7 @@ void _VisualScriptEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("remove_custom_node", "name", "category"), &_VisualScriptEditor::remove_custom_node); ADD_SIGNAL(MethodInfo("custom_nodes_updated")); } + +void VisualScriptEditor::validate() { +} #endif diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 6072e77342..b66d10021a 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -281,6 +281,7 @@ public: virtual Control *get_edit_menu(); virtual void clear_edit_menu(); virtual bool can_lose_focus_on_node_selection() { return false; } + virtual void validate(); static void register_editor(); diff --git a/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml b/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml index 8548d21323..103dbd771b 100644 --- a/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml +++ b/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml @@ -18,6 +18,24 @@ Returns the [WebSocketPeer] associated to the given [code]peer_id[/code]. </description> </method> + <method name="set_buffers"> + <return type="int" enum="Error"> + </return> + <argument index="0" name="input_buffer_size_kb" type="int"> + </argument> + <argument index="1" name="input_max_packets" type="int"> + </argument> + <argument index="2" name="output_buffer_size_kb" type="int"> + </argument> + <argument index="3" name="output_max_packets" type="int"> + </argument> + <description> + Configure the buffers sizes for this WebSocket peer. Default values can be specified in project settings under [code]network/limits[/code]. For server, values are meant per connected peer. + The first two parameters define the size and queued packets limits of the input buffer, the last two of the output buffer. + Buffer sizes are expressed in KiB, so [code]4 = 2^12 = 4096 bytes[/code]. All parameters will be rounded up to the nearest power of two. + NOTE: HTML5 exports only use the input buffer since the output one is managed by browsers. + </description> + </method> </methods> <signals> <signal name="peer_packet"> diff --git a/modules/websocket/emws_client.cpp b/modules/websocket/emws_client.cpp index aafae8f1c2..409cc9f699 100644 --- a/modules/websocket/emws_client.cpp +++ b/modules/websocket/emws_client.cpp @@ -205,6 +205,12 @@ int EMWSClient::get_max_packet_size() const { return (1 << _in_buf_size) - PROTO_SIZE; } +Error EMWSClient::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) { + _in_buf_size = nearest_shift(p_in_buffer - 1) + 10; + _in_pkt_size = nearest_shift(p_in_packets - 1); + return OK; +} + EMWSClient::EMWSClient() { _in_buf_size = nearest_shift((int)GLOBAL_GET(WSC_IN_BUF) - 1) + 10; _in_pkt_size = nearest_shift((int)GLOBAL_GET(WSC_IN_PKT) - 1); diff --git a/modules/websocket/emws_client.h b/modules/websocket/emws_client.h index 9bc29c1913..1811d05eea 100644 --- a/modules/websocket/emws_client.h +++ b/modules/websocket/emws_client.h @@ -49,6 +49,7 @@ private: public: bool _is_connecting; + Error set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets); Error connect_to_host(String p_host, String p_path, uint16_t p_port, bool p_ssl, PoolVector<String> p_protocol = PoolVector<String>()); Ref<WebSocketPeer> get_peer(int p_peer_id) const; void disconnect_from_host(int p_code = 1000, String p_reason = ""); diff --git a/modules/websocket/emws_server.cpp b/modules/websocket/emws_server.cpp index 0eef1c4ba9..c4bb459ad0 100644 --- a/modules/websocket/emws_server.cpp +++ b/modules/websocket/emws_server.cpp @@ -79,6 +79,10 @@ int EMWSServer::get_max_packet_size() const { return 0; } +Error EMWSServer::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) { + return OK; +} + EMWSServer::EMWSServer() { } diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h index bb101cd155..a5e5b4090e 100644 --- a/modules/websocket/emws_server.h +++ b/modules/websocket/emws_server.h @@ -42,6 +42,7 @@ class EMWSServer : public WebSocketServer { GDCIIMPL(EMWSServer, WebSocketServer); public: + Error set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets); Error listen(int p_port, PoolVector<String> p_protocols = PoolVector<String>(), bool gd_mp_api = false); void stop(); bool is_listening() const; diff --git a/modules/websocket/lws_client.cpp b/modules/websocket/lws_client.cpp index 08df76293b..f139a4ef66 100644 --- a/modules/websocket/lws_client.cpp +++ b/modules/websocket/lws_client.cpp @@ -215,6 +215,17 @@ uint16_t LWSClient::get_connected_port() const { return 1025; }; +Error LWSClient::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) { + ERR_EXPLAIN("Buffers sizes can only be set before listening or connecting"); + ERR_FAIL_COND_V(context != NULL, FAILED); + + _in_buf_size = nearest_shift(p_in_buffer - 1) + 10; + _in_pkt_size = nearest_shift(p_in_packets - 1); + _out_buf_size = nearest_shift(p_out_buffer - 1) + 10; + _out_pkt_size = nearest_shift(p_out_packets - 1); + return OK; +} + LWSClient::LWSClient() { _in_buf_size = nearest_shift((int)GLOBAL_GET(WSC_IN_BUF) - 1) + 10; _in_pkt_size = nearest_shift((int)GLOBAL_GET(WSC_IN_PKT) - 1); diff --git a/modules/websocket/lws_client.h b/modules/websocket/lws_client.h index b3a1237550..df4aabec7f 100644 --- a/modules/websocket/lws_client.h +++ b/modules/websocket/lws_client.h @@ -51,6 +51,7 @@ private: int _out_pkt_size; public: + Error set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets); Error connect_to_host(String p_host, String p_path, uint16_t p_port, bool p_ssl, PoolVector<String> p_protocol = PoolVector<String>()); int get_max_packet_size() const; Ref<WebSocketPeer> get_peer(int p_peer_id) const; diff --git a/modules/websocket/lws_server.cpp b/modules/websocket/lws_server.cpp index 61ccdca74a..482c02dc60 100644 --- a/modules/websocket/lws_server.cpp +++ b/modules/websocket/lws_server.cpp @@ -197,6 +197,17 @@ void LWSServer::disconnect_peer(int p_peer_id, int p_code, String p_reason) { get_peer(p_peer_id)->close(p_code, p_reason); } +Error LWSServer::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) { + ERR_EXPLAIN("Buffers sizes can only be set before listening or connecting"); + ERR_FAIL_COND_V(context != NULL, FAILED); + + _in_buf_size = nearest_shift(p_in_buffer - 1) + 10; + _in_pkt_size = nearest_shift(p_in_packets - 1); + _out_buf_size = nearest_shift(p_out_buffer - 1) + 10; + _out_pkt_size = nearest_shift(p_out_packets - 1); + return OK; +} + LWSServer::LWSServer() { _in_buf_size = nearest_shift((int)GLOBAL_GET(WSS_IN_BUF) - 1) + 10; _in_pkt_size = nearest_shift((int)GLOBAL_GET(WSS_IN_PKT) - 1); diff --git a/modules/websocket/lws_server.h b/modules/websocket/lws_server.h index 5096ee0f88..b331852d26 100644 --- a/modules/websocket/lws_server.h +++ b/modules/websocket/lws_server.h @@ -52,6 +52,7 @@ private: int _out_pkt_size; public: + Error set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets); Error listen(int p_port, PoolVector<String> p_protocols = PoolVector<String>(), bool gd_mp_api = false); void stop(); bool is_listening() const; diff --git a/modules/websocket/websocket_client.h b/modules/websocket/websocket_client.h index c464d97c7f..7ddb9468a5 100644 --- a/modules/websocket/websocket_client.h +++ b/modules/websocket/websocket_client.h @@ -67,6 +67,8 @@ public: void _on_disconnect(bool p_was_clean); void _on_error(); + virtual Error set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) = 0; + WebSocketClient(); ~WebSocketClient(); }; diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp index 6aab8a7e81..23cbf916eb 100644 --- a/modules/websocket/websocket_multiplayer_peer.cpp +++ b/modules/websocket/websocket_multiplayer_peer.cpp @@ -87,6 +87,7 @@ void WebSocketMultiplayerPeer::_clear() { void WebSocketMultiplayerPeer::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_buffers", "input_buffer_size_kb", "input_max_packets", "output_buffer_size_kb", "output_max_packets"), &WebSocketMultiplayerPeer::set_buffers); ClassDB::bind_method(D_METHOD("get_peer", "peer_id"), &WebSocketMultiplayerPeer::get_peer); ADD_SIGNAL(MethodInfo("peer_packet", PropertyInfo(Variant::INT, "peer_source"))); diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h index b050449ee0..089bc25fe9 100644 --- a/modules/websocket/websocket_multiplayer_peer.h +++ b/modules/websocket/websocket_multiplayer_peer.h @@ -97,6 +97,7 @@ public: virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size); /* WebSocketPeer */ + virtual Error set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) = 0; virtual Ref<WebSocketPeer> get_peer(int p_peer_id) const = 0; void _process_multiplayer(Ref<WebSocketPeer> p_peer, uint32_t p_peer_id); diff --git a/modules/websocket/websocket_server.h b/modules/websocket/websocket_server.h index 7a94c4047b..83c0c10419 100644 --- a/modules/websocket/websocket_server.h +++ b/modules/websocket/websocket_server.h @@ -62,6 +62,8 @@ public: void _on_disconnect(int32_t p_peer_id, bool p_was_clean); void _on_close_request(int32_t p_peer_id, int p_code, String p_reason); + virtual Error set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) = 0; + WebSocketServer(); ~WebSocketServer(); }; diff --git a/platform/iphone/camera_ios.h b/platform/iphone/camera_ios.h index e5d62af65d..cf747283e1 100644 --- a/platform/iphone/camera_ios.h +++ b/platform/iphone/camera_ios.h @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/iphone/camera_ios.mm b/platform/iphone/camera_ios.mm index 3994e9366a..4c11701fdd 100644 --- a/platform/iphone/camera_ios.mm +++ b/platform/iphone/camera_ios.mm @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/javascript/http_client.h.inc b/platform/javascript/http_client.h.inc index d707d623ab..c034069ab2 100644 --- a/platform/javascript/http_client.h.inc +++ b/platform/javascript/http_client.h.inc @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/platform/osx/camera_osx.h b/platform/osx/camera_osx.h index ed7a1f0a73..80ca3759ba 100644 --- a/platform/osx/camera_osx.h +++ b/platform/osx/camera_osx.h @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/osx/camera_osx.mm b/platform/osx/camera_osx.mm index 34486c58b1..f13cf76beb 100644 --- a/platform/osx/camera_osx.mm +++ b/platform/osx/camera_osx.mm @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 09a9c0be4d..0ca94e3a63 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -137,6 +137,9 @@ public: String im_text; Point2 im_selection; + Size2 min_size; + Size2 max_size; + PowerOSX *power_manager; CrashHandler crash_handler; @@ -235,6 +238,10 @@ public: virtual Point2 get_window_position() const; virtual void set_window_position(const Point2 &p_position); + virtual Size2 get_max_window_size() const; + virtual Size2 get_min_window_size() const; + virtual void set_min_window_size(const Size2 p_size); + virtual void set_max_window_size(const Size2 p_size); virtual void set_window_size(const Size2 p_size); virtual void set_window_fullscreen(bool p_enabled); virtual bool is_window_fullscreen() const; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 3ee6537180..dade07ffda 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -267,10 +267,23 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt - (void)windowDidEnterFullScreen:(NSNotification *)notification { OS_OSX::singleton->zoomed = true; + + [OS_OSX::singleton->window_object setContentMinSize:NSMakeSize(0, 0)]; + [OS_OSX::singleton->window_object setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; } - (void)windowDidExitFullScreen:(NSNotification *)notification { OS_OSX::singleton->zoomed = false; + + if (OS_OSX::singleton->min_size != Size2()) { + Size2 size = OS_OSX::singleton->min_size / OS_OSX::singleton->_display_scale(); + [OS_OSX::singleton->window_object setContentMinSize:NSMakeSize(size.x, size.y)]; + } + if (OS_OSX::singleton->max_size != Size2()) { + Size2 size = OS_OSX::singleton->max_size / OS_OSX::singleton->_display_scale(); + [OS_OSX::singleton->window_object setContentMaxSize:NSMakeSize(size.x, size.y)]; + } + if (!OS_OSX::singleton->resizable) [OS_OSX::singleton->window_object setStyleMask:[OS_OSX::singleton->window_object styleMask] & ~NSWindowStyleMaskResizable]; } @@ -2357,6 +2370,46 @@ Size2 OS_OSX::get_real_window_size() const { return Size2(frame.size.width, frame.size.height) * _display_scale(); } +Size2 OS_OSX::get_max_window_size() const { + return max_size; +} + +Size2 OS_OSX::get_min_window_size() const { + return min_size; +} + +void OS_OSX::set_min_window_size(const Size2 p_size) { + + if ((p_size != Size2()) && (max_size != Size2()) && ((p_size.x > max_size.x) || (p_size.y > max_size.y))) { + WARN_PRINT("Minimum window size can't be larger than maximum window size!"); + return; + } + min_size = p_size; + + if ((min_size != Size2()) && !zoomed) { + Size2 size = min_size / _display_scale(); + [window_object setContentMinSize:NSMakeSize(size.x, size.y)]; + } else { + [window_object setContentMinSize:NSMakeSize(0, 0)]; + } +} + +void OS_OSX::set_max_window_size(const Size2 p_size) { + + if ((p_size != Size2()) && ((p_size.x < min_size.x) || (p_size.y < min_size.y))) { + WARN_PRINT("Maximum window size can't be smaller than minimum window size!"); + return; + } + max_size = p_size; + + if ((max_size != Size2()) && !zoomed) { + Size2 size = max_size / _display_scale(); + [window_object setContentMaxSize:NSMakeSize(size.x, size.y)]; + } else { + [window_object setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; + } +} + void OS_OSX::set_window_size(const Size2 p_size) { Size2 size = p_size / _display_scale(); @@ -2386,6 +2439,19 @@ void OS_OSX::set_window_fullscreen(bool p_enabled) { set_window_per_pixel_transparency_enabled(false); if (!resizable) [window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable]; + if (p_enabled) { + [window_object setContentMinSize:NSMakeSize(0, 0)]; + [window_object setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; + } else { + if (min_size != Size2()) { + Size2 size = min_size / _display_scale(); + [window_object setContentMinSize:NSMakeSize(size.x, size.y)]; + } + if (max_size != Size2()) { + Size2 size = max_size / _display_scale(); + [window_object setContentMaxSize:NSMakeSize(size.x, size.y)]; + } + } [window_object toggleFullScreen:nil]; } zoomed = p_enabled; diff --git a/platform/windows/camera_win.cpp b/platform/windows/camera_win.cpp index 6eff2749f2..b97796fe89 100644 --- a/platform/windows/camera_win.cpp +++ b/platform/windows/camera_win.cpp @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/windows/camera_win.h b/platform/windows/camera_win.h index 61d22ac6b1..22ce9aa43f 100644 --- a/platform/windows/camera_win.h +++ b/platform/windows/camera_win.h @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index 432060f4fe..53ce342e8c 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -334,7 +334,7 @@ void JoypadWindows::process_joypads() { if (joy.state.dwPacketNumber != joy.last_packet) { int button_mask = XINPUT_GAMEPAD_DPAD_UP; - for (int j = 0; j <= 16; i++) { + for (int j = 0; j <= 16; j++) { input->joy_button(joy.id, j, joy.state.Gamepad.wButtons & button_mask); button_mask = button_mask * 2; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index db56bf5c7e..6e6df08f02 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -355,7 +355,23 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; // Return To The Message Loop } - + case WM_GETMINMAXINFO: { + if (video_mode.resizable && !video_mode.fullscreen) { + Size2 decor = get_real_window_size() - get_window_size(); // Size of window decorations + MINMAXINFO *min_max_info = (MINMAXINFO *)lParam; + if (min_size != Size2()) { + min_max_info->ptMinTrackSize.x = min_size.x + decor.x; + min_max_info->ptMinTrackSize.y = min_size.y + decor.y; + } + if (max_size != Size2()) { + min_max_info->ptMaxTrackSize.x = max_size.x + decor.x; + min_max_info->ptMaxTrackSize.y = max_size.y + decor.y; + } + return 0; + } else { + break; + } + } case WM_PAINT: Main::force_redraw(); @@ -1771,6 +1787,7 @@ void OS_Windows::set_window_position(const Point2 &p_position) { last_pos = p_position; update_real_mouse_position(); } + Size2 OS_Windows::get_window_size() const { if (minimized) { @@ -1783,6 +1800,33 @@ Size2 OS_Windows::get_window_size() const { } return Size2(); } + +Size2 OS_Windows::get_max_window_size() const { + return max_size; +} + +Size2 OS_Windows::get_min_window_size() const { + return min_size; +} + +void OS_Windows::set_min_window_size(const Size2 p_size) { + + if ((p_size != Size2()) && (max_size != Size2()) && ((p_size.x > max_size.x) || (p_size.y > max_size.y))) { + WARN_PRINT("Minimum window size can't be larger than maximum window size!"); + return; + } + min_size = p_size; +} + +void OS_Windows::set_max_window_size(const Size2 p_size) { + + if ((p_size != Size2()) && ((p_size.x < min_size.x) || (p_size.y < min_size.y))) { + WARN_PRINT("Maximum window size can't be smaller than minimum window size!"); + return; + } + max_size = p_size; +} + Size2 OS_Windows::get_real_window_size() const { RECT r; @@ -1791,6 +1835,7 @@ Size2 OS_Windows::get_real_window_size() const { } return Size2(); } + void OS_Windows::set_window_size(const Size2 p_size) { int w = p_size.width; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index b20d847baa..4660c16b97 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -126,6 +126,9 @@ class OS_Windows : public OS { HCURSOR hCursor; + Size2 min_size; + Size2 max_size; + Size2 window_rect; VideoMode video_mode; bool preserve_window_size = false; @@ -238,6 +241,10 @@ public: virtual void set_window_position(const Point2 &p_position); virtual Size2 get_window_size() const; virtual Size2 get_real_window_size() const; + virtual Size2 get_max_window_size() const; + virtual Size2 get_min_window_size() const; + virtual void set_min_window_size(const Size2 p_size); + virtual void set_max_window_size(const Size2 p_size); virtual void set_window_size(const Size2 p_size); virtual void set_window_fullscreen(bool p_enabled); virtual bool is_window_fullscreen() const; diff --git a/platform/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp index 79407cd9dc..9baa4d6dca 100644 --- a/platform/x11/godot_x11.cpp +++ b/platform/x11/godot_x11.cpp @@ -55,8 +55,11 @@ int main(int argc, char *argv[]) { os.run(); // it is actually the OS that decides how to run Main::cleanup(); - if (ret) - chdir(cwd); + if (ret) { // Previous getcwd was successful + if (chdir(cwd) != 0) { + ERR_PRINT("Couldn't return to previous working directory."); + } + } free(cwd); return os.get_exit_code(); diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 146cd8bb66..6421dc270f 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1006,18 +1006,30 @@ void OS_X11::set_wm_fullscreen(bool p_enabled) { XFlush(x11_display); - if (!p_enabled && !is_window_resizable()) { + if (!p_enabled) { // Reset the non-resizable flags if we un-set these before. Size2 size = get_window_size(); XSizeHints *xsh; - xsh = XAllocSizeHints(); - xsh->flags = PMinSize | PMaxSize; - xsh->min_width = size.x; - xsh->max_width = size.x; - xsh->min_height = size.y; - xsh->max_height = size.y; - + if (!is_window_resizable()) { + xsh->flags = PMinSize | PMaxSize; + xsh->min_width = size.x; + xsh->max_width = size.x; + xsh->min_height = size.y; + xsh->max_height = size.y; + } else { + xsh->flags = 0L; + if (min_size != Size2()) { + xsh->flags |= PMinSize; + xsh->min_width = min_size.x; + xsh->min_height = min_size.y; + } + if (max_size != Size2()) { + xsh->flags |= PMaxSize; + xsh->max_width = max_size.x; + xsh->max_height = max_size.y; + } + } XSetWMNormalHints(x11_display, x11_window, xsh); XFree(xsh); } @@ -1244,6 +1256,72 @@ Size2 OS_X11::get_real_window_size() const { return Size2(w, h); } +Size2 OS_X11::get_max_window_size() const { + return max_size; +} + +Size2 OS_X11::get_min_window_size() const { + return min_size; +} + +void OS_X11::set_min_window_size(const Size2 p_size) { + + if ((p_size != Size2()) && (max_size != Size2()) && ((p_size.x > max_size.x) || (p_size.y > max_size.y))) { + WARN_PRINT("Minimum window size can't be larger than maximum window size!"); + return; + } + min_size = p_size; + + if (is_window_resizable()) { + XSizeHints *xsh; + xsh = XAllocSizeHints(); + xsh->flags = 0L; + if (min_size != Size2()) { + xsh->flags |= PMinSize; + xsh->min_width = min_size.x; + xsh->min_height = min_size.y; + } + if (max_size != Size2()) { + xsh->flags |= PMaxSize; + xsh->max_width = max_size.x; + xsh->max_height = max_size.y; + } + XSetWMNormalHints(x11_display, x11_window, xsh); + XFree(xsh); + + XFlush(x11_display); + } +} + +void OS_X11::set_max_window_size(const Size2 p_size) { + + if ((p_size != Size2()) && ((p_size.x < min_size.x) || (p_size.y < min_size.y))) { + WARN_PRINT("Maximum window size can't be smaller than minimum window size!"); + return; + } + max_size = p_size; + + if (is_window_resizable()) { + XSizeHints *xsh; + xsh = XAllocSizeHints(); + xsh->flags = 0L; + if (min_size != Size2()) { + xsh->flags |= PMinSize; + xsh->min_width = min_size.x; + xsh->min_height = min_size.y; + } + if (max_size != Size2()) { + xsh->flags |= PMaxSize; + xsh->max_width = max_size.x; + xsh->max_height = max_size.y; + } + XSetWMNormalHints(x11_display, x11_window, xsh); + XFree(xsh); + + XFlush(x11_display); + } +} + void OS_X11::set_window_size(const Size2 p_size) { if (current_videomode.width == p_size.width && current_videomode.height == p_size.height) @@ -1256,17 +1334,29 @@ void OS_X11::set_window_size(const Size2 p_size) { int old_h = xwa.height; // If window resizable is disabled we need to update the attributes first + XSizeHints *xsh; + xsh = XAllocSizeHints(); if (!is_window_resizable()) { - XSizeHints *xsh; - xsh = XAllocSizeHints(); xsh->flags = PMinSize | PMaxSize; xsh->min_width = p_size.x; xsh->max_width = p_size.x; xsh->min_height = p_size.y; xsh->max_height = p_size.y; - XSetWMNormalHints(x11_display, x11_window, xsh); - XFree(xsh); + } else { + xsh->flags = 0L; + if (min_size != Size2()) { + xsh->flags |= PMinSize; + xsh->min_width = min_size.x; + xsh->min_height = min_size.y; + } + if (max_size != Size2()) { + xsh->flags |= PMaxSize; + xsh->max_width = max_size.x; + xsh->max_height = max_size.y; + } } + XSetWMNormalHints(x11_display, x11_window, xsh); + XFree(xsh); // Resize the window XResizeWindow(x11_display, x11_window, p_size.x, p_size.y); @@ -1312,20 +1402,37 @@ bool OS_X11::is_window_fullscreen() const { } void OS_X11::set_window_resizable(bool p_enabled) { - XSizeHints *xsh; - Size2 size = get_window_size(); + XSizeHints *xsh; xsh = XAllocSizeHints(); - xsh->flags = p_enabled ? 0L : PMinSize | PMaxSize; if (!p_enabled) { + Size2 size = get_window_size(); + + xsh->flags = PMinSize | PMaxSize; xsh->min_width = size.x; xsh->max_width = size.x; xsh->min_height = size.y; xsh->max_height = size.y; + } else { + xsh->flags = 0L; + if (min_size != Size2()) { + xsh->flags |= PMinSize; + xsh->min_width = min_size.x; + xsh->min_height = min_size.y; + } + if (max_size != Size2()) { + xsh->flags |= PMaxSize; + xsh->max_width = max_size.x; + xsh->max_height = max_size.y; + } } + XSetWMNormalHints(x11_display, x11_window, xsh); XFree(xsh); + current_videomode.resizable = p_enabled; + + XFlush(x11_display); } bool OS_X11::is_window_resizable() const { diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index eca617bd90..510487b599 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -120,6 +120,9 @@ class OS_X11 : public OS_Unix { bool im_active; Vector2 im_position; + Size2 min_size; + Size2 max_size; + Point2 last_mouse_pos; bool last_mouse_pos_valid; Point2i last_click_pos; @@ -268,6 +271,10 @@ public: virtual void set_window_position(const Point2 &p_position); virtual Size2 get_window_size() const; virtual Size2 get_real_window_size() const; + virtual Size2 get_max_window_size() const; + virtual Size2 get_min_window_size() const; + virtual void set_min_window_size(const Size2 p_size); + virtual void set_max_window_size(const Size2 p_size); virtual void set_window_size(const Size2 p_size); virtual void set_window_fullscreen(bool p_enabled); virtual bool is_window_fullscreen() const; diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 451da8c7c4..a8d72bb774 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -469,7 +469,7 @@ void CPUParticles2D::_validate_property(PropertyInfo &property) const { property.usage = 0; } - if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_CIRCLE) { + if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_SPHERE) { property.usage = 0; } @@ -647,8 +647,9 @@ void CPUParticles2D::_particles_process(float p_delta) { case EMISSION_SHAPE_POINT: { //do none } break; - case EMISSION_SHAPE_CIRCLE: { - p.transform[2] = Vector2(Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0).normalized() * emission_sphere_radius; + case EMISSION_SHAPE_SPHERE: { + Vector3 sphere_shape = Vector3(Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0).normalized() * emission_sphere_radius; + p.transform[2] = Vector2(sphere_shape.x, sphere_shape.y); } break; case EMISSION_SHAPE_RECTANGLE: { p.transform[2] = Vector2(Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0) * emission_rect_extents; @@ -1356,7 +1357,7 @@ void CPUParticles2D::_bind_methods() { BIND_ENUM_CONSTANT(FLAG_MAX); BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINT); - BIND_ENUM_CONSTANT(EMISSION_SHAPE_CIRCLE); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_SPHERE); BIND_ENUM_CONSTANT(EMISSION_SHAPE_RECTANGLE); BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINTS); BIND_ENUM_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS); diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h index 9bd3424c04..6c83abb311 100644 --- a/scene/2d/cpu_particles_2d.h +++ b/scene/2d/cpu_particles_2d.h @@ -75,7 +75,7 @@ public: enum EmissionShape { EMISSION_SHAPE_POINT, - EMISSION_SHAPE_CIRCLE, + EMISSION_SHAPE_SPHERE, EMISSION_SHAPE_RECTANGLE, EMISSION_SHAPE_POINTS, EMISSION_SHAPE_DIRECTED_POINTS, diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 6b12db9e44..7f01ff8806 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -435,7 +435,7 @@ void Light2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_texture_offset", "get_texture_offset"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_scale", PROPERTY_HINT_RANGE, "0.01,50,0.01"), "set_texture_scale", "get_texture_scale"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0.01,100,0.01"), "set_energy", "get_energy"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_energy", "get_energy"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Add,Sub,Mix,Mask"), "set_mode", "get_mode"); ADD_GROUP("Range", "range_"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "range_height", PROPERTY_HINT_RANGE, "-2048,2048,0.1,or_lesser,or_greater"), "set_height", "get_height"); diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index d66e6cc83d..2b12e78158 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -173,7 +173,7 @@ void BakedLightmapData::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::AABB, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "cell_space_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_space_transform", "get_cell_space_transform"); ADD_PROPERTY(PropertyInfo(Variant::INT, "cell_subdiv", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_subdiv", "get_cell_subdiv"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_energy", "get_energy"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_energy", "get_energy"); ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "octree", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_octree", "get_octree"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "user_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_user_data", "_get_user_data"); } diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index c491275f00..414e932f61 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -539,7 +539,7 @@ void GIProbe::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "subdiv", PROPERTY_HINT_ENUM, "64,128,256,512"), "set_subdiv", "get_subdiv"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents"), "set_extents", "get_extents"); ADD_PROPERTY(PropertyInfo(Variant::INT, "dynamic_range", PROPERTY_HINT_RANGE, "1,16,1"), "set_dynamic_range", "get_dynamic_range"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_energy", "get_energy"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_energy", "get_energy"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "propagation", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_propagation", "get_propagation"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_bias", "get_bias"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_normal_bias", "get_normal_bias"); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 2377068ede..2e64872616 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -249,8 +249,8 @@ void Light::_bind_methods() { ADD_GROUP("Light", "light_"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "light_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_color", "get_color"); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "light_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_ENERGY); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "light_indirect_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_INDIRECT_ENERGY); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "light_energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_param", "get_param", PARAM_ENERGY); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "light_indirect_energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_param", "get_param", PARAM_INDIRECT_ENERGY); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "light_negative"), "set_negative", "is_negative"); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "light_specular", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_SPECULAR); ADD_PROPERTY(PropertyInfo(Variant::INT, "light_bake_mode", PROPERTY_HINT_ENUM, "Disable,Indirect,All"), "set_bake_mode", "get_bake_mode"); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index 1f9bfb9936..c9cf5f8308 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -177,7 +177,7 @@ String Container::get_configuration_warning() const { if (warning != String()) { warning += "\n"; } - warning += TTR("Container by itself serves no purpose unless a script configures it's children placement behavior.\nIf you don't intend to add a script, then please use a plain 'Control' node instead."); + warning += TTR("Container by itself serves no purpose unless a script configures its children placement behavior.\nIf you don't intend to add a script, then please use a plain 'Control' node instead."); } return warning; } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 9d7c08d3f3..0845b56828 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1749,6 +1749,9 @@ Rect2 Control::_compute_child_rect(const float p_anchors[4], const float p_margi void Control::_compute_anchors(Rect2 p_rect, const float p_margins[4], float (&r_anchors)[4]) { Size2 parent_rect_size = get_parent_anchorable_rect().size; + ERR_FAIL_COND(parent_rect_size.x == 0.0); + ERR_FAIL_COND(parent_rect_size.y == 0.0); + r_anchors[0] = (p_rect.position.x - p_margins[0]) / parent_rect_size.x; r_anchors[1] = (p_rect.position.y - p_margins[1]) / parent_rect_size.y; r_anchors[2] = (p_rect.position.x + p_rect.size.x - p_margins[2]) / parent_rect_size.x; diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 7027fceb84..872402e9e1 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -86,24 +86,7 @@ void OptionButton::_focused(int p_which) { void OptionButton::_selected(int p_which) { - int selid = -1; - for (int i = 0; i < popup->get_item_count(); i++) { - - bool is_clicked = popup->get_item_id(i) == p_which; - if (is_clicked) { - selid = i; - break; - } - } - - if (selid == -1 && p_which >= 0 && p_which < popup->get_item_count()) { - _select(p_which, true); - } else { - - ERR_FAIL_COND(selid == -1); - - _select(selid, true); - } + _select(p_which, true); } void OptionButton::pressed() { @@ -355,7 +338,7 @@ OptionButton::OptionButton() { popup->set_pass_on_modal_close_click(false); popup->set_notify_transform(true); popup->set_allow_search(true); - popup->connect("id_pressed", this, "_selected"); + popup->connect("index_pressed", this, "_selected"); popup->connect("id_focused", this, "_focused"); popup->connect("popup_hide", this, "set_pressed", varray(false)); } diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index c24e62c8cb..d00acaf08a 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -63,7 +63,7 @@ void Range::Shared::emit_value_changed() { void Range::_changed_notify(const char *p_what) { - emit_signal("changed", shared->val); + emit_signal("changed"); update(); _change_notify(p_what); } @@ -79,6 +79,7 @@ void Range::Shared::emit_changed(const char *p_what) { } void Range::set_value(double p_val) { + if (shared->step > 0) p_val = Math::round(p_val / shared->step) * shared->step; @@ -303,22 +304,27 @@ bool Range::is_ratio_exp() const { } void Range::set_allow_greater(bool p_allow) { + shared->allow_greater = p_allow; } bool Range::is_greater_allowed() const { + return shared->allow_greater; } void Range::set_allow_lesser(bool p_allow) { + shared->allow_lesser = p_allow; } bool Range::is_lesser_allowed() const { + return shared->allow_lesser; } Range::Range() { + shared = memnew(Shared); shared->min = 0; shared->max = 100; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 83ce71e959..36d7dad1d3 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -5613,7 +5613,7 @@ void TextEdit::undo() { TextOperation op = undo_stack_pos->get(); _do_text_op(op, true); - if (op.from_line != op.to_line || op.to_column != op.from_column + 1) + if (op.type != TextOperation::TYPE_INSERT && (op.from_line != op.to_line || op.to_column != op.from_column + 1)) select(op.from_line, op.from_column, op.to_line, op.to_column); current_op.version = op.prev_version; diff --git a/scene/resources/default_theme/font_hidpi.inc b/scene/resources/default_theme/font_hidpi.inc index 2fc0f56c3f..4860149e6b 100644 --- a/scene/resources/default_theme/font_hidpi.inc +++ b/scene/resources/default_theme/font_hidpi.inc @@ -1,3 +1,4 @@ +/* clang-format off */ static const int _hidpi_font_height=25; static const int _hidpi_font_ascent=19; static const int _hidpi_font_charcount=191; @@ -25459,3 +25460,4 @@ static const unsigned char _hidpi_font_img_data[25255]={ 96, 130, }; +/* clang-format on */ diff --git a/scene/resources/default_theme/font_lodpi.inc b/scene/resources/default_theme/font_lodpi.inc index 8eae45a8a7..959e2c1d7b 100644 --- a/scene/resources/default_theme/font_lodpi.inc +++ b/scene/resources/default_theme/font_lodpi.inc @@ -1,3 +1,4 @@ +/* clang-format off */ static const int _lodpi_font_height=14; static const int _lodpi_font_ascent=11; static const int _lodpi_font_charcount=191; @@ -13113,3 +13114,4 @@ static const unsigned char _lodpi_font_img_data[12909]={ 96, 130, }; +/* clang-format on */ diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index ada0ac07a3..6dec4a0c49 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -2094,7 +2094,7 @@ void SpatialMaterial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "params_billboard_mode", PROPERTY_HINT_ENUM, "Disabled,Enabled,Y-Billboard,Particle Billboard"), "set_billboard_mode", "get_billboard_mode"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "params_billboard_keep_scale"), "set_flag", "get_flag", FLAG_BILLBOARD_KEEP_SCALE); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "params_grow"), "set_grow_enabled", "is_grow_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_grow_amount", PROPERTY_HINT_RANGE, "-16,10,0.01"), "set_grow", "get_grow"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_grow_amount", PROPERTY_HINT_RANGE, "-16,16,0.001"), "set_grow", "get_grow"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "params_use_alpha_scissor"), "set_flag", "get_flag", FLAG_USE_ALPHA_SCISSOR); ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_alpha_scissor_threshold", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_alpha_scissor_threshold", "get_alpha_scissor_threshold"); ADD_GROUP("Particles Anim", "particles_anim_"); @@ -2120,7 +2120,7 @@ void SpatialMaterial::_bind_methods() { ADD_GROUP("Emission", "emission_"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "emission_enabled"), "set_feature", "get_feature", FEATURE_EMISSION); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "emission", PROPERTY_HINT_COLOR_NO_ALPHA), "set_emission", "get_emission"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_emission_energy", "get_emission_energy"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_emission_energy", "get_emission_energy"); ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_operator", PROPERTY_HINT_ENUM, "Add,Multiply"), "set_emission_operator", "get_emission_operator"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "emission_on_uv2"), "set_flag", "get_flag", FLAG_EMISSION_ON_UV2); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "emission_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_EMISSION); @@ -2202,11 +2202,11 @@ void SpatialMaterial::_bind_methods() { ADD_GROUP("Proximity Fade", "proximity_fade_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "proximity_fade_enable"), "set_proximity_fade", "is_proximity_fade_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "proximity_fade_distance", PROPERTY_HINT_RANGE, "0,4096,0.1"), "set_proximity_fade_distance", "get_proximity_fade_distance"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "proximity_fade_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_proximity_fade_distance", "get_proximity_fade_distance"); ADD_GROUP("Distance Fade", "distance_fade_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "distance_fade_mode", PROPERTY_HINT_ENUM, "Disabled,PixelAlpha,PixelDither,ObjectDither"), "set_distance_fade", "get_distance_fade"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance_fade_min_distance", PROPERTY_HINT_RANGE, "0,4096,0.1"), "set_distance_fade_min_distance", "get_distance_fade_min_distance"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance_fade_max_distance", PROPERTY_HINT_RANGE, "0,4096,0.1"), "set_distance_fade_max_distance", "get_distance_fade_max_distance"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance_fade_min_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_distance_fade_min_distance", "get_distance_fade_min_distance"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance_fade_max_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_distance_fade_max_distance", "get_distance_fade_max_distance"); BIND_ENUM_CONSTANT(TEXTURE_ALBEDO); BIND_ENUM_CONSTANT(TEXTURE_METALLIC); diff --git a/servers/camera/camera_feed.cpp b/servers/camera/camera_feed.cpp index b96e9b749f..31b8b2874f 100644 --- a/servers/camera/camera_feed.cpp +++ b/servers/camera/camera_feed.cpp @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/servers/camera/camera_feed.h b/servers/camera/camera_feed.h index aa8a78b2f6..90c076071c 100644 --- a/servers/camera/camera_feed.h +++ b/servers/camera/camera_feed.h @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/servers/camera_server.cpp b/servers/camera_server.cpp index f52d3decae..8d2ae37001 100644 --- a/servers/camera_server.cpp +++ b/servers/camera_server.cpp @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/servers/camera_server.h b/servers/camera_server.h index c7716a3cff..d204142c7d 100644 --- a/servers/camera_server.h +++ b/servers/camera_server.h @@ -1,12 +1,12 @@ /*************************************************************************/ -/* camera_server.h */ +/* camera_server.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |