mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 11:50:53 +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 bevy::asset::{AssetEvent, UntypedAssetId};
|
||||
use crate::{BlueprintAssetsLoadState, BlueprintAssetsLoaded, BlueprintInfo, BlueprintInstanceReady, BlueprintSpawning, SpawnBlueprint, SubBlueprintsSpawnTracker};
|
||||
use bevy::asset::AssetEvent;
|
||||
use bevy::prelude::*;
|
||||
use bevy::scene::SceneInstance;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -53,10 +53,7 @@ pub(crate) fn inject_materials(
|
||||
material_found = Some(material);
|
||||
} else {
|
||||
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!(
|
||||
"materials file {} should have been preloaded",
|
||||
material_info.path
|
||||
));
|
||||
let mat_gltf = assets_gltf.get(model_handle.id()).unwrap_or_else(|| panic!("materials file {} should have been preloaded", material_info.path));
|
||||
if mat_gltf
|
||||
.named_materials
|
||||
.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 {
|
||||
// println!("hot reload ? {}", watching_for_changes.0);
|
||||
return watching_for_changes.0
|
||||
watching_for_changes.0
|
||||
}
|
||||
|
||||
trait BlenvyApp {
|
||||
|
@ -169,12 +169,12 @@ pub(crate) fn blueprints_prepare_spawn(
|
||||
let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();
|
||||
for scene in gltf.scenes() {
|
||||
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") {
|
||||
let assets_raw = &lookup["BlueprintAssets"];
|
||||
//println!("ASSETS RAW {}", assets_raw);
|
||||
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);
|
||||
|
||||
for asset in all_assets.assets.iter() {
|
||||
@ -250,12 +250,8 @@ pub(crate) fn blueprints_check_assets_loading(
|
||||
let asset_id = tracker.id;
|
||||
let loaded = asset_server.is_loaded_with_dependencies(asset_id);
|
||||
|
||||
// FIXME: hack for now
|
||||
let mut failed = false; // asset_server.load_state(asset_id) == bevy::asset::LoadState::Failed(_error);
|
||||
match asset_server.load_state(asset_id) {
|
||||
bevy::asset::LoadState::Failed(_) => failed = true,
|
||||
_ => {}
|
||||
}
|
||||
let mut failed = false;
|
||||
if let bevy::asset::LoadState::Failed(_) = asset_server.load_state(asset_id) { failed = true }
|
||||
tracker.loaded = loaded || failed;
|
||||
if loaded || failed {
|
||||
loaded_amount += 1;
|
||||
@ -543,7 +539,7 @@ pub struct BlueprintReadyForPostProcess;
|
||||
/// - 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 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(
|
||||
blueprint_scenes: Query<
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user