Commit Graph

553 Commits

Author SHA1 Message Date
reduz 746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
reduz 8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
kobewi 45e4cb2bbf Fix error spam when tweened node leaves tree 2022-05-05 17:57:25 +02:00
Rémi Verschelde 931838b330
Merge pull request #60627 from aaronfranke/rename-elements
Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
2022-05-03 14:40:01 +02:00
Rémi Verschelde 297241f368
Merge pull request #60714 from Calinou/typedef-remove-ref
Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`
2022-05-03 14:28:18 +02:00
Hugo Locurcio 180e5d3028
Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
Guilherme Felipe e7056c195d Improvements of state machine
- Open the menu to add new animation nodes by dragging the transitions to
empty areas and automatically connecting them.
- Adds box selection to the state machine.
- Add feature to group/ungroup selected nodes in a "sub" state machine.
- Add start/end node by default. In addition, add new color to these
nodes to differentiate then.
- Add tooltip for transitions to show the connection "from -> to".
- Add new "type" of transition line when multiple transitions are
grouped.
- Add popup to connect nodes in sub state machine.
- Add dialog to select which nodes can be deleted when they are grouped.
- Add classes:
	AnimationNodeStartState
	AnimationNodeEndState
	EditorAnimationMultiTransitionEdit
- Implements disabled transition

API Changes:
- Now it's posible to add transitions between state machines,
`AnimationNodeStateMachine::add_transition` will works with relative path,
this means you can use it like this `add_transition("Idle", "Walk", tr)`
or `add_transition("Idle", "StateMachine/Shoot)`.
2022-05-02 13:06:36 -03:00
kobewi f473aab00d Improve Tween infinite loop detection 2022-05-01 00:24:07 +02:00
kobewi 7f0bc91844 Simplify Callable error text methods 2022-04-30 13:42:26 +02:00
Aaron Franke 1bf94dff3a
Rename Basis "elements" to "rows" 2022-04-29 08:02:56 -05:00
Aaron Franke b831fb0a54
Rename Transform2D "elements" to "columns" 2022-04-29 08:02:39 -05:00
Rémi Verschelde 1eb09364f8
Merge pull request #60247 from ScottVMariotte/AnimationTree_atEndFix
Replaced `loops_current` with `end_loop` in `AnimationNodeStateMachinePlayback`
2022-04-28 18:22:23 +02:00
Haoyu Qiu 6c01ef8f4c Miscellaneous Tween fixes 2022-04-28 21:19:01 +08:00
Rémi Verschelde 1de51133c9
Merge pull request #60331 from KoBeWi/tween_static() 2022-04-27 13:20:11 +02:00
Rémi Verschelde f40952e0ba
Merge pull request #60349 from TokageItLab/fix-rotated-root-motion-view 2022-04-27 12:41:24 +02:00
Rémi Verschelde 6c20ade250
Merge pull request #60440 from KoBeWi/Ȑ̶̛̘̻̹̪͙̇̍̔͐̊̆̏̏̓̈́̉͌͘Ȩ̸͉̳̘̬̣̩̽̈́́̅̈́̕͝ͅS̷͓̮̙̪̪̺̭̰̓̎̌́͗͆͌̈́̒͋͊͘Ë̷̡̨͔̻͈̺͓̘͉́̏̍̓͋̋͠T̶̠̙͍̱̠̱̟͎͇̬̥̞̘͛̔̄̏̆̽̄̌̅͝ͅ 2022-04-27 11:06:20 +02:00
Silc 'Tokage' Renew df89969865 fixed rotated RootMotionView grid glitch 2022-04-24 15:46:39 +09:00
kobewi cf74b36740 Fix RESET animation not being created 2022-04-22 22:28:15 +02:00
Silc 'Tokage' Renew dd90a34e8a fixed init value in root motion rotation 2022-04-18 14:04:49 +09:00
kobewi 3017530e26 Make Tween.interpolate_value() static 2022-04-17 23:13:39 +02:00
Silc 'Tokage' Renew 3ce843c128 Discontinue exp map in blending 2022-04-17 04:34:28 +09:00
ScottVMariotte c526ee6683 Replaced loops_current with end_loop 2022-04-14 18:18:00 -04:00
Silc 'Tokage' Renew 0fe723a1ac Fixed value track blend animation without RESET 2022-04-14 19:01:00 +09:00
Rémi Verschelde 8ada85ef1d
Merge pull request #60093 from TokageItLab/reset-blend
Make blend animation to use ResetTrack as default value
2022-04-13 22:46:45 +02:00
Rémi Verschelde 3c1c772b01
Merge pull request #59531 from TokageItLab/fix-init-root-motion
Fixed initialization of TRS Track in blend tree for root motion
2022-04-12 18:51:23 +02:00
reduz 6f401439f8 Implement Animation Libraries
* Instead of containing single animations, AnimationPlayer now contains libraries.
* Libraries, in turn, contain the animations.

This paves the way for implementing the possibility of importing scenes as animation libraries, finally allowing to import animations separate from the 3D models.

Missing (will be done on separate PRs):

* Make it possible to import scenes (dae/fbx/gltf) as animation libraries.
* Make it possible for AnimationTree to import animation libraries on its own, so it does not rely on AnimationPlayer for everything.
2022-04-11 12:51:54 +02:00
Silc 'Tokage' Renew 860fac4e6f Make blend animation to use ResetTrack as default value 2022-04-10 13:00:00 +09:00
Rémi Verschelde 6bbd4def45
Merge pull request #59415 from KoBeWi/tween_time() 2022-04-02 00:31:40 +02:00
kobewi e04ae8c8bc Add get_total_elapsed_time() to Tween 2022-03-29 13:34:05 +02:00
Rémi Verschelde 7119d355eb String: Remove TTR and DTR defines in non-tools build
This ensures we don't use TTR in runtime code, as it's specifically meant
to source translations for the editor.
2022-03-28 20:26:35 +02:00
Rémi Verschelde abbb0dc082
Merge pull request #59548 from akien-mga/obj-remove-unused-categories 2022-03-28 14:17:24 +02:00
kobewi d48dea7158 Force final value at the end of Tween 2022-03-27 03:09:12 +02:00
Rémi Verschelde 5371009d8e Object: Remove unused category boilerplate
We might want to re-add something like this if/when we find a good use case
for it and do the effort to categorize all objects in the API properly.

Until then, it's better to remove that boilerplate since it's not needed.

Closes #18711.
2022-03-26 15:46:01 +01:00
Silc 'Tokage' Renew 013b81b93b Fixed initialization of TRS Track in blend tree for root motion 2022-03-26 09:24:56 +09:00
Haoyu Qiu 6a3bf65657 Fix inversed ADD_GROUP parameters in AnimationNodeOneShot 2022-03-18 12:53:34 +08:00
Silc 'Tokage' Renew b06d253920 Fix blend animation to solve TRS track bug & blend order inconsistency 2022-03-16 05:11:55 +09:00
reduz 6f51eca1e3 Discern between virtual and abstract class bindings
* Previous "virtual" classes (which can't be instantiated) are not corretly named "abstract".
* Added a new "virtual" category for classes, they can't be instantiated from the editor, but can be inherited from script and extensions.
* Converted a large amount of classes from "abstract" to "virtual" where it makes sense.

Most classes that make sense have been converted. Missing:

* Physics servers
* VideoStream
* Script* classes.

which will go in a separate PR due to the complexity involved.
2022-03-10 12:28:11 +01:00
reduz 21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
Rémi Verschelde b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Rémi Verschelde 0f5455230c
Use `switch` consistently in `_notification` (`scene` folder) 2022-02-15 18:44:55 +01:00
Anilforextra adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
Rémi Verschelde cb3d308f96
Merge pull request #57372 from KoBeWi/tween_freeze()
Better handle infinite Tween loops
2022-01-29 08:08:34 +01:00
kobewi 038977a985 Better handle infinite Tween loops 2022-01-29 00:36:39 +01:00
Rémi Verschelde 2279edeaf0
Merge pull request #57368 from TokageItLab/fix-delta-for-animation-tree 2022-01-28 23:16:29 +01:00
Silc 'Tokage' Renew 0650846248 Make AnimationTree delta argument force double in core 2022-01-29 05:07:30 +09:00
kobewi 4f5c3d5a60 Fix not being able to stop() empty Tweens 2022-01-28 14:54:14 +01:00
Silc 'Tokage' Renew 1c0b163df5 More time parameters change type float to double 2022-01-27 12:42:46 +09:00
Wysocki Patryk f16c483c9d
Expose AnimationNodeOneShot::mix_mode as a property
Fixes #23458.
2022-01-25 01:17:21 +01:00
kobewi 205f56f226 Fix Tween pause behavior 2022-01-09 19:38:18 +01:00
Rémi Verschelde 1b10d700de
Merge pull request #56195 from Zylann/anim_key_error_message 2022-01-07 00:46:15 +01:00