Commit Graph

573 Commits

Author SHA1 Message Date
cf8455c52d Fix regression causing jittery canvas transforms
This PR https://github.com/godotengine/godot/pull/104451 introduced
a tricky regression. Canvas item transforms could risk not being
updated for multiple frames due to the conditional on the line
in this commit. Before the "approx_pos|size_changed" fix, the
transform would get updated incidentally either way. But now there's
a gap where (pos_changed && !size_changed) may not be true for a few
frames and there's nothing else left to trigger a transform update.

The fix is quite simple, for updating the canvas item transform
we remain trigger happy around position changes, but respect the
approx_size_changed.
2025-04-16 23:59:05 -07:00
00bd421089 Merge pull request #105222 from kitbdev/fix-mouse-filter-recursive-and-rename
Fix and rename mouse filter recursive behavior and focus mode recursive behavior
2025-04-16 10:45:12 -05:00
94282d88f9 Core: Use Math namespace for constants 2025-04-10 16:29:30 -05:00
kit
d16e8b7ca4 Fix and rename mouse filter recursive behavior
and focus mode recursive behavior.
2025-04-09 23:45:03 -04:00
c6394a1b8b Merge pull request #104357 from FilipeAlexCosta/control-set-position
Fix `Control.set_position` resizes offsets/anchors
2025-04-09 18:11:55 -05:00
36a135ca62 Merge pull request #104451 from WinnerWind/fix_resized_logic_for_control
Fix excessively calling resized and floating point errors in Control.
2025-04-09 18:11:35 -05:00
c7fc877895 Merge pull request #101745 from Rindbee/remove-is_top_level_control
Remove confusing `Control::is_top_level_control()`
2025-04-09 08:51:46 -05:00
b106dfd4f9 Base accessibility API. 2025-04-08 20:14:28 +03:00
b7c452a36d Merge pull request #104614 from kleonc/control_layout_mode_fallback_to_valid_value
Fallback `Control.layout_mode` to valid mode when child of non-container control
2025-04-07 08:43:22 -05:00
ca57fe1db4 Fix #100536: Control set_position resizes offsets/anchors
The set_position method computes the anchors/offsets to match a
rectangle at the given position with size "size_cache". However, when
the Control's combined minimum size is larger than the size obtained
through the offsets and anchors, "size_cache" is set to be as large as
the combined minimum size. Therefore, when position is set while the
combined minimum size is larger than the rectangle given by the anchors
and offsets, it would resize these two fields, which would then stop
the Control from shrinking when its combined minimum size decreased. To
fix this, set_position now uses the size given by the offsets and
anchors instead of the "size_cache" field. This way, the rectangle
denoted by the offsets and anchors is simply moved, without being
resized, enabling the Control to shrink automatically when its combined
minimum size decreases. I also added a test case to ensure that the
Control shrinks correctly after setting its position while it has a
larger custom minimum size than the one obtained through the offsets
and anchors.
2025-03-31 08:50:00 +01:00
ba3482926d Merge pull request #104444 from Delsin-Yu/fix-disabled-recursive-behavior-not-applied-on-ready
[GUI] Fix reparenting control does not update recursive mode cache properly
2025-03-29 10:16:35 -05:00
04608fae4a [GUI] Fix an issue where setting a control's recursive mode to disabled does not work on ready. 2025-03-29 06:34:11 +08:00
75881f8322 Use initializer list in Arrays 2025-03-26 18:38:15 +01:00
065d567116 Fallback Control.layout_mode to valid mode when child of non-container control 2025-03-25 17:08:44 +01:00
d4bdb1a2b2 Use approximate values for resized.
This introduces two new booleans approx_pos_changed and approx_size_changed which are the pos_changed and size_changed booleans that are immune to floating point errors.

This aims to fix two bugs in one shot. #93832 and #48935
2025-03-21 22:01:54 +05:30
7ad0b9b16c Merge pull request #97495 from Delsin-Yu/control_recursive_disable_children
[GUI] Implement properties that can recursively disable child controls' `Focus Mode` & `Mouse Filter`
2025-03-19 12:26:03 +01:00
3bc2821e26 Merge pull request #102372 from Rindbee/display-the-actual-used-theme-items-in-the-Inspector
Display the actual used theme items in the Inspector
2025-03-11 16:53:55 -05:00
a49ca33a7f Implement properties that recursively disables children's focus & mouse filter.
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-03-07 22:34:58 +08:00
bef64baa18 Display the actual used theme items in the Inspector
Closes: godotengine/godot-proposals#4439.

Allows viewing the default values ​​of the currently used theme item
in the Inspector.

