Commit graph

132 commits

Author SHA1 Message Date
A Thousand Ships
d9e2fc74c7
[Scene] Add SceneStringNames::item_selected 2024-06-19 09:39:05 +02:00
bruvzg
ea379e3b3a
Improve button min. size calculation. 2024-05-16 22:37:12 +03:00
Gilles Roudière
7705265477 Fix PropertyListHelper::_get_property returning a valid value even if an index is outside the array valid indices
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
2024-05-10 10:46:04 +02:00
kobewi
e95e954c68 Add PropertyListHelper in all simple cases 2024-04-11 18:13:29 +02:00
风青山
5de496d3b0
Add a h_separation between icons in CheckButton/CheckBox
Previously, the `h_separation` between internal elements and custom elements
was added when `text` was not empty. That is, this `h_separation` does not
exist when there is a valid custom `icon` but `text` is empty.

Now, the `h_separation` between the internal element and the custom element
is added when the internal element and any custom element exist (both width
are greater than `0`).
2024-02-21 17:53:07 +08:00
Rémi Verschelde
02f4a66c1f
Merge pull request #88145 from Ratamacue9112/tweak-option-button-property-order
Tweak property order in the inspector for OptionButton
2024-02-17 18:31:47 +01:00
Ratamacue9112
45b9cbd904 Tweak property order in the inspector for OptionButton 2024-02-17 11:03:16 +00:00
Michael Alexsander
7b42c24550
Make auto translation inheritable 2024-02-15 16:51:19 -03:00
Rindbee
f29a7d302e Make the drawing logic clearer in Button
The drawing logic follows the calculation logic in `Button::get_minimum_size`.

According to the order of `stylebox`, `icon`, and `text`, and follow properties
such as alignment mode, to fill the display space of the button.

Add a `Button::_set_h_separation_is_valid_when_no_text` for Button derived
classes (like `OptionButton`) that expects a `h_separation` between `icon`
and theme icon even if the `text` is empty.
2024-01-18 22:57:22 +08:00
Wilson E. Alvarez
a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
Yuri Sizov
2924bfd4d3 Register theme properties with ThemeDB 2023-09-11 13:45:23 +02:00
Rémi Verschelde
0fff0b1054
Merge pull request #80203 from WhalesState/Dev2
Add shortcut handling to `OptionButton`
2023-08-17 11:24:14 +02:00
Haoyu Qiu
5dd854513e Fix OptionButton min size when fit longest item is enabled 2023-08-07 17:25:10 +08:00
Mounir Tohami
2cec27a3f1 Add shortcut handling to OptionButton 2023-08-03 08:38:20 +00:00
Haoyu Qiu
5384c1a579 Update OptionButton min size when disabling Fit to Longest Item 2023-07-15 11:10:23 +08:00
Florian Kothmeier
c33748d954 Fix invalid minimum size for translated messages in option button 2023-06-29 15:01:36 +02:00
Rindbee
9bd1d3b5c8 Update size or size cache when toggling expand_icon in Button
When the `expand_icon` is switched, the size cache can be updated to
solve the issue that the cache cannot be updated when the `OptionButton`
is enabled with `fit_to_longest_item`.
2023-05-17 06:06:25 +08:00
Rémi Verschelde
57e3651763
Merge pull request #72028 from kilojool/option_button_reselection
OptionButton: allow reselection of selected item
2023-04-03 17:06:36 +02:00
Haoyu Qiu
150f89352b Auto translate popup menus of MenuButton and OptionButton
Currently, `auto_translate` property of a `MenuButton` or `OptionButton`
won't affect its popup menu. It's okay if you want to auto translate,
but requires extra setup if you don't.
2023-03-27 18:09:24 +08:00
Markus Sauermann
084a4addc4 Fix Screen-Transform missing in Button Size in OptionButton::show_popup
The button size is affected by the screen transform, which was previously
not taken into consideration.
2023-02-06 20:58:57 +01:00
kilojool
8b008757db OptionButton: allow reselection of selected item 2023-01-25 15:11:48 +01:00
Juan Linietsky
0e0a6bb39b
Removed unused property hints and Object::get_translatable_strings()
* Remove unused `EditorPropertyMember` and related hints, previouly used by
  VisualScript. Such logic should be implemented in the VS module itself.
* As the above broke compatibility with the VS module, clean up the other
  hacks that were still in core in support of VisualScript.
* `PROPERTY_USAGE_INTERNATIONALIZED` was only used in Object's
  `get_translatable_strings()`, which is a legacy function not used anywhere.
  So both are removed.
* Reordered some usage flags after the above removal to minimize the diff.
* General clean up.

