Commit graph

118 commits

Author SHA1 Message Date
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
Rémi Verschelde
5e39a8eded
Merge pull request #56992 from YeldhamDev/smarter_popmenu_focus 2022-02-03 17:15:06 +01:00
eikobear
3b146c5eaa Make various improvements to OptionButton
- Allow OptionButton selection to be set to -1 to signify no selection, both via API and in the editor.
- Reset OptionButton selection to -1 when the selected item has been removed.
- Fully convert PopupMenu to a zero-based ID system, which improves an inconsistency in generated IDs when making new items in the editor.
2022-01-28 17:03:45 -05:00
Michael Alexsander
73c225838f Make popup menus focus items automatically when not using the mouse 2022-01-25 13:51:56 -03:00
Ricardo Buring
4562106cbf OptionButton::pressed(): give focus to selected 2022-01-15 22:52:12 +01:00
Rémi Verschelde
fcc2648e18
Fix missing arg name in bindings for GDExtension API 2022-01-07 14:24:06 +01:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
kobewi
c68e93ad52 Implement property array for OptionButton 2021-12-21 08:53:09 +01:00
Nathan Franke
41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
Hugo Locurcio
c012fbc8b2
Rename PROPERTY_USAGE_NOEDITOR to PROPERTY_USAGE_NO_EDITOR
This is consistent with other constants that include `NO`,
such as `PROPERTY_HINT_COLOR_NO_ALPHA`.
2021-11-03 23:06:17 +01:00
Yuri Sizov
12838bd99d Add focus font color to Button and derivatives 2021-10-26 17:42:40 +03:00
Rémi Verschelde
b334560f05
Merge pull request #49376 from menip/OptionButtonFix 2021-09-17 16:00:42 +02:00
menip
4f4c9a5f57 Make Color Picker, Menu Button, Option Button consider camera position scale for popup position. 2021-08-30 08:42:33 -07:00
kobewi
a913ae8d56 Add support for internal nodes 2021-08-28 02:07:23 +02:00
reduz
6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00