Skip to content

A Rust implementation for reading/writing roblox models

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

CraftSpider/rbxm-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rbxm-rs

crates.io Documentation MIT/Apache-2 licensed

A reader for Roblox model files, implemented in Rust.

Features

  • Strongly-typed handling of many Roblox instance kinds
  • Feature flags to add support for less stable formats, E.G. CSGPHS Meshes.
  • #[no_std] support, as long as alloc is present

Example

use 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())
}

TODO

  • Complete instance info documentation
  • XML file support
  • More helper methods on data
  • Instance new methods + #[non_exhaustive] for better future compat
  • Improve parsing modularity, add a low-level API for it maybe

License

Licensed under either of

Contribution

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.

About

A Rust implementation for reading/writing roblox models

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published