Commit graph

741 commits

Author SHA1 Message Date
Meriipu 6f77f1bb3e If the mouse is held on notification_wm_mouse_exit, do not drop focus
This fixes a bug where users of the scrollbar had to be very careful
not to move the mouse outside the viewport, otherwise the scrollbar
would drop its drag-action and stop scrolling until clicked again.

The existing behaviour had the side-effect of also dropping the
cosmetic highlighting of the scrollbar (in addition to the dragging),
for the specific case where the mouse was move outside the window.
The previous behaviour did nothing to remove the highlight if the
mouse was released (but not moved) inside the viewport.

This separate issue with the lingering highlight of the scrollbar
(until a mouse-movement action is performed inside the viewport) is
fixed in an immediate followup to this commit.

Closes bug #39634

(cherry picked from commit 44657db3e2)
2021-02-26 15:22:08 +01:00
Emmanuel Leblond 94fe2dd31e
Fix Godot returned status code on unexpected error 2021-02-25 18:39:29 +01:00
PouleyKetchoupp d94cd42ccd Added option in project settings to draw Shape2D outlines
Disabling collision outlines can be useful for performance when the game
is running and many collision shapes are displayed.
2021-02-25 07:48:33 -07:00
Hugo Locurcio 2735a5498e Improve the get_node() error message to be more descriptive
- Mention the origin of the `get_node()` call.
- Mention whether the attempted path is absolute or relative.

See #46214.

(cherry picked from commit e6abdc943d)
2021-02-22 14:16:42 +01:00
Hugo Locurcio aacaad5066
Draw an outline for 2D debug collision shapes
This makes them easier to distinguish, especially when used
in a TileMap.

The default color's opacity has been slightly decreased to account
for the new outline.
2021-02-21 17:55:54 +01:00
hilfazer 28fa0f5d13 Prevent selecting hidden nodes in Canvas Item Editor 2021-02-20 20:30:16 +01:00
Hein-Pieter van Braam 220f24c191
Merge pull request #45618 from RandomShaper/modernize_mt_3.2
Backport of all the multi-threading modernization (3.2)
2021-02-18 20:47:24 +01:00
Pedro J. Estébanez 4485b43a57 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 12:23:25 +01:00
Pedro J. Estébanez 6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
kobewi 637117c8d1 [3.2] Add node copy-paste 2021-02-13 14:27:36 +01:00
PouleyKetchoupp 5e978d1df5
Fix contact points debug for 3D Physics
Setting each point's position was missing for 3D. Now enabling collision
render debug will display contact points for 3D physics, the same way it
does for 2D physics.

Note: Multimesh rendering seems not to work in this scenario on master,
but it's working fine on 3.2.

(cherry picked from commit e5e9be8355)
2021-02-11 13:12:06 +01:00
Pedro J. Estébanez 745c711289 Implement pause-aware picking
This adds a new project setting (`physics/common/enable_pause_aware_picking`). It's disabled by default.

When enabled, it changes the way 2D & 3D physics picking behaves in relation to pause:
- When pause is set, every collision object that is hovered or captured (3D only) is released from that condition, getting the relevant mouse-exit callback., unless its pause mode makes it immune from pause.
- During the pause. picking only considers collision objects immune from pause, sending input events and enter/exit callbacks to them as expected.
- When pause is left, nothing happens. This is a big difference with the classic behavior, which at this point would process all the input events that have been queued against the current state of the 2D/3D world (in other words, checking them against the current position of the objects instead of those at the time of the events).
2021-02-08 20:48:13 +01:00
Rémi Verschelde bc47a8ae00
Merge pull request #39533 from hilfazer/editable-children-bugfixes
Fix Editable Children issues with node renaming, moving, duplicating and instancing.
2021-01-18 12:31:12 +01:00
Rémi Verschelde 49646383f1
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 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde 08ecc9e5c4
Tooltips: Fix unassigned strip_edges() call on text
Fixes #43940, was a regression from #43280.

