1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-26 15:46:23 +00:00
Commit Graph

73 Commits

Author SHA1 Message Date
Arseny Kapoulkine
6190d412d3 Adjust LOD selection metrics to use attribute error
- Revert meshoptimizer patch; the metric used for LOD selection now
incorporates attribute error
- Since LOD selection is now aware of attribute deviation, we don't
need to use a higher normal weight
- To prevent normal creases from creating input triangles with very
large normal deviation, reduce default normal merge threshold
- Since we now use combined metric to select LODs, we never need LODs
with error>1 as these should not be selected if the mesh is visible.
2025-05-18 17:38:54 +03:00
Raphaël Daubelcour
9511e1137d Check if import_script is subtype of EditorScenePostImport 2025-05-14 12:07:17 -04:00
Thaddeus Crews
5dc375b2fc Merge pull request #105014 from aaronfranke/no-type-suffixes
Allow completely opting out of name suffix magic in 3D scene import
2025-04-24 17:18:50 -05:00
Thaddeus Crews
d236bd8633 Merge pull request #99543 from KoBeWi/using_rng_to_destroy_rng
Add `create_id_for_path()` to ResourceUID
2025-04-11 09:51:12 -05:00
kobewi
ff1f040893 Add create_id_for_path() to ResourceUID 2025-04-11 00:53:34 +02:00
Thaddeus Crews
94282d88f9 Core: Use Math namespace for constants 2025-04-10 16:29:30 -05:00
Aaron Franke
e96828673f Allow completely opting out of name suffix magic in 3D scene import 2025-04-10 01:11:54 -07:00
Yufeng Ying
8ae16699c5 Do not use Dictionary::keys() for Dictionary iteration. 2025-04-05 18:42:13 +08:00
Michael Alexsander
556933306a Allow to compile templates without navigation features 2025-04-01 11:53:35 -03:00
Lyuma
8997c999e9 Scene import: extract UID paths and store fallback
When extracting meshes, materials and animations, always store the uid:// path as well as a res:// fallback.
When validating import settings, load the fallback path if the uid:// path fails to load.
Update save_to_file/fallback_path every import to keep the file path in sync with the uid.
Use UID hashing for meshes and animations.
2025-03-19 11:50:39 +01:00
kobewi
6f25babd6b Remove empty constructors and destructors from editor/ 2025-03-17 21:20:02 +01:00
A Thousand Ships
466590d0ec Use get_slicec instead of get_slice for single character splitters 2025-03-08 20:36:37 +01:00
A Thousand Ships
5113022dfe Clean up some uses of String::substr
Cases where the end position is either equvalent to the default or past
the end of the string.
2025-03-07 14:50:38 +01:00
kobewi
06b2c9f23f Fix save path validation for imported scenes 2025-01-30 23:27:36 +01:00
Rémi Verschelde
21fcb56547 Remove unused EditorSceneFormatImporter::_get_import_flags
This has never been used since Godot was open sourced.

Import flags are used but directly through `_import_scene`.
2025-01-14 16:57:06 +01:00
Saracen
048788f07d Fix scrolling for advanced importer controls. 2025-01-14 11:36:48 +01:00
Lyuma
e4de1f4583 Make EditorSceneFormatImporter::_get_import_options match EditorScenePostImportPlugin API 2025-01-13 21:45:53 +01:00
Aarni Koskela
f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
Rémi Verschelde
a7d84fa022 Merge pull request #100792 from lyuma/post_import_plugin_subresources
Allow post-import plugins to modify `_subresources`
2025-01-08 00:21:03 +01:00
Lyuma
637fe3ccdd Allow post-import plugins to modify _subresources
The old code fetched some data before the `EditorScenePostImportPlugin._pre_process` callback.
While the callback could modify existing keys, this prevented users from adding new data on a fresh import.

