feat: flatscreen only mode when passing --flatscreen or -f

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2025-06-30 13:13:48 +02:00
parent 3a91ce8158
commit 165dc1d259
5 changed files with 14 additions and 48 deletions

View File

@@ -29,25 +29,7 @@ pub struct LinesNodePlugin;
impl Plugin for LinesNodePlugin {
fn build(&self, app: &mut App) {
app.add_systems(Update, (build_line_mesh/* , update_visibillity */).chain());
}
}
fn update_visibillity(mut cmds: Commands) {
for lines in LINES_REGISTRY.get_valid_contents().into_iter() {
let Some(entity) = lines.entity.get().map(|e| **e) else {
continue;
};
match lines.spatial.node().map(|n| n.enabled()).unwrap_or(false) {
true => {
cmds.entity(entity)
.insert_recursive::<Children>(Visibility::Visible);
}
false => {
cmds.entity(entity)
.insert_recursive::<Children>(Visibility::Hidden);
}
}
app.add_systems(Update, build_line_mesh);
}
}

View File

@@ -33,7 +33,7 @@ impl Plugin for ModelNodePlugin {
PostUpdate,
(
gen_model_parts,
apply_materials, /* , update_visibillity */
apply_materials,
)
.chain(),
);
@@ -43,24 +43,6 @@ impl Plugin for ModelNodePlugin {
#[derive(Component)]
struct ModelNode(Weak<Model>);
fn update_visibillity(mut cmds: Commands) {
for model in MODEL_REGISTRY.get_valid_contents().into_iter() {
let Some(entity) = model.bevy_scene_entity.get() else {
continue;
};
match model.spatial.node().map(|n| n.enabled()).unwrap_or(false) {
true => {
cmds.entity(entity.0)
.insert_recursive::<Children>(Visibility::Visible);
}
false => {
cmds.entity(entity.0)
.insert_recursive::<Children>(Visibility::Hidden);
}
}
}
}
fn load_models(
asset_server: Res<AssetServer>,
mut cmds: Commands,