Commit Graph

179 Commits

Author SHA1 Message Date
Hakim 90dbf3bd38 Get the unlit / unshaded extension when importing GLTF and set it when exporting
(cherry picked from commit e14fa5532b)
2023-03-13 22:05:07 +01:00
K. S. Ernest (iFire) Lee 28a340bf3b For basisu avoid inserting to the image array twice.
Basisu images were getting referenced incorrectly like set black or set as not transparent.
2023-02-14 17:22:36 -08:00
K. S. Ernest (iFire) Lee dbc1e94695 Fixes for gltf export.
* Fix null crashes.
* Bake tracks
* Add some error messages.
2023-02-07 11:57:25 -08:00
Lyuma 5fbcb80170 Use reimport_append api for importing embedded gltf images
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2023-02-06 07:11:45 -08:00
Lyuma bc24d01359 gltf: Add GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_UNCOMPRESSED
This option allows for a safe fallback for embedded gltf textures in cases where VRAM compression is not needed.
Add an is_editor_hint guard around GLTFHandleBinary::HANDLE_BINARY_EXTRACT_TEXTURES, to use EMBED_AS_UNCOMPRESSED by default at runtime.
This provides an option for pixel art to be stored losslessly.
Additionally, respect project importer defaults for texture import settings.
Avoid writing and reimporting extracted textures identical to version on disk.
2023-02-01 01:42:36 -08:00
Rémi Verschelde 68cee1f02a
Merge pull request #72201 from fire/gltf-extract-img
Restore gltf embedded scenes due to problems with textures.
2023-01-31 13:18:37 +01:00
K. S. Ernest (iFire) Lee 39ef247721 gltf: Avoid using base64 hash as an image filename
Consistently use the images.name property with deduplication, or else the image index.
2023-01-31 02:30:16 -08:00
Silc Renew 8b3be51d17 Add remove immutable tracks option to glTF importer
Co-authored-by: Lyuma <xn.lyuma@gmail.com>
2023-01-30 08:57:27 +09:00
Rémi Verschelde 9d555f5c68
Merge pull request #62499 from fire/gltf-binary-img-compression
Handle gltf binary images
2023-01-27 11:35:55 +01:00
Rémi Verschelde 8b662c763e
Merge pull request #72162 from lyuma/skeleton_rename
Make BoneAttachment3D and Skeleton3D names consistent.
2023-01-27 11:24:34 +01:00
K. S. Ernest (iFire) Lee 39922d7167 Handle gltf binary
[ Ignore and Warn | Extract Textures (default) | Optimize Loading Embedded as Basisu ]

Enable compressed mip maps from Basis Universal for faster compressions.

Increase the quality of Basis to avoid corruption.

To keep compatibility use the first mip of the previous internal Godot format.

Because texture names may have invalid filename characters, adds String::validate_filename to sanitize filenames for import pipeline use.
2023-01-27 02:02:02 -08:00
Lyuma 3f4ea98b34 Make BoneAttachment3D and Skeleton3D names consistent.
BoneAttachment3D nodes are now named as their bone name.
Resolves cases where BoneAttachment3D nodes will have arbitrary names like BoneAttachment3D6
Reserve the name "Skeleton3D" and use this name for all generated Skeleton3D nodes.

This change will break existing imported scenes with more than one skeleton and/or bone attachments.
2023-01-26 23:25:33 -08:00
Lyuma 03bd1da32b Avoid nested skeletons, and handle skinned meshes with children.
Recursively adds child nodes into each skeleton. This should prevent nested skeletons and avoid bone attachments for leaf bones.

In cases where a skinned mesh has children, creates two scene nodes with the same name, which both will represent this single gltf node.
Because blend shape animations must target the mesh, adds a separate mapping for ImporterMeshInstance3D node references.

