Skip to content

TinyUSDZ for editing USD files in JavaScript? #160

Answered by syoyo
alankent asked this question in Q&A
Discussion options

You must be logged in to vote

At the moment, most of TinyUSDZ users use C++. If you want to do read/modify USD file in JavaScript, as you thinking of, having JSON representation of USD(USDJ or USDJPY(USD Json rePresentation, Yay!)) should fit your requirements.

#69

There is a very early prototype of USD to JSON conversion in TinyUSDZ https://github.com/syoyo/tinyusdz/blob/dev/src/usd-to-json.cc . Once this is implemented, you can read USD and convert it to JSON on JavaScript.

const tinyusdz = require('tinyusdz') // wasm build of tinyusdz

usd = tinyusdz.loadUSD(file_or_uri)

// j = JSON
j = tinyusdz.ToJSON(usd)

// edit j

// optionally, validate JSON with JSON Schema

// Construct USD(Stage) from JSON 
usd2 = tinyusdz.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by syoyo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants