Commit graph

100 commits

Author SHA1 Message Date
Lyuma
d92a172879 Add an import setting use_legacy_names.
During the development of 3.3, internationalization features were added to allow arbitrary bone and node names.
However, doing so will break all references and existing animation clips for projects upgraded from 3.2
This adds an import setting, enabled by default, but disabled for newly generated .import files which restores the old behavior.
2021-04-20 22:48:52 -07:00
Morris Tabor
d9e9aec9b9 fix gltf importer regression from b032067e42, causing different BoneAttachment names 2021-04-09 10:25:45 +02:00
ArdaE
87573e92dc
GLTF import: Prevent significant numerical errors in keyframe times
Keyframe times shift slowly in imported animations, starting with a zero shift
at the beginning and increasing and becoming erratic slowly farther into an
animation, reaching significant levels at times after about 3 minutes into an
animation. This commit fixes the issue by increasing the precision of the
floating point numbers used for keyframe time calculations. Only the most
significant cases that cause fast accumulation of errors over a short animation
duration are fixed. Other cases that would have a marginal benefit from
switching to double precision numbers are left for another PR/further analysis.
Note that this change has no impact on the runtime performance of games/apps
created using Godot. It only affects the GLTF importer.

Fixes #47127.

(cherry picked from commit 6770a9413b)
2021-03-19 10:53:37 +01:00
K. S. Ernest (iFire) Lee
f1e8ec942d
Expand bone name possibilities.
(cherry picked from commit c203fbfa8c)
2021-03-17 15:17:02 +01:00
abaire
b032067e42 Relaxes Node naming constraints in glTF documents to match the Editor. 2021-03-12 08:35:50 -08:00
Fabian Stiewitz
ba81e8ca09 fix gltf not importing files w/o bufferViews or accessors 2021-01-14 00:14:55 +01:00
Rémi Verschelde
49646383f1
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 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde
9d916b8540
glTF: Fix loading external images as buffer
We should first attempt loading as external files, thus creating a dependency.
Loading as a buffer should only be used as fallback to support manually loading
as PNG or JPEG depending on the defined mimeType.

Fixes #44309, was a regression from #42504.

(cherry picked from commit e268a8e523)
2021-01-05 21:33:34 +01:00
Adam Scott
d96fdcd45e Add missing "normalized" accessor property to glTF document for the 3.2 branch 2020-12-28 03:17:37 -05:00
Rémi Verschelde
68973cadf7
glTF: Workaround import failure with invalid embedded images
image/gif is not supported in the glTF 2.0 specification,
these files are broken. But let's be lenient...

Fixes #43638.

(cherry picked from commit f70cc0a60e)
2020-11-18 13:28:51 +01:00
K. S. Ernest (iFire) Lee
1f87bca8fb
Better non alphanumeric bone names.
1. _gen_unique_bone_name(Ref<GLTFState> state, const GLTFSkeletonIndex skel_i, const String &p_name) won't return an empty string.

2. String GLTFDocument::_sanitize_bone_name(const String &name) will keep Japanese characters. Like: "全ての親".

3. The sanitize function allows  the bone name to be not just alphanumeric. The only required conditions are the ones in add_bone.

> ERR_FAIL_COND(p_name == "" || p_name.find(":") != -1 || p_name.find("/") != -1);

(cherry picked from commit 7b76f8783f)
2020-10-05 20:46:01 +02:00
Rémi Verschelde
9529ce41eb
glTF: Fix parsing image data with mimeType undefined
The glTF 2.0 spec only makes `mimeType` mandatory for `bufferView` image data,
so the previous logic to handle URIs with base64-encoded images could fail if
`mimeType` is undefined.

The logic was documented and refactored to better handle the spec, notably:

- `uri` and `bufferView` are now mutually exclusive, and only the latter fails
  if `mimeType` is undefined.
- `uri` with a file path will now respect the `mimeType` if defined, and thus
  attempt loading the file with the specified format (even if its extension is
  not the one expected for this format). So we can support bad extensions (PNG
  data with `.jpg` extension) or custom ones (PNG data in `.img` file for
  example).
- `uri` with base64 encoded data will infer MIME type from `data:image/png` or
  `data:image/jpeg` if it was not documented in `mimeType` initially.
