Skip to content

Commit

Permalink
use pseudoregalia fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bananaturtlesandwich committed Aug 2, 2023
1 parent 4405d3e commit 7b4b1ac
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ authors = ["spuds"]
repository = "https://github.com/bananaturtlesandwich/stove"
description = "an editor for cooked unreal engine 4 map files"
readme = "README.md"
version = "0.9.1"
version = "0.9.2"
edition = "2021"

[dependencies]
unreal_asset = { git = "https://github.com/astrotechies/unrealmodding", package = "unreal_asset", rev = "b1d5553" }
unreal_asset = { git = "https://github.com/astrotechies/unrealmodding", package = "unreal_asset", rev = "91054ff" }
unpak = { version = "1.0", features = ["asset-paths"] }
glam = { version = "0.23", features = ["fast-math"] }
miniquad = "0.3"
Expand Down
51 changes: 36 additions & 15 deletions src/actor/ui.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use unreal_asset::{
exports::{Export, ExportBaseTrait, ExportNormalTrait},
properties::{array_property::ArrayProperty, Property, PropertyDataTrait},
properties::{
array_property::ArrayProperty, soft_path_property::SoftObjectPathPropertyValue, Property,
PropertyDataTrait,
},
types::fname::{FName, ToSerializedName},
Asset,
};
Expand Down Expand Up @@ -98,11 +101,22 @@ macro_rules! show_sampler {

macro_rules! show_path {
($ui:ident, $val:expr) => {
fname_edit(
$ui,
&mut $val.asset_path_name.get_or_insert(FName::from_slice("")),
) | text_edit($ui, $val.sub_path.get_or_insert(String::new()))
| text_edit($ui, $val.path.get_or_insert(String::new()))
match &mut $val.value {
SoftObjectPathPropertyValue::Old(path) => {
text_edit($ui, path.get_or_insert_with(|| String::new()))
}
SoftObjectPathPropertyValue::New(path) => {
text_edit(
$ui,
path.sub_path_string.get_or_insert_with(|| String::new()),
) | fname_edit(
$ui,
path.asset_path
.package_name
.get_or_insert_with(|| FName::from_slice("")),
) | fname_edit($ui, &mut path.asset_path.asset_name)
}
}
};
}

Expand Down Expand Up @@ -186,32 +200,39 @@ fn show_property(ui: &mut egui::Ui, prop: &mut Property) {
drag(ui, byte)
}
unreal_asset::properties::int_property::BytePropertyValue::FName(name) => {
fname_edit(ui, byte.enum_type.get_or_insert(FName::from_slice("")))
| fname_edit(ui, name)
fname_edit(
ui,
byte.enum_type.get_or_insert_with(|| FName::from_slice("")),
) | fname_edit(ui, name)
}
},
Property::DoubleProperty(double) => drag(ui, &mut double.value.0),
Property::NameProperty(name) => fname_edit(ui, &mut name.value),
Property::StrProperty(str) => {
text_edit(ui, str.value.get_or_insert(String::new()))
text_edit(ui, str.value.get_or_insert_with(|| String::new()))
}
Property::TextProperty(txt) => text_edit(
ui,
txt.culture_invariant_string.get_or_insert(String::new()),
txt.culture_invariant_string
.get_or_insert_with(|| String::new()),
),
Property::ObjectProperty(obj) => ui.link(obj.value.index.to_string()),
Property::AssetObjectProperty(obj) => {
text_edit(ui, obj.value.get_or_insert(String::new()))
text_edit(ui, obj.value.get_or_insert_with(|| String::new()))
}
Property::SoftObjectProperty(obj) => {
text_edit(ui, obj.value.sub_path_string.get_or_insert(String::new()))
| fname_edit(ui, &mut obj.value.asset_path.asset_name)
text_edit(
ui,
obj.value
.sub_path_string
.get_or_insert_with(|| String::new()),
) | fname_edit(ui, &mut obj.value.asset_path.asset_name)
| fname_edit(
ui,
obj.value
.asset_path
.package_name
.get_or_insert(FName::from_slice("")),
.get_or_insert_with(|| FName::from_slice("")),
)
}
Property::IntPointProperty(point) => {
Expand Down Expand Up @@ -333,7 +354,7 @@ fn show_property(ui: &mut egui::Ui, prop: &mut Property) {
.response
}),
Property::EnumProperty(enm) => {
fname_edit(ui, enm.value.get_or_insert(FName::from_slice("")))
fname_edit(ui, enm.value.get_or_insert_with(|| FName::from_slice("")))
}
// Property::UnknownProperty(unknown) => todo!(),
_ => ui.link("unimplemented"),
Expand Down
1 change: 1 addition & 0 deletions src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub fn open(file: impl AsRef<Path>, version: EngineVersion) -> Result<Asset<File
File::open(&file)?,
File::open(file.as_ref().with_extension("uexp")).ok(),
version,
None,
)
}

Expand Down
1 change: 1 addition & 0 deletions src/extras/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ fn parse_mesh() -> Result<(), unreal_asset::error::Error> {
include_bytes!("A02_Outside_Castle.uexp").as_slice(),
)),
EngineVersion::VER_UE4_25,
None,
)?)?;
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ impl Stove {
std::io::Cursor::new(mesh),
pak.get(&bulk).ok().map(std::io::Cursor::new),
self.version(),
None
) else {
continue;
};
Expand Down

0 comments on commit 7b4b1ac

Please sign in to comment.