(cherry picked from commit a4af94068a)
2021-01-05 21:33:33 +01:00
Andrii Doroshenko (Xrayez) e95e934d88
Do not start Timer upon manual switching of internal process
Prevents `Timer` to prematurely start and timeout immediately if internal
processing is enabled manually with `Timer.set_process_internal(true)` or
`Timer.set_physics_process_internal(true)`.

Even if the internal processing is enabled manually, the user still has to
actually start the timer with `start()` method explicitly.

(cherry picked from commit afcb6f38db)
2020-11-26 09:38:45 +01:00
Hugo Locurcio 3a46e01af3
Remove property groups for Pause Mode and Script
Each of those only grouped 1 property, making them useless.

This closes https://github.com/godotengine/godot-proposals/issues/1840.

(cherry picked from commit 5770e08c2a)
2020-11-17 12:07:02 +01:00
Rémi Verschelde 05143ca39a
Tooltips: Improve code clarity and docs
The return type for `_make_custom_tooltip` is clarified as Control, and users
should make sure to return a visible node for proper size calculations.

Moreover in the current master branch, a PopupPanel will be added as parent
to the provided tooltip to make it a sub-window.

Clarifies documentation for `Control._make_custom_tooltip`, and shows how to
use the (until now undocumented) "TooltipPanel" and "TooltipLabel" theme types
to style tooltips.

Fixes #39677.

(cherry picked from commit c5d8dafec4)
2020-11-11 15:30:56 +01:00
Meriipu 969e60f6b2
Make the currently hovered control get updated on mouse-release
Previously, when the mouse was released after dragging a scrollbar,
its highlight was not dropped (if the mouse cursor was still inside
the viewport). This seems to be because the currently hovered control
only gets updated when the mouse is moved.

This commit fixes the dropping of the cosmetic highlight by running
the check for whether the currently hovered control has changed on
mouse-clicks, in addition to to the existing mouse-movements.

(cherry picked from commit e8804b9978)
2020-11-11 15:12:01 +01:00
lawnjelly fed764b342 Fix editor constant redraw from fxaa and debanding.
Every NOTIFICATION_PROCESS the spatial_editor_plugin.cpp is calling set_use_fxaa which is causing a redraw_request(). Same with debanding.

These can be fixed be checking for noop state changes.
2020-11-02 10:13:18 +00:00
Rémi Verschelde c43b2ab603
Merge pull request #42942 from Calinou/add-viewport-debanding-3.2
Add a debanding property to Viewport for GLES3
2020-10-30 11:47:57 +01:00
Hugo Locurcio 3499799cb3
Improve the font oversampling warning messages to be more descriptive 2020-10-27 12:27:41 +01:00
hilfazer 6dbc08668b Move Editable Children information from scene's root to instanced nodes 2020-10-26 11:55:47 +01:00
Hugo Locurcio 2dbc329704
Add a debanding property to Viewport for GLES3
It can be enabled in the Project Settings
(`rendering/quality/filters/use_debanding`). It's disabled
by default as it has a small performance impact and can make
PNG screenshots much larger (due to how dithering works).

As a result, it should be enabled only when banding is noticeable enough.

Since debanding requires a HDR viewport to work, it's only supported
in the GLES3 backend.
2020-10-20 19:07:15 +02:00
Hugo Locurcio af45c97652
Add fast approximate antialiasing (FXAA) to Viewport
This backports FXAA from the `master` branch.

