@@ -34,6 +34,6 @@ namespace AZ::EMotionFXAtom
|
|||||||
void EditorSystemComponent::OnRegisterPlugin()
|
void EditorSystemComponent::OnRegisterPlugin()
|
||||||
{
|
{
|
||||||
EMStudio::PluginManager* pluginManager = EMStudio::EMStudioManager::GetInstance()->GetPluginManager();
|
EMStudio::PluginManager* pluginManager = EMStudio::EMStudioManager::GetInstance()->GetPluginManager();
|
||||||
pluginManager->RegisterPlugin(new EMStudio::AtomRenderPlugin());
|
pluginManager->RegisterPlugin(aznew EMStudio::AtomRenderPlugin());
|
||||||
}
|
}
|
||||||
} // namespace AZ::EMotionFXAtom
|
} // namespace AZ::EMotionFXAtom
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace AZ::EMotionFXAtom
|
|||||||
static void Reflect(ReflectContext* context);
|
static void Reflect(ReflectContext* context);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// AZ::Component
|
// AZ::Component overrides
|
||||||
void Activate() override;
|
void Activate() override;
|
||||||
void Deactivate() override;
|
void Deactivate() override;
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ namespace EMStudio
|
|||||||
m_frameworkScene->SetSubsystem<AzFramework::EntityContext::SceneStorageType>(m_entityContext.get());
|
m_frameworkScene->SetSubsystem<AzFramework::EntityContext::SceneStorageType>(m_entityContext.get());
|
||||||
|
|
||||||
// Create and register a scene with all available feature processors
|
// 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;
|
AZ::RPI::SceneDescriptor sceneDesc;
|
||||||
m_scene = AZ::RPI::Scene::CreateScene(sceneDesc);
|
m_scene = AZ::RPI::Scene::CreateScene(sceneDesc);
|
||||||
m_scene->EnableAllFeatureProcessors();
|
m_scene->EnableAllFeatureProcessors();
|
||||||
|
|||||||
@@ -11,11 +11,14 @@
|
|||||||
|
|
||||||
#include <Integration/Components/ActorComponent.h>
|
#include <Integration/Components/ActorComponent.h>
|
||||||
#include <EMotionFX/CommandSystem/Source/CommandManager.h>
|
#include <EMotionFX/CommandSystem/Source/CommandManager.h>
|
||||||
|
#include <EMotionFX/Source/Allocators.h>
|
||||||
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
|
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
namespace EMStudio
|
namespace EMStudio
|
||||||
{
|
{
|
||||||
|
AZ_CLASS_ALLOCATOR_IMPL(AtomRenderPlugin, EMotionFX::EditorAllocator, 0);
|
||||||
|
|
||||||
AtomRenderPlugin::AtomRenderPlugin()
|
AtomRenderPlugin::AtomRenderPlugin()
|
||||||
: DockWidgetPlugin()
|
: DockWidgetPlugin()
|
||||||
{
|
{
|
||||||
@@ -74,6 +77,7 @@ namespace EMStudio
|
|||||||
void AtomRenderPlugin::ReinitRenderer()
|
void AtomRenderPlugin::ReinitRenderer()
|
||||||
{
|
{
|
||||||
m_animViewportWidget->GetAnimViewportRenderer()->Reinit();
|
m_animViewportWidget->GetAnimViewportRenderer()->Reinit();
|
||||||
|
m_animViewportWidget->ResetCameraPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtomRenderPlugin::Init()
|
bool AtomRenderPlugin::Init()
|
||||||
@@ -89,10 +93,10 @@ namespace EMStudio
|
|||||||
verticalLayout->addWidget(m_animViewportWidget);
|
verticalLayout->addWidget(m_animViewportWidget);
|
||||||
|
|
||||||
// Register command callbacks.
|
// Register command callbacks.
|
||||||
m_createActorInstanceCallback = new CreateActorInstanceCallback(false);
|
m_importActorCallback = new ImportActorCallback(false);
|
||||||
m_removeActorInstanceCallback = new RemoveActorInstanceCallback(false);
|
m_removeActorCallback = new RemoveActorCallback(false);
|
||||||
EMStudioManager::GetInstance()->GetCommandManager()->RegisterCommandCallback("CreateActorInstance", m_createActorInstanceCallback);
|
EMStudioManager::GetInstance()->GetCommandManager()->RegisterCommandCallback("ImportActor", m_importActorCallback);
|
||||||
EMStudioManager::GetInstance()->GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", m_removeActorInstanceCallback);
|
EMStudioManager::GetInstance()->GetCommandManager()->RegisterCommandCallback("RemoveActor", m_removeActorCallback);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -113,23 +117,23 @@ namespace EMStudio
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtomRenderPlugin::CreateActorInstanceCallback::Execute(
|
bool AtomRenderPlugin::ImportActorCallback::Execute(
|
||||||
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
|
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
|
||||||
{
|
{
|
||||||
return ReinitAtomRenderPlugin();
|
return ReinitAtomRenderPlugin();
|
||||||
}
|
}
|
||||||
bool AtomRenderPlugin::CreateActorInstanceCallback::Undo(
|
bool AtomRenderPlugin::ImportActorCallback::Undo(
|
||||||
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
|
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
|
||||||
{
|
{
|
||||||
return ReinitAtomRenderPlugin();
|
return ReinitAtomRenderPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtomRenderPlugin::RemoveActorInstanceCallback::Execute(
|
bool AtomRenderPlugin::RemoveActorCallback::Execute(
|
||||||
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
|
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
|
||||||
{
|
{
|
||||||
return ReinitAtomRenderPlugin();
|
return ReinitAtomRenderPlugin();
|
||||||
}
|
}
|
||||||
bool AtomRenderPlugin::RemoveActorInstanceCallback::Undo(
|
bool AtomRenderPlugin::RemoveActorCallback::Undo(
|
||||||
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
|
[[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine)
|
||||||
{
|
{
|
||||||
return ReinitAtomRenderPlugin();
|
return ReinitAtomRenderPlugin();
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ namespace EMStudio
|
|||||||
: public DockWidgetPlugin
|
: public DockWidgetPlugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
AZ_CLASS_ALLOCATOR_DECL
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CLASS_ID = 0x32b0c04d
|
CLASS_ID = 0x32b0c04d
|
||||||
@@ -49,10 +51,10 @@ namespace EMStudio
|
|||||||
void ReinitRenderer();
|
void ReinitRenderer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MCORE_DEFINECOMMANDCALLBACK(CreateActorInstanceCallback);
|
MCORE_DEFINECOMMANDCALLBACK(ImportActorCallback);
|
||||||
MCORE_DEFINECOMMANDCALLBACK(RemoveActorInstanceCallback);
|
MCORE_DEFINECOMMANDCALLBACK(RemoveActorCallback);
|
||||||
CreateActorInstanceCallback* m_createActorInstanceCallback;
|
ImportActorCallback* m_importActorCallback;
|
||||||
RemoveActorInstanceCallback* m_removeActorInstanceCallback;
|
RemoveActorCallback* m_removeActorCallback;
|
||||||
|
|
||||||
QWidget* m_innerWidget;
|
QWidget* m_innerWidget;
|
||||||
AnimViewportWidget* m_animViewportWidget;
|
AnimViewportWidget* m_animViewportWidget;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace EMotionFX
|
|||||||
SetScheduler(MultiThreadScheduler::Create());
|
SetScheduler(MultiThreadScheduler::Create());
|
||||||
|
|
||||||
// reserve memory
|
// reserve memory
|
||||||
m_actorAssets.reserve(32);
|
|
||||||
m_actorInstances.reserve(1024);
|
m_actorInstances.reserve(1024);
|
||||||
m_rootActorInstances.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];
|
return m_actorAssets[nr];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ namespace EMotionFX
|
|||||||
friend class EMotionFXManager;
|
friend class EMotionFXManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using ActorAssetData = AZ::Data::Asset<Integration::ActorAsset>;
|
|
||||||
static ActorManager* Create();
|
static ActorManager* Create();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
@@ -90,6 +90,7 @@ namespace EMStudio
|
|||||||
AZStd::unique_ptr<ActorInfo> m_actorInfo;
|
AZStd::unique_ptr<ActorInfo> m_actorInfo;
|
||||||
AZStd::unique_ptr<NodeInfo> m_nodeInfo;
|
AZStd::unique_ptr<NodeInfo> m_nodeInfo;
|
||||||
|
|
||||||
|
// Use this flag to defer the reinit function to main thread.
|
||||||
bool m_reinitRequested = false;
|
bool m_reinitRequested = false;
|
||||||
};
|
};
|
||||||
} // namespace EMStudio
|
} // namespace EMStudio
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ namespace EMotionFX
|
|||||||
|
|
||||||
// Use this to alter the actor asset.
|
// Use this to alter the actor asset.
|
||||||
virtual void SetActorAsset(AZ::Data::Asset<EMotionFX::Integration::ActorAsset> actorAsset) = 0;
|
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();
|
static const size_t s_invalidJointIndex = std::numeric_limits<size_t>::max();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ namespace EMotionFX
|
|||||||
const char* GetBrowserIcon() const override;
|
const char* GetBrowserIcon() const override;
|
||||||
};
|
};
|
||||||
} // namespace Integration
|
} // namespace Integration
|
||||||
|
|
||||||
|
using ActorAssetData = AZ::Data::Asset<Integration::ActorAsset>;
|
||||||
} // namespace EMotionFX
|
} // namespace EMotionFX
|
||||||
|
|
||||||
namespace AZ
|
namespace AZ
|
||||||
|
|||||||
Reference in New Issue
Block a user