Commit graph

4219 commits

Author SHA1 Message Date
PouleyKetchoupp 645bc94bfc Fix capsule height/radius setters with linked properties
Capsule height and radius setters can modify each other, rather than
using clamping, to avoid cases where values are not set correctly when
loading a scene (depending on the order of properties).

Inspector undo/redo:
Added the possibility to link properties together in the editor, so
they can be undone together, for cases where a property can modify
another one.

Gizmo undo/redo:
Capsule handles pass both radius and height values so they can be undone
together.
2021-08-19 10:31:19 -07:00
Rémi Verschelde de7b6d13eb
Merge pull request #51627 from mhilbrunner/todo-for-neikeq 2021-08-18 20:13:50 +02: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
Rémi Verschelde d7b843a060
Merge pull request #51787 from akien-mga/string-num-fix-default-decimals
String: Fix default decimals truncation in num and num_real
2021-08-18 09:31:34 +02:00
Rémi Verschelde 17ce4846ff
Merge pull request #51807 from vnen/extension-fixes
Some fixes for the extension API
2021-08-18 08:05:02 +02:00
George Marques 3b593b596e
Properly set up virtual calls for extensions 2021-08-17 22:11:11 -03:00
Rémi Verschelde 066dbc2f0c
String: Fix default decimals truncation in num and num_real
Fixes undefined behavior, and fixes the logic for negative powers of ten.
Fixes #51764.

Adds tests to validate the changes and prevent regressions.
Adds docs for `String.num`.
2021-08-18 00:48:03 +02:00
Aaron Franke e5d85ac751
Fixes to tests for Variant and Geometry3D 2021-08-17 16:46:08 -05:00
George Marques fcfea84d5e
A few fixes in the extension C API
- Add MethodBind call (besides ptrcall), since vararg methods don't work
  with ptrcall.
- Fix argument name in register constant function to the way it
  actually is used in the engine.
- Change the integer constant type to GDNativeInt to keep it consistent.
2021-08-17 18:10:58 -03:00
George Marques ecc5921143
Initialize call error struct when calling extensions
This allows users to not need to set it when the call is correct.
2021-08-17 18:09:36 -03:00
Rémi Verschelde 273d1ca932
Merge pull request #51775 from timothyqiu/disable-undo-redo
Improve Undo/Redo menu items
2021-08-17 19:09:56 +02:00
Max Hilbrunner 81f7d1890b Namespaces instead of underscore prefix for binds
Thanks to neikeq for the initial work.

Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
2021-08-17 16:10:09 +02:00
Rémi Verschelde 913a7a63d5
Merge pull request #51793 from KoBeWi/direnam
Fix renaming directories
2021-08-17 16:06:30 +02:00
Haoyu Qiu 16c2d4ef22 Improve Undo/Redo menu items
* Make Undo/Redo menu items disabled when clicking it does nothing.
    * Context menu of `TextEdit`
    * Context menu of `LineEdit`
    * Editor's Scene menu
    * Script editor's Edit menu and context menu (for Script and Text)
* Make editor undo/redo log messages translatable.
* Mark `UndoRedo`'s `has_{un,re}do()` methods as `const`.
* Expose `TextEdit`'s `has_{un,re}do()` to scripts since `{un,re}do()` are already available.
2021-08-17 21:11:10 +08:00
kobewi 0dde3e5b59 Fix renaming directories 2021-08-17 14:38:48 +02:00
ne0fhyk 3a00ff1cce Add partial support for Android scoped storage.
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
2021-08-16 23:11:56 -07:00
Rémi Verschelde 2735f829c9
Merge pull request #51739 from neikeq/fix-csharp-instance-bindings
Fix C# native instance bindings after recent re-write
2021-08-16 18:32:16 +02:00
Ignacio Roldán Etcheverry 5ea500e599 Fix C# native instance bindings after recent re-write
This was needed after: 4469144891
2021-08-16 17:16:36 +02:00
Rémi Verschelde fff9a451a1
Merge pull request #51368 from TwistedTwigleg/GSOC_2020_Working_Branch_IK_SQUASHED
New and improved IK system for Skeleton3D - Squashed!
2021-08-16 15:37:17 +02:00
Mai Lavelle ce43781cb3 Fix input methods returning zero strength when pressed status not requested
Fixes behavior of these methods:

