diff --git a/Cargo.toml b/Cargo.toml index e621ce5..bb28302 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,21 @@ enum_dispatch = "0.3.12" ahash = "0.8.7" enumset = "1.1.3" bevy = "0.13" -bevy_math = { version = "0.13", features = ["mint"] } + +bevy_app = { version = "0.13", default-features = false } +bevy_core = { version = "0.13", default-features = false } +bevy_core_pipeline = { version = "0.13", default-features = false } +bevy_reflect = { version = "0.13", default-features = false } +bevy_math = { version = "0.13", features = ["mint"], default-features = false } +bevy_render = { version = "0.13", default-features = false } +bevy_input = { version = "0.13", default-features = false } +bevy_asset = { version = "0.13", default-features = false } +bevy_utils = { version = "0.13", default-features = false } +bevy_pbr = { version = "0.13", default-features = false } +bevy_ecs = { version = "0.13", default-features = false } +bevy_log = { version = "0.13", default-features = false } +bevy_window = { version = "0.13", default-features = false } +bevy_transform = { version = "0.13", default-features = false } [profile.release] opt-level = "s" diff --git a/crates/transform-gizmo-bevy/Cargo.toml b/crates/transform-gizmo-bevy/Cargo.toml index a11383e..aaf4052 100644 --- a/crates/transform-gizmo-bevy/Cargo.toml +++ b/crates/transform-gizmo-bevy/Cargo.toml @@ -21,8 +21,21 @@ include = [ [dependencies] transform-gizmo.workspace = true -bevy.workspace = true + +bevy_app.workspace = true +bevy_core.workspace = true +bevy_core_pipeline.workspace = true +bevy_reflect.workspace = true bevy_math.workspace = true +bevy_render.workspace = true +bevy_input.workspace = true +bevy_asset.workspace = true +bevy_utils.workspace = true +bevy_pbr.workspace = true +bevy_ecs.workspace = true +bevy_log.workspace = true +bevy_window.workspace = true +bevy_transform.workspace = true [lints] -workspace = true +workspace = true \ No newline at end of file diff --git a/crates/transform-gizmo-bevy/src/lib.rs b/crates/transform-gizmo-bevy/src/lib.rs index a404a91..5c5e8c1 100644 --- a/crates/transform-gizmo-bevy/src/lib.rs +++ b/crates/transform-gizmo-bevy/src/lib.rs @@ -28,16 +28,21 @@ //! //! You can either set it up with [`App::insert_resource`] when creating your App, or at any point in a system with [`ResMut`]. -use bevy::prelude::*; -use bevy::utils::{HashMap, Uuid}; -use bevy::window::PrimaryWindow; -use bevy_math::{DQuat, DVec3}; +use bevy_app::prelude::*; +use bevy_asset::{AssetApp, Assets}; +use bevy_ecs::prelude::*; +use bevy_input::prelude::*; +use bevy_math::{DQuat, DVec3, Vec2}; +use bevy_render::prelude::*; +use bevy_transform::prelude::*; +use bevy_utils::{HashMap, Uuid}; +use bevy_window::{PrimaryWindow, Window}; + use render::{DrawDataHandles, TransformGizmoRenderPlugin}; use transform_gizmo::config::{ GizmoModeKind, TransformPivotPoint, DEFAULT_SNAP_ANGLE, DEFAULT_SNAP_DISTANCE, DEFAULT_SNAP_SCALE, }; - pub use transform_gizmo::{ math::{Pos2, Rect}, GizmoConfig, *, @@ -384,7 +389,7 @@ fn update_gizmos( } if active_camera.is_some() { // multiple active cameras found, warn and skip - bevy::log::warn!("Only one camera with a GizmoCamera component is supported."); + bevy_log::warn!("Only one camera with a GizmoCamera component is supported."); return; } active_camera = Some(camera); @@ -482,7 +487,7 @@ fn update_gizmos( let gizmo_result = gizmo.update( gizmo_interaction, - &[transform_gizmo::math::Transform { + &[math::Transform { translation: target_transform.translation.as_dvec3().into(), rotation: target_transform.rotation.as_dquat().into(), scale: target_transform.scale.as_dvec3().into(), @@ -496,7 +501,7 @@ fn update_gizmos( if let Some((_, updated_targets)) = &gizmo_result { let Some(result_transform) = updated_targets.first() else { - bevy::log::warn!("No transform found in GizmoResult!"); + bevy_log::warn!("No transform found in GizmoResult!"); continue; }; @@ -533,7 +538,7 @@ fn update_gizmos( if let Some((_, updated_targets)) = &gizmo_result { let Some(result_transform) = updated_targets.get(i) else { - bevy::log::warn!("No transform {i} found in GizmoResult!"); + bevy_log::warn!("No transform {i} found in GizmoResult!"); continue; }; diff --git a/crates/transform-gizmo-bevy/src/render.rs b/crates/transform-gizmo-bevy/src/render.rs index a80baf4..9c48208 100644 --- a/crates/transform-gizmo-bevy/src/render.rs +++ b/crates/transform-gizmo-bevy/src/render.rs @@ -1,35 +1,38 @@ -use bevy::asset::load_internal_asset; -use bevy::core::cast_slice; -use bevy::core_pipeline::core_3d::{Transparent3d, CORE_3D_DEPTH_FORMAT}; -use bevy::core_pipeline::prepass::{ +use bevy_app::{App, Plugin}; +use bevy_asset::{load_internal_asset, Asset, Handle}; +use bevy_core::cast_slice; +use bevy_core_pipeline::core_3d::{Transparent3d, CORE_3D_DEPTH_FORMAT}; +use bevy_core_pipeline::prepass::{ DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass, }; -use bevy::ecs::query::ROQueryItem; -use bevy::ecs::system::lifetimeless::{Read, SRes}; -use bevy::ecs::system::SystemParamItem; -use bevy::pbr::{MeshPipeline, MeshPipelineKey, SetMeshViewBindGroup}; -use bevy::prelude::*; -use bevy::render::mesh::PrimitiveTopology; -use bevy::render::render_asset::{ +use bevy_ecs::prelude::*; +use bevy_ecs::query::ROQueryItem; +use bevy_ecs::system::lifetimeless::{Read, SRes}; +use bevy_ecs::system::SystemParamItem; +use bevy_pbr::{MeshPipeline, MeshPipelineKey, SetMeshViewBindGroup}; +use bevy_reflect::TypePath; +use bevy_render::mesh::PrimitiveTopology; +use bevy_render::prelude::*; +use bevy_render::render_asset::{ prepare_assets, PrepareAssetError, RenderAsset, RenderAssetPlugin, RenderAssetUsages, RenderAssets, }; -use bevy::render::render_phase::{ +use bevy_render::render_phase::{ AddRenderCommand, DrawFunctions, PhaseItem, RenderCommand, RenderCommandResult, RenderPhase, SetItemPipeline, TrackedRenderPass, }; -use bevy::render::render_resource::{ +use bevy_render::render_resource::{ BlendState, Buffer, BufferInitDescriptor, BufferUsages, ColorTargetState, ColorWrites, CompareFunction, DepthBiasState, DepthStencilState, FragmentState, IndexFormat, MultisampleState, PipelineCache, PrimitiveState, RenderPipelineDescriptor, SpecializedRenderPipeline, SpecializedRenderPipelines, StencilState, TextureFormat, VertexAttribute, VertexBufferLayout, VertexFormat, VertexState, VertexStepMode, }; -use bevy::render::renderer::RenderDevice; -use bevy::render::texture::BevyDefault; -use bevy::render::view::{ExtractedView, RenderLayers, ViewTarget}; -use bevy::render::{Extract, Render, RenderApp, RenderSet}; -use bevy::utils::{HashMap, HashSet, Uuid}; +use bevy_render::renderer::RenderDevice; +use bevy_render::texture::BevyDefault; +use bevy_render::view::{ExtractedView, RenderLayers, ViewTarget}; +use bevy_render::{Extract, Render, RenderApp, RenderSet}; +use bevy_utils::{HashMap, HashSet, Uuid}; const GIZMO_SHADER_HANDLE: Handle = Handle::weak_from_u128(7414812681337026784); @@ -139,6 +142,7 @@ impl RenderAsset for GizmoDrawData { } struct DrawTransformGizmo; + impl RenderCommand

for DrawTransformGizmo { type ViewQuery = (); type ItemQuery = Read>;