diff --git a/Code/Sandbox/Plugins/CMakeLists.txt b/Code/Sandbox/Plugins/CMakeLists.txt index 5b940921c1..0f83a98aa1 100644 --- a/Code/Sandbox/Plugins/CMakeLists.txt +++ b/Code/Sandbox/Plugins/CMakeLists.txt @@ -11,7 +11,6 @@ add_subdirectory(EditorCommon) add_subdirectory(ComponentEntityEditorPlugin) -add_subdirectory(FBXPlugin) add_subdirectory(FFMPEGPlugin) add_subdirectory(ProjectSettingsTool) add_subdirectory(PerforcePlugin) diff --git a/Code/Sandbox/Plugins/FBXPlugin/CMakeLists.txt b/Code/Sandbox/Plugins/FBXPlugin/CMakeLists.txt deleted file mode 100644 index 4c433b9cd6..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -if(NOT PAL_TRAIT_BUILD_HOST_TOOLS) - return() -endif() - -include(Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) -if(NOT PAL_TRAIT_BUILD_FBX_PLUGIN_SUPPORTED) - return() -endif() - -ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) - -ly_add_target( - NAME FBXPlugin MODULE - NAMESPACE Legacy - OUTPUT_SUBDIRECTORY EditorPlugins - AUTOMOC - AUTOUIC - AUTORCC - FILES_CMAKE - fbxplugin_files.cmake - ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake - COMPILE_DEFINITIONS - PRIVATE - PLUGIN_EXPORTS - BUILD_DEPENDENCIES - PRIVATE - 3rdParty::Qt::Core - 3rdParty::Qt::Gui - 3rdParty::Qt::Widgets - 3rdParty::FbxSdk - Legacy::CryCommon - Legacy::Editor.Headers - Legacy::EditorCore -) - -ly_add_dependencies(Editor FBXPlugin) -set_property(GLOBAL APPEND PROPERTY LY_EDITOR_PLUGINS $) diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXExporter.cpp b/Code/Sandbox/Plugins/FBXPlugin/FBXExporter.cpp deleted file mode 100644 index 9aa46e78c4..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXExporter.cpp +++ /dev/null @@ -1,924 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "FBXPlugin_precompiled.h" - - -// FBX SDK Help: http://download.autodesk.com/global/docs/fbxsdk2012/en_us/index.html - -#include "FBXExporter.h" -#include "FBXSettingsDlg.h" - -#include "IEditor.h" - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// constants used to convert cameras to and from Maya - -static const float s_CONVERSION_BAKING_SAMPLE_RATE = 30.0f; - -// IMPORT_PRE/POST_ROTATIONS determined by experimentation with fbx2015 in Maya and Max. -// We are transforming a Z-axis forward (Max/Maya) to a negative Y-axis forward camera (Editor). -// Analytically this shold involve a preRotation of -90 degrees around the x-axis. -// For Y-Up scenes, our Open 3D Engine Tools inserts an additional 180 rotation around the Y-axis when orienting .cgf files. We need to -// 'undo' for FBX anim curves. This does not apply to cameras which do not use .cgf files -static const FbxVector4 s_PRE_ROTATION_FOR_YUP_SCENES (-90.0f, .0f, .0f); -static const FbxVector4 s_POST_ROTATION_FOR_YUP_OBJECTS(-90.0f, 180.0f, .0f); -static const FbxVector4 s_POST_ROTATION_FOR_ZFORWARD_CAMERAS(-90.0f, .0f, .0f); - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -namespace { - std::string GetFilePath(const std::string& filename) - { - int pos = filename.find_last_of("/\\"); - if (pos > 0) - { - return filename.substr(0, pos + 1); - } - - return filename; - } - - - std::string GetFileName(const std::string& fullFilename) - { - int pos = fullFilename.find_last_of("/\\"); - if (pos > 0) - { - return fullFilename.substr(pos + 1); - } - - return fullFilename; - } -} // namespace - - -#ifdef DEBUG -/////////////////////////////////////////////////////////////////////// -// debugging function to print all the keys in an Fbx Curve -void DebugPrintCurveKeys(FbxAnimCurve* pCurve, const QString& name) -{ - if (pCurve) - { - ILog* log = GetIEditor()->GetSystem()->GetILog(); - log->Log("\n%s", name); - for (int keyID = 0; keyID < pCurve->KeyGetCount(); ++keyID) - { - FbxAnimCurveKey key = pCurve->KeyGet(keyID); - - log->Log("%.2g:%g, ", key.GetTime().GetSecondDouble(), key.GetValue()); - } - } -} -#endif - -// CFBXExporter -CFBXExporter::CFBXExporter() - : m_pFBXManager(0) - , m_pFBXScene(0) -{ - m_settings.bCopyTextures = true; - m_settings.bEmbedded = false; - m_settings.bAsciiFormat = false; - m_settings.bConvertAxesForMaxMaya = false; -} - - -const char* CFBXExporter::GetExtension() const -{ - return "fbx"; -} - - -const char* CFBXExporter::GetShortDescription() const -{ - return "FBX format"; -} - - -bool CFBXExporter::ExportToFile(const char* filename, const Export::IData* pData) -{ - if (!m_pFBXManager) - { - m_pFBXManager = FbxManager::Create(); - } - - bool bAnimationExport = false; - - for (int objectID = 0; objectID < pData->GetObjectCount(); ++objectID) - { - Export::Object* pObject = pData->GetObject(objectID); - - if (pObject->GetEntityAnimationDataCount() > 0) - { - bAnimationExport = true; - break; - } - } - - // do nothing if the user cancels - if (!OpenFBXSettingsDlg(m_settings)) - { - return false; - } - - m_path = GetFilePath(filename); - std::string name = GetFileName(filename); - - // create an IOSettings object - FbxIOSettings* pSettings = FbxIOSettings::Create(m_pFBXManager, IOSROOT); - m_pFBXManager->SetIOSettings(pSettings); - - // Create a scene object - FbxScene* pFBXScene = FbxScene::Create(m_pFBXManager, "Test"); - pFBXScene->GetGlobalSettings().SetAxisSystem(FbxAxisSystem::Max); - pFBXScene->GetGlobalSettings().SetOriginalUpAxis(FbxAxisSystem::Max); - - // Create document info - FbxDocumentInfo* pDocInfo = FbxDocumentInfo::Create(m_pFBXManager, "DocInfo"); - pDocInfo->mTitle = name.c_str(); - pDocInfo->mSubject = "Exported geometry from editor application."; - pDocInfo->mAuthor = "Editor FBX exporter."; - pDocInfo->mRevision = "rev. 1.0"; - pDocInfo->mKeywords = "Editor FBX export"; - pDocInfo->mComment = ""; - pFBXScene->SetDocumentInfo(pDocInfo); - - // Create nodes from objects and add them to the scene - FbxNode* pRootNode = pFBXScene->GetRootNode(); - - FbxAnimStack* pAnimStack = FbxAnimStack::Create(pFBXScene, "AnimStack"); - FbxAnimLayer* pAnimBaseLayer = FbxAnimLayer::Create(pFBXScene, "AnimBaseLayer"); - pAnimStack->AddMember(pAnimBaseLayer); - - int numObjects = pData->GetObjectCount(); - - m_nodes.resize(0); - m_nodes.reserve(numObjects); - - for (int i = 0; i < numObjects; ++i) - { - Export::Object* pObj = pData->GetObject(i); - FbxNode* newNode = NULL; - - if (!bAnimationExport) - { - newNode = CreateFBXNode(pObj); - } - else - { - newNode = CreateFBXAnimNode(pFBXScene, pAnimBaseLayer, pObj); - } - - m_nodes.push_back(newNode); - } - - // solve hierarchy - for (int i = 0; i < m_nodes.size() && i < numObjects; ++i) - { - const Export::Object* pObj = pData->GetObject(i); - FbxNode* pNode = m_nodes[i]; - FbxNode* pParentNode = 0; - if (pObj->nParent >= 0 && pObj->nParent < m_nodes.size()) - { - pParentNode = m_nodes[pObj->nParent]; - } - if (pParentNode) - { - pParentNode->AddChild(pNode); - } - else - { - pRootNode->AddChild(pNode); - } - } - - int nFileFormat = -1; - - if (m_settings.bAsciiFormat) - { - if (nFileFormat < 0 || nFileFormat >= m_pFBXManager->GetIOPluginRegistry()->GetWriterFormatCount()) - { - nFileFormat = m_pFBXManager->GetIOPluginRegistry()->GetNativeWriterFormat(); - int lFormatIndex, lFormatCount = m_pFBXManager->GetIOPluginRegistry()->GetWriterFormatCount(); - for (lFormatIndex = 0; lFormatIndex < lFormatCount; lFormatIndex++) - { - if (m_pFBXManager->GetIOPluginRegistry()->WriterIsFBX(lFormatIndex)) - { - FbxString lDesc = m_pFBXManager->GetIOPluginRegistry()->GetWriterFormatDescription(lFormatIndex); - const char* lASCII = "ascii"; - if (lDesc.Find(lASCII) >= 0) - { - nFileFormat = lFormatIndex; - break; - } - } - } - } - } - - pSettings->SetBoolProp(EXP_FBX_EMBEDDED, m_settings.bEmbedded); - - if (m_settings.bConvertAxesForMaxMaya) - { - // convert the scene from our Z-Up world to Maya's Y-Up World. This is stored in the FBX scene and both Max & Maya will - // import accordingly - FbxAxisSystem::MayaYUp.ConvertScene(pFBXScene); - - // process all camera nodes in the scene to make them look down their negative Z-axis - convertCamerasForMaxMaya(pFBXScene->GetRootNode()); - } - - //Save a scene - bool bRet = false; - FbxExporter* pFBXExporter = FbxExporter::Create(m_pFBXManager, name.c_str()); - - // For backward compatilibity choose a widely compatible FBX version that's been out for a while: - if (pFBXExporter) - { - pFBXExporter->SetFileExportVersion(FBX_2014_00_COMPATIBLE); - - if (pFBXExporter->Initialize(filename, nFileFormat, pSettings)) - { - bRet = pFBXExporter->Export(pFBXScene); - } - pFBXExporter->Destroy(); - } - - pFBXScene->Destroy(); - - m_materials.clear(); - m_meshMaterialIndices.clear(); - - m_pFBXManager->Destroy(); - m_pFBXManager = 0; - - if (bRet) - { - GetIEditor()->GetSystem()->GetILog()->Log("\nFBX Exporter: Exported successfully to %s.", name.c_str()); - } - else - { - GetIEditor()->GetSystem()->GetILog()->LogError("\nFBX Exporter: Failed."); - } - - return bRet; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// This method finds all cameras (via recursion) in the node tree rooted at pNode and bakes the necessary -// transforms into any cameras it finds to take care of the conversion from Maya Z-forward to our negative-y forward cameras -void CFBXExporter::convertCamerasForMaxMaya(FbxNode* pNode) const -{ - if (pNode) - { - // recurse to children to convert all cameras in the level - for (int i = 0; i < pNode->GetChildCount(); i++) - { - convertCamerasForMaxMaya(pNode->GetChild(i)); - } - - // process this node if it's a camera - convertCameraForMaxMaya(pNode); - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Maya cameras look down the negative z-axis. Ours look down the positive-y. This method bakes the necessary transforms -// into the local transforms of the given pNode if it's a camera to take care of the conversion -void CFBXExporter::convertCameraForMaxMaya(FbxNode* pNode) const -{ - // Maya puts in an extra 90 x-rotation in the "Rotate Axis" channel. Adding an extra post-rotation fixes this, - // determined experimentally - static const FbxVector4 s_EXTRA_EXPORT_POST_ROTATION_FOR_MAX_MAYA(.0f, -90.0f, .0f); - - if (pNode && pNode->GetNodeAttribute() && pNode->GetNodeAttribute()->GetAttributeType() == FbxNodeAttribute::eCamera) - { - // bake in s_PRE/POST_ROTATION_FOR_MAYA into anim curves - pNode->SetPivotState(FbxNode::eSourcePivot, FbxNode::ePivotActive); - pNode->SetPivotState(FbxNode::eDestinationPivot, FbxNode::ePivotActive); - - pNode->SetPreRotation(FbxNode::eSourcePivot, s_PRE_ROTATION_FOR_YUP_SCENES); - pNode->SetPostRotation(FbxNode::eSourcePivot, s_POST_ROTATION_FOR_ZFORWARD_CAMERAS); - - pNode->ResetPivotSetAndConvertAnimation(s_CONVERSION_BAKING_SAMPLE_RATE, true); // bake postRotation in for all animStacks - - // Maya puts in an extra 90 x-rotation in the "Rotate Axis" channel. Adding an extra post-rotation after the baking of transforms - // fixes this - i.e. baked transformes change the camera's local rotation channels themselves, post-bake post-transforms get - // stuffed into Maya's 'Rotate Axis' channels - pNode->SetPostRotation(FbxNode::eSourcePivot, s_EXTRA_EXPORT_POST_ROTATION_FOR_MAX_MAYA); - } -} - -FbxMesh* CFBXExporter::CreateFBXMesh(const Export::Object* pObj) -{ - if (!m_pFBXManager) - { - return 0; - } - - int numVertices = pObj->GetVertexCount(); - const Export::Vector3D* pVerts = pObj->GetVertexBuffer(); - - int numMeshes = pObj->GetMeshCount(); - - int numAllFaces = 0; - for (int j = 0; j < numMeshes; ++j) - { - const Export::Mesh* pMesh = pObj->GetMesh(j); - int numFaces = pMesh->GetFaceCount(); - numAllFaces += numFaces; - } - - if (numVertices == 0 || numAllFaces == 0) - { - return 0; - } - - FbxMesh* pFBXMesh = FbxMesh::Create(m_pFBXManager, pObj->name); - - pFBXMesh->InitControlPoints(numVertices); - FbxVector4* pControlPoints = pFBXMesh->GetControlPoints(); - - for (int i = 0; i < numVertices; ++i) - { - const Export::Vector3D& vertex = pVerts[i]; - pControlPoints[i] = FbxVector4(vertex.x, vertex.y, vertex.z); - } - - /* - // We want to have one normal for each vertex (or control point), - // so we set the mapping mode to eBY_CONTROL_POINT. - FbxGeometryElementNormal* lElementNormal= pFBXMesh->CreateElementNormal(); - - //FbxVector4 lNormalZPos(0, 0, 1); - - lElementNormal->SetMappingMode(FbxGeometryElement::eBY_CONTROL_POINT); - - // Set the normal values for every control point. - lElementNormal->SetReferenceMode(FbxGeometryElement::eDIRECT); - - lElementNormal->GetDirectArray().Add(lNormalZPos); - */ - - - int numTexCoords = pObj->GetTexCoordCount(); - const Export::UV* pTextCoords = pObj->GetTexCoordBuffer(); - if (numTexCoords) - { - // Create UV for Diffuse channel. - FbxGeometryElementUV* pFBXDiffuseUV = pFBXMesh->CreateElementUV("DiffuseUV"); - FBX_ASSERT(pFBXDiffuseUV != NULL); - - pFBXDiffuseUV->SetMappingMode(FbxGeometryElement::eByPolygonVertex); - pFBXDiffuseUV->SetReferenceMode(FbxGeometryElement::eIndexToDirect); - - for (int i = 0; i < numTexCoords; ++i) - { - const Export::UV& textCoord = pTextCoords[i]; - pFBXDiffuseUV->GetDirectArray().Add(FbxVector2(textCoord.u, textCoord.v)); - } - - //Now we have set the UVs as eINDEX_TO_DIRECT reference and in eBY_POLYGON_VERTEX mapping mode - //we must update the size of the index array. - pFBXDiffuseUV->GetIndexArray().SetCount(numTexCoords); - } - - pFBXMesh->ReservePolygonCount(numAllFaces); - pFBXMesh->ReservePolygonVertexCount(numAllFaces * 3); - - // Set material mapping. - FbxGeometryElementMaterial* pMaterialElement = pFBXMesh->CreateElementMaterial(); - pMaterialElement->SetMappingMode(FbxGeometryElement::eByPolygon); - pMaterialElement->SetReferenceMode(FbxGeometryElement::eIndexToDirect); - - for (int j = 0; j < numMeshes; ++j) - { - const Export::Mesh* pMesh = pObj->GetMesh(j); - - // Write all faces, convert the indices to one based indices - int numFaces = pMesh->GetFaceCount(); - - int polygonCount = pFBXMesh->GetPolygonCount(); - pMaterialElement->GetIndexArray().SetCount(polygonCount + numFaces); - int materialIndex = m_meshMaterialIndices[pMesh]; - - const Export::Face* pFaces = pMesh->GetFaceBuffer(); - for (int i = 0; i < numFaces; ++i) - { - const Export::Face& face = pFaces[i]; - pFBXMesh->BeginPolygon(-1, -1, -1, false); - - pFBXMesh->AddPolygon(face.idx[0], face.idx[0]); - pFBXMesh->AddPolygon(face.idx[1], face.idx[1]); - pFBXMesh->AddPolygon(face.idx[2], face.idx[2]); - - //pFBXDiffuseUV->GetIndexArray().SetAt(face.idx[0], face.idx[0]); - - pFBXMesh->EndPolygon(); - //pPolygonGroupElement->GetIndexArray().Add(j); - - pMaterialElement->GetIndexArray().SetAt(polygonCount + i, materialIndex); - } - } - - return pFBXMesh; -} - - -FbxFileTexture* CFBXExporter::CreateFBXTexture(const char* pTypeName, const char* pName) -{ - std::string filename = pName; - - if (m_settings.bCopyTextures) - { - // check if file exists - QFileInfo fi(pName); - if (!fi.exists() || fi.isDir()) - { - GetIEditor()->GetSystem()->GetILog()->LogError("\nFBX Exporter: Texture %s is not on the disk.", pName); - } - else - { - filename = m_path; - filename += GetFileName(pName); - if (QFile::copy(pName, filename.c_str())) - { - GetIEditor()->GetSystem()->GetILog()->Log("\nFBX Exporter: Texture %s was copied.", pName); - } - filename = GetFileName(pName); // It works for Maya, but not good for MAX - } - } - - FbxFileTexture* pFBXTexture = FbxFileTexture::Create(m_pFBXManager, pTypeName); - pFBXTexture->SetFileName(filename.c_str()); - pFBXTexture->SetTextureUse(FbxTexture::eStandard); - pFBXTexture->SetMappingType(FbxTexture::eUV); - pFBXTexture->SetMaterialUse(FbxFileTexture::eModelMaterial); - pFBXTexture->SetSwapUV(false); - pFBXTexture->SetTranslation(0.0, 0.0); - pFBXTexture->SetScale(1.0, 1.0); - pFBXTexture->SetRotation(0.0, 0.0); - - return pFBXTexture; -} - - -FbxSurfaceMaterial* CFBXExporter::CreateFBXMaterial(const std::string& name, const Export::Mesh* pMesh) -{ - auto it = m_materials.find(name); - if (it != m_materials.end()) - { - return it->second; - } - - FbxSurfacePhong* pMaterial = FbxSurfacePhong::Create(m_pFBXManager, name.c_str()); - - pMaterial->Diffuse.Set(FbxDouble3(pMesh->material.diffuse.r, pMesh->material.diffuse.g, pMesh->material.diffuse.b)); - pMaterial->DiffuseFactor.Set(1.0); - pMaterial->Specular.Set(FbxDouble3(pMesh->material.specular.r, pMesh->material.specular.g, pMesh->material.specular.b)); - pMaterial->SpecularFactor.Set(1.0); - - // Opacity - pMaterial->TransparentColor.Set(FbxDouble3(1.0f, 1.0f, 1.0f)); // need explicitly setup - pMaterial->TransparencyFactor.Set(1.0f - pMesh->material.opacity); - - // Glossiness - // CRC TODO: Why was this commented out? - //pMaterial->Shininess.Set(pow(2, pMesh->material.shininess * 10)); - - if (pMesh->material.mapDiffuse[0] != '\0') - { - FbxFileTexture* pFBXTexture = CreateFBXTexture("Diffuse", pMesh->material.mapDiffuse); - pMaterial->Diffuse.ConnectSrcObject(pFBXTexture); - } - - if (pMesh->material.mapSpecular[0] != '\0') - { - FbxFileTexture* pFBXTexture = CreateFBXTexture("Specular", pMesh->material.mapSpecular); - pMaterial->Specular.ConnectSrcObject(pFBXTexture); - } - - if (pMesh->material.mapOpacity[0] != '\0') - { - FbxFileTexture* pFBXTexture = CreateFBXTexture("Opacity", pMesh->material.mapOpacity); - pMaterial->TransparentColor.ConnectSrcObject(pFBXTexture); - } - // CRC TODO: Why was this commented out? - /* - if (pMesh->material.mapBump[0] != '\0') - { - FbxFileTexture* pFBXTexture = CreateFBXTexture("Bump", pMesh->material.mapBump); - pMaterial->Bump.ConnectSrcObject(pFBXTexture); - } - */ - - if (pMesh->material.mapDisplacement[0] != '\0') - { - FbxFileTexture* pFBXTexture = CreateFBXTexture("Displacement", pMesh->material.mapDisplacement); - pMaterial->DisplacementColor.ConnectSrcObject(pFBXTexture); - } - - m_materials[name] = pMaterial; - - return pMaterial; -} - - -FbxNode* CFBXExporter::CreateFBXAnimNode(FbxScene* pScene, FbxAnimLayer* pAnimBaseLayer, const Export::Object* pObj) -{ - FbxNode* pAnimNode = FbxNode::Create(pScene, pObj->name); - pAnimNode->LclTranslation.GetCurveNode(pAnimBaseLayer, true); - pAnimNode->LclRotation.GetCurveNode(pAnimBaseLayer, true); - pAnimNode->LclScaling.GetCurveNode(pAnimBaseLayer, true); - - FbxCamera* pCamera = FbxCamera::Create(pScene, pObj->name); - - if (pObj->entityType == Export::eCamera) - { - pCamera->SetApertureMode(FbxCamera::eHorizontal); - pCamera->SetFormat(FbxCamera::eCustomFormat); - pCamera->SetAspect(FbxCamera::eFixedRatio, 1.777778f, 1.0); - - pAnimNode->SetNodeAttribute(pCamera); - - if (pObj->cameraTargetNodeName[0]) - { - for (int i = 0; i < m_nodes.size(); ++i) - { - FbxNode* pCameraTargetNode = m_nodes[i]; - const char* nodeName = pCameraTargetNode->GetName(); - if (strcmp(nodeName, pObj->cameraTargetNodeName) == 0) - { - FbxMarker* pMarker = FbxMarker::Create(pScene, ""); - pCameraTargetNode->SetNodeAttribute(pMarker); - pAnimNode->SetTarget(pCameraTargetNode); - } - } - } - } - - if (pObj->GetEntityAnimationDataCount() > 0) - { - int animDataCount = pObj->GetEntityAnimationDataCount(); - - for (int animDataIndex = 0; animDataIndex < animDataCount; ++animDataIndex) - { - const Export::EntityAnimData* pAnimData = pObj->GetEntityAnimationData(animDataIndex); - - FbxTime time = 0; - time.SetSecondDouble(pAnimData->keyTime); - - FbxAnimCurve* pCurve = NULL; - - switch (pAnimData->dataType) - { - case Export::AnimParamType::PositionX: - pCurve = pAnimNode->LclTranslation.GetCurve(pAnimBaseLayer, "X", true); - break; - case Export::AnimParamType::PositionY: - pCurve = pAnimNode->LclTranslation.GetCurve(pAnimBaseLayer, "Y", true); - break; - case Export::AnimParamType::PositionZ: - pCurve = pAnimNode->LclTranslation.GetCurve(pAnimBaseLayer, "Z", true); - break; - case Export::AnimParamType::RotationX: - pCurve = pAnimNode->LclRotation.GetCurve(pAnimBaseLayer, "X", true); - break; - case Export::AnimParamType::RotationY: - pCurve = pAnimNode->LclRotation.GetCurve(pAnimBaseLayer, "Y", true); - break; - case Export::AnimParamType::RotationZ: - pCurve = pAnimNode->LclRotation.GetCurve(pAnimBaseLayer, "Z", true); - break; - case Export::AnimParamType::FOV: - { - pCurve = pCamera->FieldOfView.GetCurve(pAnimBaseLayer, "FieldOfView", true); - } - break; - - default: - break; - } - - if (pCurve) - { - int keyIndex = 0; - - pCurve->KeyModifyBegin(); - keyIndex = pCurve->KeyInsert(time); - pCurve->KeySet(keyIndex, time, pAnimData->keyValue, FbxAnimCurveDef::eInterpolationCubic, FbxAnimCurveDef::eTangentBreak, pAnimData->rightTangent, pAnimData->leftTangent, FbxAnimCurveDef::eWeightedAll, pAnimData->rightTangentWeight, pAnimData->leftTangentWeight); - - pCurve->KeySetLeftDerivative(keyIndex, pAnimData->leftTangent); - pCurve->KeySetRightDerivative(keyIndex, pAnimData->rightTangent); - - pCurve->KeySetLeftTangentWeight(keyIndex, pAnimData->leftTangentWeight); - pCurve->KeySetRightTangentWeight(keyIndex, pAnimData->rightTangentWeight); - - FbxAnimCurveTangentInfo keyLeftInfo; - keyLeftInfo.mAuto = 0; - keyLeftInfo.mDerivative = pAnimData->leftTangent; - keyLeftInfo.mWeight = pAnimData->leftTangentWeight; - keyLeftInfo.mWeighted = true; - keyLeftInfo.mVelocity = 0.0f; - keyLeftInfo.mHasVelocity = false; - - FbxAnimCurveTangentInfo keyRightInfo; - keyRightInfo.mAuto = 0; - keyRightInfo.mDerivative = pAnimData->rightTangent; - keyRightInfo.mWeight = pAnimData->rightTangentWeight; - keyRightInfo.mWeighted = true; - keyRightInfo.mVelocity = 0.0f; - keyRightInfo.mHasVelocity = false; - - pCurve->KeySetLeftDerivativeInfo(keyIndex, keyLeftInfo); - pCurve->KeySetRightDerivativeInfo(keyIndex, keyRightInfo); - - pCurve->KeyModifyEnd(); - } - } - } - - return pAnimNode; -} - -FbxNode* CFBXExporter::CreateFBXNode(const Export::Object* pObj) -{ - if (!m_pFBXManager) - { - return 0; - } - - // create a FbxNode - FbxNode* pNode = FbxNode::Create(m_pFBXManager, pObj->name); - pNode->LclTranslation.Set(FbxVector4(pObj->pos.x, pObj->pos.y, pObj->pos.z)); - - // Rotation: Create Euler angels from quaternion throughout a matrix - FbxAMatrix rotMat; - rotMat.SetQ(FbxQuaternion(pObj->rot.v.x, pObj->rot.v.y, pObj->rot.v.z, pObj->rot.w)); - pNode->LclRotation.Set(rotMat.GetR()); - - pNode->LclScaling.Set(FbxVector4(pObj->scale.x, pObj->scale.y, pObj->scale.z)); - - - // collect materials - int materialIndex = 0; - if (pObj->GetMeshCount() != 0 && pObj->materialName[0] != '\0') - { - for (int i = 0; i < pObj->GetMeshCount(); ++i) - { - const Export::Mesh* pMesh = pObj->GetMesh(i); - - if (pMesh->material.name[0] == '\0') - { - continue; - } - - // find if material was created for this object - int findIndex = -1; - for (int j = 0; j < i; ++j) - { - const Export::Mesh* pTestMesh = pObj->GetMesh(j); - if (!strcmp(pTestMesh->material.name, pMesh->material.name)) - { - findIndex = m_meshMaterialIndices[pTestMesh]; - break; - } - } - - if (findIndex != -1) - { - m_meshMaterialIndices[pMesh] = findIndex; - continue; - } - - std::string materialName = pObj->materialName; - if (strcmp(pObj->materialName, pMesh->material.name)) - { - materialName += ':'; - materialName += pMesh->material.name; - } - - FbxSurfaceMaterial* pFBXMaterial = CreateFBXMaterial(materialName, pMesh); - if (pFBXMaterial) - { - pNode->AddMaterial(pFBXMaterial); - m_meshMaterialIndices[pMesh] = materialIndex++; - } - } - } - - - FbxMesh* pFBXMesh = CreateFBXMesh(pObj); - if (pFBXMesh) - { - pNode->SetNodeAttribute(pFBXMesh); - pNode->SetShadingMode(FbxNode::eTextureShading); - } - - return pNode; -} - -void CFBXExporter::Release() -{ - delete this; -} - -inline f32 Maya2SandboxFOVDeg(const f32 fov, const f32 ratio) { return RAD2DEG(2.0f * atanf(tan(DEG2RAD(fov) / 2.0f) / ratio)); }; - -void CFBXExporter::FillAnimationData(Export::Object* pObject, FbxNode* pNode, [[maybe_unused]] FbxAnimLayer* pAnimLayer, FbxAnimCurve* pCurve, Export::AnimParamType paramType) -{ - if (pCurve) - { - for (int keyID = 0; keyID < pCurve->KeyGetCount(); ++keyID) - { - Export::EntityAnimData entityData; - - FbxAnimCurveKey key = pCurve->KeyGet(keyID); - entityData.keyValue = key.GetValue(); - FbxTime time = key.GetTime(); - entityData.keyTime = aznumeric_cast(time.GetSecondDouble()); - - entityData.leftTangent = pCurve->KeyGetLeftDerivative(keyID); - entityData.rightTangent = pCurve->KeyGetRightDerivative(keyID); - entityData.leftTangentWeight = pCurve->KeyGetLeftTangentWeight(keyID); - entityData.rightTangentWeight = pCurve->KeyGetRightTangentWeight(keyID); - - if (paramType == Export::AnimParamType::FocalLength && pNode && pNode->GetCamera()) - { - // special handling for Focal Length - we convert it to FoV for use in-engine (including switching the paramType) - // We handle this because Maya 2015 doesn't save Angle of View or Field of View animation in FBX - it only uses FocalLength. - entityData.dataType = Export::AnimParamType::FOV; - // Open 3D Engine field of view is the vertical angle - pNode->GetCamera()->SetApertureMode(FbxCamera::eVertical); - entityData.keyValue = aznumeric_cast(pNode->GetCamera()->ComputeFieldOfView(entityData.keyValue)); - } - else - { - entityData.dataType = paramType; - } - - // If the Exporter is Sandbox or Maya, convert fov, positions - QString exporterName = m_pFBXScene->GetDocumentInfo()->Original_ApplicationName.Get().Buffer(); - - if (!exporterName.toLower().contains("3ds")) - { - if (paramType == Export::AnimParamType::PositionX || paramType == Export::AnimParamType::PositionY || paramType == Export::AnimParamType::PositionZ) - { - entityData.rightTangent /= 100.0f; - entityData.leftTangent /= 100.0f; - entityData.keyValue /= 100.0f; - } - else if (paramType == Export::AnimParamType::FOV) // Maya 2015 uses FocalLength instead of FoV - assuming this is for legacy Sandbox or Maya? - { - const float kAspectRatio = 1.777778f; - entityData.keyValue = Maya2SandboxFOVDeg(entityData.keyValue, kAspectRatio); - } - } - - pObject->SetEntityAnimationData(entityData); - } - } -} - - -bool CFBXExporter::ImportFromFile(const char* filename, Export::IData* pData) -{ - FbxManager* pFBXManager = FbxManager::Create(); - - FbxScene* pFBXScene = FbxScene::Create(pFBXManager, "Test"); - m_pFBXScene = pFBXScene; - pFBXScene->GetGlobalSettings().SetAxisSystem(FbxAxisSystem::Max); - pFBXScene->GetGlobalSettings().SetOriginalUpAxis(FbxAxisSystem::Max); - - FbxImporter* pImporter = FbxImporter::Create(pFBXManager, ""); - - FbxIOSettings* pSettings = FbxIOSettings::Create(pFBXManager, IOSROOT); - - pFBXManager->SetIOSettings(pSettings); - pSettings->SetBoolProp(IMP_FBX_ANIMATION, true); - - const bool lImportStatus = pImporter->Initialize(filename, -1, pFBXManager->GetIOSettings()); - if (!lImportStatus) - { - return false; - } - - bool bLoadStatus = pImporter->Import(pFBXScene); - - if (!bLoadStatus) - { - return false; - } - - // record the original axis system used in the import file and then convert the file to Open 3D Engine's coord system, - // which matches Max's (Z-Up, negative Y-forward cameras) - int upSign = 1; - FbxAxisSystem importFileAxisSystem = pFBXScene->GetGlobalSettings().GetAxisSystem(); - FbxAxisSystem::EUpVector importSceneUpVector = importFileAxisSystem.GetUpVector(upSign); - FbxAxisSystem::Max.ConvertScene(pFBXScene); - - QString exporterName = pFBXScene->GetDocumentInfo()->Original_ApplicationName.Get().Buffer(); - // const bool fromMaya = (exporterName.contains("maya", Qt::CaseInsensitive)); - // const bool fromMax = (exporterName.contains("max", Qt::CaseInsensitive)); - - FbxNode* pRootNode = pFBXScene->GetRootNode(); - - if (pRootNode) - { - for (int animStackID = 0; animStackID < pFBXScene->GetSrcObjectCount(); ++animStackID) - { - FbxAnimStack* pAnimStack = pFBXScene->GetSrcObject(animStackID); - const int animLayersCount = pAnimStack->GetMemberCount(); - - for (int layerID = 0; layerID < animLayersCount; ++layerID) - { - FbxAnimLayer* pAnimLayer = pAnimStack->GetMember(layerID); - - const int nodeCount = pRootNode->GetChildCount(); - - for (int nodeID = 0; nodeID < nodeCount; ++nodeID) - { - FbxNode* pNode = pRootNode->GetChild(nodeID); - - if (pNode) - { - FbxAnimCurve* pCurve = 0; - Export::Object* pObject = pData->AddObject(pNode->GetName()); - - if (pObject) - { - azstrncpy(pObject->name, sizeof(pObject->name), pNode->GetName(), sizeof(pObject->name) - 1); - pObject->name[sizeof(pObject->name) - 1] = '\0'; - - FbxCamera* pCamera = pNode->GetCamera(); - - // convert animation for Y-Up scenes and for Z-forward Cameras - if (importSceneUpVector == FbxAxisSystem::eYAxis || pCamera) - { - pNode->SetPivotState(FbxNode::eSourcePivot, FbxNode::ePivotActive); - pNode->SetPivotState(FbxNode::eDestinationPivot, FbxNode::ePivotActive); - - if (importSceneUpVector == FbxAxisSystem::eYAxis) - { - // Maps RY to -RZ and RZ to RY - pNode->SetPreRotation(FbxNode::eSourcePivot, s_PRE_ROTATION_FOR_YUP_SCENES); - } - - if (pCamera) - { - // Converts Y-Up, -Z-forward cameras to Open 3D Engine Z-Up, Y-forward cameras - // It is needed regardless of the scene up vector - pNode->SetPostRotation(FbxNode::eSourcePivot, s_POST_ROTATION_FOR_ZFORWARD_CAMERAS); - } - else - { - // Objects from a Y-Up scene (i.e. not cameras). 'undo' the extra transform that the Open 3D Engine Tool - // bakes in to .cgf files from YUp scenes. - pNode->SetPostRotation(FbxNode::eSourcePivot, s_POST_ROTATION_FOR_YUP_OBJECTS); - } - - // bake the pre/post rotations into the anim curves - pNode->ConvertPivotAnimationRecursive(pAnimStack, FbxNode::eSourcePivot, s_CONVERSION_BAKING_SAMPLE_RATE); - } - - if (pCamera) - { - // extract specialized channels for cameras - pCurve = pCamera->FocalLength.GetCurve(pAnimLayer, "FocalLength"); - FillAnimationData(pObject, pNode, pAnimLayer, pCurve, Export::AnimParamType::FocalLength); - pCurve = pCamera->FieldOfView.GetCurve(pAnimLayer, "FieldOfView", true); - FillAnimationData(pObject, pNode, pAnimLayer, pCurve, Export::AnimParamType::FOV); - } - - pCurve = pNode->LclTranslation.GetCurve(pAnimLayer, "X"); - FillAnimationData(pObject, pNode, pAnimLayer, pCurve, Export::AnimParamType::PositionX); - pCurve = pNode->LclTranslation.GetCurve(pAnimLayer, "Y"); - FillAnimationData(pObject, pNode, pAnimLayer, pCurve, Export::AnimParamType::PositionY); - pCurve = pNode->LclTranslation.GetCurve(pAnimLayer, "Z"); - FillAnimationData(pObject, pNode, pAnimLayer, pCurve, Export::AnimParamType::PositionZ); - pCurve = pNode->LclRotation.GetCurve(pAnimLayer, "X"); - FillAnimationData(pObject, pNode, pAnimLayer, pCurve, Export::AnimParamType::RotationX); - pCurve = pNode->LclRotation.GetCurve(pAnimLayer, "Y"); - FillAnimationData(pObject, pNode, pAnimLayer, pCurve, Export::AnimParamType::RotationY); - pCurve = pNode->LclRotation.GetCurve(pAnimLayer, "Z"); - FillAnimationData(pObject, pNode, pAnimLayer, pCurve, Export::AnimParamType::RotationZ); - } - } - } - } - } - } - - return true; -} diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXExporter.h b/Code/Sandbox/Plugins/FBXPlugin/FBXExporter.h deleted file mode 100644 index 266de76a7d..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXExporter.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -// Description : Export geometry to FBX file format - - -#ifndef CRYINCLUDE_FBXPLUGIN_FBXEXPORTER_H -#define CRYINCLUDE_FBXPLUGIN_FBXEXPORTER_H - -#pragma once -#include -#include "fbxsdk.h" - -struct SFBXSettings -{ - bool bCopyTextures; - bool bEmbedded; - bool bAsciiFormat; - bool bConvertAxesForMaxMaya; -}; - -class CFBXExporter - : public IExporter -{ -public: - CFBXExporter(); - - virtual const char* GetExtension() const; - virtual const char* GetShortDescription() const; - virtual bool ExportToFile(const char* filename, const Export::IData* pData); - virtual bool ImportFromFile(const char* filename, Export::IData* pData); - virtual void Release(); - -private: - // recursively traverse all nodes under pNode and reset prerotations for camera nodes by calling convertCameraForMaxMaya on them - void convertCamerasForMaxMaya(FbxNode* node) const; - // reset prerotations for a specified nodes if it's a camera - void convertCameraForMaxMaya(FbxNode* pNode) const; - - FbxMesh* CreateFBXMesh(const Export::Object* pObj); - FbxFileTexture* CreateFBXTexture(const char* pTypeName, const char* pName); - FbxSurfaceMaterial* CreateFBXMaterial(const std::string& name, const Export::Mesh* pMesh); - FbxNode* CreateFBXNode(const Export::Object* pObj); - FbxNode* CreateFBXAnimNode(FbxScene* pScene, FbxAnimLayer* pCameraAnimBaseLayer, const Export::Object* pObj); - void FillAnimationData(Export::Object* pObject, FbxNode* pNode, FbxAnimLayer* pAnimLayer, FbxAnimCurve* pCurve, Export::AnimParamType paramType); - - FbxManager* m_pFBXManager; - SFBXSettings m_settings; - FbxScene* m_pFBXScene; - std::string m_path; - std::vector m_nodes; - std::map m_materials; - std::map m_meshMaterialIndices; -}; -#endif // CRYINCLUDE_FBXPLUGIN_FBXEXPORTER_H diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.cpp b/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.cpp deleted file mode 100644 index 0d51889b9d..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "FBXPlugin_precompiled.h" -#include "FBXPlugin.h" - -namespace PluginInfo -{ - const char* kName = "FBX Exporter"; - const char* kGUID = "{6CD02F95-362C-4ADF-8BAE-87C6342A8027}"; - const int kVersion = 1; -} - -void CFBXPlugin::Release() -{ - delete this; -} - -void CFBXPlugin::ShowAbout() -{ -} - -const char* CFBXPlugin::GetPluginGUID() -{ - return PluginInfo::kGUID; -} - -DWORD CFBXPlugin::GetPluginVersion() -{ - return PluginInfo::kVersion; -} - -const char* CFBXPlugin::GetPluginName() -{ - return PluginInfo::kName; -} - -bool CFBXPlugin::CanExitNow() -{ - return true; -} - -void CFBXPlugin::Serialize([[maybe_unused]] FILE* hFile, [[maybe_unused]] bool bIsStoring) -{ -} - -void CFBXPlugin::ResetContent() -{ -} - -bool CFBXPlugin::CreateUIElements() -{ - return true; -} - -void CFBXPlugin::OnEditorNotify([[maybe_unused]] EEditorNotifyEvent aEventId) -{ -} diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.h b/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.h deleted file mode 100644 index 30579d6d1d..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#pragma once -//////////////////////////////////////////////////////////////////////////// -// -// Crytek Engine Source File. -// Copyright (C), Crytek Studios, 2001-2012 -// ------------------------------------------------------------------------- -// Created: 24 June 2011 by Sergiy Shaykin. -// Description: Attachment to the Sandbox plug-in system -// -//////////////////////////////////////////////////////////////////////////// -#ifndef CRYINCLUDE_FBXPLUGIN_FBXPLUGIN_H -#define CRYINCLUDE_FBXPLUGIN_FBXPLUGIN_H -#include - -class CFBXPlugin - : public IPlugin -{ -public: - void Release(); - void ShowAbout(); - const char* GetPluginGUID(); - DWORD GetPluginVersion(); - const char* GetPluginName(); - bool CanExitNow(); - void Serialize(FILE* hFile, bool bIsStoring); - void ResetContent(); - bool CreateUIElements(); - void OnEditorNotify(EEditorNotifyEvent aEventId); -}; -#endif // CRYINCLUDE_FBXPLUGIN_FBXPLUGIN_H diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.rc b/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.rc deleted file mode 100644 index c681b1ea64..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin.rc +++ /dev/null @@ -1,104 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_FBX_EXPORT_SETTINGS DIALOGEX 0, 0, 202, 96 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_TOOLWINDOW -CAPTION "FBX Export Settings" -FONT 8, "MS Shell Dlg", 400, 0, 0x0 -BEGIN - CONTROL "Copy textures into folder with FBX file",IDC_COPY_TEXTURES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,11,137,10 - CONTROL "Embedded data (Put textures inside FBX file)",IDC_EMBEDDED, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,25,157,10 - COMBOBOX IDC_FILE_FORMAT,71,53,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "OK",IDOK,88,75,50,14 - PUSHBUTTON "Cancel",IDCANCEL,140,75,50,14 - LTEXT "File Format:",IDC_STATIC,15,55,39,8 - CONTROL "Convert Cameras for Max/Maya",IDC_CONVERT_CAMERAS_FOR_MAX_MAYA, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,39,137,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_FBX_EXPORT_SETTINGS, DIALOG - BEGIN - LEFTMARGIN, 6 - RIGHTMARGIN, 190 - TOPMARGIN, 7 - BOTTOMMARGIN, 89 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin_precompiled.cpp b/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin_precompiled.cpp deleted file mode 100644 index cedec4fe05..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin_precompiled.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "FBXPlugin_precompiled.h" - diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin_precompiled.h b/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin_precompiled.h deleted file mode 100644 index da268110a8..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXPlugin_precompiled.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#pragma once - -#include - -#include "resource.h" - -///////////////////////////////////////////////////////////////////////////// -// CRY Stuff //////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -#include - - -///////////////////////////////////////////////////////////////////////////// -// STL -///////////////////////////////////////////////////////////////////////////// -#include -#include -#include - -///////////////////////////////////////////////////////////////////////////// -// CRY Stuff //////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -#include -#include "Util/EditorUtils.h" - -#include "EditorCoreAPI.h" diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.cpp b/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.cpp deleted file mode 100644 index 9766288b5a..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "FBXPlugin_precompiled.h" -#include "FBXSettingsDlg.h" -#include "FBXExporter.h" -#include "resource.h" - -#include - -#include - -#include "ui_FBXSettingsDlg.h" - -bool OpenFBXSettingsDlg(struct SFBXSettings& settings) -{ - Ui::FBXSettingsDialog ui; - QDialog dialog(GetIEditor()->GetEditorMainWindow()); - ui.setupUi(&dialog); - - ui.hCopyTextures->setChecked(settings.bCopyTextures); - ui.hEmbedded->setChecked(settings.bEmbedded); - ui.hFileFormat->setCurrentIndex(settings.bAsciiFormat ? 1 : 0); - ui.hConvertAxesForMaxMaya->setChecked(settings.bConvertAxesForMaxMaya); - - if (dialog.exec() != QDialog::Accepted) - return false; - - settings.bCopyTextures = ui.hCopyTextures->isChecked(); - settings.bEmbedded = ui.hEmbedded->isChecked(); - settings.bAsciiFormat = ui.hFileFormat->currentIndex() == 1; - settings.bConvertAxesForMaxMaya = ui.hConvertAxesForMaxMaya->isChecked(); - - return true; -} diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.h b/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.h deleted file mode 100644 index e9b259234f..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.h +++ /dev/null @@ -1,20 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#ifndef CRYINCLUDE_FBXPLUGIN_FBXSETTINGSDLG_H -#define CRYINCLUDE_FBXPLUGIN_FBXSETTINGSDLG_H - -#pragma once - -bool OpenFBXSettingsDlg(struct SFBXSettings& settings); -#endif // CRYINCLUDE_FBXPLUGIN_FBXSETTINGSDLG_H diff --git a/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.ui b/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.ui deleted file mode 100644 index 8f2367255a..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/FBXSettingsDlg.ui +++ /dev/null @@ -1,109 +0,0 @@ - - - FBXSettingsDialog - - - - 0 - 0 - 313 - 149 - - - - FBX Export Settings - - - - - - Copy textures into folder with FBX file - - - - - - - Embedded data (Put textures inside FBX file) - - - - - - - Convert Cameras for Max/Maya - - - - - - - File Format: - - - hFileFormat - - - - - - - - Bin - - - - - Ascii - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - FBXSettingsDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - FBXSettingsDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/Code/Sandbox/Plugins/FBXPlugin/Platform/Linux/platform_linux.cmake b/Code/Sandbox/Plugins/FBXPlugin/Platform/Linux/platform_linux.cmake deleted file mode 100644 index ed7bdab4b2..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/Platform/Linux/platform_linux.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(PAL_TRAIT_BUILD_FBX_PLUGIN_SUPPORTED FALSE) diff --git a/Code/Sandbox/Plugins/FBXPlugin/Platform/Linux/platform_linux_files.cmake b/Code/Sandbox/Plugins/FBXPlugin/Platform/Linux/platform_linux_files.cmake deleted file mode 100644 index 4d5680a30d..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/Platform/Linux/platform_linux_files.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# diff --git a/Code/Sandbox/Plugins/FBXPlugin/Platform/Mac/platform_mac.cmake b/Code/Sandbox/Plugins/FBXPlugin/Platform/Mac/platform_mac.cmake deleted file mode 100644 index fc4f6ca1b3..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/Platform/Mac/platform_mac.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(PAL_TRAIT_BUILD_FBX_PLUGIN_SUPPORTED TRUE) diff --git a/Code/Sandbox/Plugins/FBXPlugin/Platform/Mac/platform_mac_files.cmake b/Code/Sandbox/Plugins/FBXPlugin/Platform/Mac/platform_mac_files.cmake deleted file mode 100644 index 4d5680a30d..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/Platform/Mac/platform_mac_files.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# diff --git a/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/DllMain_Windows.cpp b/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/DllMain_Windows.cpp deleted file mode 100644 index 7c180714d4..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/DllMain_Windows.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include - -HINSTANCE g_hInstance = NULL; - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, ULONG fdwReason, [[maybe_unused]] LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hinstDLL; - //DisableThreadLibraryCalls(hInstance); - } - - return(TRUE); -} diff --git a/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/platform_windows.cmake b/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/platform_windows.cmake deleted file mode 100644 index fc4f6ca1b3..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/platform_windows.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(PAL_TRAIT_BUILD_FBX_PLUGIN_SUPPORTED TRUE) diff --git a/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/platform_windows_files.cmake b/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/platform_windows_files.cmake deleted file mode 100644 index 7e654edcbe..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/Platform/Windows/platform_windows_files.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(FILES - DllMain_Windows.cpp -) diff --git a/Code/Sandbox/Plugins/FBXPlugin/fbxplugin_files.cmake b/Code/Sandbox/Plugins/FBXPlugin/fbxplugin_files.cmake deleted file mode 100644 index b3cacea11c..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/fbxplugin_files.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(FILES - FBXExporter.cpp - FBXExporter.h - FBXPlugin.cpp - FBXPlugin.h - FBXPlugin.rc - FBXSettingsDlg.cpp - FBXSettingsDlg.h - FBXSettingsDlg.ui - main.cpp - resource.h - FBXPlugin_precompiled.cpp - FBXPlugin_precompiled.h -) diff --git a/Code/Sandbox/Plugins/FBXPlugin/main.cpp b/Code/Sandbox/Plugins/FBXPlugin/main.cpp deleted file mode 100644 index 1949350135..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -// Description : Export geometry to FBX file format - -#include "FBXPlugin_precompiled.h" - -#include "FBXPlugin.h" -#include "FBXExporter.h" - - - -PLUGIN_API IPlugin* CreatePluginInstance(PLUGIN_INIT_PARAM* pInitParam) -{ - if (pInitParam->pluginVersion != SANDBOX_PLUGIN_SYSTEM_VERSION) - { - pInitParam->outErrorCode = IPlugin::eError_VersionMismatch; - return 0; - } - - ModuleInitISystem(GetIEditor()->GetSystem(), "FBX Exporter Plugin"); - - IExportManager* pExportManager = GetIEditor()->GetExportManager(); - if (pExportManager) - { - pExportManager->RegisterExporter(new CFBXExporter()); - } - - GetIEditor()->GetSystem()->GetILog()->Log("FBX plugin: CreatePluginInstance"); - return new CFBXPlugin; -} diff --git a/Code/Sandbox/Plugins/FBXPlugin/resource.h b/Code/Sandbox/Plugins/FBXPlugin/resource.h deleted file mode 100644 index 0784105d96..0000000000 --- a/Code/Sandbox/Plugins/FBXPlugin/resource.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#define IDD_FBX_EXPORT_SETTINGS 103 -#define IDC_COPY_TEXTURES 1003 -#define IDC_EMBEDDED 1004 -#define IDC_FILE_FORMAT 1005 -#define IDC_CONVERT_CAMERAS_FOR_MAX_MAYA 1006 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1007 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Code/Tools/SceneAPI/CMakeLists.txt b/Code/Tools/SceneAPI/CMakeLists.txt index 0dfcbaf9cd..70bfe9e837 100644 --- a/Code/Tools/SceneAPI/CMakeLists.txt +++ b/Code/Tools/SceneAPI/CMakeLists.txt @@ -10,7 +10,7 @@ # add_subdirectory(FbxSceneBuilder) -add_subdirectory(FbxSDKWrapper) add_subdirectory(SceneCore) add_subdirectory(SceneData) add_subdirectory(SceneUI) +add_subdirectory(SDKWrapper) diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveNodeWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveNodeWrapper.cpp deleted file mode 100644 index 78d7c713e0..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveNodeWrapper.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include "FbxAnimCurveNodeWrapper.h" -#include "FbxAnimCurveWrapper.h" -#include "fbxsdk.h" - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxAnimCurveNodeWrapper::FbxAnimCurveNodeWrapper(FbxAnimCurveNode* fbxAnimCurveNode) - : m_fbxAnimCurveNode(fbxAnimCurveNode) - { - } - - const char* FbxAnimCurveNodeWrapper::GetName() const - { - return m_fbxAnimCurveNode->GetName(); - } - - int FbxAnimCurveNodeWrapper::GetChannelCount() const - { - return m_fbxAnimCurveNode->GetChannelsCount(); - } - - int FbxAnimCurveNodeWrapper::GetCurveCount(int channelID) const - { - return m_fbxAnimCurveNode->GetCurveCount(channelID); - } - - AZStd::shared_ptr FbxAnimCurveNodeWrapper::GetCurveWrapper(int channelID, int index) const - { - return AZStd::make_shared(static_cast(m_fbxAnimCurveNode->GetCurve(channelID, index))); - } - } -} diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveNodeWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveNodeWrapper.h deleted file mode 100644 index a1213de32b..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveNodeWrapper.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include "fbxsdk.h" -#include "FbxTimeWrapper.h" -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxAnimCurveWrapper; - - class FbxAnimCurveNodeWrapper - { - public: - FbxAnimCurveNodeWrapper(FbxAnimCurveNode* fbxAnimCurveNode); - ~FbxAnimCurveNodeWrapper() = default; - const char* GetName() const; - int GetChannelCount() const; - int GetCurveCount(int channelID) const; - - AZStd::shared_ptr GetCurveWrapper(int channelID, int index) const; - - protected: - FbxAnimCurveNode* m_fbxAnimCurveNode; - }; - } -} diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.cpp deleted file mode 100644 index e1e32278d9..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxAnimCurveWrapper::FbxAnimCurveWrapper(FbxAnimCurve* fbxAnimCurve) - : m_fbxAnimCurve(fbxAnimCurve) - { - } - - const char* FbxAnimCurveWrapper::GetName() const - { - return m_fbxAnimCurve->GetName(); - } - - float FbxAnimCurveWrapper::Evaluate(FbxTimeWrapper& time) const - { - return m_fbxAnimCurve->Evaluate(time.m_fbxTime); - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.h deleted file mode 100644 index f8793f53cd..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxAnimCurveWrapper - { - public: - FbxAnimCurveWrapper(FbxAnimCurve* fbxAnimCurve); - ~FbxAnimCurveWrapper() = default; - const char* GetName() const; - float Evaluate(FbxTimeWrapper& time) const; - - protected: - FbxAnimCurve* m_fbxAnimCurve; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.cpp deleted file mode 100644 index a99fe05303..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include - -#include "fbxsdk.h" - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxAnimLayerWrapper::FbxAnimLayerWrapper(FbxAnimLayer* fbxAnimLayer) - : m_fbxAnimLayer(fbxAnimLayer) - { - } - - const char* FbxAnimLayerWrapper::GetName() const - { - return m_fbxAnimLayer->GetName(); - } - - u32 FbxAnimLayerWrapper::GetCurveNodeCount() const - { - return static_cast(m_fbxAnimLayer->GetMemberCount()); - } - - FbxAnimLayer* FbxAnimLayerWrapper::GetFbxLayer() const - { - return m_fbxAnimLayer; - } - - AZStd::shared_ptr FbxAnimLayerWrapper::GetCurveNodeWrapper(u32 index) const - { - return AZStd::make_shared(static_cast(m_fbxAnimLayer->GetMember(aznumeric_cast(index)))); - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h deleted file mode 100644 index ace0f7eee0..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxAnimCurveNodeWrapper; - - class FbxAnimLayerWrapper - { - friend class FbxNodeWrapper; - public: - FbxAnimLayerWrapper(FbxAnimLayer* fbxAnimLayer); - ~FbxAnimLayerWrapper() = default; - const char* GetName() const; - u32 GetCurveNodeCount() const ; - FbxAnimLayer* GetFbxLayer() const; - AZStd::shared_ptr GetCurveNodeWrapper(u32 index) const; - - protected: - FbxAnimLayer* m_fbxAnimLayer; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.cpp deleted file mode 100644 index 943bff2bc0..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxAnimStackWrapper::FbxAnimStackWrapper(FbxAnimStack* fbxAnimStack) - : m_fbxAnimStack(fbxAnimStack) - { - AZ_Assert(fbxAnimStack, "Invalid FbxAnimStack input to initialize FbxAnimStackWrapper"); - } - - FbxAnimStackWrapper::~FbxAnimStackWrapper() - { - m_fbxAnimStack = nullptr; - } - - const char* FbxAnimStackWrapper::GetName() const - { - return m_fbxAnimStack->GetName(); - } - - int FbxAnimStackWrapper::GetAnimationLayerCount() const - { - return m_fbxAnimStack->GetMemberCount(); - } - - const AZStd::shared_ptr FbxAnimStackWrapper::GetAnimationLayerAt(int index) const - { - AZ_Assert(index < GetAnimationLayerCount(), "Invalid animation layer index %d for layer count %d", index, GetAnimationLayerCount()); - return AZStd::make_shared(m_fbxAnimStack->GetMember(index)); - } - - FbxTimeSpanWrapper FbxAnimStackWrapper::GetLocalTimeSpan() const - { - return FbxTimeSpanWrapper(m_fbxAnimStack->GetLocalTimeSpan()); - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.h deleted file mode 100644 index 97e1f86324..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - using FbxSDKLongLong = FbxLongLong; - class FbxAnimLayerWrapper; - class FbxTimeSpanWrapper; - - class FbxAnimStackWrapper - { - public: - FbxAnimStackWrapper(FbxAnimStack* fbxAnimStack); - virtual ~FbxAnimStackWrapper(); - - virtual const char* GetName() const; - virtual int GetAnimationLayerCount() const; - virtual const AZStd::shared_ptr GetAnimationLayerAt(int index) const; - virtual FbxTimeSpanWrapper GetLocalTimeSpan() const; - - protected: - FbxAnimStackWrapper() = default; - FbxAnimStack* m_fbxAnimStack; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.cpp deleted file mode 100644 index b957b1105c..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxAxisSystemWrapper::FbxAxisSystemWrapper(const FbxAxisSystem& fbxAxisSystem) - : m_fbxAxisSystem(fbxAxisSystem) - { - } - - FbxAxisSystemWrapper::UpVector FbxAxisSystemWrapper::GetUpVector(int& sign) const - { - switch (m_fbxAxisSystem.GetUpVector(sign)) - { - case FbxAxisSystem::eXAxis: - return X; - case FbxAxisSystem::eYAxis: - return Y; - case FbxAxisSystem::eZAxis: - return Z; - default: - AZ_TraceContext("Unknown value", m_fbxAxisSystem.GetUpVector(sign)); - AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized axis up vector type"); - return Unknown; - } - } - - SceneAPI::DataTypes::MatrixType FbxAxisSystemWrapper::CalculateConversionTransform(UpVector targetUpAxis) - { - FbxAxisSystem targetSystem; - switch (targetUpAxis) - { - case Y: - // Maya YUp coordinate system (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded)) - targetSystem = FbxAxisSystem::MayaYUp; - break; - case Z: - // CryTek ZUp coordinate system (UpVector = +Z, FrontVector = +Y, CoordSystem = -X (RightHanded)) - targetSystem = FbxAxisSystem(FbxAxisSystem::eZAxis, FbxAxisSystem::eParityOdd, FbxAxisSystem::eRightHanded); - break; - case X: - // Default XUp coordinate system (UpVector = +X, FrontVector = +Z, CoordSystem = -Y (RightHanded)) - targetSystem = FbxAxisSystem(FbxAxisSystem::eXAxis, FbxAxisSystem::eParityOdd, FbxAxisSystem::eRightHanded); - break; - default: - AZ_TraceContext("Unknown value", targetUpAxis); - AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized axis conversion target axis type"); - return SceneAPI::DataTypes::MatrixType::CreateIdentity(); - } - FbxAMatrix targetMatrix; - targetSystem.GetMatrix(targetMatrix); - FbxAMatrix currentMatrix; - m_fbxAxisSystem.GetMatrix(currentMatrix); - FbxAMatrix adjustMatrix = targetMatrix * currentMatrix.Inverse(); - return FbxTypeConverter::ToTransform(adjustMatrix); - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.h deleted file mode 100644 index d8dba5068a..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxAxisSystemWrapper - { - public: - enum UpVector - { - X, - Y, - Z, - Unknown - }; - - FbxAxisSystemWrapper() = default; - FbxAxisSystemWrapper(const FbxAxisSystem& fbxAxisSystem); - virtual ~FbxAxisSystemWrapper() = default; - - virtual UpVector GetUpVector(int& sign) const; - virtual SceneAPI::DataTypes::MatrixType CalculateConversionTransform(UpVector targetUpAxis); - - protected: - FbxAxisSystem m_fbxAxisSystem; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.cpp deleted file mode 100644 index 92cf655dbd..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxBlendShapeChannelWrapper::FbxBlendShapeChannelWrapper(FbxBlendShapeChannel* fbxBlendShapeChannel) - : m_fbxBlendShapeChannel(fbxBlendShapeChannel) - { - AZ_Assert(fbxBlendShapeChannel, "Invalid FbxSkin input to initialize FbxBlendShapeChannelWrapper"); - } - - FbxBlendShapeChannelWrapper::~FbxBlendShapeChannelWrapper() - { - m_fbxBlendShapeChannel = nullptr; - } - - const char* FbxBlendShapeChannelWrapper::GetName() const - { - return m_fbxBlendShapeChannel->GetName(); - } - - //The engine currently only supports one target shape. If there are more than one, - //code will ultimately end up just using the max index returned by this function. - int FbxBlendShapeChannelWrapper::GetTargetShapeCount() const - { - return m_fbxBlendShapeChannel->GetTargetShapeCount(); - } - - //While not strictly true that the target shapes are meshes, for the purposes of the engine's - //current runtime they must be meshes. - AZStd::shared_ptr FbxBlendShapeChannelWrapper::GetTargetShape(int index) const - { - //we need to create a duplicate FbxMesh from the base mesh and the target data - //FbxMeshWrapper needs an FbxMesh to point to so we are generating one - //by cloning the mesh data and then replacing with the morph data. - FbxShape* fbxShape = m_fbxBlendShapeChannel->GetTargetShape(index); - if (!fbxShape) - { - return nullptr; - } - - FbxGeometry* fbxGeom = fbxShape->GetBaseGeometry(); - if (fbxGeom && fbxGeom->GetAttributeType() == FbxNodeAttribute::EType::eMesh) - { - FbxMesh* fbxMesh = static_cast(fbxGeom); - FbxMesh* fbxBlendMesh = FbxMesh::Create(m_fbxBlendShapeChannel->GetScene(),""); - fbxBlendMesh->Copy(*fbxMesh); - //TODO: test that mesh is managed by the sdk - const int count = fbxBlendMesh->GetControlPointsCount(); - //set control points from blend shape - for (int i = 0; i < count; i++) - { - fbxBlendMesh->SetControlPointAt(fbxShape->GetControlPointAt(i), i); - } - - //source data - FbxLayerElementArrayTemplate* normalsTemplate; - if (fbxShape->GetNormals(&normalsTemplate)) - { - int normalCount = normalsTemplate->GetCount(); - - //destination data - FbxLayer* normalLayer = fbxBlendMesh->GetLayer(0, FbxLayerElement::eNormal); - if (normalLayer) - { - FbxLayerElementNormal* normals = normalLayer->GetNormals(); - if (normals) - { - //set normal data from blend shape - for (int j = 0; j < normalCount; j++) - { - FbxVector4 normal = normalsTemplate->GetAt(j); - normals->GetDirectArray().SetAt(j, normal); - } - } - } - } - return AZStd::make_shared(fbxBlendMesh); - } - return nullptr; - } - } -} diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.h deleted file mode 100644 index a8f2fffdcc..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxNodeWrapper; - class FbxMeshWrapper; - - class FbxBlendShapeChannelWrapper - { - public: - FbxBlendShapeChannelWrapper(FbxBlendShapeChannel* fbxBlendShapeChannel); - virtual ~FbxBlendShapeChannelWrapper(); - - virtual const char* GetName() const; - virtual int GetTargetShapeCount() const; - - //While not strictly true that the target shapes are meshes, for the purposes of the engine's - //current runtime they must be meshes. - virtual AZStd::shared_ptr GetTargetShape(int index) const; - - protected: - FbxBlendShapeChannelWrapper() = default; - FbxBlendShapeChannel* m_fbxBlendShapeChannel; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.cpp deleted file mode 100644 index ab75613ab5..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxBlendShapeWrapper::FbxBlendShapeWrapper(FbxBlendShape* fbxBlendShape) - : m_fbxBlendShape(fbxBlendShape) - { - AZ_Assert(fbxBlendShape, "Invalid FbxBlendShape input to initialize FbxBlendShapeWrapper"); - } - - FbxBlendShapeWrapper::~FbxBlendShapeWrapper() - { - m_fbxBlendShape = nullptr; - } - - const char* FbxBlendShapeWrapper::GetName() const - { - return m_fbxBlendShape->GetName(); - } - - //Technically Fbx returns a FbxGeometry off this interface, but we only support meshes in the engine runtime. - AZStd::shared_ptr FbxBlendShapeWrapper::GetGeometry() const - { - FbxGeometry* fbxGeom = m_fbxBlendShape->GetGeometry(); - - if (fbxGeom && fbxGeom->GetAttributeType() == FbxNodeAttribute::EType::eMesh ) - { - return AZStd::make_shared(static_cast(fbxGeom)); - } - else - { - return nullptr; - } - } - - int FbxBlendShapeWrapper::GetBlendShapeChannelCount() const - { - return m_fbxBlendShape->GetBlendShapeChannelCount(); - } - - AZStd::shared_ptr FbxBlendShapeWrapper::GetBlendShapeChannel(int index) const - { - FbxBlendShapeChannel* fbxBlendShapeChannel = m_fbxBlendShape->GetBlendShapeChannel(index); - if (fbxBlendShapeChannel) - { - return AZStd::make_shared(fbxBlendShapeChannel); - } - else - { - return nullptr; - } - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.h deleted file mode 100644 index d049f5cec8..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxBlendShapeChannelWrapper; - class FbxNodeWrapper; - class FbxMeshWrapper; - - class FbxBlendShapeWrapper - { - public: - FbxBlendShapeWrapper(FbxBlendShape* fbxBlendShape); - virtual ~FbxBlendShapeWrapper(); - - virtual const char* GetName() const; - //Technically Fbx returns a FbxGeometry off this interface, but we only support meshes in the engine runtime. - virtual AZStd::shared_ptr GetGeometry() const; - virtual int GetBlendShapeChannelCount() const; - virtual AZStd::shared_ptr GetBlendShapeChannel(int index) const; - - protected: - FbxBlendShapeWrapper() = default; - FbxBlendShape* m_fbxBlendShape; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h deleted file mode 100644 index a4eed3f947..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxLayerElementUtilities - { - public: - template - static void GetGeometryElement(ValueType& value, const ElementArrayType* elementArray, - int polygonIndex, int polygonVertexIndex, int controlPointIndex); - }; - } // namespace FbxSDKWrapper -} // namespace AZ - -#include "FbxLayerElementUtilities.inl" diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.inl b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.inl deleted file mode 100644 index eb1d9ef925..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.inl +++ /dev/null @@ -1,74 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - template - void FbxLayerElementUtilities::GetGeometryElement( ValueType& value, const ElementArrayType* elementArray, - int polygonIndex, int polygonVertexIndex, int controlPointIndex) - { - if (!elementArray) - { - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Invalid ElementArrayType input"); - return; - } - - int fbxElementIndex; - switch (elementArray->GetMappingMode()) - { - case FbxGeometryElement::eByControlPoint: - // One mapping coordinate for each surface control point/vertex. - fbxElementIndex = controlPointIndex; - break; - case FbxGeometryElement::eByPolygonVertex: - // One mapping coordinate for each vertex, for every polygon of which it is a part. - // This means that a vertex will have as many mapping coordinates as polygons of which it is a part. - fbxElementIndex = polygonVertexIndex; - break; - case FbxGeometryElement::eByPolygon: - // One mapping coordinate for the whole polygon. - fbxElementIndex = polygonIndex; - break; - default: - AZ_TraceContext("Unknown value", elementArray->GetMappingMode()); - AZ_TracePrintf(AZ::SceneAPI::Utilities::ErrorWindow, "Invalid ElementArrayType mapping mode"); - return; - } - - if (elementArray->GetReferenceMode() == FbxGeometryElement::eIndexToDirect) - { - // Convert index from "index of value's index" to "index of value". - const FbxLayerElementArrayTemplate& indices = elementArray->GetIndexArray(); - AZ_Assert(fbxElementIndex < indices.GetCount(), "Invalid element index %d", fbxElementIndex); - if (fbxElementIndex >= indices.GetCount()) - { - return; - } - fbxElementIndex = indices.GetAt(fbxElementIndex); - } - - const FbxLayerElementArrayTemplate& elements = elementArray->GetDirectArray(); - AZ_Assert(fbxElementIndex < elements.GetCount(), "Invalid element index %d", fbxElementIndex); - if (fbxElementIndex >= elements.GetCount()) - { - return; - } - value = elements.GetAt(fbxElementIndex); - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.cpp deleted file mode 100644 index 37c23bc2cb..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -#include -#include -#include -#include -#include -#include -#include - -namespace -{ - const char* s_physicalisedAttributeName = "physicalize"; - const char* s_proxyNoDraw = "ProxyNoDraw"; -} - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxMaterialWrapper::FbxMaterialWrapper(FbxSurfaceMaterial* fbxMaterial) - : SDKMaterial::MaterialWrapper(fbxMaterial) - { - AZ_Assert(fbxMaterial, "Invalid FbxSurfaceMaterial input to initialize FbxMaterialWrapper"); - } - - AZStd::string FbxMaterialWrapper::GetName() const - { - return m_fbxMaterial->GetInitialName(); - } - - AZ::Vector3 FbxMaterialWrapper::GetDiffuseColor() const - { - if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId)) - { - FbxSurfaceLambert* lambertMat = static_cast(m_fbxMaterial); - const FbxDouble3 fbxValue = lambertMat->Diffuse.Get(); - const float power = static_cast(lambertMat->DiffuseFactor.Get()); - return power * AZ::Vector3(static_cast(fbxValue[0]), static_cast(fbxValue[1]), static_cast(fbxValue[2])); - } - else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId)) - { - FbxSurfacePhong* phongMat = static_cast(m_fbxMaterial); - const FbxDouble3 fbxValue = phongMat->Diffuse.Get(); - const float power = static_cast(phongMat->DiffuseFactor.Get()); - return power * AZ::Vector3(static_cast(fbxValue[0]), static_cast(fbxValue[1]), static_cast(fbxValue[2])); - } - - return AZ::Vector3::CreateOne(); - } - - AZ::Vector3 FbxMaterialWrapper::GetSpecularColor() const - { - if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId)) - { - FbxSurfacePhong* phongMat = static_cast(m_fbxMaterial); - const FbxDouble3 fbxValue = phongMat->Specular.Get(); - const float power = static_cast(phongMat->SpecularFactor.Get()); - return power * AZ::Vector3(static_cast(fbxValue[0]), static_cast(fbxValue[1]), static_cast(fbxValue[2])); - } - - return AZ::Vector3::CreateZero(); - } - - AZ::Vector3 FbxMaterialWrapper::GetEmissiveColor() const - { - if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId)) - { - FbxSurfaceLambert* lambertMat = static_cast(m_fbxMaterial); - const FbxDouble3 fbxValue = lambertMat->Emissive.Get(); - const float power = static_cast(lambertMat->EmissiveFactor.Get()); - return power * AZ::Vector3(static_cast(fbxValue[0]), static_cast(fbxValue[1]), static_cast(fbxValue[2])); - } - else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId)) - { - FbxSurfacePhong* phongMat = static_cast(m_fbxMaterial); - const FbxDouble3 fbxValue = phongMat->Emissive.Get(); - const float power = static_cast(phongMat->EmissiveFactor.Get()); - return power * AZ::Vector3(static_cast(fbxValue[0]), static_cast(fbxValue[1]), static_cast(fbxValue[2])); - } - - return AZ::Vector3::CreateZero(); - } - - float FbxMaterialWrapper::GetShininess() const - { - if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId)) - { - FbxSurfacePhong* phongMat = static_cast(m_fbxMaterial); - return static_cast(phongMat->Shininess.Get()); - } - - return 10.f; - } - - AZ::u64 FbxMaterialWrapper::GetUniqueId() const - { - return m_fbxMaterial->GetUniqueID(); - } - - float FbxMaterialWrapper::GetOpacity() const - { - // FBX materials are erroneously reporting a TransparencyFactor of 1.0 (fully transparent) - // even for values that are 0.0 in Maya. It is instead storing it in the components - // for TransparentColor, so extract from there instead. - - if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId)) - { - FbxSurfaceLambert* lambertMat = static_cast(m_fbxMaterial); - const FbxDouble3 fbxValue = lambertMat->TransparentColor.Get(); - return 1.f - AZ::GetMin(AZ::GetMin(static_cast(fbxValue[0]), static_cast(fbxValue[1])), static_cast(fbxValue[2])); - } - else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId)) - { - FbxSurfacePhong* phongMat = static_cast(m_fbxMaterial); - const FbxDouble3 fbxValue = phongMat->TransparentColor.Get(); - return 1.f - AZ::GetMin(AZ::GetMin(static_cast(fbxValue[0]), static_cast(fbxValue[1])), static_cast(fbxValue[2])); - } - - return 1.f; - } - - AZStd::string FbxMaterialWrapper::GetTextureFileName(const char* textureType) const - { - FbxFileTexture* fileTexture = nullptr; - FbxProperty property = m_fbxMaterial->FindProperty(textureType); - FbxDataType propertyType = property.GetPropertyDataType(); - - /// Engine currently doesn't support multiple textures. Right now we only use first texture of first layer. - int layeredTextureCount = property.GetSrcObjectCount(); - if (layeredTextureCount > 0) - { - FbxLayeredTexture* layeredTexture = FbxCast(property.GetSrcObject(0)); - int textureCount = layeredTexture->GetSrcObjectCount(); - if (textureCount > 0) - { - fileTexture = FbxCast(layeredTexture->GetSrcObject(0)); - } - } - else - { - int textureCount = property.GetSrcObjectCount(); - if (textureCount > 0) - { - fileTexture = FbxCast(property.GetSrcObject(0)); - } - } - - return fileTexture ? fileTexture->GetFileName() : AZStd::string(); - } - - AZStd::string FbxMaterialWrapper::GetTextureFileName(const AZStd::string& textureType) const - { - return GetTextureFileName(textureType.c_str()); - } - - AZStd::string FbxMaterialWrapper::GetTextureFileName(MaterialMapType textureType) const - { - switch (textureType) - { - case MaterialMapType::Diffuse: - return GetTextureFileName(FbxSurfaceMaterial::sDiffuse); - case MaterialMapType::Specular: - return GetTextureFileName(FbxSurfaceMaterial::sSpecular); - case MaterialMapType::Bump: - return GetTextureFileName(FbxSurfaceMaterial::sBump); - case MaterialMapType::Normal: - return GetTextureFileName(FbxSurfaceMaterial::sNormalMap); - default: - AZ_TraceContext("Unknown value", aznumeric_cast(textureType)); - AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized MaterialMapType retrieved"); - return AZStd::string(); - } - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.h deleted file mode 100644 index 0f195b939d..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxMaterialWrapper : public SDKMaterial::MaterialWrapper - { - public: - AZ_RTTI(FbxMaterialWrapper, "{227582F6-93BC-4E44-823E-FB1D631443A7}", SDKMaterial::MaterialWrapper); - - FbxMaterialWrapper(FbxSurfaceMaterial* fbxMaterial); - ~FbxMaterialWrapper() override = default; - - AZStd::string GetName() const override; - virtual AZStd::string GetTextureFileName(const char* textureType) const; - virtual AZStd::string GetTextureFileName(const AZStd::string& textureType) const; - AZStd::string GetTextureFileName(MaterialMapType textureType) const override; - - AZ::Vector3 GetDiffuseColor() const override; - AZ::Vector3 GetSpecularColor() const override; - AZ::Vector3 GetEmissiveColor() const override; - float GetOpacity() const override; - float GetShininess() const override; - AZ::u64 GetUniqueId() const override; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMeshWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMeshWrapper.cpp deleted file mode 100644 index b6778153c2..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMeshWrapper.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxMeshWrapper::FbxMeshWrapper(FbxMesh* fbxMesh) - : m_fbxMesh(fbxMesh) - { - AZ_Assert(fbxMesh, "Invalid FbxMesh input to initialize FbxMeshWrapper"); - } - - FbxMeshWrapper::~FbxMeshWrapper() - { - m_fbxMesh = nullptr; - } - - const char* FbxMeshWrapper::GetName() const - { - return m_fbxMesh->GetName(); - } - - int FbxMeshWrapper::GetDeformerCount() const - { - return m_fbxMesh->GetDeformerCount(); - } - - int FbxMeshWrapper::GetDeformerCount(int type) const - { - return m_fbxMesh->GetDeformerCount(static_cast(type)); - } - - int FbxMeshWrapper::GetControlPointsCount() const - { - return m_fbxMesh->GetControlPointsCount(); - } - - AZStd::vector FbxMeshWrapper::GetControlPoints() const - { - FbxVector4* controlPoints = m_fbxMesh->GetControlPoints(); - AZStd::vector azControlPoints; - azControlPoints.reserve(aznumeric_caster(GetControlPointsCount())); - for (int i = 0; i < GetControlPointsCount(); ++i) - { - azControlPoints.push_back(FbxTypeConverter::ToVector3(controlPoints[i])); - } - return azControlPoints; - } - - AZStd::shared_ptr FbxMeshWrapper::GetSkin(int index) const - { - FbxSkin* skin = static_cast(m_fbxMesh->GetDeformer(index, FbxDeformer::eSkin)); - return skin ? AZStd::make_shared(skin) : nullptr; - } - - AZStd::shared_ptr FbxMeshWrapper::GetBlendShape(int index) const - { - FbxBlendShape* blendShape = static_cast(m_fbxMesh->GetDeformer(index, FbxDeformer::eBlendShape)); - return blendShape ? AZStd::make_shared(blendShape) : nullptr; - } - - int FbxMeshWrapper::GetPolygonCount() const - { - return m_fbxMesh->GetPolygonCount(); - } - - int FbxMeshWrapper::GetPolygonSize(int polygonIndex) const - { - return m_fbxMesh->GetPolygonSize(polygonIndex); - } - - int* FbxMeshWrapper::GetPolygonVertices() const - { - return m_fbxMesh->GetPolygonVertices(); - } - - int FbxMeshWrapper::GetPolygonVertexIndex(int polygonIndex) const - { - return m_fbxMesh->GetPolygonVertexIndex(polygonIndex); - } - - bool FbxMeshWrapper::GetMaterialIndices(FbxLayerElementArrayTemplate** lockableArray) const - { - return m_fbxMesh->GetMaterialIndices(lockableArray); - } - - FbxUVWrapper FbxMeshWrapper::GetElementUV(int index) - { - return FbxUVWrapper(m_fbxMesh->GetElementUV(index)); - } - - FbxVertexTangentWrapper FbxMeshWrapper::GetElementTangent(int index) - { - return FbxVertexTangentWrapper(m_fbxMesh->GetElementTangent(index)); - } - - FbxVertexBitangentWrapper FbxMeshWrapper::GetElementBitangent(int index) - { - return FbxVertexBitangentWrapper(m_fbxMesh->GetElementBinormal(index)); - } - - int FbxMeshWrapper::GetElementUVCount() const - { - return m_fbxMesh->GetElementUVCount(); - } - - int FbxMeshWrapper::GetElementTangentCount() const - { - return m_fbxMesh->GetElementTangentCount(); - } - - int FbxMeshWrapper::GetElementBitangentCount() const - { - return m_fbxMesh->GetElementBinormalCount(); - } - - FbxVertexColorWrapper FbxMeshWrapper::GetElementVertexColor(int index) - { - return FbxVertexColorWrapper(m_fbxMesh->GetElementVertexColor(index)); - } - - int FbxMeshWrapper::GetElementVertexColorCount() const - { - return m_fbxMesh->GetElementVertexColorCount(); - } - - bool FbxMeshWrapper::GetPolygonVertexNormal(int polyIndex, int vertexIndex, Vector3& normal) const - { - FbxVector4 fbxNormal; - bool hasVertexNormal = m_fbxMesh->GetPolygonVertexNormal(polyIndex, vertexIndex, fbxNormal); - normal = FbxTypeConverter::ToVector3(fbxNormal); - return hasVertexNormal; - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h deleted file mode 100644 index 80912d1a1b..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxSkinWrapper; - class FbxBlendShapeWrapper; - class FbxVertexTangentWrapper; - class FbxVertexBitangentWrapper; - - class FbxMeshWrapper - { - public: - FbxMeshWrapper(FbxMesh* fbxMesh); - virtual ~FbxMeshWrapper(); - - virtual const char* GetName() const; - - virtual int GetDeformerCount() const; - virtual int GetDeformerCount(int type) const; - virtual AZStd::shared_ptr GetSkin(int index) const; - virtual AZStd::shared_ptr GetBlendShape(int index) const; - virtual bool GetMaterialIndices(FbxLayerElementArrayTemplate** lockableArray) const; - - // Vertex positions access - // Get the control points number - virtual int GetControlPointsCount() const; - - // Get the array of control points - virtual AZStd::vector GetControlPoints() const; - - // Polygon data accesses - // Get the polygon count of this mesh - virtual int GetPolygonCount() const; - - // Get the number of polygon vertices in a polygon - virtual int GetPolygonSize(int polygonIndex) const; - - // Get the array of polygon vertices (i.e: indices to the control points) - virtual int* GetPolygonVertices() const; - - // Gets the start index into the array returned by GetPolygonVertices() for the given polygon - virtual int GetPolygonVertexIndex(int polygonIndex) const; - - // Vertex colors and UV textures accesses - // Returns this geometry's UV element - virtual FbxUVWrapper GetElementUV(int index = 0); - - virtual int GetElementUVCount() const; - - virtual int GetElementTangentCount() const; - virtual int GetElementBitangentCount() const; - virtual FbxVertexTangentWrapper GetElementTangent(int index = 0); - virtual FbxVertexBitangentWrapper GetElementBitangent(int index = 0); - - // Returns this geometry's vertex color element - virtual FbxVertexColorWrapper GetElementVertexColor(int index = 0); - - virtual int GetElementVertexColorCount() const; - - // Get the normal associated with the specified polygon vertex - virtual bool GetPolygonVertexNormal(int polyIndex, int vertexIndex, Vector3& normal) const; - - protected: - FbxMeshWrapper() = default; - FbxMesh* m_fbxMesh; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxNodeWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxNodeWrapper.cpp deleted file mode 100644 index 92621c2ce4..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxNodeWrapper.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxNodeWrapper::FbxNodeWrapper(FbxNode* fbxNode) - : NodeWrapper(fbxNode) - { - AZ_Assert(fbxNode, "Invalid FbxNode to initialize FbxNodeWrapper"); - } - - FbxNodeWrapper::~FbxNodeWrapper() - { - } - - - int FbxNodeWrapper::GetMaterialCount() const - { - return m_fbxNode->GetMaterialCount(); - } - - const char* FbxNodeWrapper::GetMaterialName(int index) const - { - if (index < GetMaterialCount()) - { - return m_fbxNode->GetMaterial(index)->GetName(); - } - AZ_Assert(index < GetMaterialCount(), "Invalid material index %d", index); - return nullptr; - } - - const std::shared_ptr FbxNodeWrapper::GetMesh() const - { - FbxMesh* mesh = m_fbxNode->GetMesh(); - return mesh ? std::shared_ptr(new FbxMeshWrapper(mesh)) : nullptr; - } - - const std::shared_ptr FbxNodeWrapper::FindProperty(const char* name) const - { - FbxProperty propertyName = m_fbxNode->FindProperty(name); - return std::shared_ptr(new FbxPropertyWrapper(&propertyName)); - } - - bool FbxNodeWrapper::IsBone() const - { - return (m_fbxNode->GetSkeleton() != nullptr); - } - - bool FbxNodeWrapper::IsMesh() const - { - return (m_fbxNode->GetMesh() != nullptr); - } - - const char* FbxNodeWrapper::GetName() const - { - return m_fbxNode->GetName(); - } - - AZ::u64 FbxNodeWrapper::GetUniqueId() const - { - return m_fbxNode->GetUniqueID(); - } - - SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateGlobalTransform() - { - return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateGlobalTransform()); - } - - Vector3 FbxNodeWrapper::EvaluateLocalTranslation() - { - return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTranslation()); - } - - Vector3 FbxNodeWrapper::EvaluateLocalTranslation(FbxTimeWrapper& time) - { - return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTranslation(time.m_fbxTime)); - } - - SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateLocalTransform() - { - return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateLocalTransform()); - } - - SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateLocalTransform(FbxTimeWrapper& time) - { - return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateLocalTransform(time.m_fbxTime)); - } - - Vector3 FbxNodeWrapper::EvaluateLocalRotation() - { - return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTransform().GetR()); - } - - Vector3 FbxNodeWrapper::EvaluateLocalRotation(FbxTimeWrapper& time) - { - return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTransform(time.m_fbxTime).GetR()); - } - - Vector3 FbxNodeWrapper::GetGeometricTranslation() const - { - return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricTranslation(FbxNode::eSourcePivot)); - } - - Vector3 FbxNodeWrapper::GetGeometricScaling() const - { - return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricScaling(FbxNode::eSourcePivot)); - } - - Vector3 FbxNodeWrapper::GetGeometricRotation() const - { - return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricRotation(FbxNode::eSourcePivot)); - } - - SceneAPI::DataTypes::MatrixType FbxNodeWrapper::GetGeometricTransform() const - { - FbxAMatrix geoTransform(m_fbxNode->GetGeometricTranslation(FbxNode::eSourcePivot), - m_fbxNode->GetGeometricRotation(FbxNode::eSourcePivot), m_fbxNode->GetGeometricScaling(FbxNode::eSourcePivot)); - return FbxTypeConverter::ToTransform(geoTransform); - } - - const AZStd::shared_ptr FbxNodeWrapper::GetLocalTranslationCurve(const AZStd::shared_ptr& layer, - CurveNodeComponent component) const - { - if (!layer) - { - return nullptr; - } - const char* componentString = nullptr; - switch (component) - { - case Component_X: - componentString = FBXSDK_CURVENODE_COMPONENT_X; - break; - case Component_Y: - componentString = FBXSDK_CURVENODE_COMPONENT_Y; - break; - case Component_Z: - componentString = FBXSDK_CURVENODE_COMPONENT_Z; - break; - default: - break; - } - // If there is available animation curve data of specified component/channel for translation, create and return a wrapped version of it. - return m_fbxNode->LclTranslation.GetCurve(layer->m_fbxAnimLayer, componentString) ? - AZStd::make_shared(m_fbxNode->LclTranslation.GetCurve(layer->m_fbxAnimLayer, componentString)) : nullptr; - } - - const AZStd::shared_ptr FbxNodeWrapper::GetLocalRotationCurve(const AZStd::shared_ptr& layer, - CurveNodeComponent component) const - { - if (!layer) - { - return nullptr; - } - const char* componentString = nullptr; - switch (component) - { - case Component_X: - componentString = FBXSDK_CURVENODE_COMPONENT_X; - break; - case Component_Y: - componentString = FBXSDK_CURVENODE_COMPONENT_Y; - break; - case Component_Z: - componentString = FBXSDK_CURVENODE_COMPONENT_Z; - break; - default: - break; - } - // If there is available animation curve data of specified component/channel for rotation, create and return a wrapped version of it. - return m_fbxNode->LclRotation.GetCurve(layer->m_fbxAnimLayer, componentString) ? - AZStd::make_shared(m_fbxNode->LclRotation.GetCurve(layer->m_fbxAnimLayer, componentString)) : nullptr; - } - - bool FbxNodeWrapper::IsAnimated() const - { - return FbxAnimUtilities::IsAnimated(m_fbxNode); - } - - int FbxNodeWrapper::GetChildCount() const - { - return m_fbxNode->GetChildCount(); - } - - const std::shared_ptr FbxNodeWrapper::GetChild(int childIndex) const - { - FbxNode* child = m_fbxNode->GetChild(childIndex); - AZ_Assert(child, "Cannot get child FbxNode at index %d", childIndex); - return child ? std::shared_ptr(new FbxNodeWrapper(child)) : nullptr; - } - - const std::shared_ptr FbxNodeWrapper::GetMaterial(int index) const - { - if (index < GetMaterialCount()) - { - return std::shared_ptr(new FbxMaterialWrapper(m_fbxNode->GetMaterial(index))); - } - AZ_Assert(index < GetMaterialCount(), "Invalid material index %d", index); - return nullptr; - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h deleted file mode 100644 index fceebc96d4..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxMaterialWrapper; - class FbxAnimLayerWrapper; - class FbxAnimCurveWrapper; - - class FbxNodeWrapper : public SDKNode::NodeWrapper - { - public: - AZ_RTTI(FbxNodeWrapper, "{5F1C09D1-791C-41CA-94DB-D7DD2810C859}", SDKNode::NodeWrapper); - FbxNodeWrapper(FbxNode* fbxNode); - ~FbxNodeWrapper() override; - - int GetMaterialCount() const override; - virtual const char* GetMaterialName(int index) const; - virtual const std::shared_ptr GetMaterial(int index) const; - virtual const std::shared_ptr GetMesh() const; - virtual const std::shared_ptr FindProperty(const char* name) const; - virtual bool IsBone() const; - virtual bool IsMesh() const; - const char* GetName() const override; - AZ::u64 GetUniqueId() const override; - - virtual SceneAPI::DataTypes::MatrixType EvaluateGlobalTransform(); - virtual Vector3 EvaluateLocalTranslation(); - virtual Vector3 EvaluateLocalTranslation(FbxTimeWrapper& time); - virtual SceneAPI::DataTypes::MatrixType EvaluateLocalTransform(); - virtual SceneAPI::DataTypes::MatrixType EvaluateLocalTransform(FbxTimeWrapper& time); - virtual Vector3 EvaluateLocalRotation(); - virtual Vector3 EvaluateLocalRotation(FbxTimeWrapper& time); - virtual Vector3 GetGeometricTranslation() const; - virtual Vector3 GetGeometricScaling() const; - virtual Vector3 GetGeometricRotation() const; - virtual SceneAPI::DataTypes::MatrixType GetGeometricTransform() const; - virtual const AZStd::shared_ptr GetLocalTranslationCurve(const AZStd::shared_ptr& layer, CurveNodeComponent component) const; - virtual const AZStd::shared_ptr GetLocalRotationCurve(const AZStd::shared_ptr& layer, CurveNodeComponent component) const; - - int GetChildCount() const override; - const std::shared_ptr GetChild(int childIndex) const override; - - virtual bool IsAnimated() const; - - protected: - FbxNodeWrapper() = default; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.cpp deleted file mode 100644 index 3e2e149a8c..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxPropertyWrapper::FbxPropertyWrapper(FbxProperty* fbxProperty) - : m_fbxProperty(fbxProperty) - { - AZ_Assert(fbxProperty, "Invalid FbxProperty to initialize FbxPropertyWrapper"); - } - - FbxPropertyWrapper::~FbxPropertyWrapper() - { - m_fbxProperty = nullptr; - } - - bool FbxPropertyWrapper::IsValid() const - { - return m_fbxProperty->IsValid(); - } - - Vector3 FbxPropertyWrapper::GetFbxVector3() const - { - return FbxTypeConverter::ToVector3(m_fbxProperty->Get()); - } - - int FbxPropertyWrapper::GetFbxInt() const - { - return aznumeric_caster(m_fbxProperty->Get()); - } - - AZStd::string FbxPropertyWrapper::GetFbxString() const - { - return AZStd::string(m_fbxProperty->Get().Buffer()); - } - - const char* FbxPropertyWrapper::GetEnumValue(int index) const - { - return m_fbxProperty->GetEnumValue(index); - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h deleted file mode 100644 index ffa174b0a9..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxPropertyWrapper - { - public: - FbxPropertyWrapper(FbxProperty* fbxProperty); - virtual ~FbxPropertyWrapper(); - - virtual bool IsValid() const; - virtual Vector3 GetFbxVector3() const; - virtual int GetFbxInt() const; - virtual AZStd::string GetFbxString() const; - virtual const char* GetEnumValue(int index) const; - - protected: - FbxProperty* m_fbxProperty; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSceneWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSceneWrapper.cpp deleted file mode 100644 index 0a1b8b50d8..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSceneWrapper.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxSceneWrapper::FbxSceneWrapper() - : SceneWrapperBase() - , m_fbxManager(nullptr) - , m_fbxImporter(nullptr) - , m_fbxIOSettings(nullptr) - { - } - - FbxSceneWrapper::FbxSceneWrapper(FbxScene* fbxScene) - : SceneWrapperBase(fbxScene) - , m_fbxManager(nullptr) - , m_fbxImporter(nullptr) - , m_fbxIOSettings(nullptr) - { - AZ_Assert(fbxScene, "FbxSceneWrapper should have a valid scene to initialize."); - } - - FbxSceneWrapper::~FbxSceneWrapper() - { - if (m_fbxScene) - { - m_fbxScene->Destroy(); - m_fbxScene = nullptr; - } - - if (m_fbxImporter) - { - m_fbxImporter->Destroy(); - m_fbxImporter = nullptr; - } - - if (m_fbxIOSettings) - { - m_fbxIOSettings->Destroy(); - m_fbxIOSettings = nullptr; - } - - if (m_fbxManager) - { - m_fbxManager->Destroy(); - m_fbxManager = nullptr; - } - } - - AZStd::shared_ptr FbxSceneWrapper::GetAxisSystem() const - { - return AZStd::make_shared(m_fbxScene->GetGlobalSettings().GetAxisSystem()); - } - - AZStd::shared_ptr FbxSceneWrapper::GetSystemUnit() const - { - return AZStd::make_shared(m_fbxScene->GetGlobalSettings().GetSystemUnit()); - } - - FbxTimeWrapper FbxSceneWrapper::GetTimeLineDefaultDuration() const - { - FbxTimeSpan timeSpan; - m_fbxScene->GetGlobalSettings().GetTimelineDefaultTimeSpan(timeSpan); - return FbxTimeWrapper(timeSpan.GetDuration()); - } - - const char* FbxSceneWrapper::GetLastSavedApplicationName() const - { - if (m_fbxScene->GetDocumentInfo()) - { - return m_fbxScene->GetDocumentInfo()->LastSaved_ApplicationName.Get().Buffer(); - } - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Cannot get valid document info from FbxScene"); - return nullptr; - } - - const char* FbxSceneWrapper::GetLastSavedApplicationVersion() const - { - if (m_fbxScene->GetDocumentInfo()) - { - return m_fbxScene->GetDocumentInfo()->LastSaved_ApplicationVersion.Get().Buffer(); - } - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Cannot get valid document info from FbxScene"); - return nullptr; - } - - const std::shared_ptr FbxSceneWrapper::GetRootNode() const - { - return std::shared_ptr(new FbxNodeWrapper(m_fbxScene->GetRootNode())); - } - - std::shared_ptr FbxSceneWrapper::GetRootNode() - { - return std::shared_ptr(new FbxNodeWrapper(m_fbxScene->GetRootNode())); - } - - int FbxSceneWrapper::GetAnimationStackCount() const - { - return m_fbxScene->GetSrcObjectCount(); - } - - const std::shared_ptr FbxSceneWrapper::GetAnimationStackAt(int index) const - { - return std::shared_ptr(new FbxAnimStackWrapper(FbxCast(m_fbxScene->GetSrcObject(index)))); - } - - bool FbxSceneWrapper::LoadSceneFromFile(const char* fileName) - { - AZ_TracePrintf(SceneAPI::Utilities::LogWindow, "FbxSceneWrapper::LoadSceneFromFile %s", fileName); - AZ_TraceContext("Filename", fileName); - - if (!m_fbxManager) - { - m_fbxManager = FbxManager::Create(); - if (!m_fbxManager) - { - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxManager"); - return false; - } - } - - if (!m_fbxIOSettings) - { - m_fbxIOSettings = FbxIOSettings::Create(m_fbxManager, IOSROOT); - if (!m_fbxIOSettings) - { - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxIOSettings"); - return false; - } - } - - m_fbxManager->SetIOSettings(m_fbxIOSettings); - - if (!m_fbxImporter) - { - m_fbxImporter = FbxImporter::Create(m_fbxManager, ""); - if (!m_fbxImporter) - { - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxImporter with FbxManager"); - return false; - } - } - - if (!m_fbxImporter->Initialize(fileName, -1, m_fbxManager->GetIOSettings())) - { - FbxString error = m_fbxImporter->GetStatus().GetErrorString(); - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to initialize FbxImporter with fbx file. Error returned: %s", error.Buffer()); - return false; - } - - // Create a new FBX scene so it can be populated by the imported file. - m_fbxScene = FbxScene::Create(m_fbxManager, s_defaultSceneName); - - if (!m_fbxScene) - { - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxScene"); - return false; - } - - if (!m_fbxImporter->Import(m_fbxScene)) - { - FbxString error = m_fbxImporter->GetStatus().GetErrorString(); - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to import FbxScene. Error returned: %s", error.Buffer()); - return false; - } - - return true; - } - - bool FbxSceneWrapper::LoadSceneFromFile(const AZStd::string& fileName) - { - return LoadSceneFromFile(fileName.c_str()); - } - - void FbxSceneWrapper::Clear() - { - if (m_fbxScene) - { - m_fbxScene->Clear(); - } - } - }//namespace FbxSDKWrapper - -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSceneWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSceneWrapper.h deleted file mode 100644 index f28ee6d7c3..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSceneWrapper.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// -// FBX SDK Wrapper -// provides isolation between AUTODESK FBX SDK and FBX Serializer -// provides necessary APIs for FBX Serializer -// -//////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxSceneWrapper : public SDKScene::SceneWrapperBase - { - public: - AZ_RTTI(FbxSceneWrapper, "{63637E50-BB26-4BE9-AECD-D1168AE2355B}", SDKScene::SceneWrapperBase); - FbxSceneWrapper(); - FbxSceneWrapper(fbxsdk::FbxScene* fbxScene); - ~FbxSceneWrapper(); - - bool LoadSceneFromFile(const char* fileName) override; - bool LoadSceneFromFile(const AZStd::string& fileName) override; - - virtual AZStd::shared_ptr GetSystemUnit() const; - virtual AZStd::shared_ptr GetAxisSystem() const; - virtual FbxTimeWrapper GetTimeLineDefaultDuration() const; - virtual const char* GetLastSavedApplicationName() const; - virtual const char* GetLastSavedApplicationVersion() const; - const std::shared_ptr GetRootNode() const override; - std::shared_ptr GetRootNode() override; - virtual int GetAnimationStackCount() const; - virtual const std::shared_ptr GetAnimationStackAt(int index) const; - void Clear() override; - - protected: - FbxManager* m_fbxManager; - FbxImporter* m_fbxImporter; - FbxIOSettings* m_fbxIOSettings; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSkinWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSkinWrapper.cpp deleted file mode 100644 index 04b90ed6a3..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSkinWrapper.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxSkinWrapper::FbxSkinWrapper(FbxSkin* fbxSkin) - : m_fbxSkin(fbxSkin) - { - AZ_Assert(fbxSkin, "Invalid FbxSkin input to initialize FbxSkinWrapper"); - } - - FbxSkinWrapper::~FbxSkinWrapper() - { - m_fbxSkin = nullptr; - } - - const char* FbxSkinWrapper::GetName() const - { - return m_fbxSkin->GetName(); - } - - int FbxSkinWrapper::GetClusterCount() const - { - return m_fbxSkin->GetClusterCount(); - } - - int FbxSkinWrapper::GetClusterControlPointIndicesCount(int index) const - { - if (index < m_fbxSkin->GetClusterCount()) - { - return m_fbxSkin->GetCluster(index)->GetControlPointIndicesCount(); - } - AZ_Assert(index < m_fbxSkin->GetClusterCount(), "Invalid skin cluster index %d", index); - return 0; - } - - int FbxSkinWrapper::GetClusterControlPointIndex(int clusterIndex, int pointIndex) const - { - bool validIndex = clusterIndex < m_fbxSkin->GetClusterCount() && pointIndex < m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndicesCount(); - if (validIndex) - { - return m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndices()[pointIndex]; - } - AZ_Assert(validIndex, "Invalid skin cluster control point index at cluster index %d control point index %d", clusterIndex, pointIndex); - return -1; - } - - double FbxSkinWrapper::GetClusterControlPointWeight(int clusterIndex, int pointIndex) const - { - bool validIndex = clusterIndex < m_fbxSkin->GetClusterCount() && pointIndex < m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndicesCount(); - if (validIndex) - { - return m_fbxSkin->GetCluster(clusterIndex)->GetControlPointWeights()[pointIndex]; - } - AZ_Assert(validIndex, "Invalid skin cluster control point weight at cluster index %d control point index %d", clusterIndex, pointIndex); - return 0.0f; - } - - AZStd::shared_ptr FbxSkinWrapper::GetClusterLink(int index) const - { - if (index < m_fbxSkin->GetClusterCount()) - { - return AZStd::make_shared(m_fbxSkin->GetCluster(index)->GetLink()); - } - AZ_Assert(index < m_fbxSkin->GetClusterCount(), "Invalid skin cluster index %d", index); - return nullptr; - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h deleted file mode 100644 index 1d31248f49..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxNodeWrapper; - - class FbxSkinWrapper - { - public: - FbxSkinWrapper(FbxSkin* fbxSkin); - virtual ~FbxSkinWrapper(); - - virtual const char* GetName() const; - virtual int GetClusterCount() const; - virtual int GetClusterControlPointIndicesCount(int index) const; - virtual int GetClusterControlPointIndex(int clusterIndex, int pointIndex) const; - virtual double GetClusterControlPointWeight(int clusterIndex, int pointIndex) const; - virtual AZStd::shared_ptr GetClusterLink(int index) const; - - protected: - FbxSkinWrapper() = default; - FbxSkin* m_fbxSkin; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.cpp deleted file mode 100644 index 2171735c54..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxSystemUnitWrapper::FbxSystemUnitWrapper(const FbxSystemUnit& fbxSystemUnit) - : m_fbxSystemUnit(fbxSystemUnit) - { - } - - FbxSystemUnitWrapper::Unit FbxSystemUnitWrapper::GetUnit() const - { - if (m_fbxSystemUnit == FbxSystemUnit::mm) - { - return mm; - } - if (m_fbxSystemUnit == FbxSystemUnit::dm) - { - return dm; - } - if (m_fbxSystemUnit == FbxSystemUnit::cm) - { - return cm; - } - if (m_fbxSystemUnit == FbxSystemUnit::m) - { - return m; - } - if (m_fbxSystemUnit == FbxSystemUnit::km) - { - return km; - } - if (m_fbxSystemUnit == FbxSystemUnit::Inch) - { - return inch; - } - if (m_fbxSystemUnit == FbxSystemUnit::Foot) - { - return foot; - } - if (m_fbxSystemUnit == FbxSystemUnit::Mile) - { - return mile; - } - if (m_fbxSystemUnit == FbxSystemUnit::Yard) - { - return yard; - } - AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized current unit type"); - return unknown; - } - - float FbxSystemUnitWrapper::GetConversionFactorTo(Unit to) - { - FbxSystemUnit targetUnit; - switch (to) - { - case mm: - targetUnit = FbxSystemUnit::mm; - break; - case dm: - targetUnit = FbxSystemUnit::dm; - break; - case cm: - targetUnit = FbxSystemUnit::cm; - break; - case m: - targetUnit = FbxSystemUnit::m; - break; - case km: - targetUnit = FbxSystemUnit::km; - break; - case inch: - targetUnit = FbxSystemUnit::Inch; - break; - case foot: - targetUnit = FbxSystemUnit::Foot; - break; - case mile: - targetUnit = FbxSystemUnit::Mile; - break; - case yard: - targetUnit = FbxSystemUnit::Yard; - break; - default: - AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized unit conversion target type"); - targetUnit = FbxSystemUnit::m; - } - return aznumeric_caster(m_fbxSystemUnit.GetConversionFactorTo(targetUnit)); - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.h deleted file mode 100644 index 8973a68694..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxSystemUnitWrapper - { - public: - enum Unit - { - mm, - dm, - cm, - m, - km, - inch, - foot, - mile, - yard, - unknown - }; - - FbxSystemUnitWrapper() = default; - FbxSystemUnitWrapper(const FbxSystemUnit& fbxSystemUnit); - virtual ~FbxSystemUnitWrapper() = default; - - virtual Unit GetUnit() const; - virtual float GetConversionFactorTo(Unit to); - - protected: - FbxSystemUnit m_fbxSystemUnit; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.cpp deleted file mode 100644 index 9e92a109e2..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxTimeSpanWrapper::FbxTimeSpanWrapper(const FbxTimeSpan& fbxTimeSpan) - : m_fbxTimeSpan(fbxTimeSpan) - { - } - - FbxTimeWrapper FbxTimeSpanWrapper::GetStartTime() const - { - return FbxTimeWrapper(m_fbxTimeSpan.GetStart()); - } - - FbxTimeWrapper FbxTimeSpanWrapper::GetStopTime() const - { - return FbxTimeWrapper(m_fbxTimeSpan.GetStop()); - } - - double FbxTimeSpanWrapper::GetFrameRate() const - { - return FbxTimeWrapper(m_fbxTimeSpan.GetStart()).GetFrameRate(); - } - - int64_t FbxTimeSpanWrapper::GetNumFrames() const - { - return GetStopTime().GetFrameCount() - GetStartTime().GetFrameCount() + 1; - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.h deleted file mode 100644 index 4dfdcc2da5..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxTimeSpanWrapper - { - public: - FbxTimeSpanWrapper(const FbxTimeSpan& fbxTimeSpan); - virtual ~FbxTimeSpanWrapper() = default; - - virtual FbxTimeWrapper GetStartTime() const; - virtual FbxTimeWrapper GetStopTime() const; - virtual double GetFrameRate() const; - int64_t GetNumFrames() const; - - protected: - FbxTimeSpan m_fbxTimeSpan; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeWrapper.cpp deleted file mode 100644 index 3b6c555fe1..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeWrapper.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxTimeWrapper::FbxTimeWrapper() : m_fbxTime(FBXSDK_TIME_INFINITE) - { - } - - FbxTimeWrapper::FbxTimeWrapper(const FbxTime& fbxTime) : m_fbxTime(fbxTime) - { - } - - FbxTimeWrapper::~FbxTimeWrapper() - { - } - - void FbxTimeWrapper::SetFrame(int64_t frames, TimeMode timeMode) - { - m_fbxTime.SetFrame(static_cast(frames), GetFbxTimeMode(timeMode)); - } - - void FbxTimeWrapper::SetTime(double time) - { - m_fbxTime.SetSecondDouble(time); - } - - double FbxTimeWrapper::GetFrameRate() const - { - return m_fbxTime.GetFrameRate(m_fbxTime.GetGlobalTimeMode()); - } - - int64_t FbxTimeWrapper::GetFrameCount() const - { - return static_cast(m_fbxTime.GetFrameCount()); - } - - double FbxTimeWrapper::GetTime() const - { - return m_fbxTime.GetSecondDouble(); - } - - FbxTime::EMode FbxTimeWrapper::GetFbxTimeMode(TimeMode timeMode) const - { - switch (timeMode) - { - case frames60: - return FbxTime::eFrames60; - case frames30: - return FbxTime::eFrames30; - case frames24: - return FbxTime::eFrames24; - case defaultMode: - return FbxTime::eDefaultMode; - default: - AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unsupported frame rate"); - return FbxTime::eDefaultMode; - } - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h deleted file mode 100644 index 6f00670025..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxTimeWrapper - { - friend class FbxNodeWrapper; - friend class FbxAnimCurveWrapper; - public: - enum TimeMode - { - defaultMode, - frames60, - frames30, - frames24, - eModesCount - }; - - FbxTimeWrapper(); - FbxTimeWrapper(const FbxTime& fbxTime); - virtual ~FbxTimeWrapper(); - - virtual void SetFrame(int64_t frames, TimeMode timeMode = defaultMode); - virtual void SetTime(double time); - virtual double GetFrameRate() const; - virtual int64_t GetFrameCount() const; - virtual double GetTime() const; - - protected: - FbxTime::EMode GetFbxTimeMode(TimeMode timeMode) const; - - FbxTime m_fbxTime; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTypeConverter.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTypeConverter.cpp deleted file mode 100644 index 7bf1d719df..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTypeConverter.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - Vector2 FbxTypeConverter::ToVector2(const FbxVector2& vector) - { - return Vector2(static_cast(vector[0]), - static_cast(vector[1])); - } - - Vector3 FbxTypeConverter::ToVector3(const FbxVector4& vector) - { - // Note: FbxVector4[x] is of type FbxDouble and aznumeric_caster does not accept it as cast from type. - return Vector3(static_cast(vector[0]), - static_cast(vector[1]), - static_cast(vector[2])); - } - - SceneAPI::DataTypes::MatrixType FbxTypeConverter::ToTransform(const FbxAMatrix& matrix) - { - SceneAPI::DataTypes::MatrixType transform; - for (int row = 0; row < 3; ++row) - { - FbxVector4 line = matrix.GetColumn(row); - for (int column = 0; column < 4; ++column) - { - // Note: FbxVector4[x] is of type FbxDouble and aznumeric_caster does not accept it as cast from type. - transform.SetElement(row, column, static_cast(line[column])); - } - } - return transform; - } - - SceneAPI::DataTypes::MatrixType FbxTypeConverter::ToTransform(const FbxMatrix& matrix) - { - // This implementation ignores the last row, effectively assuming it to be (0,0,0,1) - SceneAPI::DataTypes::MatrixType transform; - for (int row = 0; row < 3; ++row) - { - FbxVector4 line = matrix.GetColumn(row); - for (int column = 0; column < 4; ++column) - { - // Note: FbxVector4[x] is of type FbxDouble and aznumeric_caster does not accept it as cast from type. - transform.SetElement(row, column, static_cast(line[column])); - } - } - return transform; - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTypeConverter.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTypeConverter.h deleted file mode 100644 index b670bc3770..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxTypeConverter.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ -#pragma once - -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxTypeConverter - { - public: - static Vector2 ToVector2(const FbxVector2& vector); - static Vector3 ToVector3(const FbxVector4& vector); - static SceneAPI::DataTypes::MatrixType ToTransform(const FbxAMatrix& matrix); - static SceneAPI::DataTypes::MatrixType ToTransform(const FbxMatrix& matrix); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxUVWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxUVWrapper.cpp deleted file mode 100644 index 8c7538b54e..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxUVWrapper.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxUVWrapper::FbxUVWrapper(FbxGeometryElementUV* fbxUV) - : m_fbxUV(fbxUV) - { - AZ_Assert(fbxUV, "Invalid FbxGeometryElementUV to initialize FbxUVWrapper") - } - - FbxUVWrapper::~FbxUVWrapper() - { - m_fbxUV = nullptr; - } - - const char* FbxUVWrapper::GetName() const - { - if (m_fbxUV) - { - return m_fbxUV->GetName(); - } - return nullptr; - } - - Vector2 FbxUVWrapper::GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const - { - FbxVector2 uv; - FbxLayerElementUtilities::GetGeometryElement(uv, m_fbxUV, polygonIndex, polygonVertexIndex, controlPointIndex); - return FbxTypeConverter::ToVector2(uv); - } - - bool FbxUVWrapper::IsValid() const - { - return m_fbxUV != nullptr; - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxUVWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxUVWrapper.h deleted file mode 100644 index 23bd77f4df..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxUVWrapper.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxUVWrapper - { - public: - FbxUVWrapper(FbxGeometryElementUV* fbxUV); - ~FbxUVWrapper(); - - Vector2 GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const; - const char* GetName() const; - bool IsValid() const; - - protected: - FbxGeometryElementUV* m_fbxUV; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.cpp deleted file mode 100644 index eeb3eb8f8e..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxVertexBitangentWrapper::FbxVertexBitangentWrapper(FbxGeometryElementBinormal* fbxBitangent) - : m_fbxBitangent(fbxBitangent) - { - AZ_Assert(fbxBitangent, "Invalid FbxGeometryElementBinormal to initialize FbxVertexBitangentWrapper") - } - - - FbxVertexBitangentWrapper::~FbxVertexBitangentWrapper() - { - m_fbxBitangent = nullptr; - } - - - const char* FbxVertexBitangentWrapper::GetName() const - { - if (m_fbxBitangent) - { - return m_fbxBitangent->GetName(); - } - return ""; - } - - - Vector3 FbxVertexBitangentWrapper::GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const - { - FbxVector4 bitangent; - FbxLayerElementUtilities::GetGeometryElement(bitangent, m_fbxBitangent, polygonIndex, polygonVertexIndex, controlPointIndex); - return FbxTypeConverter::ToVector3(bitangent); - } - - - bool FbxVertexBitangentWrapper::IsValid() const - { - return m_fbxBitangent != nullptr; - } - - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.h deleted file mode 100644 index 51a9e3c1d4..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - - class FbxVertexBitangentWrapper - { - public: - FbxVertexBitangentWrapper(FbxGeometryElementBinormal* fbxBitangent); - ~FbxVertexBitangentWrapper(); - - Vector3 GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const; - const char* GetName() const; - bool IsValid() const; - - protected: - FbxGeometryElementBinormal* m_fbxBitangent; - }; - - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.cpp deleted file mode 100644 index 9a3aaf1328..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - FbxColorWrapper::FbxColorWrapper(FbxColor& fbxColor) - : m_fbxColor(fbxColor) - { - } - - float FbxColorWrapper::GetR() const - { - return aznumeric_caster(m_fbxColor.mRed); - } - - float FbxColorWrapper::GetG() const - { - return aznumeric_caster(m_fbxColor.mGreen); - } - - float FbxColorWrapper::GetB() const - { - return aznumeric_caster(m_fbxColor.mBlue); - } - - float FbxColorWrapper::GetAlpha() const - { - return aznumeric_caster(m_fbxColor.mAlpha); - } - - FbxVertexColorWrapper::FbxVertexColorWrapper(FbxGeometryElementVertexColor* fbxVertexColor) - : m_fbxVertexColor(fbxVertexColor) - { - AZ_Assert(m_fbxVertexColor, "Invalid FbxGeometryElementVertexColor to initialie FbxVertexColorWrapper"); - } - - FbxVertexColorWrapper::~FbxVertexColorWrapper() - { - m_fbxVertexColor = nullptr; - } - - const char* FbxVertexColorWrapper::GetName() const - { - if (m_fbxVertexColor) - { - return m_fbxVertexColor->GetName(); - } - return nullptr; - } - - FbxColorWrapper FbxVertexColorWrapper::GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const - { - FbxColor color; - FbxLayerElementUtilities::GetGeometryElement(color, m_fbxVertexColor, polygonIndex, polygonVertexIndex, controlPointIndex); - return FbxColorWrapper(color); - } - - bool FbxVertexColorWrapper::IsValid() const - { - return m_fbxVertexColor != nullptr; - } - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.h deleted file mode 100644 index af1c414acb..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxColorWrapper - { - public: - FbxColorWrapper(FbxColor& fbxColor); - float GetR() const; - float GetG() const; - float GetB() const; - float GetAlpha() const; - - protected: - FbxColor m_fbxColor; - }; - - class FbxVertexColorWrapper - { - public: - FbxVertexColorWrapper(FbxGeometryElementVertexColor* fbxVertexColor); - ~FbxVertexColorWrapper(); - - FbxColorWrapper GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const; - const char* GetName() const; - bool IsValid() const; - - protected: - FbxGeometryElementVertexColor* m_fbxVertexColor; - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.cpp b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.cpp deleted file mode 100644 index bdf2ebd44b..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - - FbxVertexTangentWrapper::FbxVertexTangentWrapper(FbxGeometryElementTangent* fbxTangent) - : m_fbxTangent(fbxTangent) - { - AZ_Assert(fbxTangent, "Invalid FbxGeometryElementTangent to initialize FbxVertexTangentWrapper") - } - - - FbxVertexTangentWrapper::~FbxVertexTangentWrapper() - { - m_fbxTangent = nullptr; - } - - - const char* FbxVertexTangentWrapper::GetName() const - { - if (m_fbxTangent) - { - return m_fbxTangent->GetName(); - } - return ""; - } - - - Vector3 FbxVertexTangentWrapper::GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const - { - FbxVector4 tangent; - FbxLayerElementUtilities::GetGeometryElement(tangent, m_fbxTangent, polygonIndex, polygonVertexIndex, controlPointIndex); - return FbxTypeConverter::ToVector3(tangent); - } - - - bool FbxVertexTangentWrapper::IsValid() const - { - return m_fbxTangent != nullptr; - } - - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.h deleted file mode 100644 index 24cfebd3d5..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - - class FbxVertexTangentWrapper - { - public: - FbxVertexTangentWrapper(FbxGeometryElementTangent* fbxTangent); - ~FbxVertexTangentWrapper(); - - Vector3 GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const; - const char* GetName() const; - bool IsValid() const; - - protected: - FbxGeometryElementTangent* m_fbxTangent; - }; - - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxAnimStackWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxAnimStackWrapper.h deleted file mode 100644 index 122ab05ecb..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxAnimStackWrapper.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxAnimStackWrapper - : public FbxAnimStackWrapper - { - public: - MOCK_CONST_METHOD0(GetMemberCount, - int()); - MOCK_CONST_METHOD1(GetAnimationLayerAt, - FbxAnimLayer * (int index)); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxAxisSystemWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxAxisSystemWrapper.h deleted file mode 100644 index 7cd022ce50..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxAxisSystemWrapper.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxAxisSystemWrapper - : public FbxAxisSystemWrapper - { - public: - MOCK_CONST_METHOD1(GetUpVector, - UpVector(int)); - MOCK_METHOD1(CalculateConversionTransform, - Transform(UpVector)); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxMaterialWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxMaterialWrapper.h deleted file mode 100644 index ac19831be7..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxMaterialWrapper.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxMaterialWrapper - : public FbxMaterialWrapper - { - public: - MOCK_CONST_METHOD0(GetName, - std::string()); - MOCK_CONST_METHOD1(GetTextureFileName, - std::string(const char* textureType)); - MOCK_CONST_METHOD1(GetTextureFileName, - std::string(const std::string& textureType)); - MOCK_CONST_METHOD1(GetTextureFileName, - std::string(MaterialMapType textureType)); - MOCK_CONST_METHOD0(IsNoDraw, - bool()); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxMeshWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxMeshWrapper.h deleted file mode 100644 index c498d56426..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxMeshWrapper.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxMeshWrapper - : public FbxMeshWrapper - { - public: - MOCK_CONST_METHOD0(GetDeformerCount, - int()); - MOCK_CONST_METHOD1(GetSkin, - AZStd::shared_ptr(int index)); - MOCK_CONST_METHOD1(GetMaterialIndices, - bool(FbxLayerElementArrayTemplate**)); - MOCK_CONST_METHOD0(GetControlPointsCount, - int()); - MOCK_CONST_METHOD0(GetControlPoints, - AZStd::vector()); - MOCK_CONST_METHOD0(GetPolygonCount, - int()); - MOCK_CONST_METHOD1(GetPolygonSize, - int(int)); - MOCK_CONST_METHOD1(GetPolygonVertics, - int(int index)); - MOCK_CONST_METHOD1(GetPolygonVertexIndex, - int(int)); - MOCK_CONST_METHOD1(GetElementUV, - FbxUVWrapper(int)); - MOCK_CONST_METHOD0(GetElementUVCount, - int()); - MOCK_CONST_METHOD1(GetElementVertexColor, - FbxVertexColorWrapper(int)); - MOCK_CONST_METHOD0(GetElementVertexColorCount, - int()); - MOCK_CONST_METHOD3(GetPolygonVertexNormal, - bool(int, int, Vector3&)); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxNodeWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxNodeWrapper.h deleted file mode 100644 index aa02d633b0..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxNodeWrapper.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxNodeWrapper - : public FbxNodeWrapper - { - public: - MOCK_CONST_METHOD0(GetMaterialCount, - int()); - MOCK_CONST_METHOD1(GetMaterialName, - const char*(int index)); - MOCK_CONST_METHOD1(GetMaterial, - const std::shared_ptr(int index)); - MOCK_CONST_METHOD0(GetMesh, - const std::shared_ptr()); - MOCK_CONST_METHOD1(FindProperty, - const std::shared_ptr(const char* name)); - MOCK_CONST_METHOD0(IsBone, - bool()); - MOCK_CONST_METHOD0(GetName, - const char*()); - MOCK_METHOD0(EvaluateGlobalTransform, - Transform()); - MOCK_METHOD0(EvaluateLocalTranslation, - Vector3()); - MOCK_METHOD1(EvaluateLocalTranslation, - Vector3(FbxTimeWrapper& time)); - MOCK_METHOD0(EvaluateLocalTransform, - Transform()); - MOCK_METHOD1(EvaluateLocalTransform, - Transform(FbxTimeWrapper& time)); - MOCK_CONST_METHOD0(GetGeometricTranslation, - Vector3()); - MOCK_CONST_METHOD0(GetGeometricScaling, - Vector3()); - MOCK_CONST_METHOD0(GetGeometricRotation, - Vector3()); - MOCK_CONST_METHOD0(GetGeometricTransform, - Transform()); - MOCK_CONST_METHOD0(GetChildCount, - int()); - MOCK_CONST_METHOD1(GetChild, - const std::shared_ptr(int childIndex)); - MOCK_CONST_METHOD0(IsAnimated, - bool()); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxPropertyWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxPropertyWrapper.h deleted file mode 100644 index f49521f136..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxPropertyWrapper.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxPropertyWrapper - : public FbxPropertyWrapper - { - public: - MockFbxPropertyWrapper() - : FbxPropertyWrapper(new FbxProperty()) - { - } - MOCK_CONST_METHOD0(IsValid, - bool()); - MOCK_CONST_METHOD0(GetFbxVector4, - Vector4()); - MOCK_CONST_METHOD0(GetFbxInt, - FbxInt()); - MOCK_CONST_METHOD0(GetFbxString, - AZStd::string()); - MOCK_CONST_METHOD1(GetEnumValue, - const char*(int index)); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSceneWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSceneWrapper.h deleted file mode 100644 index 8f3d1903ac..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSceneWrapper.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxSceneWrapper - : public FbxSceneWrapper - { - public: - virtual ~MockFbxSceneWrapper() = default; - - MOCK_METHOD1(LoadSceneFromFile, - bool(const char* fileName)); - MOCK_METHOD1(LoadSceneFromFile, - bool(const std::string& fileName)); - MOCK_CONST_METHOD0(GetSystemUnit, - AZStd::shared_ptr()); - MOCK_CONST_METHOD0(GetAxisSystem, - AZStd::shared_ptr()); - MOCK_CONST_METHOD0(GetTimeLineDefaultDuration, - FbxTimeWrapper()); - MOCK_CONST_METHOD0(GetLastSavedApplicationName, - const char*()); - MOCK_CONST_METHOD0(GetLastSavedApplicationVersion, - const char*()); - MOCK_CONST_METHOD0(GetRootNode, - const std::shared_ptr()); - MOCK_METHOD0(GetRootNode, - std::shared_ptr()); - MOCK_CONST_METHOD0(GetAnimationStackCount, - int()); - MOCK_CONST_METHOD1(GetAnimationStackAt, - const std::shared_ptr(int index)); - MOCK_METHOD0(Clear, - void()); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSkinWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSkinWrapper.h deleted file mode 100644 index dd17a12146..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSkinWrapper.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxSkinWrapper - : public FbxSkinWrapper - { - public: - MOCK_CONST_METHOD0(GetName, - const char*()); - MOCK_CONST_METHOD0(GetClusterCount, - int()); - MOCK_CONST_METHOD1(GetClusterControlPointIndicesCount, - int(int index)); - MOCK_CONST_METHOD2(GetClusterControlPointIndices, - int(int clusterIndex, int pointIndex)); - MOCK_CONST_METHOD2(GetClusterControlPointWeights, - double(int clusterIndex, int pointIndex)); - MOCK_CONST_METHOD1(GetClusterLink, - AZStd::shared_ptr(int index)); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSystemUnitWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSystemUnitWrapper.h deleted file mode 100644 index 822a700edd..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxSystemUnitWrapper.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxSystemUnitWrapper - : public FbxSystemUnitWrapper - { - public: - MOCK_CONST_METHOD0(GetUnit, - Unit()); - MOCK_METHOD1(GetConversionFactorTo, - float(Unit)); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxTimeWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxTimeWrapper.h deleted file mode 100644 index 6ab6194261..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxTimeWrapper.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxTimeWrapper - : public FbxTimeWrapper - { - public: - MOCK_METHOD2(SetFrame, - void(int64_t, TimeMode)); - MOCK_CONST_METHOD0(GetFrameRate, - double()); - MOCK_CONST_METHOD0(GetFrameCount, - int64_t()); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxUVWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxUVWrapper.h deleted file mode 100644 index 73fb2af587..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxUVWrapper.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxUVWrapper - : public FbxUVWrapper - { - public: - MOCK_CONST_METHOD3(GetElementAt, - Vector2(int, int, int)); - MOCK_CONST_METHOD0(GetName, - const char*()); - MOCK_CONST_METHOD0(IsValid, - bool()); - }; - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxVertexColorWrapper.h b/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxVertexColorWrapper.h deleted file mode 100644 index a2291807f6..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/Mocks/MockFbxVertexColorWrapper.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class MockFbxVertexColorWrapper - : public FbxVertexColorWrapper - { - public: - MOCK_CONST_METHOD3(GetElementAt, - FbxColorWrapper(int, int, int)); - MOCK_CONST_METHOD0(GetName, - const char*()); - MOCK_CONST_METHOD0(IsValid, - bool()); - }; - - } // namespace FbxSDKWrapper -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/fbxsdkwrapper_files.cmake b/Code/Tools/SceneAPI/FbxSDKWrapper/fbxsdkwrapper_files.cmake deleted file mode 100644 index a3bb994725..0000000000 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/fbxsdkwrapper_files.cmake +++ /dev/null @@ -1,69 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(FILES - FbxSceneWrapper.cpp - FbxAnimStackWrapper.cpp - FbxAnimLayerWrapper.cpp - FbxAnimCurveNodeWrapper.cpp - FbxAnimCurveWrapper.cpp - FbxNodeWrapper.cpp - FbxMeshWrapper.cpp - FbxSkinWrapper.cpp - FbxPropertyWrapper.cpp - FbxMaterialWrapper.cpp - FbxTimeWrapper.cpp - FbxTimeSpanWrapper.cpp - FbxTypeConverter.cpp - FbxAxisSystemWrapper.cpp - FbxSystemUnitWrapper.cpp - FbxVertexColorWrapper.cpp - FbxVertexTangentWrapper.cpp - FbxVertexBitangentWrapper.cpp - FbxUVWrapper.cpp - FbxBlendShapeWrapper.cpp - FbxBlendShapeChannelWrapper.cpp - FbxLayerElementUtilities.inl - FbxSceneWrapper.h - FbxAnimStackWrapper.h - FbxAnimLayerWrapper.h - FbxAnimCurveNodeWrapper.h - FbxAnimCurveWrapper.h - FbxNodeWrapper.h - FbxMeshWrapper.h - FbxSkinWrapper.h - FbxPropertyWrapper.h - FbxMaterialWrapper.h - FbxTimeWrapper.h - FbxTimeSpanWrapper.h - FbxTypeConverter.h - FbxAxisSystemWrapper.h - FbxSystemUnitWrapper.h - FbxVertexColorWrapper.h - FbxVertexTangentWrapper.h - FbxVertexBitangentWrapper.h - FbxUVWrapper.h - FbxBlendShapeWrapper.h - FbxBlendShapeChannelWrapper.h - FbxLayerElementUtilities.h - Mocks/MockFbxAnimStackWrapper.h - Mocks/MockFbxAxisSystemWrapper.h - Mocks/MockFbxMaterialWrapper.h - Mocks/MockFbxMeshWrapper.h - Mocks/MockFbxNodeWrapper.h - Mocks/MockFbxPropertyWrapper.h - Mocks/MockFbxSceneWrapper.h - Mocks/MockFbxSkinWrapper.h - Mocks/MockFbxSystemUnitWrapper.h - Mocks/MockFbxTimeWrapper.h - Mocks/MockFbxUVWrapper.h - Mocks/MockFbxVertexColorWrapper.h -) diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/CMakeLists.txt b/Code/Tools/SceneAPI/FbxSceneBuilder/CMakeLists.txt index fdd6f8b755..144191b286 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/CMakeLists.txt +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/CMakeLists.txt @@ -31,9 +31,9 @@ ly_add_target( AZ::AzFramework PUBLIC AZ::AzToolsFramework - AZ::FbxSDKWrapper AZ::SceneCore AZ::SceneData + AZ::SDKWrapper ) ly_add_target( diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp index d567f1f9c5..3dc14814de 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp @@ -31,18 +31,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include namespace AZ { @@ -78,18 +66,6 @@ namespace AZ g_componentDescriptors.push_back(FbxSceneBuilder::FbxImporter::CreateDescriptor()); // Node and attribute importers - g_componentDescriptors.push_back(FbxAnimationImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxBlendShapeImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxBoneImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxColorStreamImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxMaterialImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxMeshImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxSkinImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxSkinWeightsImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxTransformImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxUvMapImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxTangentStreamImporter::CreateDescriptor()); - g_componentDescriptors.push_back(FbxBitangentStreamImporter::CreateDescriptor()); g_componentDescriptors.push_back(AssImpBitangentStreamImporter::CreateDescriptor()); g_componentDescriptors.push_back(AssImpColorStreamImporter::CreateDescriptor()); g_componentDescriptors.push_back(AssImpMaterialImporter::CreateDescriptor()); diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp index 650eb4c935..c7f7b4ad79 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.cpp @@ -20,13 +20,10 @@ #include #include #include -#include #include #include -#include +#include #include -#include -#include #include #include #include @@ -55,16 +52,7 @@ namespace AZ FbxImporter::FbxImporter() : m_sceneSystem(new FbxSceneSystem()) { - - if (m_useAssetImporterSDK) - { - m_sceneWrapper = AZStd::make_unique(); - } - else - { - m_sceneWrapper = AZStd::make_unique(); - } - + m_sceneWrapper = AZStd::make_unique(); BindToCall(&FbxImporter::ImportProcessing); } @@ -89,15 +77,13 @@ namespace AZ typedef AZStd::function ConvertFunc; ConvertFunc convertFunc; m_sceneSystem->Set(m_sceneWrapper.get()); - if (azrtti_istypeof(m_sceneWrapper.get())) - { - convertFunc = AZStd::bind(&FbxImporter::ConvertFbxSceneContext, this, AZStd::placeholders::_1); - } - else + if (!azrtti_istypeof(m_sceneWrapper.get())) { - convertFunc = AZStd::bind(&FbxImporter::ConvertFbxScene, this, AZStd::placeholders::_1); + return Events::ProcessingResult::Failure; } + convertFunc = AZStd::bind(&FbxImporter::ConvertFbxScene, this, AZStd::placeholders::_1); + if (convertFunc(context.GetScene())) { return Events::ProcessingResult::Success; @@ -108,175 +94,6 @@ namespace AZ } } - bool FbxImporter::ConvertFbxSceneContext(Containers::Scene& scene) const - { - std::shared_ptr fbxRoot = m_sceneWrapper->GetRootNode(); - if (!fbxRoot) - { - return false; - } - FbxSDKWrapper::FbxSceneWrapper* fbxSceneWrapper = azrtti_cast (m_sceneWrapper.get()); - int sign = 0; - FbxSDKWrapper::FbxAxisSystemWrapper::UpVector upVector = fbxSceneWrapper->GetAxisSystem()->GetUpVector(sign); - AZ_Assert(sign != 0, "sign failed to populate which is a failure in GetUpVector"); - - if (upVector == FbxSDKWrapper::FbxAxisSystemWrapper::UpVector::Z) - { - if (sign > 0) - { - scene.SetOriginalSceneOrientation(Containers::Scene::SceneOrientation::ZUp); - } - else - { - scene.SetOriginalSceneOrientation(Containers::Scene::SceneOrientation::NegZUp); - AZ_Assert(false, "Negative Z Up scene orientation is not a currently supported orientation."); - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Negative Z Up scene orientation is not a currently supported orientation."); - } - } - else if (upVector == FbxSDKWrapper::FbxAxisSystemWrapper::UpVector::Y) - { - if (sign > 0) - { - scene.SetOriginalSceneOrientation(Containers::Scene::SceneOrientation::YUp); - } - else - { - scene.SetOriginalSceneOrientation(Containers::Scene::SceneOrientation::NegYUp); - AZ_Assert(false, "Negative Y Up scene orientation is not a currently supported orientation."); - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Negative Y Up scene orientation is not a currently supported orientation."); - } - } - else if (upVector == FbxSDKWrapper::FbxAxisSystemWrapper::UpVector::X) - { - if (sign > 0) - { - scene.SetOriginalSceneOrientation(Containers::Scene::SceneOrientation::XUp); - AZ_Assert(false, "Positive X Up scene orientation is not a currently supported orientation."); - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Positive X Up scene orientation is not a currently supported orientation."); - } - else - { - scene.SetOriginalSceneOrientation(Containers::Scene::SceneOrientation::NegXUp); - AZ_Assert(false, "Negative X Up scene orientation is not a currently supported orientation."); - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Negative X Up scene orientation is not a currently supported orientation."); - } - } - - AZStd::queue nodes; - nodes.emplace(AZStd::move(fbxRoot), scene.GetGraph().GetRoot()); - - RenamedNodesMap nodeNameMap; - - while (!nodes.empty()) - { - FbxSceneBuilder::QueueNode& node = nodes.front(); - - AZ_Assert(node.m_node, "Empty fbx node queued"); - - if (!nodeNameMap.RegisterNode(node.m_node, scene.GetGraph(), node.m_parent)) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Failed to register fbx node in name table."); - continue; - } - AZStd::string nodeName = nodeNameMap.GetNodeName(node.m_node); - AZ_TraceContext("SceneAPI Node Name", nodeName); - - Containers::SceneGraph::NodeIndex newNode = scene.GetGraph().AddChild(node.m_parent, nodeName.c_str()); - AZ_Assert(newNode.IsValid(), "Failed to add node to scene graph"); - if (!newNode.IsValid()) - { - continue; - } - FbxNodeEncounteredContext sourceNodeEncountered(scene, newNode, *fbxSceneWrapper, *m_sceneSystem, nodeNameMap, *azrtti_cast(node.m_node.get())); - Events::ProcessingResultCombiner nodeResult; - nodeResult += Events::Process(sourceNodeEncountered); - - // If no importer created data, we still create an empty node that may eventually contain a transform - if (sourceNodeEncountered.m_createdData.empty()) - { - AZ_Assert(nodeResult.GetResult() != Events::ProcessingResult::Success, - "Importers returned success but no data was created"); - AZStd::shared_ptr nullData(nullptr); - sourceNodeEncountered.m_createdData.emplace_back(nullData); - nodeResult += Events::ProcessingResult::Success; - } - - // Create single node since only one piece of graph data was created - if (sourceNodeEncountered.m_createdData.size() == 1) - { - AZ_Assert(nodeResult.GetResult() != Events::ProcessingResult::Ignored, - "An importer created data, but did not return success"); - if (nodeResult.GetResult() == Events::ProcessingResult::Failure) - { - AZ_TracePrintf(Utilities::ErrorWindow, "One or more importers failed to create data."); - } - - SceneDataPopulatedContext dataProcessed(sourceNodeEncountered, - sourceNodeEncountered.m_createdData[0], nodeName.c_str()); - Events::ProcessingResult result = AddDataNodeWithContexts(dataProcessed); - if (result != Events::ProcessingResult::Failure) - { - newNode = dataProcessed.m_currentGraphPosition; - } - } - // Create an empty parent node and place all data under it. The remaining - // tree will be built off of this as the logical parent - else - { - AZ_Assert(nodeResult.GetResult() != Events::ProcessingResult::Ignored, - "%i importers created data, but did not return success", - sourceNodeEncountered.m_createdData.size()); - if (nodeResult.GetResult() == Events::ProcessingResult::Failure) - { - AZ_TracePrintf(Utilities::ErrorWindow, "One or more importers failed to create data."); - } - - size_t offset = nodeName.length(); - for (size_t i = 0; i < sourceNodeEncountered.m_createdData.size(); ++i) - { - nodeName += '_'; - nodeName += AZStd::to_string(aznumeric_cast(i + 1)); - - Containers::SceneGraph::NodeIndex subNode = - scene.GetGraph().AddChild(newNode, nodeName.c_str()); - AZ_Assert(subNode.IsValid(), "Failed to create new scene sub node"); - SceneDataPopulatedContext dataProcessed(sourceNodeEncountered, - sourceNodeEncountered.m_createdData[i], nodeName); - dataProcessed.m_currentGraphPosition = subNode; - AddDataNodeWithContexts(dataProcessed); - - // Remove the temporary extension again. - nodeName.erase(offset, nodeName.length() - offset); - } - } - - AZ_Assert(nodeResult.GetResult() == Events::ProcessingResult::Success, - "No importers successfully added processed scene data."); - AZ_Assert(newNode != node.m_parent, - "Failed to update current graph position during data processing."); - - int childCount = node.m_node->GetChildCount(); - for (int i = 0; i < childCount; ++i) - { - std::shared_ptr child = std::make_shared(node.m_node->GetChild(i)->GetFbxNode()); - if (child) - { - nodes.emplace(AZStd::move(child), newNode); - } - } - - nodes.pop(); - } - - Events::ProcessingResult result = Events::Process(scene, *fbxSceneWrapper, *m_sceneSystem, nodeNameMap); - if (result == Events::ProcessingResult::Failure) - { - return false; - } - - return true; - } - bool FbxImporter::ConvertFbxScene(Containers::Scene& scene) const { std::shared_ptr fbxRoot = m_sceneWrapper->GetRootNode(); diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.h index 5bf9ab84c9..5e35bcddc3 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.h +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImporter.h @@ -45,13 +45,11 @@ namespace AZ Events::ProcessingResult ImportProcessing(Events::ImportEventContext& context); protected: - bool ConvertFbxSceneContext(Containers::Scene& scene) const; bool ConvertFbxScene(Containers::Scene& scene) const; void SanitizeNodeName(AZStd::string& nodeName) const; AZStd::unique_ptr m_sceneWrapper; AZStd::shared_ptr m_sceneSystem; - bool m_useAssetImporterSDK = true; }; } // namespace FbxSceneBuilder } // namespace SceneAPI diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxSceneSystem.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxSceneSystem.cpp index af79ab86d3..31abaf0311 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxSceneSystem.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxSceneSystem.cpp @@ -11,8 +11,8 @@ */ #include -#include #include +#include #include #include #include @@ -33,103 +33,86 @@ namespace AZ void FbxSceneSystem::Set(const SDKScene::SceneWrapperBase* fbxScene) { // Get unit conversion factor to meter. - if (azrtti_istypeof(fbxScene)) + if (!azrtti_istypeof(fbxScene)) { - const FbxSDKWrapper::FbxSceneWrapper* fbxSDKScene = azrtti_cast (fbxScene); - m_unitSizeInMeters = fbxSDKScene->GetSystemUnit()->GetConversionFactorTo(FbxSDKWrapper::FbxSystemUnitWrapper::m); - const FbxGlobalSettings& globalSettings = fbxSDKScene->GetFbxScene()->GetGlobalSettings(); - m_originalUnitSizeInMeters = static_cast(globalSettings.GetOriginalSystemUnit().GetConversionFactorTo(FbxSystemUnit::m)); - - int sign = 0; - FbxSDKWrapper::FbxAxisSystemWrapper::UpVector upVector = fbxSDKScene->GetAxisSystem()->GetUpVector(sign); - - if (upVector != FbxSDKWrapper::FbxAxisSystemWrapper::Z && upVector != FbxSDKWrapper::FbxAxisSystemWrapper::Unknown) - { - m_adjustTransform.reset(new DataTypes::MatrixType(fbxSDKScene->GetAxisSystem()->CalculateConversionTransform(FbxSDKWrapper::FbxAxisSystemWrapper::Z))); - m_adjustTransformInverse.reset(new DataTypes::MatrixType(m_adjustTransform->GetInverseFull())); - } + return; } - else if (azrtti_istypeof(fbxScene)) - { - const AssImpSDKWrapper::AssImpSceneWrapper* assImpScene = azrtti_cast(fbxScene); - // If either meta data piece is not available, the default of 1 will be used. - assImpScene->GetAssImpScene()->mMetaData->Get("UnitScaleFactor", m_unitSizeInMeters); - assImpScene->GetAssImpScene()->mMetaData->Get("OriginalUnitScaleFactor", m_originalUnitSizeInMeters); + const AssImpSDKWrapper::AssImpSceneWrapper* assImpScene = azrtti_cast(fbxScene); - /* Conversion factor for converting from centimeters to meters */ - m_unitSizeInMeters = m_unitSizeInMeters *.01f; + // If either meta data piece is not available, the default of 1 will be used. + assImpScene->GetAssImpScene()->mMetaData->Get("UnitScaleFactor", m_unitSizeInMeters); + assImpScene->GetAssImpScene()->mMetaData->Get("OriginalUnitScaleFactor", m_originalUnitSizeInMeters); - AZStd::pair upAxisAndSign = assImpScene->GetUpVectorAndSign(); + /* Conversion factor for converting from centimeters to meters */ + m_unitSizeInMeters = m_unitSizeInMeters * .01f; - if (upAxisAndSign.second <= 0) - { - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Negative scene orientation is not a currently supported orientation."); - return; - } + AZStd::pair upAxisAndSign = assImpScene->GetUpVectorAndSign(); - AZStd::pair frontAxisAndSign = assImpScene->GetFrontVectorAndSign(); + if (upAxisAndSign.second <= 0) + { + AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Negative scene orientation is not a currently supported orientation."); + return; + } + AZStd::pair frontAxisAndSign = assImpScene->GetFrontVectorAndSign(); - if (upAxisAndSign.first != AssImpSDKWrapper::AssImpSceneWrapper::AxisVector::Z && - upAxisAndSign.first != AssImpSDKWrapper::AssImpSceneWrapper::AxisVector::Unknown) + if (upAxisAndSign.first != AssImpSDKWrapper::AssImpSceneWrapper::AxisVector::Z && + upAxisAndSign.first != AssImpSDKWrapper::AssImpSceneWrapper::AxisVector::Unknown) + { + AZ::Matrix4x4 currentCoordMatrix = AZ::Matrix4x4::CreateIdentity(); + //(UpVector = +Z, FrontVector = +Y, CoordSystem = -X(RightHanded)) + AZ::Matrix4x4 targetCoordMatrix = AZ::Matrix4x4::CreateFromColumns( + AZ::Vector4(-1, 0, 0, 0), + AZ::Vector4(0, 0, 1, 0), + AZ::Vector4(0, 1, 0, 0), + AZ::Vector4(0, 0, 0, 1)); + + switch (upAxisAndSign.first) { - AZ::Matrix4x4 currentCoordMatrix = AZ::Matrix4x4::CreateIdentity(); - //(UpVector = +Z, FrontVector = +Y, CoordSystem = -X(RightHanded)) - AZ::Matrix4x4 targetCoordMatrix = AZ::Matrix4x4::CreateFromColumns( - AZ::Vector4(-1, 0, 0, 0), - AZ::Vector4(0, 0, 1, 0), - AZ::Vector4(0, 1, 0, 0), - AZ::Vector4(0, 0, 0, 1)); - - switch (upAxisAndSign.first) + case AssImpSDKWrapper::AssImpSceneWrapper::AxisVector::X: { + if (frontAxisAndSign.second == 1) + { + currentCoordMatrix = AZ::Matrix4x4::CreateFromColumns( + AZ::Vector4(0, -1, 0, 0), + AZ::Vector4(1, 0, 0, 0), + AZ::Vector4(0, 0, 1, 0), + AZ::Vector4(0, 0, 0, 1)); + } + else { - case AssImpSDKWrapper::AssImpSceneWrapper::AxisVector::X: + currentCoordMatrix = AZ::Matrix4x4::CreateFromColumns( + AZ::Vector4(0, 1, 0, 0), + AZ::Vector4(1, 0, 0, 0), + AZ::Vector4(0, 0, -1, 0), + AZ::Vector4(0, 0, 0, 1)); + } + } + break; + case AssImpSDKWrapper::AssImpSceneWrapper::AxisVector::Y: { + if (frontAxisAndSign.second == 1) { - if (frontAxisAndSign.second == 1) - { - currentCoordMatrix = AZ::Matrix4x4::CreateFromColumns( - AZ::Vector4(0, -1, 0, 0), - AZ::Vector4(1, 0, 0, 0), - AZ::Vector4(0, 0, 1, 0), - AZ::Vector4(0, 0, 0, 1)); - } - else - { - currentCoordMatrix = AZ::Matrix4x4::CreateFromColumns( - AZ::Vector4(0, 1, 0, 0), - AZ::Vector4(1, 0, 0, 0), - AZ::Vector4(0, 0, -1, 0), - AZ::Vector4(0, 0, 0, 1)); - } + currentCoordMatrix = AZ::Matrix4x4::CreateFromColumns( + AZ::Vector4(1, 0, 0, 0), + AZ::Vector4(0, 1, 0, 0), + AZ::Vector4(0, 0, 1, 0), + AZ::Vector4(0, 0, 0, 1)); } - break; - case AssImpSDKWrapper::AssImpSceneWrapper::AxisVector::Y: - { - if (frontAxisAndSign.second == 1) - { - currentCoordMatrix = AZ::Matrix4x4::CreateFromColumns( - AZ::Vector4(1, 0, 0, 0), - AZ::Vector4(0, 1, 0, 0), - AZ::Vector4(0, 0, 1, 0), - AZ::Vector4(0, 0, 0, 1)); - } - else - { - currentCoordMatrix = AZ::Matrix4x4::CreateFromColumns( - AZ::Vector4(-1, 0, 0, 0), - AZ::Vector4(0, 1, 0, 0), - AZ::Vector4(0, 0, -1, 0), - AZ::Vector4(0, 0, 0, 1)); - } - } - break; + else + { + currentCoordMatrix = AZ::Matrix4x4::CreateFromColumns( + AZ::Vector4(-1, 0, 0, 0), + AZ::Vector4(0, 1, 0, 0), + AZ::Vector4(0, 0, -1, 0), + AZ::Vector4(0, 0, 0, 1)); } - AZ::Matrix4x4 inverse = currentCoordMatrix.GetInverseTransform(); - AZ::Matrix4x4 adjustmatrix = targetCoordMatrix * currentCoordMatrix.GetInverseTransform(); - m_adjustTransform.reset(new DataTypes::MatrixType(AssImpSDKWrapper::AssImpTypeConverter::ToTransform(adjustmatrix))); - m_adjustTransformInverse.reset(new DataTypes::MatrixType(m_adjustTransform->GetInverseFull())); } + break; + } + AZ::Matrix4x4 inverse = currentCoordMatrix.GetInverseTransform(); + AZ::Matrix4x4 adjustmatrix = targetCoordMatrix * currentCoordMatrix.GetInverseTransform(); + m_adjustTransform.reset(new DataTypes::MatrixType(AssImpSDKWrapper::AssImpTypeConverter::ToTransform(adjustmatrix))); + m_adjustTransformInverse.reset(new DataTypes::MatrixType(m_adjustTransform->GetInverseFull())); } } diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/ImportContexts/FbxImportContexts.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/ImportContexts/FbxImportContexts.cpp deleted file mode 100644 index bbb1ac12ea..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/ImportContexts/FbxImportContexts.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxImportContext::FbxImportContext(const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, FbxSDKWrapper::FbxNodeWrapper& sourceNode) - : m_sourceScene(sourceScene) - , m_sourceSceneSystem(sourceSceneSystem) - , m_sourceNode(sourceNode) - { - } - - FbxNodeEncounteredContext::FbxNodeEncounteredContext(Containers::Scene& scene, - Containers::SceneGraph::NodeIndex currentGraphPosition, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap, FbxSDKWrapper::FbxNodeWrapper& sourceNode) - : FbxImportContext(sourceScene, sourceSceneSystem, sourceNode) - , NodeEncounteredContext(scene, currentGraphPosition, nodeNameMap) - { - } - - FbxNodeEncounteredContext::FbxNodeEncounteredContext( - Events::ImportEventContext& parent, Containers::SceneGraph::NodeIndex currentGraphPosition, - const FbxSDKWrapper::FbxSceneWrapper& sourceScene, const FbxSceneSystem& sourceSceneSystem, - RenamedNodesMap& nodeNameMap, FbxSDKWrapper::FbxNodeWrapper& sourceNode) - : FbxImportContext(sourceScene, sourceSceneSystem, sourceNode) - , NodeEncounteredContext(parent.GetScene(), currentGraphPosition, nodeNameMap) - { - } - - SceneDataPopulatedContext::SceneDataPopulatedContext(FbxNodeEncounteredContext& parent, - const AZStd::shared_ptr& graphData, const AZStd::string& dataName) - : FbxImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode) - , SceneDataPopulatedContextBase(parent, graphData, dataName) - { - } - - SceneDataPopulatedContext::SceneDataPopulatedContext(Containers::Scene& scene, - Containers::SceneGraph::NodeIndex currentGraphPosition, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap, FbxSDKWrapper::FbxNodeWrapper& sourceNode, - const AZStd::shared_ptr& nodeData, const AZStd::string& dataName) - : FbxImportContext(sourceScene, sourceSceneSystem, sourceNode) - , SceneDataPopulatedContextBase(scene, currentGraphPosition, nodeNameMap, nodeData, dataName) - { - } - - SceneNodeAppendedContext::SceneNodeAppendedContext(SceneDataPopulatedContext& parent, - Containers::SceneGraph::NodeIndex newIndex) - : FbxImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode) - , SceneNodeAppendedContextBase(parent.m_scene, newIndex, parent.m_nodeNameMap) - { - } - - SceneNodeAppendedContext::SceneNodeAppendedContext(Containers::Scene& scene, - Containers::SceneGraph::NodeIndex currentGraphPosition, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap, FbxSDKWrapper::FbxNodeWrapper& sourceNode) - : FbxImportContext(sourceScene, sourceSceneSystem, sourceNode) - , SceneNodeAppendedContextBase(scene, currentGraphPosition, nodeNameMap) - { - } - - SceneAttributeDataPopulatedContext::SceneAttributeDataPopulatedContext(SceneNodeAppendedContext& parent, - const AZStd::shared_ptr& nodeData, - const Containers::SceneGraph::NodeIndex attributeNodeIndex, const AZStd::string& dataName) - : FbxImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode) - , SceneAttributeDataPopulatedContextBase(parent, nodeData, attributeNodeIndex, dataName) - { - } - - SceneAttributeNodeAppendedContext::SceneAttributeNodeAppendedContext( - SceneAttributeDataPopulatedContext& parent, Containers::SceneGraph::NodeIndex newIndex) - : FbxImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode) - , SceneAttributeNodeAppendedContextBase(parent, newIndex) - { - } - - SceneNodeAddedAttributesContext::SceneNodeAddedAttributesContext(SceneNodeAppendedContext& parent) - : FbxImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode) - , SceneNodeAddedAttributesContextBase(parent) - { - } - - SceneNodeFinalizeContext::SceneNodeFinalizeContext(SceneNodeAddedAttributesContext& parent) - : FbxImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode) - , SceneNodeFinalizeContextBase(parent) - { - } - - FinalizeSceneContext::FinalizeSceneContext(Containers::Scene& scene, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap) - : FinalizeSceneContextBase(scene, nodeNameMap) - , m_sourceScene(sourceScene) - , m_sourceSceneSystem(sourceSceneSystem) - { - } - } // namespace SceneAPI - } // namespace FbxSceneBuilder -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/ImportContexts/FbxImportContexts.h b/Code/Tools/SceneAPI/FbxSceneBuilder/ImportContexts/FbxImportContexts.h deleted file mode 100644 index a3bc3e0b45..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/ImportContexts/FbxImportContexts.h +++ /dev/null @@ -1,184 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxSceneWrapper; - class FbxNodeWrapper; - } - - namespace SceneAPI - { - class FbxSceneSystem; - - namespace FbxSceneBuilder - { - class RenamedNodesMap; - - // FbxImportContext - // Base structure containing common data needed for all import contexts - // Member Variables: - // m_sourceScene - Basic scene data extracted from the FBX Scene. Used to - // transform data. - // m_sourceNode - FBX node being used for data processing. - struct FbxImportContext - { - AZ_RTTI(FbxImportContext, "{C8D665D5-E871-41AD-90E7-C84CF6842BCF}"); - - FbxImportContext(const FbxSDKWrapper::FbxSceneWrapper& sourceScene, const FbxSceneSystem& sourceSceneSystem, - FbxSDKWrapper::FbxNodeWrapper& sourceNode); - - const FbxSDKWrapper::FbxSceneWrapper& m_sourceScene; - const FbxSceneSystem& m_sourceSceneSystem; // Needed for unit and axis conversion - FbxSDKWrapper::FbxNodeWrapper& m_sourceNode; - }; - - // FbxNodeEncounteredContext - // Context pushed to indicate that a new FBX Node has been found and any - // importers that have means to process the contained data should do so - // Member Variables: - // m_createdData - out container that importers must add their created data - // to. - struct FbxNodeEncounteredContext - : public FbxImportContext - , public NodeEncounteredContext - { - AZ_RTTI(FbxNodeEncounteredContext, "{BE21E324-6745-41FD-A79C-A6CA7AB15A7A}", FbxImportContext, NodeEncounteredContext); - - FbxNodeEncounteredContext(Containers::Scene& scene, - Containers::SceneGraph::NodeIndex currentGraphPosition, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap, FbxSDKWrapper::FbxNodeWrapper& sourceNode); - - FbxNodeEncounteredContext(Events::ImportEventContext& parent, - Containers::SceneGraph::NodeIndex currentGraphPosition, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap, FbxSDKWrapper::FbxNodeWrapper& sourceNode); - }; - - // SceneDataPopulatedContext - // Context pushed to indicate that a piece of scene data has been fully - // processed and any importers that wish to place it within the scene graph - // may now do so. This may be triggered by processing a FbxNodeEncounteredContext - // (for base data, e.g. bones, meshes) or from a SceneNodeAppendedContext - // (for attribute data, e.g. UV Maps, materials) - // Member Variables: - // m_graphData - the piece of data that should be inserted in the graph - // m_dataName - the name that should be used as the basis for the scene node - // name - // m_isAttribute - Indicates whether the graph data is an attribute - struct SceneDataPopulatedContext - : public FbxImportContext - , public SceneDataPopulatedContextBase - { - AZ_RTTI(SceneDataPopulatedContext, "{DF17306C-FE28-4BEB-9CF0-88CF0472B8A8}", FbxImportContext, SceneDataPopulatedContextBase); - - SceneDataPopulatedContext(FbxNodeEncounteredContext& parent, - const AZStd::shared_ptr& nodeData, - const AZStd::string& dataName); - - SceneDataPopulatedContext(Containers::Scene& scene, - Containers::SceneGraph::NodeIndex currentGraphPosition, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap, FbxSDKWrapper::FbxNodeWrapper& sourceNode, - const AZStd::shared_ptr& nodeData, const AZStd::string& dataName); - }; - - // SceneNodeAppendedContext - // Context pushed to indicate that data has been added to the scene graph. - // Generally created due to the insertion of a node during SceneDataPopulatedContext - // processing. - struct SceneNodeAppendedContext - : public FbxImportContext - , public SceneNodeAppendedContextBase - { - AZ_RTTI(SceneNodeAppendedContext, "{72C1C37A-C6ED-4CB7-B929-DA03AA44131C}", FbxImportContext, SceneNodeAppendedContextBase); - - SceneNodeAppendedContext(SceneDataPopulatedContext& parent, Containers::SceneGraph::NodeIndex newIndex); - SceneNodeAppendedContext(Containers::Scene& scene, - Containers::SceneGraph::NodeIndex currentGraphPosition, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap, FbxSDKWrapper::FbxNodeWrapper& sourceNode); - }; - - // SceneAttributeDataPopulatedContext - // Context pushed to indicate that attribute data has been found and processed - struct SceneAttributeDataPopulatedContext - : public FbxImportContext - , public SceneAttributeDataPopulatedContextBase - { - AZ_RTTI(SceneAttributeDataPopulatedContext, "{93E67C26-5A40-4385-8189-947A626E3CDA}", FbxImportContext, SceneAttributeDataPopulatedContextBase); - - SceneAttributeDataPopulatedContext(SceneNodeAppendedContext& parent, - const AZStd::shared_ptr& nodeData, - const Containers::SceneGraph::NodeIndex attributeNodeIndex, const AZStd::string& dataName); - }; - - // SceneAttributeNodeAppendedContext - // Context pushed to indicate that an attribute node has been added to the scene graph - struct SceneAttributeNodeAppendedContext - : public FbxImportContext - , public SceneAttributeNodeAppendedContextBase - { - AZ_RTTI(SceneAttributeNodeAppendedContext, "{C0DD4F39-5C61-4CA0-96C5-9EA3AC40D98B}", FbxImportContext, SceneAttributeNodeAppendedContextBase); - - SceneAttributeNodeAppendedContext(SceneAttributeDataPopulatedContext& parent, - Containers::SceneGraph::NodeIndex newIndex); - }; - - // SceneNodeAddedAttributesContext - // Context pushed to indicate that all attribute processors have completed their - // work for a specific data node. - struct SceneNodeAddedAttributesContext - : public FbxImportContext - , public SceneNodeAddedAttributesContextBase - { - AZ_RTTI(SceneNodeAddedAttributesContext, "{1601900C-5109-4D37-83F1-22317A4D7C78}", FbxImportContext, SceneNodeAddedAttributesContextBase); - - SceneNodeAddedAttributesContext(SceneNodeAppendedContext& parent); - }; - - // SceneNodeFinalizeContext - // Context pushed last after all other contexts for a scene node to allow any - // post-processing needed for an importer. - struct SceneNodeFinalizeContext - : public FbxImportContext - , public SceneNodeFinalizeContextBase - { - AZ_RTTI(SceneNodeFinalizeContext, "{D1D9839A-EA48-425D-BB7A-A9AEA65B8B7A}", FbxImportContext, SceneNodeFinalizeContextBase); - - SceneNodeFinalizeContext(SceneNodeAddedAttributesContext& parent); - }; - - // FinalizeSceneContext - // Context pushed after the scene has been fully created. This can be used to finalize pending work - // such as resolving named links. - struct FinalizeSceneContext - : public FinalizeSceneContextBase - { - AZ_RTTI(FinalizeSceneContext, "{C8D665D5-E871-41AD-90E7-C84CF6842BCF}", FinalizeSceneContextBase); - - FinalizeSceneContext(Containers::Scene& scene, const FbxSDKWrapper::FbxSceneWrapper& sourceScene, - const FbxSceneSystem& sourceSceneSystem, RenamedNodesMap& nodeNameMap); - - const FbxSDKWrapper::FbxSceneWrapper& m_sourceScene; - const FbxSceneSystem& m_sourceSceneSystem; // Needed for unit and axis conversion - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ - diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpAnimationImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpAnimationImporter.cpp index e456f2dbab..dd92e6bb8b 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpAnimationImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpAnimationImporter.cpp @@ -22,11 +22,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpAnimationImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpAnimationImporter.h index 3c06153d04..e27264c171 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpAnimationImporter.h +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpAnimationImporter.h @@ -12,8 +12,6 @@ #pragma once -#include -#include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBitangentStreamImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBitangentStreamImporter.cpp index b5bcab31e6..c2b1f20035 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBitangentStreamImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBitangentStreamImporter.cpp @@ -14,13 +14,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include +#include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBlendShapeImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBlendShapeImporter.cpp index 404a5857c1..c0399329d3 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBlendShapeImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBlendShapeImporter.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBoneImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBoneImporter.cpp index 0dd525c058..4467d6933b 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBoneImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpBoneImporter.cpp @@ -17,8 +17,7 @@ #include #include #include -#include -#include +#include #include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpColorStreamImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpColorStreamImporter.cpp index 55c14fd5d7..7ebdb55363 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpColorStreamImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpColorStreamImporter.cpp @@ -14,13 +14,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include +#include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpMaterialImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpMaterialImporter.cpp index a63c2406f4..e314804ea1 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpMaterialImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpMaterialImporter.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpSkinWeightsImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpSkinWeightsImporter.cpp index bcfbaa9624..abcbf10b4a 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpSkinWeightsImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpSkinWeightsImporter.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpTangentStreamImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpTangentStreamImporter.cpp index 88177a04a0..992a6a6ab1 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpTangentStreamImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpTangentStreamImporter.cpp @@ -14,13 +14,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include +#include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpTransformImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpTransformImporter.cpp index 90030a3058..84c0e3e18c 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpTransformImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpTransformImporter.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpUvMapImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpUvMapImporter.cpp index 65e7c00d74..f5f47b233d 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpUvMapImporter.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/AssImpUvMapImporter.cpp @@ -16,12 +16,13 @@ #include #include #include -#include +#include #include #include #include #include #include +#include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxAnimationImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxAnimationImporter.cpp deleted file mode 100644 index 8122b68e3d..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxAnimationImporter.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - const char* FbxAnimationImporter::s_animationNodeName = "animation"; - const FbxSDKWrapper::FbxTimeWrapper::TimeMode FbxAnimationImporter::s_defaultTimeMode = - FbxSDKWrapper::FbxTimeWrapper::frames30; - - FbxAnimationImporter::FbxAnimationImporter() - { - BindToCall(&FbxAnimationImporter::ImportAnimation); - } - - void FbxAnimationImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxAnimationImporter::ImportAnimation(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "Animation"); - - // Add check for animation layers at the scene level. - - if (context.m_sourceScene.GetAnimationStackCount() <= 0) - { - return Events::ProcessingResult::Ignored; - } - - if (context.m_sourceNode.IsMesh()) - { - return ImportBlendShapeAnimation(context); - } - - if (!context.m_sourceNode.IsBone()) - { - return Events::ProcessingResult::Ignored; - } - - AZStd::string nodeName = s_animationNodeName; - RenamedNodesMap::SanitizeNodeName(nodeName, context.m_scene.GetGraph(), context.m_currentGraphPosition); - AZ_TraceContext("Animation node name", nodeName); - - auto animStackWrapper = context.m_sourceScene.GetAnimationStackAt(0); - const FbxSDKWrapper::FbxTimeWrapper startTime = animStackWrapper->GetLocalTimeSpan().GetStartTime(); - const double frameRate = startTime.GetFrameRate(); - - if (frameRate == 0.0) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Scene has a 0 framerate. Animation cannot be processed without timing information."); - return Events::ProcessingResult::Failure; - } - - const int64_t startFrame = startTime.GetFrameCount(); - const int64_t numFrames = animStackWrapper->GetLocalTimeSpan().GetNumFrames(); - - AZStd::shared_ptr createdAnimationData = - AZStd::make_shared(); - createdAnimationData->ReserveKeyFrames(numFrames); - createdAnimationData->SetTimeStepBetweenFrames(1.0 / frameRate); - - { - FbxSDKWrapper::FbxTimeWrapper currTime = startTime; - for (int64_t currFrame = startFrame; currFrame < startFrame + numFrames; currFrame++) - { - currTime.SetFrame(currFrame); - - SceneAPI::DataTypes::MatrixType animTransform = context.m_sourceNode.EvaluateLocalTransform(currTime); - context.m_sourceSceneSystem.SwapTransformForUpAxis(animTransform); - context.m_sourceSceneSystem.ConvertBoneUnit(animTransform); - - createdAnimationData->AddKeyFrame(animTransform); - } - - AZ_Assert(createdAnimationData->GetKeyFrameCount() == numFrames, "The imported animation data created does not have the same number of keyframes as the FBX data."); - } - - Containers::SceneGraph::NodeIndex addNode = context.m_scene.GetGraph().AddChild( - context.m_currentGraphPosition, nodeName.c_str(), AZStd::move(createdAnimationData)); - context.m_scene.GetGraph().MakeEndPoint(addNode); - - return Events::ProcessingResult::Success; - } - - Events::ProcessingResult FbxAnimationImporter::ImportBlendShapeAnimation(SceneNodeAppendedContext& context) - { - FbxNode * node = context.m_sourceNode.GetFbxNode(); - FbxMesh * pMesh = node->GetMesh(); - if (!pMesh) - { - return Events::ProcessingResult::Ignored; - } - - int deformerCount = pMesh->GetDeformerCount(FbxDeformer::eBlendShape); - int blendShapeIndex = -1; - AZStd::string nodeName; - AZStd::string animNodeName; - for (int deformerIndex = 0; deformerIndex < deformerCount; ++deformerIndex) - { - //we are assuming 1 anim stack (single animation clip export) - const FbxBlendShape* pDeformer = (FbxBlendShape*)pMesh->GetDeformer(deformerIndex, FbxDeformer::eBlendShape); - if (!pDeformer) - { - continue; - } - blendShapeIndex++; - int blendShapeChannelCount = pDeformer->GetBlendShapeChannelCount(); - auto animStackWrapper = context.m_sourceScene.GetAnimationStackAt(0); - - const FbxSDKWrapper::FbxTimeWrapper startTime = animStackWrapper->GetLocalTimeSpan().GetStartTime(); - const double frameRate = startTime.GetFrameRate(); - - if (frameRate == 0.0) - { - AZ_TracePrintf("Animation_Warning", "Scene has a 0 framerate. Animation cannot be processed without timing information."); - return Events::ProcessingResult::Failure; - } - - const int64_t startFrame = startTime.GetFrameCount(); - const int64_t numFrames = animStackWrapper->GetLocalTimeSpan().GetNumFrames(); - - const int layerCount = animStackWrapper->GetAnimationLayerCount(); - - for (int blendShapeChannelIdx = 0; blendShapeChannelIdx < blendShapeChannelCount; ++blendShapeChannelIdx) - { - const FbxBlendShapeChannel* pChannel = pDeformer->GetBlendShapeChannel(blendShapeChannelIdx); - if (!pChannel) - { - continue; - } - - for (int layerIndex = 0; layerIndex < layerCount; layerIndex++) - { - FbxAnimLayer* animationLayer = animStackWrapper->GetAnimationLayerAt(layerIndex)->GetFbxLayer(); - FbxAnimCurve* animCurve = pMesh->GetShapeChannel(blendShapeIndex, blendShapeChannelIdx, animationLayer); - if (!animCurve) - { - continue; - } - AZStd::shared_ptr animCurveWrapper = AZStd::make_shared(animCurve); - - AZStd::shared_ptr createdAnimationData = - AZStd::make_shared(); - - createdAnimationData->ReserveKeyFrames(numFrames); - createdAnimationData->SetTimeStepBetweenFrames(1.0 / frameRate); - - { - FbxSDKWrapper::FbxTimeWrapper currTime = startTime; - for (int64_t currFrame = startFrame; currFrame < startFrame + numFrames; currFrame++) - { - currTime.SetFrame(currFrame); - - //weight values from FBX are range 0 - 100 - float sampleValue = animCurveWrapper->Evaluate(currTime) / 100.0f; - createdAnimationData->AddKeyFrame(sampleValue); - } - AZ_Assert(createdAnimationData->GetKeyFrameCount() == numFrames, "Imported animation blend data does not contain the same number of keyframes as the source FBX data.") - } - - nodeName = pChannel->GetName(); - const size_t dotIndex = nodeName.find_last_of('.'); - nodeName = nodeName.substr(dotIndex + 1); - createdAnimationData->SetBlendShapeName(nodeName.c_str()); - animNodeName = AZStd::string::format("%s_%s", s_animationNodeName, nodeName.c_str()); - Containers::SceneGraph::NodeIndex addNode = context.m_scene.GetGraph().AddChild( - context.m_currentGraphPosition, animNodeName.c_str(), AZStd::move(createdAnimationData)); - context.m_scene.GetGraph().MakeEndPoint(addNode); - } - } - } - return Events::ProcessingResult::Success; - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxAnimationImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxAnimationImporter.h deleted file mode 100644 index 2abb7f1170..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxAnimationImporter.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxAnimationImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxAnimationImporter, "{26ABDA62-9DB7-4B4D-961D-44B5F5F56808}", SceneCore::LoadingComponent); - - FbxAnimationImporter(); - ~FbxAnimationImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportAnimation(SceneNodeAppendedContext& context); - Events::ProcessingResult ImportBlendShapeAnimation(SceneNodeAppendedContext& context); - - protected: - static const char* s_animationNodeName; - static const FbxSDKWrapper::FbxTimeWrapper::TimeMode s_defaultTimeMode; - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBitangentStreamImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBitangentStreamImporter.cpp deleted file mode 100644 index f94dc9cf2f..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBitangentStreamImporter.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxBitangentStreamImporter::FbxBitangentStreamImporter() - { - BindToCall(&FbxBitangentStreamImporter::ImportBitangents); - } - - - void FbxBitangentStreamImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - - Events::ProcessingResult FbxBitangentStreamImporter::ImportBitangents(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "Bitangents"); - std::shared_ptr fbxMesh = context.m_sourceNode.GetMesh(); - if (!fbxMesh) - { - return Events::ProcessingResult::Ignored; - } - - Events::ProcessingResultCombiner combinedStreamResults; - const int numBitangentSets = context.m_sourceNode.GetMesh()->GetElementBitangentCount(); - for (int elementIndex = 0; elementIndex < numBitangentSets; ++elementIndex) - { - AZ_TraceContext("Bitangent set index", elementIndex); - - FbxSDKWrapper::FbxVertexBitangentWrapper fbxVertexBitangents = fbxMesh->GetElementBitangent(elementIndex); - if (!fbxVertexBitangents.IsValid()) - { - AZ_TracePrintf(Utilities::WarningWindow, "Invalid bitangent set found, ignoring"); - continue; - } - - const AZStd::string originalNodeName = AZStd::string::format("BitangentSet_Fbx_%d", elementIndex); - const AZStd::string nodeName = AZ::SceneAPI::DataTypes::Utilities::CreateUniqueName(originalNodeName, context.m_scene.GetManifest()); - AZ_TraceContext("Bitangent Set Name", nodeName); - if (originalNodeName != nodeName) - { - AZ_TracePrintf(Utilities::WarningWindow, "Bitangent set '%s' has been renamed to '%s' because the name was already in use.", originalNodeName.c_str(), nodeName.c_str()); - } - - AZStd::shared_ptr parentData = context.m_scene.GetGraph().GetNodeContent(context.m_currentGraphPosition); - AZ_Assert(parentData && parentData->RTTI_IsTypeOf(SceneData::GraphData::MeshData::TYPEINFO_Uuid()), "Tried to construct bitangent set attribute for invalid or non-mesh parent data"); - if (!parentData || !parentData->RTTI_IsTypeOf(SceneData::GraphData::MeshData::TYPEINFO_Uuid())) - { - combinedStreamResults += Events::ProcessingResult::Failure; - continue; - } - - const SceneData::GraphData::MeshData* const parentMeshData = azrtti_cast(parentData.get()); - const size_t vertexCount = parentMeshData->GetVertexCount(); - AZStd::shared_ptr bitangentStream = BuildVertexBitangentData(fbxVertexBitangents, vertexCount, fbxMesh); - - AZ_Assert(bitangentStream, "Failed to allocate bitangent data for scene graph."); - if (!bitangentStream) - { - combinedStreamResults += Events::ProcessingResult::Failure; - continue; - } - - bitangentStream->SetBitangentSetIndex(elementIndex); - bitangentStream->SetTangentSpace(AZ::SceneAPI::DataTypes::TangentSpace::FromFbx); - - Containers::SceneGraph::NodeIndex newIndex = context.m_scene.GetGraph().AddChild(context.m_currentGraphPosition, nodeName.c_str()); - AZ_Assert(newIndex.IsValid(), "Failed to create SceneGraph node for attribute."); - if (!newIndex.IsValid()) - { - combinedStreamResults += Events::ProcessingResult::Failure; - continue; - } - - Events::ProcessingResult streamResults; - SceneAttributeDataPopulatedContext dataPopulated(context, bitangentStream, newIndex, nodeName); - streamResults = Events::Process(dataPopulated); - if (streamResults != Events::ProcessingResult::Failure) - { - streamResults = AddAttributeDataNodeWithContexts(dataPopulated); - } - - combinedStreamResults += streamResults; - } - - return combinedStreamResults.GetResult(); - } - - - AZStd::shared_ptr FbxBitangentStreamImporter::BuildVertexBitangentData(const FbxSDKWrapper::FbxVertexBitangentWrapper& bitangents, size_t vertexCount, const std::shared_ptr& fbxMesh) - { - AZStd::shared_ptr bitangentData = AZStd::make_shared(); - bitangentData->ReserveContainerSpace(vertexCount); - - const int fbxPolygonCount = fbxMesh->GetPolygonCount(); - const int* const fbxPolygonVertices = fbxMesh->GetPolygonVertices(); - for (int fbxPolygonIndex = 0; fbxPolygonIndex < fbxPolygonCount; ++fbxPolygonIndex) - { - const int fbxPolygonVertexCount = fbxMesh->GetPolygonSize(fbxPolygonIndex); - if (fbxPolygonVertexCount <= 2) - { - continue; - } - - const int fbxVertexStartIndex = fbxMesh->GetPolygonVertexIndex(fbxPolygonIndex); - for (int index = 0; index < fbxPolygonVertexCount; ++index) - { - const int fbxPolygonVertexIndex = fbxVertexStartIndex + index; - const int fbxControlPointIndex = fbxPolygonVertices[fbxPolygonVertexIndex]; - - const Vector3 bitangent = bitangents.GetElementAt(fbxPolygonIndex, fbxPolygonVertexIndex, fbxControlPointIndex); - bitangentData->AppendBitangent(bitangent); - } - } - - if (bitangentData->GetCount() != vertexCount) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Vertex count (%i) doesn't match the number of entries for the bitangent stream %s (%i)", vertexCount, bitangents.GetName(), bitangentData->GetCount()); - return nullptr; - } - - return bitangentData; - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBitangentStreamImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBitangentStreamImporter.h deleted file mode 100644 index 4fd6820ebf..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBitangentStreamImporter.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace SceneData - { - namespace GraphData - { - class MeshVertexBitangentData; - } - } - - namespace FbxSDKWrapper - { - class FbxMeshWrapper; - class FbxVertexBitangentWrapper; - } - - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxBitangentStreamImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxBitangentStreamImporter, "{B68F90E6-9F9D-448F-A874-CABA9F67E5FD}", SceneCore::LoadingComponent); - - FbxBitangentStreamImporter(); - ~FbxBitangentStreamImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportBitangents(SceneNodeAppendedContext& context); - - protected: - AZStd::shared_ptr BuildVertexBitangentData(const FbxSDKWrapper::FbxVertexBitangentWrapper& bitangents, - size_t vertexCount, const std::shared_ptr& fbxMesh); - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBlendShapeImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBlendShapeImporter.cpp deleted file mode 100644 index cc20d76d87..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBlendShapeImporter.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxBlendShapeImporter::FbxBlendShapeImporter() - { - BindToCall(&FbxBlendShapeImporter::ImportBlendShapes); - } - - void FbxBlendShapeImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxBlendShapeImporter::ImportBlendShapes(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "Blend Shapes"); - - if (!IsSkinnedMesh(context.m_sourceNode)) - { - return Events::ProcessingResult::Ignored; - } - - Events::ProcessingResultCombiner combinedBlendShapeResult; - - const std::shared_ptr sourceMesh = context.m_sourceNode.GetMesh(); - int blendShapeDeformerCount = sourceMesh->GetDeformerCount(FbxDeformer::eBlendShape); - for (int deformerIndex = 0; deformerIndex < blendShapeDeformerCount; ++deformerIndex) - { - AZ_TraceContext("Deformer Index", deformerIndex); - AZStd::shared_ptr fbxBlendShape = sourceMesh->GetBlendShape(deformerIndex); - - if (!fbxBlendShape) - { - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Unable to extract BlendShape Deformer at index %d", deformerIndex); - return Events::ProcessingResult::Failure; - } - int blendShapeChannelCount = fbxBlendShape->GetBlendShapeChannelCount(); - for (int channelIndex = 0; channelIndex < blendShapeChannelCount; ++channelIndex) - { - //extract the mesh and build a blendshape data object. - AZStd::shared_ptr blendShapeChannel = fbxBlendShape->GetBlendShapeChannel(channelIndex); - - int shapeCount = blendShapeChannel->GetTargetShapeCount(); - - //We do not support percentage blends at this time. Take only the final shape. - AZStd::shared_ptr mesh = blendShapeChannel->GetTargetShape(shapeCount - 1); - - if (mesh) - { - //Maya is creating node names of the form cone_skin_blendShapeNode.cone_squash during export. - //We need the name after the period for our naming purposes. - AZStd::string nodeName(blendShapeChannel->GetName()); - size_t dotIndex = nodeName.rfind('.'); - if (dotIndex != AZStd::string::npos) - { - nodeName.erase(0, dotIndex + 1); - } - RenamedNodesMap::SanitizeNodeName(nodeName, context.m_scene.GetGraph(), context.m_currentGraphPosition, "BlendShape"); - AZ_TraceContext("Blend shape name", nodeName); - - AZStd::shared_ptr blendShapeData = - AZStd::make_shared(); - - BuildSceneBlendShapeFromFbxBlendShape(blendShapeData, mesh, context.m_sourceSceneSystem); - - Containers::SceneGraph::NodeIndex newIndex = - context.m_scene.GetGraph().AddChild(context.m_currentGraphPosition, nodeName.c_str()); - - Events::ProcessingResult blendShapeResult; - SceneAttributeDataPopulatedContext dataPopulated(context, blendShapeData, newIndex, nodeName); - blendShapeResult = Events::Process(dataPopulated); - - if (blendShapeResult != Events::ProcessingResult::Failure) - { - blendShapeResult = AddAttributeDataNodeWithContexts(dataPopulated); - } - combinedBlendShapeResult += blendShapeResult; - } - else - { - AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Unable to extract blendshape mesh for node '%s' from BlendShapeChannel %d", sourceMesh->GetName(), channelIndex); - combinedBlendShapeResult += Events::ProcessingResult::Failure; - } - } - } - - return combinedBlendShapeResult.GetResult(); - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBlendShapeImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBlendShapeImporter.h deleted file mode 100644 index b56a622383..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBlendShapeImporter.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxBlendShapeImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxBlendShapeImporter, "{3E733F1B-B4A1-4F6F-B2EE-A1C501830E91}", SceneCore::LoadingComponent); - - FbxBlendShapeImporter(); - ~FbxBlendShapeImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportBlendShapes(SceneNodeAppendedContext& context); - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBoneImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBoneImporter.cpp deleted file mode 100644 index 728a4c7828..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBoneImporter.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxBoneImporter::FbxBoneImporter() - { - BindToCall(&FbxBoneImporter::ImportBone); - } - - void FbxBoneImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxBoneImporter::ImportBone(FbxNodeEncounteredContext& context) - { - AZ_TraceContext("Importer", "Bone"); - - if (!context.m_sourceNode.IsBone()) - { - return Events::ProcessingResult::Ignored; - } - - AZStd::shared_ptr boneGraphData; - - // If the current scene node (our eventual parent) contains bone data, we are not a root bone - AZStd::shared_ptr createdBoneData; - - if (NodeHasAncestorOfType(context.m_scene.GetGraph(), context.m_currentGraphPosition, - DataTypes::IBoneData::TYPEINFO_Uuid())) - { - createdBoneData = AZStd::make_shared(); - } - else - { - createdBoneData = AZStd::make_shared(); - } - - SceneAPI::DataTypes::MatrixType globalTransform = context.m_sourceNode.EvaluateGlobalTransform(); - - context.m_sourceSceneSystem.SwapTransformForUpAxis(globalTransform); - - context.m_sourceSceneSystem.ConvertBoneUnit(globalTransform); - - createdBoneData->SetWorldTransform(globalTransform); - - context.m_createdData.push_back(AZStd::move(createdBoneData)); - - return Events::ProcessingResult::Success; - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBoneImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBoneImporter.h deleted file mode 100644 index 29ac288149..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxBoneImporter.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxBoneImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxBoneImporter, "{3575F356-BC2F-45F6-B57C-9C590ED54995}", SceneCore::LoadingComponent); - - FbxBoneImporter(); - ~FbxBoneImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportBone(FbxNodeEncounteredContext& context); - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxColorStreamImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxColorStreamImporter.cpp deleted file mode 100644 index 78c2933d0b..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxColorStreamImporter.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxColorStreamImporter::FbxColorStreamImporter() - { - BindToCall(&FbxColorStreamImporter::ImportColorStreams); - } - - void FbxColorStreamImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxColorStreamImporter::ImportColorStreams(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "Color Stream"); - std::shared_ptr fbxMesh = - context.m_sourceNode.GetMesh(); - if (!fbxMesh) - { - return Events::ProcessingResult::Ignored; - } - - Events::ProcessingResultCombiner combinedVertexColorResults; - - for (int i = 0; i < context.m_sourceNode.GetMesh()->GetElementVertexColorCount(); ++i) - { - AZ_TraceContext("Vertex color index", i); - - FbxSDKWrapper::FbxVertexColorWrapper fbxVertexColors = - fbxMesh->GetElementVertexColor(i); - - if (!fbxVertexColors.IsValid()) - { - AZ_TracePrintf(Utilities::WarningWindow, "Invalid vertex color channel found, ignoring"); - continue; - } - - AZStd::string nodeName = fbxVertexColors.GetName(); - RenamedNodesMap::SanitizeNodeName(nodeName, context.m_scene.GetGraph(), context.m_currentGraphPosition, "ColorStream"); - AZ_TraceContext("Color Stream Name", nodeName); - - AZStd::shared_ptr parentData = - context.m_scene.GetGraph().GetNodeContent(context.m_currentGraphPosition); - AZ_Assert(parentData && parentData->RTTI_IsTypeOf(SceneData::GraphData::MeshData::TYPEINFO_Uuid()), - "Tried to construct color stream attribute for invalid or non-mesh parent data"); - if (!parentData || !parentData->RTTI_IsTypeOf(SceneData::GraphData::MeshData::TYPEINFO_Uuid())) - { - combinedVertexColorResults += Events::ProcessingResult::Failure; - continue; - } - - SceneData::GraphData::MeshData* parentMeshData = - azrtti_cast(parentData.get()); - size_t vertexCount = parentMeshData->GetVertexCount(); - AZStd::shared_ptr vertexColors = - BuildVertexColorData(fbxVertexColors, vertexCount, fbxMesh); - AZ_Assert(vertexColors, "Failed to allocate vertex color data for scene graph."); - if (!vertexColors) - { - combinedVertexColorResults += Events::ProcessingResult::Failure; - continue; - } - - Containers::SceneGraph::NodeIndex newIndex = - context.m_scene.GetGraph().AddChild(context.m_currentGraphPosition, nodeName.c_str()); - - AZ_Assert(newIndex.IsValid(), "Failed to create SceneGraph node for attribute."); - if (!newIndex.IsValid()) - { - combinedVertexColorResults += Events::ProcessingResult::Failure; - continue; - } - - Events::ProcessingResult vertexColorResult; - SceneAttributeDataPopulatedContext dataPopulated(context, vertexColors, newIndex, nodeName); - vertexColorResult = AddAttributeDataNodeWithContexts(dataPopulated); - - combinedVertexColorResults += vertexColorResult; - } - - return combinedVertexColorResults.GetResult(); - } - - AZStd::shared_ptr FbxColorStreamImporter::BuildVertexColorData(const FbxSDKWrapper::FbxVertexColorWrapper& fbxVertexColors, size_t vertexCount, const std::shared_ptr& fbxMesh) - { - AZ_Assert(fbxVertexColors.IsValid(), "BuildVertexColorData was called for invalid color stream data."); - if (!fbxVertexColors.IsValid()) - { - return nullptr; - } - - AZStd::shared_ptr colorData = AZStd::make_shared(); - colorData->ReserveContainerSpace(vertexCount); - colorData->SetCustomName(fbxVertexColors.GetName()); - - const int fbxPolygonCount = fbxMesh->GetPolygonCount(); - const int* const fbxPolygonVertices = fbxMesh->GetPolygonVertices(); - for (int fbxPolygonIndex = 0; fbxPolygonIndex < fbxPolygonCount; ++fbxPolygonIndex) - { - const int fbxPolygonVertexCount = fbxMesh->GetPolygonSize(fbxPolygonIndex); - if (fbxPolygonVertexCount < 3) - { - continue; - } - - const int fbxVertexStartIndex = fbxMesh->GetPolygonVertexIndex(fbxPolygonIndex); - - for (int polygonVertexIndex = 0; polygonVertexIndex < fbxPolygonVertexCount; ++polygonVertexIndex) - { - const int fbxPolygonVertexIndex = fbxVertexStartIndex + polygonVertexIndex; - const int fbxControlPointIndex = fbxPolygonVertices[fbxPolygonVertexIndex]; - - FbxSDKWrapper::FbxColorWrapper color = fbxVertexColors.GetElementAt(fbxPolygonIndex, fbxPolygonVertexIndex, fbxControlPointIndex); - - colorData->AppendColor({color.GetR(), color.GetG(), color.GetB(), color.GetAlpha()}); - } - } - - if (colorData->GetCount() != vertexCount) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Vertex count (%i) doesn't match the number of entries for the vertex color stream %s (%i)", - vertexCount, fbxVertexColors.GetName(), colorData->GetCount()); - return nullptr; - } - - return colorData; - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxColorStreamImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxColorStreamImporter.h deleted file mode 100644 index bf614cf0d3..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxColorStreamImporter.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace SceneData - { - namespace GraphData - { - class MeshVertexColorData; - } - } - - namespace FbxSDKWrapper - { - class FbxMeshWrapper; - class FbxVertexColorWrapper; - } - - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxColorStreamImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxColorStreamImporter, "{96A25361-04FC-43EC-A443-C81E2E28F3BB}", SceneCore::LoadingComponent); - - FbxColorStreamImporter(); - ~FbxColorStreamImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportColorStreams(SceneNodeAppendedContext& context); - - protected: - AZStd::shared_ptr BuildVertexColorData(const FbxSDKWrapper::FbxVertexColorWrapper& fbxVertexColors, size_t vertexCount, const std::shared_ptr& fbxMesh); - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMaterialImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMaterialImporter.cpp deleted file mode 100644 index 199f476ec0..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMaterialImporter.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxMaterialImporter::FbxMaterialImporter() - { - BindToCall(&FbxMaterialImporter::ImportMaterials); - } - - void FbxMaterialImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxMaterialImporter::ImportMaterials(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "Material"); - - if (!context.m_sourceNode.GetMesh()) - { - return Events::ProcessingResult::Ignored; - } - - Events::ProcessingResultCombiner combinedMaterialImportResults; - - for (int materialIndex = 0; materialIndex < context.m_sourceNode.GetMaterialCount(); ++materialIndex) - { - AZ_TraceContext("Material Index", materialIndex); - - const std::shared_ptr fbxMaterial = - context.m_sourceNode.GetMaterial(materialIndex); - - if (!fbxMaterial) - { - AZ_TracePrintf(Utilities::WarningWindow, "Invalid material data found, ignoring."); - continue; - } - - AZStd::string materialName = fbxMaterial->GetName().c_str(); - RenamedNodesMap::SanitizeNodeName(materialName, context.m_scene.GetGraph(), context.m_currentGraphPosition, "Material"); - AZ_TraceContext("Material Name", materialName); - - AZStd::shared_ptr materialData = - BuildMaterial(context.m_sourceNode, materialIndex); - - AZ_Assert(materialData, "Failed to allocate scene material data."); - if (!materialData) - { - combinedMaterialImportResults += Events::ProcessingResult::Failure; - continue; - } - - Events::ProcessingResult materialResult; - Containers::SceneGraph::NodeIndex newIndex = - context.m_scene.GetGraph().AddChild(context.m_currentGraphPosition, materialName.c_str()); - - AZ_Assert(newIndex.IsValid(), "Failed to create SceneGraph node for attribute."); - if(!newIndex.IsValid()) - { - combinedMaterialImportResults += Events::ProcessingResult::Failure; - continue; - } - - SceneAttributeDataPopulatedContext dataPopulated(context, materialData, newIndex, materialName); - materialResult = Events::Process(dataPopulated); - - if (materialResult != Events::ProcessingResult::Failure) - { - materialResult = AddAttributeDataNodeWithContexts(dataPopulated); - } - - combinedMaterialImportResults += materialResult; - } - - return combinedMaterialImportResults.GetResult(); - } - - AZStd::shared_ptr FbxMaterialImporter::BuildMaterial(FbxSDKWrapper::FbxNodeWrapper& node, int materialIndex) const - { - AZ_Assert(materialIndex < node.GetMaterialCount(), "Invalid material index (%i)", materialIndex); - const std::shared_ptr fbxMaterial = node.GetMaterial(materialIndex); - if (!fbxMaterial) - { - return nullptr; - } - - AZStd::shared_ptr material = AZStd::make_shared(); - - material->SetMaterialName(fbxMaterial->GetName()); - material->SetTexture(DataTypes::IMaterialData::TextureMapType::Diffuse, - fbxMaterial->GetTextureFileName(FbxSDKWrapper::FbxMaterialWrapper::MaterialMapType::Diffuse).c_str()); - material->SetTexture(DataTypes::IMaterialData::TextureMapType::Specular, - fbxMaterial->GetTextureFileName(FbxSDKWrapper::FbxMaterialWrapper::MaterialMapType::Specular).c_str()); - material->SetTexture(DataTypes::IMaterialData::TextureMapType::Bump, - fbxMaterial->GetTextureFileName(FbxSDKWrapper::FbxMaterialWrapper::MaterialMapType::Bump).c_str()); - material->SetTexture(DataTypes::IMaterialData::TextureMapType::Normal, - fbxMaterial->GetTextureFileName(FbxSDKWrapper::FbxMaterialWrapper::MaterialMapType::Normal).c_str()); - material->SetDiffuseColor(fbxMaterial->GetDiffuseColor()); - material->SetSpecularColor(fbxMaterial->GetSpecularColor()); - material->SetEmissiveColor(fbxMaterial->GetEmissiveColor()); - material->SetShininess(fbxMaterial->GetShininess()); - - float opacity = fbxMaterial->GetOpacity(); - if (opacity == 0.0f) - { - opacity = 1.0f; - AZ_TracePrintf(Utilities::WarningWindow, "Opacity has been changed from 0 to full. Some DCC tools ignore the opacity and " - "write 0 to indicate opacity is not used. This causes meshes to turn invisible, which is often not the intention so " - "the opacity has been set to full automatically. If the intention was for a fully transparent mesh, please update " - "the opacity in Open 3D Engine's material editor."); - } - material->SetOpacity(opacity); - - // Due to the fact that fbxMaterial->GetUniqueId() will return a different ID - // each time when the fbx is reprocessed, we need a more stable ID. - // The current best candidate is probably the name of the material. - // But this will also force the user to update the material component for overrides - // if the fbx material name is changed outside from apps like dcc tools. - // (Ideally, only changing the material properties in the dcc tool will force the user to update the material component) - // - // Using 32-bit CRC as it is mathematically stable and enough within the same fbx. - uint64_t id = uint32_t(AZ::Crc32(fbxMaterial->GetName())); - material->SetUniqueId(id); - return material; - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMaterialImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMaterialImporter.h deleted file mode 100644 index a6b7bbd5ee..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMaterialImporter.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace SceneData - { - namespace GraphData - { - class MaterialData; - } - } - - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxMaterialImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxMaterialImporter, "{E1DF4182-793D-4188-B833-1236D33CCEB4}", SceneCore::LoadingComponent); - - FbxMaterialImporter(); - ~FbxMaterialImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportMaterials(SceneNodeAppendedContext& context); - - protected: - AZStd::shared_ptr BuildMaterial(FbxSDKWrapper::FbxNodeWrapper& node, int materialIndex) const; - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMeshImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMeshImporter.cpp deleted file mode 100644 index 90d4dceb6c..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMeshImporter.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxMeshImporter::FbxMeshImporter() - { - BindToCall(&FbxMeshImporter::ImportMesh); - } - - void FbxMeshImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxMeshImporter::ImportMesh(FbxNodeEncounteredContext& context) - { - AZ_TraceContext("Importer", "Mesh"); - if (!context.m_sourceNode.GetMesh() || - IsSkinnedMesh(context.m_sourceNode)) - { - return Events::ProcessingResult::Ignored; - } - - AZStd::shared_ptr createdData = - AZStd::make_shared(); - - if (BuildSceneMeshFromFbxMesh(createdData, *context.m_sourceNode.GetMesh(), context.m_sourceSceneSystem)) - { - context.m_createdData.push_back(std::move(createdData)); - return Events::ProcessingResult::Success; - } - else - { - return Events::ProcessingResult::Failure; - } - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMeshImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMeshImporter.h deleted file mode 100644 index 6d205c7bfa..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxMeshImporter.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxMeshWrapper; - } - - namespace SceneData - { - namespace GraphData - { - class MeshData; - } - } - - namespace SceneAPI - { - class FbxSceneSystem; - - namespace FbxSceneBuilder - { - class FbxMeshImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxMeshImporter, "{8D131E77-4D53-486A-B3C6-80ACC27A6D50}", SceneCore::LoadingComponent); - - FbxMeshImporter(); - ~FbxMeshImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportMesh(FbxNodeEncounteredContext& context); - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinImporter.cpp deleted file mode 100644 index 7c710fdda0..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinImporter.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxSkinImporter::FbxSkinImporter() - { - BindToCall(&FbxSkinImporter::ImportSkin); - } - - void FbxSkinImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxSkinImporter::ImportSkin(FbxNodeEncounteredContext& context) - { - if (!context.m_sourceNode.GetMesh() || - !IsSkinnedMesh(context.m_sourceNode)) - { - return Events::ProcessingResult::Ignored; - } - - AZStd::shared_ptr createdData = - AZStd::make_shared(); - - if (BuildSceneMeshFromFbxMesh(createdData, *context.m_sourceNode.GetMesh(), context.m_sourceSceneSystem)) - { - context.m_createdData.push_back(std::move(createdData)); - return Events::ProcessingResult::Success; - } - else - { - return Events::ProcessingResult::Failure; - } - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinImporter.h deleted file mode 100644 index 2ed63a2acd..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinImporter.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxSkinImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxSkinImporter, "{22108E92-7037-442D-94E0-A2E92554A79F}", SceneCore::LoadingComponent); - - FbxSkinImporter(); - ~FbxSkinImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportSkin(FbxNodeEncounteredContext& context); - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinWeightsImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinWeightsImporter.cpp deleted file mode 100644 index 3e8b2324d8..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinWeightsImporter.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - const AZStd::string FbxSkinWeightsImporter::s_skinWeightName = "SkinWeight_"; - - FbxSkinWeightsImporter::FbxSkinWeightsImporter() - { - BindToCall(&FbxSkinWeightsImporter::ImportSkinWeights); - BindToCall(&FbxSkinWeightsImporter::SetupNamedBoneLinks); - } - - void FbxSkinWeightsImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxSkinWeightsImporter::ImportSkinWeights(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "Skin Weights"); - - if (!IsSkinnedMesh(context.m_sourceNode)) - { - return Events::ProcessingResult::Ignored; - } - - Events::ProcessingResultCombiner combinedSkinWeightsResult; - - for (int deformerIndex = 0; deformerIndex < context.m_sourceNode.GetMesh()->GetDeformerCount(FbxDeformer::eSkin); ++deformerIndex) - { - AZ_TraceContext("Deformer Index", deformerIndex); - AZStd::shared_ptr fbxSkin = - context.m_sourceNode.GetMesh()->GetSkin(deformerIndex); - if (!fbxSkin) - { - return Events::ProcessingResult::Failure; - } - AZStd::string skinWeightName = s_skinWeightName; - skinWeightName += AZStd::to_string(deformerIndex); - RenamedNodesMap::SanitizeNodeName(skinWeightName, context.m_scene.GetGraph(), context.m_currentGraphPosition); - - AZStd::shared_ptr skinDeformer = - BuildSkinWeightData(context.m_sourceNode.GetMesh(), deformerIndex); - - AZ_Assert(skinDeformer, "Failed to allocate skin weighting data."); - if (!skinDeformer) - { - combinedSkinWeightsResult += Events::ProcessingResult::Failure; - continue; - } - - Containers::SceneGraph::NodeIndex newIndex = - context.m_scene.GetGraph().AddChild(context.m_currentGraphPosition, skinWeightName.c_str()); - - AZ_Assert(newIndex.IsValid(), "Failed to create SceneGraph node for attribute."); - if (!newIndex.IsValid()) - { - combinedSkinWeightsResult += Events::ProcessingResult::Failure; - continue; - } - - Events::ProcessingResult skinWeightsResult; - SceneAttributeDataPopulatedContext dataPopulated(context, skinDeformer, newIndex, skinWeightName); - skinWeightsResult = Events::Process(dataPopulated); - - if (skinWeightsResult != Events::ProcessingResult::Failure) - { - skinWeightsResult = AddAttributeDataNodeWithContexts(dataPopulated); - } - - combinedSkinWeightsResult += skinWeightsResult; - } - - return combinedSkinWeightsResult.GetResult(); - } - - AZStd::shared_ptr FbxSkinWeightsImporter::BuildSkinWeightData( - const std::shared_ptr& fbxMesh, int skinIndex) - { - AZStd::shared_ptr fbxSkin = fbxMesh->GetSkin(skinIndex); - AZ_Assert(fbxSkin, "BuildSkinWeightData was called for index %i which doesn't contain a skin deformer.", - skinIndex); - if (!fbxSkin) - { - return nullptr; - } - - AZStd::shared_ptr skinWeightData = - AZStd::make_shared(); - - // Cache the new object and the link info for now so it can be resolved at a later point when all - // names have been updated. - Pending pending; - pending.m_fbxMesh = fbxMesh; - pending.m_fbxSkin = fbxSkin; - pending.m_skinWeightData = skinWeightData; - m_pendingSkinWeights.push_back(pending); - - return skinWeightData; - } - - Events::ProcessingResult FbxSkinWeightsImporter::SetupNamedBoneLinks(FinalizeSceneContext& context) - { - AZ_TraceContext("Importer", "Skin Weights"); - - for (auto& it : m_pendingSkinWeights) - { - int controlPointCount = it.m_fbxMesh->GetControlPointsCount(); - it.m_skinWeightData->ResizeContainerSpace(controlPointCount); - - int clusterCount = it.m_fbxSkin->GetClusterCount(); - - for (int clusterIndex = 0; clusterIndex < clusterCount; ++clusterIndex) - { - int controlPointCount2 = it.m_fbxSkin->GetClusterControlPointIndicesCount(clusterIndex); - AZStd::shared_ptr fbxLink = it.m_fbxSkin->GetClusterLink(clusterIndex); - - if (!fbxLink) - { - AZ_TracePrintf(Utilities::WarningWindow, "FBX data contains null skin cluster link at index %i", clusterIndex); - continue; - } - - // The name of the bones may be updated as they get processed. Processing of bones may not necessarily happen before - // processing skin weights so to avoid storing names that will be updated later delay setting up the link until - // all processing has completed. - AZStd::string boneName = context.m_nodeNameMap.GetNodeName(fbxLink); - int boneId = it.m_skinWeightData->GetBoneId(boneName); - - for (int pointIndex = 0; pointIndex < controlPointCount2; ++pointIndex) - { - SceneAPI::DataTypes::ISkinWeightData::Link link; - link.boneId = boneId; - link.weight = aznumeric_caster(it.m_fbxSkin->GetClusterControlPointWeight(clusterIndex, pointIndex)); - it.m_skinWeightData->AppendLink(it.m_fbxSkin->GetClusterControlPointIndex(clusterIndex, pointIndex), link); - } - } - } - const auto result = m_pendingSkinWeights.empty() ? Events::ProcessingResult::Ignored : Events::ProcessingResult::Success; - m_pendingSkinWeights.clear(); - return result; - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinWeightsImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinWeightsImporter.h deleted file mode 100644 index dfe4ee4ecc..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxSkinWeightsImporter.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxMeshWrapper; - } - - namespace SceneData - { - namespace GraphData - { - class SkinWeightData; - } - } - - namespace SceneAPI - { - namespace Events - { - class PostImportEventContext; - } - - namespace FbxSceneBuilder - { - class FbxSkinWeightsImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxSkinWeightsImporter, "{95FCD291-5E1F-4591-90AD-AB5EA2599C3E}", SceneCore::LoadingComponent); - - FbxSkinWeightsImporter(); - ~FbxSkinWeightsImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportSkinWeights(SceneNodeAppendedContext& context); - Events::ProcessingResult SetupNamedBoneLinks(FinalizeSceneContext& context); - - protected: - struct Pending - { - std::shared_ptr m_fbxMesh; - AZStd::shared_ptr m_fbxSkin; - AZStd::shared_ptr m_skinWeightData; - }; - AZStd::shared_ptr BuildSkinWeightData( - const std::shared_ptr& fbxMesh, int skinIndex); - - //! List of skin weights that still need to be filled in. Setting the data for skin weights is - //! delayed until after the tree has been fully constructed as bones are linked by name, but until - //! the graph has been fully filled in, those names can change which would break the names recorded - //! for the skin. - AZStd::vector m_pendingSkinWeights; - - static const AZStd::string s_skinWeightName; - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTangentStreamImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTangentStreamImporter.cpp deleted file mode 100644 index 3a5257d851..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTangentStreamImporter.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxTangentStreamImporter::FbxTangentStreamImporter() - { - BindToCall(&FbxTangentStreamImporter::ImportTangents); - } - - - void FbxTangentStreamImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - - Events::ProcessingResult FbxTangentStreamImporter::ImportTangents(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "Tangents"); - std::shared_ptr fbxMesh = context.m_sourceNode.GetMesh(); - if (!fbxMesh) - { - return Events::ProcessingResult::Ignored; - } - - Events::ProcessingResultCombiner combinedStreamResults; - const int numTangentSets = context.m_sourceNode.GetMesh()->GetElementTangentCount(); - for (int elementIndex = 0; elementIndex < numTangentSets; ++elementIndex) - { - AZ_TraceContext("Tangent set index", elementIndex); - - FbxSDKWrapper::FbxVertexTangentWrapper fbxVertexTangents = fbxMesh->GetElementTangent(elementIndex); - if (!fbxVertexTangents.IsValid()) - { - AZ_TracePrintf(Utilities::WarningWindow, "Invalid tangent set found, ignoring"); - continue; - } - - const AZStd::string originalNodeName = AZStd::string::format("TangentSet_Fbx_%d", elementIndex); - const AZStd::string nodeName = AZ::SceneAPI::DataTypes::Utilities::CreateUniqueName(originalNodeName, context.m_scene.GetManifest()); - AZ_TraceContext("Tangent Set Name", nodeName); - if (originalNodeName != nodeName) - { - AZ_TracePrintf(Utilities::WarningWindow, "Tangent set '%s' has been renamed to '%s' because the name was already in use.", originalNodeName.c_str(), nodeName.c_str()); - } - - AZStd::shared_ptr parentData = context.m_scene.GetGraph().GetNodeContent(context.m_currentGraphPosition); - AZ_Assert(parentData && parentData->RTTI_IsTypeOf(SceneData::GraphData::MeshData::TYPEINFO_Uuid()), "Tried to construct tangent set attribute for invalid or non-mesh parent data"); - if (!parentData || !parentData->RTTI_IsTypeOf(SceneData::GraphData::MeshData::TYPEINFO_Uuid())) - { - combinedStreamResults += Events::ProcessingResult::Failure; - continue; - } - - const SceneData::GraphData::MeshData* const parentMeshData = azrtti_cast(parentData.get()); - const size_t vertexCount = parentMeshData->GetVertexCount(); - AZStd::shared_ptr tangentStream = BuildVertexTangentData(fbxVertexTangents, vertexCount, fbxMesh); - - AZ_Assert(tangentStream, "Failed to allocate tangent data for scene graph."); - if (!tangentStream) - { - combinedStreamResults += Events::ProcessingResult::Failure; - continue; - } - - tangentStream->SetTangentSetIndex(elementIndex); - tangentStream->SetTangentSpace(AZ::SceneAPI::DataTypes::TangentSpace::FromFbx); - - const Containers::SceneGraph::NodeIndex newIndex = context.m_scene.GetGraph().AddChild(context.m_currentGraphPosition, nodeName.c_str()); - AZ_Assert(newIndex.IsValid(), "Failed to create SceneGraph node for attribute."); - if (!newIndex.IsValid()) - { - combinedStreamResults += Events::ProcessingResult::Failure; - continue; - } - - Events::ProcessingResult streamResults; - SceneAttributeDataPopulatedContext dataPopulated(context, tangentStream, newIndex, nodeName); - streamResults = Events::Process(dataPopulated); - - if (streamResults != Events::ProcessingResult::Failure) - { - streamResults = AddAttributeDataNodeWithContexts(dataPopulated); - } - - combinedStreamResults += streamResults; - } - - return combinedStreamResults.GetResult(); - } - - - AZStd::shared_ptr FbxTangentStreamImporter::BuildVertexTangentData(const FbxSDKWrapper::FbxVertexTangentWrapper& tangents, size_t vertexCount, const std::shared_ptr& fbxMesh) - { - AZStd::shared_ptr tangentData = AZStd::make_shared(); - tangentData->ReserveContainerSpace(vertexCount); - - const int fbxPolygonCount = fbxMesh->GetPolygonCount(); - const int* const fbxPolygonVertices = fbxMesh->GetPolygonVertices(); - for (int fbxPolygonIndex = 0; fbxPolygonIndex < fbxPolygonCount; ++fbxPolygonIndex) - { - const int fbxPolygonVertexCount = fbxMesh->GetPolygonSize(fbxPolygonIndex); - if (fbxPolygonVertexCount <= 2) - { - continue; - } - - const int fbxVertexStartIndex = fbxMesh->GetPolygonVertexIndex(fbxPolygonIndex); - for (int index = 0; index < fbxPolygonVertexCount; ++index) - { - const int fbxPolygonVertexIndex = fbxVertexStartIndex + index; - const int fbxControlPointIndex = fbxPolygonVertices[fbxPolygonVertexIndex]; - - const Vector3 tangent = tangents.GetElementAt(fbxPolygonIndex, fbxPolygonVertexIndex, fbxControlPointIndex); - tangentData->AppendTangent(AZ::Vector4(tangent.GetX(), tangent.GetY(), tangent.GetZ(), 1.0f)); - } - } - - if (tangentData->GetCount() != vertexCount) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Vertex count (%i) doesn't match the number of entries for the tangent stream %s (%i)", vertexCount, tangents.GetName(), tangentData->GetCount()); - return nullptr; - } - - return tangentData; - } - - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTangentStreamImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTangentStreamImporter.h deleted file mode 100644 index 38f561eb04..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTangentStreamImporter.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace SceneData - { - namespace GraphData - { - class MeshVertexTangentData; - } - } - - namespace FbxSDKWrapper - { - class FbxMeshWrapper; - class FbxVertexTangentWrapper; - } - - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxTangentStreamImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxTangentStreamImporter, "{70F3A9F5-5BB1-4FE2-BD63-A60C2DCA4589}", SceneCore::LoadingComponent); - - FbxTangentStreamImporter(); - ~FbxTangentStreamImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportTangents(SceneNodeAppendedContext& context); - - protected: - AZStd::shared_ptr BuildVertexTangentData(const FbxSDKWrapper::FbxVertexTangentWrapper& tangents, - size_t vertexCount, const std::shared_ptr& fbxMesh); - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTransformImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTransformImporter.cpp deleted file mode 100644 index b1ccfe8acf..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTransformImporter.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - const char* FbxTransformImporter::s_transformNodeName = "transform"; - - FbxTransformImporter::FbxTransformImporter() - { - BindToCall(&FbxTransformImporter::ImportTransform); - } - - void FbxTransformImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxTransformImporter::ImportTransform(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "Transform"); - - DataTypes::MatrixType localTransform; - - if (!GetBindPoseLocalTransform(context.m_sourceScene, context.m_sourceNode, localTransform)) - { - localTransform = context.m_sourceNode.EvaluateLocalTransform(); - DataTypes::MatrixType geoTransform = context.m_sourceNode.GetGeometricTransform(); // transform of the pivot - localTransform *= geoTransform; - } - - if (localTransform == DataTypes::MatrixType::Identity()) - { - return Events::ProcessingResult::Ignored; - } - - - context.m_sourceSceneSystem.SwapTransformForUpAxis(localTransform); - - context.m_sourceSceneSystem.ConvertUnit(localTransform); - - AZStd::shared_ptr transformData = - AZStd::make_shared(localTransform); - AZ_Assert(transformData, "Failed to allocate transform data."); - if (!transformData) - { - return Events::ProcessingResult::Failure; - } - - - // If it is non-endpoint data populated node, add a transform attribute - if (context.m_scene.GetGraph().HasNodeContent(context.m_currentGraphPosition)) - { - if (!context.m_scene.GetGraph().IsNodeEndPoint(context.m_currentGraphPosition)) - { - AZStd::string nodeName = s_transformNodeName; - RenamedNodesMap::SanitizeNodeName(nodeName, context.m_scene.GetGraph(), context.m_currentGraphPosition); - AZ_TraceContext("Transform node name", nodeName); - - Containers::SceneGraph::NodeIndex newIndex = - context.m_scene.GetGraph().AddChild(context.m_currentGraphPosition, nodeName.c_str()); - - AZ_Assert(newIndex.IsValid(), "Failed to create SceneGraph node for attribute."); - if (!newIndex.IsValid()) - { - return Events::ProcessingResult::Failure; - } - - Events::ProcessingResult transformAttributeResult; - SceneAttributeDataPopulatedContext dataPopulated(context, transformData, newIndex, nodeName); - transformAttributeResult = Events::Process(dataPopulated); - - if (transformAttributeResult != Events::ProcessingResult::Failure) - { - transformAttributeResult = AddAttributeDataNodeWithContexts(dataPopulated); - } - - return transformAttributeResult; - } - } - else - { - bool addedData = context.m_scene.GetGraph().SetContent( - context.m_currentGraphPosition, - transformData); - - AZ_Assert(addedData, "Failed to add node data"); - return addedData ? Events::ProcessingResult::Success : Events::ProcessingResult::Failure; - } - - return Events::ProcessingResult::Ignored; - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTransformImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTransformImporter.h deleted file mode 100644 index d9e3b5371b..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxTransformImporter.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxTransformImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxTransformImporter, "{354EAAE2-DF31-4E11-BD8A-619419A3EA17}", SceneCore::LoadingComponent); - - FbxTransformImporter(); - ~FbxTransformImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportTransform(SceneNodeAppendedContext& context); - - protected: - static const char* s_transformNodeName; - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxUvMapImporter.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxUvMapImporter.cpp deleted file mode 100644 index b05c64fcad..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxUvMapImporter.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - FbxUvMapImporter::FbxUvMapImporter() - { - BindToCall(&FbxUvMapImporter::ImportUvMaps); - } - - void FbxUvMapImporter::Reflect(ReflectContext* context) - { - SerializeContext* serializeContext = azrtti_cast(context); - if (serializeContext) - { - serializeContext->Class()->Version(1); - } - } - - Events::ProcessingResult FbxUvMapImporter::ImportUvMaps(SceneNodeAppendedContext& context) - { - AZ_TraceContext("Importer", "UV Map"); - std::shared_ptr fbxMesh = - context.m_sourceNode.GetMesh(); - if (!fbxMesh) - { - return Events::ProcessingResult::Ignored; - } - - Events::ProcessingResultCombiner combinedUvMapResults; - - for (int uvElementIndex = 0; uvElementIndex < context.m_sourceNode.GetMesh()->GetElementUVCount(); ++uvElementIndex) - { - AZ_TraceContext("UV Map index", uvElementIndex); - - FbxSDKWrapper::FbxUVWrapper fbxVertexUVs = fbxMesh->GetElementUV(uvElementIndex); - - if (!fbxVertexUVs.IsValid()) - { - AZ_TracePrintf(Utilities::WarningWindow, "Invalid UV Map found, ignoring"); - continue; - } - - AZStd::string nodeName = fbxVertexUVs.GetName(); - RenamedNodesMap::SanitizeNodeName(nodeName, context.m_scene.GetGraph(), context.m_currentGraphPosition, "UV"); - AZ_TraceContext("UV Map Name", nodeName); - - AZStd::shared_ptr parentData = - context.m_scene.GetGraph().GetNodeContent(context.m_currentGraphPosition); - AZ_Assert(parentData && parentData->RTTI_IsTypeOf(SceneData::GraphData::MeshData::TYPEINFO_Uuid()), - "Tried to construct uv stream attribute for invalid or non-mesh parent data"); - if (!parentData || !parentData->RTTI_IsTypeOf(SceneData::GraphData::MeshData::TYPEINFO_Uuid())) - { - combinedUvMapResults += Events::ProcessingResult::Failure; - continue; - } - - const SceneData::GraphData::MeshData* const parentMeshData = - azrtti_cast(parentData.get()); - size_t vertexCount = parentMeshData->GetVertexCount(); - - AZStd::shared_ptr uvMap = BuildVertexUVData(fbxVertexUVs, vertexCount, fbxMesh); - - AZ_Assert(uvMap, "Failed to allocate UV map data for scene graph."); - if (!uvMap) - { - combinedUvMapResults += Events::ProcessingResult::Failure; - continue; - } - - Containers::SceneGraph::NodeIndex newIndex = - context.m_scene.GetGraph().AddChild(context.m_currentGraphPosition, nodeName.c_str()); - - AZ_Assert(newIndex.IsValid(), "Failed to create SceneGraph node for attribute."); - if (!newIndex.IsValid()) - { - combinedUvMapResults += Events::ProcessingResult::Failure; - continue; - } - - Events::ProcessingResult uvMapResults; - SceneAttributeDataPopulatedContext dataPopulated(context, uvMap, newIndex, nodeName); - uvMapResults = Events::Process(dataPopulated); - - if (uvMapResults != Events::ProcessingResult::Failure) - { - uvMapResults = AddAttributeDataNodeWithContexts(dataPopulated); - } - - combinedUvMapResults += uvMapResults; - } - - return combinedUvMapResults.GetResult(); - } - - AZStd::shared_ptr FbxUvMapImporter::BuildVertexUVData(const FbxSDKWrapper::FbxUVWrapper& uvs, - size_t vertexCount, const std::shared_ptr& fbxMesh) - { - AZStd::shared_ptr uvData = AZStd::make_shared(); - uvData->ReserveContainerSpace(vertexCount); - uvData->SetCustomName(uvs.GetName()); - - const int fbxPolygonCount = fbxMesh->GetPolygonCount(); - const int* const fbxPolygonVertices = fbxMesh->GetPolygonVertices(); - for (int fbxPolygonIndex = 0; fbxPolygonIndex < fbxPolygonCount; ++fbxPolygonIndex) - { - const int fbxPolygonVertexCount = fbxMesh->GetPolygonSize(fbxPolygonIndex); - if (fbxPolygonVertexCount <= 2) - { - continue; - } - - const int fbxVertexStartIndex = fbxMesh->GetPolygonVertexIndex(fbxPolygonIndex); - - for (int uvIndex = 0; uvIndex < fbxPolygonVertexCount; ++uvIndex) - { - const int fbxPolygonVertexIndex = fbxVertexStartIndex + uvIndex; - const int fbxControlPointIndex = fbxPolygonVertices[fbxPolygonVertexIndex]; - - Vector2 uv = uvs.GetElementAt(fbxPolygonIndex, fbxPolygonVertexIndex, fbxControlPointIndex); - uv.SetY(1.0f - uv.GetY()); - uvData->AppendUV(uv); - } - } - - if (uvData->GetCount() != vertexCount) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Vertex count (%i) doesn't match the number of entries for the uv set %s (%i)", - vertexCount, uvs.GetName(), uvData->GetCount()); - return nullptr; - } - - return uvData; - - } - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxUvMapImporter.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxUvMapImporter.h deleted file mode 100644 index f64de0034f..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxUvMapImporter.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -#include -#include -#include - -namespace AZ -{ - namespace SceneData - { - namespace GraphData - { - class MeshVertexUVData; - } - } - - namespace FbxSDKWrapper - { - class FbxMeshWrapper; - class FbxUVWrapper; - } - - namespace SceneAPI - { - namespace FbxSceneBuilder - { - class FbxUvMapImporter - : public SceneCore::LoadingComponent - { - public: - AZ_COMPONENT(FbxUvMapImporter, "{B16CD69D-3C0C-4FE2-B481-1084B1C36242}", SceneCore::LoadingComponent); - - FbxUvMapImporter(); - ~FbxUvMapImporter() override = default; - - static void Reflect(ReflectContext* context); - - Events::ProcessingResult ImportUvMaps(SceneNodeAppendedContext& context); - - protected: - AZStd::shared_ptr BuildVertexUVData(const FbxSDKWrapper::FbxUVWrapper& uvs, - size_t vertexCount, const std::shared_ptr& fbxMesh); - }; - } // namespace FbxSceneBuilder - } // namespace SceneAPI -} // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.cpp similarity index 85% rename from Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.cpp rename to Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.cpp index b50517381d..9b47e3e34a 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.cpp @@ -12,12 +12,8 @@ #include #include -#include #include -#include -#include -#include -#include +#include #include #include #include @@ -50,19 +46,7 @@ namespace AZ dataPopulated.m_scene.GetGraph().SetContent(dataPopulated.m_currentGraphPosition, AZStd::move(dataPopulated.m_graphData)); - if (azrtti_istypeof(dataPopulated)) - { - SceneDataPopulatedContext* dataPopulatedContext = azrtti_cast(&dataPopulated); - SceneNodeAppendedContext nodeAppended(*dataPopulatedContext, dataPopulated.m_currentGraphPosition); - nodeResults += Events::Process(nodeAppended); - - SceneNodeAddedAttributesContext addedAttributes(nodeAppended); - nodeResults += Events::Process(addedAttributes); - - SceneNodeFinalizeContext finalizeNode(addedAttributes); - nodeResults += Events::Process(finalizeNode); - } - else + if (azrtti_istypeof(dataPopulated)) { AssImpSceneDataPopulatedContext* dataPopulatedContext = azrtti_cast(&dataPopulated); AssImpSceneNodeAppendedContext nodeAppended(*dataPopulatedContext, dataPopulated.m_currentGraphPosition); @@ -91,13 +75,7 @@ namespace AZ dataPopulated.m_scene.GetGraph().SetContent(dataPopulated.m_currentGraphPosition, AZStd::move(dataPopulated.m_graphData)); - if (azrtti_istypeof(dataPopulated)) - { - SceneAttributeDataPopulatedContext* dataPopulatedContext = azrtti_cast(&dataPopulated); - SceneAttributeNodeAppendedContext nodeAppended(*dataPopulatedContext, dataPopulated.m_currentGraphPosition); - nodeResults += Events::Process(nodeAppended); - } - else + if (azrtti_istypeof(dataPopulated)) { AssImpSceneAttributeDataPopulatedContext* dataPopulatedContext = azrtti_cast(&dataPopulated); AssImpSceneAttributeNodeAppendedContext nodeAppended(*dataPopulatedContext, dataPopulated.m_currentGraphPosition); @@ -456,48 +434,6 @@ namespace AZ return true; } - - bool GetBindPoseLocalTransform(const FbxSDKWrapper::FbxSceneWrapper& sceneWrapper, - FbxSDKWrapper::FbxNodeWrapper& nodeWrapper, SceneAPI::DataTypes::MatrixType& xf) - { - PoseList poseList; - FbxArray nodeIndices; - - FbxNode* node = nodeWrapper.GetFbxNode(); - - FbxScene* scene = sceneWrapper.GetFbxScene(); - FbxMatrix nodeMatrix; - if (FbxPose::GetBindPoseContaining(scene, node, poseList, nodeIndices)) - { - nodeMatrix = poseList[0]->GetMatrix(nodeIndices[0]); - } - else - { - return false; - } - - // We are after the local transform of the node while fbx bind pose provides the global transform. - // To get the local transform, we multiply with the inverse of the parent's global transform. - FbxNode* parentNode = node->GetParent(); - FbxMatrix parentMatrix; - if (parentNode) - { - poseList.Clear(); - nodeIndices.Clear(); - if (FbxPose::GetBindPoseContaining(scene, parentNode, poseList, nodeIndices)) - { - parentMatrix = poseList[0]->GetMatrix(nodeIndices[0]); - } - else - { - parentMatrix = parentNode->EvaluateGlobalTransform(); - } - } - FbxMatrix nodeLocalMatrix = parentMatrix.Inverse() * nodeMatrix; - xf = FbxSDKWrapper::FbxTypeConverter::ToTransform(nodeLocalMatrix); - return true; - } - } // namespace FbxSceneBuilder } // namespace SceneAPI } // namespace AZ diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.h similarity index 74% rename from Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.h rename to Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.h index 7f16422fdb..d3577d54af 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.h +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.h @@ -12,7 +12,9 @@ #pragma once -#include +#include +#include +#include #include #include @@ -20,12 +22,6 @@ namespace AZ { struct Uuid; - namespace FbxSDKWrapper - { - class FbxNodeWrapper; - class FbxSceneWrapper; - } - namespace SceneAPI { namespace FbxSceneBuilder @@ -42,7 +38,6 @@ namespace AZ const AZ::Uuid& uuid); inline bool NodeHasAncestorOfType(const CoreSceneGraph& graph, CoreGraphNodeIndex nodeIndex, const AZ::Uuid& uuid); - inline bool IsSkinnedMesh(const FbxSDKWrapper::FbxNodeWrapper& sourceNode); CoreProcessingResult AddDataNodeWithContexts(SceneDataPopulatedContextBase& dataContext); CoreProcessingResult AddAttributeDataNodeWithContexts(SceneAttributeDataPopulatedContextBase& dataContext); bool AreSceneGraphsEqual(const CoreSceneGraph& lhsGraph, const CoreSceneGraph& rhsGraph); @@ -51,12 +46,8 @@ namespace AZ bool IsGraphDataEqual(const AZStd::shared_ptr& lhs, const AZStd::shared_ptr& rhs); - // If the scene contains bindpose information for the node, returns true and sets "xf" to the local transform - // of the node in bindpose. Returns false if bindpose info is not available for the node. - bool GetBindPoseLocalTransform(const FbxSDKWrapper::FbxSceneWrapper& sceneWrapper, - FbxSDKWrapper::FbxNodeWrapper& nodeWrapper, DataTypes::MatrixType& xf); } // namespace FbxSceneBuilder } // namespace SceneAPI } // namespace AZ -#include +#include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.inl b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.inl similarity index 81% rename from Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.inl rename to Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.inl index 3fd0e02f08..f56982a06c 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/FbxImporterUtilities.inl +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/ImporterUtilities.inl @@ -10,10 +10,7 @@ * */ -#include -#include -#include -#include +#include #include #include @@ -57,12 +54,6 @@ namespace AZ return false; } - bool IsSkinnedMesh(const FbxSDKWrapper::FbxNodeWrapper& sourceNode) - { - const std::shared_ptr fbxMesh = sourceNode.GetMesh(); - return (fbxMesh && (fbxMesh->GetDeformerCount(FbxDeformer::eSkin) > 0 || fbxMesh->GetDeformerCount(FbxDeformer::eBlendShape) > 0)); - } - bool AreScenesEqual(const CoreScene& lhs, const CoreScene& rhs) { if (lhs.GetGraph().GetNodeCount() != rhs.GetGraph().GetNodeCount()) diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/FbxMeshImporterUtilities.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/FbxMeshImporterUtilities.cpp deleted file mode 100644 index 5dddaff4d8..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/FbxMeshImporterUtilities.cpp +++ /dev/null @@ -1,312 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#include -#include -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace SceneAPI - { - namespace FbxSceneBuilder - { - bool BuildSceneMeshFromFbxMesh(const AZStd::shared_ptr& mesh, - const FbxSDKWrapper::FbxMeshWrapper& sourceMesh, const FbxSceneSystem& sceneSystem) - { - // Save unit sizes of the mesh - mesh->SetUnitSizeInMeters(sceneSystem.GetUnitSizeInMeters()); - mesh->SetOriginalUnitSizeInMeters(sceneSystem.GetOriginalUnitSizeInMeters()); - - // Get mesh subset count by scanning material IDs in meshes. - // For negative material ids we will add an additional - // subset at the end, see "++maxMaterialIndex". - - // These defines material index range for all polygons in the mesh - // Each polygon has a material index - int minMeshMaterialIndex = INT_MAX; - int maxMeshMaterialIndex = INT_MIN; - - FbxLayerElementArrayTemplate* fbxMaterialIndices; - sourceMesh.GetMaterialIndices(&fbxMaterialIndices); // per polygon - - int fbxPolygonCount = sourceMesh.GetPolygonCount(); - - AZ_Error("FbxSceneBuilder", fbxPolygonCount, - "Source mesh %s polygon count is 0. Zero count meshes are not supported, either remove this mesh or add polygons to it.", - sourceMesh.GetName()); - for (int fbxPolygonIndex = 0; fbxPolygonIndex < fbxPolygonCount; ++fbxPolygonIndex) - { - // if the polygon has less than 3 vertices, it's not a valid polygon and is skipped - const int fbxPolygonVertexCount = sourceMesh.GetPolygonSize(fbxPolygonIndex); - if (fbxPolygonVertexCount <= 2) - { - continue; - } - - // Get the material index of each polygon - const int meshMaterialIndex = fbxMaterialIndices ? (*fbxMaterialIndices)[fbxPolygonIndex] : -1; - minMeshMaterialIndex = AZ::GetMin(minMeshMaterialIndex, meshMaterialIndex); - maxMeshMaterialIndex = AZ::GetMax(maxMeshMaterialIndex, meshMaterialIndex); - } - - if (minMeshMaterialIndex > maxMeshMaterialIndex) - { - return false; - } - - if (maxMeshMaterialIndex < 0) - { - minMeshMaterialIndex = maxMeshMaterialIndex = 0; - } - else if (minMeshMaterialIndex < 0) - { - minMeshMaterialIndex = 0; - ++maxMeshMaterialIndex; - } - - // Fill geometry - - // Control points contain positions of vertices - AZStd::vector fbxControlPoints = sourceMesh.GetControlPoints(); - const int* const fbxPolygonVertices = sourceMesh.GetPolygonVertices(); - - fbxMaterialIndices = nullptr; - sourceMesh.GetMaterialIndices(&fbxMaterialIndices); // per polygon - - // Iterate through each polygon in the mesh and convert data - fbxPolygonCount = sourceMesh.GetPolygonCount(); - for (int fbxPolygonIndex = 0; fbxPolygonIndex < fbxPolygonCount; ++fbxPolygonIndex) - { - const int fbxPolygonVertexCount = sourceMesh.GetPolygonSize(fbxPolygonIndex); - if (fbxPolygonVertexCount <= 2) - { - continue; - } - - AZ_TraceContext("Polygon Index", fbxPolygonIndex); - - // Ensure the validity of the material index for the polygon - int fbxMaterialIndex = fbxMaterialIndices ? (*fbxMaterialIndices)[fbxPolygonIndex] : -1; - if (fbxMaterialIndex < minMeshMaterialIndex || fbxMaterialIndex > maxMeshMaterialIndex) - { - fbxMaterialIndex = maxMeshMaterialIndex; - } - - const int fbxVertexStartIndex = sourceMesh.GetPolygonVertexIndex(fbxPolygonIndex); - - // Triangulate polygon as a fan and remember resulting vertices and faces - - int firstMeshVertexIndex = -1; - int previousMeshVertexIndex = -1; - - AZ::SceneAPI::DataTypes::IMeshData::Face meshFace; - int verticesInMeshFace = 0; - - // Iterate through each vertex in the polygon - for (int vertexIndex = 0; vertexIndex < fbxPolygonVertexCount; ++vertexIndex) - { - const int meshVertexIndex = aznumeric_caster(mesh->GetVertexCount()); - - const int fbxPolygonVertexIndex = fbxVertexStartIndex + vertexIndex; - const int fbxControlPointIndex = fbxPolygonVertices[fbxPolygonVertexIndex]; - - Vector3 meshPosition = fbxControlPoints[fbxControlPointIndex]; - - Vector3 meshVertexNormal; - sourceMesh.GetPolygonVertexNormal(fbxPolygonIndex, vertexIndex, meshVertexNormal); - - sceneSystem.SwapVec3ForUpAxis(meshPosition); - sceneSystem.ConvertUnit(meshPosition); - // Add position - mesh->AddPosition(meshPosition); - - // Add normal - sceneSystem.SwapVec3ForUpAxis(meshVertexNormal); - meshVertexNormal.NormalizeSafe(); - mesh->AddNormal(meshVertexNormal); - - mesh->SetVertexIndexToControlPointIndexMap(meshVertexIndex, fbxControlPointIndex); - - // Add face - { - if (vertexIndex == 0) - { - firstMeshVertexIndex = meshVertexIndex; - } - - int meshVertices[3]; - int meshVertexCount = 0; - - meshVertices[meshVertexCount++] = meshVertexIndex; - - // If we already have generated one triangle before, make a new triangle at a time as we encounter a new vertex. - // The new triangle is composed with the first vertex of the polygon, the last vertex, and the current vertex. - if (vertexIndex >= 3) - { - meshVertices[meshVertexCount++] = firstMeshVertexIndex; - meshVertices[meshVertexCount++] = previousMeshVertexIndex; - } - - for (int faceVertexIndex = 0; faceVertexIndex < meshVertexCount; ++faceVertexIndex) - { - meshFace.vertexIndex[verticesInMeshFace++] = meshVertices[faceVertexIndex]; - if (verticesInMeshFace == 3) - { - verticesInMeshFace = 0; - mesh->AddFace(meshFace, fbxMaterialIndex); - } - } - } - - previousMeshVertexIndex = meshVertexIndex; - } - - // Report problem if there are vertices that left for forming a polygon - if (verticesInMeshFace != 0) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Internal error in mesh filler"); - return false; - } - } - - // Report problem if no vertex or face converted to MeshData - if (mesh->GetVertexCount() <= 0 || mesh->GetFaceCount() <= 0) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Missing geometry data in mesh node"); - return false; - } - - return true; - } - - // Currently doesn't maintain a list of unique control points. - // Normals are associated with each triangle vertex from the face. - bool BuildSceneBlendShapeFromFbxBlendShape(const AZStd::shared_ptr& blendShape, - const AZStd::shared_ptr& sourceMesh, const FbxSceneSystem& sceneSystem) - { - // Control points contain positions of vertices - const AZStd::vector& fbxControlPoints = sourceMesh->GetControlPoints(); - const int* const fbxPolygonVertices = sourceMesh->GetPolygonVertices(); - - // Iterate through each polygon in the mesh and convert data - const int fbxPolygonCount = sourceMesh->GetPolygonCount(); - - for (int fbxPolygonIndex = 0; fbxPolygonIndex < fbxPolygonCount; ++fbxPolygonIndex) - { - const int fbxPolygonVertexCount = sourceMesh->GetPolygonSize(fbxPolygonIndex); - if (fbxPolygonVertexCount <= 2) - { - continue; - } - - AZ_TraceContext("Polygon Index", fbxPolygonIndex); - - const int fbxVertexStartIndex = sourceMesh->GetPolygonVertexIndex(fbxPolygonIndex); - - // Triangulate polygon as a fan and remember resulting vertices and faces - - int firstMeshVertexIndex = -1; - int previousMeshVertexIndex = -1; - - DataTypes::IBlendShapeData::Face face; - int verticesInMeshFace = 0; - - // Iterate through each vertex in the polygon - for (int vertexIndex = 0; vertexIndex < fbxPolygonVertexCount; ++vertexIndex) - { - const int meshVertexIndex = aznumeric_caster(blendShape->GetVertexCount()); - - const int fbxPolygonVertexIndex = fbxVertexStartIndex + vertexIndex; - const int fbxControlPointIndex = fbxPolygonVertices[fbxPolygonVertexIndex]; - - // This data allows for mapping vertex data to original Control Point index. - blendShape->SetVertexIndexToControlPointIndexMap(meshVertexIndex, fbxControlPointIndex); - - Vector3 meshVertexPosition = fbxControlPoints[fbxControlPointIndex]; - Vector3 meshVertexNormal; - sourceMesh->GetPolygonVertexNormal(fbxPolygonIndex, vertexIndex, meshVertexNormal); - - // position - sceneSystem.SwapVec3ForUpAxis(meshVertexPosition); - sceneSystem.ConvertUnit(meshVertexPosition); - - // normal - sceneSystem.SwapVec3ForUpAxis(meshVertexNormal); - meshVertexNormal.Normalize(); - - blendShape->AddPosition(meshVertexPosition); - blendShape->AddNormal(meshVertexNormal); - - // Add face - { - if (vertexIndex == 0) - { - firstMeshVertexIndex = meshVertexIndex; - } - - int meshVertices[3]; - int meshNormals[3]; - - int meshVertexCount = 0; - - meshVertices[meshVertexCount] = meshVertexIndex; - meshNormals[meshVertexCount++] = meshVertexIndex; - - // If we already have generated one triangle before, make a new triangle at a time as we encounter a new vertex. - // The new triangle is composed with the first vertex of the polygon, the last vertex, and the current vertex. - if (vertexIndex >= 3) - { - meshVertices[meshVertexCount++] = firstMeshVertexIndex; - meshVertices[meshVertexCount++] = previousMeshVertexIndex; - } - - for (int faceVertexIndex = 0; faceVertexIndex < meshVertexCount; ++faceVertexIndex) - { - face.vertexIndex[verticesInMeshFace++] = meshVertices[faceVertexIndex]; - - if (verticesInMeshFace == 3) - { - verticesInMeshFace = 0; - blendShape->AddFace(face); - break; - } - } - } - - previousMeshVertexIndex = meshVertexIndex; - } - - // Report problem if there are vertices that left for forming a polygon - if (verticesInMeshFace != 0) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Internal error in mesh filler. Vertices were left without forming polygon"); - return false; - } - } - - // Report problem if no vertex or face converted to MeshData - if (blendShape->GetVertexCount() <= 0 || blendShape->GetFaceCount() <= 0) - { - AZ_TracePrintf(Utilities::ErrorWindow, "Missing geometry data in blendshape node"); - return false; - } - - return true; - } - } - } -} diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/FbxMeshImporterUtilities.h b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/FbxMeshImporterUtilities.h deleted file mode 100644 index efb85e5275..0000000000 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/FbxMeshImporterUtilities.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -* its licensors. -* -* For complete copyright and license terms please see the LICENSE at the root of this -* distribution (the "License"). All use of this software is governed by the License, -* or, if provided, by the license below or the license accompanying this file. Do not -* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* -*/ - -#pragma once - -namespace AZ -{ - namespace FbxSDKWrapper - { - class FbxMeshWrapper; - } - - namespace SceneData - { - namespace GraphData - { - class MeshData; - class BlendShapeData; - } - } - - namespace SceneAPI - { - class FbxSceneSystem; - namespace FbxSceneBuilder - { - bool BuildSceneMeshFromFbxMesh(const AZStd::shared_ptr& mesh, - const FbxSDKWrapper::FbxMeshWrapper& sourceMesh, const FbxSceneSystem& sceneSystem); - bool BuildSceneBlendShapeFromFbxBlendShape(const AZStd::shared_ptr& blendShape, - const AZStd::shared_ptr& sourceMesh, const FbxSceneSystem& sceneSystem); - } - } -} diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/RenamedNodesMap.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/RenamedNodesMap.cpp index 3c0414734f..abc095d583 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/RenamedNodesMap.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Importers/Utilities/RenamedNodesMap.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/Tests/Importers/FbxImporterUtilitiesTests.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/Tests/Importers/FbxImporterUtilitiesTests.cpp index 7ac64b3eda..66db966cac 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/Tests/Importers/FbxImporterUtilitiesTests.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/Tests/Importers/FbxImporterUtilitiesTests.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/fbxscenebuilder_files.cmake b/Code/Tools/SceneAPI/FbxSceneBuilder/fbxscenebuilder_files.cmake index 93976a1709..92e02f3c6d 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/fbxscenebuilder_files.cmake +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/fbxscenebuilder_files.cmake @@ -19,39 +19,8 @@ set(FILES FbxSceneSystem.cpp ImportContexts/ImportContexts.h ImportContexts/ImportContexts.cpp - ImportContexts/FbxImportContexts.h - ImportContexts/FbxImportContexts.cpp ImportContexts/AssImpImportContexts.h ImportContexts/AssImpImportContexts.cpp - Importers/FbxAnimationImporter.h - Importers/FbxAnimationImporter.cpp - Importers/FbxBoneImporter.h - Importers/FbxBoneImporter.cpp - Importers/FbxBlendShapeImporter.h - Importers/FbxBlendShapeImporter.cpp - Importers/FbxColorStreamImporter.h - Importers/FbxColorStreamImporter.cpp - Importers/FbxTangentStreamImporter.h - Importers/FbxTangentStreamImporter.cpp - Importers/FbxBitangentStreamImporter.h - Importers/FbxBitangentStreamImporter.cpp - Importers/FbxImporterUtilities.h - Importers/FbxImporterUtilities.inl - Importers/FbxImporterUtilities.cpp - Importers/FbxMaterialImporter.h - Importers/FbxMaterialImporter.cpp - Importers/FbxMeshImporter.h - Importers/FbxMeshImporter.cpp - Importers/FbxSkinImporter.h - Importers/FbxSkinImporter.cpp - Importers/FbxSkinWeightsImporter.h - Importers/FbxSkinWeightsImporter.cpp - Importers/FbxTransformImporter.h - Importers/FbxTransformImporter.cpp - Importers/FbxUvMapImporter.h - Importers/FbxUvMapImporter.cpp - Importers/Utilities/FbxMeshImporterUtilities.h - Importers/Utilities/FbxMeshImporterUtilities.cpp Importers/Utilities/AssImpMeshImporterUtilities.h Importers/Utilities/AssImpMeshImporterUtilities.cpp Importers/Utilities/RenamedNodesMap.h @@ -84,4 +53,7 @@ set(FILES Importers/AssImpUvMapImporter.cpp Importers/AssImpAnimationImporter.h Importers/AssImpAnimationImporter.cpp + Importers/ImporterUtilities.h + Importers/ImporterUtilities.cpp + Importers/ImporterUtilities.inl ) diff --git a/Code/Tools/SceneAPI/FbxSDKWrapper/CMakeLists.txt b/Code/Tools/SceneAPI/SDKWrapper/CMakeLists.txt similarity index 84% rename from Code/Tools/SceneAPI/FbxSDKWrapper/CMakeLists.txt rename to Code/Tools/SceneAPI/SDKWrapper/CMakeLists.txt index ddbabe604d..b1664ca7e5 100644 --- a/Code/Tools/SceneAPI/FbxSDKWrapper/CMakeLists.txt +++ b/Code/Tools/SceneAPI/SDKWrapper/CMakeLists.txt @@ -16,21 +16,18 @@ endif() set(sdkwrapper_dir ${CMAKE_CURRENT_LIST_DIR}/../SDKWrapper) ly_add_target( - NAME FbxSDKWrapper STATIC + NAME SDKWrapper STATIC NAMESPACE AZ FILES_CMAKE - fbxsdkwrapper_files.cmake - ${sdkwrapper_dir}/sdkwrapper_files.cmake + sdkwrapper_files.cmake INCLUDE_DIRECTORIES PUBLIC . ../.. - ${sdkwrapper_dir} BUILD_DEPENDENCIES PRIVATE AZ::AzCore AZ::AzToolsFramework PUBLIC - 3rdParty::FbxSdk 3rdParty::assimplib ) diff --git a/Gems/SceneProcessing/Code/CMakeLists.txt b/Gems/SceneProcessing/Code/CMakeLists.txt index 9c514adbe4..67124a74d5 100644 --- a/Gems/SceneProcessing/Code/CMakeLists.txt +++ b/Gems/SceneProcessing/Code/CMakeLists.txt @@ -39,7 +39,6 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS) PUBLIC 3rdParty::Qt::Widgets 3rdParty::mikkelsen - 3rdParty::FbxSdk AZ::AzCore AZ::SceneCore AZ::SceneData diff --git a/cmake/3rdParty/FindFbxSdk.cmake b/cmake/3rdParty/FindFbxSdk.cmake deleted file mode 100644 index c703512036..0000000000 --- a/cmake/3rdParty/FindFbxSdk.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -ly_add_external_target( - NAME FbxSdk - VERSION 2016.1.2-az.1 - INCLUDE_DIRECTORIES include -) diff --git a/cmake/3rdParty/Platform/Linux/FbxSdk_linux.cmake b/cmake/3rdParty/Platform/Linux/FbxSdk_linux.cmake deleted file mode 100644 index cf14c5e0b5..0000000000 --- a/cmake/3rdParty/Platform/Linux/FbxSdk_linux.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(FBXSDK_LIBS ${BASE_PATH}/lib/gcc4/x64/$,debug,release>/libfbxsdk.so) -set(FBXSDK_RUNTIME_DEPENDENCIES ${BASE_PATH}/lib/gcc4/x64/$,debug,release>/libfbxsdk.so) diff --git a/cmake/3rdParty/Platform/Linux/cmake_linux_files.cmake b/cmake/3rdParty/Platform/Linux/cmake_linux_files.cmake index fbe24d382d..1a99f250b2 100644 --- a/cmake/3rdParty/Platform/Linux/cmake_linux_files.cmake +++ b/cmake/3rdParty/Platform/Linux/cmake_linux_files.cmake @@ -11,6 +11,5 @@ set(FILES BuiltInPackages_linux.cmake - FbxSdk_linux.cmake Wwise_linux.cmake ) diff --git a/cmake/3rdParty/Platform/Mac/FbxSdk_mac.cmake b/cmake/3rdParty/Platform/Mac/FbxSdk_mac.cmake deleted file mode 100644 index 3918bd2317..0000000000 --- a/cmake/3rdParty/Platform/Mac/FbxSdk_mac.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(FBXSDK_LIBS ${BASE_PATH}/lib/clang/$,debug,release>/libfbxsdk.dylib) -set(FBXSDK_RUNTIME_DEPENDENCIES ${BASE_PATH}/lib/clang/$,debug,release>/libfbxsdk.dylib) - diff --git a/cmake/3rdParty/Platform/Mac/cmake_mac_files.cmake b/cmake/3rdParty/Platform/Mac/cmake_mac_files.cmake index 7d7679c3aa..8a422c0962 100644 --- a/cmake/3rdParty/Platform/Mac/cmake_mac_files.cmake +++ b/cmake/3rdParty/Platform/Mac/cmake_mac_files.cmake @@ -11,7 +11,6 @@ set(FILES BuiltInPackages_mac.cmake - FbxSdk_mac.cmake OpenGLInterface_mac.cmake Wwise_mac.cmake ) diff --git a/cmake/3rdParty/Platform/Windows/FbxSdk_windows.cmake b/cmake/3rdParty/Platform/Windows/FbxSdk_windows.cmake deleted file mode 100644 index 240515972d..0000000000 --- a/cmake/3rdParty/Platform/Windows/FbxSdk_windows.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(FBXSDK_LIBS ${BASE_PATH}/lib/vs2015/x64/$,debug,release>/libfbxsdk-md.lib) \ No newline at end of file diff --git a/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake b/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake index 64d58e912f..72b6b0f378 100644 --- a/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake +++ b/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake @@ -11,6 +11,5 @@ set(FILES BuiltInPackages_windows.cmake - FbxSdk_windows.cmake Wwise_windows.cmake ) diff --git a/cmake/3rdParty/cmake_files.cmake b/cmake/3rdParty/cmake_files.cmake index 80e1ae426a..ebbad6e156 100644 --- a/cmake/3rdParty/cmake_files.cmake +++ b/cmake/3rdParty/cmake_files.cmake @@ -12,7 +12,6 @@ set(FILES BuiltInPackages.cmake FindClang.cmake - FindFbxSdk.cmake FindOpenGLInterface.cmake FindRadTelemetry.cmake FindVkValidation.cmake