By fetching the keys after pre_process, this means users can consistently modify import options for nodes, meshes, materials and animations in a post-import plugin.
2024-12-24 07:34:24 -08:00
A Thousand Ships
a1846b27ea Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
2024-12-23 16:35:02 -05:00
Yufeng Ying
f241c1fda0 Remove unused header in editor.
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-12-24 00:40:38 +08:00
Thaddeus Crews
1c78b09815 Merge pull request #96544 from SaracenOne/import_thumbnails
Generate thumbnails on imported scenes.
2024-11-27 10:47:02 -06:00
Thaddeus Crews
04786f0ee8 Merge pull request #97824 from TokageItLab/retarget-modifier
Add RetargetModifier3D for realtime retarget to keep original rest
2024-11-26 13:04:47 -06:00
Saracen
74611a74d1 Generate editor thumbnails on imported scenes. 2024-11-24 10:23:56 -08:00
Silc Lizard (Tokage) Renew
f5b49af99f Add RetargetModifier3D for realtime retarget to keep original rest 2024-11-18 22:44:55 +09:00
Thaddeus Crews
2ed6d12652 Merge pull request #97363 from reduz/deterministic-gen-suberesources-id
Allow passing UID to importer
2024-11-11 14:18:30 -06:00
Juan
fe34c45d2a Allow passing UID to importer
This helps, for importers spitting out new resources to the res://
filesystem to actually hash them to generate deterministic UIDs.

This PR also fixes the determinism for translations.
2024-11-11 15:22:42 +01:00
Thaddeus Crews
925b690c98 Core: Integrate Ref::instantiate where possible 2024-11-10 12:41:26 -06:00
Aaron Franke
924732772b GLTF: Preserve node visibility on import 2024-11-05 19:06:08 -08:00
Arseny Kapoulkine
260287b3a1 Rewrite index optimization code for maximum efficiency
While all the previous fixes to optimizeVertexCache invocation fixed the
vertex transform efficiency, the import code still was missing two
crucial recommendations from meshoptimizer documentation:

- All meshes should be optimized for vertex cache (this reorders
  vertices for maximum fetch efficiency)
- When LODs are used with a shared vertex buffer, the vertex order
  should be generated by doing a vertex fetch optimization on the
  concatenated index buffer from coarse to fine LODs; this maximizes
  fetch efficiency for coarse LODs

The last point is especially crucial for Mali GPUs; unlike other GPUs
where vertex order affects fetch efficiency but not shading, these GPUs
have various shading quirks (depending on the GPU generation) that
really require consecutive index ranges for each LOD, which requires the
second optimization mentioned above. However all of these also help
desktop GPUs and other mobile GPUs as well.

Because this optimization is "global" in the sense that it affects all
LODs and all vertex arrays in concert, I've taken this opportunity to
isolate all optimization code in this function and pull it out of
generate_lods and create_shadow_mesh; this doesn't change the vertex
cache efficiency, but makes the code cleaner. Consequently,
optimize_indices should be called after other functions like
create_shadow_mesh / generate_lods.

This required exposing meshopt_optimizeVertexFetchRemap; as a drive-by,
meshopt_simplifySloppy was never used so it's not exposed anymore - this
will simplify future meshopt upgrades if they end up changing the
function's interface.
2024-11-04 06:58:06 -08:00
Arseny Kapoulkine
494fe2fe21 LOD: Remove "Raycast Normals" and associated "Normal Split Angle" settings
"Raycast Normals" was introduced in 4.4 dev and defaulted to "false".
The limited testing results at the time suggested that raycasting
generally reduces normal quality compared to native simplifier results,
at the same time increasing vertex memory and import time.

To play it safe, we introduced a setting that defaulted to false, with
the goal of removing it later in 4.4 development cycle if no regressions
are noticed. Since we already had three dev snapshots and no reports,
this change removes the setting and associated code.

"Normal Split Angle" was only used when raycast normals were enabled;
this change removes it from the settings, but keeps it in the script
binding for compatibility.

Existing meshes import exactly the same after this change (unless they
chose to override raycasting which would be surprising).

