remove scripteventreference deprecated code
Signed-off-by: carlitosan <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
-92
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ScriptEventReferencesComponent.h"
|
||||
|
||||
namespace ScriptEvents
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
void ScriptEventReferencesComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
// The Script Event References component is no longer necessary, as all Script Event assets
|
||||
// will be properly loaded as needed.
|
||||
serializeContext->ClassDeprecate("ScriptEventReferencesComponent", "{D0F440AC-32D4-49EC-8B93-860B188266A6}");
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEventReferencesComponent::Activate()
|
||||
{
|
||||
for (auto& scriptEventReferences : m_scriptEventAssets)
|
||||
{
|
||||
const auto& asset = scriptEventReferences.GetAsset();
|
||||
if (asset)
|
||||
{
|
||||
if (!AZ::Data::AssetBus::MultiHandler::BusIsConnectedId(asset.GetId()))
|
||||
{
|
||||
AZ::Data::AssetBus::MultiHandler::BusConnect(asset.GetId());
|
||||
}
|
||||
|
||||
// Load the asset if it's not ready
|
||||
if (!asset.IsReady())
|
||||
{
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
AZ::Data::AssetCatalogRequestBus::BroadcastResult(assetInfo, &AZ::Data::AssetCatalogRequests::GetAssetInfoById, asset.GetId());
|
||||
if (assetInfo.m_assetId.IsValid())
|
||||
{
|
||||
AZ::Data::AssetManager::Instance().GetAsset(asset.GetId(), azrtti_typeid<ScriptEventsAsset>(), AZ::Data::AssetLoadBehavior::Default)
|
||||
.BlockUntilLoadComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Warning("Script Events", false, "ScriptEventReferencesComponent could not find Script Event asset: %s", scriptEventReferences.GetDefinition() ? scriptEventReferences.GetDefinition()->GetName().c_str() : scriptEventReferences.GetAsset().GetId().ToString<AZStd::string>().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEventReferencesComponent::Deactivate()
|
||||
{
|
||||
for (auto& scriptEventReferences : m_scriptEventAssets)
|
||||
{
|
||||
const auto& asset = scriptEventReferences.GetAsset();
|
||||
if (asset)
|
||||
{
|
||||
AZ::Data::AssetBus::MultiHandler::BusDisconnect(asset.GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEventReferencesComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
provided.push_back(AZ_CRC("ScriptEventReference", 0x3df92d40));
|
||||
}
|
||||
|
||||
void ScriptEventReferencesComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC("ScriptEventReference", 0x3df92d40));
|
||||
}
|
||||
|
||||
void ScriptEventReferencesComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
|
||||
{
|
||||
dependent.push_back(AZ_CRC("LuaScriptService", 0x21d76c4b));
|
||||
}
|
||||
|
||||
void ScriptEventReferencesComponent::OnAssetReady(AZ::Data::Asset<AZ::Data::AssetData> asset)
|
||||
{
|
||||
if (ScriptEventsAsset* scriptEventAsset = asset.GetAs<ScriptEventsAsset>())
|
||||
{
|
||||
scriptEventAsset->m_definition.RegisterInternal();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ScriptEvents/ScriptEventsAssetRef.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
|
||||
namespace ScriptEvents
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
class ScriptEventReferencesComponent
|
||||
: public AZ::Component
|
||||
, private AZ::Data::AssetBus::MultiHandler
|
||||
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_COMPONENT(ScriptEventReferencesComponent, "{D0F440AC-32D4-49EC-8B93-860B188266A6}", AZ::Component);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Component
|
||||
void Init() override {}
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
||||
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
|
||||
|
||||
void OnAssetReady(AZ::Data::Asset<AZ::Data::AssetData> asset) override;
|
||||
static void Reflect(AZ::ReflectContext* reflection);
|
||||
|
||||
AZStd::vector<ScriptEvents::ScriptEventsAssetRef> m_scriptEventAssets;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <ScriptEvents/ScriptEventsGem.h>
|
||||
#include <Source/Editor/ScriptEventsSystemEditorComponent.h>
|
||||
|
||||
#include <ScriptEvents/Components/ScriptEventReferencesComponent.h>
|
||||
#include <Builder/ScriptEventsBuilderComponent.h>
|
||||
#include <ScriptEvents/ScriptEventsBus.h>
|
||||
|
||||
@@ -74,7 +73,6 @@ namespace ScriptEvents
|
||||
|
||||
m_descriptors.insert(m_descriptors.end(), {
|
||||
ScriptEventsEditor::ScriptEventEditorSystemComponent::CreateDescriptor(),
|
||||
ScriptEvents::Components::ScriptEventReferencesComponent::CreateDescriptor(),
|
||||
ScriptEventsBuilder::ScriptEventsBuilderComponent::CreateDescriptor(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
#include <ScriptEvents/ScriptEventsGem.h>
|
||||
|
||||
#include <ScriptEvents/Components/ScriptEventReferencesComponent.h>
|
||||
|
||||
namespace ScriptEvents
|
||||
{
|
||||
ScriptEventsModule::ScriptEventsModule()
|
||||
@@ -23,8 +21,7 @@ namespace ScriptEvents
|
||||
ScriptEventModuleConfigurationRequestBus::Handler::BusConnect();
|
||||
|
||||
m_descriptors.insert(m_descriptors.end(), {
|
||||
ScriptEvents::ScriptEventsSystemComponent::CreateDescriptor(),
|
||||
ScriptEvents::Components::ScriptEventReferencesComponent::CreateDescriptor(),
|
||||
ScriptEvents::ScriptEventsSystemComponent::CreateDescriptor()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,4 @@ set(FILES
|
||||
Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventsBindingBus.h
|
||||
Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventBinding.h
|
||||
Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventBinding.cpp
|
||||
Include/ScriptEvents/Components/ScriptEventReferencesComponent.h
|
||||
Include/ScriptEvents/Components/ScriptEventReferencesComponent.cpp
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user