Skip to content

Commit b479dea

Browse files
committed
fix reflections
Signed-off-by: Wojciech Czerski <[email protected]>
1 parent b4d0e2f commit b479dea

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

Gems/CsvSpawner/Code/Include/CsvSpawner/CsvSpawnerInterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace CsvSpawner
4141
* @param m_spawnInfo Struct holding information about entities to be spawned.
4242
* @param m_statusCode Status code indicating success, failure and warnings of the spawn.
4343
*/
44-
virtual void OnEntitiesSpawnFinished(CsvSpawnerUtils::SpawnInfo& m_spawnInfo, CsvSpawnerUtils::SpawnStatus& m_statusCode) = 0;
44+
virtual void OnEntitiesSpawnFinished(CsvSpawnerUtils::SpawnInfo& m_spawnInfo, CsvSpawnerUtils::SpawnStatus m_statusCode) = 0;
4545

4646
/// EBus Configuration - Allows multiple listeners to handle events.
4747
static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
@@ -67,7 +67,7 @@ namespace CsvSpawner
6767
Call(FN_OnEntitiesSpawnBegin, m_spawnInfo);
6868
}
6969

70-
void OnEntitiesSpawnFinished(CsvSpawnerUtils::SpawnInfo& m_spawnInfo, CsvSpawnerUtils::SpawnStatus& m_statusCode) override
70+
void OnEntitiesSpawnFinished(CsvSpawnerUtils::SpawnInfo& m_spawnInfo, CsvSpawnerUtils::SpawnStatus m_statusCode) override
7171
{
7272
Call(FN_OnEntitiesSpawnFinished, m_spawnInfo, m_statusCode);
7373
}

Gems/CsvSpawner/Code/Source/CsvSpawner/CsvSpawnerEditorComponent.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ namespace CsvSpawner
2727

2828
void CsvSpawnerEditorComponent::Reflect(AZ::ReflectContext* context)
2929
{
30+
CsvSpawner::SpawnInfo::Reflect(context);
31+
3032
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
3133
if (serializeContext)
3234
{

Gems/CsvSpawner/Code/Source/CsvSpawner/CsvSpawnerUtils.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,32 @@ namespace CsvSpawner::CsvSpawnerUtils
4040
->Field("Transform", &CsvSpawnableEntityInfo::m_transform)
4141
->Field("Name", &CsvSpawnableEntityInfo::m_name)
4242
->Field("Seed", &CsvSpawnableEntityInfo::m_seed);
43+
44+
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
45+
{
46+
editContext->Class<CsvSpawnableEntityInfo>("Csv Spawnable Entity Info", "An entity configuration for spawning")
47+
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
48+
->DataElement(AZ::Edit::UIHandlers::Default, &CsvSpawnableEntityInfo::m_id, "ID", "Optional ID for the entity")
49+
->DataElement(
50+
AZ::Edit::UIHandlers::Default, &CsvSpawnableEntityInfo::m_transform, "Transform", "Transform of the entity")
51+
->DataElement(
52+
AZ::Edit::UIHandlers::Default,
53+
&CsvSpawnableEntityInfo::m_name,
54+
"Name",
55+
"Name of the spawnable entity configuration")
56+
->DataElement(
57+
AZ::Edit::UIHandlers::Default, &CsvSpawnableEntityInfo::m_seed, "Seed", "Optional seed value for randomization");
58+
}
59+
}
60+
61+
if (auto* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
62+
{
63+
behaviorContext->Class<CsvSpawnableEntityInfo>("CsvSpawnableEntityInfo")
64+
->Constructor<>()
65+
->Property("Id", BehaviorValueProperty(&CsvSpawnableEntityInfo::m_id))
66+
->Property("Transform", BehaviorValueProperty(&CsvSpawnableEntityInfo::m_transform))
67+
->Property("Name", BehaviorValueProperty(&CsvSpawnableEntityInfo::m_name))
68+
->Property("Seed", BehaviorValueProperty(&CsvSpawnableEntityInfo::m_seed));
4369
}
4470
}
4571
void CsvSpawnableAssetConfiguration::Reflect(AZ::ReflectContext* context)
@@ -360,8 +386,15 @@ namespace CsvSpawner::CsvSpawnerUtils
360386

361387
if (auto* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
362388
{
389+
behaviorContext->EnumProperty<static_cast<int>(CsvSpawnerUtils::SpawnStatus::Success)>("SpawnStatus_Success");
390+
behaviorContext->EnumProperty<static_cast<int>(CsvSpawnerUtils::SpawnStatus::Fail)>("SpawnStatus_Fail");
391+
behaviorContext->EnumProperty<static_cast<int>(CsvSpawnerUtils::SpawnStatus::Stopped)>("SpawnStatus_Stopped");
392+
behaviorContext->EnumProperty<static_cast<int>(CsvSpawnerUtils::SpawnStatus::Warning)>("SpawnStatus_Warning");
393+
363394
behaviorContext->Class<SpawnInfo>("SpawnInfo")
364395
->Constructor()
396+
->Attribute(AZ::Script::Attributes::Category, "CsvSpawner")
397+
->Attribute(AZ::Script::Attributes::Module, "editor")
365398
->Property("m_entitiesToSpawn", BehaviorValueProperty(&SpawnInfo::m_entitiesToSpawn))
366399
->Property("m_physicsSceneName", BehaviorValueProperty(&SpawnInfo::m_physicsSceneName))
367400
->Property("m_spawnerParentEntityId", BehaviorValueProperty(&SpawnInfo::m_spawnerParentEntityId));

0 commit comments

Comments
 (0)