Fixes #30203.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-09 16:56:01 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Markus Sauermann
95597bb2ac Fix position and size of OptionButton PopupMenu
Use the correct Transform2D (get_global_transform_with_canvas) for
position and size.
2022-11-12 21:12:02 +01:00
kobewi
1778301cd0 Add call_deferred() method to Callable 2022-11-04 17:24:34 +01:00
EricEzaM
272c297931 Improve MenuButton and OptionButton
* MenuButton + OptionButton: Add method `show_popup()` which performs required popup setup before showing (prefer use of this over `get_popup()->popup()`, otherwise GH #66308 occurs)
* MenuButton: Ensure that the menu can be opened with a shortcut, if one is set for the button. (GH #66403). Ensure that popupmenu item shortcuts are checked first before the MenuButton shortcut.
2022-10-03 20:07:39 +10:00
Michael Alexsander
9507e91c07 Rename PopupMenu's set/get_current_index() to set/get_focused_item() 2022-09-06 10:51:14 -03:00
Yuri Sizov
3b1aa240dc Add a lifecycle method for manual theme item caching to Control 2022-09-01 16:35:36 +03:00
Michael Alexsander
221344b9e2 Fix some corner cases in the Menu/OptionButton item auto-highlight 2022-08-28 01:15:03 -03:00
Rémi Verschelde
ac7b5111f5
Merge pull request #64768 from bruvzg/popups_hide_if_visible 2022-08-26 11:59:50 +02:00
Rémi Verschelde
b7d2ba12c8
Merge pull request #64635 from YeldhamDev/menu_buttons_popup_fix
Make `Menu/OptionButton` item auto-highlight behave better
2022-08-24 19:07:25 +02:00
bruvzg
cd095ab64a
Hide MenuButton / OptionButton popup on click if it's already visible. 2022-08-23 10:38:51 +03:00
Rémi Verschelde
b9ea0e1338
Merge pull request #64218 from Rindbee/fix-button-minimum-size-calculation 2022-08-22 22:40:59 +02:00
Yuri Sizov
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
Michael Alexsander
1da50698fc Make Menu/OptionButton item auto-highlight behave better 2022-08-19 14:54:53 -03:00
Rindbee
4a3a15c304 Fix case where h_separation might not work in Button
This patch mainly solves two things:
1. The typo of `h_separation`;
2. Negative values of `h_separation` will be treated as `0` when used, to prevent the button's minimum `width` from being reduced by `h_separation`.
2022-08-12 19:57:08 +08:00
kobewi
e06cd2742f Add missing properties to default theme 2022-08-11 14:15:04 +02:00
Yuri Sizov
1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00
kobewi
24d02dfb47 Add fit_to_longest_item to OptionButton 2022-08-02 23:37:43 +02:00
Juan Linietsky
d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
SnailRhymer
d79818acb6 Fix errors and improve UX relating to new animation libraries
- Fix a bug causing an error message when a scene containing an AnimationPlayer with a reset track is saved, by correctly referencing the temporary "default" library.
- Make library dropdown in new animation window assign correct library when creating an animation.
- Similarly allow choice of library when duplicating animation.
- Make library dropdown default to library of currently selected animation.
- Make library dropdown show when exactly one library exists, and it isn't [Global]. Include [Global] on the dropdown in this case (will be newly created if dialog is confirmed).
- When appending (x) to avoid New Anim name collisions, correctly check target library instead of [Global].
- Add parentheses when appending x when duplicating animations in the library editor, for consistency.
- Change titles and prompts to be distinct in name/rename/duplicate dialiogs.
- Fix bug in OprionButton.get_selectable_item(true) when last is not selectable.
- Fix issues where animation wasn't found on deletion/rename by correctly prepending library name.
- Remove an extraneous print_line from animation_track_editor.
- Add messages to errors when an animation isn't found.
2022-05-17 00:02:51 +01:00
FireForge
3073b85de9 Rename theme properties to include underscores
- check_vadjust -> check_v_adjust
- close_h_ofs -> close_h_offset
- close_v_ofs -> close_v_offset
- commentfocus -> comment_focus
- hseparation -> h_separation
- ofs -> offset
- selectedframe -> selected_frame
- state_machine_selectedframe -> state_machine_selected_frame
- table_hseparation -> table_h_separation
- table_vseparation -> table_v_separation
- vseparation -> v_separation
2022-04-23 11:16:18 -05:00
reduz
6f401439f8 Implement Animation Libraries
* Instead of containing single animations, AnimationPlayer now contains libraries.
* Libraries, in turn, contain the animations.

This paves the way for implementing the possibility of importing scenes as animation libraries, finally allowing to import animations separate from the 3D models.

Missing (will be done on separate PRs):

* Make it possible to import scenes (dae/fbx/gltf) as animation libraries.
* Make it possible for AnimationTree to import animation libraries on its own, so it does not rely on AnimationPlayer for everything.
2022-04-11 12:51:54 +02:00
kobewi
342dac77d4 Hide text and icon properties in OptionButton 2022-03-19 13:36:10 +01:00
Haoyu Qiu
a635ecf6d4 Add item tooltip access to OptionButton 2022-03-17 13:50:16 +08:00
Hugo Locurcio
a06f82ca4d
Add optional constructor arguments to more Control nodes
This can be used to make editor code more compact.
However, as of writing, these constructor arguments cannot be used
from the scripting API.

This was already provided for Label and CheckBox, but it was missing
for other Control nodes where it made sense to provide a default value.
2022-03-04 09:48:41 +01:00
Rémi Verschelde
0f5455230c
Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
Rémi Verschelde
b6ddf4a629
Merge pull request #57692 from YeldhamDev/popping_options 2022-02-08 14:04:28 +01:00
Michael Alexsander
8bde86da10 Make popups from MenuButton, OptionButton, and submenus obey the layout direction 2022-02-06 23:07:08 -03:00
Michael Alexsander
21bf23d966 Enhancements and fixes for OptionButton and PopupMenu 2022-02-06 16:03:18 -03:00