Commit graph

1194 commits

Author SHA1 Message Date
PouleyKetchoupp
acbd24ea84 Use parameter classes instead of arguments for all physics queries
Same as what is already done for shape queries, applied to point and ray
queries. Easier to document and more flexible to add more parameters.

Also expose intersect_point method to script in 3D.
Remove intersect_point_on_canvas in 2D, replaced with a parameter.
2021-11-04 11:44:39 -07: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
Rémi Verschelde
a2803f3d86
Merge pull request #54072 from KoBeWi/hrcr_is_ded 2021-11-03 17:31:48 +01:00
Rémi Verschelde
96ce806b2f
Merge pull request #54369 from S0yKaf/fix-hardcoded-ray-distance
Fix hardcoded raycast distance in viewport object picking
2021-11-01 21:01:44 +01:00
vdyotte
02b6bbc5df
fix hardcoded raycast distance with viewport object picking
having the raycast distance hardcoded to `10000` caused input events
to not be registered in very large 3D scenes.

This resolves the issue by using the cameras far distance instead.
Creating the more predictable behavior of if an object is visible,
it will be picked by the viewport.

resolves: #49735
2021-10-28 23:08:48 -04:00
Lyuma
97a4ae9e0f Fix off by one in Viewport.render_target_update_mode property enum 2021-10-28 19:42:31 -07:00
Rémi Verschelde
3b11e33a09
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +02:00
kobewi
de4f29f458 Remove node_hrcr hack 2021-10-28 01:43:34 +02:00
bruvzg
ebbc25e89c Ignore empty Font resources as theme override.
Add range hint to font_size properties.
Remove excessive `base_size` Font property.
2021-10-25 14:05:37 +03: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
Rémi Verschelde
9f7218eb69
Merge pull request #54088 from madmiraal/remove-unimplemented-methods 2021-10-22 12:59:32 +02:00
Sean Kim
497b00a937 Fix potential nullptr dereference in CanvasLayer
* Changed another instance of ERR_FAIL_COND in the same file to
  ERR_FAIL_NULL_MSG instead.
* Checked for potential access of the viewport pointer elsewhere in same
  file.

Fixes #54098
2021-10-21 19:41:13 -07:00
Marcel Admiraal
87a4ba492e Remove unimplemented methods 2021-10-21 18:44:25 +01:00
PouleyKetchoupp
d5847f1cb4 Fix errors in mouse detection when removing collision object from tree
Now behaves the same way as ui elements, mouse exit is skipped when the
object is removed from the tree.
2021-10-20 09:10:59 -07:00
Rémi Verschelde
56078cca90
Merge pull request #53630 from timothyqiu/viewport-recursion 2021-10-11 10:02:22 +02:00
Haoyu Qiu
7ecb133b22 Fix Viewport::handle_input_locally related infinite recursion 2021-10-10 18:10:28 +08:00
mashumafi
80dc1cc412 Executing AcceptDialog.push_input no longer crashes 2021-10-09 20:33:29 +00:00
Hugo Locurcio
42d13e29e2
Add a warning for Timer nodes with very low wait times
Very low wait times behave in unpredictable ways depending on the
rendered frame rate. This is because the timeout signal is only emitted
once per rendered frame (or physics frame, depending on the timer's
process mode).
2021-10-09 08:57:48 +02:00
Rémi Verschelde
5ae569560d
Fix missing argument names in bindings
While at it, tweak some boolean setters to use `p_enabled` for the bool.

Also renames `draw_minimap()` to `set_draw_minimap()`.
2021-10-09 00:20:10 +02:00
Hugo Locurcio
73c6e19acc
Allow any floating-point value as a 3D rendering scale option
This allows for finer control over 3D rendering resolution.
Supersampling can also be performed by setting a 3D rendering
resolution above 1.0, which is useful for offline rendering or
for very high-end GPUs.
2021-10-08 18:22:10 +02:00
kleonc
23dac24789 Delete objects enqueued for deletion during SceneTree destruction 2021-10-08 16:45:55 +02:00
Fabio Alessandrelli
7c93931751 [Net] Add call_local argument to Node.rpc_config. 2021-10-08 12:49:20 +02:00
jitspoe
2ceba818c3
Fix ViewportTexture error when viewport is used from a child scene
Fix invalid errors when a separate child scene file contains a viewport and
that viewport is used for a texture in the current scene.

