parent
3b75fed684
commit
7621db220e
@ -1,105 +0,0 @@
|
|||||||
(
|
|
||||||
resources: {},
|
|
||||||
entities: {
|
|
||||||
1: (
|
|
||||||
components: {
|
|
||||||
"bevy_render::view::visibility::Visibility": Inherited,
|
|
||||||
"bevy_transform::components::transform::Transform": (
|
|
||||||
translation: (
|
|
||||||
x: 0.0,
|
|
||||||
y: 0.0,
|
|
||||||
z: 0.0,
|
|
||||||
),
|
|
||||||
rotation: (0.0, 0.0, 0.0, 1.0),
|
|
||||||
scale: (
|
|
||||||
x: 1.0,
|
|
||||||
y: 1.0,
|
|
||||||
z: 1.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
"bevy_transform::components::global_transform::GlobalTransform": ((
|
|
||||||
matrix3: (
|
|
||||||
x_axis: (
|
|
||||||
x: 1.0,
|
|
||||||
y: 0.0,
|
|
||||||
z: 0.0,
|
|
||||||
),
|
|
||||||
y_axis: (
|
|
||||||
x: 0.0,
|
|
||||||
y: 1.0,
|
|
||||||
z: 0.0,
|
|
||||||
),
|
|
||||||
z_axis: (
|
|
||||||
x: 0.0,
|
|
||||||
y: 0.0,
|
|
||||||
z: 1.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
translation: (
|
|
||||||
x: 0.0,
|
|
||||||
y: 0.0,
|
|
||||||
z: 0.0,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
"editor::LevelRoot": (),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
2: (
|
|
||||||
components: {
|
|
||||||
"editor::AudioRoot": (),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
191: (
|
|
||||||
components: {
|
|
||||||
"bevy_asset::handle::Handle<bevy_audio::audio_source::AudioSource>": (
|
|
||||||
id: AssetPathId(((3014684909402542266), (8823233378563626002))),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
200: (
|
|
||||||
components: {
|
|
||||||
"bevy_render::view::visibility::Visibility": Inherited,
|
|
||||||
"bevy_transform::components::transform::Transform": (
|
|
||||||
translation: (
|
|
||||||
x: 0.0,
|
|
||||||
y: 0.0,
|
|
||||||
z: 0.0,
|
|
||||||
),
|
|
||||||
rotation: (0.0, 0.0, 0.0, 1.0),
|
|
||||||
scale: (
|
|
||||||
x: 1.0,
|
|
||||||
y: 1.0,
|
|
||||||
z: 1.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
"bevy_transform::components::global_transform::GlobalTransform": ((
|
|
||||||
matrix3: (
|
|
||||||
x_axis: (
|
|
||||||
x: 1.0,
|
|
||||||
y: 0.0,
|
|
||||||
z: 0.0,
|
|
||||||
),
|
|
||||||
y_axis: (
|
|
||||||
x: 0.0,
|
|
||||||
y: 1.0,
|
|
||||||
z: 0.0,
|
|
||||||
),
|
|
||||||
z_axis: (
|
|
||||||
x: 0.0,
|
|
||||||
y: 0.0,
|
|
||||||
z: 1.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
translation: (
|
|
||||||
x: 0.0,
|
|
||||||
y: 0.0,
|
|
||||||
z: 0.0,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
"bevy_asset::handle::Handle<bevy_scene::scene::Scene>": (
|
|
||||||
id: AssetPathId(((13241355290950327508), (2370051114748836591))),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
use crate::editor::prelude::*;
|
|
||||||
|
|
||||||
// This sets buttons to active when their associated handle is spawned
|
|
||||||
pub fn sync_asset_buttons<T: Asset>(
|
|
||||||
events: Query<&Handle<T>, Added<Handle<T>>>,
|
|
||||||
buttons: Query<(Entity, &ui::TargetAsset<T>)>,
|
|
||||||
mut commands: Commands,
|
|
||||||
) {
|
|
||||||
events.iter().for_each(|this_handle| {
|
|
||||||
info!("Syncing {:?}", this_handle);
|
|
||||||
buttons
|
|
||||||
.iter()
|
|
||||||
.find_map(|(entity, ui::TargetAsset { handle })| {
|
|
||||||
if handle == this_handle {
|
|
||||||
Some(entity)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.iter()
|
|
||||||
.for_each(|&entity| {
|
|
||||||
commands.entity(entity).insert(ui::Active);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove active when handle is despawned?
|
|
||||||
// ONLY IF there are no instances of that handle [!any(*)]
|
|
||||||
pub fn sync_remove_asset_buttons<T: Asset>(
|
|
||||||
mut events: RemovedComponents<Handle<T>>,
|
|
||||||
asset_entities: Query<&Handle<T>>,
|
|
||||||
buttons: Query<(Entity, &ui::TargetAsset<T>)>,
|
|
||||||
mut commands: Commands,
|
|
||||||
) {
|
|
||||||
events
|
|
||||||
.iter()
|
|
||||||
.find_map(|this_asset_entity| asset_entities.get(this_asset_entity).ok())
|
|
||||||
.iter()
|
|
||||||
.for_each(|this_handle| {
|
|
||||||
info!("Syncing removal of {:?}", this_handle);
|
|
||||||
buttons
|
|
||||||
.iter()
|
|
||||||
.find_map(|(entity, ui::TargetAsset { handle })| {
|
|
||||||
if handle == *this_handle {
|
|
||||||
Some(entity)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.iter()
|
|
||||||
.for_each(|&entity| {
|
|
||||||
commands.entity(entity).remove::<ui::Active>();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
use crate::editor::prelude::*;
|
||||||
|
|
||||||
|
#[derive(Debug, Default)]
|
||||||
|
pub struct EditorPlugin;
|
||||||
|
|
||||||
|
impl Plugin for EditorPlugin {
|
||||||
|
fn build(&self, app: &mut App) {
|
||||||
|
app.add_plugins(EditorAssetsPlugin::default())
|
||||||
|
.add_plugins(EditorAnimationPlugin::default())
|
||||||
|
.add_plugins(EditorAudioPlugin::default())
|
||||||
|
.add_plugins(EditorCameraPlugin::default())
|
||||||
|
.add_plugins(EditorFontPlugin::default())
|
||||||
|
.add_plugins(EditorGltfPlugin::default())
|
||||||
|
.add_plugins(EditorLevelPlugin::default())
|
||||||
|
.add_plugins(EditorLightingPlugin::default())
|
||||||
|
.add_plugins(EditorMonologuePlugin::default())
|
||||||
|
.add_plugins(EditorQuitPlugin::default())
|
||||||
|
.add_plugins(EditorScenePlugin::default())
|
||||||
|
.add_plugins(EditorTimelinePlugin::default())
|
||||||
|
.add_systems(Startup, initialize_ui)
|
||||||
|
.add_systems(Startup, init_texts_ui)
|
||||||
|
.add_systems(Startup, welcome_message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,69 +0,0 @@
|
|||||||
use crate::editor::prelude::*;
|
|
||||||
|
|
||||||
#[derive(Debug, Component)]
|
|
||||||
pub struct ClearLevel;
|
|
||||||
|
|
||||||
pub fn clear_level(
|
|
||||||
events: Query<Entity, (With<ClearLevel>, Added<ui::Active>)>,
|
|
||||||
actives: Query<
|
|
||||||
Entity,
|
|
||||||
(
|
|
||||||
With<ui::Active>,
|
|
||||||
Or<(
|
|
||||||
With<ui::TargetEntity>,
|
|
||||||
With<ui::TargetAsset<Gltf>>,
|
|
||||||
With<ui::TargetAsset<Scene>>,
|
|
||||||
With<ui::TargetAsset<AnimationClip>>,
|
|
||||||
With<ui::TargetAsset<AudioSource>>,
|
|
||||||
With<ui::TargetAsset<Monologue>>,
|
|
||||||
With<ui::TargetAsset<Font>>,
|
|
||||||
)>,
|
|
||||||
),
|
|
||||||
>,
|
|
||||||
root: Query<Entity, With<LevelRoot>>,
|
|
||||||
mut commands: Commands,
|
|
||||||
) {
|
|
||||||
events.iter().for_each(|_| {
|
|
||||||
actives.iter().for_each(|entity| {
|
|
||||||
commands.entity(entity).remove::<ui::Active>();
|
|
||||||
});
|
|
||||||
root.iter().for_each(|entity| {
|
|
||||||
commands.entity(entity).despawn_descendants();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Component)]
|
|
||||||
pub struct ClearAssets;
|
|
||||||
|
|
||||||
pub fn clear_assets(
|
|
||||||
asset_holders: Query<
|
|
||||||
Entity,
|
|
||||||
Or<(
|
|
||||||
With<ui::TargetAsset<Gltf>>,
|
|
||||||
With<Handle<Gltf>>,
|
|
||||||
With<ui::TargetAsset<Scene>>,
|
|
||||||
With<Handle<Scene>>,
|
|
||||||
With<ui::TargetAsset<AnimationClip>>,
|
|
||||||
With<Handle<AnimationClip>>,
|
|
||||||
With<ui::TargetAsset<AudioSource>>,
|
|
||||||
With<Handle<AudioSource>>,
|
|
||||||
With<ui::TargetAsset<Monologue>>,
|
|
||||||
With<Handle<Monologue>>,
|
|
||||||
With<ui::TargetAsset<Font>>,
|
|
||||||
With<Handle<Font>>,
|
|
||||||
)>,
|
|
||||||
>,
|
|
||||||
mut registry: ResMut<AssetRegistry>,
|
|
||||||
mut commands: Commands,
|
|
||||||
) {
|
|
||||||
info!("Clearing assets");
|
|
||||||
|
|
||||||
// Clear buttons holding asset references
|
|
||||||
asset_holders
|
|
||||||
.iter()
|
|
||||||
.for_each(|entity| commands.entity(entity).despawn_recursive());
|
|
||||||
|
|
||||||
// Empty asset registry
|
|
||||||
registry.0.clear();
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue