How bluebolt/bb_arnoldalembicprocedural works
Project type and purpose
• This is a C++ “procedural” plugin for the Arnold renderer that reads Alembic (.abc) archives and emits geometry (polymesh, curves, points, subd, etc.) into an Arnold scene.
• It’s invoked with command‐line style flags but ultimately is a shared‐object loaded inside Arnold as a procedural node.
Top‐level architectural components
A. Procedural Entry & Argument Handling
– ProcMain.cpp / ProcArgs.{cpp,h}
– Entry point registers the plugin, parses flags (–filename, –frame, –fps, user properties).
B. Alembic Parameter & Sampling Layer
– ArbGeomParams.{cpp,h}
– SampleUtil.{cpp,h}
– Encapsulates Alembic time mapping, shutter window computation, subd iteration handling.
C. Geometry‐Emitter Modules
– WriteGeo, WriteCurves, WritePoint, WriteTransform, WriteOverrides (all .cpp/.h)
– Each module knows how to traverse a subset (e.g. polymesh, curves, points, face‐sets) of the Alembic archive and emit corresponding Arnold primitives.
D. Utility Libraries
– PathUtil.{cpp,h}: path‐string manipulation for Alembic object paths.
– JSON wrapper (json/ directory + jsoncpp.cpp): parse user‐provided JSON dictionaries for overrides, userAttributes, shader assignments.
– pystring.{cpp,h}: Python‐style string utilities used by modules for pattern matching, wildcarding.
E. External Dependencies
– Alembic C++ SDK (AbcGeom API)
– Arnold C API for procedural registration & primitive creation
– JSONCPP (bundled in json/)
– CMakeLists.txt for build configuration
Key relationships and data flow
1. Arnold instantiates the procedural node → calls your ProcMain entry
2. ProcMain uses ProcArgs to parse flags & JSON property strings/files
3. Parsed parameters feed into ArbGeomParams to set up Alembic archive reader and sampling window
4. SampleUtil supplies time‐sampled data out of the archive
5. Writing modules (WriteGeo, WriteCurves, etc.) traverse the archive hierarchy (using PathUtil) and emit Arnold primitives
6. WriteOverrides & JSON parsing attach user‐overrides, shaders, displacement assignments to the emitted nodes
Architectural patterns and design principles
• Modular decomposition: each “Write…” module handles one primitive type
• Layered design: separation of argument parsing, sampling logic, write logic, and utilities
• Plugin pattern: registration via Arnold’s API, entry via ProcMain
• Data‐driven configuration: JSON dictionaries drive user overrides, shader assigns
– Each component clearly labeled
– Notes on key responsibilities (e.g., “WriteCurves: emits curve primitives from ICurves”)
– Grouping of modules by layer to reflect architectural separation