mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-26 13:32:32 +00:00
chore(Blenvy:Bevy): clippy fixes
This commit is contained in:
parent
3380f4c71d
commit
e394edade2
@ -1,5 +1,5 @@
|
|||||||
use crate::{BlueprintAssetsLoadState, BlueprintAssetsLoaded, BlueprintChildrenReady, BlueprintInfo, BlueprintInstanceReady, BlueprintSpawning, InBlueprint, SpawnBlueprint, SubBlueprintsSpawnTracker};
|
use crate::{BlueprintAssetsLoadState, BlueprintAssetsLoaded, BlueprintInfo, BlueprintInstanceReady, BlueprintSpawning, SpawnBlueprint, SubBlueprintsSpawnTracker};
|
||||||
use bevy::asset::{AssetEvent, UntypedAssetId};
|
use bevy::asset::AssetEvent;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy::scene::SceneInstance;
|
use bevy::scene::SceneInstance;
|
||||||
use bevy::utils::hashbrown::HashMap;
|
use bevy::utils::hashbrown::HashMap;
|
||||||
@ -75,7 +75,7 @@ pub(crate) fn react_to_asset_changes(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ! retained_candidates.contains(&entity) {
|
if ! retained_candidates.contains(entity) {
|
||||||
retained_candidates.push(**entity);
|
retained_candidates.push(**entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,7 @@ pub(crate) fn inject_materials(
|
|||||||
material_found = Some(material);
|
material_found = Some(material);
|
||||||
} else {
|
} else {
|
||||||
let model_handle: Handle<Gltf> = asset_server.load(material_info.path.clone()); // FIXME: kinda weird now
|
let model_handle: Handle<Gltf> = asset_server.load(material_info.path.clone()); // FIXME: kinda weird now
|
||||||
let mat_gltf = assets_gltf.get(model_handle.id()).expect(&format!(
|
let mat_gltf = assets_gltf.get(model_handle.id()).unwrap_or_else(|| panic!("materials file {} should have been preloaded", material_info.path));
|
||||||
"materials file {} should have been preloaded",
|
|
||||||
material_info.path
|
|
||||||
));
|
|
||||||
if mat_gltf
|
if mat_gltf
|
||||||
.named_materials
|
.named_materials
|
||||||
.contains_key(&material_info.name as &str)
|
.contains_key(&material_info.name as &str)
|
||||||
|
@ -66,7 +66,7 @@ fn aabbs_enabled(blenvy_config: Res<BlenvyConfig>) -> bool {
|
|||||||
|
|
||||||
fn hot_reload(watching_for_changes: Res<WatchingForChanges>) -> bool {
|
fn hot_reload(watching_for_changes: Res<WatchingForChanges>) -> bool {
|
||||||
// println!("hot reload ? {}", watching_for_changes.0);
|
// println!("hot reload ? {}", watching_for_changes.0);
|
||||||
return watching_for_changes.0
|
watching_for_changes.0
|
||||||
}
|
}
|
||||||
|
|
||||||
trait BlenvyApp {
|
trait BlenvyApp {
|
||||||
|
@ -169,12 +169,12 @@ pub(crate) fn blueprints_prepare_spawn(
|
|||||||
let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();
|
let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();
|
||||||
for scene in gltf.scenes() {
|
for scene in gltf.scenes() {
|
||||||
let scene_extras = scene.extras().clone().unwrap();
|
let scene_extras = scene.extras().clone().unwrap();
|
||||||
let lookup: HashMap<String, Value> = serde_json::from_str(&scene_extras.get()).unwrap();
|
let lookup: HashMap<String, Value> = serde_json::from_str(scene_extras.get()).unwrap();
|
||||||
if lookup.contains_key("BlueprintAssets") {
|
if lookup.contains_key("BlueprintAssets") {
|
||||||
let assets_raw = &lookup["BlueprintAssets"];
|
let assets_raw = &lookup["BlueprintAssets"];
|
||||||
//println!("ASSETS RAW {}", assets_raw);
|
//println!("ASSETS RAW {}", assets_raw);
|
||||||
let all_assets: BlueprintAssets =
|
let all_assets: BlueprintAssets =
|
||||||
ron::from_str(&assets_raw.as_str().unwrap()).unwrap();
|
ron::from_str(assets_raw.as_str().unwrap()).unwrap();
|
||||||
// println!("all_assets {:?}", all_assets);
|
// println!("all_assets {:?}", all_assets);
|
||||||
|
|
||||||
for asset in all_assets.assets.iter() {
|
for asset in all_assets.assets.iter() {
|
||||||
@ -250,12 +250,8 @@ pub(crate) fn blueprints_check_assets_loading(
|
|||||||
let asset_id = tracker.id;
|
let asset_id = tracker.id;
|
||||||
let loaded = asset_server.is_loaded_with_dependencies(asset_id);
|
let loaded = asset_server.is_loaded_with_dependencies(asset_id);
|
||||||
|
|
||||||
// FIXME: hack for now
|
let mut failed = false;
|
||||||
let mut failed = false; // asset_server.load_state(asset_id) == bevy::asset::LoadState::Failed(_error);
|
if let bevy::asset::LoadState::Failed(_) = asset_server.load_state(asset_id) { failed = true }
|
||||||
match asset_server.load_state(asset_id) {
|
|
||||||
bevy::asset::LoadState::Failed(_) => failed = true,
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
tracker.loaded = loaded || failed;
|
tracker.loaded = loaded || failed;
|
||||||
if loaded || failed {
|
if loaded || failed {
|
||||||
loaded_amount += 1;
|
loaded_amount += 1;
|
||||||
@ -543,7 +539,7 @@ pub struct BlueprintReadyForPostProcess;
|
|||||||
/// - it removes one level of useless nesting
|
/// - it removes one level of useless nesting
|
||||||
/// - it copies the blueprint's root components to the entity it was spawned on (original entity)
|
/// - it copies the blueprint's root components to the entity it was spawned on (original entity)
|
||||||
/// - it copies the children of the blueprint scene into the original entity
|
/// - it copies the children of the blueprint scene into the original entity
|
||||||
/// - it adds an `AnimationLink` component containing the entity that has the AnimationPlayer so that animations can be controlled from the original entity
|
/// - it adds an `AnimationLink` component containing the entity that has the `AnimationPlayer` so that animations can be controlled from the original entity
|
||||||
pub(crate) fn blueprints_cleanup_spawned_scene(
|
pub(crate) fn blueprints_cleanup_spawned_scene(
|
||||||
blueprint_scenes: Query<
|
blueprint_scenes: Query<
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user