Crates.io | bevy_gltf_components |
lib.rs | bevy_gltf_components |
version | 0.6.0 |
source | src |
created_at | 2023-09-28 11:37:43.484684 |
updated_at | 2024-07-18 23:14:58.682394 |
description | Allows you to define Bevy components direclty inside gltf files and instanciate the components on the Bevy side. |
homepage | https://github.com/kaosat-dev/Blender_bevy_components_workflow |
repository | https://github.com/kaosat-dev/Blender_bevy_components_workflow |
max_upload_size | |
id | 985838 |
size | 38,291 |
bevy_gltf_components has been deprecated in favor of its successor Blenvy, part of the Blenvy project. No further development or maintenance will be done for Bevy bevy_gltf_components. See #194 for background.
This crate allows you to define Bevy components direclty inside gltf files and instanciate the components on the Bevy side.
important : the plugin for processing gltf files runs in update , so you cannot use the components directly if you spawn your scene from gltf in setup (the additional components will not show up)
Please see the
bevy_asset_loader
for reliable preloading of files, as this crate does not deal with loading your assets.bevy_gltf_blueprints
crate, built on this crate's features,
that allows you to directly spawn entities from gltf based blueprints.Here's a minimal usage example:
# Cargo.toml
[dependencies]
bevy="0.14"
bevy_gltf_components = { version = "0.6"}
//too barebones of an example to be meaningfull, please see https://github.com/kaosat-dev/Blender_bevy_components_workflow/bevy_gltf_components/examples/basic for a real example
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(ComponentsFromGltfPlugin::default())
.add_system(spawn_level)
.run();
}
fn spawn_level(
asset_server: Res<AssetServer>,
mut commands: bevy::prelude::Commands,
keycode: Res<Input<KeyCode>>,
){
if keycode.just_pressed(KeyCode::Return) {
commands.spawn(SceneBundle {
scene: asset_server.load("basic/models/level1.glb#Scene0"),
transform: Transform::from_xyz(2.0, 0.0, -5.0),
..Default::default()
});
}
}
Add the following to your [dependencies]
section in Cargo.toml
:
bevy_gltf_components = "0.6"
Or use cargo add
:
cargo add bevy_gltf_components
starting with version 0.3, this plugin is configurable Use the default configuration:
ComponentsFromGltfPlugin::default()
Or disable the legacy mode: (enabled by default)
ComponentsFromGltfPlugin{legacy_mode: false}
You need to disable legacy mode if you want to use the bevy_components
Blender addon + the bevy_registry_export crate
!
As it create custom properties that are writen in real ron file format
instead of a simplified version (the one in the legacy mode)
Note: the legacy mode support will be dropped in future versions, and the default behaviour will be NO legacy mode
the ordering of systems is very important !
For example to replace your proxy components (stand-in components when you cannot/ do not want to use real components in the gltf file) with actual ones,
which should happen AFTER the components from the gltf files have been injected,
so bevy_gltf_components
provides a SystemSet for that purpose:GltfComponentsSet
Typically , the order of systems should be
bevy_gltf_components (GltfComponentsSet::Injection) => replace_proxies
If these components are present in your gltf file, they will be handled automatically by this crate, will be ignored otherwise.
The main branch is compatible with the latest Bevy release, while the branch bevy_main
tries to track the main
branch of Bevy (PRs updating the tracked commit are welcome).
Compatibility of bevy_gltf_components
versions:
bevy_gltf_components |
bevy |
---|---|
0.6 |
0.14 |
0.5 |
0.13 |
0.2 - 0.4 |
0.12 |
0.1 |
0.11 |
branch main |
0.13 |
branch bevy_main |
main |
This crate, all its code, contents & assets is Dual-licensed under either of