MCPcopy Index your code
hub / github.com/alexxbb/hapi-rs

github.com/alexxbb/hapi-rs @v21.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v21.0.2 ↗ · + Follow
1,205 symbols 4,277 edges 81 files 230 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Rust bindings to Houdini Engine API

Cargo Documentation MIT/Apache 2.0

SideFX Houdini Meets Rust!

SideFx Houdini is world leading software for creating stunning visual effects for movies and games. Apart from the main graphical interface written in C++ and Python, Houdini also provides a C interface called Houdini Engine or HAPI for short. Its goal is to bring the power of Houdini to other DCCs (Digital Content Creation) software and game engines.

:exclamation: A valid commercial Houdini Engine license is required to use this crate

HDA Viewer Demo

https://user-images.githubusercontent.com/10694389/227816361-b9ffa083-7932-40e4-afda-3cb400126eb5.mp4

Introduction Video On Youtube

Example

use hapi_rs::Result;
use hapi_rs::session::simple_session;
use hapi_rs::parameter::*;

fn main() -> Result<()> {
    // Start a standalone engine process with sensible defaults
    let session = simple_session()?;
    // Load a Houdini Asset and create a node
    let lib = session.load_asset_file("otls/hapi_geo.hda")?;
    let node = lib.create_asset_for_node("Object/hapi_geo", None)?;
    // Set the "scale" parameter
    if let Parameter::Float(parm) = node.parameter("scale")? {
        parm.set(0, 3.0)?;
        node.cook()?;
    }
    // Get a reference to the node's internal geometry
    let geometry = node.geometry()?.expect("geometry");
    // Save it to one of the supported geometry formats
    geometry.save_to_file("/tmp/output.fbx")?;
    Ok(())
}

Supported Houdini versions

The crate version matches the supported Houdini MAJOR.MINOR version i.e. 21.0.0 is built work with Houdini 21.0 Mixing and matching different versions of Houdini and this crate is not guranteed to work.

Documentation

docs.rs

HAPI C Documentation

Development

Run Rust test coverage with cargo-llvm-cov:

cargo install cargo-llvm-cov
cargo xtask coverage

For an HTML report:

cargo xtask coverage --html

To cover only tests matching a name pattern:

cargo xtask coverage --test-pattern node_

Extension points exported contracts — how you extend this code

ParmBaseTrait (Interface)
Common trait for parameters [4 implementers]
lib/src/parameter/base.rs
AsAttribute (Interface)
(no doc) [6 implementers]
lib/src/attribute/mod.rs
EnvVariable (Interface)
Trait bound for [`Session::get_server_var()`] and [`Session::set_server_var()`] [3 implementers]
lib/src/session.rs
ToNodeTypeBits (Interface)
Trait to convert a `NodeType` to a `NodeTypeBits` [2 implementers]
lib/src/node.rs
ToNodeFlagsBits (Interface)
Trait to convert a `NodeFlags` to a `NodeFlagsBits` [2 implementers]
lib/src/node.rs

Core symbols most depended-on inside this repo

ptr
called by 283
lib/src/session.rs
check_err
called by 266
lib/src/errors.rs
as_ref
called by 75
lib/src/node.rs
cook_blocking
called by 54
lib/src/node.rs
get
called by 51
lib/src/attribute/mod.rs
uzize_to_i32
called by 49
lib/src/utils.rs
set
called by 44
lib/src/attribute/mod.rs
load_asset_file
called by 37
lib/src/session.rs

Shape

Function 510
Method 467
Class 155
Enum 62
Interface 11

Languages

Rust99%
Python1%

Modules by API surface

lib/src/ffi/functions.rs245 symbols
lib/src/session.rs95 symbols
lib/src/geometry.rs83 symbols
lib/src/ffi/bindings.rs79 symbols
lib/src/node.rs73 symbols
lib/src/ffi/structs.rs49 symbols
lib/src/server.rs41 symbols
lib/src/attribute/mod.rs32 symbols
lib/src/pdg.rs30 symbols
lib/src/parameter/base.rs29 symbols
apps/viewport/src/setup.rs25 symbols
lib/src/errors.rs24 symbols

For agents

$ claude mcp add hapi-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact