Change actorRenderFlag to use AZ ENUM CLASS instead of azstd::bitset (#7542)

* Fixes the problem with using actor render flags in actor component

Signed-off-by: rhhong <rhhong@amazon.com>

* In progress work for actor render flag rework

Signed-off-by: rhhong <rhhong@amazon.com>

* add an utlity function to check bit

Signed-off-by: rhhong <rhhong@amazon.com>

* code cleanup

Signed-off-by: rhhong <rhhong@amazon.com>

* More CR cleanup

Signed-off-by: rhhong <rhhong@amazon.com>

* build fix

Signed-off-by: rhhong <rhhong@amazon.com>

* CR feedback

Signed-off-by: rhhong <rhhong@amazon.com>
This commit is contained in:
Roman
2022-02-14 13:27:37 -08:00
committed by GitHub
parent 60d7533301
commit da421b7056
31 changed files with 217 additions and 168 deletions
@@ -570,7 +570,7 @@ namespace EMotionFX
drawData->Unlock();
}
void SimulatedObjectWidget::Render(EMotionFX::ActorRenderFlagBitset renderFlags)
void SimulatedObjectWidget::Render(EMotionFX::ActorRenderFlags renderFlags)
{
if (!m_actor || !m_actorInstance)
{
@@ -578,9 +578,8 @@ namespace EMotionFX
}
const AZ::Render::RenderActorSettings& settings = EMotionFX::GetRenderActorSettings();
const bool renderSimulatedJoints = renderFlags[RENDER_SIMULATEJOINTS];
const AZStd::unordered_set<size_t>& selectedJointIndices = EMStudio::GetManager()->GetSelectedJointIndices();
if (renderSimulatedJoints && !selectedJointIndices.empty())
if (AZ::RHI::CheckBitsAny(renderFlags, EMotionFX::ActorRenderFlags::SimulatedJoints) && !selectedJointIndices.empty())
{
// Render the joint radius.
const size_t actorInstanceCount = GetActorManager().GetNumActorInstances();
@@ -613,8 +612,7 @@ namespace EMotionFX
}
}
const bool renderColliders = renderFlags[RENDER_SIMULATEDOBJECT_COLLIDERS];
if (renderColliders)
if (AZ::RHI::CheckBitsAny(renderFlags, EMotionFX::ActorRenderFlags::SimulatedObjectColliders))
{
ColliderContainerWidget::RenderColliders(PhysicsSetup::SimulatedObjectCollider,
settings.m_simulatedObjectColliderColor, settings.m_selectedSimulatedObjectColliderColor);
@@ -61,7 +61,7 @@ namespace EMotionFX
void LegacyRender(EMStudio::RenderPlugin* renderPlugin, RenderInfo* renderInfo) override;
void LegacyRenderJointRadius(const SimulatedJoint* joint, ActorInstance* actorInstance, const AZ::Color& color);
void Render(EMotionFX::ActorRenderFlagBitset renderFlags) override;
void Render(EMotionFX::ActorRenderFlags renderFlags) override;
void RenderJointRadius(const SimulatedJoint* joint, ActorInstance* actorInstance, const AZ::Color& color);
SimulatedObjectModel* GetSimulatedObjectModel() const;