Commit Graph

121 Commits

Author SHA1 Message Date
e31bb5ffeb Rename CanvasItem.update() to queue_redraw()
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +02: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
4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
a7eecc61ad Fix toggling after scrolling resulted in blank space
Previously, the data used by `update_scrollbars()` and `_update_dimensions()` in their calculations depended on each other, which caused some problems.

Now, the calculation of `child_max_size` is put into `get_minimum_size()`, as the containers call `update_minimum_size()` before calling `queue_sort()`.

Make the semantics of variable/function names more clear.

Co-authored-by:  Aaron Record <aaronjrecord@gmail.com>
2022-07-31 09:32:20 +08:00
0c81502217 Merge pull request #62093 from Rindbee/fix-undecided-min_size-in-ScrollContainer 2022-07-22 23:47:48 +02:00
b3bd082070 Merge pull request #63295 from winterpixelgames/master-allow-scroll-container-scroll-to-be-set-instantly 2022-07-22 00:51:43 +02:00
48f2d128d4 Call update_scrollbars() in sort_children() so the max is set properly so you can set scroll_container.scroll_vertical instantly after adding children to a scroll container. 2022-07-21 12:23:41 -06:00
b27bce875f Fix indeterminate minimum size in ScrollContainer 2022-07-21 22:29:25 +08:00
4678736a39 Add suffixes to all nodes and resources 2022-06-11 09:41:05 -05:00
7119d355eb String: Remove TTR and DTR defines in non-tools build
This ensures we don't use TTR in runtime code, as it's specifically meant
to source translations for the editor.
2022-03-28 20:26:35 +02:00
0f5455230c Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
fe52458154 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
1032c2c434 Merge pull request #55487 from YeldhamDev/scroll_bikeshedding 2022-01-03 14:10:41 +01:00
841a9ef820 ScrollContainer's scrollbar visibility is now enum 2021-12-07 18:27:12 +01:00
ea7cc1dea9 Rename minimum_size_changed() method 2021-12-06 14:02:34 +01:00
ec4f4c6cda Rename all methods that return ScrollBar nodes to get_*_scroll_bar() 2021-11-30 13:46:36 -03:00
098e3cf8f7 Fix style issue after #54148 2021-11-16 14:27:44 +01:00
1edbe4f3c1 Merge pull request #54148 from miraz12/fix-scrollContrainer-notification-crash 2021-11-16 14:13:21 +01:00
3c0fdcc8ac Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
ee81979f90 Fixed crash in ScrollContainer _notification 2021-10-23 14:03:26 +02:00
cc51b045da Construct values only when necessary. 2021-09-23 22:26:07 +05:45
a913ae8d56 Add support for internal nodes 2021-08-28 02:07:23 +02:00
5cecdfa8af Entirely removes BIND_VMETHOD in favor of GDVIRTUAL
* `_gui_input`, `_input`, `_unhandled_input` and `_unhandled_key_input` are now regular C++ virutal functions.
* Everything else converted to GDVIRTUAL
* BIND_VMETHOD is gone, always use the new syntax from now on.

Creating `_gui_input` method and using the binder to register events will no longer work, simply override the virtual function now.
2021-08-23 08:10:13 -03:00
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
8fb7a9f023 Merge pull request #49719 from LightningAA/rename-node-is-ancestor-of
Rename `is_a_parent_of()` to `is_ancestor_of()`
2021-06-29 12:07:25 +02:00
452e10ba7b Remove clips_input() method and use clip_content 2021-06-25 15:46:37 +02:00
899e5f8685 Rename is_a_parent_of() to is_ancestor_of() 2021-06-21 08:39:28 -06:00
4c1d555b9a Merge pull request #48770 from LightningAA/scrollcontainer-ensure-item-visible-4.0
ScrollContainer: Expose `_ensure_focused_visible` to the scripting API and rename it to `ensure_control_visible`
2021-06-01 11:01:40 +02:00
6d5b5ba89f ScrollContainer: Expose _ensure_focused_visible to the API
Was renamed to `ensure_control_visible`
2021-05-31 17:14:57 -10:00
97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
bb6bdcee1a Add the ability to hide scrollcontainer's scrollbars 2021-04-28 09:28:31 -06:00
2a8c59c171 Use Array for node configuration warnings
Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
2021-04-11 23:25:38 -05:00
504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
10d7fccb54 Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
7961a1dea3 Initialize class variables with default values in scene/ [2/2] 2021-02-09 18:24:36 +01:00
b5334d14f7 Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
b8610dbd31 Allow ScrollBar params of a ScrollContainer to be modified in _ready()
Initializes the sizes of the ScrollContainer and its associated
ScrollBars in _ready() to allow scroll values to be set in GDScript
initially.
2020-12-29 13:02:02 +08:00
5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
c4c211c3b7 Merge pull request #44605 from madmiraal/rename-control-margin
Rename Control margin to offset
2020-12-23 18:24:00 +01:00
4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
1adea98d07 Use integer text position in scroll container, TextEdit and canvas editor, to ensure sharp text rendering.
Use integer font align/advance with any font scaling, to ensure sharp text rendering.
2020-12-21 07:49:27 +02:00
d89677442b Update page value properly of ScrollContainer 2020-12-01 11:52:37 +09:00
99666de00f [Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
67c2f2445f Fix to update scroll bar has correct max value in ScrollContainer 2020-11-25 05:30:55 +09:00
19f72beebb Merge pull request #42451 from Duroxxigar/rename-toplevel
Renamed toplevel to be top_level
2020-10-02 10:57:23 +02:00
b687ace7f9 Renamed toplevel to be top_level 2020-10-01 03:17:33 -04:00
9fc2b0fddc Update all get_configuration_warning to retrieve warnings from the parent 2020-05-16 16:07:42 +03:00
0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00