Fixes #27790.
2021-10-05 12:21:06 +02:00
Rémi Verschelde
b85dfd990e
GDScript completion: Handle quote style ad-hoc to remove editor dependency
`core` and `scene` shouldn't depend on `editor`, so they can't query this style
setting in `get_argument_options`. But we can handle it after the fact in
GDScript's completion code.

Also cleans up a couple extra unused invalid includes in `core`.
2021-10-04 16:16:05 +02:00
Yuri Sizov
4a42a66cd9 Add the base scale factor to the Theme resource 2021-10-04 15:25:07 +03:00
bruvzg
0c0b5c84b0 Implement TextServer GDExtension interface, remove TextServer GDNative interface. 2021-10-01 15:13:29 +03:00
Lightning_A
c63b18507d Use range iterators for Map 2021-09-30 15:09:12 -06:00
Hugo Locurcio
570cdc128f
Rename Node's filename property to scene_file_path for clarity 2021-09-30 16:50:25 +02:00
Haoyu Qiu
9dd0d3f550 Don't memcpy to nullptr even if length is zero 2021-09-29 20:58:14 +08:00
Eric M
caac2e1a87 Fix focus shortcuts triggering incorrectly 2021-09-21 12:24:07 +10:00
Rémi Verschelde
583eaa9869
Merge pull request #49819 from nekomatata/fix-process-mode-inherit 2021-09-17 19:16:19 +02:00
Wilson E. Alvarez
f3a564f9a5
Rename Listener2D/Listener3D to AudioListener2D/AudioListener3D 2021-09-16 17:51:51 -04:00
Rémi Verschelde
195ea41a7a
Merge pull request #51237 from KoBeWi/tween_fix()
Various fixes to Tween code
2021-09-14 10:29:50 +02:00
Rémi Verschelde
70ba366743
Merge pull request #50375 from Paulb23/code_edit_unit_tests 2021-09-13 21:51:20 +02:00
Rémi Verschelde
8ecc571158
Merge pull request #49063 from Calinou/remove-16x-msaa
Remove 16× MSAA support due to driver bugs and low performance
2021-09-13 17:34:04 +02:00
kobewi
6b68445e4d Fix multiple definitions of Listener2D 2021-09-12 21:19:37 +02:00
Max Hilbrunner
06e2a02253 Clean up Viewport, remove dead code. 2021-09-10 16:58:33 +02:00
Max Hilbrunner
68563b5760
Merge pull request #52431 from dozingpip/patch-1
Remove dead code from Viewport::_gui_input_event
2021-09-10 16:34:28 +02:00
Juan Linietsky
d0a7eeaaff
Merge pull request #44844 from KoBeWi/hey_listen!_but_2d
Add Listener2D
2021-09-09 19:19:10 -03:00
Max Hilbrunner
5b25457794 Multiplayer networking renames/simplification
Removes _networking_ prefix from some methods and members, now that multiplayer has been largely moved out of Node and SceneTree and is seperated into its own set of classes.
2021-09-08 12:05:54 +02:00
Max Hilbrunner
acc776f7b6
Merge pull request #52442 from Faless/mp/4.x_rpc_manager
[Net] Move multiplayer classes to own subfolder. Split RPC from MultiplayerAPI.
2021-09-07 18:44:39 +02:00
Max Hilbrunner
b284cb908a
Merge pull request #52392 from Shatur/fix-ready
Remove extra get_script_instance check
2021-09-07 18:43:06 +02:00
Fabio Alessandrelli
bf9aae09ba [Net] Move multiplayer to core subdir, split RPCManager.
Move multiplayer classes to "core/multiplayer" subdir.

Move the RPCConfig and enums (TransferMode, RPCMode) to a separate
file (multiplayer.h), and bind them to the global namespace.

Move the RPC handling code to its own class (RPCManager).

Renames "get_rpc_sender_id" to "get_remote_sender_id".
2021-09-07 11:14:30 +02:00
PouleyKetchoupp
226d6337e5 Fix process mode update when mode owner is set to Inherit
Prevent the root node to be set to PROCESS_MODE_INHERIT, since it causes
undefined behavior.

