[LYN-3717] When pulling in an actor FBX, two entities are spawned & [ATOM-15258] Clicking and Dragging fbx file into viewport produces 2 entities (#1392)

* [LYN-3717] When pulling in an actor FBX, two entities are spawned & [ATOM-15258] Clicking and Dragging fbx file into viewport produces 2 entities
* Added another operation to the CanSpawnEntityForProduct that checks the other products and can veto the creation process.
* The model product will not create an entity in case there is already an actor exported, which prevents the issue reported by two different teams/users.
This commit is contained in:
Benjamin Jillich
2021-06-22 05:12:42 -07:00
committed by GitHub
parent 858dee2210
commit 7d5a7b47ac
4 changed files with 57 additions and 10 deletions
@@ -315,5 +315,26 @@ namespace AZ
return modelTriangleCount;
}
} //namespace RPI
bool ModelAssetHandler::HasConflictingProducts(const AZStd::vector<AZ::Data::AssetType>& productAssetTypes) const
{
size_t modelAssetCount = 0;
size_t actorAssetCount = 0;
for (const AZ::Data::AssetType& assetType : productAssetTypes)
{
if (assetType == azrtti_typeid<ModelAsset>())
{
modelAssetCount++;
}
else if (assetType == AZ::Data::AssetType("{F67CC648-EA51-464C-9F5D-4A9CE41A7F86}")) // ActorAsset
{
actorAssetCount++;
}
}
// When dropping a well-defined character, consisting of a mesh and a skeleton/actor,
// do not create an entity with a mesh component.
return modelAssetCount == 1 && actorAssetCount == 1;
}
} // namespace RPI
} // namespace AZ