Giter Club home page Giter Club logo

rbxm-rs's Introduction

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.

rbxm-rs's People

Contributors

craftspider avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

rbxm-rs's Issues

Auto-generate Definitions

Currently, updating definitions requires manual effort. It would be nice if it was possible to generate them off of the API dump or similar

It's currently not possible to use just the API dump - it defines the Lua access, but not how the objects are serialized. Things like model mesh data aren't listed, and as such causes failures due to extra properties.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.