Revert "Nudge users into migrating to new default glTF coordinate conversion (#19816)"
This reverts commit fb2bbb043c
.
This commit is contained in:
parent
33bed5dd70
commit
777e28ef3a
@ -574,11 +574,6 @@ web = ["bevy_internal/web"]
|
|||||||
# Enable hotpatching of Bevy systems
|
# Enable hotpatching of Bevy systems
|
||||||
hotpatching = ["bevy_internal/hotpatching"]
|
hotpatching = ["bevy_internal/hotpatching"]
|
||||||
|
|
||||||
# Enable converting glTF coordinates to Bevy's coordinate system by default. This will be Bevy's default behavior starting in 0.18.
|
|
||||||
gltf_convert_coordinates_default = [
|
|
||||||
"bevy_internal/gltf_convert_coordinates_default",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Enable collecting debug information about systems and components to help with diagnostics
|
# Enable collecting debug information about systems and components to help with diagnostics
|
||||||
debug = ["bevy_internal/debug"]
|
debug = ["bevy_internal/debug"]
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ pbr_multi_layer_material_textures = [
|
|||||||
]
|
]
|
||||||
pbr_anisotropy_texture = ["bevy_pbr/pbr_anisotropy_texture"]
|
pbr_anisotropy_texture = ["bevy_pbr/pbr_anisotropy_texture"]
|
||||||
pbr_specular_textures = ["bevy_pbr/pbr_specular_textures"]
|
pbr_specular_textures = ["bevy_pbr/pbr_specular_textures"]
|
||||||
gltf_convert_coordinates_default = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# bevy
|
# bevy
|
||||||
@ -64,6 +63,8 @@ serde = { version = "1.0", features = ["derive"] }
|
|||||||
serde_json = "1.0.140"
|
serde_json = "1.0.140"
|
||||||
smallvec = { version = "1", default-features = false }
|
smallvec = { version = "1", default-features = false }
|
||||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
bevy_log = { path = "../bevy_log", version = "0.17.0-dev" }
|
bevy_log = { path = "../bevy_log", version = "0.17.0-dev" }
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
|
@ -185,7 +185,7 @@ impl Default for GltfPlugin {
|
|||||||
GltfPlugin {
|
GltfPlugin {
|
||||||
default_sampler: ImageSamplerDescriptor::linear(),
|
default_sampler: ImageSamplerDescriptor::linear(),
|
||||||
custom_vertex_attributes: HashMap::default(),
|
custom_vertex_attributes: HashMap::default(),
|
||||||
convert_coordinates: cfg!(feature = "gltf_convert_coordinates_default"),
|
convert_coordinates: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ mod extensions;
|
|||||||
mod gltf_ext;
|
mod gltf_ext;
|
||||||
|
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use bevy_log::warn_once;
|
|
||||||
use std::{
|
use std::{
|
||||||
io::Error,
|
io::Error,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
@ -298,18 +297,7 @@ async fn load_gltf<'a, 'b, 'c>(
|
|||||||
|
|
||||||
let convert_coordinates = match settings.convert_coordinates {
|
let convert_coordinates = match settings.convert_coordinates {
|
||||||
Some(convert_coordinates) => convert_coordinates,
|
Some(convert_coordinates) => convert_coordinates,
|
||||||
None => {
|
None => loader.default_convert_coordinates,
|
||||||
let convert_by_default = loader.default_convert_coordinates;
|
|
||||||
if !convert_by_default && !cfg!(feature = "gltf_convert_coordinates_default") {
|
|
||||||
warn_once!(
|
|
||||||
"Starting from Bevy 0.18, by default all imported glTF models will be rotated by 180 degrees around the Y axis to align with Bevy's coordinate system. \
|
|
||||||
You are currently importing glTF files using the old behavior. Consider opting-in to the new import behavior by enabling the `gltf_convert_coordinates_default` feature. \
|
|
||||||
If you encounter any issues please file a bug! \
|
|
||||||
If you want to continue using the old behavior going forward (even when the default changes in 0.18), manually set the corresponding option in the `GltfPlugin` or `GltfLoaderSettings`. See the migration guide for more details."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
convert_by_default
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "bevy_animation")]
|
#[cfg(feature = "bevy_animation")]
|
||||||
|
@ -369,10 +369,6 @@ web = [
|
|||||||
|
|
||||||
hotpatching = ["bevy_app/hotpatching", "bevy_ecs/hotpatching"]
|
hotpatching = ["bevy_app/hotpatching", "bevy_ecs/hotpatching"]
|
||||||
|
|
||||||
gltf_convert_coordinates_default = [
|
|
||||||
"bevy_gltf?/gltf_convert_coordinates_default",
|
|
||||||
]
|
|
||||||
|
|
||||||
debug = ["bevy_utils/debug"]
|
debug = ["bevy_utils/debug"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -91,7 +91,6 @@ The default feature set enables most of the expected features of a game engine,
|
|||||||
|ghost_nodes|Experimental support for nodes that are ignored for UI layouting|
|
|ghost_nodes|Experimental support for nodes that are ignored for UI layouting|
|
||||||
|gif|GIF image format support|
|
|gif|GIF image format support|
|
||||||
|glam_assert|Enable assertions to check the validity of parameters passed to glam|
|
|glam_assert|Enable assertions to check the validity of parameters passed to glam|
|
||||||
|gltf_convert_coordinates_default|Enable converting glTF coordinates to Bevy's coordinate system by default. This will be Bevy's default behavior starting in 0.18.|
|
|
||||||
|hotpatching|Enable hotpatching of Bevy systems|
|
|hotpatching|Enable hotpatching of Bevy systems|
|
||||||
|ico|ICO image format support|
|
|ico|ICO image format support|
|
||||||
|jpeg|JPEG image format support|
|
|jpeg|JPEG image format support|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Allow importing glTFs with a corrected coordinate system
|
title: Allow importing glTFs with a corrected coordinate system
|
||||||
authors: ["@janhohenheim"]
|
authors: ["@janhohenheim"]
|
||||||
pull_requests: [19633, 19685, 19816]
|
pull_requests: [19633, 19685]
|
||||||
---
|
---
|
||||||
|
|
||||||
glTF uses the following coordinate system:
|
glTF uses the following coordinate system:
|
||||||
@ -24,27 +24,7 @@ Long-term, we'd like to fix our glTF imports to use the correct coordinate syste
|
|||||||
But changing the import behavior would mean that *all* imported glTFs of *all* users would suddenly look different, breaking their scenes!
|
But changing the import behavior would mean that *all* imported glTFs of *all* users would suddenly look different, breaking their scenes!
|
||||||
Not to mention that any bugs in the conversion code would be incredibly frustating for users.
|
Not to mention that any bugs in the conversion code would be incredibly frustating for users.
|
||||||
|
|
||||||
This is why we are now gradually rolling out support for corrected glTF imports. You will now be greeted by the following warning when using the old behavior:
|
This is why we are now gradually rolling out support for corrected glTF imports. Starting now you can opt into the new behavior by setting `convert_coordinates` on `GltfPlugin`:
|
||||||
|
|
||||||
> Starting from Bevy 0.18, by default all imported glTF models will be rotated by 180 degrees around the Y axis to align with Bevy's coordinate system.
|
|
||||||
> You are currently importing glTF files using the old behavior. Consider opting-in to the new import behavior by enabling the `gltf_convert_coordinates_default` feature.
|
|
||||||
> If you encounter any issues please file a bug!
|
|
||||||
> If you want to continue using the old behavior going forward (even when the default changes in 0.18), manually set the corresponding option in the `GltfPlugin` or `GltfLoaderSettings`.
|
|
||||||
> See the migration guide for more details.
|
|
||||||
|
|
||||||
As the warning says, you can opt into the new behavior by enabling the `gltf_convert_coordinates_default` feature in your `Cargo.toml`:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
# old behavior, ignores glTF's coordinate system
|
|
||||||
[dependencies]
|
|
||||||
bevy = "0.17.0"
|
|
||||||
|
|
||||||
# new behavior, converts the coordinate system of all glTF assets into Bevy's coordinate system
|
|
||||||
[dependencies]
|
|
||||||
bevy = { version = "0.17.0", features = ["gltf_convert_coordinates_default"] }
|
|
||||||
```
|
|
||||||
|
|
||||||
If you prefer, you can also do this in code by setting `convert_coordinates` on `GltfPlugin`:
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// old behavior, ignores glTF's coordinate system
|
// old behavior, ignores glTF's coordinate system
|
||||||
@ -61,9 +41,6 @@ App::new()
|
|||||||
.run();
|
.run();
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to continue using the old behavior in the future, you can silence the warning by enabling the `gltf_convert_coordinates_default` feature
|
|
||||||
and explicitly setting `convert_coordinates: false` on `GltfPlugin`.
|
|
||||||
|
|
||||||
You can also control this on a per-asset-level:
|
You can also control this on a per-asset-level:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
@ -79,7 +56,7 @@ let handle = asset_server.load_with_settings(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
After opting into the new behavior, your scene will be oriented such that your modeling software's forward direction correctly corresponds to Bevy's forward direction.
|
Afterwards, your scene will be oriented such that your modeling software's forward direction correctly corresponds to Bevy's forward direction.
|
||||||
|
|
||||||
For example, Blender assumes -Y to be forward, so exporting the following model to glTF and loading it in Bevy with the new settings will ensure everything is
|
For example, Blender assumes -Y to be forward, so exporting the following model to glTF and loading it in Bevy with the new settings will ensure everything is
|
||||||
oriented the right way across all programs in your pipeline:
|
oriented the right way across all programs in your pipeline:
|
Loading…
Reference in New Issue
Block a user