First pass FBX -> Scene File conversion. (#1699)

This is the simple pass, minimizing code changes and focused on comments.

Signed-off-by: stankowi <4838196+AMZN-stankowi@users.noreply.github.com>
main
AMZN-stankowi 5 years ago committed by GitHub
parent ff9d52d38e
commit 4c4be73bd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -69,7 +69,7 @@ namespace AZ
void MaterialAssetDependenciesComponent::ReportJobDependencies(SceneAPI::JobDependencyList& jobDependencyList, const char* platformIdentifier)
{
AssetBuilderSDK::SourceFileDependency materialTypeSource;
// Right now, FBX importing only supports a single material type, once that changes, this will have to be re-designed, see ATOM-3554
// Right now, scene file importing only supports a single material type, once that changes, this will have to be re-designed, see ATOM-3554
RPI::MaterialConverterBus::BroadcastResult(materialTypeSource.m_sourceFileDependencyPath, &RPI::MaterialConverterBus::Events::GetMaterialTypePath);
AssetBuilderSDK::JobDependency jobDependency;
@ -94,7 +94,7 @@ namespace AZ
{
// [GFX TODO] I am suggesting we use the first two 16bits for different kind of assets generated from a Scene
// For example, 0x10000 for mesh, 0x20000 for material, 0x30000 for animation, 0x40000 for scene graph and etc.
// so the subid can be evaluated for reference across different assets generate within this fbx.
// so the subid can be evaluated for reference across different assets generate within this scene file.
/*const uint32_t materialPrefix = 0x20000;
AZ_Assert(materialPrefix > materialId, "materialId should be smaller than materialPrefix");
return materialPrefix + materialId;*/
@ -148,7 +148,7 @@ namespace AZ
// The source data for generating material asset
MaterialSourceData sourceData;
// User hook to create their materials based on the data from Fbx pipeline
// User hook to create their materials based on the data from the scene pipeline
bool result = false;
RPI::MaterialConverterBus::BroadcastResult(result, &RPI::MaterialConverterBus::Events::ConvertMaterial, *materialData, sourceData);
if (result)

@ -995,7 +995,7 @@ namespace AZ
if (numInfluencesExcess > 0)
{
AZ_Warning(s_builderName, warnedExcessOfSkinInfluences,
"Mesh %s has more skin influences (%d) than the maximum (%d). Skinning influences won't be normalized. Maximum number of skin influences can be increased with a Skin Modifier in FBX Settings.",
"Mesh %s has more skin influences (%d) than the maximum (%d). Skinning influences won't be normalized. Maximum number of skin influences can be increased with a Skin Modifier in Scene Settings.",
sourceMesh.m_name.GetCStr(),
m_numSkinJointInfluencesPerVertex + numInfluencesExcess,
m_numSkinJointInfluencesPerVertex);

@ -41,7 +41,7 @@ namespace AZ
AZStd::string label;
if (assetId.IsValid())
{
// Material assets that are exported through the FBX pipeline have their filenames generated by adding
// Material assets that are exported through the scene pipeline have their filenames generated by adding
// the DCC material name as a prefix and a unique number to the end of the source file name.
// Rather than storing the DCC material name inside of the material asset we can reproduce it by removing
// the prefix and suffix from the product file name.

@ -100,7 +100,7 @@ namespace AZ
{
return
GetAssetId(key, RPI::MaterialAsset::RTTI_Type()).IsValid() &&
// in case it's a source fbx, it will contain both material and model products
// in case it's a source scene file, it will contain both material and model products
// model thumbnails are handled by MeshThumbnail
!GetAssetId(key, RPI::ModelAsset::RTTI_Type()).IsValid();
}

@ -95,7 +95,7 @@ namespace AZ
skinnedSubMesh.m_vertexCount = aznumeric_cast<uint32_t>(subMeshVertexCount);
lodVertexCount += aznumeric_cast<uint32_t>(subMeshVertexCount);
// The default material id used by a sub-mesh is the guid of the source .fbx plus the subId which is a unique material ID from the scene API
// The default material id used by a sub-mesh is the guid of the source scene file plus the subId which is a unique material ID from the scene API
AZ::u32 subId = modelMesh.GetMaterialAsset().GetId().m_subId;
AZ::Data::AssetId materialId{ actorAssetId.m_guid, subId };

@ -62,7 +62,7 @@ namespace Blast
}
else
{
// in this case we'll want to extract the physics meshes from the fbx.
// in this case we'll want to extract the physics meshes from the scene file.
// We don't necessarily have access to the mesh data though, so if we want to support this,
// we'll need to come up with a way to associate with the mesh data
// See BlastAssetModel in the SDK sample for how to create that data

@ -160,7 +160,7 @@ namespace EMotionFX
}
}
// Default to the first mesh group until we get a way to choose it via the FBX settings (ATOM-13590).
// Default to the first mesh group until we get a way to choose it via the scene settings (ATOM-13590).
AZStd::optional<AZ::Data::AssetId> meshAssetId = AZStd::nullopt;
AZ_Error("EMotionFX", atomModelAssets.size() <= 1, "Ambigious mesh for actor asset. More than one mesh group found. Defaulting to the first one.");
if (!atomModelAssets.empty())

@ -96,7 +96,7 @@ namespace EMotionFX
const AZ::u32 frameCount = aznumeric_caster(animation->GetKeyFrameCount());
if (motionRangeRule->GetStartFrame() == 0 && motionRangeRule->GetEndFrame() == frameCount - 1)
{
// if the startframe/endframe matches the fbx animation length, remove it.
// if the startframe/endframe matches the scene file's animation length, remove it.
rules.RemoveRule(motionRangeRule);
updated = true;
}

@ -25,7 +25,7 @@ namespace EMotionFX
~IMotionGroup() override = default;
// Ability to specify root bone can be useful if there are multiple skeletons
// stored in an fbx file or if the user wants to override the root bone automatically
// stored in a scene file or if the user wants to override the root bone automatically
// selected by the code.
virtual const AZStd::string& GetSelectedRootBone() const = 0;

@ -158,7 +158,7 @@ namespace EMotionFX
virtual size_t CalcStreamSaveSizeInBytes(const SaveSettings& saveSettings) const = 0;
virtual AZ::u32 GetStreamSaveVersion() const = 0;
virtual bool GetSupportsOptimizeSettings() const { return true; }
virtual const char* GetFbxSettingsName() const = 0;
virtual const char* GetSceneSettingsName() const = 0;
// Sampling
virtual Transform SampleJointTransform(const SampleSettings& settings, AZ::u32 jointSkeletonIndex) const = 0;

@ -35,7 +35,7 @@ namespace EMotionFX
return aznew NonUniformMotionData();
}
const char* NonUniformMotionData::GetFbxSettingsName() const
const char* NonUniformMotionData::GetSceneSettingsName() const
{
return "Reduced Keyframes (slower, mostly smaller)";
}

@ -52,7 +52,7 @@ namespace EMotionFX
bool Save(MCore::Stream* stream, const SaveSettings& saveSettings) const override;
size_t CalcStreamSaveSizeInBytes(const SaveSettings& saveSettings) const override;
AZ::u32 GetStreamSaveVersion() const override;
const char* GetFbxSettingsName() const override;
const char* GetSceneSettingsName() const override;
Transform SampleJointTransform(const SampleSettings& settings, AZ::u32 jointSkeletonIndex) const override;
void SamplePose(const SampleSettings& settings, Pose* outputPose) const override;

@ -36,7 +36,7 @@ namespace EMotionFX
return aznew UniformMotionData();
}
const char* UniformMotionData::GetFbxSettingsName() const
const char* UniformMotionData::GetSceneSettingsName() const
{
return "Evenly Spaced Keyframes (faster, mostly larger)";
}

@ -49,7 +49,7 @@ namespace EMotionFX
size_t CalcStreamSaveSizeInBytes(const SaveSettings& saveSettings) const override;
AZ::u32 GetStreamSaveVersion() const override;
bool GetSupportsOptimizeSettings() const override { return false; }
const char* GetFbxSettingsName() const override;
const char* GetSceneSettingsName() const override;
// Overloaded.
Transform SampleJointTransform(const SampleSettings& settings, AZ::u32 jointSkeletonIndex) const override;

@ -76,7 +76,7 @@ namespace EMotionFX
const MotionDataFactory& factory = GetEMotionFX().GetMotionManager()->GetMotionDataFactory();
for (size_t i = 0; i < factory.GetNumRegistered(); ++i)
{
GUI->addItem(factory.GetRegistered(i)->GetFbxSettingsName());
GUI->addItem(factory.GetRegistered(i)->GetSceneSettingsName());
m_typeIds.emplace_back(factory.GetRegistered(i)->RTTI_GetType());
}

@ -161,7 +161,7 @@ namespace EMotionFX
bool m_forceUpdateJointsOOV = false;
// \todo attachmentTarget node nr
// Note: LOD work in progress. For now we use one material instead of a list of material, because we don't have the support for LOD with multiple FBXs.
// Note: LOD work in progress. For now we use one material instead of a list of material, because we don't have the support for LOD with multiple scene files.
// We purposely kept a materialList in actorComponent and actorRenderNode for the flexibility in future.
// At the moment, the materialList stores duplicates of the same material.
AzFramework::SimpleAssetReference<LmbrCentral::MaterialAsset> m_materialPerActor;

@ -485,7 +485,7 @@ namespace EMotionFX
SetMediaRoot("@assets@");
// \todo Right now we're pointing at the @devassets@ location (source) and working from there, because .actor and .motion (motion) aren't yet processed through
// the FBX pipeline. Once they are, we'll need to update various segments of the Tool to always read from the @assets@ cache, but write to the @devassets@ data/metadata.
// the scene pipeline. Once they are, we'll need to update various segments of the Tool to always read from the @assets@ cache, but write to the @devassets@ data/metadata.
EMotionFX::GetEMotionFX().InitAssetFolderPaths();
// Register EMotionFX event handler

@ -770,13 +770,13 @@ namespace EMotionFX
TEST_F(PerformanceTestFixture, DISABLED_MotionSamplingPerformanceNonUniform)
{
// Make sure that the motion is set to use NonUniform sampling! Change this in the Fbx settings! Otherwise you get wrong results.
// Make sure that the motion is set to use NonUniform sampling! Change this in the scene settings! Otherwise you get wrong results.
TestMotionSamplingPerformance("@assets@\\animationsamples\\advanced_rinlocomotion\\motions\\rin_idle.motion");
}
TEST_F(PerformanceTestFixture, DISABLED_MotionSamplingPerformanceUniform)
{
// Make sure that the motion is set to use Uniform sampling! Change this in the Fbx settings! Otherwise you get wrong results.
// Make sure that the motion is set to use Uniform sampling! Change this in the scene settings! Otherwise you get wrong results.
TestMotionSamplingPerformance("@assets@\\animationsamples\\advanced_rinlocomotion\\motions\\rin_walk_kick_01.motion");
}

@ -249,7 +249,7 @@ namespace EMotionFX
LoadActor(actorFilename.toUtf8().data(), false);
ASSERT_EQ(EMotionFX::GetActorManager().GetNumActorInstances(), 2) << "Failed to merge Actor.";
// We can't test Save Selected Actor as we would it would involve mocking fbx scene handling.
// We can't test Save Selected Actor as we would it would involve mocking source scene handling.
// Add the filename to the recent actorsa anyway, so we can test that functionality.
EMStudio::GetMainWindow()->AddRecentActorFile(actorFilename);
@ -634,7 +634,7 @@ namespace EMotionFX
motionSet->SetFilename(motionsetFilename.toUtf8().constData());
motionSet->SetDirtyFlag(true);
// Don't create an actor or motion as we can't save that due to fbx scene requirements.
// Don't create an actor or motion as we can't save that due to source scene requirements.
EMStudio::Workspace* workspace = EMStudio::GetManager()->GetWorkspace();
const QString workspaceFilename = GenerateTempWorkspaceFilename();

@ -28,8 +28,8 @@ namespace LmbrCentral
};
/*!
* FBX Material asset type configuration.
* Reflect as: AzFramework::SimpleAssetReference<FbxMaterialAsset>
* Source scene file Material asset type configuration.
* Reflect as: AzFramework::SimpleAssetReference<DccMaterialAsset>
*/
class DccMaterialAsset
{

@ -68,7 +68,7 @@ namespace NvCloth
// Mesh Node
->DataElement(Editor::MeshNodeSelector, &ClothConfiguration::m_meshNode, "Mesh node",
"List of mesh nodes with cloth simulation data. These are the nodes selected inside Cloth Modifiers in FBX Editor Settings.")
"List of mesh nodes with cloth simulation data. These are the nodes selected inside Cloth Modifiers in Scene Settings.")
->Attribute(AZ::Edit::UIHandlers::EntityId, &ClothConfiguration::GetEntityId)
->Attribute(AZ::Edit::Attributes::StringList, &ClothConfiguration::PopulateMeshNodeList)
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree)

