CR feedback - code cleaning

Signed-off-by: rhhong <rhhong@amazon.com>
This commit is contained in:
rhhong
2021-08-31 12:23:05 -07:00
parent af9448d4ea
commit c4a3162c85
6 changed files with 145 additions and 121 deletions
@@ -11,32 +11,29 @@
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
namespace AZ
namespace AZ::EMotionFXAtom
{
namespace EMotionFXAtom
void EditorSystemComponent::Reflect(ReflectContext* context)
{
void EditorSystemComponent::Reflect(ReflectContext* context)
if (SerializeContext* serialize = azrtti_cast<SerializeContext*>(context))
{
if (SerializeContext* serialize = azrtti_cast<SerializeContext*>(context))
{
serialize->Class<EditorSystemComponent, Component>()->Version(0);
}
}
void EditorSystemComponent::Activate()
{
EMotionFX::Integration::SystemNotificationBus::Handler::BusConnect();
}
void EditorSystemComponent::Deactivate()
{
EMotionFX::Integration::SystemNotificationBus::Handler::BusDisconnect();
}
void EditorSystemComponent::OnRegisterPlugin()
{
EMStudio::PluginManager* pluginManager = EMStudio::EMStudioManager::GetInstance()->GetPluginManager();
pluginManager->RegisterPlugin(new EMStudio::AtomRenderPlugin());
serialize->Class<EditorSystemComponent, Component>()->Version(0);
}
}
} // namespace AZ
void EditorSystemComponent::Activate()
{
EMotionFX::Integration::SystemNotificationBus::Handler::BusConnect();
}
void EditorSystemComponent::Deactivate()
{
EMotionFX::Integration::SystemNotificationBus::Handler::BusDisconnect();
}
void EditorSystemComponent::OnRegisterPlugin()
{
EMStudio::PluginManager* pluginManager = EMStudio::EMStudioManager::GetInstance()->GetPluginManager();
pluginManager->RegisterPlugin(new EMStudio::AtomRenderPlugin());
}
} // namespace AZ::EMotionFXAtom
@@ -10,26 +10,23 @@
#include <AzCore/Component/Component.h>
#include <Integration/AnimationBus.h>
namespace AZ
namespace AZ::EMotionFXAtom
{
namespace EMotionFXAtom
class EditorSystemComponent
: public Component
, private EMotionFX::Integration::SystemNotificationBus::Handler
{
class EditorSystemComponent
: public Component
, private EMotionFX::Integration::SystemNotificationBus::Handler
{
public:
AZ_COMPONENT(EditorSystemComponent, "{1FAEC046-255D-4664-8F12-D16503C34431}");
public:
AZ_COMPONENT(EditorSystemComponent, "{1FAEC046-255D-4664-8F12-D16503C34431}");
static void Reflect(ReflectContext* context);
static void Reflect(ReflectContext* context);
protected:
// AZ::Component
void Activate() override;
void Deactivate() override;
protected:
// AZ::Component
void Activate() override;
void Deactivate() override;
// SystemNotificationBus::OnRegisterPlugin
void OnRegisterPlugin() override;
};
} // namespace EMotionFXAtom
} // namespace AZ
// SystemNotificationBus::OnRegisterPlugin
void OnRegisterPlugin() override;
};
} // namespace AZ::EMotionFXAtom
@@ -21,6 +21,51 @@ namespace EMStudio
}
const char* AtomRenderPlugin::GetName() const
{
return "Atom Render Window";
}
uint32 AtomRenderPlugin::GetClassID() const
{
return static_cast<uint32>(AtomRenderPlugin::CLASS_ID);
}
const char* AtomRenderPlugin::GetCreatorName() const
{
return "O3DE";
}
float AtomRenderPlugin::GetVersion() const
{
return 1.0f;
}
bool AtomRenderPlugin::GetIsClosable() const
{
return true;
}
bool AtomRenderPlugin::GetIsFloatable() const
{
return true;
}
bool AtomRenderPlugin::GetIsVertical() const
{
return false;
}
EMStudioPlugin* AtomRenderPlugin::Clone()
{
return new AtomRenderPlugin();
}
EMStudioPlugin::EPluginType AtomRenderPlugin::GetPluginType() const
{
return EMStudioPlugin::PLUGINTYPE_RENDERING;
}
bool AtomRenderPlugin::Init()
{
m_innerWidget = new QWidget();
@@ -28,48 +28,16 @@ namespace EMStudio
~AtomRenderPlugin();
// Plugin information
const char* GetCompileDate() const override
{
return MCORE_DATE;
}
const char* GetName() const override
{
return "Atom Render Window";
}
uint32 GetClassID() const override
{
return static_cast<uint32>(AtomRenderPlugin::CLASS_ID);
}
const char* GetCreatorName() const override
{
return "O3DE";
}
float GetVersion() const override
{
return 1.0f;
}
bool GetIsClosable() const override
{
return true;
}
bool GetIsFloatable() const override
{
return true;
}
bool GetIsVertical() const override
{
return false;
}
const char* GetName() const override;
uint32 GetClassID() const override;
const char* GetCreatorName() const override;
float GetVersion() const override;
bool GetIsClosable() const override;
bool GetIsFloatable() const override;
bool GetIsVertical() const override;
bool Init() override;
EMStudioPlugin* Clone()
{
return new AtomRenderPlugin();
}
EMStudioPlugin::EPluginType GetPluginType() const override
{
return EMStudioPlugin::PLUGINTYPE_RENDERING;
}
EMStudioPlugin* Clone();
EMStudioPlugin::EPluginType GetPluginType() const override;
private:
QWidget* m_innerWidget;
@@ -104,7 +104,6 @@ namespace EMStudio
AZ::Interface<EMStudioManager>::Register(this);
}
// destructor
EMStudioManager::~EMStudioManager()
{
@@ -498,4 +497,49 @@ namespace EMStudio
path.addText(textPos, font, text);
painter.drawPath(path);
}
// shortcuts
QApplication* GetApp()
{
return EMStudioManager::GetInstance()->GetApp();
}
EMStudioManager* GetManager()
{
return EMStudioManager::GetInstance();
}
bool HasMainWindow()
{
return EMStudioManager::GetInstance()->HasMainWindow();
}
MainWindow* GetMainWindow()
{
return EMStudioManager::GetInstance()->GetMainWindow();
}
PluginManager* GetPluginManager()
{
return EMStudioManager::GetInstance()->GetPluginManager();
}
LayoutManager* GetLayoutManager()
{
return EMStudioManager::GetInstance()->GetLayoutManager();
}
NotificationWindowManager* GetNotificationWindowManager()
{
return EMStudioManager::GetInstance()->GetNotificationWindowManager();
}
MotionEventPresetManager* GetEventPresetManager()
{
return EMStudioManager::GetInstance()->GetEventPresetManger();
}
CommandSystem::CommandManager* GetCommandManager()
{
return EMStudioManager::GetInstance()->GetCommandManager();
}
} // namespace EMStudio
@@ -157,41 +157,14 @@ namespace EMStudio
EventProcessingCallback* m_eventProcessingCallback;
};
// shortcuts
MCORE_INLINE QApplication* GetApp()
{
return EMStudioManager::GetInstance()->GetApp();
}
MCORE_INLINE EMStudioManager* GetManager()
{
return EMStudioManager::GetInstance();
}
MCORE_INLINE bool HasMainWindow()
{
return EMStudioManager::GetInstance()->HasMainWindow();
}
MCORE_INLINE MainWindow* GetMainWindow()
{
return EMStudioManager::GetInstance()->GetMainWindow();
}
MCORE_INLINE PluginManager* GetPluginManager()
{
return EMStudioManager::GetInstance()->GetPluginManager();
}
MCORE_INLINE LayoutManager* GetLayoutManager()
{
return EMStudioManager::GetInstance()->GetLayoutManager();
}
MCORE_INLINE NotificationWindowManager* GetNotificationWindowManager()
{
return EMStudioManager::GetInstance()->GetNotificationWindowManager();
}
MCORE_INLINE MotionEventPresetManager* GetEventPresetManager()
{
return EMStudioManager::GetInstance()->GetEventPresetManger();
}
MCORE_INLINE CommandSystem::CommandManager* GetCommandManager()
{
return EMStudioManager::GetInstance()->GetCommandManager();
}
// Shortcuts
QApplication* GetApp();
EMStudioManager* GetManager();
bool HasMainWindow();
MainWindow* GetMainWindow();
PluginManager* GetPluginManager();
LayoutManager* GetLayoutManager();
NotificationWindowManager* GetNotificationWindowManager();
MotionEventPresetManager* GetEventPresetManager();
CommandSystem::CommandManager* GetCommandManager();
} // namespace EMStudio