`InputMap::event_get_action_status`
`InputEvent*::action_match`

Previously when `p_pressed` was `nullptr`, `p_strength` would be set to
`0.0f` regardless of event strength. This affected `InputEventAction` events
processed by `Input.parse_input_event` for example.

Regression found in afa89c9eea
2021-08-16 00:53:01 -04:00
Ricard Rovira Cubeles a8d12b5a61 Add constant to vector function parameters that don't actually modify their input.
Add more overloads of vector multiplication, required by templates to compile with float=64.
2021-08-15 16:45:37 +02:00
TwistedTwigleg 5ffed49907 New and improved IK system for Skeleton3D
This PR and commit adds a new IK system for 3D with the Skeleton3D node
that adds several new IK solvers, as well as additional changes and functionality
for making bone manipulation in Godot easier.

This work was sponsored by GSoC 2020 and TwistedTwigleg

Full list of changes:
* Adds a SkeletonModification3D resource
  * This resource is the base where all IK code is written and executed
* Adds a SkeletonModificationStack3D resource
  * This node oversees the execution of the modifications and acts as a bridge of sorts for the modifications to the Skeleton3D node
* Adds SkeletonModification3D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK
  * Each modification is in it's own file
* Several changes to Skeletons, listed below:
  * Added local_pose_override, which acts just like global_pose_override but keeps bone-child relationships intract
    * So if you move a bone using local_pose_override, all of the bones that are children will also be moved. This is different than global_pose_override, which only affects the individual bone
  * Internally bones keep track of their children. This removes the need of a processing list, makes it possible to update just a few select bones at a time, and makes it easier to traverse down the bone chain
  * Additional functions added for converting from world transform to global poses, global poses to local poses, and all the same changes but backwards (local to global, global to world). This makes it much easier to work with bone transforms without needing to think too much about how to convert them.
  * New signal added, bone_pose_changed, that can be used to tell if a specific bone changed its transform. Needed for BoneAttachment3D
  * Added functions for getting the forward position of a bone
* BoneAttachment3D node refactored heavily
  * BoneAttachment3D node is now completely standalone in its functionality.
    * This makes the code easier and less interconnected, as well as allowing them to function properly without being direct children of Skeleton3D nodes
  * BoneAttachment3D now can be set either using the index or the bone name.
  * BoneAttachment3D nodes can now set the bone transform instead of just following it. This is disabled by default for compatibility
  * BoneAttachment3D now shows a warning when not configured correctly
* Added rotate_to_align function in Basis
* Added class reference documentation for all changes
2021-08-14 15:57:00 -04:00
AndreaCatania c81cb64416 Add the possibility to initialize the classes allocated with the PagedAllocator
It uses the (`const T &&... p_args`) forward reference, to avoid copying the
memory in case it's an rvalue, or pass a reference in case it's an lvalue.

This is an example:
```c++
PagedAllocator<btShapeBox> box_allocator;
btShapeBox* box = box_allocator.alloc( btVector3(1.0, 1.0, 1.0) );
```
2021-08-14 09:04:31 +02:00
Rémi Verschelde 81512a3732
Style: Cleanup code using text_editor/completion/use_single_quotes 2021-08-13 21:27:57 +02:00
Rémi Verschelde 9e37336124
Merge pull request #51508 from AndreaCatania/mem-placement
Refactors the memnew_placement.
2021-08-13 14:58:02 +02:00
Rémi Verschelde 87b80a84f0
Merge pull request #51582 from AnilBK/ustring-macro-replacements
ustring: Replace macros with inline functions.
2021-08-13 14:42:09 +02:00
Rémi Verschelde 85e315d6e8
Merge pull request #51607 from aaronfranke/includes
Fix some unnecessary includes
2021-08-13 14:38:56 +02:00
Pedro J. Estébanez dc187324be Add input buffering framework
Input buffering is implicitly used by event accumulation, but this commit makes it more generic so it can be enabled for other uses.