Fix a case where the process owner node is wrongly set to the direct
parent instead of the proper node.

Add errors for all unhandled cases.
2021-09-06 17:14:12 -07:00
Pip
d7a6f8990a
Remove dead code from Viewport::_gui_input_event 2021-09-06 03:11:02 -04:00
Hennadii Chernyshchyk
2b78353e79
Remove extra get_script_instance check
Otherwise, `_ready()` will not be called on classes
that define this function and doesn't have a script attached.
2021-09-04 12:14:54 +03:00
Hugo Locurcio
879c37d658
Rename Node's NOTIFICATION_PATH_CHANGED to NOTIFICATION_PATH_RENAMED
The new name is less misleading, as the notification is only emitted
when the node name (or one of its parents' names) is changed.
2021-09-04 00:15:15 +02:00
JestemStefan
177173578a Changed Window current_screen parameter from string to int 2021-09-02 23:34:15 +02:00
Paulb23
cd6b11222c Prevent crash on startup if no audio server 2021-09-01 16:46:04 +01:00
kobewi
f2cb0a8d4b Add Listener2D 2021-08-31 16:53:14 +02:00
Fabio Alessandrelli
64b9f30b92 [Net] Rename RPC "puppet" to "auth" (authority). Drop "master".
This commit completely removes the RPC_MODE_MASTER ("master" keyword),
and renames the RPC_MODE_PUPPET to RPC_MODE_AUTHORITY ("auth" keyword).

This commit also renames the "Node.[get|set]_network_master" methods to
"Node.[get|set]_network_authority".

This commit also renames the RPC_MODE_REMOTE constant to RPC_MODE_ANY.

RPC_MODE_MASTER in Godot 3.x meant that a given RPC would be callable by
any puppet peer on the master, while RPC_MODE_PUPPET meant that it would
be callable by the master on any puppet.

Beside proving to be very confusing to the user (referring to where it
could be called instead of who can call it) the RPC_MODE_MASTER is quite
useless. It is almost the same as RPC_MODE_REMOTE (anyone can call) with
the exception that the network master cannot. While this could be useful
to check in some case, in such a function you would anyway need to check
in code who is the caller via get_rpc_sender_id(), so adding the check
there for those rare cases does not warrants a dedicated mode.
2021-08-30 00:54:38 +02:00
Juan Linietsky
72bf79186e
Merge pull request #30391 from KoBeWi/hiding_children
Add support for internal nodes
2021-08-29 19:36:30 -03:00
Michael Alexsander
565ba91d28
Merge pull request #51906 from requizm/fix/49077
Fix tooltips don't appear for PopupMenus
2021-08-28 15:43:02 +00:00
kobewi
a913ae8d56 Add support for internal nodes 2021-08-28 02:07:23 +02:00
Ellen Poe
3598d300cb Do all audio mixing in the AudioServer 2021-08-27 10:41:57 -07:00
bruvzg
4c3f7d1290 Makes FontData importable resource.
Adds multi-channel SDF font texture generation and rendering support.
Adds per-font oversampling support.
Adds FontData import plugins (for dynamic fonts, BMFonts and monospaced image fonts), font texture cache pre-generation and loading.
Adds BMFont binary format and outline support.
2021-08-27 15:43:18 +03:00
Camille Mohr-Daurat
adafc509f3
Merge pull request #52132 from nekomatata/fix-physics-process-delta
Fix delta passed in _physics_process
2021-08-26 11:27:38 -07:00
PouleyKetchoupp
cbce1550ff Fix delta passed in _physics_process
Regression due to typo in recent GDVIRTUAL_CALL change.
2021-08-26 10:49:12 -07:00
Juan Linietsky
d19b12dbd2
Merge pull request #52107 from timothyqiu/overriden
Fix misspelled "overriden"
2021-08-26 13:07:52 -03:00
Bastiaan Olij
64626cc435 Optionally scale 3D render content 2021-08-26 20:48:40 +10:00
Haoyu Qiu
eba7265a1c Fix misspelled "overriden"
In recent GDVIRTUAL PR and SkeletonModification3DJiggle doc.
2021-08-26 01:44:01 +08:00
Hugo Locurcio
7192852da3
Remove 16× MSAA support due to driver bugs and low performance
In the `master` branch, 16× MSAA caused the entire system to freeze
on NVIDIA GPUs. This is likely caused by graphics drivers not actually
implementing 16× MSAA, but combining 8× MSAA with 2× SSAA instead.

On top of that, modern shader complexity makes 16× MSAA very difficult
to use while keeping a good framerate. 8× MSAA is hard enough to use
as it is.
2021-08-25 07:56:27 +02:00
Juan Linietsky
6609ce1944
Merge pull request #52000 from lyuma/set_editable_instance
Make Node editable_instance methods available to GDScript
2021-08-24 08:31:34 -03:00
Lyuma
7eb6ae2798 Make Node editable_instance methods available to GDScript 2021-08-23 21:45:18 -07:00
reduz
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
reduz
3682978aee Replace BIND_VMETHOD by new GDVIRTUAL syntax
* New syntax is type safe.
* New syntax allows for type safe virtuals in native extensions.
* New syntax permits extremely fast calling.

Note: Everything was replaced where possible except for `_gui_input` `_input` and `_unhandled_input`.
These will require API rework on a separate PR as they work different than the rest of the functions.

Added a new method flag METHOD_FLAG_OBJECT_CORE, used internally. Allows to not dump the core virtuals like `_notification` to the json API, since each language will implement those as it is best fits.
2021-08-22 08:23:58 -03:00
Juan Linietsky
1990721d1b
Revert "Add Node processing and physics processing cumulative (as opposed to delta) time" 2021-08-22 08:21:34 -03:00
Hugo Locurcio
fb94b2e656
Merge pull request #41850 from MohammadKhashashneh/cumulative-time_issue_6999
Add Node processing and physics processing cumulative (as opposed to delta) time
2021-08-22 10:33:20 +02:00
requizm
6f3d8fa228 Fix tooltip message working incorrectly in PopupMenu
fix
2021-08-20 23:06:00 +03:00
Fabio Alessandrelli
d4dd859991 [Net] MultiplayerReplicator with initial state.
Move the former "spawnables" functions to a dedicated
MultiplayerReplicator class.
Support custom overrides in replicator.
Spawn/despawn messages can now contain a state.
The state can be automatically encoded/decoded by passing the desired
object properties to `spawnable_config`.
You can use script properties to optimize the state representation.
2 Callables can be also specified to completely override the default
implementation for sending and receiving the spawn/despawn event.
(9 bytes overhead, and there's room for improvement here).
When using a custom implementation `spawn` and `despawn` can be called
with any Object, `send_spawn`/`send_despawn` can receive any Variant as
a state, and the path is not required.

Two new functions, `spawn` and `despawn`, convey the implementation
independent method for requesting a spawn/despawn of an Object, while
`send_spawn` and `send_despawn` represent the more low-level send event
for a Variant to be used by the custom implementations.
2021-08-18 10:21:29 +01:00
Mohammad Khashashneh
0c027ef0f1 Add Node processing and physics processing cumulative (as opposed to delta) time. 2021-08-17 21:34:50 +03:00
Jihyun Yu
d40b7e2cfb fix bug on window notification propagation 2021-08-17 14:07:53 +09:00
Rémi Verschelde
a96c96ca72
Merge pull request #50147 from aaronfranke/disable-node3d
Disable Node3D when compiling without 3D and fix disable_3d option
2021-08-14 11:59:06 +02:00
Rémi Verschelde
81512a3732
Style: Cleanup code using text_editor/completion/use_single_quotes 2021-08-13 21:27:57 +02:00
Aaron Franke
7094ccfbe9
Disable Node3D when compiling without 3D and fix disable_3d option 2021-08-13 08:59:48 -05:00
Rémi Verschelde
85e315d6e8
Merge pull request #51607 from aaronfranke/includes
Fix some unnecessary includes
2021-08-13 14:38:56 +02:00
Aaron Franke
eb4902a455
Fix some unnecessary includes 2021-08-13 00:27:38 -05:00
Hugo Locurcio
7612cff432
Use the Unicode multiplication symbol where relevant 2021-08-12 21:45:33 +02:00
Rémi Verschelde
dce488d8f7
Merge pull request #49417 from Bhu1-V/gsoc-cmd-plt
Command Palette For Godot
2021-08-10 18:55:22 +02:00
Aaron Franke
339687e04f
Organize methods in Viewport and explicitly name 3D methods with 3D 2021-08-10 09:10:34 -05:00
Aaron Franke
84f720966c
Use doubles for time in many other places 2021-08-09 14:05:42 -05:00
Fabio Alessandrelli
9fcf3b5a9c [Net] Basic extensible MultiplayerAPI spawn/despawn.
`PackedScene`s can be configured to be spawnable via a new
`MultiplayerAPI.spawnable_config` method.
They can be configured either to be spawned automatically when coming
from the server or to always require verification.
Another method, `MultiplayerAPI.send_spawn` lets you request a spawn on
the remote peers.
When a peer receive a spawn request:
- If it comes from the server and the scene is configured as
  `SPAWN_MODE_SERVER`:
  - Spawn the scene (instantiate it, add it to tree).
  - Emit signal `network_spawn`.
- Else:
  - Emit signal `network_spawn_request`.

In a similar way, `despawn`s are handled automatically in
`SPAWN_MODE_SERVER`.

In `SPAWN_MODE_SERVER`, when a new client connects it will also receive,
from the server all the spawned (and not yet despawned) instances.
2021-08-09 16:34:40 +02:00
Bhuvan Vemula
a0a019a998 Added EditorCommandPalette 2021-08-09 17:41:50 +05:30
kobewi
e092a132fe Various fixes to Tween code 2021-08-06 13:07:34 +02:00
Rémi Verschelde
57a5186b08
Merge pull request #51006 from foxydevloper/drag-drop-naming
Name nodes added when drag & dropping an image by `name_casing`
2021-08-03 09:38:03 +02:00
Michael Alexsander
94a64d557e Add auto_translate toggle for automatic translation 2021-07-29 18:30:34 -03:00
foxydevloper
07a8f0fe38 Name nodes added from drag & drop by name_casing 2021-07-29 00:29:24 -04:00
Michael Alexsander
79fc188fc4 Multiple cosmetic fixes for embedded windows 2021-07-27 23:55:06 -03:00
Rémi Verschelde
fab3412139
Merge pull request #50899 from akien-mga/refref
Use Ref<T> references as iterators where relevant
2021-07-26 19:45:04 +02:00
Rémi Verschelde
92299989bd
Use Ref<T> references as iterators where relevant
And const when possible.
2021-07-26 19:27:11 +02:00
Aaron Franke
4ecb6fba80
Use doubles for time everywhere in Timer/SceneTree 2021-07-26 02:00:48 -04:00
Rémi Verschelde
ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke
4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
kobewi
8793ec4564 Show tooltips even when paused or time_scale is 0 2021-07-23 17:49:30 +02:00
Michael Alexsander
a690cd9251 Make MenuButton's switch_on_hover work again 2021-07-22 14:27:30 -03:00
Hugo Locurcio
4bd5e4fd9b
Use the standard C INFINITY and NAN constants directly
The `Math_INF` and `Math_NAN` defines were just aliases for those
constants, so we might as well use them directly.

Some portions of the code were already using `INFINITY` directly.
2021-07-21 10:41:08 +02:00
Rémi Verschelde
c82daaed48
Merge pull request #38317 from verdog/get-cam-2d-4.0
add viewport.get_camera_2d()
2021-07-20 22:19:06 +02:00
Rémi Verschelde
693f9b4e20
Merge pull request #50655 from JFonS/sname_opt
Editor StringName and Viewport optimizations
2021-07-20 21:49:32 +02:00
Joan Fons
a6adb58493 Editor StringName and Viewport optimizations
* Added explicit return type to the SNAME macro.
* Add some extra SNAME usages.
* Change some ClassDB methods to use const StringName & arguments.
* Cache the Window parent in Control because it's used in
  is_layout_rtl(), which is called often.
* Only enable internal processing for viewports that need it.
* Change CanvasItem::group to be a StringName because it's only used as
  that.
2021-07-20 20:35:41 +02:00
Rémi Verschelde
394191c02f
Merge pull request #50605 from Calinou/tweak-shader-code-style
Use C++11 raw literals for shader code to improve readability
2021-07-20 10:05:13 +02:00