@ -25,8 +25,8 @@ namespace NvCloth
{
widget_t* picker = new widget_t(parent);
// Set edit button appearance to go to FBX Settings dialog
picker->GetEditButton()->setToolTip("Open FBX Settings to setup Cloth Modifiers");
// Set edit button appearance to go to Scene Settings dialog
picker->GetEditButton()->setToolTip("Open Scene Settings to setup Cloth Modifiers");
picker->GetEditButton()->setText("");
picker->GetEditButton()->setEnabled(false);
@ -106,7 +106,7 @@ namespace NvCloth
AZ::Data::Asset<AZ::Data::AssetData> meshAsset = GetMeshAsset(GUI->GetEntityId());
if (meshAsset)
{
// Open the asset with the preferred asset editor, which for Mesh and Actor Assets it's FBX Settings.
// Open the asset with the preferred asset editor, which for Mesh and Actor Assets it's Scene Settings.
bool handled = false;
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Broadcast(
&AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotifications::OpenAssetInAssociatedEditor, meshAsset.GetId(), handled);

@ -19,7 +19,7 @@ namespace NvCloth
namespace Pipeline
{
// It's necessary for the rule to specify the system allocator, otherwise
// the editor crashes when deleting the cloth modifier from FBX Settings.
// the editor crashes when deleting the cloth modifier from Scene Settings.
AZ_CLASS_ALLOCATOR_IMPL(ClothRule, AZ::SystemAllocator, 0)
const char* const ClothRule::DefaultChooseNodeName = "Choose a node";

@ -61,7 +61,7 @@ namespace NvCloth
[[maybe_unused]] const AZ::SceneAPI::Containers::Scene& scene,
AZ::SceneAPI::DataTypes::IManifestObject& target)
{
// When a cloth rule is created in the FBX Editor Settings...
// When a cloth rule is created in the Scene Settings...
if (target.RTTI_IsTypeOf(ClothRule::TYPEINFO_Uuid()))
{
ClothRule* clothRule = azrtti_cast<ClothRule*>(&target);

@ -39,7 +39,7 @@ namespace NvCloth
//! It specifies the valid Scene Groups that are allowed to have
//! cloth rules (aka cloth modifiers), these are Mesh and Actor groups.
//! It also validates the cloth rules data for the manifest (asset containing
//! all the Scene information from the FBX Editor Settings).
//! all the Scene information from the Scene Settings).
class ClothRuleBehavior
: public AZ::SceneAPI::SceneCore::BehaviorComponent
, public AZ::SceneAPI::Events::ManifestMetaInfoBus::Handler

@ -56,7 +56,7 @@ namespace PhysX
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &EditorProxyAssetShapeConfig::m_pxAsset, "PhysX Mesh", "PhysX mesh collider asset")
->Attribute(AZ_CRC_CE("EditButton"), "")
->Attribute(AZ_CRC_CE("EditDescription"), "Open in FBX Settings")
->Attribute(AZ_CRC_CE("EditDescription"), "Open in Scene Settings")
->DataElement(AZ::Edit::UIHandlers::Default, &EditorProxyAssetShapeConfig::m_configuration, "Configuration", "Configuration of asset shape")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly);
}

@ -165,7 +165,7 @@ namespace PhysX
;
// Note: This class needs to have edit context reflection so PropertyAssetCtrl::OnEditButtonClicked
// can open the asset with the preferred asset editor (FBX Settings).
// can open the asset with the preferred asset editor (Scene Settings).
if (auto* editContext = serializeContext->GetEditContext())
{
editContext->Class<MeshAsset>("PhysX Mesh Asset", "")

@ -63,7 +63,7 @@ namespace PhysX
}
} pxDefaultErrorCallback;
// A struct to store the geometry data per FBX node
// A struct to store the geometry data per scene node
struct NodeCollisionGeomExportData
{
AZStd::vector<Vec3> m_vertices;
@ -500,10 +500,10 @@ namespace PhysX
assetData.m_materialNames = meshGroup.GetMaterialSlots();
assetData.m_physicsMaterialNames = meshGroup.GetPhysicsMaterials();
// Updating materials lists from new materials gathered from fbx
// because this exporter runs when the FBX is being processed, which
// Updating materials lists from new materials gathered from the source scene file
// because this exporter runs when the source scene is being processed, which
// could have a different content from when the mesh group info was
// entered in FBX Settings Editor.
// entered in Scene Settings Editor.
if (!Utils::UpdateAssetPhysicsMaterials(assetMaterialsData.m_fbxMaterialNames, assetData.m_materialNames, assetData.m_physicsMaterialNames))
{
return SceneEvents::ProcessingResult::Failure;

@ -59,7 +59,7 @@ namespace PhysX
//! A struct to store the materials of the mesh nodes selected in a mesh group.
struct AssetMaterialsData
{
//! Material names coming from FBX.
//! Material names coming from the source scene file.
AZStd::vector<AZStd::string> m_fbxMaterialNames;
//! Look-up table for fbxMaterialNames.

@ -70,7 +70,7 @@ namespace AZ
* AddFileSoftName("_anim", PatternMatcher::MatchApproach::PostFix, "Ignore", false,
* SceneAPI::DataTypes::IAnimationData::TYPEINFO_Name())
* If the filename ends with "_anim" this will mark all nodes as "Ignore" unless they're derived from IAnimationData.
* This will cause only animations to be exported from the .fbx file even if there's other data available.
* This will cause only animations to be exported from the source scene file even if there's other data available.
*/
virtual bool AddFileSoftName(const char* pattern, SceneAPI::SceneCore::PatternMatcher::MatchApproach approach,
const char* virtualType, bool inclusive, const AZStd::string& graphObjectTypeName) = 0;

@ -42,7 +42,7 @@ namespace AZ
m_softNames.push_back(aznew NodeSoftNameSetting("^.*_[Pp][Hh][Yy][Ss](_optimized)?$", PatternMatcher::MatchApproach::Regex, "PhysicsMesh", true));
m_softNames.push_back(aznew NodeSoftNameSetting("_ignore", PatternMatcher::MatchApproach::PostFix, "Ignore", false));
// If the filename ends with "_anim" this will mark all nodes as "Ignore" unless they're derived from IAnimationData. This will
// cause only animations to be exported from the .fbx file even if there's other data available.
// cause only animations to be exported from the source scene file even if there's other data available.
m_softNames.push_back(aznew FileSoftNameSetting("_anim", PatternMatcher::MatchApproach::PostFix, "Ignore", false,
{ FileSoftNameSetting::GraphType(SceneAPI::DataTypes::IAnimationData::TYPEINFO_Name()) }));
@ -166,7 +166,7 @@ namespace AZ
"Soft naming conventions", "Update the naming conventions to suit your project.")
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
->DataElement(AZ::Edit::UIHandlers::Default, &SceneProcessingConfigSystemComponent::m_UseCustomNormals,
"Use Custom Normals", "When enabled, Open 3D Engine will use the DCC assets custom or tangent space normals. When disabled, the normals will be averaged. This setting can be overridden on individual FBX asset settings.")
"Use Custom Normals", "When enabled, Open 3D Engine will use the DCC assets custom or tangent space normals. When disabled, the normals will be averaged. This setting can be overridden on an individual scene file's asset settings.")
->Attribute(AZ::Edit::Attributes::AutoExpand, false);
}
}

