Commit Graph

405 Commits

Author SHA1 Message Date
Pedro J. Estébanez fe4850c0d0 Use mingw-std-threads in MinGW builds 2023-11-18 11:56:05 +01:00
Hugo Locurcio e5270c0db2
Link to runtime loading/saving tutorial and improve Image documentation 2023-11-14 12:05:54 +01:00
Aaron Franke 6d8f029df4
Use the Blender file name instead of the generated GLTF file name 2023-11-09 12:11:39 -06:00
Aaron Franke 58076b9ccb
Implement glTF compat version system for files from older Godot versions 2023-11-03 12:07:25 -05:00
clayjohn d1043a5f93 Enhance checks and user experience around tangents.
Ensure `ensure_tangents` option actually creates tangent array. Even if it is just a dummy array.

Allow mesh to generate its own tangents when using compression. This allows users to compress meshes without tangents.

Warn users if they are trying to read from tangents without providing tangents.
2023-11-01 22:40:42 +01:00
Saracen 4b671eec0e Reimport bone attachment fixes:
Assign bone_idx to GLTF importer to fix serialization.
Notifies Skeletons and BoneAttachments when reimporting.
Removes usage of NOTIFICATION_NODE_RECACHE_REQUESTED
2023-10-27 20:34:01 +01:00
Haoyu Qiu 2413952a4c Fix "as" capitalization in editor strings 2023-10-23 16:10:05 +08:00
jsjtxietian 1c70a7ae6a Prevent godot crash from importing a certain kind of invalid gltf
invalid type: mistach interpolation CUBICSPLINE and value size
2023-10-20 16:58:11 +08:00
A Thousand Ships 034c0f1624 Replace `sanity` with `safety` for checks 2023-10-08 16:22:24 +02:00
clayjohn 51ed3aef63 Vertex and attribute compression to reduce the size of the vertex format.
This allows Godot to automatically compress meshes to save a lot of bandwidth.

In general, this requires no interaction from the user and should result in
no noticable quality loss.

This scheme is not backwards compatible, so we have provided an upgrade
mechanism, and a mesh versioning mechanism.

Existing meshes can still be used as a result, but users can get a
performance boost by reimporting assets.
2023-10-05 12:02:23 -06:00
Rémi Verschelde 3cf17679ca
Merge pull request #81194 from rcorre/blend-import-76338
Update blender export flags for 3.6.
2023-10-02 13:16:11 +02:00
Ryan Roden-Corrent 7e64c6c399
Update blender export flags for 3.6.
Fixes #76338.

Blender 3.6 imports fail with:

```
TypeError: Converting py args to operator properties: : keyword "export_nla_strips" unrecognized
```

The `export_nla_strips` flag was removed and replaced with `export_animation_mode`.
In 3.6.0-3.6.21, this option does not exist at all and causes the failure above.
In 3.6.22, this option was re-added, but does nothing.
See 96a73cb664.

We now need to check the blender version to determine what flags to use.
This adds an additional shell command before every import.
We might consider caching the version, but we'd have to invalidate the cache if the blender version or path changes.

As an aside, the "group animations" setting in Godot does the opposite of what I'd expect.
When `group_tracks=true`, each animation is exported individually.
When `group_tracks=false`, all animations are exported as a single track.
This seems backwards, but I've kept the 3.6 behavior consistent with 3.5.

From https://docs.blender.org/api/3.6/bpy.ops.export_scene.html:

