Commit graph

122 commits

Author SHA1 Message Date
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
Rémi Verschelde 5ff0624a07
Fix GCC 12 -Werror=type-limits in animation compression code
Fixup to #54050, CI's GCC builds didn't catch it.
2021-10-25 17:59:07 +02:00
Rémi Verschelde 24fdedfe94
Merge pull request #54050 from reduz/animation-compression 2021-10-25 14:27:58 +02:00
Silc 'Tokage' Renew 653e2a550c Fixed animation insertion in SkeletonEditor 2021-10-23 16:50:00 +09:00
reduz a69541da4c Implement Animation Compression
Roughly based on https://github.com/godotengine/godot-proposals/issues/3375 (used format is slightly different).

* Implement bitwidth based animation compression (see animation.h for format).
* Can compress imported animations up to 10 times.
* Compression format opens the door to streaming.
* Works transparently (happens all inside animation.h)
2021-10-21 18:27:34 -03:00
reduz ae1c016547 Implement Animation Blend Shape Tracks
* New track type BLEND_SHAPE
* Blend shapes are imported via this new track type
* Processing is more optimized (no longer relies on variants)
* Modified the Blend Shape API in MeshInstance3D to use indices rather than StringNames (more optimizes)
* Promo: Fixed a small bug in gizmo updating in Node3D that affected performance

Dedicated BlendShape tracks are required for both optimization and eventually implementing them in animation compression.
2021-10-16 08:36:05 -03:00
reduz ec19ed3723 Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.

This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:

* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.

*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
2021-10-12 20:08:42 -03:00
Juan Linietsky 610de0974d
Revert "Implement reverse playback and ping-pong loop in AnimationPlayer and NodeAnimation" 2021-10-11 19:27:50 -03:00
Tokage 372ba76663 implement ping-pong loop in animation
Co-authored-by: Chaosus <chaosus89@gmail.com>
2021-10-09 18:08:43 +09:00
K. S. Ernest (iFire) Lee ffe54af0db Calculate proper animation length. 2021-08-24 18:50:22 -07:00
requizm e4b29cb6be Fix 3d animations doesn't play
Add comment


Fix


ff
2021-08-22 23:19:26 +03:00
Aaron Franke 430ad75963
Some work on double support 2021-08-09 17:43:48 -05:00
Aaron Franke 78d33a6e24
Use doubles for time in animation code 2021-08-09 14:04:25 -05:00
Marcel Admiraal 8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00
Aaron Franke 125d1a7cd3
Rename Animation TYPE_TRANSFORM to TYPE_TRANSFORM3D 2021-06-03 21:11:54 -04:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
reduz f8d03b98e7 Improve resource load cache
-Added a new method in Resource: reset_state , used for reloading the same resource from disk
-Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type)
-Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
2021-02-11 15:44:28 -03:00
Rafał Mikrut 7961a1dea3 Initialize class variables with default values in scene/ [2/2] 2021-02-09 18:24:36 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Pedro J. Estébanez b7367ac426 Add animation reset track feature
As a bonus, to have consistency between use Beziers and create insert tracks, use Beziers also gets a default via editor settings that is used when the confirmation dialog is disabled, instead of just falling back to creating non-Bezier tracks.
2020-12-20 12:45:08 +01:00
Marcel Admiraal f5a3cbda19 Rename Animation::track_remove_key_at_position to track_remove_key_at_time 2020-12-14 18:00:11 +00:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
lolligerjoj ff4af94414 Expose Animation::value_track_interpolate to GDscript 2020-10-01 14:27:09 +02:00
Tomasz Chabora e1a1bb0a6e Keep transition value when replacing key 2020-07-23 22:59:04 +02:00
lordkettune 4313a7bdc8 Fix issues with custom tracks on reimport 2020-07-02 16:08:20 -07:00
Andrii Doroshenko (Xrayez) 69d5de632e Split Geometry singleton into Geometry2D and Geometry3D
Extra `_2d` suffixes are removed from 2D methods accoringly.
2020-05-27 14:28:34 +03:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Aaron Franke 540156b387
[Core] Rename linear_interpolate to lerp 2020-04-29 04:02:49 -04:00
Rémi Verschelde cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
Juan Linietsky 33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
Juan Linietsky 3c0059650d Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
2020-02-21 14:25:29 +01:00
Juan Linietsky 3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Rémi Verschelde 77816fea8b
Merge pull request #32477 from aaronfranke/equal-approx-separate
Make is_equal_approx separate and make == exact again
2019-11-07 14:54:15 +01:00
LikeLakers2 68552d9a4b Changes the name of all parameters referring to track indices within Animation, to "track_idx" 2019-10-14 18:08:41 -04:00
Aaron Franke aeb7075628
Replace vector == and is_zero_approx(distance) with is_equal_approx
Internal changes only
2019-10-14 16:47:42 -04:00
Paul Trojahn 7c9c6df7e4 Replace is_zero_approx(A.distance_to(B)) with A==B
Related to #22988 (Fixes the holes in the shape of
the first comment)
2019-08-19 18:16:58 +02:00
qarmin 6cbaf7662f Changed some code showed in LGTM and Coverage 2019-07-20 08:09:57 +02:00
qarmin 01cc7a996b Use reference to constant in functions 2019-07-10 11:54:12 +02:00
Rémi Verschelde af80182016
Merge pull request #30407 from qarmin/small_fixess
Fixes minor issues found by static analyzer
2019-07-08 08:16:50 +02:00
qarmin 9a77d748c0 Fixes minor issues found by static analyzer 2019-07-07 23:08:51 +02:00
Ibrahn Sahir 4e4697b1c4 Added release function to PoolVector::Access.
For clarity, assign-to-release idiom for PoolVector::Read/Write
replaced with a function call.
Existing uses replaced (or removed if already handled by scope)
2019-07-06 12:04:27 +01:00
Rémi Verschelde 66a854da78
Merge pull request #29878 from Dentrax/fixes
Added ERR_FAIL checks for `Animation::track_set_key_value` and `AnimationNodeStateMachine::remove_node`
2019-06-19 14:18:52 +02:00
Furkan Türkal 09907a28b3 added forgotten err_fail_index check 2019-06-19 13:07:18 +03:00
Rémi Verschelde 6d16f2f053 Fix error macro calls not ending with semicolon
It's not necessary, but the vast majority of calls of error macros
do have an ending semicolon, so it's best to be consistent.
Most WARN_DEPRECATED calls did *not* have a semicolon, but there's
no reason for them to be treated differently.
2019-06-11 14:49:34 +02:00
Tomasz Chabora adcbcf87dd Add track_set_key_time() to Animation 2019-05-31 00:40:29 +02:00
Rémi Verschelde c11bf884e0
Merge pull request #25012 from avencherus/prevent-duplicate-keyframes
Do precision comparison to prevent the creation of keyframes with a time that already exists
2019-05-29 18:59:19 +02:00