You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/AssetValidation/Code/Include/AssetValidation/AssetValidationBus.h

82 lines
4.4 KiB
C++

/*
* 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 <AzCore/EBus/EBus.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/std/containers/set.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/utils.h>
namespace AssetValidation
{
class AssetValidationRequests
: public AZ::EBusTraits
{
public:
//////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//////////////////////////////////////////////////////////////////////////
using AssetSourceList = AZStd::vector<AZStd::pair< AZ::Data::AssetId, AZ::u32 >>;
//! Request to toggle Seed Mode
virtual void SeedMode() { }
//! Given an asset fileName does it exist in our dependency graph beneath any of our declared seed assetIds
virtual bool IsKnownAsset(const char* /*fileName*/) { return false; }
//! When Seed Mode is on, given an asset fileName does it exist in our dependency graph - if so emit missing seed notification
virtual bool CheckKnownAsset(const char* /*fileName*/) { return false; }
//! Add a new seed assetId to the graph. sourceID is used for deterministic add/removal - the same seed assetId
//! Could come from multiple sources so we need to be able to track multiple copies to avoid cleanup errors
virtual bool AddSeedAssetId(AZ::Data::AssetId /*assetId*/, AZ::u32 /*sourceId*/) { return false; }
// Remove a seed assetId to the graph. sourceID is used for deterministic removal - the same seed assetId
//! Could come from multiple sources so we need to be able to track multiple copies to avoid cleanup errors
virtual bool RemoveSeedAssetId(AZ::Data::AssetId /* assetId */, AZ::u32 /*sourceId */) { return false; }
//! Request to add a seed file to be tracked by file path
virtual bool RemoveSeedAssetIdList(AssetSourceList /* assetList */) { return false; }
//! Request to add a seed to tracking by a relative path under the /dev folder
virtual bool AddSeedPath([[maybe_unused]] const char* fileName) { return false; }
//! Request to Remove a Seed from tracking by relative path under the /dev folder
virtual bool RemoveSeedPath([[maybe_unused]] const char* fileName) { return false; }
//! Check current status of seed mode
virtual bool IsSeedMode() { return false; }
//! List all known current assetIds and paths
virtual void ListKnownAssets() { }
//! Add all seeds from a seed file at a specified path
virtual bool AddSeedList([[maybe_unused]] const char* filePath) { return true; }
//! Remove all seeds from a seed file at a specified path
virtual bool RemoveSeedList([[maybe_unused]] const char* filePath) { return true; }
//! Toggle exclude printing
virtual void TogglePrintExcluded() { }
};
using AssetValidationRequestBus = AZ::EBus<AssetValidationRequests>;
class AssetValidationNotifications
: public AZ::EBusTraits
{
public:
//////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//////////////////////////////////////////////////////////////////////////
// Notification that SeedMode has been turned on or off
virtual void SetSeedMode(bool /*modeOn*/) {}
// Notification that an unknown asset has been discovered through CheckKnownAsset
virtual void UnknownAsset([[maybe_unused]] const char* fileName) { }
};
using AssetValidationNotificationBus = AZ::EBus<AssetValidationNotifications>;
} // namespace AssetValidation