Make atom render viewport the default for animation editor. (#7282)

* Make atom render viewport the default for animation editor.

Signed-off-by: rhhong <rhhong@amazon.com>

* Fixed the automated test problem caused by making atom vp the default

Signed-off-by: rhhong <rhhong@amazon.com>

* Fix another test failure

Signed-off-by: rhhong <rhhong@amazon.com>

* fix failed test

Signed-off-by: rhhong <rhhong@amazon.com>

* more fix to the automation test

Signed-off-by: rhhong <rhhong@amazon.com>

* we don't need to manuelly call init on the ragdoll plugin anymore

Signed-off-by: rhhong <rhhong@amazon.com>
monroegm-disable-blank-issue-2
Roman 4 years ago committed by GitHub
parent 5c2ce583cd
commit 5509764fc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -51,7 +51,7 @@ namespace EMStudio
const char* AtomRenderPlugin::GetName() const const char* AtomRenderPlugin::GetName() const
{ {
return "Atom Render Window (Preview)"; return "Atom Render Window";
} }
uint32 AtomRenderPlugin::GetClassID() const uint32 AtomRenderPlugin::GetClassID() const

@ -35,7 +35,7 @@ namespace EMStudio
// plugin information // plugin information
const char* GetCompileDate() const override { return MCORE_DATE; } const char* GetCompileDate() const override { return MCORE_DATE; }
const char* GetName() const override { return "OpenGL Render Window"; } const char* GetName() const override { return "OpenGL Render Window (Deprecated)"; }
uint32 GetClassID() const override { return static_cast<uint32>(RenderPlugin::CLASS_ID); } uint32 GetClassID() const override { return static_cast<uint32>(RenderPlugin::CLASS_ID); }
const char* GetCreatorName() const override { return "O3DE"; } const char* GetCreatorName() const override { return "O3DE"; }
float GetVersion() const override { return 1.0f; } float GetVersion() const override { return 1.0f; }

@ -0,0 +1,52 @@
/*
* 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 <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.h>
namespace EMStudio
{
// The Mock version of AtomRenderPlugin. It have the same name, class_id and type of the actual version.
// The actual implementation of the AtomRenderPlugin is defined outside of EMotionFX gem. This Mock version
// exists so we could load the default layouts without errors.
class MockAtomRenderPlugin
: public DockWidgetPlugin
{
enum
{
CLASS_ID = 0x32b0c04d
};
// Plugin information
const char* GetName() const override
{
return "Atom Render Window";
};
uint32 GetClassID() const override
{
return CLASS_ID;
};
bool Init() override
{
return true;
};
EMStudioPlugin* Clone()
{
return new MockAtomRenderPlugin();
};
EMStudioPlugin::EPluginType GetPluginType() const override
{
return EMStudioPlugin::PLUGINTYPE_RENDERING;
};
};
}

@ -40,11 +40,6 @@ namespace EMotionFX
UIFixture::SetUp(); UIFixture::SetUp();
AZ::SerializeContext* serializeContext = GetSerializeContext();
Physics::MockPhysicsSystem::Reflect(serializeContext); // Required by Ragdoll plugin to fake PhysX Gem is available
D6JointLimitConfiguration::Reflect(serializeContext);
EXPECT_CALL(m_jointHelpers, GetSupportedJointTypeIds) EXPECT_CALL(m_jointHelpers, GetSupportedJointTypeIds)
.WillRepeatedly(testing::Return(AZStd::vector<AZ::TypeId>{ azrtti_typeid<D6JointLimitConfiguration>() })); .WillRepeatedly(testing::Return(AZStd::vector<AZ::TypeId>{ azrtti_typeid<D6JointLimitConfiguration>() }));
@ -68,7 +63,9 @@ namespace EMotionFX
{ return AZStd::make_unique<D6JointLimitConfiguration>(); }); { return AZStd::make_unique<D6JointLimitConfiguration>(); });
} }
private: protected:
virtual bool ShouldReflectPhysicSystem() override { return true; }
Physics::MockPhysicsSystem m_physicsSystem; Physics::MockPhysicsSystem m_physicsSystem;
Physics::MockPhysicsInterface m_physicsInterface; Physics::MockPhysicsInterface m_physicsInterface;
Physics::MockJointHelpersInterface m_jointHelpers; Physics::MockJointHelpersInterface m_jointHelpers;
@ -116,7 +113,6 @@ namespace EMotionFX
auto* ragdollPlugin = EMStudio::GetPluginManager()->FindActivePlugin<RagdollNodeInspectorPlugin>(); auto* ragdollPlugin = EMStudio::GetPluginManager()->FindActivePlugin<RagdollNodeInspectorPlugin>();
ASSERT_TRUE(ragdollPlugin) << "Ragdoll plugin not found."; ASSERT_TRUE(ragdollPlugin) << "Ragdoll plugin not found.";
ragdollPlugin->Init();
auto* skeletonOutlinerPlugin = EMStudio::GetPluginManager()->FindActivePlugin<SkeletonOutlinerPlugin>(); auto* skeletonOutlinerPlugin = EMStudio::GetPluginManager()->FindActivePlugin<SkeletonOutlinerPlugin>();
ASSERT_TRUE(skeletonOutlinerPlugin) << "Skeleton outliner plugin not found."; ASSERT_TRUE(skeletonOutlinerPlugin) << "Skeleton outliner plugin not found.";

@ -31,6 +31,8 @@ namespace EMotionFX
{ {
class CopyPasteRagdollJointLimitsFixture : public UIFixture class CopyPasteRagdollJointLimitsFixture : public UIFixture
{ {
protected:
virtual bool ShouldReflectPhysicSystem() override { return true; }
}; };
#if AZ_TRAIT_DISABLE_FAILED_EMOTION_FX_EDITOR_TESTS #if AZ_TRAIT_DISABLE_FAILED_EMOTION_FX_EDITOR_TESTS
@ -41,16 +43,10 @@ namespace EMotionFX
{ {
using testing::_; using testing::_;
AZ::SerializeContext* serializeContext = GetSerializeContext();
Physics::MockPhysicsSystem::Reflect(serializeContext); // Required by Ragdoll plugin to fake PhysX Gem is available
D6JointLimitConfiguration::Reflect(serializeContext);
EMStudio::GetMainWindow()->ApplicationModeChanged("Physics"); EMStudio::GetMainWindow()->ApplicationModeChanged("Physics");
auto ragdollPlugin = static_cast<EMotionFX::RagdollNodeInspectorPlugin*>(EMStudio::GetPluginManager()->FindActivePlugin(EMotionFX::RagdollNodeInspectorPlugin::CLASS_ID)); auto ragdollPlugin = static_cast<EMotionFX::RagdollNodeInspectorPlugin*>(EMStudio::GetPluginManager()->FindActivePlugin(EMotionFX::RagdollNodeInspectorPlugin::CLASS_ID));
ASSERT_TRUE(ragdollPlugin) << "Ragdoll plugin not found."; ASSERT_TRUE(ragdollPlugin) << "Ragdoll plugin not found.";
ragdollPlugin->Init();
Physics::MockPhysicsSystem physicsSystem; Physics::MockPhysicsSystem physicsSystem;
Physics::MockPhysicsInterface physicsInterface; Physics::MockPhysicsInterface physicsInterface;

@ -34,19 +34,8 @@ namespace EMotionFX
class CanAddToSimulatedObjectFixture class CanAddToSimulatedObjectFixture
: public UIFixture : public UIFixture
{ {
public: protected:
void SetUp() override virtual bool ShouldReflectPhysicSystem() override { return true; }
{
SetupQtAndFixtureBase();
AZ::SerializeContext* serializeContext = nullptr;
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
Physics::MockPhysicsSystem::Reflect(serializeContext); // Required by Ragdoll plugin to fake PhysX Gem is available
D6JointLimitConfiguration::Reflect(serializeContext);
SetupPluginWindows();
}
}; };
TEST_F(CanAddToSimulatedObjectFixture, CanAddExistingJointsAndUnaddedChildren) TEST_F(CanAddToSimulatedObjectFixture, CanAddExistingJointsAndUnaddedChildren)

@ -49,18 +49,6 @@ namespace EMotionFX
class ClothColliderTestsFixture : public UIFixture class ClothColliderTestsFixture : public UIFixture
{ {
public: public:
void SetUp() override
{
SetupQtAndFixtureBase();
AZ::SerializeContext* serializeContext = nullptr;
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
SystemComponent::Reflect(serializeContext);
SetupPluginWindows();
}
void TearDown() override void TearDown() override
{ {
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
@ -86,6 +74,19 @@ namespace EMotionFX
} }
protected: protected:
bool ShouldReflectPhysicSystem() override { return true; }
void ReflectMockedSystems() override
{
UIFixture::ReflectMockedSystems();
// Reflect the mocked version of the cloth system.
AZ::SerializeContext* serializeContext = nullptr;
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
SystemComponent::Reflect(serializeContext);
}
QModelIndexList m_indexList; QModelIndexList m_indexList;
ReselectingTreeView* m_treeView; ReselectingTreeView* m_treeView;
EMotionFX::SkeletonOutlinerPlugin* m_skeletonOutliner; EMotionFX::SkeletonOutlinerPlugin* m_skeletonOutliner;

@ -31,18 +31,12 @@ namespace EMotionFX
{ {
class RagdollEditTestsFixture : public UIFixture class RagdollEditTestsFixture : public UIFixture
{ {
public: public:
void SetUp() override void SetUp() override
{ {
using ::testing::_; UIFixture::SetUp();
SetupQtAndFixtureBase();
AZ::SerializeContext* serializeContext = nullptr;
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
Physics::MockPhysicsSystem::Reflect(serializeContext); // Required by Ragdoll plugin to fake PhysX Gem is available using ::testing::_;
D6JointLimitConfiguration::Reflect(serializeContext);
EXPECT_CALL(m_jointHelpers, GetSupportedJointTypeIds) EXPECT_CALL(m_jointHelpers, GetSupportedJointTypeIds)
.WillRepeatedly(testing::Return(AZStd::vector<AZ::TypeId>{ azrtti_typeid<D6JointLimitConfiguration>() })); .WillRepeatedly(testing::Return(AZStd::vector<AZ::TypeId>{ azrtti_typeid<D6JointLimitConfiguration>() }));
@ -67,7 +61,6 @@ namespace EMotionFX
return AZStd::make_unique<D6JointLimitConfiguration>(); return AZStd::make_unique<D6JointLimitConfiguration>();
}); });
SetupPluginWindows();
} }
void TearDown() override void TearDown() override
@ -95,6 +88,8 @@ namespace EMotionFX
} }
protected: protected:
virtual bool ShouldReflectPhysicSystem() override { return true; }
QModelIndexList m_indexList; QModelIndexList m_indexList;
ReselectingTreeView* m_treeView; ReselectingTreeView* m_treeView;
EMotionFX::SkeletonOutlinerPlugin* m_skeletonOutliner; EMotionFX::SkeletonOutlinerPlugin* m_skeletonOutliner;

@ -8,6 +8,9 @@
#include <Tests/UI/UIFixture.h> #include <Tests/UI/UIFixture.h>
#include <Tests/UI/ModalPopupHandler.h> #include <Tests/UI/ModalPopupHandler.h>
#include <Tests/Mocks/AtomRenderPlugin.h>
#include <Tests/Mocks/PhysicsSystem.h>
#include <Tests/D6JointLimitConfiguration.h>
#include <Integration/System/SystemCommon.h> #include <Integration/System/SystemCommon.h>
#include <EMotionStudio/EMStudioSDK/Source/EMStudioManager.h> #include <EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
@ -69,6 +72,7 @@ namespace EMotionFX
// Set ignore visibilty so that the visibility check can be ignored in plugins // Set ignore visibilty so that the visibility check can be ignored in plugins
EMStudio::GetManager()->SetIgnoreVisibility(true); EMStudio::GetManager()->SetIgnoreVisibility(true);
} }
void UIFixture::SetupPluginWindows() void UIFixture::SetupPluginWindows()
{ {
// Plugins have to be created after both the QApplication object and // Plugins have to be created after both the QApplication object and
@ -81,11 +85,30 @@ namespace EMotionFX
} }
} }
void UIFixture::ReflectMockedSystems()
{
if (ShouldReflectPhysicSystem())
{
AZ::SerializeContext* serializeContext = GetSerializeContext();
Physics::MockPhysicsSystem::Reflect(serializeContext); // Required by Ragdoll plugin to fake PhysX Gem is available
D6JointLimitConfiguration::Reflect(serializeContext);
}
}
void UIFixture::OnRegisterPlugin()
{
EMStudio::PluginManager* pluginManager = EMStudio::EMStudioManager::GetInstance()->GetPluginManager();
pluginManager->RegisterPlugin(new EMStudio::MockAtomRenderPlugin());
}
void UIFixture::SetUp() void UIFixture::SetUp()
{ {
Integration::SystemNotificationBus::Handler::BusConnect();
using namespace testing; using namespace testing;
SetupQtAndFixtureBase(); SetupQtAndFixtureBase();
ReflectMockedSystems();
SetupPluginWindows(); SetupPluginWindows();
m_animGraphPlugin = static_cast<EMStudio::AnimGraphPlugin*>(EMStudio::GetPluginManager()->FindActivePlugin(EMStudio::AnimGraphPlugin::CLASS_ID)); m_animGraphPlugin = static_cast<EMStudio::AnimGraphPlugin*>(EMStudio::GetPluginManager()->FindActivePlugin(EMStudio::AnimGraphPlugin::CLASS_ID));
@ -97,6 +120,7 @@ namespace EMotionFX
void UIFixture::TearDown() void UIFixture::TearDown()
{ {
m_assetSystemRequestMock.BusDisconnect(); m_assetSystemRequestMock.BusDisconnect();
Integration::SystemNotificationBus::Handler::BusDisconnect();
CloseAllNotificationWindows(); CloseAllNotificationWindows();
DeselectAllAnimGraphNodes(); DeselectAllAnimGraphNodes();

@ -19,6 +19,7 @@
#include <EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.h> #include <EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.h>
#include <EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.h> #include <EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.h>
#include <Integration/AnimationBus.h>
#include <QString> #include <QString>
#include <QToolBar> #include <QToolBar>
@ -68,6 +69,7 @@ namespace EMotionFX
class UIFixture class UIFixture
: public MakeQtApplicationBase : public MakeQtApplicationBase
, public UIFixtureBase , public UIFixtureBase
, private Integration::SystemNotificationBus::Handler
{ {
public: public:
void SetUp() override; void SetUp() override;
@ -108,6 +110,10 @@ namespace EMotionFX
SimulatedObjectColliderWidget* GetSimulatedObjectColliderWidget() const; SimulatedObjectColliderWidget* GetSimulatedObjectColliderWidget() const;
protected: protected:
virtual bool ShouldReflectPhysicSystem() { return false; }
virtual void ReflectMockedSystems();
void OnRegisterPlugin();
void SetupQtAndFixtureBase(); void SetupQtAndFixtureBase();
void SetupPluginWindows(); void SetupPluginWindows();

@ -99,5 +99,6 @@ set(FILES
Tests/EMotionFXBuilderFixture.cpp Tests/EMotionFXBuilderFixture.cpp
Tests/TestAssetCode/TestActorAssets.h Tests/TestAssetCode/TestActorAssets.h
Tests/TestAssetCode/TestActorAssets.cpp Tests/TestAssetCode/TestActorAssets.cpp
Tests/Mocks/AtomRenderPlugin.h
Tests/Mocks/PhysicsSystem.h Tests/Mocks/PhysicsSystem.h
) )

Loading…
Cancel
Save