Skip to main content

Interface: MaterialXPackage

A MaterialX document together with every resource it references, held in memory.

This is the unit that transform pipelines operate on and that the Node entry point (mtlx-core/node) reads from and writes to either MaterialXFormat. The document's file references always point at resources[i].archivePath.

Example:

import { loadMaterialXPackage, writeMaterialXPackage } from 'mtlx-core/node';
import { transform } from 'mtlx-core';
import { resizeTextures } from 'mtlx-core/textures';

const pkg = await loadMaterialXPackage('material.mtlx');
await transform(pkg, resizeTextures({ maxImageSize: 1024, targets: [{ format: 'webp' }] }));
await writeMaterialXPackage(pkg, 'material.mtlx.zip');

Properties​

document​

document: MaterialXDocument


resources​

resources: MaterialXResource[]


rootPath​

rootPath: string

Archive-relative path of the root .mtlx document, e.g. material.mtlx.