Commit graph

655 commits

Author SHA1 Message Date
Haoyu Qiu
385a5b44aa Improve documentation for get_animation() 2022-08-29 14:54:57 +08:00
Silc Renew
931fb4dc11 Add linear/cubic angle interpolation to Animation interpolation type 2022-08-27 07:58:22 +09:00
Rémi Verschelde
f9f2446972
Merge pull request #64367 from Mickeon/rename-var-to-str
Rename `str2var` to `str_to_var` and similar
2022-08-26 23:04:06 +02:00
Micky
59e11934d8 Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
Rémi Verschelde
0123752dc4
Merge pull request #54456 from rafallus/fix/anim_state_machine_start
Fix AnimationTree state machine start()
2022-08-26 07:47:11 +02:00
Rémi Verschelde
b9919fd87d
Merge pull request #64678 from TokageItLab/implement-ease-baker
Fix Quaternion Tween and add Easing baker to AnimationTrackEditor
2022-08-23 09:19:21 +02:00
Rémi Verschelde
b8a64313f0
Merge pull request #59564 from KoBeWi/FINALLY,_ULTIMATE_UNDO_REDO 2022-08-22 22:37:33 +02:00
Rémi Verschelde
9c567a0604
Merge pull request #63802 from TokageItLab/curve-transition 2022-08-22 22:30:09 +02:00
Rémi Verschelde
1f61d47766
Merge pull request #64339 from YuriSizov/core-multilevel-validate-property 2022-08-22 21:39:48 +02:00
kobewi
ece3df3938 Add per-scene UndoRedo 2022-08-22 18:05:10 +02:00
Yuri Sizov
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
Silc Renew
f7dd83ce60 Fix Quaternion Tween and implement ease baker 2022-08-22 19:04:58 +09:00
Aaron Franke
8893b2bdb4
Clean up mesh include code and comments 2022-08-20 13:24:40 -05:00
Silc Renew
2c2e1a7736 added Curve in animation node transition for better control over cros…
Co-authored-by: jeronimo-schreyer <jeronimo.schreyer@gmail.com>
2022-08-18 08:17:30 +09:00
Guilherme Felipe de C. G. da Silva
15b5bc88e2 Re-add AnimationNodeStateMachine::end_node for root state machine
Fix #63660
2022-08-10 19:29:53 -03:00
Yuri Sizov
1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00
Guilherme Felipe de C. G. da Silva
a2e63096c6 Fix AnimationNodeStateMachinePlayback::is_playing
Fix #24790
2022-08-03 14:38:57 -03:00
Guilherme Felipe de C. G. da Silva
0ad580a740 Fix AnimationNodeStateMachine::rename_node 2022-07-31 18:47:19 -03:00
Juan Linietsky
d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
Hugo Locurcio
aaeb60eafc
Add a Movie Quit On Finish property to AnimationPlayer
This quits the project when an animation is done playing in the
given AnimationPlayer, but only in Movie Maker mode.
When this happens, a message is printed with the absolute path of the
AnimationPlayer node that caused the engine to quit.

This can be used to create videos that stop at a specified time
without having to write any script.

A report is now also printed to the console when the video is done
recording (as long as the engine was exited properly).
This report is unfortunately not always visible in the editor's
Output panel, as it's printed too late.

A method was also added to get the path to the output file from the
scripting API.
2022-07-27 18:50:28 +02:00
Silc Renew
dde235ad82 add position track normalization & post process key value for retarget 2022-07-26 18:48:08 +09:00
Silc Renew
e27119a51f Fix initial value of TRS3DTrack cache in AnimationPlayer 2022-07-26 05:32:26 +09:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
Rémi Verschelde
3084a48ace
Merge pull request #63219 from reduz/implement-vector4-projection 2022-07-25 11:13:27 +02:00
reduz
455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
João Pedro São Gregorio Silva
324b4884d6 Fix incorrect expression base in AnimationNodeStateMachinePlayback::_check_advance_condition 2022-07-21 16:36:52 +02:00
Silc Renew
9be288edf9 refactor sync in AnimationTree 2022-07-16 21:45:32 +09:00
Rémi Verschelde
d631ee3307
Merge pull request #62510 from MinusKube/animation-reset-crash
Fix animation player crashing when caching disabled tracks
2022-06-29 10:19:33 +02:00
MinusKube
a73882305c Fix animation player crashing when caching disabled tracks 2022-06-29 06:18:45 +02:00
Silc Renew
2201c281dd fixed Pingpong animation get snaging on the edge in AnimationTree 2022-06-29 08:39:41 +09:00
SaracenOne
75a8606b83 Add AnimationTree Advance Expressions
Allows specifying an expression as a condition for state machine transitions.

