From bd2444ab40fb8e5c12f8344270e367522d6d865b Mon Sep 17 00:00:00 2001 From: "Victor A." <52110451+cs50victor@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:09:30 -0500 Subject: [PATCH] chore: lint --- crates/bevy_headless/src/lib.rs | 6 +++--- crates/bevy_headless/src/plugin.rs | 22 +++++++++++++--------- crates/bevy_headless/src/utils.rs | 6 ++---- examples/new_media/src/main.rs | 3 +-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/crates/bevy_headless/src/lib.rs b/crates/bevy_headless/src/lib.rs index a91fa62..7808132 100644 --- a/crates/bevy_headless/src/lib.rs +++ b/crates/bevy_headless/src/lib.rs @@ -4,8 +4,8 @@ mod plugin; mod utils; pub use plugin::{ - GpuImageExportSource, ImageExportBundle, ImageExportPlugin, ImageExportSettings, - ImageExportSource, ImageExportSystems, CurrImageContainer + CurrImageContainer, GpuImageExportSource, ImageExportBundle, ImageExportPlugin, + ImageExportSettings, ImageExportSource, ImageExportSystems, }; -pub use utils::{setup_render_target,SceneInfo}; +pub use utils::{setup_render_target, SceneInfo}; diff --git a/crates/bevy_headless/src/plugin.rs b/crates/bevy_headless/src/plugin.rs index 9e33987..c189df6 100644 --- a/crates/bevy_headless/src/plugin.rs +++ b/crates/bevy_headless/src/plugin.rs @@ -2,13 +2,20 @@ use std::sync::Arc; use crate::{ node::{ImageExportNode, NODE_NAME}, - utils::{CurrImage}, + utils::CurrImage, }; use bevy::{ app::{App, Plugin, PluginGroup, PostUpdate}, asset::{Asset, AssetApp, Handle}, ecs::{ - bundle::Bundle, component::Component, entity::Entity, query::{QueryItem, With, Without}, schedule::{apply_deferred, IntoSystemConfigs, IntoSystemSetConfigs, SystemSet}, system::{lifetimeless::SRes, Commands, Local, Query, Res, ResMut, Resource, SystemParamItem}, world::Mut + bundle::Bundle, + component::Component, + entity::Entity, + query::{QueryItem, With, Without}, + schedule::{apply_deferred, IntoSystemConfigs, IntoSystemSetConfigs, SystemSet}, + system::{ + lifetimeless::SRes, Commands, Local, Query, Res, ResMut, Resource, SystemParamItem, + }, }, log::LogPlugin, reflect::{Reflect, TypeUuid}, @@ -237,7 +244,6 @@ fn capture_img_bytes( // }else{ // log::info!("Curr Image Resource still doesn't exist"); // } - }, None => { log::error!("Failed creating image buffer for frame - '{frame_id}'"); @@ -268,11 +274,11 @@ impl Plugin for ImageExportPlugin { .disable::(), ); - // TODO: + // TODO: let curr_image_container = CurrImageContainer::default(); app.insert_resource(curr_image_container.clone()); - + app.configure_sets( PostUpdate, (SetupImageExport, SetupImageExportFlush).chain().before(CameraUpdateSystem), @@ -293,7 +299,7 @@ impl Plugin for ImageExportPlugin { ); let render_app = app.sub_app_mut(RenderApp); - + render_app.insert_resource(curr_image_container); render_app.add_systems( @@ -305,10 +311,8 @@ impl Plugin for ImageExportPlugin { graph.add_node(NODE_NAME, ImageExportNode); graph.add_node_edge(CAMERA_DRIVER, NODE_NAME); - - } } #[derive(Clone, Default, Resource)] -pub struct CurrImageContainer(pub Arc>); \ No newline at end of file +pub struct CurrImageContainer(pub Arc>); diff --git a/crates/bevy_headless/src/utils.rs b/crates/bevy_headless/src/utils.rs index 5a88af0..c8cba58 100644 --- a/crates/bevy_headless/src/utils.rs +++ b/crates/bevy_headless/src/utils.rs @@ -12,15 +12,14 @@ use bevy::{ texture::Image, }, }; -use std::{default, io::Cursor, ops::Deref}; +use std::{io::Cursor, ops::Deref}; use base64::{engine::general_purpose, Engine}; use image::{EncodableLayout, ImageBuffer, ImageOutputFormat, Pixel, Rgba, RgbaImage}; use crate::{ImageExportBundle, ImageExportSource}; - -#[derive(Default,Resource)] +#[derive(Default, Resource)] pub struct CurrImage { pub img_buffer: ImageBuffer, Vec>, pub frame_id: u64, @@ -60,7 +59,6 @@ impl CurrImage { pub fn to_web_base64(&self) -> anyhow::Result { base64_browser_img(&self.img_buffer) } - } #[derive(Debug, Default, Resource, Event)] diff --git a/examples/new_media/src/main.rs b/examples/new_media/src/main.rs index 4b7ddea..83c10c7 100644 --- a/examples/new_media/src/main.rs +++ b/examples/new_media/src/main.rs @@ -25,7 +25,7 @@ use server::{receive_message, start_ws}; fn setup_gaussian_cloud( mut commands: Commands, asset_server: Res, - mut gaussian_assets: ResMut>, + _gaussian_assets: ResMut>, mut scene_controller: ResMut, mut images: ResMut>, export_sources: ResMut>, @@ -107,4 +107,3 @@ fn move_camera(mut camera: Query<&mut Transform, With>) { transform.translation.z += speed; } } -