{LYN-4514} Re-factored Blast gem's python asset builder (#2143)

* {LYN-4514} Re-factored Blast gem's python asset builder

* Re-factored Blast gem's python asset builder so that the .blast file creates an asset info scene manifest
* Added a python script to act as a SceneAPI script + Python Asset Builder (blast_asset_builder.py)
* renaming types from "Slice" to "Chunk"

Tests: Re-enabled Gems/Blast/Code/Tests/Editor/EditorBlastSliceAssetHandlerTest.cpp

Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* renaming from Slice to Chunks

Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* updated the Copyright


Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* Removing StdAfx.h includes

Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* null check added m_blastChunksAsset.Get()
removing 'slice' like EditorBlastSliceAssetHandlerTestFixture
delete old asset builder blast file


Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* adding source deps for FBX -> BLAST file

Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* removing slice name

Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* Adding error message and updates from PR

Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>
This commit is contained in:
jackalbe
2021-08-03 09:21:36 -05:00
committed by GitHub
parent fa52124f9c
commit be5a7f821c
21 changed files with 801 additions and 1284 deletions
@@ -45,10 +45,10 @@ namespace Blast
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
{
serialize->Class<EditorBlastMeshDataComponent, AzToolsFramework::Components::EditorComponentBase>()
->Version(4)
->Version(5)
->Field("Show Mesh Assets", &EditorBlastMeshDataComponent::m_showMeshAssets)
->Field("Mesh Assets", &EditorBlastMeshDataComponent::m_meshAssets)
->Field("Blast Slice", &EditorBlastMeshDataComponent::m_blastSliceAsset);
->Field("Blast Chunks", &EditorBlastMeshDataComponent::m_blastChunksAsset);
if (AZ::EditContext* ec = serialize->GetEditContext())
{
@@ -77,9 +77,9 @@ namespace Blast
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorBlastMeshDataComponent::OnMeshAssetsChanged)
->DataElement(
AZ::Edit::UIHandlers::Default, &EditorBlastMeshDataComponent::m_blastSliceAsset, "Blast Slice",
"Slice override to fill out meshes and material")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorBlastMeshDataComponent::OnSliceAssetChanged);
AZ::Edit::UIHandlers::Default, &EditorBlastMeshDataComponent::m_blastChunksAsset, "Blast Chunks",
"Manifest override to fill out meshes and material")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorBlastMeshDataComponent::OnBlastChunksAssetChanged);
}
}
}
@@ -107,23 +107,27 @@ namespace Blast
UnregisterModel();
}
void EditorBlastMeshDataComponent::OnSliceAssetChanged()
void EditorBlastMeshDataComponent::OnBlastChunksAssetChanged()
{
if (!m_blastSliceAsset.GetId().IsValid())
if (!m_blastChunksAsset.GetId().IsValid())
{
return;
}
using namespace AZ::Data;
const AssetId blastAssetId = m_blastChunksAsset.GetId();
m_blastChunksAsset = AssetManager::Instance().GetAsset<BlastChunksAsset>(blastAssetId, AssetLoadBehavior::QueueLoad);
m_blastChunksAsset.BlockUntilLoadComplete();
const AssetId blastAssetId = m_blastSliceAsset.GetId();
m_blastSliceAsset =
AssetManager::Instance().GetAsset<BlastSliceAsset>(blastAssetId, AssetLoadBehavior::QueueLoad);
m_blastSliceAsset.BlockUntilLoadComplete();
if (!m_blastChunksAsset.Get() || m_blastChunksAsset.Get()->GetModelAssetIds().empty())
{
AZ_Warning("blast", false, "Blast Chunk Asset does not contain any models.")
return;
}
// load up the new mesh list
m_meshAssets.clear();
for (const auto& meshId : m_blastSliceAsset.Get()->GetMeshIdList())
for (const auto& meshId : m_blastChunksAsset.Get()->GetModelAssetIds())
{
auto meshAsset = AssetManager::Instance().GetAsset<AZ::RPI::ModelAsset>(meshId, AssetLoadBehavior::QueueLoad);
if (meshAsset)
@@ -135,8 +139,8 @@ namespace Blast
UnregisterModel();
RegisterModel();
AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
using namespace AzToolsFramework;
ToolsApplicationEvents::Bus::Broadcast(&ToolsApplicationEvents::InvalidatePropertyDisplay, Refresh_EntireTree);
}
void EditorBlastMeshDataComponent::OnMeshAssetsChanged()
@@ -205,9 +209,9 @@ namespace Blast
gameEntity->CreateComponent<BlastMeshDataComponent>(m_meshAssets);
}
const AZ::Data::Asset<BlastSliceAsset>& EditorBlastMeshDataComponent::GetBlastSliceAsset() const
const AZ::Data::Asset<BlastChunksAsset>& EditorBlastMeshDataComponent::GetBlastChunksAsset() const
{
return m_blastSliceAsset;
return m_blastChunksAsset;
}
const AZStd::vector<AZ::Data::Asset<AZ::RPI::ModelAsset>>& EditorBlastMeshDataComponent::GetMeshAssets() const