For desktop OSs it's currently not feasible given main and UI threads are the same).
2021-08-13 11:19:19 +02:00
Pedro J. Estébanez 7c864d41c9 Improve input event accumulation
- API has been simplified: all events now go through `parse_input_event()`. Whether they are accumulated or not depends on the `use_accumulated_input` flag.
- Event accumulation is now thread-safe (it was not needed so far, but it prepares the ground for the following changes).
- Touch drag events now support accumulation.
2021-08-13 11:19:19 +02:00
AndreaCatania 98ceb60eb4 Refactors the memnew_placement.
With this commit the macro `memnew_placement` uses the standard memory
placement syntax: `new (mem) TheClass()`, and removes the outdated and
not used syntax:
```
_ALWAYS_INLINE_ void *operator new(size_t p_size, void *p_pointer, size_t check, const char *p_description) {
```

Thanks to this change, the function `memnew_placement` call is compatible with
any class, and can also initialize classes with non-empty constructor:
```
// This is valid, like before.
memnew_placement(mem, Variant);

// This works too:
memnew_placement(mem, Variant(123));
```
2021-08-13 10:18:34 +02:00
Aaron Franke eb4902a455
Fix some unnecessary includes 2021-08-13 00:27:38 -05:00
Anilforextra c350a33898 Convert ustring macros to inline functions and use them wherever possible.
Add new inline functions to check if a character is lowercase or uppercase.

Remove unused upper case macro.
2021-08-13 10:32:29 +05:45
Rémi Verschelde 6e9439198c
Resource: Remove unused _use_builtin_script() virtual method
And another piece of dead code found while searching for "use_builtin".
2021-08-12 12:16:17 +02:00
Rémi Verschelde d7a39cc346
Merge pull request #38992 from Dragoncraft89/master
Error handling functions for GdScript
2021-08-11 18:43:27 +02:00
Rémi Verschelde c00303ff55
Merge pull request #47378 from aaronfranke/use-input-enums
Use key enum instead of plain integers for input code
2021-08-11 11:20:45 +02:00
Hugo Locurcio 937c1a716c
Rename iterations_per_second to physics_ticks_per_second
This makes it clearer that this property is only about physics FPS,
not rendering FPS.

The `physics_fps` project setting was also renamed to
`physics_ticks_per_second` for consistency.
2021-08-11 02:37:02 +02:00
Aaron Franke fa3a32a2d6
Use Key enum instead of plain integers 2021-08-10 16:26:55 -05: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
Rémi Verschelde 46beaacec3
Merge pull request #51017 from vnen/extension-fixes 2021-08-10 16:42:31 +02:00
Rémi Verschelde 16d73fefdb
Merge pull request #50682 from aaronfranke/basis-looking-at
Move code for looking_at to Basis
2021-08-10 11:28:12 +02:00
George Marques ee6e05ee68
Rename GDNative call error enum values to use GDNATIVE prefix
To make sure it does not clash with other libraries.
2021-08-09 19:21:37 -03: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
Fabio Alessandrelli 9798d08ac2 [Core] Expose ResourceLoader.get_resource_uid. 2021-08-09 16:26:56 +02:00
Bhuvan Vemula a0a019a998 Added EditorCommandPalette 2021-08-09 17:41:50 +05:30
bruvzg 7c3c5603d0 [Text Server] Improve object (image/table) inline alignment. 2021-08-08 22:35:47 +03:00
Rémi Verschelde 73cd3f0b38
Merge pull request #51395 from angad-k/pseudolocalization-squashed
Add pseudolocalization to Godot. (GSoC'21)
2021-08-08 17:55:30 +02:00
Angad Kambli e79dde1cbb add pseudolocalization to Godot 2021-08-08 20:37:57 +05:30
Pedro J. Estébanez a6303b70a5 Fix logic to allow default null thread argument 2021-08-08 12:53:30 +02:00
Julien Nguyen daee3c316f Fix action_get_events returning booleans instead of InputKey entries 2021-08-07 21:17:55 +02:00