15 #include <pxr/usd/usd/stage.h>
16 #include <pxr/usd/usd/modelAPI.h>
17 #include <pxr/usd/usd/editContext.h>
18 #if (PXR_MINOR_VERSION < 20)
19 #include <pxr/usd/usd/references.h>
21 #include <pxr/usd/usd/payloads.h>
23 #include <pxr/usd/kind/registry.h>
24 #include <pxr/usd/usdGeom/scope.h>
25 #include <pxr/usd/usdGeom/metrics.h>
26 #include <pxr/usd/usdGeom/xform.h>
27 #include <pxr/usd/usdGeom/mesh.h>
28 #include <pxr/usd/usdGeom/primvarsAPI.h>
29 #include <pxr/usd/usdSkel/skeleton.h>
30 #include <pxr/usd/usdSkel/blendShape.h>
31 #include <pxr/usd/usdSkel/bindingAPI.h>
32 #include <pxr/usd/usdSkel/animation.h>
33 #include <pxr/usd/sdf/valueTypeName.h>
34 #include <pxr/usd/sdf/path.h>
35 #include <pxr/usd/usdShade/materialBindingAPI.h>
36 #include <pxr/base/tf/token.h>
37 #include <pxr/base/gf/matrix4d.h>
38 #include <pxr/base/vt/types.h>
39 #include <pxr/base/vt/value.h>
41 #include <Atoms/Usd/Globals.h>
42 #include <AtomsCore/AtomsMath.h>
43 #include <AtomsCore/Metadata/MapMetadata.h>
44 #include <AtomsCore/Metadata/ArrayMetadata.h>
45 #include <AtomsCore/Metadata/MeshMetadata.h>
46 #include <AtomsCore/Joint.h>
47 #include <AtomsCore/Skeleton.h>
48 #include <Atoms/Variations.h>
55 std::string diffusePathValue;
56 std::string specularPathValue;
57 std::string normalPathValue;
59 double specularWeight;
60 double cosinePowerValue;
61 double specularEccentricity;
66 specularPathValue(
""),
71 cosinePowerValue(0.5),
72 specularEccentricity(0.5)
80 PXR_NS::VtVec3fArray t;
81 PXR_NS::VtVec3hArray s;
82 PXR_NS::VtQuatfArray r;
90 v(PXR_NS::UsdGeomTokensType().inherited),
104 PXR_NS::VtTokenArray blendShapeNames;
105 std::map<int, PXR_NS::VtFloatArray> blendShapeWeights;
109 blendShapeNames.clear();
110 blendShapeWeights.clear();
116 std::string agentType;
117 std::string variation;
119 std::string groupName;
122 std::vector<std::string> variationsOverrides;
123 std::vector<std::string> variationsGeometryFilters;
124 std::vector<std::string> variationsGeoMatOverrides;
126 std::map<int, TransformData> transforms;
131 std::string cleanNameForUSD(
132 const std::string& name);
134 PXR_NS::GfMatrix4d convertAtomsMatrix(
138 const PXR_NS::GfMatrix4d& mtx);
140 void convertMaterial(
141 const PXR_NS::UsdStageRefPtr& stage,
142 const std::string& name,
143 const std::string& parent,
145 PXR_NS::UsdShadeMaterial& material);
148 std::string buildJointFullPath(
152 std::vector<std::string> buildJointNamesFromSkeleton(
156 std::vector<std::string> convertAtomsSkeleton(
158 const PXR_NS::UsdSkelSkeleton& skel);
160 std::vector<std::string> saveAtomsSkeleton(
162 const std::string& skeletonOutput,
163 const std::string& name);
166 void atomsMeshToUsdMesh(
168 PXR_NS::UsdGeomMesh& meshPrim,
172 void setupSkinWeights(
173 AtomsPtr<const AtomsCore::MapMetadata> geoMap,
174 PXR_NS::UsdGeomMesh& meshPrim);
177 void setMetadataPrimVar(
178 PXR_NS::UsdGeomPrimvarsAPI& primvarsApi,
179 const PXR_NS::TfToken& primVarName,
180 const std::string& metaName,
181 unsigned int metaTypeId,
182 AtomsPtr<const AtomsCore::MapMetadata> meta,
183 int* frame =
nullptr);
185 void setMetadataAsAttributes(
186 PXR_NS::UsdPrim& primvarsApi,
187 const std::string& metaName,
188 const AtomsPtr<AtomsCore::Metadata>& meta,
189 int* frame =
nullptr);
192 std::vector<std::string> getBlendShapeNames(
194 const std::string& agentTypeName,
195 const std::string& variationName);
198 void atomsBlendShapesToUsdBlendShapes(
199 const PXR_NS::UsdStageRefPtr& stage,
200 PXR_NS::UsdGeomMesh& meshPrim,
202 AtomsPtr<const AtomsCore::ArrayMetadata>& blendShapes,
203 const std::string& blendShapeName);
206 void processChildMesh(
207 const PXR_NS::UsdStageRefPtr& stage,
208 const std::string& childPath,
209 AtomsPtr<const AtomsCore::MapMetadata>& currentChild,
210 bool useDefaultMaterial,
211 const std::string& blendShapeName,
212 const std::string& outAssetFolder,
213 bool mergeTransformAndShape,
214 PXR_NS::SdfPathVector& meshesPaths);
218 const std::string& putputPath,
219 const std::string& name,
222 PXR_NS::UsdStageRefPtr createNewUSDStage(
const std::string& path);
Variations class.
Definition: Variations.h:839
Joint class.
Definition: Joint.h:30
Skeleton class.
Definition: Skeleton.h:68
Mesh class.
Definition: Mesh.h:30
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
AtomsMath::Matrix Matrix
Matrix class.
Definition: AtomsMath.h:63
Definition: UsdExporterUtils.h:103
Definition: UsdExporterUtils.h:52
Definition: UsdExporterUtils.h:115