Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix embedded asset path panic #209

Merged
merged 1 commit into from
Mar 26, 2024
Merged
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
18 changes: 15 additions & 3 deletions rmf_site_editor/src/site/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,21 @@ use crate::{shapes::*, site::*};
use bevy::{asset::embedded_asset, math::Affine3A, prelude::*};

pub(crate) fn add_site_icons(app: &mut App) {
embedded_asset!(app, "icons/battery.png");
embedded_asset!(app, "icons/parking.png");
embedded_asset!(app, "icons/stopwatch.png");
// Taken from https://github.com/bevyengine/bevy/issues/10377#issuecomment-1858797002
// TODO(luca) remove once we migrate to Bevy 0.13 that includes the fix
#[cfg(any(not(target_family = "windows"), target_env = "gnu"))]
{
embedded_asset!(app, "src/", "icons/battery.png");
embedded_asset!(app, "src/", "icons/parking.png");
embedded_asset!(app, "src/", "icons/stopwatch.png");
}

#[cfg(all(target_family = "windows", not(target_env = "gnu")))]
{
embedded_asset!(app, "src\\", "icons\\battery.png");
embedded_asset!(app, "src\\", "icons\\parking.png");
embedded_asset!(app, "src\\", "icons\\stopwatch.png");
}
}

#[derive(Resource)]
Expand Down
71 changes: 50 additions & 21 deletions rmf_site_editor/src/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,56 @@ pub struct PendingModel {
pub struct StandardUiLayout;

fn add_widgets_icons(app: &mut App) {
embedded_asset!(app, "icons/add.png");
embedded_asset!(app, "icons/alignment.png");
embedded_asset!(app, "icons/alpha.png");
embedded_asset!(app, "icons/confirm.png");
embedded_asset!(app, "icons/down.png");
embedded_asset!(app, "icons/edit.png");
embedded_asset!(app, "icons/empty.png");
embedded_asset!(app, "icons/exit.png");
embedded_asset!(app, "icons/global.png");
embedded_asset!(app, "icons/hidden.png");
embedded_asset!(app, "icons/hide.png");
embedded_asset!(app, "icons/merge.png");
embedded_asset!(app, "icons/opaque.png");
embedded_asset!(app, "icons/reject.png");
embedded_asset!(app, "icons/search.png");
embedded_asset!(app, "icons/select.png");
embedded_asset!(app, "icons/selected.png");
embedded_asset!(app, "icons/to_bottom.png");
embedded_asset!(app, "icons/to_top.png");
embedded_asset!(app, "icons/trash.png");
embedded_asset!(app, "icons/up.png");
// Taken from https://github.com/bevyengine/bevy/issues/10377#issuecomment-1858797002
// TODO(luca) remove once we migrate to Bevy 0.13 that includes the fix
#[cfg(any(not(target_family = "windows"), target_env = "gnu"))]
{
embedded_asset!(app, "src/", "icons/add.png");
embedded_asset!(app, "src/", "icons/alignment.png");
embedded_asset!(app, "src/", "icons/alpha.png");
embedded_asset!(app, "src/", "icons/confirm.png");
embedded_asset!(app, "src/", "icons/down.png");
embedded_asset!(app, "src/", "icons/edit.png");
embedded_asset!(app, "src/", "icons/empty.png");
embedded_asset!(app, "src/", "icons/exit.png");
embedded_asset!(app, "src/", "icons/global.png");
embedded_asset!(app, "src/", "icons/hidden.png");
embedded_asset!(app, "src/", "icons/hide.png");
embedded_asset!(app, "src/", "icons/merge.png");
embedded_asset!(app, "src/", "icons/opaque.png");
embedded_asset!(app, "src/", "icons/reject.png");
embedded_asset!(app, "src/", "icons/search.png");
embedded_asset!(app, "src/", "icons/select.png");
embedded_asset!(app, "src/", "icons/selected.png");
embedded_asset!(app, "src/", "icons/to_bottom.png");
embedded_asset!(app, "src/", "icons/to_top.png");
embedded_asset!(app, "src/", "icons/trash.png");
embedded_asset!(app, "src/", "icons/up.png");
}
#[cfg(all(target_family = "windows", not(target_env = "gnu")))]
{
embedded_asset!(app, "src\\", "icons\\add.png");
embedded_asset!(app, "src\\", "icons\\alignment.png");
embedded_asset!(app, "src\\", "icons\\alpha.png");
embedded_asset!(app, "src\\", "icons\\confirm.png");
embedded_asset!(app, "src\\", "icons\\down.png");
embedded_asset!(app, "src\\", "icons\\edit.png");
embedded_asset!(app, "src\\", "icons\\empty.png");
embedded_asset!(app, "src\\", "icons\\exit.png");
embedded_asset!(app, "src\\", "icons\\global.png");
embedded_asset!(app, "src\\", "icons\\hidden.png");
embedded_asset!(app, "src\\", "icons\\hide.png");
embedded_asset!(app, "src\\", "icons\\merge.png");
embedded_asset!(app, "src\\", "icons\\opaque.png");
embedded_asset!(app, "src\\", "icons\\reject.png");
embedded_asset!(app, "src\\", "icons\\search.png");
embedded_asset!(app, "src\\", "icons\\select.png");
embedded_asset!(app, "src\\", "icons\\selected.png");
embedded_asset!(app, "src\\", "icons\\to_bottom.png");
embedded_asset!(app, "src\\", "icons\\to_top.png");
embedded_asset!(app, "src\\", "icons\\trash.png");
embedded_asset!(app, "src\\", "icons\\up.png");
}
}

impl Plugin for StandardUiLayout {
Expand Down
Loading