Commit Graph

72 Commits

Author SHA1 Message Date
Yuri Sizov 95b27fe8c7 Reorganize code related to editor theming
This change introduces a new EditorThemeManager class
to abstract theme generatio and its subroutines.

Logic related to EditorTheme, EditorColorMap, and editor
icons has been extracted into their respective files with
includes cleaned up.

All related files have been moved to a separate folder to
better scope them in the project. This includes relevant
generated files as well.
2024-01-16 11:57:45 +01:00
Christian Kaiser 1910f91f17 Improve "Add" button consistency in Project Settings
* Adds an icon to all the input-adjacent add/remove buttons
 * Adds a separator next to the action map "add" button
 * Changes the Shader Globals editor to be consistent with the others
 * Adds a clear button to the shader global name input
2024-01-11 17:13:23 -03:00
Rémi Verschelde ad3e5a949e
Merge pull request #82283 from YeldhamDev/focus_that_search_bar!
Make the search bars in the "Project Settings" dialog grab focus when they appear
2024-01-04 16:38:52 +01:00
Hugo Locurcio 8e2f3191e7
Add input action name to window title in input map editor 2023-12-18 01:42:59 +01:00
Michael Alexsander c7d0565681
Make the search bars in the "Project Settings" dialog grab focus when they appear 2023-09-25 01:09:29 -03:00
kobewi 6de34fde27 Add EditorStringNames singleton 2023-09-03 19:58:18 +02:00
jsjtxietian 9c1278cae8 save show built-in actions button state 2023-08-22 16:36:48 +08:00
Rémi Verschelde 27fdb06fed
Merge pull request #71322 from EricEzaM/55856-proj-settings-initial-array-dict-shared-instance
Fix Project Settings array/dicts initial value being shared instances of the current value.
2023-02-01 07:29:44 +01:00
bruvzg daad4aed62
Cleanup and unify keyboard input.
- Unify keycode values (secondary label printed on a key), remove unused hardcoded Latin-1 codes.
- Unify IME behaviour, add inline composition string display on Windows and X11.
- Add key_label (localized label printed on a key) value to the key events, and allow mapping actions to the unshifted Unicode events.
- Add support for physical keyboard (Bluetooth or Sidecar) handling on iOS.
- Add support for media key handling on macOS.

Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-01-23 15:08:12 +02:00
kobewi 59ea36b87c Remove set_drag_forwarding_compat() 2023-01-14 15:16:51 +01:00
Eric M 7c73b6c71c Fix Project Settings array/dicts initial value being shared instances of the current value. 2023-01-13 21:48:43 +10:00
Juan Linietsky e6a4debede Change set_drag_forwarding() to use callables.
* This solution is much cleaner than the one in 3.x thanks to the use of callables.
* Works without issues in any language (no need to worry about camel or snake case).
* Editor code uses a compatibility function (too much work to redo).