@ -107,7 +107,7 @@ namespace AZ::SceneGenerationComponents
return AZ::SceneAPI::Events::ProcessingResult::Failure;
}
// Now that we have the tangents and bitangents, calculate the tangent w values for the ones that we imported from Fbx, as they only have xyz.
// Now that we have the tangents and bitangents, calculate the tangent w values for the ones that we imported from the scene file, as they only have xyz.
UpdateFbxTangentWValues(graph, nodeIndex, mesh);
}
@ -122,7 +122,7 @@ namespace AZ::SceneGenerationComponents
size_t uvSetIndex = 0;
while (uvData)
{
// Get the tangents and bitangents from Fbx.
// Get the tangents and bitangents from the source scene.
AZ::SceneAPI::DataTypes::IMeshVertexTangentData* fbxTangentData = AZ::SceneAPI::SceneData::TangentsRule::FindTangentData(graph, nodeIndex, uvSetIndex, AZ::SceneAPI::DataTypes::TangentSpace::FromFbx);
AZ::SceneAPI::DataTypes::IMeshVertexBitangentData* fbxBitangentData = AZ::SceneAPI::SceneData::TangentsRule::FindBitangentData(graph, nodeIndex, uvSetIndex, AZ::SceneAPI::DataTypes::TangentSpace::FromFbx);
@ -197,7 +197,7 @@ namespace AZ::SceneGenerationComponents
return true; // No fatal error
}
// Check if we had tangents inside the Fbx file.
// Check if we had tangents inside the source scene file.
AZ::SceneAPI::DataTypes::IMeshVertexTangentData* fbxTangentData = AZ::SceneAPI::SceneData::TangentsRule::FindTangentData(graph, nodeIndex, 0, AZ::SceneAPI::DataTypes::TangentSpace::FromFbx);
AZ::SceneAPI::DataTypes::IMeshVertexBitangentData* fbxBitangentData = AZ::SceneAPI::SceneData::TangentsRule::FindBitangentData(graph, nodeIndex, 0, AZ::SceneAPI::DataTypes::TangentSpace::FromFbx);
@ -211,7 +211,7 @@ namespace AZ::SceneGenerationComponents
requiredSpaces.emplace_back(AZ::SceneAPI::DataTypes::TangentSpace::MikkT);
}
// If all we need is import from FBX, and we have tangent data from Fbx already, then skip generating.
// If all we need is import from the source scene, and we have tangent data from the source scene already, then skip generating.
if ((requiredSpaces.size() == 1 && requiredSpaces[0] == AZ::SceneAPI::DataTypes::TangentSpace::FromFbx) && fbxTangentData && fbxBitangentData)
{
return true;

@ -50,7 +50,7 @@ namespace SceneBuilder
if (m_cachedFingerprint.empty())
{
// put them in an ORDERED set so that changing the reflection
// or the gems loaded does not invalidate FBX files due to order of reflection changing.
// or the gems loaded does not invalidate scene files due to order of reflection changing.
AZStd::set<AZStd::string> fragments;
AZ::SerializeContext* context = nullptr;
@ -350,7 +350,7 @@ namespace SceneBuilder
AZ::u32 SceneBuilderWorker::BuildSubId(const AZ::SceneAPI::Events::ExportProduct& product) const
{
// Instead of the just the lower 16-bits, use the full 32-bits that are available. There are production examples of
// uber-fbx files that contain hundreds of meshes that need to be split into individual mesh objects as an example.
// uber-scene files that contain hundreds of meshes that need to be split into individual mesh objects as an example.
AZ::u32 id = static_cast<AZ::u32>(product.m_id.GetHash());
if (product.m_lod.has_value())

Loading…
Cancel
Save