> ACTIONS Actions – Export actions (actives and on NLA tracks) as separate animations.
> ACTIVE_ACTIONS Active actions merged – All the currently assigned actions become one glTF animation.

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-09-30 11:32:21 -04:00
Aaron Franke 7bd894ba7a
Fix skeletons when generating multiple Godot scenes from one GLTF 2023-09-28 17:48:33 -05:00
Rémi Verschelde dc14f02892
Merge pull request #81851 from aaronfranke/gltf-single-root
GLTF: Add root node export options and GODOT_single_root extension
2023-09-26 17:52:51 +02:00
Aaron Franke 446893fdd1
GLTF: Add GODOT_single_root extension 2023-09-26 10:18:52 -05:00
A Thousand Ships 517e9f8aef [Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-26 16:44:52 +02:00
Saracen 3f4513d4de Add error checks for DirAccess creation. 2023-09-26 03:07:43 +01:00
Matias N. Goldberg ec0e6800bc Fix gltf importer forcing vertex colors on all materials
The importer already checks if a mesh has vertex colors and enables
vertex colors on the material using it.

Before this fix, GLTF importer would force shader generation to use
vertex colors even if the scene did not have vertex colors at all, or
did not need them; causing inefficient shader and PSO generation.
2023-09-24 19:37:33 -03:00
Rémi Verschelde 51f67ea4c5
Merge pull request #81264 from aaronfranke/gltf-node-name-camera
GLTF: Change "Camera3D" generated node name to "Camera"
2023-09-16 21:22:29 +02:00
Rémi Verschelde be53991b5a
Merge pull request #80272 from aaronfranke/gltf-root-node-logic
GLTF: Improve logic for keeping track of the real root node
2023-09-16 21:21:40 +02:00
Aaron Franke 2723f781dd
GLTF: Allow specifying export image format including from extensions 2023-09-14 17:33:48 -05:00
Yuri Sizov 356624ce6d Merge pull request #80807 from aaronfranke/gltf-skin-mesh-comment
GLTF: Add a comment for skinned mesh tree placement
2023-09-06 14:49:06 +02:00
Aaron Franke 908716529d
GLTF: Add a comment for skinned mesh tree placement
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-09-05 12:19:31 -05:00
kobewi 6de34fde27 Add EditorStringNames singleton 2023-09-03 19:58:18 +02:00
Aaron Franke 5b7001dccf
GLTF: Improve logic for keeping track of the real root node 2023-09-03 03:35:29 -05:00
Aaron Franke c1bc4fbd20
GLTF: Change "Camera3D" generated node name to "Camera" 2023-09-03 02:47:34 -05:00
Aaron Franke da89753cc6
Fix doubly-reserved unique names in GLTF scene name assignment 2023-08-20 00:03:56 -05:00
Rémi Verschelde 5444afae63
Merge pull request #76572 from acazuc/ktx_format_support
Add support for KTX image format so that we can use Basis Universal for GLTF
2023-08-19 13:00:35 +02:00
acazuc a00cf02241 Add support for KTX & KTX2 image format
Add support glTF KHR_texture_basisu extension
2023-08-19 10:27:29 +02:00
Rémi Verschelde a2a1ed1aac
Merge pull request #80576 from KurtBliss/master
Fixed editor filesystem/import properties not being caught by the doctool.
2023-08-18 15:43:58 +02:00
KurtBliss 300ecfab89 Fixed editor filesystem/import properties not being caught by the doctool
Defined glft editor properties in editor_settings
Added documentation descriptions and entries
2023-08-14 06:06:28 -04:00
Aaron Franke d12b0787af
GLTF: Add center of mass property 2023-08-11 11:27:01 -05:00
Lyuma f67b6c158c Use image index instead of texture index for source_images 2023-08-05 16:54:35 -07:00
Aaron Franke 2970839085
Set base_path and filename during export 2023-08-03 16:49:22 -05:00
Aaron Franke 101442ced9
Expose filename in GLTFState 2023-08-03 16:38:10 -05:00
Rémi Verschelde 1d42504b30
Merge pull request #79623 from aaronfranke/gltf-export-preserialize
Add `export_preserialize` to the GLTF export process
2023-08-03 18:33:49 +02:00
Aaron Franke 2d13a9651c
GLTF: Preserve the original bytes when importing a texture 2023-08-03 10:30:33 -05:00
Aaron Franke bc68fa368d
More cosmetic improvements in the GLTF code 2023-08-03 02:05:41 -05:00
Rémi Verschelde 6b38024b6a
Merge pull request #79801 from aaronfranke/gltf-scene-export-logic
Improve GLTF export logic for scene root nodes
2023-08-02 12:20:23 +02:00
Rémi Verschelde 3988bf614b
Merge pull request #79775 from aaronfranke/gltf-node-gen-cosmetic
Cosmetic changes in GLTF node generation code
2023-08-02 12:19:58 +02:00
Rémi Verschelde c000b0ce1b
Merge pull request #79267 from aaronfranke/gltf-copyright
Add copyright to GLTFState
2023-08-02 12:16:40 +02:00
Aaron Franke 955104385c
Cosmetic changes in GLTF node generation code 2023-07-30 13:51:25 -05:00
Aaron Franke 8da45d9e16
Improve GLTF export logic for scene root nodes 2023-07-22 23:45:27 -05:00
Haoyu Qiu b35a847109 Make blend file importer warnings translatable 2023-07-23 11:19:21 +08:00
Aaron Franke e8906b5b80
Add export_preserialize to the GLTF export process 2023-07-18 15:20:24 -05:00
Hendrik Brucker 7e21eb7e00 Extract and reorganize texture resource classes 2023-07-14 20:04:21 +02:00
Yuri Sizov ac16c2696e Merge pull request #79421 from wojtekpil/gltf_emission_strength_export
Add `KHR_materials_emissive_strength` extension support for exporting GLTFs
2023-07-14 18:50:08 +02:00
wojtekpil a875baa218 Add KHR_materials_emissive_strength extension support for exporting gltfs 2023-07-13 15:30:30 +02:00
Aaron Franke 865d7e3e00
GLTF: Internal renames in material parsing code 2023-07-12 14:15:08 -05:00
Yuri Sizov e1859346dc Merge pull request #78621 from RevoluPowered/add-emission-strength-support-to-gltf
Add support for GLTF extension KHR_materials_emissive_strength
2023-07-12 17:16:41 +02:00
Aaron Franke 07400f2065
Add copyright to GLTFState 2023-07-10 00:24:10 -05:00
Rémi Verschelde 81064cc239
Doctool: Remove version attribute from XML header
We don't use that info for anything, and it generates unnecessary diffs
every time we bump the minor version (and CI failures if we forget to
sync some files from opt-in modules (mono, text_server_fb).
2023-07-06 10:08:21 +02:00
Rémi Verschelde 346f1ab86b
Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +02:00
RevoluPowered 83f2fce078 Add support for KHR_materials_emissive_strength
This reads the multiplier for the emission strength from GLTF files.

This is fairly universal and is required for blender's emission value to be imported.

The value is a simple universal multiplier and is unitless.

Sponsored by The Mirror.
2023-06-23 19:43:43 +01:00
Rémi Verschelde f9fc77bbe4
Merge pull request #77545 from aaronfranke/gltf-no-skeleton
Fix exporting MeshInstances without a Skeleton in the GLTF module
2023-06-23 00:10:00 +02:00
Aaron Franke a222bdf83f
GLTF: Rename GLTFCollider class to GLTFPhysicsShape 2023-06-16 15:18:24 -05:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
Hakim 1fb1dd3248 Refresh the filesystem tab when exporting a new GLTF file 2023-06-10 23:04:20 +02:00
Aaron Franke 6dde6b4cdf
GLTF: Expose the inertia tensor instead of a vector 2023-06-06 21:06:49 -05:00
Aaron Franke 629613a867
GLTF: Document `gltf_skeleton->godot_bone_node` is unused when importing 2023-06-03 02:13:07 -05:00
Aaron Franke a98be434b7
Fix center of mass when importing GLTF physics bodies 2023-05-29 00:09:15 -05:00
Aaron Franke 5e139c2ab9
Add a get_node_index method to GLTFState 2023-05-27 12:30:25 -05:00
Aaron Franke 4017524363
Fix exporting MeshInstances without a Skeleton in the GLTF module 2023-05-27 03:41:31 -05:00
Rémi Verschelde cb711a9950
Merge pull request #76895 from aaronfranke/gltf-webp
Add support for extending GLTF with more texture formats and support WebP
2023-05-26 11:00:06 +02:00
Theraot 3b9bcadb9e Fix GLTFSkin binding for the godot_sking property 2023-05-23 19:28:06 -05:00
Aaron Franke 7da93a0bc0
Add support for extending GLTF with more texture formats & support WebP 2023-05-22 16:30:20 -05:00
Ninni Pipping 71ee65dc57 Enable shadow warnings and fix raised errors 2023-05-11 16:00:59 +02:00
Lyuma 72d131899b gltf: Permit sparse accessors without a bufferView. 2023-05-09 10:03:38 -07:00
Clay John 610877e326
Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
2023-05-05 09:56:48 -07:00
VolTer 6b84e258d2 Use String.repeat() in more places 2023-05-01 02:27:46 +02:00
Rémi Verschelde 8f7b09916d
Merge pull request #76026 from YuriSizov/editor-running-up-that-gui
Extract editor run toolbar into its own component
2023-04-26 12:15:29 +02:00
Rémi Verschelde be00dcd724
Merge pull request #73656 from TokageItLab/expose-3d-tracks
Expose interpolation methods for 3D track in `Animation` class
2023-04-25 09:57:52 +02:00
Rémi Verschelde d5b8a0fc37
Merge pull request #69266 from aaronfranke/gltf-physics
Implement physics support in the GLTF module
2023-04-25 09:56:58 +02:00
Silc Renew fac8a918f9 Expose interpolation methods for 3D track in Animation class 2023-04-25 01:45:14 +09:00
Yuri Sizov 8a74d8438f Extract editor run toolbar into its own component
- Simplify and update its logic.
- Simplify EditorScript.
- Improve EditorNode and other relevant includes.
- Fix scene-based path in the movie writer when
reloading a scene.
2023-04-19 17:12:28 +02:00
Martin Capitanio 8b6fa79eee Fix blend_shape (shapekey) empty name import.
Corresponds to the Blender glTF-Importer PR
https://github.com/KhronosGroup/glTF-Blender-IO/pull/1902
2023-04-12 16:37:49 +02:00
Yuri Sizov 4154039832 Improve includes of EditorNode (and everything else)
Also start organizing editor-specific GUI components
into a dedicated folder, `editor/gui`.
Also move `editor_file_server` next to the rest of debugger classes.
2023-04-07 18:59:49 +02:00
Aaron Franke 639b8e7dc7
Implement physics support in the GLTF module 2023-03-09 20:02:05 -06:00
juliuse98 7a0d12182e
Fix blend-file import when using custom color management in blender
When using custom color management in blender the --version command will
output additional information infront of the "normal" output and this
prevented the import.

Fixes #74439.
2023-03-06 22:36:03 +01:00
Rémi Verschelde 6941ffaef3
Merge pull request #74293 from akien-mga/fbx-dialog-disable-importer
FBX: Disable importer when canceling FBX2glTF setup
2023-03-06 10:55:21 +01:00
Hakim e14fa5532b Get the unlit / unshaded extension when importing GLTF and set it when exporting 2023-03-05 22:34:04 +01:00
Rémi Verschelde d81e6ee024
FBX: Disable importer when canceling FBX2glTF setup
Pretty hacky solution but it's better than an infinite loop.

All this import setup needs to be redone, it's very difficult to properly
bail out from an invalid import without triggering reimport loops.

Also fix underline not visible at default editor scale in LinkButton.

Fixes #73319.
2023-03-03 13:53:03 +01:00
Rémi Verschelde eaca689118
Merge pull request #74167 from aaronfranke/gltf-node-doc
Document GLTFNode and some of GLTFState
2023-03-03 11:06:39 +01:00
Rémi Verschelde 1c39cc5ff8
Merge pull request #74018 from Abdul-AZ/master
Fix glTF mesh importer not freeing nodes correctly on import
2023-03-02 11:24:39 +01:00
Aaron Franke 2cc22fb964
Document GLTFNode and some of GLTFState 2023-03-01 10:25:23 -06:00
Rémi Verschelde 1c1524a651
Bump version to 4.1-dev
Can't stop, won't stop, they said, huh?
2023-03-01 01:44:37 +01:00
Abdulrahman Al Zeidi 5e0641ea9a Fix glTF mesh importer not freeing nodes correctly on import 2023-02-27 02:44:23 +00:00
Aaron Franke 9a031806bd
GLTF: Delete unused skeleton_to_node 2023-02-26 15:16:31 -06:00
Rémi Verschelde fe08570ac5
Merge pull request #73667 from aaronfranke/gltf-unused-joint-bool
Remove unused joint boolean in GLTFNode
2023-02-21 08:47:15 +01:00
Aaron Franke 84658b47ca
Remove unused joint boolean in GLTFNode 2023-02-21 00:48:02 -06:00
Lyuma 1c090d37b4 fbx: Set base_dir correctly in append_from_scene 2023-02-20 16:32:27 -08:00
Rémi Verschelde 1f6a5426e2
Merge pull request #73345 from TokageItLab/gltfimport
Fix gltf import generate_scene() option
2023-02-15 09:53:22 +01:00
Silc Renew 4970c27ff5 Fix gltf import generate_scene() option 2023-02-15 17:43:34 +09: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
Rémi Verschelde 6e2b9b3bdc
Merge pull request #72802 from RedMser/blender-rpc-error-handling
Better error handling for Blender RPC import
2023-02-06 22:45:18 +01:00
RedMser 8f099c7de3 Better error handling for Blender RPC import
- If RPC import fails, then try a direct import as well. While it's
 slower, it may be better than failing the import completely.
- Connection errors will disable RPC automatically, to avoid having to
wait the full 30 seconds timeout each time.
  This should be properly fixed by allowing to override the timeout
per HTTPClient.
2023-02-06 18:23:20 +01: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
Rémi Verschelde c40020513a
Merge pull request #72440 from V-Sekai/gltf_embed_as_uncompressed
gltf: Add GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_UNCOMPRESSED
2023-02-01 12:10:13 +01: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