f44169f7fa
* Remove AssetSerializer inclusion from SerializeContext header Moved a few Reflect methods to new cpp files. In addition, some preparations for further header dependency reductions. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix smoke test lua failures. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Windows build fixes. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Missing license headers Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix white-space issues. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Code review fix for AzToolsFramework/AssetEditor/AssetEditorBus.h Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix inheritance list wrapping broken by older clang-format Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
82 lines
3.0 KiB
C++
82 lines
3.0 KiB
C++
/*
|
|
* 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 <ScriptCanvas/Core/Attributes.h>
|
|
|
|
#include <AzCore/RTTI/BehaviorContext.h>
|
|
#include <AzCore/Serialization/SerializeContext.h>
|
|
|
|
namespace ScriptCanvasTestingNodes
|
|
{
|
|
//! This object is used to test the use of BehaviorContext classes
|
|
class BehaviorContextObjectTest
|
|
{
|
|
public:
|
|
AZ_RTTI(BehaviorContextObjectTest, "{FF687BD7-42AA-44C4-B3AB-79353E8C6CCF}");
|
|
AZ_CLASS_ALLOCATOR(BehaviorContextObjectTest, AZ::SystemAllocator, 0);
|
|
|
|
static void Reflect(AZ::ReflectContext* context)
|
|
{
|
|
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
|
|
if (serializeContext)
|
|
{
|
|
serializeContext->Class<BehaviorContextObjectTest>()
|
|
->Version(0)
|
|
->Field("String", &BehaviorContextObjectTest::m_string)
|
|
->Field("Name", &BehaviorContextObjectTest::m_name)
|
|
;
|
|
|
|
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
|
{
|
|
editContext->Class<BehaviorContextObjectTest>("Behavior Context Object Test", "An Object that lives within Behavior Context exclusively for testing")
|
|
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
|
->Attribute(AZ::Edit::Attributes::Category, "Tests/Behavior Context")
|
|
->Attribute(AZ::Edit::Attributes::CategoryStyle, ".method")
|
|
->Attribute(ScriptCanvas::Attributes::Node::TitlePaletteOverride, "TestingNodeTitlePalette")
|
|
->DataElement(AZ::Edit::UIHandlers::Default, &BehaviorContextObjectTest::m_string, "String", "")
|
|
;
|
|
}
|
|
}
|
|
|
|
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
|
{
|
|
behaviorContext->Class<BehaviorContextObjectTest>()
|
|
->Attribute(AZ::Script::Attributes::Category, "Tests/Behavior Context")
|
|
->Method("SetString", &BehaviorContextObjectTest::SetString)
|
|
->Method("GetString", &BehaviorContextObjectTest::GetString)
|
|
->Property("Name", BehaviorValueProperty(&BehaviorContextObjectTest::m_name))
|
|
->Constant("Always24", BehaviorConstant(24))
|
|
;
|
|
}
|
|
}
|
|
|
|
BehaviorContextObjectTest()
|
|
{
|
|
}
|
|
|
|
virtual ~BehaviorContextObjectTest() {}
|
|
|
|
void SetString(AZStd::string string)
|
|
{
|
|
m_string = string;
|
|
}
|
|
|
|
AZStd::string GetString() const
|
|
{
|
|
return m_string;
|
|
}
|
|
|
|
private:
|
|
AZStd::string m_name;
|
|
AZStd::string m_string;
|
|
|
|
};
|
|
}
|