CR feedback

Signed-off-by: rhhong <rhhong@amazon.com>
monroegm-disable-blank-issue-2
rhhong 4 years ago
parent 82bfbd5c98
commit 09f9e5c6c3

@ -40,7 +40,6 @@
namespace EMStudio
{
static constexpr float DepthNear = 0.01f;
static constexpr const char* const s_actorComponentTypeId = "{BDC97E7F-A054-448B-A26F-EA2B5D78E377}";
AnimViewportRenderer::AnimViewportRenderer(AZStd::shared_ptr<AZ::RPI::WindowContext> windowContext)
: m_windowContext(windowContext)
@ -229,7 +228,7 @@ namespace EMStudio
void AnimViewportRenderer::ReinitActorEntities()
{
// 1. Destroy all the entities that does not point to any actorAsset anymore.
// 1. Destroy all the entities that do not point to any actorAsset anymore.
AZStd::set<AZ::Data::AssetId> assetLookup;
AzFramework::EntityContext* entityContext = m_entityContext.get();
const size_t numActors = EMotionFX::GetActorManager().GetNumActors();
@ -285,7 +284,7 @@ namespace EMStudio
AZ::Entity* AnimViewportRenderer::CreateActorEntity(AZ::Data::Asset<EMotionFX::Integration::ActorAsset> actorAsset)
{
AZ::Entity* actorEntity = m_entityContext->CreateEntity(actorAsset->GetActor()->GetName());
actorEntity->CreateComponent(s_actorComponentTypeId);
actorEntity->CreateComponent(azrtti_typeid<EMotionFX::Integration::ActorComponent>());
actorEntity->CreateComponent(AZ::Render::MaterialComponentTypeId);
actorEntity->CreateComponent(azrtti_typeid<AzFramework::TransformComponent>());
actorEntity->Activate();

@ -51,11 +51,11 @@ namespace EMStudio
private:
// This function reset the light, camera and other environment settings.
// This function resets the light, camera and other environment settings.
void ResetEnvironment();
// This function create in-editor entities for all the actor asset stored in the actor manager,
// and delete all the actor entities that no longer has an actor asset in the actor manager.
// This function creates in-editor entities for all actor assets stored in the actor manager,
// and deletes all the actor entities that no longer has an actor asset in the actor manager.
// Those entities are used in atom render viewport to visualize actors in animation editor.
void ReinitActorEntities();

@ -19,7 +19,7 @@ namespace EMStudio
{
public:
AnimViewportWidget(QWidget* parent = nullptr);
AnimViewportRenderer* GetAnimViewportRenderer() { return m_renderer.get();}
AnimViewportRenderer* GetAnimViewportRenderer() { return m_renderer.get(); }
private:
AZStd::unique_ptr<AnimViewportRenderer> m_renderer;

@ -89,7 +89,9 @@ namespace EMStudio
// Register command callbacks.
m_createActorInstanceCallback = new CreateActorInstanceCallback(false);
m_removeActorInstanceCallback = new RemoveActorInstanceCallback(false);
EMStudioManager::GetInstance()->GetCommandManager()->RegisterCommandCallback("CreateActorInstance", m_createActorInstanceCallback);
EMStudioManager::GetInstance()->GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", m_removeActorInstanceCallback);
return true;
}
@ -121,4 +123,15 @@ namespace EMStudio
return ReinitAtomRenderPlugin();
}
bool AtomRenderPlugin::RemoveActorInstanceCallback::Execute(
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
{
return ReinitAtomRenderPlugin();
}
bool AtomRenderPlugin::RemoveActorInstanceCallback::Undo(
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
{
return ReinitAtomRenderPlugin();
}
}

@ -50,7 +50,9 @@ namespace EMStudio
private:
MCORE_DEFINECOMMANDCALLBACK(CreateActorInstanceCallback);
MCORE_DEFINECOMMANDCALLBACK(RemoveActorInstanceCallback);
CreateActorInstanceCallback* m_createActorInstanceCallback;
RemoveActorInstanceCallback* m_removeActorInstanceCallback;
QWidget* m_innerWidget;
AnimViewportWidget* m_animViewportWidget;

Loading…
Cancel
Save