Skip to main content

vScriptValToUSD

Convert point, edge, UV and UV edge arrays into OpenUSD ASCII (USDA) text for a single mesh, with an optional 4x4 matrix.

IntermediateMograph / ScriptValScriptValArrayJSON
vScriptValToUSD node

vScriptValToUSD takes arrays on its Points, Edges, UVs and UV Edges sockets and outputs a USDA text for one mesh. A matrix on the Matrix socket transforms the points before they are written.

Parameters​

ParameterTypeDefaultDescription
EdgesScriptVal—Array of face index lists. Each entry is one face and becomes part of faceVertexCounts and faceVertexIndices.
PointsScriptVal—Array of points. The points are written as point3f values.
UVsScriptVal—Array of texture coordinates. Written as primvars:st when UV Edges is also connected.
UV EdgesScriptVal—Array of UV index lists. Written as primvars:st:indices.
MatrixText—A 4x4 matrix as JSON text that is applied to the points. Without it the identity matrix is used.
+3 more parameters
ParameterTypeDefaultDescription
Object SortText—Sort value stored in the sort field of the Array output. Default Mesh.
Object PathText—Prim path stored in the path field of the Array output. Default /vMograph/mesh.
Show InputInteger1.0Shows or hides the Edges, Points, UVs and UV Edges sockets. Default on.
Read the full description

The text is a USDA 1.0 file with the default prim vMograph, a document string that names the composition, metersPerUnit 0.01 and upAxis Y. It holds one Xform named vMograph with one Mesh named mesh, which is written as double sided.

Edges become faceVertexCounts and faceVertexIndices. Each entry of the Edges array is one face, its length is the vertex count, and every index has 1 subtracted, so the node expects 1-based indices like the ones used in OBJ. Points are transformed by the Matrix socket, or by the identity matrix if nothing is connected, and written as point3f values with four decimal places.

UVs are written only when both the UVs and the UV Edges arrays have content. The node writes the first two values of each UV as primvars:st with faceVarying interpolation, and the UV Edges as primvars:st:indices, again with 1 subtracted.

The Output socket carries the USDA text. The Array socket carries JSON text with the fields sort, path and usda. Sort and Path come from the Object Sort and Object Path controls, which have the defaults Mesh and /vMograph/mesh. They are not written into the USDA text itself.

Example Connections​

vScriptValPointsOnGrid.Output -> vScriptValToUSD.ArrayPoints