Fixes #59899
2023-01-10 14:09:24 +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 3238d11247 Fix closing project setting window with ESC while listening for input
This is done by disallowing ESC to be used for closing the window
while the filter-LineEdit is focused.
2022-12-21 12:48:59 +01:00
Eric M da1589dae6 Refactor `get_event_text` to a static method, remove high deadzone from event configuration.
* `get_event_text` and `get_device_string` are now static methods (they always could have been)
* Applied 90% deadzone on joypad motion inputs in the configurator had the effect of ignoring most joypad motion inputs. Low ones do not need to be filtered out as JoypadMotion is only considered 'pressed' if it as above 50% strength - and that works well.
2022-11-18 18:18:31 +10:00
Rémi Verschelde f475c91081
Fix -Wunused-but-set-variable warnings from Emscripten 3.1.20 2022-11-04 11:36:13 +01:00
Eric M 598ee4266c Split `action_map_editor` file into one file per class it contained.
* ActionMapEditor
* EventListenerLineEdit
* InputEventConfigurationDialog
2022-10-06 18:29:20 +10:00
EricEzaM cb6d7fd059 Add searching by event for Editor Settings shortcuts and Project Settings input map.
* Focus into the LineEdit, then perform input to search the list of events by the events assigned.
* New specialised editor-only control for this: EventListenerLineEdit. Line edit is a good candidate for such a control because you can focus it, override it's input handling, and show the event all in one control.
Update InputEventConfigurationDialog to use event listener line edit rather than the separate tabs.
* Cleaner look - no need for tabs.
* Simpler code.
2022-10-03 19:56:34 +10:00
bruvzg 6f4d233062
Fix key mapping changes when moving from macOS to other platform
Removes separate `Command` key (use `Meta` instead).
Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`).
2022-09-07 18:45:35 +02:00
Rémi Verschelde fd6453c45e Revert "Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED"
This reverts commit 4b817a565c.

Fixes #64988.
Fixes #64997.

This caused several regressions (#64988, #64997,
https://github.com/godotengine/godot/issues/64997#issuecomment-1229970605)
which point at a flaw in the current logic:

- `Control::NOTIFICATION_ENTER_TREE` triggers a *deferred* notification with
  `NOTIFCATION_THEME_CHANGED` as introduced in #62845.
- Some classes use their `THEME_CHANGED` to cache theme items in
  member variables (e.g. `style_normal`, etc.), and use those member
  variables in `ENTER_TREE`, `READY`, `DRAW`, etc. Since the `THEME_CHANGE`
  notification is now deferred, they end up accessing invalid state and this
  can lead to not applying theme properly (e.g. for EditorHelp) or crashing
  (e.g. for EditorLog or CodeEdit).

So we need to go back to the drawing board and see if `THEME_CHANGED` can be
called earlier so that the previous logic still works?

Or can we refactor all engine code to make sure that:
- `ENTER_TREE` and similar do not depend on theme properties cached in member
  variables.
- Or `THEME_CHANGE` does trigger a general UI update to make sure that any
  bad theme handling in `ENTER_TREE` and co. gets fixed when `THEME_CHANGE`
  does arrive for the first time. But that means having a temporary invalid
  (and possibly still crashing) state, and doing some computations twice
  which might be heavy (e.g. `EditorHelp::_update_doc()`).
2022-08-29 11:11:29 +02:00
Rémi Verschelde f7f8af232c
Merge pull request #64885 from Mickeon/rename-tooltip-hint
Rename `hint_tooltip` to `tooltip_text` & setter getter
2022-08-28 17:43:01 +02:00
Aaron Record 4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
Micky ef5b9a06a9 Rename `hint_tooltip` to `tooltip_text` & setget
`hint_tooltip` -> `tooltip_text`
`set_tooltip` -> `set_tooltip_text`
`_get_tooltip` -> `get_tooltip_text`

Updates documentation, too.
2022-08-27 01:35:01 +02:00
Yuri Rubinsky 1ab7ad323f Fix input map settings theming 2022-08-25 09:26:20 +03: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
FireForge 97dfbea6ad Rename Control PRESET_WIDE to PRESET_FULL_RECT 2022-07-18 20:08:11 -05:00
FireForge eb573da2b5 Use "odd" style for TabContainers on base BG color
- Use the "odd" style for TabContainers that are on a background with the same color as the default TabContainer background color to add contrast
2022-05-26 21:19:15 -05:00
trollodel 307427af89 Add the button pressed to some signals in Tree 2022-05-21 17:16:52 +02:00
kobewi 1dc7bcc83c Cleanup metadata usage 2022-05-06 00:27:10 +02:00
Aaron Record 6b878e9aea Disable add button when action name is invalid 2022-05-04 11:19:27 -06:00
FireForge 0b0a74e135 Redesign InputEvent editor plugin
- Use vertical layout and add text wrapping
- Fix Window.popup_centered() rect calculation
2022-04-12 08:30:24 -05:00
Eric M cc6a181ed8 Action Map Editor fixes and improvements
Multiple fixes:
* Fixed device not being updated correctly (changing the device dropdown did not actually change the underlying event's device)
* Device selection now defaults to `All Devices`
* Device is now displayed in the text shown in the input event editor, and in the action list.
* There was code running twice previously because of the following interaction: 1) input via "Listen for Input" tab. 2) `_set_event` gets called. 3) input list tree selection gets updated to match the listened event. 4) tree "item_selection" signal is emitted. 5) eventually `_set_event` is called again.
* The only reason this was not an infinite loop is because reselection is disabled on the tree. So, the code runs twice - not a big deal, but it is unnecessary processing and it could cause an issue in the future. If someone turns on reselection on the tree, the whole thing comes crashing down. This should prevent that scenario and make the code a bit safer and more robust.
2022-04-01 21:34:09 +10:00
Rémi Verschelde fbfa12dd76 Fixup enum compare after #53734 2022-03-25 15:22:53 +01:00
Rémi Verschelde 6d28ff6e23
Merge pull request #53734 from jmb462/fix-missing-action-icons 2022-03-25 14:01:17 +01:00
Michael Alexsander deb1342036 Make `TabBar/Container` default their alignments to the left instead of center 2022-03-17 18:12:23 -03:00
Aaron Franke 918b09cabc
Initialize bools in the headers in editor 2022-03-12 13:34:06 -06:00
Michael Alexsander a811ebf699 Make `TabContainer` use `TabBar` internally 2022-03-03 21:49:58 -03:00
jmb462 dcd2a92af3 Port existing _notification code to use switch statements (part 1/3) 2022-02-16 11:38:24 +01:00
Rémi Verschelde 11572c6e30
Editor: Cleanup some includes dependencies
Removes some unnecessary includes from `editor_node.h`, and instead add
those where they're used.

Removes unnecessary `editor_node.h` includes in various editor classes.

Renames `dynamicfont` to `dynamic_font` in a couple files.

Misc cleanup while jumping through that rabbit hole.
2022-02-15 14:54:15 +01:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Rémi Verschelde db155a7cb3
Merge pull request #56221 from YeldhamDev/inputmap_undo_master 2022-01-13 12:27:17 +01:00
Marcel Admiraal 5737e7dd2d Check if action name exists before adding it or renaming an action to it 2022-01-12 15:19:18 +00: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
Michael Alexsander 6033711379 Fix undo/redo operations in Input Map 2021-12-24 01:19:24 -03:00
Nathan Franke 49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Nathan Franke 41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
Lightning_A e078f970db Rename `remove()` to `remove_at()` when removing by index 2021-11-23 18:58:57 -07:00
Hugo Locurcio 8fb7e622a6
Rename built-in `SGN()` macro to `SIGN()`
This matches the name of the GDScript function (except it's uppercase
here).
2021-11-16 20:40:49 +01:00
Aaron Franke 3c0fdcc8ac
Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
Rémi Verschelde 3b11e33a09
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +02:00