ComfyUI Node

Text to USD

Paste USDA source code straight into your graph

By cjhosken·Created 3 months ago·Updated 2 months ago· 9
Text to USD
    • USD
    usda_text

    Text to USD builds a live USD stage from ASCII USDA source code. Paste a valid block of .usda in and you get a stage out - no file on disk, no DCC, just text parsed into a working scene graph. It's the pack's answer to the fact that USD is, underneath everything, a text format, and sometimes the fastest way to get something into the graph is to type it.

    Why you'd reach for it

    USDA is human-readable by design. When you open a .usda file you can read the prim hierarchy, the transforms, the references - it reads like structured notes. So there's a whole class of workflows where text is the natural currency:

    • Hand-author a tiny stage. A cube, a light, a camera - a dozen lines of USDA gets you a scene you'd otherwise need several nodes to build.
    • Paste from documentation. USD tutorials and reference files are full of copy-pasteable USDA snippets. Text to USD is how a snippet becomes a real stage.
    • The edit loop. USD to Text dumps a stage as text, you (or an LLM node) edit that text, and Text to USD parses it back into a stage. That round-trip is the pack's "live USDA editing" story - it's the most direct way to do something the dedicated nodes don't cover.

    How it works

    It's two calls deep in the pxr library: create an in-memory stage and import the text into its root layer (ImportFromString). That's it. The stage is genuinely in memory - nothing is written to disk until you run it through SaveUSD. Text becomes a stage object on the custom USD socket, ready for every other node in the pack.

    The one thing that surprises people: usda_text is an input socket, not a text box you type into. The node is declared with forceInput, so it won't render a widget - you have to wire a STRING into it. That's actually the design intent: you feed it from USD to Text, from any text/string node, or from an LLM node that's generating USDA for you. If you want to hand-type, put your text in an upstream string node (or any multiline text widget) and wire it over.

    Inputs and output

    • usda_text - a required STRING socket. Must be valid ASCII USDA.
    • Output: a single USD stage.

    Install

    It's part of the cjhosken/ComfyUI-OpenUSD pack. ComfyUI Manager, search "ComfyUI-OpenUSD", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cjhosken/ComfyUI-OpenUSD
    

    Restart, and let usd-core==26.5 (the big one), numpy, trimesh, and pygltflib install. No model downloads in this pack at all.

    Troubleshooting

    • It errors on paste - the text isn't valid USDA. Most common cause: you pasted the contents of a binary .usdc file, or a .usda with an incompatible header. Text to USD wants ASCII .usda syntax, period.
    • Nothing appears in the viewer - if your snippet defines prims but no meshes or lights, the viewer will look empty. Text to USD doesn't care; it parses whatever you give it.
    • The node has no text box - that's the forceInput design, not a bug. Wire a string node in.

    Pack-level honesty: this is v0.1.1, brand new, no community track record. The forceInput choice is sensible but it means the "text to USD" workflow is a two-node graph (string node → Text to USD) rather than a single box. Slightly fiddlier than it reads, but the round-trip with USD to Text is worth it.

    Category3d/usd/convert

    Inputs (1)

    NameTypeDefaultDescription
    usda_textSTRING

    Outputs (1)

    NameTypeDescription
    USDUSD