For theme item properties of resource type, editing the default
resource does not make sense. Use **Make Unique** to create a copy
before editing.
2025-02-07 07:29:30 +08:00
7230932dba Fix ui navigation break
Use `is_visible_in_tree()` instead of `is_visible()` to check for
invisible controls.
2025-01-29 20:57:59 +08:00
f7397a0fee Remove confusing Control::is_top_level_control()
It's hard to tell at first glance under what circumstances `is_top_level_control()`
returns `true`. So it's hard to decide when to use this method. And it seems to be
just a helper function for `Control::get_root_parent_control()`.

`is_top_level_control()` seems to only return `true` during entry and exit of canvas.
2025-01-28 00:29:23 +08:00
e197463525 Fix getting wrong focus neighbor when the control is in ScrollContainer
Exclude controls inside a `ScrollContainer` that are outside the visible area of ​​
the `ScrollContainer` when looking for focus neighbors.
2025-01-16 07:55:56 +08:00
a1846b27ea Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
2024-12-23 16:35:02 -05:00
1daa9a180b Fix Control offset_* property types 2024-12-06 09:06:55 +01:00
d58b2e879f Get rid of easily removable uses of const_cast 2024-12-01 17:50:13 -08:00
58e79bfa9a Compile certain CanvasItem._edit_*() functions with DEBUG_ENABLED 2024-11-02 15:43:18 -03:00
0d350e7108 Set clang-format RemoveSemicolon rule to true
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
009446a277 Add System Locale layout direction for Control and Window 2024-10-17 07:52:07 +08:00
78801f61da Add auto translate mode for tooltips 2024-09-26 22:31:22 +08:00
0dde931bc9 StringName: Fix empty hash
+Fixed compat hashes
2024-09-09 13:30:02 -07:00
5216edeb14 Merge pull request #95500 from tetrapod00/zero-separation-focus-neighbor
Fix wrong focus neighbor for grid-aligned 0 separation controls
2024-09-08 23:21:18 +02:00
c5ef2e2112 Add tie-breaking to find focus neighbor in Control 2024-09-06 18:07:48 -07:00
9dc231366d Fix super call in various get_configuration_warnings methods 2024-09-05 16:08:35 +02:00
ea26272075 Merge pull request #93800 from EAinsley/fix#92929
Fix incorrect size calculation when position is set on resized
2024-08-28 00:11:25 +02:00
e3695423b2 Merge pull request #93363 from kitbdev/pass-propagate
Clarify Mouse Filter Pass in the Inspector
2024-08-28 00:11:06 +02:00
588cf16630 Merge pull request #84840 from kleonc/control-get-transform-simplification
Simplify `Control` internal transform calculation
2024-08-26 23:28:08 +02:00
091212b4f1 Merge pull request #93602 from aaronp64/inspector_latency
Improve Editor Inspector/Theme item lookup performance
2024-08-22 00:10:26 +02:00
7593e55527 Improve Editor Inspector/Theme item lookup performance
Changes to reduce the latency between changing node selection in the editor and seeing the new node reflected in the Inspector tab

- Use Vector instead of List for ThemeOwner::get_theme_type_dependencies and related functions
- Use Vector instead of List for ThemeContext::themes, set_themes(), and get_themes()
- Add ClassDB:get_inheritance_chain_nocheck to get all parent/ancestor classes at once, to avoid repeated ClassDB locking overhead
- Update BIND_THEME_ITEM macros and ThemeDB::update_class_instance_items to use provided StringNames for call to ThemeItemSetter, instead of creating a new StringName in each call

These changes reduce the time taken by EditorInspector::update_tree by around 30-35%
2024-08-20 13:39:40 -04:00
5be4eb9fc6 Simplify Control internal transform calculation 2024-08-19 12:14:41 +02:00
7343dc3a5d Split TranslationServer into its own file 2024-08-15 15:00:47 +08:00
5da03541a1 Merge pull request #93749 from alvinhochun/gui-snap-to-pixel-round-halfway-to-positive
Change GUI controls pixel snap to round halfway towards positive infinity (`floor(x + 0.5)`)
2024-07-17 15:44:43 +02:00
1c47fd7089 Fix Control nodes emitting unnecessary resized signals 2024-07-05 01:41:21 +02:00
819c392ca3 Notify item_rect_changed before resized. 2024-07-01 11:54:07 +08:00
cc45c2cdd3 Change GUI controls pixel snap to round halfway to +ve infinity 2024-06-30 00:33:37 +08:00
kit
a3b944c41d Clarify Mouse Filter Pass in the Inspector 2024-06-19 14:43:06 -04:00
22b6f962d9 Invalidate Control global transform before notifying about resize / rect change 2024-05-30 10:10:24 +02:00
8652e9914f Fix theme StyleBox override parameter completion
Also added completion for remove_theme_*_override.
2024-05-24 08:12:53 +08:00
413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
a262d2d881 Add shorthand for using singleton string names 2024-05-11 18:53:08 +02:00
82b6f9d7a7 Fetch argument options from ThemeDB 2024-05-07 15:02:50 +02:00