Commit Graph

139 Commits

Author SHA1 Message Date
Adam Scott f3302b8089 Fix Camera2D crash when edited scene root is null
(cherry picked from commit deb45c0cab)
2023-08-31 20:19:31 +02:00
Yuri Sizov 553fd238cf
Merge pull request #73897 from TheSecondReal0/camera-line-width
Draw Camera2D outlines as 2 point primitives instead of 4 (consistent with how origin is drawn in 2D editor)
2023-03-25 13:49:12 +01:00
Asa Sprow 574293532d Draw Camera2D outlines as 2 point primitives instead of 4 2023-03-23 15:19:32 -07:00
Marcus Elg a835dfd96d Fix Camera2D position smoothing properties not being grouped 2023-03-03 19:28:39 +01:00
kobewi cf50eb130e Fix custom viewports in Camera2D 2023-02-24 13:26:31 +01:00
kobewi 3f31c64300 Fix camera reparenting 2023-02-10 23:46:55 +01:00
kobewi 724d6581d6 Fix Camera2D crashes 2023-02-01 23:49:02 +01:00
Rémi Verschelde 14a4408e02
Merge pull request #65698 from KoBeWi/cameraman
Rework how current Camera2D is determined
2023-01-31 18:56:20 +01:00
Ninni Pipping bbf203bc32 Hide clip_children for non-drawn CanvasItems 2023-01-30 08:22:06 +01:00
Rémi Verschelde 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
Richard Adenling a3d8a78f1b Fix for 2D viewport not updating in the editor when the camera moves
This fixes a problem with 2D viewports not taking the camera position
into consideration when previewed in the editor.

Fixes #40441
2022-12-06 11:34:32 +01:00
kobewi 7e2a8afb57 Rework how current Camera2D is determined 2022-12-02 00:05:02 +01:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Micky 43b9cc96da Rename Camera2D's `smoothing` to `position_smoothing`
For Camera2D:
`smoothing_enabled` ->  `position_smoothing_enabled`
`set_enable_follow_smoothing` -> `set_position_smoothing_enabled`
`is_follow_smoothing_enabled` -> `is_position_smoothing_enabled`
`smoothing_speed` -> `position_smoothing_speed`
`set_follow_smoothing` -> `set_position_smoothing_speed`
`get_follow_smoothing` -> `get_position_smoothing_speed`
2022-10-11 16:51:26 +02:00
Luis Lopez c262589e26 Add rotation smoothing to Camera2D
Camera2D has follow smoothing to interpolate towards a target position, but no rotation smoothing to align with the target rotation.

This adds rotation smoothing directly into the Camera2D API by having two new properties:
  - `rotation_smoothing_enabled`
  - `rotation_smoothing_speed`
2022-10-04 17:14:03 +02:00
Micky ee16de583f Reverse Camera2D.`rotating` to `ignore_rotation`
`rotating` is misleading, as Camera2D is affected by `rotation` and `global_rotation` like any other Node2D

Updates description in the docs, as well.
2022-09-21 01:52:12 +02:00
Rémi Verschelde adaec8396e Merge pull request #64880 from Mickeon/rename-camera-position
Rename Camera2D's `*_screen_center` and `*_position` to `get_screen_center_position` and `get_target_position`
2022-09-06 17:00:52 +02:00
Micky 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
Micky ec963788cc Rename Camera2D's `screen_center` and `*_position`
`get_camera_screen_center` -> `get_screen_center_position`
`get_camera_position` -> `get_target_position`
2022-08-26 12:11:52 +02:00
Yuri Sizov 1a24c9e14b Make `_validate_property` a multilevel method 2022-08-22 18:35:11 +03:00
Marcel Admiraal e61dc6bb04 Ensure changes to Camera2D's limits don't affect smoothed_camera_pos 2022-07-28 15:32:45 +01:00
Marcel Admiraal 3f83c3a0ac When Camera2D enters tree, ensure first update is not lost 2022-07-28 15:29:38 +01:00
Marcel Admiraal 4c23fe602b Update camera position when updating camera limit 2022-07-17 08:51:43 +01:00
FireForge 92817aa72f Add Vector2/3 linking to more properties
- Camera2D.zoom
- CanvasLayer.scale
- ParallaxBackground.scroll_base_scale
- ParallaxLayer.motion_scale
- Polygon2D.texture_scale
- BaseMaterial3D.uv1_scale
- BaseMaterial3D.uv2_scale
2022-06-14 09:33:44 -05:00
FireForge 4678736a39 Add suffixes to all nodes and resources 2022-06-11 09:41:05 -05:00
Hugo Locurcio aabbb40009
Make `{call,set,notify}_group()` immediate by default
This results in less surprising behavior out of the box.

