CR feedback

Signed-off-by: rhhong <rhhong@amazon.com>
This commit is contained in:
rhhong
2021-10-06 22:28:18 -07:00
parent 8897040315
commit 5fca7ffd86
10 changed files with 24 additions and 19 deletions
@@ -34,6 +34,6 @@ namespace AZ::EMotionFXAtom
void EditorSystemComponent::OnRegisterPlugin()
{
EMStudio::PluginManager* pluginManager = EMStudio::EMStudioManager::GetInstance()->GetPluginManager();
pluginManager->RegisterPlugin(new EMStudio::AtomRenderPlugin());
pluginManager->RegisterPlugin(aznew EMStudio::AtomRenderPlugin());
}
} // namespace AZ::EMotionFXAtom
@@ -22,7 +22,7 @@ namespace AZ::EMotionFXAtom
static void Reflect(ReflectContext* context);
protected:
// AZ::Component
// AZ::Component overrides
void Activate() override;
void Deactivate() override;
@@ -59,7 +59,6 @@ namespace EMStudio
m_frameworkScene->SetSubsystem<AzFramework::EntityContext::SceneStorageType>(m_entityContext.get());
// Create and register a scene with all available feature processors
// TODO: We don't need every procesors, only register the processor we are going to use.
AZ::RPI::SceneDescriptor sceneDesc;
m_scene = AZ::RPI::Scene::CreateScene(sceneDesc);
m_scene->EnableAllFeatureProcessors();
@@ -11,11 +11,14 @@
#include <Integration/Components/ActorComponent.h>
#include <EMotionFX/CommandSystem/Source/CommandManager.h>
#include <EMotionFX/Source/Allocators.h>
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
#include <QHBoxLayout>
namespace EMStudio
{
AZ_CLASS_ALLOCATOR_IMPL(AtomRenderPlugin, EMotionFX::EditorAllocator, 0);
AtomRenderPlugin::AtomRenderPlugin()
: DockWidgetPlugin()
{
@@ -74,6 +77,7 @@ namespace EMStudio
void AtomRenderPlugin::ReinitRenderer()
{
m_animViewportWidget->GetAnimViewportRenderer()->Reinit();
m_animViewportWidget->ResetCameraPosition();
}
bool AtomRenderPlugin::Init()
@@ -89,10 +93,10 @@ namespace EMStudio
verticalLayout->addWidget(m_animViewportWidget);
// 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);
m_importActorCallback = new ImportActorCallback(false);
m_removeActorCallback = new RemoveActorCallback(false);
EMStudioManager::GetInstance()->GetCommandManager()->RegisterCommandCallback("ImportActor", m_importActorCallback);
EMStudioManager::GetInstance()->GetCommandManager()->RegisterCommandCallback("RemoveActor", m_removeActorCallback);
return true;
}
@@ -113,23 +117,23 @@ namespace EMStudio
return true;
}
bool AtomRenderPlugin::CreateActorInstanceCallback::Execute(
bool AtomRenderPlugin::ImportActorCallback::Execute(
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
{
return ReinitAtomRenderPlugin();
}
bool AtomRenderPlugin::CreateActorInstanceCallback::Undo(
bool AtomRenderPlugin::ImportActorCallback::Undo(
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
{
return ReinitAtomRenderPlugin();
}
bool AtomRenderPlugin::RemoveActorInstanceCallback::Execute(
bool AtomRenderPlugin::RemoveActorCallback::Execute(
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
{
return ReinitAtomRenderPlugin();
}
bool AtomRenderPlugin::RemoveActorInstanceCallback::Undo(
bool AtomRenderPlugin::RemoveActorCallback::Undo(
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
{
return ReinitAtomRenderPlugin();
@@ -27,6 +27,8 @@ namespace EMStudio
: public DockWidgetPlugin
{
public:
AZ_CLASS_ALLOCATOR_DECL
enum
{
CLASS_ID = 0x32b0c04d
@@ -49,10 +51,10 @@ namespace EMStudio
void ReinitRenderer();
private:
MCORE_DEFINECOMMANDCALLBACK(CreateActorInstanceCallback);
MCORE_DEFINECOMMANDCALLBACK(RemoveActorInstanceCallback);
CreateActorInstanceCallback* m_createActorInstanceCallback;
RemoveActorInstanceCallback* m_removeActorInstanceCallback;
MCORE_DEFINECOMMANDCALLBACK(ImportActorCallback);
MCORE_DEFINECOMMANDCALLBACK(RemoveActorCallback);
ImportActorCallback* m_importActorCallback;
RemoveActorCallback* m_removeActorCallback;
QWidget* m_innerWidget;
AnimViewportWidget* m_animViewportWidget;
@@ -31,7 +31,6 @@ namespace EMotionFX
SetScheduler(MultiThreadScheduler::Create());
// reserve memory
m_actorAssets.reserve(32);
m_actorInstances.reserve(1024);
m_rootActorInstances.reserve(1024);
}
@@ -429,7 +428,7 @@ namespace EMotionFX
}
ActorManager::ActorAssetData ActorManager::GetActorAsset(size_t nr) const
ActorAssetData ActorManager::GetActorAsset(size_t nr) const
{
return m_actorAssets[nr];
}
@@ -42,7 +42,6 @@ namespace EMotionFX
friend class EMotionFXManager;
public:
using ActorAssetData = AZ::Data::Asset<Integration::ActorAsset>;
static ActorManager* Create();
/**
@@ -90,6 +90,7 @@ namespace EMStudio
AZStd::unique_ptr<ActorInfo> m_actorInfo;
AZStd::unique_ptr<NodeInfo> m_nodeInfo;
// Use this flag to defer the reinit function to main thread.
bool m_reinitRequested = false;
};
} // namespace EMStudio
@@ -98,7 +98,6 @@ namespace EMotionFX
// Use this to alter the actor asset.
virtual void SetActorAsset(AZ::Data::Asset<EMotionFX::Integration::ActorAsset> actorAsset) = 0;
// virtual AZ::Data::Asset<const EMotionFX::Integration::ActorAsset> GetAsset() const = 0;
static const size_t s_invalidJointIndex = std::numeric_limits<size_t>::max();
};
@@ -80,6 +80,8 @@ namespace EMotionFX
const char* GetBrowserIcon() const override;
};
} // namespace Integration
using ActorAssetData = AZ::Data::Asset<Integration::ActorAsset>;
} // namespace EMotionFX
namespace AZ