diff options
-rw-r--r-- | core/input/input.cpp | 12 | ||||
-rw-r--r-- | core/input/input.h | 4 | ||||
-rw-r--r-- | doc/classes/Input.xml | 34 | ||||
-rw-r--r-- | doc/classes/InputEventMouseMotion.xml | 2 | ||||
-rw-r--r-- | doc/classes/MultiplayerSynchronizer.xml | 2 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 7 | ||||
-rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_map_editor.cpp | 1 | ||||
-rw-r--r-- | scene/main/window.cpp | 2 | ||||
-rw-r--r-- | scene/multiplayer/multiplayer_synchronizer.cpp | 2 |
10 files changed, 35 insertions, 34 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp index 4befdfac58..b3a68bb98c 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -134,8 +134,12 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "shape", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2())); ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event); ClassDB::bind_method(D_METHOD("set_use_accumulated_input", "enable"), &Input::set_use_accumulated_input); + ClassDB::bind_method(D_METHOD("is_using_accumulated_input"), &Input::is_using_accumulated_input); ClassDB::bind_method(D_METHOD("flush_buffered_events"), &Input::flush_buffered_events); + ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_mode"), "set_mouse_mode", "get_mouse_mode"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_accumulated_input"), "set_use_accumulated_input", "is_using_accumulated_input"); + BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE); BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN); BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED); @@ -897,6 +901,10 @@ void Input::set_use_accumulated_input(bool p_enable) { use_accumulated_input = p_enable; } +bool Input::is_using_accumulated_input() { + return use_accumulated_input; +} + void Input::release_pressed_events() { flush_buffered_events(); // this is needed to release actions strengths @@ -1401,8 +1409,8 @@ String Input::get_joy_guid(int p_device) const { return joy_names[p_device].uid; } -Array Input::get_connected_joypads() { - Array ret; +TypedArray<int> Input::get_connected_joypads() { + TypedArray<int> ret; HashMap<int, Joypad>::Iterator elem = joy_names.begin(); while (elem) { if (elem->value.connected) { diff --git a/core/input/input.h b/core/input/input.h index 9a5b8e6e06..f02f2abae5 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -36,6 +36,7 @@ #include "core/os/keyboard.h" #include "core/os/thread_safe.h" #include "core/templates/rb_set.h" +#include "core/variant/typed_array.h" class Input : public Object { GDCLASS(Input, Object); @@ -259,7 +260,7 @@ public: float get_joy_axis(int p_device, JoyAxis p_axis) const; String get_joy_name(int p_idx); - Array get_connected_joypads(); + TypedArray<int> get_connected_joypads(); Vector2 get_joy_vibration_strength(int p_device); float get_joy_vibration_duration(int p_device); uint64_t get_joy_vibration_timestamp(int p_device); @@ -326,6 +327,7 @@ public: bool is_using_input_buffering(); void set_use_input_buffering(bool p_enable); void set_use_accumulated_input(bool p_enable); + bool is_using_accumulated_input(); void release_pressed_events(); diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 2a4381b41b..66683fa0ee 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -40,7 +40,7 @@ <method name="flush_buffered_events"> <return type="void" /> <description> - Sends all input events which are in the current buffer to the game loop. These events may have been buffered as a result of accumulated input ([method set_use_accumulated_input]) or agile input flushing ([member ProjectSettings.input_devices/buffering/agile_event_flushing]). + Sends all input events which are in the current buffer to the game loop. These events may have been buffered as a result of accumulated input ([member use_accumulated_input]) or agile input flushing ([member ProjectSettings.input_devices/buffering/agile_event_flushing]). The engine will already do this itself at key execution points (at least once per frame). However, this can be useful in advanced cases where you want precise control over the timing of event handling. </description> </method> @@ -80,7 +80,7 @@ </description> </method> <method name="get_connected_joypads"> - <return type="Array" /> + <return type="int[]" /> <description> Returns an [Array] containing the device IDs of all currently connected joypads. </description> @@ -160,12 +160,6 @@ Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together. </description> </method> - <method name="get_mouse_mode" qualifiers="const"> - <return type="int" enum="Input.MouseMode" /> - <description> - Returns the mouse mode. See the constants for more information. - </description> - </method> <method name="get_vector" qualifiers="const"> <return type="Vector2" /> <argument index="0" name="negative_x" type="StringName" /> @@ -338,21 +332,6 @@ [b]Note:[/b] This value can be immediately overwritten by the hardware sensor value on Android and iOS. </description> </method> - <method name="set_mouse_mode"> - <return type="void" /> - <argument index="0" name="mode" type="int" enum="Input.MouseMode" /> - <description> - Sets the mouse mode. See the constants for more information. - </description> - </method> - <method name="set_use_accumulated_input"> - <return type="void" /> - <argument index="0" name="enable" type="bool" /> - <description> - Enables or disables the accumulation of similar input events sent by the operating system. When input accumulation is enabled, all input events generated during a frame will be merged and emitted when the frame is done rendering. Therefore, this limits the number of input method calls per second to the rendering FPS. - Input accumulation is enabled by default. It can be disabled to get slightly more precise/reactive input at the cost of increased CPU usage. In applications where drawing freehand lines is required, input accumulation should generally be disabled while the user is drawing the line to get results that closely follow the actual input. - </description> - </method> <method name="start_joy_vibration"> <return type="void" /> <argument index="0" name="device" type="int" /> @@ -389,6 +368,15 @@ </description> </method> </methods> + <members> + <member name="mouse_mode" type="int" setter="set_mouse_mode" getter="get_mouse_mode" enum="Input.MouseMode"> + Controls the mouse mode. See [enum MouseMode] for more information. + </member> + <member name="use_accumulated_input" type="bool" setter="set_use_accumulated_input" getter="is_using_accumulated_input"> + If [code]true[/code], similar input events sent by the operating system are accumulated. When input accumulation is enabled, all input events generated during a frame will be merged and emitted when the frame is done rendering. Therefore, this limits the number of input method calls per second to the rendering FPS. + Input accumulation can be disabled to get slightly more precise/reactive input at the cost of increased CPU usage. In applications where drawing freehand lines is required, input accumulation should generally be disabled while the user is drawing the line to get results that closely follow the actual input. + </member> + </members> <signals> <signal name="joy_connection_changed"> <argument index="0" name="device" type="int" /> diff --git a/doc/classes/InputEventMouseMotion.xml b/doc/classes/InputEventMouseMotion.xml index 7cc3de8fcb..ad74204d82 100644 --- a/doc/classes/InputEventMouseMotion.xml +++ b/doc/classes/InputEventMouseMotion.xml @@ -5,7 +5,7 @@ </brief_description> <description> Contains mouse and pen motion information. Supports relative, absolute positions and velocity. See [method Node._input]. - [b]Note:[/b] By default, this event is only emitted once per frame rendered at most. If you need more precise input reporting, call [method Input.set_use_accumulated_input] with [code]false[/code] to make events emitted as often as possible. If you use InputEventMouseMotion to draw lines, consider implementing [url=https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm]Bresenham's line algorithm[/url] as well to avoid visible gaps in lines if the user is moving the mouse quickly. + [b]Note:[/b] By default, this event is only emitted once per frame rendered at most. If you need more precise input reporting, set [member Input.use_accumulated_input] to [code]false[/code] to make events emitted as often as possible. If you use InputEventMouseMotion to draw lines, consider implementing [url=https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm]Bresenham's line algorithm[/url] as well to avoid visible gaps in lines if the user is moving the mouse quickly. </description> <tutorials> <link title="Mouse and input coordinates">$DOCS_URL/tutorials/inputs/mouse_and_input_coordinates.html</link> diff --git a/doc/classes/MultiplayerSynchronizer.xml b/doc/classes/MultiplayerSynchronizer.xml index 43355481b6..89ee66a535 100644 --- a/doc/classes/MultiplayerSynchronizer.xml +++ b/doc/classes/MultiplayerSynchronizer.xml @@ -7,7 +7,7 @@ <tutorials> </tutorials> <members> - <member name="congiruation" type="SceneReplicationConfig" setter="set_replication_config" getter="get_replication_config"> + <member name="configuration" type="SceneReplicationConfig" setter="set_replication_config" getter="get_replication_config"> </member> <member name="replication_interval" type="float" setter="set_replication_interval" getter="get_replication_interval" default="0.0"> </member> diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index c53c04af4e..fa106979be 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1484,6 +1484,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const int gn_margin_side = 2; const int gn_margin_bottom = 2; + // StateMachine + const int sm_margin_side = 10; + Color graphnode_bg = dark_color_3; if (!dark_theme) { graphnode_bg = prop_section_color; @@ -1510,10 +1513,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { graphsbposition->set_border_color(error_color); graphsbposition->set_shadow_color(error_color * Color(1.0, 1.0, 1.0, 0.2)); Ref<StyleBoxEmpty> graphsbslot = make_empty_stylebox(12, 0, 12, 0); - Ref<StyleBoxFlat> smgraphsb = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.7), gn_margin_side, 24, gn_margin_side, gn_margin_bottom, corner_width); + Ref<StyleBoxFlat> smgraphsb = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.7), sm_margin_side, 24, sm_margin_side, gn_margin_bottom, corner_width); smgraphsb->set_border_width_all(border_width); smgraphsb->set_border_color(graphnode_bg); - Ref<StyleBoxFlat> smgraphsbselected = make_flat_stylebox(graphnode_bg * Color(1, 1, 1, 0.9), gn_margin_side, 24, gn_margin_side, gn_margin_bottom, corner_width); + Ref<StyleBoxFlat> smgraphsbselected = make_flat_stylebox(graphnode_bg * Color(1, 1, 1, 0.9), sm_margin_side, 24, sm_margin_side, gn_margin_bottom, corner_width); smgraphsbselected->set_border_width_all(2 * EDSCALE + border_width); smgraphsbselected->set_border_color(Color(accent_color.r, accent_color.g, accent_color.b, 0.9)); smgraphsbselected->set_shadow_size(8 * EDSCALE); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index bd9b89cbb7..ece0c6a0ce 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1220,7 +1220,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { for (const StringName &E : nodes) { Ref<AnimationNode> anode = state_machine->get_node(E); String name = E; - bool needs_editor = EditorNode::get_singleton()->item_has_editor(anode.ptr()); + bool needs_editor = AnimationTreeEditor::get_singleton()->can_edit(anode); Ref<StyleBox> sb = selected_nodes.has(E) ? style_selected : style; Size2 s = sb->get_minimum_size(); @@ -1432,7 +1432,6 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { } else { state_machine_draw->draw_texture(edit, nr.edit.position); } - offset.x += sep + edit->get_width(); } } diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 6c39244f80..cd8aca2a8e 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -3428,6 +3428,7 @@ void TileMapEditor::_notification(int p_what) { void TileMapEditor::_on_grid_toggled(bool p_pressed) { EditorSettings::get_singleton()->set("editors/tiles_editor/display_grid", p_pressed); + CanvasItemEditor::get_singleton()->update_viewport(); } void TileMapEditor::_layers_selection_button_draw() { diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 193f18c075..9b347ed7c8 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -681,7 +681,7 @@ void Window::_update_viewport_size() { } break; case CONTENT_SCALE_MODE_VIEWPORT: { - final_size = viewport_size; + final_size = (viewport_size / content_scale_factor).floor(); attach_to_screen_rect = Rect2(margin, screen_size); } break; diff --git a/scene/multiplayer/multiplayer_synchronizer.cpp b/scene/multiplayer/multiplayer_synchronizer.cpp index 34d5abf9f6..13fd7bc77e 100644 --- a/scene/multiplayer/multiplayer_synchronizer.cpp +++ b/scene/multiplayer/multiplayer_synchronizer.cpp @@ -96,7 +96,7 @@ void MultiplayerSynchronizer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_replication_config", "config"), &MultiplayerSynchronizer::set_replication_config); ClassDB::bind_method(D_METHOD("get_replication_config"), &MultiplayerSynchronizer::get_replication_config); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "congiruation", PROPERTY_HINT_RESOURCE_TYPE, "SceneReplicationConfig"), "set_replication_config", "get_replication_config"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "configuration", PROPERTY_HINT_RESOURCE_TYPE, "SceneReplicationConfig"), "set_replication_config", "get_replication_config"); } void MultiplayerSynchronizer::_notification(int p_what) { |