Internal usages were modified to keep the existing behavior
identical there.
2022-05-05 16:59:37 +02:00
Rémi Verschelde b7bc8dbebe
Merge pull request #57392 from madmiraal/implement-3888 2022-03-14 08:31:58 +01:00
Rémi Verschelde 0f5455230c
Use `switch` consistently in `_notification` (`scene` folder) 2022-02-15 18:44:55 +01:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Marcel Admiraal 15ea6706e2 Invert Camear2D zoom to make it intuitive 2022-01-31 16:35:28 +00:00
Marcel Admiraal f107139979 Rename Project Window width and height settings to match their function 2022-01-04 13:59:16 +00:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Eric 7257bb6ad0 Fix condition on 'jump to limits' logic
This is a fix for: #54856
2021-11-17 21:12:34 -08:00
Rémi Verschelde b99792b5d9
Merge pull request #54167 from brunosxs/fix-game-crash-when-sending-a-notification-from-a-camera-class 2021-11-16 14:11:14 +01:00
Hugo Locurcio c012fbc8b2
Rename `PROPERTY_USAGE_NOEDITOR` to `PROPERTY_USAGE_NO_EDITOR`
This is consistent with other constants that include `NO`,
such as `PROPERTY_HINT_COLOR_NO_ALPHA`.
2021-11-03 23:06:17 +01:00
BrunoSXS eb2deabffe Fixes a game crash caused by instantiating Camera2D and sending a notification from it before adding it to the tree. 2021-10-23 17:30:18 -03:00
Anilforextra 90908cd67d Add Get Center Method for Rect2/Rect2i and AABB. 2021-09-21 21:14:17 +05:45
ThreeRhinosInAnElephantCostume 78e2d35a7e fixed camera2d's "current" property getting reset when switching scenes 2021-08-19 15:19:19 +02:00
Anilforextra c390f0515d Use get_global_* functions instead of using transforms. 2021-08-14 14:01:57 +05:45
Aaron Franke eb4902a455
Fix some unnecessary includes 2021-08-13 00:27:38 -05:00
vitika9 22eaec6895 Fixed Camera2D's reset_smoothing() does not work as described 2021-07-27 16:29:30 +05:30
Josh Chandler 879f84d8f8 add viewport.get_camera_2d()
* there is now a more clear distinction between camera_2d and camera_3d functions in the engine code
* simplified camera2d's exported interface - now everything happens directly with the 'current' variable and make_current and clear_current are no longer exposed- there were some situations where calling one instead of set_current would result in incomplete results
* rebased to current godot master
2021-07-03 15:08:17 -04:00
Eric 525ad7c37e Enable Camera2D smoothing on limit change 2021-06-30 16:21:29 -07:00
Aaron Franke 8b692e8872
Add PROPERTY_USAGE_NONE and use it 2021-06-17 19:10:26 -04:00
Hugo Locurcio 8e2a7fff1d
Tweak Camera2D editor line colors for better visibility
The new color for screen drawing was chosen to be easier to distinguish
from the 2D viewport limits.

This also makes lines less opaque when the Camera2D has the Current
property enabled. The increased line width is enough to spot the
camera easily, and the increased opacity on top of that felt obnoxious.
2021-05-27 07:14:49 +02:00
Aaron Franke 6811a45b59
Use real_t in non-physics 2D nodes 2021-03-19 13:04:45 -04:00
Michael Alexsander 4be282a269 Hide more options of disabled properties 2021-03-03 20:51:35 -03:00
Michael Alexsander f70ccbca52 Make Camera2D's editor helper code only be compiled on editor builds 2021-03-01 14:05:45 -03:00
reduz 083aa9b95e Refactor Process Mode
Implements https://github.com/godotengine/godot-proposals/issues/1835#issuecomment-727186192

* PauseMode is now ProcessMode, containing the following states:
	```
	PROCESS_MODE_INHERIT, // same as parent node
	PROCESS_MODE_NORMAL, // process only if not paused
	PROCESS_MODE_PAUSE_ONLY, // process only if paused
	PROCESS_MODE_ALWAYS, // process always
	PROCESS_MODE_DISABLED, // never process
	```
* NOTIFICATION_PAUSED and NOTIFICATION_UNPAUSED are received effectively when the node is paused and unpaused (not any longer when pause mode is set in SceneTree).
* Renamed some nodes that used ProcessMode/process_mode to specify a callback type to ProcessCallback to avoid clashes.
2021-02-18 20:39:55 -03:00
Rafał Mikrut 003bb8e1a8 Initialize class variables with default values in scene/ [1/2] 2021-02-07 22:29:31 +01:00