- `uri` with base64 encoded data, no `mimeType` and `application/octet-stream`
  or `application/gltf-buffer` will fall back to trying both PNG and JPEG
  loaders.

Fully fixes #33796 (and fixes up #42501).

(cherry picked from commit 2e99d0b26f)
2020-10-05 14:41:53 +02:00
Rémi Verschelde
177d16c01c
glTF: Fix parsing buffer data with application/gltf-buffer and image/* MIME types
See https://github.com/KhronosGroup/glTF/issues/944 for context on the
application/gltf-buffer MIME type.

The glTF 2.0 spec supports `image/jpeg` and `image/png` which can also be
base64-encoded in buffer URIs.

Fixes #33796.

(cherry picked from commit 34a50310ad)
2020-10-05 14:38:48 +02:00
K. S. Ernest (iFire) Lee
460ab353b4
Use the vertex colors by default in gltf.
(cherry picked from commit 43424e1321)
2020-09-29 13:57:57 +02:00
K. S. Ernest (iFire) Lee
f189d0e1f3 Allow gltf2 morph targets with no default values. Changes for bug 38751
(cherry picked from commit 71ae0ff46d)
2020-07-24 09:37:43 +02:00
Sl3dge78
d99f6c4d5c Fix #20467. The "Anim imported" warning gets displayed properly when working on imported anims.
(cherry picked from commit 95cd74fc4b)
2020-06-21 21:36:12 +02:00
Aaron Franke
e3cf64a7d8
[3.2] Add GLTF light import
Co-authored-by: K.S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2020-06-10 23:51:34 -04:00
Alex Bustin
8a024ca294 Respect 'mesh compression' editor import option in Assimp (ie. FBX) and glTF importers 2020-05-28 15:28:47 -07:00
Rémi Verschelde
5f5ef98832 glTF: Fix tangent generation for non-blend shapes
PR #30877 was bogus as it made a blend shape-specific code block apply
to everything but blend shapes (as it seemed not to work properly *for*
blend shapes).

The proper fix should thus be to simply remove the problematic
block (and thus cleanup unnecessary logic).

Fixes #32712.

(cherry picked from commit 0034c88c57)
2020-05-01 10:56:58 +02:00
Juan Linietsky
03c8e12d54 Add support for named binds in Skin.
Helps better reutilization of skeletons from Maya exported files.

(cherry picked from commit 9a34f39d32)
2020-03-04 12:40:14 +01:00
Hugo Locurcio
a002b93d86
Add explanations for errors related to Vector/Quat normalization 2020-01-24 14:19:23 +01:00
Haoyu Qiu
92b36d4706 Adds NULL check before using image loader 2020-01-16 21:49:23 +08:00
K. S. Ernest (iFire) Lee
0172a7f932 Use cycle and loop hint flags in glTF2. 2020-01-10 08:02:16 -08:00
K. S. Ernest (iFire) Lee
f028b8b0e4 Support GLTF2 alpha scissors. 2020-01-02 11:52:08 -08: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
Marios Staikopoulos
d3cf8cfb7d Fix Hard Crash on glTF Color Accessor Import 2019-12-24 15:03:24 -08:00
Marios Staikopoulos
4b28fd4f23 Bugfix: Sanitize glTF importer Animation Names and do not set bone_pose 2019-11-27 12:20:38 -08:00
K. S. Ernest (iFire) Lee
80b1604fa9 33714 glTF2 handle undefined load-time scene. 2019-11-22 08:48:23 -08:00
Rémi Verschelde
ab3bccdb78 Fix typos with codespell
Using codespell 1.16.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-11-22 08:35:03 +01:00
Rémi Verschelde
28613ab8c9
Merge pull request #33794 from nekomatata/gltf-morph-shapes-crash2
Error instead of crash in gltf import with more than one morph target
2019-11-21 22:09:08 +01:00
PouleyKetchoupp
e949665489 Error instead of crash in gltf import with more than one morph target
Redone from PR #33782 to fix the crash without adding compatibility with Blender 2.8
Helps with #16124, while Blender 2.81 has the proper export fix.
2019-11-21 17:25:01 +01:00
K. S. Ernest (iFire) Lee
d0de373884 33756 gltf2 importer should use zfar 2019-11-21 07:52:18 -08:00
K. S. Ernest (iFire) Lee
3b44866bf2 33714 If the gltf2 asset has no scene, it is corrupt. 2019-11-20 10:49:24 -08:00
qarmin
616ab4fac2 Small fixes to redundand code, copy paste bugs 2019-10-14 11:40:55 +02:00
gladmin
7f3e37fead Fix import hints being ignored by glTF importer
This fixes a regression introduced in commit 72d2468
due to hyphens being removed from nodes names.
2019-09-25 16:58:05 +02:00
Rémi Verschelde
dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin
17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Rémi Verschelde
8c0595b722
Merge pull request #32306 from hbina/unused_variable
Fixed incorrect usage of variables in querying values.
2019-09-25 08:49:31 +02:00
Marios Staikopoulos
4631b0ca62 glTF: Fixed mistake with root node calculation in skin_verify
Was not actually grabbing the computed roots for comparison, but instead
was grabbing the disjoint_set representatives.
2019-09-24 21:49:25 -07:00
Hanif Bin Ariffin
d1e069ea23 Fixed incorrect use of variables
The previous committer mistakenly used the wrong variable to query some values.
This commit simply changes it so that it queries the right Dict.
2019-09-24 16:45:34 -04:00
Marios Staikopoulos
77e223ff94 GLTF: Fixed some issues with skin groups joining incorrectly and removed unused code
- Skin groups now merge more cleanly together
- Skins whose highest nodes are siblings of another skin now get merged also
- Skin nodes who have children of another skin now also fuse together
- Removed the re-rooting of IBM code, as it is no longer needed with the Skin system
2019-09-22 17:45:36 -07:00
Marios Staikopoulos
72d2468d68 More GLTF Fixes
1: Depth draw mode set for transparent materials (iFire)
2: Skeletons
  - Bone names now unique and seperate from scene names
  - Due to mixture of fake joints and joints, new bone sanitizing for names added
  - Fixed an issue where some disjoint skins were not being joined due to a logic error
  - Deterministic and Depth-first bone creation order
3: Skins
  - Removed duplicate skins when possible
4: Animations
  - Fixed invalid morph target names
2019-09-21 21:45:38 -07:00
Marios Staikopoulos
6fc5647bc3 GLTF Importer - Add more Index types and const-ed up the code 2019-09-21 15:21:02 -07:00
Marios Staikopoulos
11e09e59d1 GLTF2 Import Fixes - Skin(s) to Skeleton - Skin Support 2019-09-20 23:08:58 -07:00
Juan Linietsky
d81ddaf33e Added skin support and simplified APIs to override bone position. 2019-09-18 19:46:32 -03:00
Fabio Alessandrelli
c19871af6d Move CryptoCore to it's own folder.
Crypto classes will be placed in core/crypto.
2019-08-19 16:31:05 +02:00
Braden Bodily
71d71d55b5 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages

Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?),
core/os/memory.cpp,
drivers/png/png_driver_common.cpp,
drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-08-17 12:33:15 +02:00
Joseph Catrambone
c2e91005ef Bugfix in GLTF import: Flipping boolean check. Reindexing should _NOT_ happen when blend shapes are present. 2019-07-27 14:34:54 -07:00
Rémi Verschelde
a1b4568ba9
Revert "Tweak SpatialMaterial's default metallic and roughness texture channels" 2019-07-22 11:56:41 +02:00
Fabio Alessandrelli
564d93ff10 CryptoCore class to access to base crypto utils.
Godot core needs MD5/SHA256/AES/Base64 which used to be provided by
separate libraries.
Since we bundle mbedtls in most cases, and we can easily only include
the needed sources if we so desire, let's use it.

To simplify library changes in the future, and better isolate header
dependencies all functions have been wrapped around inside a class in
`core/math/crypto_base.h`.

If the mbedtls module is disabled, we only bundle the needed source
files independently of the `builtin_mbedtls` option.
If the module is enabled, the `builtin_mbedtls` option works as usual.

Also remove some unused headers from StreamPeerMbedTLS which were
causing build issues.
2019-07-02 12:36:27 +02:00