Skip to content
This repository was archived by the owner on May 12, 2025. It is now read-only.

support non standard msaa in bevy 0.15.0 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A tool that tries to do what the html / css tools in the chrome dev tools do.
App::new()
.add_plugins((
DefaultPlugins,
UiInpector,
UiInspectorPlugin::default(),
))
.run()

Expand Down
7 changes: 1 addition & 6 deletions examples/hsl_picker_bevy.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
//! Shows how to render to a texture. Useful for mirrors, UI, or exporting images.

use std::{
any::{Any, TypeId},
f32::consts::PI,
};

use bevy::{color::palettes, prelude::*, window::WindowResolution};
use bevy_ui_inspector::UiInspectorPlugin;

Expand All @@ -17,7 +12,7 @@ fn main() {
}),
..default()
}))
.add_plugins(UiInspectorPlugin)
.add_plugins(UiInspectorPlugin::default())
.add_systems(Startup, setup)
.run();
}
Expand Down
37 changes: 22 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ fn ui_node_hit_test_system(
mouse_button_input: Res<ButtonInput<MouseButton>>,
node_query: Query<
(Entity, &GlobalTransform, &ComputedNode),
(Without<HoverUiElementWrapperMarker>, Without<HoverUiElementMarker>),
(
Without<HoverUiElementWrapperMarker>,
Without<HoverUiElementMarker>,
),
>,
node_q: Query<(&ComputedNode, &GlobalTransform)>,
mut previous_resource: ResMut<RestorePreviousResource>,
Expand Down Expand Up @@ -567,19 +570,8 @@ fn show_hovered_ui(
});
}

fn setup(mut commands: Commands) {
commands.spawn((
Camera2d,
Camera {
clear_color: ClearColorConfig::None,
order: 4,
..default()
},
RenderLayers::layer(10),
Name::new("Plugin camera"),
));
}
pub struct UiInspectorPlugin;
#[derive(Default)]
pub struct UiInspectorPlugin(pub Msaa);
impl Plugin for UiInspectorPlugin {
fn build(&self, app: &mut App) {
if !app.is_plugin_added::<EguiPlugin>() {
Expand All @@ -596,6 +588,21 @@ impl Plugin for UiInspectorPlugin {
app.insert_resource(ActiveStyleInspection::default());
app.insert_resource(PickingUiNode::default());
app.add_systems(Update, (create_ui, ui_node_hit_test_system));
app.add_systems(Startup, (setup));

// TODO: remove once https://github.com/bevyengine/bevy/issues/16590 is fixed
let msaa = self.0;
app.add_systems(Startup, move |mut commands: Commands| {
commands.spawn((
Camera2d,
Camera {
clear_color: ClearColorConfig::None,
order: 4,
..default()
},
RenderLayers::layer(10),
msaa,
Name::new("UiInspectorPlugin camera"),
));
});
}
}