This change will break existing imported scenes with bone attachments and more than one skeleton.

Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2023-01-26 22:41:58 -08:00
SaracenOne 03523572b9 Adds missing method call to set blendshape tracks as 'imported' when importing from a GLTF. 2023-01-23 07:40:06 +00:00
K. S. Ernest (iFire) Lee a103400871 Fixes cases where the runtime ResourceLoader cannot load gltf images. 2023-01-19 09:10:28 -08:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Quentin Guidée b14c87cb92
glTF: Fix export crash with a ShaderMaterial (fixes #70159) 2022-12-17 10:03:42 -05:00
Aaron Franke f83f13f3a2
Pass GLTFState to the export_preflight method 2022-12-11 13:22:25 -06:00
Aaron Franke 5c48dfac48
Consistently use `p_` for parameters in GLTFDocument 2022-12-10 16:07:17 -06:00
Rémi Verschelde 0c1273629d
Merge pull request #69372 from aaronfranke/gltf-cleanup
GLTF module: Clean up lots of includes
2022-12-10 10:48:14 +01:00
bruvzg ecec415988
Use system fonts as fallback and improve system font handling.
Add support for font weight and stretch selection when using system fonts.
Add function to get system fallback font from a font name, style, text, and language code.
Implement system font support for Android.
Use system fonts as a last resort fallback.
2022-12-04 18:44:20 +02:00
Aaron Franke 1bbbee384d
GLTF: Clean up lots of includes 2022-11-29 23:11:08 -06:00
Rémi Verschelde 09e1db2148
Merge pull request #68665 from TokageItLab/cut-unkeyed-gltf-anim
Add "Trimming" option to cut un-keyed timeline before first key in glTF animation
2022-11-29 16:51:56 +01:00
Silc Renew db7473672f Add trimming option to cut un-keyed timeline before first key in gltf 2022-11-29 13:53:33 +09:00
Rémi Verschelde 06bdc91afd
Merge pull request #69083 from fire/abstract_gltf_material
Cache materials in gltf as the abstract class of Material in GLTFDocument
2022-11-24 18:54:25 +01:00
K. S. Ernest (iFire) Lee baab97302a Cache materials in gltf as the abstract class of Material
Use the abstract material class instead of BaseMaterial3D. This allows inserting ShaderMaterials into gltf. Like in VRM.
2022-11-24 09:00:09 -08:00
RedMser 9c50e99c5c Add unregister for GLTFDocumentExtension 2022-11-22 21:46:59 +01:00
Aaron Franke 98ef359240
Add three new methods to GLTFDocumentExtension 2022-11-21 14:38:46 -06:00
Aaron Franke 73c673a614
Change the way GLTFDocumentExtension classes are registered
Also move GLTFDocumentExtension into the extensions folder
2022-11-09 20:58:48 -06:00
Aaron Franke 83634119d4
Replace Quaternion Euler constructor with `from_euler` method 2022-11-01 09:28:12 -05:00
kobewi 072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
Rémi Verschelde 8017827144 SCons: Re-enable treating `#warning` as error with `werror`
Replace all TODO uses of `#warning` by proper TODO comments, and will open
matching bug reports to keep track of them.

We don't have a great track record fixing TODOs, but I'd wager we're even
worse for fixing these "TODO #warning" so we should prohibit this usage.
2022-10-10 16:12:26 +02:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
The Tophat Demon c1a600545c GLTF imports & exports material texture filters 2022-10-03 16:20:08 -04:00
Aaron Franke 7097e8add7
Add a way to get the GLTF extensions supported by GLTFDocumentExtension 2022-09-19 19:40:06 -05:00
Aaron Franke b72dc0de89
Make used extensions stored in GLTFState
This allows GLTFDocumentExtension classes to add to the used extensions array.
2022-09-19 19:39:49 -05:00
Aaron Franke afe09ec914
Minor enhancements to the GLTF module (lights and docs) 2022-09-18 22:33:21 -05:00
Sarfraz 177f2a8419 Fix gltf 8 bone weights condition to check for the second joint array
size.
2022-09-10 23:54:20 +05:30
Micky 694190a354 Rename TileMap/GridMap.`world_to_map` and opposite to `local_to_map`
For both TileMap and GridMap:
- `world_to_map` -> `local_to_map`
- `map_to_world` -> `map_to_local`

Also changes any mention of "world" in this context to "local" to avoid future confusion.

Finally, updates the docs of both methods for consistency.
In particular, adding a note on how to convert the returned values from local to global coordinates and vice versa.
2022-09-05 18:08:39 +02:00
Rémi Verschelde 3a62c294c7 Merge pull request #65170 from KoBeWi/your_argument_is_TypedArray 2022-09-02 13:57:02 +02:00
Jonathan Nicholl 15d057c521 Add `is_zero_approx` methods to `Vector2`, `3`, and `4` 2022-09-02 00:29:50 -04:00
kobewi 7adc8376ed Change Array arguments to TypedArray 2022-09-01 13:13:19 +02:00
Rémi Verschelde 432b25d364
Merge pull request #65066 from aaronfranke/str-path-join 2022-08-30 10:01:11 +02:00
Aaron Franke 10a56981dc
Rename String `plus_file` to `path_join` 2022-08-29 19:38:13 -05:00
Aaron Franke 03cd8097e1
Move GLTF camera conversion code into GLTFCamera 2022-08-28 11:18:32 -05:00
Aaron Franke 3d76b91229
Move GLTF light conversion code into GLTFLight 2022-08-28 11:18:22 -05: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 09b012a409
Merge pull request #64400 from aaronfranke/gltf-fix-camera 2022-08-22 22:23:08 +02:00
rafallus da7a5653f4 Expose Basis `set_orthogonal_index` method as a GridMap function 2022-08-20 21:42:20 -05:00
Aaron Franke be81b33e2b
GLTF: Fix orthographic cameras, internally store data in GLTF's format 2022-08-14 19:18:53 -05:00