summaryrefslogtreecommitdiff
path: root/scene/main/viewport.cpp
AgeCommit message (Collapse)Author
2023-02-17Merge pull request #72764 from Sauermann/fix-color-pickingRémi Verschelde
Fix Color Picking
2023-02-14Merge pull request #68027 from ktxyz/window-on-topRémi Verschelde
Update sub_windows order with respect to FLAG_ALWAYS_ON_TOP
2023-02-10Fix crash in editor when setting `SubViewport.size` to zeroMarkus Sauermann
`Viewport::_set_size` now verifies, that the minimum size is at least 2x2. Also fix `RendererViewport::viewport_set_size` fail condition.
2023-02-09Fix Color PickingMarkus Sauermann
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.
2023-02-07Merge pull request #62179 from Rindbee/fix-popup_center-off-centerRémi Verschelde
Use min_size/max_size to limit window size and position while popup center
2023-02-07Merge pull request #72829 from Sauermann/fix-code-simplificationsRémi Verschelde
Some code simplifications
2023-02-07Some code simplificationsMarkus Sauermann
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`
2023-02-07Use min_size/max_size to limit the window size and the position while popup ↵Rindbee
center
2023-02-07Fix Viewport::get_mouse_position for SubViewportsMarkus Sauermann
SubViewports don't have a cached mouse position available. This PR calculates the mouse position from the screen position of the mouse cursor.
2023-02-06Merge pull request #72740 from Sauermann/fix-event-device-idRémi Verschelde
Fix mouse/drag/touch InputEvents having no device id
2023-02-06Fix mouse/drag/touch InputEvents having no device idMarkus Sauermann
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`.
2023-02-06Fix MOUSE_FILTER_STOP not affecting emulated mouse eventsMarkus Sauermann
Touch and Drag events are now stopped by MOUSE_FILTER_STOP
2023-02-06Merge pull request #68492 from Sauermann/fix-picking-sortRémi Verschelde
Fix propagation order for 2D physics picking events
2023-02-04Fix propagation order for 2D physics picking eventsMarkus Sauermann
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.
2023-02-03Fix Camera2D crash due to ParallaxBackground nodekobewi
2023-02-02Remove `Viewport::_get_input_pre_xform`Markus Sauermann
This function is only relevant for `Window`. So this PR moves the functionality to the `Window`-class.
2023-02-02Simplify Viewport::_set_sizeMarkus Sauermann
`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`.
2023-02-01Fix Camera2D crasheskobewi
2023-02-01Merge pull request #67331 from Sauermann/fix-subviewport-no-stretch-updateRémi Verschelde
Fix stretch transform when resizing SubViewports
2023-02-01Merge pull request #58610 from Sauermann/fix-physics-mouseRémi Verschelde
Fix execution of physics picking events at unexpected times
2023-02-01Fix stretch transform when resizing SubViewportsMarkus Sauermann
Move calculation of stretch transform from outside to inside of `Viewport::_set_size` function.
2023-02-01Merge pull request #66906 from Sauermann/fix-prohibit-inconsistent-size-stateRémi Verschelde
Prohibit inconsistent size state for SubViewport
2023-01-31Prohibit inconsistent size state for SubViewportMarkus Sauermann
Prohibit size changes of SubViewports with parent SubViewportContainers that have stretch mode enabled.
2023-01-31Merge pull request #65698 from KoBeWi/cameramanRémi Verschelde
Rework how current Camera2D is determined
2023-01-31Merge pull request #59310 from Sauermann/proposal-event-transformRémi Verschelde
Calculate window input event transform only on window change
2023-01-26Added assertion checkMarkus Sauermann
2023-01-26Merge pull request #68007 from Sauermann/fix-3d-captureRémi Verschelde
Fix event-content and mouse-signals with 3D-capture-on-drag
2023-01-26Merge pull request #68627 from Sauermann/fix-tooltip-positionRémi Verschelde
Fix position of Tooltips
2023-01-26Include the Window-transform into Viewport::get_final_transformMarkus Sauermann
2023-01-26Fix position of TooltipsMarkus Sauermann
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.
2023-01-20Merge pull request #71692 from HalcyonGarside/viewport-debug-draw-fixRémi Verschelde
Fix incorrect Viewport Debug Draw effects
2023-01-19Add 'Lighting' to list of Debug Draw viewport optionsHalcyonGarside
2023-01-17Fix crash on touch releaseMai Lavelle
2023-01-16Merge pull request #69598 from Sauermann/fix-focus-inverseRémi Verschelde
Calculate the mouse focus inverse transform only when needed
2023-01-16Add `WINDOW_FLAG_MOUSE_PASSTHROUGH` flag and enabled it for tooltips. Expose ↵bruvzg
`window_set_mouse_passthrough` to `Window`.
2023-01-09Calculate the mouse focus inverse transform only when neededMarkus Sauermann
Revival of #49158 Co-authored-by: Marcel Admiraal <madmiraal@users.noreply.github.com>
2023-01-08Use BitField<> in core type masksJuan Linietsky
* 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.
2023-01-07Add support for the custom initial screen for the main window, fix primary ↵bruvzg
screen detection.
2023-01-06Merge pull request #68429 from KoBeWi/PropertySettingsRémi Verschelde
Add PropertyInfo overload for GLOBAL_DEF
2023-01-05One Copyright Update to rule them allRémi Verschelde
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".
2022-12-29Add safety-checks before some servers `free()`Adam Scott
2022-12-19Merge pull request #59682 from Sauermann/fix-following-viewport-transformRémi Verschelde
Include the follow-viewport-transform into CanvasLayer transform calculations
2022-12-18Include the following-viewport-transform into CanvasLayer transformsMarkus Sauermann
The following-viewport-transform was missing from several calculations
2022-12-11Add PropertyInfo overload for GLOBAL_DEFkobewi
2022-12-02Rework how current Camera2D is determinedkobewi
2022-11-30Fix routing of InputEventScreenDrag events to Control nodesFredia Huya-Kouadio
2022-11-28Merge pull request #59801 from Sauermann/fix-node2d-viewport-root-orderRémi Verschelde
Fix Viewport root order after Node2D raise
2022-11-25Merge pull request #68447 from Grimmr/clean-tooltips-on-WM-focus-offRémi Verschelde
Viewport cancels existing tooltip when window looses focus
2022-11-25Viewport cancels existing tooltip when window looses focusgrimmr
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
2022-11-22Fix CanvasTransform on RenderingServer when Viewport enters TreeMarkus Sauermann
Previously the Viewport didn't initialize its canvas transform in the RenderingServer.