Skip to content

Instantly share code, notes, and snippets.

@fereria
Created February 29, 2020 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fereria/eea61531a530efa799d343331d305214 to your computer and use it in GitHub Desktop.
Save fereria/eea61531a530efa799d343331d305214 to your computer and use it in GitHub Desktop.
void
main() {
auto stage = UsdStage::CreateInMemory();
ClassTest* hoge = new ClassTest("D:/work/data_sample/xbot.fbx");
FbxArray<FbxMesh*>* meshArray = new FbxArray<FbxMesh*>();
hoge->getAllMesh(*meshArray);
// 取得してきた情報でPrimを作る
for (int i = 0; i < meshArray->Size(); i++) {
USDMeshData* data = new USDMeshData();
hoge->getMeshData(meshArray->GetAt(i), data);
SdfPath meshPath = SdfPath(data->sdfPath);
UsdGeomMesh usdMesh = UsdGeomMesh::Define(stage, meshPath);
usdMesh.CreatePointsAttr(VtValue(data->vtxPoints));
usdMesh.CreateFaceVertexCountsAttr(VtValue(data->polyVtx));
usdMesh.CreateFaceVertexIndicesAttr(VtValue(data->polyIndex));
}
stage->GetRootLayer()->Export("D:/test.usda");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment