Skip to content

Commit

Permalink
Support metadatagroup in object
Browse files Browse the repository at this point in the history
  • Loading branch information
gyscos committed Sep 12, 2024
1 parent 8e45d0c commit 0a8121d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ pub struct Object {
pub name: Option<String>,
#[serde(rename = "@pid", skip_serializing_if = "Option::is_none")]
pub pid: Option<usize>,
#[serde(rename = "$value")]
pub object: ObjectData,

#[serde(skip_serializing_if = "Option::is_none")]
pub mesh: Option<Mesh>,

#[serde(skip_serializing_if = "Option::is_none")]
pub components: Option<Components>,
}

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum ObjectData {
Mesh(Mesh),
Components { component: Vec<Component> },
pub struct Components {
pub component: Vec<Component>,
}

#[derive(Serialize, Deserialize)]
Expand Down Expand Up @@ -114,7 +116,8 @@ impl From<Mesh> for Model {
partnumber: None,
name: None,
pid: None,
object: ObjectData::Mesh(mesh),
mesh: Some(mesh),
components: None,
};
let resources = Resources {
object: vec![object],
Expand Down

0 comments on commit 0a8121d

Please sign in to comment.