split_normals helper was only used in this code path and is also removed
for simplicity; it is unlikely that this code will be useful as is, as
it can only regenerate normals without fixing tangents or updating
positions.
2024-10-28 10:14:04 -07:00
Aaron Franke
b0f99099b4 Add "Use Node Type Suffixes" scene import option 2024-09-09 01:12:14 -07:00
A Thousand Ships
194bdde947 Cleanup of raw nullptr checks with Ref
Using `is_valid/null` over checks with `nullptr` or `ERR_FAIL_NULL` etc.
2024-08-31 15:01:09 +02:00
Rémi Verschelde
7f86ca057a Merge pull request #96308 from SaracenOne/attempt_to_reset_imported_scene
Attempt applying RESET pose during import.
2024-08-30 09:59:59 +02:00
Saracen
31253257b3 Attempt applying RESET pose during import. 2024-08-29 22:58:26 +01:00
demolke
c409e6d722 Import/export GLTF extras to node->meta
This is useful for custom tagging of objects with properties (for example in Blender) and having this available in the editor for scripting.

- Adds import logic to propagate the parsed GLTF extras all the way to the resulting Node->meta
- Adds export logic to save Godot Object meta into GLTF extras
- Supports `nodes`, `meshes` and `materials` (in GLTF sense of the words)
2024-08-29 19:17:04 +02:00
Aaron Franke
9dd71c6414 ResourceImporterScene: Replace animation bool with an import type string enum 2024-08-27 14:58:18 -07:00
Saracen
064f471103 Prevent empty post-import script paths throwing errors. 2024-08-26 16:42:39 +01:00
Adam Scott
7e580150f9 Add import tab "import_script/path" relative path support 2024-08-25 12:50:50 -04:00
Arseny Kapoulkine
0fde03c0e0 Optimize base and shadow meshes for cache
Previously, vertex cache optimization was ran for the LOD meshes, but
was never ran for the base mesh or for the shadow meshes, including
shadow LOD chain (shadow LOD chain would sometimes get implicitly
optimized for vertex cache as a byproduct of base LOD optimization, but
not always). This could significantly affect the rendering performance
of geometry heavy scenes, especially for depth or shadow passes where
the fragment load is light.
2024-08-16 07:36:12 -07:00
Rémi Verschelde
e58a7530aa Merge pull request #93727 from zeux/raycast-opt
Disable normal raycaster for LOD generation by default
2024-08-16 10:34:03 +02:00
Rémi Verschelde
9fe4cb6a76 Merge pull request #93284 from rune-scape/missing-import-settings-crash
Avoid crashing when scene import settings are empty
2024-07-31 11:37:34 +02:00
Hilderin
169e732518 Fix missing options in Project Import Defaults 2024-07-09 09:33:39 -04:00
Arseny Kapoulkine
a13a64eacd Disable normal raycaster for LOD generation by default
Normal raycaster makes LOD generation process >2x slower and often
generates normals that look significantly worse compared to what the
simplifier comes up with by default. This was likely different before
last meshoptimizer upgrade, as the attribute metric was not functioning
properly, but now it looks like it's doing more harm than good.

This change makes it disabled by default but keeps an easy option to
re-enable it per mesh using LOD parameters for now until we get more
confidence and can remove the code outright.

Because the long term plan would be to disable this feature entirely,
the scripting API isn't changed, and it's just off-by-default there with
no way to re-enable.
2024-07-02 10:18:15 -07:00
Bastiaan Olij
ab0c974f28 Fix default collision shape on imported rigidbody 2024-06-24 10:16:58 +10:00
tamas
e19f0042ca Retain meta data set on imported nodes
During the import process, many importer nodes are replaced with their
engine node counterparts. For example, ImporterMeshInstance3D is
replaced with a MeshInstance3D node. Any meta data set on these
importer nodes, i.e. through a GLTFDocumentExtension, are lost during
the conversion. This change copies over any meta data set on these
importer nodes to their engine counterparts.
2024-06-18 12:39:34 -05:00
rune-scape
b303e73877 avoid crashing when scene import settings are empty 2024-06-17 18:13:09 -07:00
Rémi Verschelde
782a0261cb Merge pull request #92196 from lyuma/gltf_anim_library_import_as_bones
Support Import As Skeleton Bones on glTF and AnimationLibrary import
2024-05-23 08:59:13 +02:00
Lyuma
c433754d34 fbx: change import option defaults
ufbx has special logic to handle animation/trimming, and most users expect trimming to be on.
For existing projects, we should upgrade files0 to FBX2glTF to preserve node compatibility.
2024-05-21 07:58:36 -07:00