Skip to content

Commit

Permalink
Only add Unit list if there are unit objects
Browse files Browse the repository at this point in the history
  • Loading branch information
GingerAvalanche committed Aug 16, 2024
1 parent 8e77fb7 commit 72d1604
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/uk-content/src/actor/params/modellist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ impl TryFrom<&ParameterList> for ModelData {

impl From<ModelData> for ParameterList {
fn from(val: ModelData) -> Self {
ParameterList::new()
let data = ParameterList::new()
.with_object(
"Base",
ParameterObject::new().with_parameter("Folder", val.folder.into()),
)
.with_list(
);
if val.units.len() > 0 {
data.with_list(
"Unit",
ParameterList::new().with_objects(val.units.into_iter().enumerate().map(
|(i, (name, bone))| {
Expand All @@ -85,6 +86,9 @@ impl From<ModelData> for ParameterList {
},
)),
)
} else {
data
}
}
}

Expand Down

0 comments on commit 72d1604

Please sign in to comment.