This gives much greater flexibility for creating complex state machines. By directly interfacing with the script code, it is possible to create complex animation advance condition for switching between states.

Ensure assigning AnimationTreeStateMachineTransition base expression node in editor is relative to current AnimationTree node.

Allow setting an expression base node on the AnimationTree itself.

Co-Authored-By: reduz <reduzio@gmail.com>
2022-06-28 09:26:13 -07:00
Rémi Verschelde
1a4a4856f6
Merge pull request #61885 from TokageItLab/fix-method-seek
Improved way of getting MethodTrack keys
2022-06-23 10:07:45 +02:00
Rémi Verschelde
21b51fdf7e
Merge pull request #61826 from guilhermefelipecgs/fix_leak
Fix ObjectDB instances leaked on state machine when editor closes
2022-06-23 09:58:51 +02:00
Rémi Verschelde
64918e4ae9
Merge pull request #62337 from reduz/respect-disabled-animation-tracks
Respect disabled animation tracks
2022-06-23 09:13:54 +02:00
reduz
11805ac01d Respect disabled animation tracks
Fixes #25537, supersedes #60509
2022-06-23 08:35:34 +02:00
reduz
df6cd650d1 Fix animation reset on save
Old (prototype) name was left in code

Supersedes #60565
2022-06-23 07:49:41 +02:00
Silc 'Tokage' Renew
dedc4710a3 improved way of getting method track keys 2022-06-23 04:57:42 +09:00
reduz
141c375581 Clean up Hash Functions
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02:00
Haoyu Qiu
74e15ea35f Remove argument option for the remove_animation that no longer exists 2022-06-19 11:08:19 +08:00
Andreas Raddau
0e4fd72ae6 Remove duplicate assignment of AnimationNode::State.valid
In AnimationTree::_process_graph, the State.valid variable is set to true.
A few lines later, it's set again. Probably a copy/paste mistake. This
commit removes the second assignment.
2022-06-18 11:59:19 +02:00
FireForge
4678736a39 Add suffixes to all nodes and resources 2022-06-11 09:41:05 -05:00
Guilherme Felipe de C. G. da Silva
7fc3aa43ce Fix ObjectDB instances leaked on state machine when editor closes 2022-06-08 17:08:48 -03:00
SnailRhymer
b0e31eeb4a Remove configuration warning from AnimationPlayer
Remove warning about animations in different libraries having the same name, since shared names are fine.

Also fix missing vformat argument when setting the name of an animation to one that does conflict with an animation in the same library.
2022-05-24 13:22:16 +01:00
Rémi Verschelde
bd8d91254c
Merge pull request #61106 from snailrhymer/animation-library-fixes
Fix errors and improve UX relating to new animation libraries
2022-05-24 10:51:31 +02:00
Rémi Verschelde
9923851370 Fix typos with codespell
Using codespell 2.2-dev from current git.
2022-05-23 21:32:19 +02:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Aaron Record
900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
Haoyu Qiu
fc3b845c07 Add dedicated macros for property name extraction
* Replace case-by-case extraction with PNAME & GNAME
* Fix group handling when group hint begins with property name
* Exclude properties that are PROPERTY_USAGE_NO_EDITOR
* Extract missing ADD_ARRAY*, ADD_SUBGROUP* macros
2022-05-19 14:08:47 +08:00
Rémi Verschelde
5b3d596285
Merge pull request #60774 from TokageItLab/root-seek-mode
Fixed broken root motion calculation in internal process of `AnimationBlendTree` such as `NodeOneShot`
2022-05-18 15:24:21 +02:00
SnailRhymer
d79818acb6 Fix errors and improve UX relating to new animation libraries
- Fix a bug causing an error message when a scene containing an AnimationPlayer with a reset track is saved, by correctly referencing the temporary "default" library.
- Make library dropdown in new animation window assign correct library when creating an animation.
- Similarly allow choice of library when duplicating animation.
- Make library dropdown default to library of currently selected animation.
- Make library dropdown show when exactly one library exists, and it isn't [Global]. Include [Global] on the dropdown in this case (will be newly created if dialog is confirmed).
- When appending (x) to avoid New Anim name collisions, correctly check target library instead of [Global].
- Add parentheses when appending x when duplicating animations in the library editor, for consistency.
- Change titles and prompts to be distinct in name/rename/duplicate dialiogs.
- Fix bug in OprionButton.get_selectable_item(true) when last is not selectable.
- Fix issues where animation wasn't found on deletion/rename by correctly prepending library name.
- Remove an extraneous print_line from animation_track_editor.
- Add messages to errors when an animation isn't found.
2022-05-17 00:02:51 +01:00
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
Silc Renew
ba8398f270 Fixed delta & Implement selection of whether or not to seek root 2022-05-09 08:28:32 +09: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