Registering an empty atom render plugin in the emfxatom gem.
Signed-off-by: rhhong <rhhong@amazon.com>
This commit is contained in:
@@ -54,11 +54,18 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Source
|
||||
Tools
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzCore
|
||||
Gem::EMotionFX_Atom.Static
|
||||
Gem::EMotionFX.Editor.Static
|
||||
Gem::AtomToolsFramework.Static
|
||||
Gem::AtomToolsFramework.Editor
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::EMotionFX.Editor
|
||||
COMPILE_DEFINITIONS
|
||||
PUBLIC
|
||||
EMOTIONFXATOM_EDITOR
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Module/Module.h>
|
||||
#ifdef EMOTIONFXATOM_EDITOR
|
||||
#include <Editor/EditorSystemComponent.h>
|
||||
#endif
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -28,7 +31,10 @@ namespace AZ
|
||||
: Module()
|
||||
{
|
||||
m_descriptors.insert(m_descriptors.end(), {
|
||||
ActorSystemComponent::CreateDescriptor()
|
||||
ActorSystemComponent::CreateDescriptor(),
|
||||
#ifdef EMOTIONFXATOM_EDITOR
|
||||
EMotionFXAtom::EditorSystemComponent::CreateDescriptor(),
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,6 +45,9 @@ namespace AZ
|
||||
{
|
||||
return ComponentTypeList{
|
||||
azrtti_typeid<ActorSystemComponent>(),
|
||||
#ifdef EMOTIONFXATOM_EDITOR
|
||||
azrtti_typeid<EMotionFXAtom::EditorSystemComponent>(),
|
||||
#endif
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Editor/EditorSystemComponent.h>
|
||||
#include <EMStudio/AtomRenderPlugin.h>
|
||||
|
||||
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace EMotionFXAtom
|
||||
{
|
||||
void EditorSystemComponent::Reflect(ReflectContext* 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());
|
||||
}
|
||||
}
|
||||
} // namespace AZ
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <Integration/AnimationBus.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace EMotionFXAtom
|
||||
{
|
||||
class EditorSystemComponent
|
||||
: public Component
|
||||
, private EMotionFX::Integration::SystemNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(EditorSystemComponent, "{1FAEC046-255D-4664-8F12-D16503C34431}");
|
||||
|
||||
static void Reflect(ReflectContext* context);
|
||||
|
||||
protected:
|
||||
// AZ::Component
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
|
||||
// SystemNotificationBus::OnRegisterPlugin
|
||||
void OnRegisterPlugin() override;
|
||||
};
|
||||
} // namespace EMotionFXAtom
|
||||
} // namespace AZ
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <EMotionStudio/Plugins/RenderPlugins/Source/AtomRender/AnimViewportWidget.h>
|
||||
#include <EMStudio/AnimViewportWidget.h>
|
||||
|
||||
namespace EMStudio
|
||||
{
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <EMotionStudio/Plugins/RenderPlugins/Source/AtomRender/AtomRenderPlugin.h>
|
||||
#include <EMStudio/AtomRenderPlugin.h>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
namespace EMStudio
|
||||
+2
-2
@@ -9,8 +9,8 @@
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.h>
|
||||
#include <EMotionStudio/Plugins/RenderPlugins/Source/AtomRender/AnimViewportWidget.h>
|
||||
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.h>
|
||||
#include <EMStudio/AnimViewportWidget.h>
|
||||
#include <QWidget>
|
||||
#endif
|
||||
|
||||
@@ -8,4 +8,10 @@
|
||||
|
||||
set(FILES
|
||||
Source/ActorModule.cpp
|
||||
Source/Editor/EditorSystemComponent.h
|
||||
Source/Editor/EditorSystemComponent.cpp
|
||||
Tools/EMStudio/AtomRenderPlugin.h
|
||||
Tools/EMStudio/AtomRenderPlugin.cpp
|
||||
Tools/EMStudio/AnimViewportWidget.h
|
||||
Tools/EMStudio/AnimViewportWidget.cpp
|
||||
)
|
||||
|
||||
+11
-33
@@ -46,15 +46,10 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
namespace EMStudio
|
||||
{
|
||||
//--------------------------------------------------------------------------
|
||||
// globals
|
||||
//--------------------------------------------------------------------------
|
||||
EMStudioManager* gEMStudioMgr = nullptr;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// class EMStudioManager
|
||||
//--------------------------------------------------------------------------
|
||||
AZ_CLASS_ALLOCATOR_IMPL(EMStudioManager, AZ::SystemAllocator, 0)
|
||||
|
||||
// constructor
|
||||
EMStudioManager::EMStudioManager(QApplication* app, [[maybe_unused]] int& argc, [[maybe_unused]] char* argv[])
|
||||
@@ -105,6 +100,8 @@ namespace EMStudio
|
||||
|
||||
// log some information
|
||||
LogInfo();
|
||||
|
||||
AZ::Interface<EMStudioManager>::Register(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +127,8 @@ namespace EMStudio
|
||||
delete m_commandManager;
|
||||
|
||||
AZ::AllocatorInstance<UIAllocator>::Destroy();
|
||||
|
||||
AZ::Interface<EMStudioManager>::Unregister(this);
|
||||
}
|
||||
|
||||
MainWindow* EMStudioManager::GetMainWindow()
|
||||
@@ -422,6 +421,12 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
|
||||
EMStudioManager* EMStudioManager::GetInstance()
|
||||
{
|
||||
return AZ::Interface<EMStudioManager>().Get();
|
||||
}
|
||||
|
||||
|
||||
// function to add a gizmo to the manager
|
||||
MCommon::TransformationManipulator* EMStudioManager::AddTransformationManipulator(MCommon::TransformationManipulator* manipulator)
|
||||
{
|
||||
@@ -493,31 +498,4 @@ namespace EMStudio
|
||||
path.addText(textPos, font, text);
|
||||
painter.drawPath(path);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// class Initializer
|
||||
//--------------------------------------------------------------------------
|
||||
// initialize EMotion Studio
|
||||
bool Initializer::Init(QApplication* app, int& argc, char* argv[])
|
||||
{
|
||||
// do nothing if we already have initialized
|
||||
if (gEMStudioMgr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// create the new EMStudio object
|
||||
gEMStudioMgr = new EMStudioManager(app, argc, argv);
|
||||
|
||||
// return success
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// the shutdown function
|
||||
void Initializer::Shutdown()
|
||||
{
|
||||
delete gEMStudioMgr;
|
||||
gEMStudioMgr = nullptr;
|
||||
}
|
||||
} // namespace EMStudio
|
||||
|
||||
+42
-28
@@ -53,9 +53,10 @@ namespace EMStudio
|
||||
class EMSTUDIO_API EMStudioManager
|
||||
: private EMotionFX::SkeletonOutlinerNotificationBus::Handler
|
||||
{
|
||||
MCORE_MEMORYOBJECTCATEGORY(EMStudioManager, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_EMSTUDIOSDK)
|
||||
|
||||
public:
|
||||
AZ_RTTI(EMStudio::EMStudioManager, "{D45E95CF-0C7B-44F1-A9D4-99A1E12A5AB5}")
|
||||
AZ_CLASS_ALLOCATOR_DECL
|
||||
|
||||
EMStudioManager(QApplication* app, int& argc, char* argv[]);
|
||||
~EMStudioManager();
|
||||
|
||||
@@ -72,6 +73,9 @@ namespace EMStudio
|
||||
AZStd::string GetRecoverFolder() const;
|
||||
AZStd::string GetAutosavesFolder() const;
|
||||
|
||||
// Singleton pattern
|
||||
static EMStudioManager* GetInstance();
|
||||
|
||||
// text rendering helper function
|
||||
static void RenderText(QPainter& painter, const QString& text, const QColor& textColor, const QFont& font, const QFontMetrics& fontMetrics, Qt::Alignment textAlignment, const QRect& rect);
|
||||
|
||||
@@ -153,31 +157,41 @@ namespace EMStudio
|
||||
EventProcessingCallback* m_eventProcessingCallback;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
class EMSTUDIO_API Initializer
|
||||
{
|
||||
public:
|
||||
static bool MCORE_CDECL Init(QApplication* app, int& argc, char* argv[]);
|
||||
static void MCORE_CDECL Shutdown();
|
||||
};
|
||||
|
||||
|
||||
// the global manager
|
||||
extern EMSTUDIO_API EMStudioManager* gEMStudioMgr;
|
||||
|
||||
// shortcuts
|
||||
MCORE_INLINE QApplication* GetApp() { return gEMStudioMgr->GetApp(); }
|
||||
MCORE_INLINE EMStudioManager* GetManager() { return gEMStudioMgr; }
|
||||
MCORE_INLINE bool HasMainWindow() { return gEMStudioMgr->HasMainWindow(); }
|
||||
MCORE_INLINE MainWindow* GetMainWindow() { return gEMStudioMgr->GetMainWindow(); }
|
||||
MCORE_INLINE PluginManager* GetPluginManager() { return gEMStudioMgr->GetPluginManager(); }
|
||||
MCORE_INLINE LayoutManager* GetLayoutManager() { return gEMStudioMgr->GetLayoutManager(); }
|
||||
MCORE_INLINE NotificationWindowManager* GetNotificationWindowManager() { return gEMStudioMgr->GetNotificationWindowManager(); }
|
||||
MCORE_INLINE MotionEventPresetManager* GetEventPresetManager() { return gEMStudioMgr->GetEventPresetManger(); }
|
||||
MCORE_INLINE CommandSystem::CommandManager* GetCommandManager() { return gEMStudioMgr->GetCommandManager(); }
|
||||
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();
|
||||
}
|
||||
} // namespace EMStudio
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <EMotionStudio/EMStudioSDK/Source/EMStudioConfig.h>
|
||||
#include <EMotionStudio/EMStudioSDK/Source/GUIOptions.h>
|
||||
#include <EMotionStudio/EMStudioSDK/Source/PluginOptionsBus.h>
|
||||
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioConfig.h>
|
||||
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/GUIOptions.h>
|
||||
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginOptionsBus.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <MCore/Source/Command.h>
|
||||
#include <MCore/Source/StandardHeaders.h>
|
||||
|
||||
-4
@@ -11,8 +11,4 @@ set(FILES
|
||||
Source/OpenGLRender/GLWidget.cpp
|
||||
Source/OpenGLRender/OpenGLRenderPlugin.h
|
||||
Source/OpenGLRender/OpenGLRenderPlugin.cpp
|
||||
Source/AtomRender/AtomRenderPlugin.h
|
||||
Source/AtomRender/AtomRenderPlugin.cpp
|
||||
Source/AtomRender/AnimViewportWidget.h
|
||||
Source/AtomRender/AnimViewportWidget.cpp
|
||||
)
|
||||
|
||||
@@ -46,6 +46,9 @@ namespace EMotionFX
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
// Use this bus to register custom EMotionFX plugin.
|
||||
virtual void OnRegisterPlugin() = 0;
|
||||
};
|
||||
using SystemNotificationBus = AZ::EBus<SystemNotifications>;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <EMotionFX/Source/PoseData.h>
|
||||
#include <EMotionFX/Source/PoseDataRagdoll.h>
|
||||
|
||||
#include <Integration/AnimationBus.h>
|
||||
#include <Integration/EMotionFXBus.h>
|
||||
#include <Integration/Assets/ActorAsset.h>
|
||||
#include <Integration/Assets/MotionAsset.h>
|
||||
@@ -70,7 +71,6 @@
|
||||
# include <AzToolsFramework/API/ViewPaneOptions.h>
|
||||
# include <AzCore/std/string/wildcard.h>
|
||||
# include <QApplication>
|
||||
# include <EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
|
||||
# include <EMotionStudio/EMStudioSDK/Source/MainWindow.h>
|
||||
# include <EMotionStudio/EMStudioSDK/Source/PluginManager.h>
|
||||
// EMStudio plugins
|
||||
@@ -88,7 +88,6 @@
|
||||
# include <EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.h>
|
||||
# include <EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.h>
|
||||
# include <EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.h>
|
||||
# include <EMotionStudio/Plugins/RenderPlugins/Source/AtomRender/AtomRenderPlugin.h>
|
||||
# include <Editor/Plugins/HitDetection/HitDetectionJointInspectorPlugin.h>
|
||||
# include <Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.h>
|
||||
# include <Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.h>
|
||||
@@ -530,7 +529,7 @@ namespace EMotionFX
|
||||
|
||||
if (EMStudio::GetManager())
|
||||
{
|
||||
EMStudio::Initializer::Shutdown();
|
||||
m_emstudioManager.reset();
|
||||
MysticQt::Initializer::Shutdown();
|
||||
}
|
||||
|
||||
@@ -795,12 +794,13 @@ namespace EMotionFX
|
||||
pluginManager->RegisterPlugin(new EMStudio::NodeGroupsPlugin());
|
||||
pluginManager->RegisterPlugin(new EMStudio::AnimGraphPlugin());
|
||||
pluginManager->RegisterPlugin(new EMStudio::OpenGLRenderPlugin());
|
||||
pluginManager->RegisterPlugin(new EMStudio::AtomRenderPlugin());
|
||||
pluginManager->RegisterPlugin(new EMotionFX::HitDetectionJointInspectorPlugin());
|
||||
pluginManager->RegisterPlugin(new EMotionFX::SkeletonOutlinerPlugin());
|
||||
pluginManager->RegisterPlugin(new EMotionFX::RagdollNodeInspectorPlugin());
|
||||
pluginManager->RegisterPlugin(new EMotionFX::ClothJointInspectorPlugin());
|
||||
pluginManager->RegisterPlugin(new EMotionFX::SimulatedObjectWidget());
|
||||
|
||||
SystemNotificationBus::Broadcast(&SystemNotificationBus::Events::OnRegisterPlugin);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -816,7 +816,7 @@ namespace EMotionFX
|
||||
char** argv = nullptr;
|
||||
|
||||
MysticQt::Initializer::Init("", editorAssetsPath.c_str());
|
||||
EMStudio::Initializer::Init(qApp, argc, argv);
|
||||
m_emstudioManager = AZStd::make_unique<EMStudio::EMStudioManager>(qApp, argc, argv);
|
||||
|
||||
InitializeEMStudioPlugins();
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
# include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
# include <AzToolsFramework/API/EditorAnimationSystemRequestBus.h>
|
||||
# include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
# include <EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
|
||||
#endif // EMOTIONFXANIMATION_EDITOR
|
||||
|
||||
namespace AZ
|
||||
@@ -126,6 +127,10 @@ namespace EMotionFX
|
||||
AZStd::vector<AZStd::unique_ptr<AZ::Data::AssetHandler> > m_assetHandlers;
|
||||
AZStd::unique_ptr<EMotionFXEventHandler> m_eventHandler;
|
||||
AZStd::unique_ptr<RenderBackendManager> m_renderBackendManager;
|
||||
|
||||
#if defined(EMOTIONFXANIMATION_EDITOR)
|
||||
AZStd::unique_ptr<EMStudio::EMStudioManager> m_emstudioManager;
|
||||
#endif // EMOTIONFXANIMATION_EDITOR
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user