3ds Max USD API Reference
|
#include <MeshConverter.h>
Public Member Functions | |
pxr::UsdGeomMesh | ConvertToUSDMesh (INode *node, const pxr::UsdStagePtr &stage, const pxr::SdfPath &path, const MaxMeshConversionOptions &options, const maxUsd::TimeConfig &time, bool applyOffsetTransform) |
Converts an INode carrying geometry to a UsdGeomMesh prim. More... | |
void | ConvertToUSDMesh (maxUsd::MeshFacade &maxMesh, const pxr::UsdStagePtr &stage, const pxr::SdfPath &path, const MaxMeshConversionOptions &options, pxr::UsdGeomMesh &usdMesh, const pxr::UsdTimeCode &timecode, std::map< MtlID, pxr::VtIntArray > &materialIdToFacesMap, bool animated) |
Converts a MNMesh to a UsdGeomMesh prim. More... | |
void | ConvertToUSDMesh (maxUsd::MeshFacade &&maxMesh, const pxr::UsdStagePtr &stage, const pxr::SdfPath &path, const MaxMeshConversionOptions &options, pxr::UsdGeomMesh &usdMesh, const pxr::UsdTimeCode &timecode, std::map< MtlID, pxr::VtIntArray > &materialIdToFacesMap, bool animated) |
Converts a MNMesh to a UsdGeomMesh prim. This overload was added to allow passing a temporary MeshFacade as parameter. | |
PolyObject * | ConvertToPolyObject (const pxr::UsdGeomMesh &mesh, const PrimvarMappingOptions &options, std::map< int, std::string > &channelNames, MultiMtl **geomSubsetsMaterial, pxr::UsdTimeCode timeCode) |
Converts a UsdGeomMesh to a 3dsMax PolyObject. More... | |
void | ConvertToMNMesh (const pxr::UsdGeomMesh &mesh, MNMesh &maxMesh, const PrimvarMappingOptions &options, std::map< int, std::string > &channelNames, MultiMtl **geomsubSetsMaterial=nullptr, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default()) |
Converts a UsdGeomMesh to a MNesh. More... | |
Static Public Member Functions | |
static int | GetMaterialIdFromCustomData (const pxr::UsdPrim &usdPrim) |
Get the material id from custom data on the given usd prim. More... | |
Static Protected Member Functions | |
static void | ApplyUSDNormals (const pxr::UsdGeomMesh &mesh, MNMesh &maxMesh, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default()) |
Applies the USD normals to the given MNmesh. More... | |
static bool | ApplyMaxNormals (maxUsd::MeshFacade &maxMesh, pxr::UsdGeomMesh &mesh, const MaxMeshConversionOptions &options, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default(), bool animated=false) |
Applies a MNmesh's normals to a usd mesh. More... | |
static void | ApplyMaxMapChannels (maxUsd::MeshFacade &maxMesh, pxr::UsdGeomMesh &mesh, const MaxMeshConversionOptions &options, pxr::UsdTimeCode timeCode, bool animated) |
Exports map channels to primvars on the target usd mesh. More... | |
static bool | ChannelToPrimvar (maxUsd::MeshFacade &maxMesh, int channel, pxr::UsdGeomMesh &mesh, const maxUsd::MappedAttributeBuilder::Config &primvarConfig, const pxr::UsdTimeCode &timeCode, bool animated) |
Exports a channel to a primvar. More... | |
static void | ResolveChannelPrimvars (const pxr::UsdGeomMesh &mesh, const PrimvarMappingOptions &options, std::map< int, pxr::UsdGeomPrimvar > &channelPrimvars) |
Resolves the target channels for the primvars of the given mesh. This takes care of incompatibilities and potential conflicts. Following a call to this method, we have a clear idea of what channel will host the data of what primvar for a specific mesh. More... | |
static void | ApplyUSDPrimvars (const pxr::UsdGeomMesh &mesh, MNMesh &maxMesh, const PrimvarMappingOptions &options, std::map< int, std::string > &channelNames, const pxr::UsdTimeCode &timeCode) |
Applies USD primvars to the given Max mesh. More... | |
static void | ApplyMaxMaterialIDs (Mtl *mtl, const std::map< MtlID, pxr::VtIntArray > &materialIdToFacesMap, const pxr::UsdPrim &usdPrim) |
Create USD subsets on the given usdMesh for the materialID information provided in materialIdToFacesMap. More... | |
static void | ApplyUSDMaterialIDs (const pxr::UsdPrim &usdPrim, MNMesh &maxMesh, const pxr::UsdTimeCode &timeCode, MultiMtl **geomSubsetMaterial=nullptr) |
Apply material id on the provide MNMesh from the provide usdMesh prim subsets. More... | |
static void | ApplyMaxVertCreases (maxUsd::MeshFacade &maxMesh, pxr::UsdGeomMesh &usdMesh, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default()) |
Applies the MNMesh vert creases to the given USD mesh. More... | |
static void | ApplyUSDVertCreases (const pxr::UsdGeomMesh &usdMesh, MNMesh &maxMesh, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default()) |
Applies the USD vert creases to the given MNmesh. More... | |
static void | ApplyMaxEdgeCreases (maxUsd::MeshFacade &maxMesh, pxr::UsdGeomMesh &usdMesh, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default()) |
Applies the MNMesh edge creases to the given USD mesh. More... | |
static void | ApplyUSDEdgeCreases (const pxr::UsdGeomMesh &usdMesh, MNMesh &maxMesh, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default()) |
Applies the USD edge creases to the given MNmesh. More... | |
static void | ApplyMatIdToMesh (const pxr::UsdGeomSubset &subset, MNMesh &maxMesh, int matId, const pxr::UsdTimeCode &timeCode) |
Applies the given matId on the given mesh for the face found in the given geom Subset. More... | |
MeshConverter Utility Class
Example of use:
|
staticprotected |
Applies the given matId on the given mesh for the face found in the given geom Subset.
subset | The USD geom subset in which to find the face indices |
maxMesh | The max mesh where to apply the matId |
matId | The matId to apply to the faces found in the geom subset |
timeCode | The time code at which to get the faces. |
|
staticprotected |
Applies the MNMesh edge creases to the given USD mesh.
usdMesh | The USD mesh where to apply the edge creases. |
maxMesh | The max mesh from which to read the edge creases. |
timeCode | The time code at which to get the edge creases. |
|
staticprotected |
Exports map channels to primvars on the target usd mesh.
maxMesh | The Max mesh where to read the channels. |
mesh | The target USD mesh. |
options | Mesh conversion options. |
timeCode | The timecode where to write the primvars. |
animated | Whether or not the conversion of the map channel is part of an animation. |
|
staticprotected |
Create USD subsets on the given usdMesh for the materialID information provided in materialIdToFacesMap.
mtl | The 3ds Max material associated to the mesh. |
materialIdToFacesMap | A map of faces by material id. |
usdPrim | The usd usdPrim on which to add the material binding subsets. |
|
staticprotected |
Applies a MNmesh's normals to a usd mesh.
maxMesh | The max mesh from which to fetch the normals. |
mesh | The usd mesh where to apply the normals. |
options | Mesh conversion options. |
timeCode | The timecode at which to apply the normals. |
animated | Whether or not the normal conversion is part of an animation. |
|
staticprotected |
Applies the MNMesh vert creases to the given USD mesh.
usdMesh | The USD mesh where to apply the vert creases. |
maxMesh | The max mesh from which to read the vert creases. |
timeCode | The time code at which to get the vert creases. |
|
staticprotected |
Applies the USD edge creases to the given MNmesh.
usdMesh | The USD mesh from which to read the edge creases. |
maxMesh | The max mesh where to apply the edge creases. |
timeCode | The time code at which to get the edge creases. |
|
staticprotected |
Apply material id on the provide MNMesh from the provide usdMesh prim subsets.
usdPrim | UsdPrim prim from which to extract the material id subsets |
maxMesh | MNMesh on which to add the material id |
timeCode | The USD time code at which to fetch the data. |
geomSubsetMaterial | Optional, a multimaterial to be filled with geomSubset information if any in case of multiple materials bound to the mesh. |
|
staticprotected |
Applies the USD normals to the given MNmesh.
mesh | The USD mesh from which to read the normals. |
maxMesh | The max mesh where to apply the normals. |
timeCode | The time code at which to get the normals. |
|
staticprotected |
Applies USD primvars to the given Max mesh.
mesh | The usd mesh hosting the primvars to apply. |
maxMesh | The target max mesh. |
options | The primvar / channel mapping options. |
channelNames | Filled map of names associated with each imported channels. Typically from primvar names. |
timeCode | The USD time code at which to fetch the data. |
|
staticprotected |
Applies the USD vert creases to the given MNmesh.
usdMesh | The USD mesh from which to read the vert creases. |
maxMesh | The max mesh where to apply the vert creases. |
timeCode | The time code at which to get the vert creases. |
|
staticprotected |
Exports a channel to a primvar.
maxMesh | The max mesh. |
channel | The channel to export to a primvar. |
mesh | The usd mesh where to create the primvar. |
primvarConfig | The configuration for the primvar. |
timeCode | The timecode at which to output the data. |
animated | Whether or not the map channel conversion is part of an animation. |
void MeshConverter::ConvertToMNMesh | ( | const pxr::UsdGeomMesh & | mesh, |
MNMesh & | maxMesh, | ||
const PrimvarMappingOptions & | options, | ||
std::map< int, std::string > & | channelNames, | ||
MultiMtl ** | geomsubSetsMaterial = nullptr , |
||
pxr::UsdTimeCode | timeCode = pxr::UsdTimeCode::Default() |
||
) |
Converts a UsdGeomMesh to a MNesh.
mesh | The USD mesh to convert. |
maxMesh | The output MNMesh. |
options | Primvar mapping options. |
channelNames | The map channel names, generated from converted primvars. |
geomsubSetsMaterial | Generated multi-material, representing any found UsdGeomSubsets. |
timeCode | The USD timeCode at which the conversion happens. |
PolyObject * MeshConverter::ConvertToPolyObject | ( | const pxr::UsdGeomMesh & | mesh, |
const PrimvarMappingOptions & | options, | ||
std::map< int, std::string > & | channelNames, | ||
MultiMtl ** | geomSubsetsMaterial, | ||
pxr::UsdTimeCode | timeCode | ||
) |
Converts a UsdGeomMesh to a 3dsMax PolyObject.
mesh | The USD mesh to be converted. |
options | Primvar mapping options. |
channelNames | The map channel names, generated from converted primvars. |
geomSubsetsMaterial | Generated multi-material, representing any found UsdGeomSubsets. |
timeCode | The USD timeCode at which the conversion happens. |
pxr::UsdGeomMesh MeshConverter::ConvertToUSDMesh | ( | INode * | node, |
const pxr::UsdStagePtr & | stage, | ||
const pxr::SdfPath & | path, | ||
const MaxMeshConversionOptions & | options, | ||
const maxUsd::TimeConfig & | time, | ||
bool | applyOffsetTransform | ||
) |
Converts an INode carrying geometry to a UsdGeomMesh prim.
node | The node to convert. |
stage | The stage in which the UsdGeomMesh will be created. |
path | The path to the output UsdGeomMesh. |
options | Mesh conversion options. |
time | The time configuration for the conversion (which frames to export, at what sample rate). |
applyOffsetTransform | Whether or not to apply the object offset transform onto the mesh. |
void MeshConverter::ConvertToUSDMesh | ( | maxUsd::MeshFacade & | maxMesh, |
const pxr::UsdStagePtr & | stage, | ||
const pxr::SdfPath & | path, | ||
const MaxMeshConversionOptions & | options, | ||
pxr::UsdGeomMesh & | usdMesh, | ||
const pxr::UsdTimeCode & | timecode, | ||
std::map< MtlID, pxr::VtIntArray > & | materialIdToFacesMap, | ||
bool | animated | ||
) |
Converts a MNMesh to a UsdGeomMesh prim.
maxMesh | The mesh to convert. |
stage | The stage in which the UsdGeomMesh will be created. |
path | The path to the output UsdGeomMesh. |
options | Mesh conversion options. |
usdMesh | The output UsdGeomMesh. |
timecode | The USD timeCode at which the conversion happens. |
materialIdToFacesMap | Material mapping information. |
animated | Whether or not the conversion is part of an animation. |
|
static |
Get the material id from custom data on the given usd prim.
usdPrim | The USD prim that contain the matId custom data. |
|
staticprotected |
Resolves the target channels for the primvars of the given mesh. This takes care of incompatibilities and potential conflicts. Following a call to this method, we have a clear idea of what channel will host the data of what primvar for a specific mesh.
mesh | The usd mesh, potentially hosting primvars that will need to be imported. |
options | The primvar to channel mapping options. |
channelPrimvars | The resolved association, max channel -> primvar. |