Commit Graph

195 Commits

Author SHA1 Message Date
6de34fde27 Add EditorStringNames singleton 2023-09-03 19:58:18 +02:00
3dbd47ecb6 Expose Control::_get_drag_data() as non-const function 2023-05-24 06:09:45 +09:00
91ff34b5b5 Add a warning when trying to access theme items too early 2023-04-03 18:01:10 +02:00
a95cd3872a Add missing virtual bind for control::get_tooltip 2023-03-21 17:39:51 +01:00
3bc426c9d8 Fix toplevel nomenclature
toplevel was 3.x
top_level is 4.x
2023-02-02 17:37:41 +01:00
4cfdd25384 Merge pull request #67507 from Sauermann/fix-toplevel-root-control-node
Fix event propagation to child after set_as_toplevel
2023-01-31 15:55:46 +01:00
65883cc73b Merge pull request #71598 from bruvzg/gdscript_bidi_override
Implement BiDi override mode for GDScript source.
2023-01-19 19:33:18 +01:00
c0083e431b Cleanup unused engine code v2 2023-01-19 13:02:18 +01:00
5361ec9f43 Implement BiDi override mode for GDScript source. 2023-01-18 19:22:20 +02:00
59ea36b87c Remove set_drag_forwarding_compat() 2023-01-14 15:16:51 +01:00
3e2843e3ad Merge pull request #71183 from YuriSizov/control-refresh-layouts-by-parents
Ensure that the cached layout mode is in sync
2023-01-11 01:29:51 +01:00
42cbdbc7df Ensure that the cached layout mode is in sync 2023-01-10 23:51:27 +03:00
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
00b5222f66 Fix inconsistent state of Controls when editing and running scenes 2023-01-09 15:54:04 +03:00
47592927b3 Use BitField<> hint for ArrayFormat
This was missing in the conversion of bitflags to BitField<>.
2023-01-08 18:47:48 +01:00
3579d7a9f7 Merge pull request #36301 from KoBeWi/daddy_node
Add reparent methods to Node
2023-01-07 13:20:56 +01:00
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
80b578b060 Restore 'rotation_degrees' properties.
By popular demand, restoring the helper properties to rotate objects in degrees.
Affected are local and global rotations for:

* Node2D
* Node3D
* Control
2022-12-19 10:59:47 +01:00
29cc86fa6c Copy local theme overrides from Control to Window 2022-12-07 20:50:51 +03:00
3add6dcd89 Add Control::localize_numeral_system property to toggle automatic numeral system conversion. 2022-11-17 14:59:56 +02:00
4134f2a464 Merge pull request #67566 from Sauermann/fix-code-simplifications
Code simplifications
2022-10-23 17:02:04 -07:00
d148613bb1 Merge pull request #66279 from aaronfranke/control-min-size
Revert `custom_minimum_size` type back to `Vector2` instead of `Vector2i`
2022-10-19 22:40:52 +02:00
b8031bb7d6 Code simplifications
1. Viewport::get_visible_rect().position is always zero.
So Control::get_window_rect is identical to Control::get_global_rect.
Remove Control::get_window_rect since it is not used in the source code.

2. sqrt(a * a) = abs(a) for doubles

3. Simplify affine_inverse combination

4. Simplify calculation in shaders
2022-10-18 12:47:40 +02:00
13b87c13c7 Fix set_as_toplevel event propagation to child
In certain conditions events did not get propagated to Control childs of
Node2D nodes when setting a parent of the Node2D to toplevel.

This patch makes sure that such Control nodes become root control in the
viewport.
2022-10-16 21:42:16 +02:00
f32f5b70d8 Merge pull request #67348 from Mickeon/salvage-a-dear-comment
Comment not to remove `data` structs in some Nodes
2022-10-13 18:40:58 +02:00
de9e08da76 Comment not to remove data structs in some Nodes 2022-10-13 15:52:35 +02:00
a3ed9e6f2c Move Shortcut Context to Control and ensure that shortcut_input adheres to contexts. Also ensure that controls with no context are only triggered AFTER nodes which do have a context. 2022-10-13 21:07:19 +10:00
c3970f8fe5 Revert custom_minimum_size type back to Vector2 instead of Vector2i 2022-09-22 19:09:12 -05:00
aed3822a93 Change return type of get_configuration_warnings to PackedStringArray 2022-09-19 16:43:15 +01:00
c4c9e41073 Make Vector2i values paired with EDSCALE be just Vector2 2022-09-08 14:46:32 -03:00
8b128081e8 Un-defer the initial theme changed notification
Co-authored-by: Rindbee <idleman@yeah.net>
2022-09-02 23:44:23 +03:00
ddc55ef746 Add ThemeOwner type for managing theme propagation and lookup 2022-09-02 23:44:23 +03:00
3b1aa240dc Add a lifecycle method for manual theme item caching to Control 2022-09-01 16:35:36 +03:00
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
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
4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
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
74eb2a70bd Refactor and remove excessive calls of NOTIFICATION_THEME_CHANGED 2022-08-25 14:50:49 -06:00
bb5fa91a6b Disconnect Control from theme resources to avoid issues on destruction 2022-08-24 18:50:04 +03:00
8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
1f61d47766 Merge pull request #64339 from YuriSizov/core-multilevel-validate-property 2022-08-22 21:39:48 +02:00
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
e08feee8a6 Replace meta properties with regular properties in Control 2022-08-19 20:52:01 +03:00
2bdd7e9ea0 Add methods for node reparenting 2022-08-16 19:44:41 +02:00
9f88300007 Add dumb theme item cache to Control 2022-08-12 14:36:06 +03:00
d04c154585 Merge pull request #63318 from YuriSizov/control-code-reorg 2022-07-27 10:47:12 +02:00
6ca95003a9 Reorganize code of control.cpp for better maintainability 2022-07-26 23:03:49 +03:00
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
97dfbea6ad Rename Control PRESET_WIDE to PRESET_FULL_RECT 2022-07-18 20:08:11 -05:00
21b253a870 Define some Theme data structures with using for readability 2022-05-18 18:17:47 +03:00