The functionality of `push_unhandled_input` has changed so that it no
longer propagates input events to SubViewports.
This makes it less predictable and it should be deprecated in favor of
`push_input` which provides the same functionality and more.
Also this deprecation simplifies the Viewport-API by reducing the methods
for pushing input events, so that users don't need to worry about when
to use which function in order to insert input events.
A single mouse click can cause multiple actions, which contradicts
the paradigm that a single Input Event should cause only a single
action.
The solution consists of two parts:
1. Physics Picking as the last step during viewport input event
handling, currently doesn't set the event as handled. This PR sets
the event as handled in the case of physics picking.
2. After an InputEvent is processed by a SubVieportContainer, it is
sent to its parent, even if it set as handled within the SubViewport.
This PR adds an additional test to check if the event is handled
before propagating the event to the parent Control.
The associated `ViewportTexture`s will update the `viewport_path`
in time when the `Viewport`'s nodepath is changed (caused by renaming
the node names or moving in the SceneTree dock).
If the target `Viewport` is changed by resetting the `viewport_path`,
the `ViewportTexture`s will be re-setup and emit `changed` signal in
time.
* This notification makes node children management very inefficient.
* Replaced by a NOTIFICATION_CHILDREN_CHANGED (and children_changed signal).
* Changed Canvas code (and similar) to use the above signal, to perform more efficiently.
This PR breaks compatibility (although this notification was very rarely used, even within the engine), but provides an alternate way to do the same.
It is required for the changes in #75627 to be entirely effective.
Fixes#75084.
The clamp_to_embedder setting was added in 8be16e0704,
but was not set on any of the in-editor dialogs.
This patch sets `clamp_to_embedder` on editor dialogs so they cannot be dragged out of the frame.
This also modifies `clamp_to_embedder` so a window is clamped to the bounds of an embedder when
it pops up and when the parent is resized.
This solves the problem, that mouse events get sent to SubViewports
even if they are outside of the visible area of the SubViewport.
This changes makes SubViewportContainer::unhandled_input redundand.
Shortcut Events now need to be distributed via push_input, in order for
them to be able to reach SubViewports.
In the editor, it was possible to set the size of a `SubViewport` even
in cases where a parent `SubViewportContainer` had stretch enabled.
This PR disables editing a `SubViewport.size` while the parent disallows
it and it makes necessary adjustments during `NOTIFICATION_ENTER_TREE`.
With the 4.x-introduction of Windows the previous method for
color picking was no longer working.
This PR uses the following approach to reintroduce color-picking.
When the Color-Picking-Button is pressed, a quasi-screenshot of the
Window-content is created and displayed in a new Popup-Window.
This new Window allows selecting colors by Mouse-Click.
A Preview of the targeted Color is also displayed.
1. `number_width` isn't used later
2. `return_type` is used only once
3. AudioServer::get_singleton()->get_channel_count() always returns a channel_count of 1 or larger
4. negative `aa->backward` conditional
5. `current_canvas` == `find_world_2d()->get_canvas()`
6. identical if `render_shadows`
Some internally created emulated/instantiated events didn't have a
device id. This PR sets for these cases a device id.
Also rename `DEVICE_ID_TOUCH_MOUSE` to the more generic
`DEVICE_ID_EMULATION`.
This patch adds a viewport-configuration-option for sorting
physics-picking events by the Z-Index and the scene tree position
of the collision objects.
`Viewport.to_screen_rect` is used only in a single location to compare it
to `Rect2i()`.
When called from `SubViewport`, `to_screen_rect` is always equal to `Rect2i()`.
When called from `Window`, `to_screen_rect` is always different from `Rect2i()`.
So the comparison `to_screen_rect != Rect2i()` can be replaced by
`Object::cast_to<Window>(this)`.
This allows the removal of `Viewport.to_screen_rect` and the simplification of
`Viewport::_set_size`.
CanvasItem::get_screen_transform returns a transform from the CanvasItem
to the coordinate system, where a Popup - created as a child of the
CanvasItem - should be opened.
get_screen_transform makes some simplifications, that work well, when used
in the editor, but not in general cases.
Since Popups like Tooltips are now used more commonly in projects,
it becomes necessary to correct these simplifications.
This solution introduces Viewport::get_popup_base_transform, which makes
the necessary calculations.
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
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".
fixes#68197
when NOTIFICATION_WM_WINDOW_FOCUS_OUT is recieved by a viewport it will now call
_gui_cancel_tooltip() to avoid it hanging around after the mouse events stop
coming in
This patch implements the functionality to cancel Drag and Drop
by using the escape key or more general, the ui_cancel action.
Since this would be the third location, where the finalization of
Drag and Drop would have to be implemented, that functionality was
put into the private function _perform_drop.
Simplified gui.drag_data.get_type() != Variant::NIL to gui.dragging
because they are equivalent.
A SubViewport with default-size doesn't display its content, but shows
pink color, until it is resized.
This patch makes sure, that the size gets set during initialization.
When resizing a non-focused window, the previously focused
Window got resized.
This patch grabs focus for the actually resized window, before
starting with the resizing.
Fix for 3D-physics processing:
- with enabled input_capture_on_drag now report correct position and
normals in _input_event
- mouse_enter and mouse_exit signals are emitted when the mouse cursor
leaves the visible area of the 3D-object, independently of pressed mouse
button or input_capture_on_drag
- make sure that collision input events are sent in the right order with
respect to mouse_enter and mouse_exit signals