mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-22 23:54:10 +00:00
chore(testing): added example of filtered out components
This commit is contained in:
parent
664e04b05c
commit
7e6805f221
@ -1,12 +1,23 @@
|
||||
use bevy::prelude::*;
|
||||
use std::any::TypeId;
|
||||
|
||||
use bevy::{prelude::*, utils::HashSet};
|
||||
use bevy_gltf_blueprints::*;
|
||||
use bevy_registry_export::*;
|
||||
|
||||
use crate::{ComponentAToFilterOut, ComponentBToFilterOut};
|
||||
|
||||
pub struct CorePlugin;
|
||||
impl Plugin for CorePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins((
|
||||
ExportRegistryPlugin::default(),
|
||||
ExportRegistryPlugin{
|
||||
|
||||
component_filter: SceneFilter::Denylist(HashSet::from([ // this is using Bevy's build in SceneFilter, you can compose what components you want to allow/deny
|
||||
TypeId::of::<ComponentAToFilterOut>(),
|
||||
TypeId::of::<ComponentBToFilterOut>(),
|
||||
// and any other commponent you want to include/exclude
|
||||
])),
|
||||
..Default::default()},
|
||||
BlueprintsPlugin {
|
||||
library_folder: "blueprints".into(),
|
||||
format: GltfFormat::GLB,
|
||||
|
@ -189,6 +189,15 @@ pub struct HashmapTestStringColor {
|
||||
#[reflect(Component)]
|
||||
pub struct HashmapTestStringColorFlat(HashMap<String, Color>);
|
||||
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug)]
|
||||
#[reflect(Component)]
|
||||
pub struct ComponentAToFilterOut;
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug)]
|
||||
#[reflect(Component)]
|
||||
pub struct ComponentBToFilterOut;
|
||||
|
||||
pub struct ComponentsTestPlugin;
|
||||
impl Plugin for ComponentsTestPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
@ -236,6 +245,9 @@ impl Plugin for ComponentsTestPlugin {
|
||||
.register_type::<HashmapTestStringColor>()
|
||||
.register_type::<HashmapTestStringColorFlat>()
|
||||
|
||||
.register_type::<ComponentAToFilterOut>()
|
||||
.register_type::<ComponentBToFilterOut>()
|
||||
|
||||
.add_plugins(MaterialPlugin::<
|
||||
ExtendedMaterial<StandardMaterial, MyExtension>,
|
||||
>::default());
|
||||
|
Loading…
Reference in New Issue
Block a user