11#include "MaxUsd/MaxUSDAPI.h"
13#include <pxr/usd/sdf/path.h>
14#include <pxr/usd/usdGeom/mesh.h>
15#include <pxr/usd/usdGeom/subset.h>
19#include "MaxUsd/MappedAttributeBuilder.h"
20#include "MaxMeshConversionOptions.h"
21#include "PrimvarMappingOptions.h"
22#include "MaxUsd/Utilities/TranslationUtils.h"
24#include "MeshFacade.h"
59 void ConvertToUSDMesh(maxUsd::MeshFacade& maxMesh,
const pxr::UsdStagePtr& stage,
const pxr::SdfPath& path,
61 std::map<MtlID, pxr::VtIntArray>& materialIdToFacesMap,
bool animated);
65 void ConvertToUSDMesh(maxUsd::MeshFacade&& maxMesh,
const pxr::UsdStagePtr& stage,
const pxr::SdfPath& path,
67 std::map<MtlID, pxr::VtIntArray>& materialIdToFacesMap,
bool animated)
69 ConvertToUSDMesh(maxMesh, stage, path, options, usdMesh, timecode, materialIdToFacesMap, animated);
93 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());
111 static void ApplyUSDNormals(
const pxr::UsdGeomMesh& mesh, MNMesh& maxMesh, pxr::UsdTimeCode timeCode = pxr::UsdTimeCode::Default());
134 pxr::UsdTimeCode timeCode,
bool animated);
146 static bool ChannelToPrimvar(maxUsd::MeshFacade& maxMesh,
int channel, pxr::UsdGeomMesh& mesh,
147 const maxUsd::MappedAttributeBuilder::Config& primvarConfig,
const pxr::UsdTimeCode& timeCode,
bool animated);
176 static void ApplyMaxMaterialIDs(Mtl* mtl,
const std::map<MtlID, pxr::VtIntArray>& materialIdToFacesMap,
const pxr::UsdPrim& usdPrim);
186 static void ApplyUSDMaterialIDs(
const pxr::UsdPrim& usdPrim, MNMesh& maxMesh,
const pxr::UsdTimeCode& timeCode, MultiMtl** geomSubsetMaterial =
nullptr);
194 static void ApplyMaxVertCreases(maxUsd::MeshFacade& maxMesh, pxr::UsdGeomMesh& usdMesh, pxr::UsdTimeCode timeCode = pxr::UsdTimeCode::Default());
202 static void ApplyUSDVertCreases(
const pxr::UsdGeomMesh& usdMesh, MNMesh& maxMesh, pxr::UsdTimeCode timeCode = pxr::UsdTimeCode::Default());
210 static void ApplyMaxEdgeCreases(maxUsd::MeshFacade& maxMesh, pxr::UsdGeomMesh& usdMesh, pxr::UsdTimeCode timeCode = pxr::UsdTimeCode::Default());
218 static void ApplyUSDEdgeCreases(
const pxr::UsdGeomMesh& usdMesh, MNMesh& maxMesh, pxr::UsdTimeCode timeCode = pxr::UsdTimeCode::Default());
227 static void ApplyMatIdToMesh(
const pxr::UsdGeomSubset& subset, MNMesh& maxMesh,
int matId,
const pxr::UsdTimeCode& timeCode);
Definition: MaxMeshConversionOptions.h:13
Definition: MeshConverter.h:34
static int GetMaterialIdFromCustomData(const pxr::UsdPrim &usdPrim)
Get the material id from custom data on the given usd prim.
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.
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.
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.
static void ApplyUSDVertCreases(const pxr::UsdGeomMesh &usdMesh, MNMesh &maxMesh, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default())
Applies the USD vert creases to the given MNmesh.
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.
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.
static void ApplyUSDEdgeCreases(const pxr::UsdGeomMesh &usdMesh, MNMesh &maxMesh, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default())
Applies the USD edge creases to the given MNmesh.
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.
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.
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 MeshFac...
Definition: MeshConverter.h:65
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.
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.
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.
static void ApplyUSDNormals(const pxr::UsdGeomMesh &mesh, MNMesh &maxMesh, pxr::UsdTimeCode timeCode=pxr::UsdTimeCode::Default())
Applies the USD normals to the given MNmesh.
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 materialIdToFacesM...
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...
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.
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.
This class exposes methods for getting and setting primvar/channel mapping options.
Definition: PrimvarMappingOptions.h:19