use crate::color::Color;
use bevy_math::Vec2;
use std::path::PathBuf;
use strum::{EnumDiscriminants, FromRepr};
#[derive(Debug)]
pub struct Attachment {
pub placeholder_name: String,
pub attachment_name: String,
pub data: AttachmentData,
}
#[derive(Debug, EnumDiscriminants)]
#[strum_discriminants(name(AttachmentType))]
#[strum_discriminants(derive(FromRepr))]
#[strum_discriminants(vis(pub))]
pub enum AttachmentData {
Region(RegionAttachment),
BoundingBox(BoundingBoxAttachment),
Mesh(MeshAttachment),
LinkedMesh(LinkedMeshAttachment),
Path(PathAttachment),
Point(PointAttachment),
Clipping(ClippingAttachment),
}
#[derive(Debug)]
pub struct RegionAttachment {
pub path: Option<PathBuf>,
pub position: Vec2,
pub scale: Vec2,
pub rotation: f32,
pub size: Vec2,
pub color: Color,
}
#[derive(Debug)]
pub struct BoundingBoxAttachment {
pub vertices: Vertices,
pub color: Color,
}
#[derive(Debug)]
pub struct MeshAttachment {
pub path_string: usize,
pub color: Color,
pub uvs: Vec<Vec2>,
pub vertex_index: Vec<usize>,
pub vertices: Vertices,
pub hull_count: usize,
pub edges: Option<Vec<usize>>,
pub size: Option<Vec2>,
}
#[derive(Debug)]
pub struct LinkedMeshAttachment {
pub path: Option<String>,
pub skin: Option<String>,
pub parent: Option<String>,
pub deform: bool,
pub color: Color,
pub size: Option<Vec2>,
}
#[derive(Debug)]
pub struct PathAttachment {
pub closed: bool,
pub constant_speed: bool,
}
#[derive(Debug)]
pub struct PointAttachment {
pub rotation: f32,
pub position: Vec2,
pub color: Option<Color>,
}
#[derive(Debug)]
pub struct ClippingAttachment {
pub end_slot_index: usize,
pub vertices: Vertices,
pub color: Option<Color>,
}
#[derive(Debug)]
pub enum Vertices {
Positions { positions: Vec<Vec2> },
BoneInfluenced { vertices: Vec<Vec<BoneInfluence>> },
}
#[derive(Debug)]
pub struct BoneInfluence {
pub index: usize,
pub position: Vec2,
pub weight: f32,
}