Co-authored-by: Clay John <claynjohn@gmail.com>
2020-10-20 14:54:52 +02:00
Hugo Locurcio ad4e80f2fa
Recommend restarting after changing the reflection atlas size or HDR
This closes #42687.
2020-10-10 17:04:00 +02:00
Rémi Verschelde e40b4eeeea
Merge pull request #37226 from arrowinaknee/fix-node-config-warnings
[3.2] Update get_configuration_warning() overrides to retrieve warnings from parent class
2020-10-01 14:04:26 +02:00
Tomasz Chabora 7ce476c425 Expose NOTIFICATION_POST_ENTER_TREE
(cherry picked from commit 677796a2c3)
2020-08-14 00:32:05 +02:00
Tomasz Chabora cd01cda143 Fix ultra long node names
(cherry picked from commit d3f2062d86)
2020-07-28 00:43:37 +02:00
ArrowInAKnee e48430b1d4 Make all get_configuration_warning() overrides retrieve warnings from parent 2020-07-13 01:50:02 +03:00
Andrés Botero 6b05f8f602 Fix parent check for add_child_below_node 2020-07-11 15:57:17 -05:00
Maganty Rushyendra 0df5d74e6e Fix signal duplication bug when duplicating node with instanced children
Change error checking in `duplicate_signals()` to check for path to
`p_original`, thus adhering to the method used in `duplicate`, instead
of checking for ownership.
2020-06-11 09:37:47 +08:00
Rémi Verschelde 7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
lawnjelly b6d652367b Items and draw calls added to IDE Monitor in '2d' section
This adds 2 new values (items and draw calls) to the performance monitor in a '2d' section, rather than reusing the 3d values in the 'raster' section.

This makes it far easier to optimize games to minimize drawcalls.
2020-04-16 11:52:22 +01:00
Rasmus Vermeulen 5c64458d9e Add size warning to Viewport Node
(cherry picked from commits 855f4dc193
and 760095e28d)
2020-03-25 11:38:53 +01:00
Rémi Verschelde 6472e09a85 SceneTree: Abort change_scene if we're quitting
Otherwise we can have a segmentation fault if we try to call
`add_child` on an already freed node.

Fixes #35323.
2020-01-19 22:08:40 +01:00
Rémi Verschelde eb89254690 Fix crash when confirming dialogs with Return key
Regression from #34040, apparently making this a const reference
introduces issues (not sure why, but previous code worked fine).

Fixes #34691.

Co-authored-by: dankan1890 <mewuidev2@gmail.com>
2020-01-17 12:47:23 +01:00
Tomasz Chabora bbc36dbc67 Don't show conf warning if script is not tool 2020-01-07 21:28:16 +01:00
Rémi Verschelde ce75a2f33d
Merge pull request #33987 from nekomatata/own-world-environment
Viewport environment is updated properly when set to own world
2020-01-06 15:26:52 +01:00
Hugo Locurcio cc626acf45
Add a shorthand for setting the exit code using SceneTree::quit()
This reduces the amount of code required to exit a process with a
non-zero exit code. This pattern is also found in most other
programming languages.
2020-01-03 11:41:46 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Hugo Locurcio f1052aa893
Improve the Timer wait time property hint
- Make it possible to enter more precise values (up to 3 decimals).
- Make it possible to enter values above 4096.
2019-12-28 22:36:59 +01:00
Rémi Verschelde 3d6f991a17 Revert "Allow tab key to be used for shortcuts"
This reverts commit cafb888361.

Fixes #34405.
Reopens #8799, #24064.
2019-12-18 08:30:39 +01:00
Tomasz Chabora 77a8657633 Scroll ScrollContainer to focused children 2019-12-11 14:29:36 +01:00
Rafał Mikrut ed1c4bc77d Removed unused variables, add some constants numbers 2019-12-10 05:13:02 +01:00
PouleyKetchoupp dc13750189 Viewport environment is updated properly when set to own world
When own_world property is set, the viewport stores a unique resource for the world. With this change it keeps being updated from changes made to the world property instead of storing a default empty world with environment settings that can't be modified.

Fixes #23412
2019-11-29 11:50:10 +01:00
x2f f085110b20 Added more details in Timer.start() error message. 2019-11-27 14:11:15 -05:00
Rémi Verschelde 967cc2c014
Merge pull request #33862 from Faless/net/http_request_chunk_size
Add download_chunk_size property to HTTPRequest.
2019-11-25 14:29:59 +01:00
Fabio Alessandrelli ed19b4076e Add download_chunk_size property to HTTPRequest.
This allows setting the `read_chunk_size` of the internal HTTPClient.
This is important to reduce the allocation overhead and number of file
writes when downloading large files, allowing for better download speed.
2019-11-24 19:32:20 +01:00
Martin Capitanio a7df198c94 Setting the node process priority should not trigger an error
Fixes #33749
This function can be called outside the scene tree.
2019-11-21 18:08:52 +01:00