Crates.io | rbxm |
lib.rs | rbxm |
version | 0.3.0 |
source | src |
created_at | 2021-05-08 20:20:06.176772 |
updated_at | 2022-12-17 20:54:52.660804 |
description | Reader for Roblox model files |
homepage | |
repository | https://github.com/CraftSpider/rbxm-rs |
max_upload_size | |
id | 394983 |
size | 314,491 |
A reader for Roblox model files, implemented in Rust.
#[no_std]
support, as long as alloc is presentuse rbxm::{from_file, SerdeError, ModelError};
fn main() {
// Read a model from a file
let model = match from_file("./Model.rbxm") {
Ok(model) => model,
Err(SerdeError::IoError(err)) => panic!("IO Error: {}", err),
Err(err) => panic!("Error parsing model: {}", err),
};
// Get a part from a path, this looks for a root node named ModelSection with a child named Part, and returns
// that child.
let part = match model.get_path("ModelSection/Part") {
Ok(part) => part,
Err(ModelError::NotFound) => panic!("Couldn't find instance at \"ModelSection/Part\""),
Err(ModelError::AmbiguousPath) => panic!("Found more than one instance matching \"ModelSection/Part\""),
Err(err) => panic!("Model Error: {}", err),
};
println!("Part Class: {}", part.borrow().kind.class_name())
}
#[non_exhaustive]
for better future compatLicensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.