mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-26 13:32:32 +00:00
Compare commits
2 Commits
d50fb4508d
...
c9229c6884
Author | SHA1 | Date | |
---|---|---|---|
|
c9229c6884 | ||
|
930033354b |
@ -14,12 +14,8 @@ license = "MIT OR Apache-2.0"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", default-features = false, features = [
|
||||
"bevy_asset",
|
||||
"bevy_scene",
|
||||
] }
|
||||
bevy = { version = "0.13", default-features = false, features = ["bevy_scene"] }
|
||||
bevy_gltf_components = { version = "0.5", path = "../bevy_gltf_components" }
|
||||
bevy_gltf_blueprints = { version = "0.10", path = "../bevy_gltf_blueprints", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
bevy = { version = "0.13", default-features = false, features = [
|
||||
|
@ -1,10 +1,9 @@
|
||||
use bevy::{
|
||||
app::{App, Plugin},
|
||||
asset::Handle,
|
||||
ecs::{
|
||||
component::Component,
|
||||
entity::Entity,
|
||||
query::{Or, With},
|
||||
query::With,
|
||||
reflect::ReflectComponent,
|
||||
schedule::{IntoSystemConfigs, IntoSystemSetConfigs, SystemSet},
|
||||
system::{Commands, Query, Res, ResMut, Resource, SystemParam},
|
||||
@ -13,15 +12,12 @@ use bevy::{
|
||||
log::warn,
|
||||
prelude::Update,
|
||||
reflect::{Reflect, TypePath},
|
||||
scene::Scene,
|
||||
scene::SceneInstance,
|
||||
utils::HashMap,
|
||||
};
|
||||
use bevy_gltf_components::GltfComponentsSet;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
#[cfg(feature = "bevy_gltf_blueprints")]
|
||||
use bevy_gltf_blueprints::{BlueprintName, GltfBlueprintsSet};
|
||||
|
||||
/// Plugin for keeping the GltfRefMap in sync.
|
||||
pub struct GltfRefMapPlugin;
|
||||
|
||||
@ -29,16 +25,12 @@ impl Plugin for GltfRefMapPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.register_type::<GltfRefTarget>()
|
||||
.init_resource::<GltfRefMap>()
|
||||
.configure_sets(Update, {
|
||||
let set = (GltfRefsSet::CreateRefMap, GltfRefsSet::ResolveRefs)
|
||||
.configure_sets(
|
||||
Update,
|
||||
(GltfRefsSet::CreateRefMap, GltfRefsSet::ResolveRefs)
|
||||
.chain()
|
||||
.after(GltfComponentsSet::Injection);
|
||||
|
||||
#[cfg(feature = "bevy_gltf_blueprints")]
|
||||
let set = set.after(GltfBlueprintsSet::Spawn);
|
||||
|
||||
set
|
||||
})
|
||||
.after(GltfComponentsSet::Injection),
|
||||
)
|
||||
.add_systems(
|
||||
Update,
|
||||
GltfRefMap::create_ref_map.in_set(GltfRefsSet::CreateRefMap),
|
||||
@ -164,10 +156,7 @@ impl<T: Component + FromGltfRef> Default for GltfRefPlugin<T> {
|
||||
/// SystemParam to find the Gltf that an entity belongs to.
|
||||
#[derive(SystemParam)]
|
||||
pub struct GltfForEntity<'w, 's> {
|
||||
#[cfg(not(feature = "bevy_gltf_blueprints"))]
|
||||
gltfs: Query<'w, 's, (), With<Handle<Scene>>>,
|
||||
#[cfg(feature = "bevy_gltf_blueprints")]
|
||||
gltfs: Query<'w, 's, (), Or<(With<Handle<Scene>>, With<BlueprintName>)>>,
|
||||
gltfs: Query<'w, 's, (), With<SceneInstance>>,
|
||||
hierarchy: Query<'w, 's, &'static Parent>,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user