Skip to content

Commit

Permalink
Enable use of ExtractResource derive macro within bevy_render itself
Browse files Browse the repository at this point in the history
  • Loading branch information
superdump committed Mar 28, 2022
1 parent 29a5535 commit 16cf4e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 4 additions & 1 deletion crates/bevy_render/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use bevy_macro_utils::BevyManifest;
use proc_macro::TokenStream;

pub(crate) fn bevy_render_path() -> syn::Path {
BevyManifest::default().get_path("bevy_render")
BevyManifest::default()
.maybe_get_path("bevy_render")
// NOTE: If the derivation is within bevy_render, then we need to return 'crate'
.unwrap_or_else(|| BevyManifest::parse_str("crate"))
}

#[proc_macro_derive(ExtractResource)]
Expand Down
8 changes: 1 addition & 7 deletions crates/bevy_render/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Plugin for ViewPlugin {
}
}

#[derive(Clone)]
#[derive(Clone, ExtractResource)]
/// Configuration resource for [Multi-Sample Anti-Aliasing](https://en.wikipedia.org/wiki/Multisample_anti-aliasing).
///
/// # Example
Expand Down Expand Up @@ -72,12 +72,6 @@ impl Default for Msaa {
}
}

impl ExtractResource for Msaa {
fn extract_resource(res: &Self) -> Self {
res.clone()
}
}

#[derive(Component)]
pub struct ExtractedView {
pub projection: Mat4,
Expand Down

0 comments on commit 16cf4e7

Please sign in to comment.