Merge branch 'main' into LYN-1099

This commit is contained in:
jjjoness
2021-04-23 09:55:17 +01:00
613 changed files with 3851 additions and 4639 deletions
+21 -3
View File
@@ -327,7 +327,16 @@ struct IMovieCallback
*/
struct IAnimTrack
{
AZ_RTTI(IAnimTrack, "{AA0D5170-FB28-426F-BA13-7EFF6BB3AC67}")
AZ_RTTI(IAnimTrack, "{AA0D5170-FB28-426F-BA13-7EFF6BB3AC67}");
AZ_CLASS_ALLOCATOR(IAnimTrack, AZ::SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimTrack>();
}
}
//! Flags that can be set on animation track.
enum EAnimTrackFlags
@@ -594,7 +603,16 @@ struct IAnimNodeOwner
struct IAnimNode
{
public:
AZ_RTTI(IAnimNode, "{0A096354-7F26-4B18-B8C0-8F10A3E0440A}")
AZ_RTTI(IAnimNode, "{0A096354-7F26-4B18-B8C0-8F10A3E0440A}");
AZ_CLASS_ALLOCATOR(IAnimNode, AZ::SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimNode>();
}
}
//////////////////////////////////////////////////////////////////////////
// Supported params.
@@ -922,7 +940,7 @@ struct IAnimSequence
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext != nullptr)
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimSequence>();
}
+1
View File
@@ -4094,6 +4094,7 @@ void CSystem::CreateSystemVars()
"0 = Suppress Asserts\n"
"1 = Log Asserts\n"
"2 = Show Assert Dialog\n"
"3 = Crashes the Application on Assert\n"
"Note: when set to '0 = Suppress Asserts', assert expressions are still evaluated. To turn asserts into a no-op, undefine AZ_ENABLE_TRACING and recompile.",
OnAssertLevelCvarChanged);
CSystem::SetAssertLevel(defaultAssertValue);
@@ -63,13 +63,13 @@ namespace AZ
static AssetTrackingImpl* GetSharedInstance();
static ThreadData& GetSharedThreadData();
using MasterAssets = AZStd::unordered_map<AssetTrackingId, AssetMasterInfo, AZStd::hash<AssetTrackingId>, AZStd::equal_to<AssetTrackingId>, AZStdAssetTrackingAllocator>;
using PrimaryAssets = AZStd::unordered_map<AssetTrackingId, AssetPrimaryInfo, AZStd::hash<AssetTrackingId>, AZStd::equal_to<AssetTrackingId>, AZStdAssetTrackingAllocator>;
using ThreadData = ThreadData;
using mutex_type = AZStd::mutex;
using lock_type = AZStd::lock_guard<mutex_type>;
mutex_type m_mutex;
MasterAssets m_masterAssets;
PrimaryAssets m_primaryAssets;
AssetTreeNodeBase* m_assetRoot = nullptr;
AssetAllocationTableBase* m_allocationTable = nullptr;
bool m_performingAnalysis = false;
@@ -118,7 +118,7 @@ namespace AZ
auto& threadData = GetSharedThreadData();
AssetTreeNodeBase* parentAsset = threadData.m_currentAssetStack.empty() ? nullptr : threadData.m_currentAssetStack.back();
AssetTreeNodeBase* childAsset;
AssetMasterInfo* assetMasterInfo;
AssetPrimaryInfo* assetPrimaryInfo;
if (!parentAsset)
{
@@ -128,22 +128,22 @@ namespace AZ
{
lock_type lock(m_mutex);
// Locate or create the master record for this asset
auto masterItr = m_masterAssets.find(assetId);
// Locate or create the primary record for this asset
auto primaryItr = m_primaryAssets.find(assetId);
if (masterItr != m_masterAssets.end())
if (primaryItr != m_primaryAssets.end())
{
assetMasterInfo = &masterItr->second;
assetPrimaryInfo = &primaryItr->second;
}
else
{
auto insertResult = m_masterAssets.emplace(assetId, AssetMasterInfo());
assetMasterInfo = &insertResult.first->second;
assetMasterInfo->m_id = &insertResult.first->first;
auto insertResult = m_primaryAssets.emplace(assetId, AssetPrimaryInfo());
assetPrimaryInfo = &insertResult.first->second;
assetPrimaryInfo->m_id = &insertResult.first->first;
}
// Add this asset to the stack for this thread's context
childAsset = parentAsset->FindOrAddChild(assetId, assetMasterInfo);
childAsset = parentAsset->FindOrAddChild(assetId, assetPrimaryInfo);
}
threadData.m_currentAssetStack.push_back(childAsset);
@@ -304,7 +304,7 @@ namespace AZ
char* pos = buffer;
for (auto itr = assetStack.rbegin(); itr != assetStack.rend(); ++itr)
{
pos += azsnprintf(pos, BUFFER_SIZE - (pos - buffer), "%s\n", (*itr)->GetAssetMasterInfo()->m_id->m_id.c_str());
pos += azsnprintf(pos, BUFFER_SIZE - (pos - buffer), "%s\n", (*itr)->GetAssetPrimaryInfo()->m_id->m_id.c_str());
if (pos >= buffer + BUFFER_SIZE)
{
@@ -79,9 +79,9 @@ namespace AZ
AssetTrackingString m_id;
};
// Master information about an asset.
// Primary information about an asset.
// Currently just contains the ID of the asset, but in the future may carry additional information about that asset (such as where in code it was initialized).
struct AssetMasterInfo
struct AssetPrimaryInfo
{
const AssetTrackingId* m_id;
};
@@ -90,8 +90,8 @@ namespace AZ
class AssetTreeNodeBase
{
public:
virtual const AssetMasterInfo* GetAssetMasterInfo() const = 0;
virtual AssetTreeNodeBase* FindOrAddChild(const AssetTrackingId& id, const AssetMasterInfo* info) = 0;
virtual const AssetPrimaryInfo* GetAssetPrimaryInfo() const = 0;
virtual AssetTreeNodeBase* FindOrAddChild(const AssetTrackingId& id, const AssetPrimaryInfo* info) = 0;
};
// Base class for an asset tree. Implemented by the template AssetTree<>.
@@ -29,18 +29,18 @@ namespace AZ
class AssetTreeNode : public AssetTreeNodeBase
{
public:
AssetTreeNode(const AssetMasterInfo* masterInfo = nullptr, AssetTreeNode* parent = nullptr) :
m_masterInfo(masterInfo),
AssetTreeNode(const AssetPrimaryInfo* primaryInfo = nullptr, AssetTreeNode* parent = nullptr) :
m_primaryinfo(primaryInfo),
m_parent(parent)
{
}
const AssetMasterInfo* GetAssetMasterInfo() const override
const AssetPrimaryInfo* GetAssetPrimaryInfo() const override
{
return m_masterInfo;
return m_primaryinfo;
}
AssetTreeNodeBase* FindOrAddChild(const AssetTrackingId& id, const AssetMasterInfo* info) override
AssetTreeNodeBase* FindOrAddChild(const AssetTrackingId& id, const AssetPrimaryInfo* info) override
{
AssetTreeNodeBase* result = nullptr;
auto childItr = m_children.find(id);
@@ -61,7 +61,7 @@ namespace AZ
using AssetMap = AssetTrackingMap<AssetTrackingId, AssetTreeNode>;
const AssetMasterInfo* m_masterInfo;
const AssetPrimaryInfo* m_primaryinfo;
AssetTreeNode* m_parent;
AssetMap m_children;
AssetDataT m_data;
+9 -2
View File
@@ -70,6 +70,7 @@ namespace AZ
static const char* logVerbosityUID = "sys_LogLevel";
static const int assertLevel_log = 1;
static const int assertLevel_nativeUI = 2;
static const int assertLevel_crash = 3;
static const int logLevel_errorWarning = 1;
static const int logLevel_full = 2;
static AZ::EnvironmentVariable<AZStd::unordered_set<size_t>> g_ignoredAsserts;
@@ -289,8 +290,8 @@ namespace AZ
}
#if AZ_ENABLE_TRACE_ASSERTS
//display native UI dialogs at verbosity level 2 or higher
if (currentLevel >= assertLevel_nativeUI)
//display native UI dialogs at verbosity level 2
if (currentLevel == assertLevel_nativeUI)
{
AZ::NativeUI::AssertAction buttonResult;
EBUS_EVENT_RESULT(buttonResult, AZ::NativeUI::NativeUIRequestBus, DisplayAssertDialog, dialogBoxText);
@@ -314,7 +315,13 @@ namespace AZ
break;
}
}
else
#endif //AZ_ENABLE_TRACE_ASSERTS
// Crash the application directly at assert level 3
if (currentLevel >= assertLevel_crash)
{
AZ_Crash();
}
}
g_alreadyHandlingAssertOrFatal = false;
}
+29 -2
View File
@@ -146,8 +146,8 @@ namespace AZ
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Method("GetTranslated", &Aabb::GetTranslated)
->Method("GetSurfaceArea", &Aabb::GetSurfaceArea)
->Method("GetTransformedObb", &Aabb::GetTransformedObb)
->Method("GetTransformedAabb", &Aabb::GetTransformedAabb)
->Method("GetTransformedObb", static_cast<Obb(Aabb::*)(const Transform&) const>(&Aabb::GetTransformedObb))
->Method("GetTransformedAabb", static_cast<Aabb(Aabb::*)(const Transform&) const>(&Aabb::GetTransformedAabb))
->Method("ApplyTransform", &Aabb::ApplyTransform)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Method("Clone", [](const Aabb& rhs) -> Aabb { return rhs; })
@@ -195,6 +195,20 @@ namespace AZ
}
Obb Aabb::GetTransformedObb(const Matrix3x4& matrix3x4) const
{
Matrix3x4 matrixNoScale = matrix3x4;
const AZ::Vector3 scale = matrixNoScale.ExtractScale();
const AZ::Quaternion rotation = AZ::Quaternion::CreateFromMatrix3x4(matrixNoScale);
return Obb::CreateFromPositionRotationAndHalfLengths(
matrix3x4 * GetCenter(),
rotation,
0.5f * scale * GetExtents()
);
}
void Aabb::ApplyTransform(const Transform& transform)
{
Vector3 a, b, axisCoeffs;
@@ -224,4 +238,17 @@ namespace AZ
m_min = newMin;
m_max = newMax;
}
void Aabb::ApplyMatrix3x4(const Matrix3x4& matrix3x4)
{
const AZ::Vector3 extents = GetExtents();
const AZ::Vector3 center = matrix3x4 * GetCenter();
AZ::Vector3 newHalfExtents(
0.5f * matrix3x4.GetRowAsVector3(0).GetAbs().Dot(extents),
0.5f * matrix3x4.GetRowAsVector3(1).GetAbs().Dot(extents),
0.5f * matrix3x4.GetRowAsVector3(2).GetAbs().Dot(extents));
m_min = center - newHalfExtents;
m_max = center + newHalfExtents;
}
}
+12 -2
View File
@@ -129,11 +129,21 @@ namespace AZ
void ApplyTransform(const Transform& transform);
void ApplyMatrix3x4(const Matrix3x4& matrix3x4);
void MultiplyByScale(const Vector3& scale);
//! Transforms an Aabb and returns the resulting Obb.
class Obb GetTransformedObb(const Transform& transform) const;
[[nodiscard]] Obb GetTransformedObb(const Transform& transform) const;
//! Transforms an Aabb and returns the resulting Obb.
[[nodiscard]] Obb GetTransformedObb(const Matrix3x4& matrix3x4) const;
//! Returns a new AABB containing the transformed AABB.
Aabb GetTransformedAabb(const Transform& transform) const;
[[nodiscard]] Aabb GetTransformedAabb(const Transform& transform) const;
//! Returns a new AABB containing the transformed AABB.
[[nodiscard]] Aabb GetTransformedAabb(const Matrix3x4& matrix3x4) const;
//! Checks if this aabb is equal to another within a floating point tolerance.
bool IsClose(const Aabb& rhs, float tolerance = Constants::Tolerance) const;
@@ -292,6 +292,14 @@ namespace AZ
}
AZ_MATH_INLINE void Aabb::MultiplyByScale(const Vector3& scale)
{
m_min *= scale;
m_max *= scale;
AZ_MATH_ASSERT(IsValid(), "Min must be less than Max");
}
AZ_MATH_INLINE Aabb Aabb::GetTransformedAabb(const Transform& transform) const
{
Aabb aabb = Aabb::CreateFromMinMax(m_min, m_max);
@@ -300,6 +308,14 @@ namespace AZ
}
AZ_MATH_INLINE Aabb Aabb::GetTransformedAabb(const Matrix3x4& matrix3x4) const
{
Aabb aabb = Aabb::CreateFromMinMax(m_min, m_max);
aabb.ApplyMatrix3x4(matrix3x4);
return aabb;
}
AZ_MATH_INLINE bool Aabb::IsClose(const Aabb& rhs, float tolerance) const
{
return m_min.IsClose(rhs.m_min, tolerance) && m_max.IsClose(rhs.m_max, tolerance);
@@ -105,7 +105,7 @@ namespace UnitTest
EXPECT_EQ(&rootAsset, &m_env->m_tree.GetRoot());
ASSERT_NE(itr, rootAsset.m_children.end());
EXPECT_EQ(itr->second.m_masterInfo->m_id->m_id, "TestScopedAllocation.1");
EXPECT_EQ(itr->second.m_primaryinfo->m_id->m_id, "TestScopedAllocation.1");
EXPECT_EQ(&itr->second, m_env->m_table.FindAllocation(TEST_POINTER));
@@ -15,6 +15,7 @@
#include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <AZTestShared/Math/MathTestHelpers.h>
using namespace AZ;
@@ -385,4 +386,77 @@ namespace UnitTest
EXPECT_TRUE(aabb.GetMin().IsClose(transAabb.GetMin()));
EXPECT_TRUE(aabb.GetMax().IsClose(transAabb.GetMax()));
}
TEST(MATH_AabbTransform, GetTransformedObbMatrix3x4)
{
Vector3 min(-1.0f, -2.0f, -3.0f);
Vector3 max(4.0f, 3.0f, 2.0f);
Aabb aabb = Aabb::CreateFromMinMax(min, max);
Quaternion rotation(0.46f, 0.26f, 0.58f, 0.62f);
Vector3 translation(5.0f, 7.0f, 9.0f);
Matrix3x4 matrix3x4 = Matrix3x4::CreateFromQuaternionAndTranslation(rotation, translation);
matrix3x4.MultiplyByScale(Vector3(0.5f, 1.5f, 2.0f));
Obb obb = aabb.GetTransformedObb(matrix3x4);
EXPECT_THAT(obb.GetRotation(), IsClose(rotation));
EXPECT_THAT(obb.GetHalfLengths(), IsClose(Vector3(1.25f, 3.75f, 5.0f)));
EXPECT_THAT(obb.GetPosition(), IsClose(Vector3(3.928f, 7.9156f, 9.3708f)));
}
TEST(MATH_AabbTransform, GetTransformedAabbMatrix3x4)
{
Vector3 min(2.0f, 3.0f, 5.0f);
Vector3 max(6.0f, 5.0f, 11.0f);
Aabb aabb = Aabb::CreateFromMinMax(min, max);
Quaternion rotation(0.34f, 0.46f, 0.58f, 0.58f);
Vector3 translation(-3.0f, -4.0f, -5.0f);
Matrix3x4 matrix3x4 = Matrix3x4::CreateFromQuaternionAndTranslation(rotation, translation);
matrix3x4.MultiplyByScale(Vector3(1.2f, 0.8f, 2.0f));
Aabb transformedAabb = aabb.GetTransformedAabb(matrix3x4);
EXPECT_THAT(transformedAabb.GetMin(), IsClose(Vector3(4.1488f, -0.01216f, -0.31904f)));
EXPECT_THAT(transformedAabb.GetMax(), IsClose(Vector3(16.3216f, 6.54272f, 5.98112f)));
}
TEST(MATH_AabbTransform, GetTransformedObbFitsInsideTransformedAabb)
{
Vector3 min(4.0f, 3.0f, 1.0f);
Vector3 max(7.0f, 6.0f, 8.0f);
Aabb aabb = Aabb::CreateFromMinMax(min, max);
Quaternion rotation(0.40f, 0.40f, 0.64f, 0.52f);
Vector3 translation(-2.0f, 4.0f, -3.0f);
Matrix3x4 matrix3x4 = Matrix3x4::CreateFromQuaternionAndTranslation(rotation, translation);
matrix3x4.MultiplyByScale(Vector3(2.2f, 0.6f, 1.4f));
Aabb transformedAabb = aabb.GetTransformedAabb(matrix3x4);
Obb transformedObb = aabb.GetTransformedObb(matrix3x4);
Aabb aabbContainingTransformedObb = Aabb::CreateFromObb(transformedObb);
EXPECT_THAT(transformedAabb.GetMin(), IsClose(aabbContainingTransformedObb.GetMin()));
EXPECT_THAT(transformedAabb.GetMax(), IsClose(aabbContainingTransformedObb.GetMax()));
}
TEST(MATH_AabbTransform, MultiplyByScale)
{
Vector3 min(2.0f, 6.0f, 8.0f);
Vector3 max(6.0f, 9.0f, 10.0f);
Aabb aabb = Aabb::CreateFromMinMax(min, max);
Vector3 scale(0.5f, 2.0f, 1.5f);
aabb.MultiplyByScale(scale);
EXPECT_THAT(aabb.GetMin(), IsClose(Vector3(1.0f, 12.0f, 12.0f)));
EXPECT_THAT(aabb.GetMax(), IsClose(Vector3(3.0f, 18.0f, 15.0f)));
}
}
@@ -29,6 +29,20 @@ namespace AzFramework::AssetSystem::Platform
bool LaunchAssetProcessor(AZStd::string_view executableDirectory, AZStd::string_view engineRoot,
AZStd::string_view projectPath)
{
AZ::IO::FixedMaxPath assetProcessorPath{ executableDirectory };
assetProcessorPath /= "AssetProcessor";
if (!AZ::IO::SystemFile::Exists(assetProcessorPath.c_str()))
{
// Check for existence of one under a "bin" directory, i.e. engineRoot is an SDK structure.
assetProcessorPath = AZ::IO::FixedMaxPath{engineRoot} / "bin" / AZ_BUILD_CONFIGURATION_TYPE / "AssetProcessor";
if (!AZ::IO::SystemFile::Exists(assetProcessorPath.c_str()))
{
return false;
}
}
pid_t firstChildPid = fork();
if (firstChildPid == 0)
{
@@ -47,9 +61,6 @@ namespace AzFramework::AssetSystem::Platform
pid_t secondChildPid = fork();
if (secondChildPid == 0)
{
AZ::IO::FixedMaxPath assetProcessorPath{ executableDirectory };
assetProcessorPath /= "AssetProcessor";
AZStd::array args {
assetProcessorPath.c_str(), assetProcessorPath.c_str(), "--start-hidden",
static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), static_cast<const char*>(nullptr)
@@ -11,6 +11,7 @@
*/
#include <AzCore/IO/Path/Path.h>
#include <AzCore/IO/SystemFile.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <sys/types.h>
@@ -20,6 +21,7 @@ namespace AzFramework::AssetSystem::Platform
{
void AllowAssetProcessorToForeground()
{}
bool LaunchAssetProcessor(AZStd::string_view executableDirectory, AZStd::string_view engineRoot,
AZStd::string_view projectPath)
{
@@ -29,6 +31,17 @@ namespace AzFramework::AssetSystem::Platform
assetProcessorPath /= "../../../AssetProcessor.app";
assetProcessorPath = assetProcessorPath.LexicallyNormal();
if (!AZ::IO::SystemFile::Exists(assetProcessorPath.c_str()))
{
// Check for existence of one under a "bin" directory, i.e. engineRoot is an SDK structure.
assetProcessorPath = AZ::IO::FixedMaxPath{engineRoot} / "bin" / AZ_BUILD_CONFIGURATION_TYPE / "AssetProcessor.app";
if (!AZ::IO::SystemFile::Exists(assetProcessorPath.c_str()))
{
return false;
}
}
auto fullLaunchCommand = AZ::IO::FixedMaxPathString::format(R"(open -g "%s" --args --start-hidden)", assetProcessorPath.c_str());
// Add the engine path to the launch command if not empty
if (!engineRoot.empty())
@@ -12,6 +12,7 @@
#include <AzCore/PlatformIncl.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/IO/SystemFile.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <Psapi.h>
@@ -67,6 +68,17 @@ namespace AzFramework::AssetSystem::Platform
AZ::IO::FixedMaxPath assetProcessorPath{ executableDirectory };
assetProcessorPath /= "AssetProcessor.exe";
if (!AZ::IO::SystemFile::Exists(assetProcessorPath.c_str()))
{
// Check for existence of one under a "bin" directory, i.e. engineRoot is an SDK structure.
assetProcessorPath = AZ::IO::FixedMaxPath{engineRoot} / "bin" / AZ_BUILD_CONFIGURATION_TYPE / "AssetProcessor.exe";
if (!AZ::IO::SystemFile::Exists(assetProcessorPath.c_str()))
{
return false;
}
}
auto fullLaunchCommand = AZ::IO::FixedMaxPathString::format(R"("%s" --start-hidden)", assetProcessorPath.c_str());
// Add the engine path to the launch command if not empty
@@ -279,7 +279,7 @@ namespace AzToolsFramework
AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder)
{
AZStd::unique_ptr<Prefab::Instance> createdPrefabInstance =
m_prefabSystemComponent->CreatePrefab(entities, AZStd::move(nestedPrefabInstances), filePath);
m_prefabSystemComponent->CreatePrefab(entities, AZStd::move(nestedPrefabInstances), filePath, nullptr, false);
if (createdPrefabInstance)
{
@@ -321,7 +321,6 @@ namespace AzToolsFramework
removedNestedInstance = AZStd::move(nestedInstanceIterator->second);
removedNestedInstance->m_parent = nullptr;
removedNestedInstance->m_alias = InstanceAlias();
m_nestedInstances.erase(instanceAlias);
}
@@ -396,6 +395,14 @@ namespace AzToolsFramework
}
}
void Instance::GetNestedInstances(const AZStd::function<void(AZStd::unique_ptr<Instance>&)>& callback)
{
for (auto& [instanceAlias, instance] : m_nestedInstances)
{
callback(instance);
}
}
void Instance::GetEntities(const AZStd::function<bool(AZStd::unique_ptr<AZ::Entity>&)>& callback)
{
for (auto& [entityAlias, entity] : m_entities)
@@ -114,6 +114,7 @@ namespace AzToolsFramework
void GetConstEntities(const AZStd::function<bool(const AZ::Entity&)>& callback);
void GetNestedEntities(const AZStd::function<bool(AZStd::unique_ptr<AZ::Entity>&)>& callback);
void GetEntities(const AZStd::function<bool(AZStd::unique_ptr<AZ::Entity>&)>& callback);
void GetNestedInstances(const AZStd::function<void(AZStd::unique_ptr<Instance>&)>& callback);
/**
* Gets the alias for a given EnitityId in the Instance DOM.
@@ -101,6 +101,10 @@ namespace AzToolsFramework
nestedInstance->GetInstanceAlias(), nestedInstance->GetLinkId(), undoBatch.GetUndoBatch());
}
PrefabUndoHelpers::UpdatePrefabInstance(
commonRootEntityOwningInstance->get(), "Update prefab instance", commonRootInstanceDomBeforeCreate,
undoBatch.GetUndoBatch());
auto prefabEditorEntityOwnershipInterface = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
if (!prefabEditorEntityOwnershipInterface)
{
@@ -118,13 +122,21 @@ namespace AzToolsFramework
"(A null instance is returned)."));
}
PrefabUndoHelpers::UpdatePrefabInstance(
commonRootEntityOwningInstance->get(), "Update prefab instance", commonRootInstanceDomBeforeCreate, undoBatch.GetUndoBatch());
AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId();
instanceToCreate->get().GetNestedInstances([&](AZStd::unique_ptr<Instance>& nestedInstance) {
AZ_Assert(nestedInstance, "Invalid nested instance found in the new prefab created.");
EntityOptionalReference nestedInstanceContainerEntity = nestedInstance->GetContainerEntity();
AZ_Assert(
nestedInstanceContainerEntity, "Invalid container entity found for the nested instance used in prefab creation.");
CreateLink(
{&nestedInstanceContainerEntity->get()}, *nestedInstance, instanceToCreate->get().GetTemplateId(),
undoBatch.GetUndoBatch(), containerEntityId);
});
CreateLink(
topLevelEntities, instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch(),
commonRootEntityId);
AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId();
// Change top level entities to be parented to the container entity
// Mark them as dirty so this change is correctly applied to the template
@@ -225,19 +237,7 @@ namespace AzToolsFramework
PrefabOperationResult PrefabPublicHandler::SavePrefab(AZ::IO::Path filePath)
{
auto prefabSystemComponentInterface = AZ::Interface<PrefabSystemComponentInterface>::Get();
if (!prefabSystemComponentInterface)
{
AZ_Assert(
false,
"Prefab - PrefabPublicHandler - "
"Prefab System Component Interface could not be found. "
"Check that it is being correctly initialized.");
return AZ::Failure(
AZStd::string("SavePrefab - Internal error (Prefab System Component Interface could not be found)."));
}
auto templateId = prefabSystemComponentInterface->GetTemplateIdFromFilePath(filePath.c_str());
auto templateId = m_prefabSystemComponentInterface->GetTemplateIdFromFilePath(filePath.c_str());
if (templateId == InvalidTemplateId)
{
@@ -438,26 +438,14 @@ namespace AzToolsFramework
PrefabRequestResult PrefabPublicHandler::HasUnsavedChanges(AZ::IO::Path prefabFilePath) const
{
auto prefabSystemComponentInterface = AZ::Interface<PrefabSystemComponentInterface>::Get();
if (!prefabSystemComponentInterface)
{
AZ_Assert(
false,
"Prefab - PrefabPublicHandler - "
"Prefab System Component Interface could not be found. "
"Check that it is being correctly initialized.");
return AZ::Failure(
AZStd::string("HasUnsavedChanges - Internal error (Prefab System Component Interface could not be found)."));
}
auto templateId = prefabSystemComponentInterface->GetTemplateIdFromFilePath(prefabFilePath.c_str());
auto templateId = m_prefabSystemComponentInterface->GetTemplateIdFromFilePath(prefabFilePath.c_str());
if (templateId == InvalidTemplateId)
{
return AZ::Failure(AZStd::string("HasUnsavedChanges - Path error. Path could be invalid, or the prefab may not be loaded in this level."));
}
return AZ::Success(prefabSystemComponentInterface->IsTemplateDirty(templateId));
return AZ::Success(m_prefabSystemComponentInterface->IsTemplateDirty(templateId));
}
PrefabOperationResult PrefabPublicHandler::DeleteEntitiesInInstance(const EntityIdList& entityIds)
@@ -91,8 +91,9 @@ namespace AzToolsFramework
m_instanceUpdateExecutor.UpdateTemplateInstancesInQueue();
}
AZStd::unique_ptr<Instance> PrefabSystemComponent::CreatePrefab(const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume,
AZ::IO::PathView filePath, AZStd::unique_ptr<AZ::Entity> containerEntity)
AZStd::unique_ptr<Instance> PrefabSystemComponent::CreatePrefab(
const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume,
AZ::IO::PathView filePath, AZStd::unique_ptr<AZ::Entity> containerEntity, bool shouldCreateLinks)
{
AZ::IO::Path relativeFilePath = m_prefabLoader.GetRelativePathToProject(filePath);
if (GetTemplateIdFromFilePath(relativeFilePath) != InvalidTemplateId)
@@ -123,7 +124,7 @@ namespace AzToolsFramework
newInstance->SetTemplateSourcePath(relativeFilePath);
newInstance->SetContainerEntityName(relativeFilePath.Stem().Native());
TemplateId newTemplateId = CreateTemplateFromInstance(*newInstance);
TemplateId newTemplateId = CreateTemplateFromInstance(*newInstance, shouldCreateLinks);
if (newTemplateId == InvalidTemplateId)
{
AZ_Error("Prefab", false,
@@ -289,7 +290,7 @@ namespace AzToolsFramework
return newInstance;
}
TemplateId PrefabSystemComponent::CreateTemplateFromInstance(Instance& instance)
TemplateId PrefabSystemComponent::CreateTemplateFromInstance(Instance& instance, bool shouldCreateLinks)
{
// We will register the template to match the path the instance has
const AZ::IO::Path& templateSourcePath = instance.GetTemplateSourcePath();
@@ -323,14 +324,15 @@ namespace AzToolsFramework
return InvalidTemplateId;
}
if (!GenerateLinksForNewTemplate(newTemplateId, instance))
if (shouldCreateLinks)
{
// Clear new template and any links associated with it
RemoveTemplate(newTemplateId);
return InvalidTemplateId;
if (!GenerateLinksForNewTemplate(newTemplateId, instance))
{
// Clear new template and any links associated with it
RemoveTemplate(newTemplateId);
return InvalidTemplateId;
}
}
return newTemplateId;
}
@@ -187,17 +187,22 @@ namespace AzToolsFramework
* @param entities A vector of entities that will be used in the new instance. May be empty
* @param instances A vector of Prefab Instances that will be nested in the new instance, will be consumed and moved.
* May be empty
* @param filePath the path to associate the template of the new instance to
* @param filePath the path to associate the template of the new instance to.
* @param containerEntity The container entity for the prefab to be created. It will be created if a nullptr is provided.
* @param shouldCreateLinks The flag indicating if links should be created between the templates of the instance
* and its nested instances.
* @return A pointer to the newly created instance. nullptr on failure
*/
AZStd::unique_ptr<Instance> CreatePrefab(const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume,
AZ::IO::PathView filePath, AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr) override;
AZStd::unique_ptr<Instance> CreatePrefab(
const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume,
AZ::IO::PathView filePath, AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr,
bool ShouldCreateLinks = true) override;
PrefabDom& FindTemplateDom(TemplateId templateId) override;
/**
* Updates a template with the given updated DOM.
*
*
* @param templateId The id of the template to update.
* @param updatedDom The DOM to update the template with.
*/
@@ -260,9 +265,11 @@ namespace AzToolsFramework
/**
* Takes a prefab instance and generates a new Prefab Template
* along with any new Prefab Links representing any of the nested instances present
* @param instance The instance used to generate the new Template
* @param instance The instance used to generate the new Template.
* @param shouldCreateLinks The flag indicating if links should be created between the templates of the instance
* and its nested instances.
*/
TemplateId CreateTemplateFromInstance(Instance& instance);
TemplateId CreateTemplateFromInstance(Instance& instance, bool shouldCreateLinks);
/**
* Connect two templates with given link, and a nested instance value iterator
@@ -61,7 +61,7 @@ namespace AzToolsFramework
virtual AZStd::unique_ptr<Instance> InstantiatePrefab(const TemplateId& templateId) = 0;
virtual AZStd::unique_ptr<Instance> CreatePrefab(const AZStd::vector<AZ::Entity*>& entities,
AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume, AZ::IO::PathView filePath,
AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr) = 0;
AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr, bool ShouldCreateLinks = true) = 0;
};
@@ -577,16 +577,6 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
modifyMenu.AddAction(ID_MODIFY_LINK);
modifyMenu.AddAction(ID_MODIFY_UNLINK);
modifyMenu.AddSeparator();
auto alignMenu = modifyMenu.AddMenu(tr("Align"));
alignMenu.AddAction(ID_OBJECTMODIFY_ALIGNTOGRID);
auto constrainMenu = modifyMenu.AddMenu(tr("Constrain"));
constrainMenu.AddAction(ID_SELECT_AXIS_X);
constrainMenu.AddAction(ID_SELECT_AXIS_Y);
constrainMenu.AddAction(ID_SELECT_AXIS_Z);
constrainMenu.AddAction(ID_SELECT_AXIS_XY);
constrainMenu.AddAction(ID_SELECT_AXIS_TERRAIN);
}
auto snapMenu = modifyMenu.AddMenu(tr("Snap"));
@@ -608,20 +598,10 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
}
auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode"));
if (!newViewportInteractionModelEnabled)
{
transformModeMenu.AddAction(ID_EDITMODE_SELECT);
}
transformModeMenu.AddAction(ID_EDITMODE_MOVE);
transformModeMenu.AddAction(ID_EDITMODE_ROTATE);
transformModeMenu.AddAction(ID_EDITMODE_SCALE);
if (!newViewportInteractionModelEnabled)
{
transformModeMenu.AddAction(ID_EDITMODE_SELECTAREA);
}
editMenu.AddSeparator();
// Lock Selection
+30 -240
View File
@@ -125,7 +125,6 @@ AZ_POP_DISABLE_WARNING
#include "AnimationContext.h"
#include "GotoPositionDlg.h"
#include "SetVectorDlg.h"
#include "ConsoleDialog.h"
#include "Controls/ConsoleSCB.h"
@@ -395,29 +394,20 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove)
ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate)
ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale)
ON_COMMAND(ID_EDITMODE_SELECT, OnEditmodeSelect)
ON_COMMAND(ID_OBJECTMODIFY_SETAREA, OnObjectSetArea)
ON_COMMAND(ID_OBJECTMODIFY_SETHEIGHT, OnObjectSetHeight)
ON_COMMAND(ID_OBJECTMODIFY_FREEZE, OnObjectmodifyFreeze)
ON_COMMAND(ID_OBJECTMODIFY_UNFREEZE, OnObjectmodifyUnfreeze)
ON_COMMAND(ID_EDITMODE_SELECTAREA, OnEditmodeSelectarea)
ON_COMMAND(ID_SELECT_AXIS_X, OnSelectAxisX)
ON_COMMAND(ID_SELECT_AXIS_Y, OnSelectAxisY)
ON_COMMAND(ID_SELECT_AXIS_Z, OnSelectAxisZ)
ON_COMMAND(ID_SELECT_AXIS_XY, OnSelectAxisXy)
ON_COMMAND(ID_UNDO, OnUndo)
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one
ON_COMMAND(ID_SELECTION_SAVE, OnSelectionSave)
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
ON_COMMAND(ID_SELECTION_LOAD, OnSelectionLoad)
ON_COMMAND(ID_OBJECTMODIFY_ALIGNTOGRID, OnAlignToGrid)
ON_COMMAND(ID_LOCK_SELECTION, OnLockSelection)
ON_COMMAND(ID_EDIT_LEVELDATA, OnEditLevelData)
ON_COMMAND(ID_FILE_EDITLOGFILE, OnFileEditLogFile)
ON_COMMAND(ID_FILE_RESAVESLICES, OnFileResaveSlices)
ON_COMMAND(ID_FILE_EDITEDITORINI, OnFileEditEditorini)
ON_COMMAND(ID_SELECT_AXIS_TERRAIN, OnSelectAxisTerrain)
ON_COMMAND(ID_SELECT_AXIS_SNAPTOALL, OnSelectAxisSnapToAll)
ON_COMMAND(ID_PREFERENCES, OnPreferences)
ON_COMMAND(ID_RELOAD_GEOMETRY, OnReloadGeometry)
ON_COMMAND(ID_REDO, OnRedo)
@@ -484,7 +474,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_VIEW_CYCLE2DVIEWPORT, OnViewCycle2dviewport)
#endif
ON_COMMAND(ID_DISPLAY_GOTOPOSITION, OnDisplayGotoPosition)
ON_COMMAND(ID_DISPLAY_SETVECTOR, OnDisplaySetVector)
ON_COMMAND(ID_SNAPANGLE, OnSnapangle)
ON_COMMAND(ID_RULER, OnRuler)
ON_COMMAND(ID_ROTATESELECTION_XAXIS, OnRotateselectionXaxis)
@@ -2755,85 +2744,31 @@ void CCryEditApp::OnSetHeight()
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeMove()
{
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Translation);
}
else
{
GetIEditor()->SetEditMode(eEditModeMove);
}
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Translation);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeRotate()
{
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Rotation);
}
else
{
GetIEditor()->SetEditMode(eEditModeRotate);
}
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Rotation);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeScale()
{
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Scale);
}
else
{
GetIEditor()->SetEditMode(eEditModeScale);
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeSelect()
{
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
GetIEditor()->SetEditMode(eEditModeSelect);
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeSelectarea()
{
// TODO: Add your command handler code here
GetIEditor()->SetEditMode(eEditModeSelectArea);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateEditmodeSelectarea(QAction* action)
{
Q_ASSERT(action->isCheckable());
action->setChecked(GetIEditor()->GetEditMode() == eEditModeSelectArea);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateEditmodeSelect(QAction* action)
{
Q_ASSERT(action->isCheckable());
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
action->setChecked(GetIEditor()->GetEditMode() == eEditModeSelect);
}
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Scale);
}
//////////////////////////////////////////////////////////////////////////
@@ -2841,19 +2776,12 @@ void CCryEditApp::OnUpdateEditmodeMove(QAction* action)
{
Q_ASSERT(action->isCheckable());
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
}
else
{
action->setChecked(GetIEditor()->GetEditMode() == eEditModeMove);
}
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
}
//////////////////////////////////////////////////////////////////////////
@@ -2861,20 +2789,12 @@ void CCryEditApp::OnUpdateEditmodeRotate(QAction* action)
{
Q_ASSERT(action->isCheckable());
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
}
else
{
action->setChecked(GetIEditor()->GetEditMode() == eEditModeRotate);
action->setEnabled(true);
}
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
}
//////////////////////////////////////////////////////////////////////////
@@ -2882,20 +2802,12 @@ void CCryEditApp::OnUpdateEditmodeScale(QAction* action)
{
Q_ASSERT(action->isCheckable());
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
}
else
{
action->setChecked(GetIEditor()->GetEditMode() == eEditModeScale);
action->setEnabled(true);
}
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
}
//////////////////////////////////////////////////////////////////////////
@@ -3076,101 +2988,6 @@ void CCryEditApp::OnViewSwitchToGame()
GetIEditor()->SetInGameMode(inGame);
}
void CCryEditApp::OnSelectAxisX()
{
AxisConstrains axis = (GetIEditor()->GetAxisConstrains() != AXIS_X) ? AXIS_X : AXIS_NONE;
GetIEditor()->SetAxisConstraints(axis);
}
void CCryEditApp::OnSelectAxisY()
{
AxisConstrains axis = (GetIEditor()->GetAxisConstrains() != AXIS_Y) ? AXIS_Y : AXIS_NONE;
GetIEditor()->SetAxisConstraints(axis);
}
void CCryEditApp::OnSelectAxisZ()
{
AxisConstrains axis = (GetIEditor()->GetAxisConstrains() != AXIS_Z) ? AXIS_Z : AXIS_NONE;
GetIEditor()->SetAxisConstraints(axis);
}
void CCryEditApp::OnSelectAxisXy()
{
AxisConstrains axis = (GetIEditor()->GetAxisConstrains() != AXIS_XY) ? AXIS_XY : AXIS_NONE;
GetIEditor()->SetAxisConstraints(axis);
}
void CCryEditApp::OnUpdateSelectAxisX(QAction* action)
{
Q_ASSERT(action->isCheckable());
action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_X);
}
void CCryEditApp::OnUpdateSelectAxisXy(QAction* action)
{
Q_ASSERT(action->isCheckable());
action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_XY);
}
void CCryEditApp::OnUpdateSelectAxisY(QAction* action)
{
Q_ASSERT(action->isCheckable());
action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_Y);
}
void CCryEditApp::OnUpdateSelectAxisZ(QAction* action)
{
Q_ASSERT(action->isCheckable());
action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_Z);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSelectAxisTerrain()
{
IEditor* editor = GetIEditor();
bool isAlreadyEnabled = (editor->GetAxisConstrains() == AXIS_TERRAIN) && (editor->IsTerrainAxisIgnoreObjects());
if (!isAlreadyEnabled)
{
editor->SetAxisConstraints(AXIS_TERRAIN);
editor->SetTerrainAxisIgnoreObjects(true);
}
else
{
// behave like a toggle button - click on the same thing again to disable.
editor->SetAxisConstraints(AXIS_NONE);
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSelectAxisSnapToAll()
{
IEditor* editor = GetIEditor();
bool isAlreadyEnabled = (editor->GetAxisConstrains() == AXIS_TERRAIN) && (!editor->IsTerrainAxisIgnoreObjects());
if (!isAlreadyEnabled)
{
editor->SetAxisConstraints(AXIS_TERRAIN);
editor->SetTerrainAxisIgnoreObjects(false);
}
else
{
// behave like a toggle button - click on the same thing again to disable.
editor->SetAxisConstraints(AXIS_NONE);
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateSelectAxisTerrain(QAction* action)
{
Q_ASSERT(action->isCheckable());
action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_TERRAIN && GetIEditor()->IsTerrainAxisIgnoreObjects());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateSelectAxisSnapToAll(QAction* action)
{
action->setChecked(GetIEditor()->GetAxisConstrains() == AXIS_TERRAIN && !GetIEditor()->IsTerrainAxisIgnoreObjects());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnExportSelectedObjects()
{
@@ -3351,26 +3168,6 @@ void CCryEditApp::OnUpdateSelected(QAction* action)
action->setEnabled(!GetIEditor()->GetSelection()->IsEmpty());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnAlignToGrid()
{
CSelectionGroup* sel = GetIEditor()->GetSelection();
if (!sel->IsEmpty())
{
CUndo undo("Align To Grid");
Matrix34 tm;
for (int i = 0; i < sel->GetCount(); i++)
{
CBaseObject* obj = sel->GetObject(i);
tm = obj->GetWorldTM();
Vec3 snaped = gSettings.pGrid->Snap(tm.GetTranslation());
tm.SetTranslation(snaped);
obj->SetWorldTM(tm, eObjectUpdateFlags_UserInput);
obj->OnEvent(EVENT_ALIGN_TOGRID);
}
}
}
void CCryEditApp::OnShowHelpers()
{
GetIEditor()->GetDisplaySettings()->DisplayHelpers(!GetIEditor()->GetDisplaySettings()->IsDisplayHelpers());
@@ -4530,13 +4327,6 @@ void CCryEditApp::OnDisplayGotoPosition()
dlg.exec();
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnDisplaySetVector()
{
CSetVectorDlg dlg;
dlg.exec();
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSnapangle()
{
-18
View File
@@ -224,40 +224,23 @@ public:
void OnEditmodeMove();
void OnEditmodeRotate();
void OnEditmodeScale();
void OnEditmodeSelect();
void OnObjectSetArea();
void OnObjectSetHeight();
void OnUpdateEditmodeSelect(QAction* action);
void OnUpdateEditmodeMove(QAction* action);
void OnUpdateEditmodeRotate(QAction* action);
void OnUpdateEditmodeScale(QAction* action);
void OnObjectmodifyFreeze();
void OnObjectmodifyUnfreeze();
void OnEditmodeSelectarea();
void OnUpdateEditmodeSelectarea(QAction* action);
void OnSelectAxisX();
void OnSelectAxisY();
void OnSelectAxisZ();
void OnSelectAxisXy();
void OnUpdateSelectAxisX(QAction* action);
void OnUpdateSelectAxisXy(QAction* action);
void OnUpdateSelectAxisY(QAction* action);
void OnUpdateSelectAxisZ(QAction* action);
void OnUndo();
void OnSelectionSave();
void OnOpenAssetImporter();
void OnSelectionLoad();
void OnUpdateSelected(QAction* action);
void OnAlignToGrid();
void OnLockSelection();
void OnEditLevelData();
void OnFileEditLogFile();
void OnFileResaveSlices();
void OnFileEditEditorini();
void OnSelectAxisTerrain();
void OnSelectAxisSnapToAll();
void OnUpdateSelectAxisTerrain(QAction* action);
void OnUpdateSelectAxisSnapToAll(QAction* action);
void OnPreferences();
void OnReloadTextures();
void OnReloadGeometry();
@@ -448,7 +431,6 @@ private:
void OnToolsScriptHelp();
void OnViewCycle2dviewport();
void OnDisplayGotoPosition();
void OnDisplaySetVector();
void OnSnapangle();
void OnUpdateSnapangle(QAction* action);
void OnRuler();
-2
View File
@@ -279,8 +279,6 @@ void CCryEditDoc::DeleteContents()
// [LY-90904] move this to the EditorVegetationManager component
InstanceStatObjEventBus::Broadcast(&InstanceStatObjEventBus::Events::ReleaseData);
GetIEditor()->SetEditMode(eEditModeSelect);
//////////////////////////////////////////////////////////////////////////
// Clear all undo info.
//////////////////////////////////////////////////////////////////////////
-1
View File
@@ -216,7 +216,6 @@ protected:
void OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/) override;
//////////////////////////////////////////////////////////////////////////
QString m_strMasterCDFolder;
bool m_bLoadFailed;
QColor m_waterColor;
XmlNodeRef m_fogTemplate;
+17 -17
View File
@@ -65,7 +65,7 @@ namespace
const float kTangentDelta = 0.01f;
const float kAspectRatio = 1.777778f;
const int kReserveCount = 7; // x,y,z,rot_x,rot_y,rot_z,fov
const QString kMasterCameraName = "MasterCamera";
const QString kPrimaryCameraName = "PrimaryCamera";
} // namespace
@@ -169,10 +169,10 @@ CExportManager::CExportManager()
, m_numberOfExportFrames(0)
, m_pivotEntityObject(0)
, m_bBakedKeysSequenceExport(true)
, m_animTimeExportMasterSequenceCurrentTime(0.0f)
, m_animTimeExportPrimarySequenceCurrentTime(0.0f)
, m_animKeyTimeExport(true)
, m_soundKeyTimeExport(true)
, m_bExportOnlyMasterCamera(false)
, m_bExportOnlyPrimaryCamera(false)
{
RegisterExporter(new COBJExporter());
RegisterExporter(new COCMExporter());
@@ -773,14 +773,14 @@ bool CExportManager::ShowFBXExportDialog()
return false;
}
SetFBXExportSettings(fpsDialog.GetExportCoordsLocalToTheSelectedObject(), fpsDialog.GetExportOnlyMasterCamera(), fpsDialog.GetFPS());
SetFBXExportSettings(fpsDialog.GetExportCoordsLocalToTheSelectedObject(), fpsDialog.GetExportOnlyPrimaryCamera(), fpsDialog.GetFPS());
return true;
}
bool CExportManager::ProcessObjectsForExport()
{
Export::CObject* pObj = new Export::CObject(kMasterCameraName.toUtf8().data());
Export::CObject* pObj = new Export::CObject(kPrimaryCameraName.toUtf8().data());
pObj->entityType = Export::eCamera;
m_data.m_objects.push_back(pObj);
@@ -808,13 +808,13 @@ bool CExportManager::ProcessObjectsForExport()
Export::CObject* pObj2 = m_data.m_objects[objectID];
CBaseObject* pObject = 0;
if (QString::compare(pObj2->name, kMasterCameraName) == 0)
if (QString::compare(pObj2->name, kPrimaryCameraName) == 0)
{
pObject = GetIEditor()->GetObjectManager()->FindObject(GetIEditor()->GetViewManager()->GetCameraObjectId());
}
else
{
if (m_bExportOnlyMasterCamera && pObj2->entityType != Export::eCameraTarget)
if (m_bExportOnlyPrimaryCamera && pObj2->entityType != Export::eCameraTarget)
{
continue;
}
@@ -952,7 +952,7 @@ void CExportManager::FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode*
if (numAllTracks > 0)
{
XmlNodeRef objNode = writeNode->createNode(CleanXMLText(pObjectNode->GetName()).toUtf8().data());
writeNode->setAttr("time", m_animTimeExportMasterSequenceCurrentTime);
writeNode->setAttr("time", m_animTimeExportPrimarySequenceCurrentTime);
for (unsigned int trackID = 0; trackID < numAllTracks; ++trackID)
{
@@ -1020,7 +1020,7 @@ void CExportManager::FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode*
XmlNodeRef keyNode = subNode->createNode(keyContentName.toUtf8().data());
float keyGlobalTime = m_animTimeExportMasterSequenceCurrentTime + keyTime;
float keyGlobalTime = m_animTimeExportPrimarySequenceCurrentTime + keyTime;
keyNode->setAttr("keyTime", keyGlobalTime);
if (keyStartTime > 0)
@@ -1123,13 +1123,13 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo
const QString sequenceName = pSubSequence->GetName();
XmlNodeRef subSeqNode2 = seqNode->createNode(sequenceName.toUtf8().data());
if (sequenceName == m_animTimeExportMasterSequenceName)
if (sequenceName == m_animTimeExportPrimarySequenceName)
{
m_animTimeExportMasterSequenceCurrentTime = sequenceKey.time;
m_animTimeExportPrimarySequenceCurrentTime = sequenceKey.time;
}
else
{
m_animTimeExportMasterSequenceCurrentTime += sequenceKey.time;
m_animTimeExportPrimarySequenceCurrentTime += sequenceKey.time;
}
AddObjectsFromSequence(pSubSequence, subSeqNode2);
@@ -1336,7 +1336,7 @@ bool CExportManager::Export(const char* defaultName, const char* defaultExt, con
{
m_numberOfExportFrames = pSequence->GetTimeRange().end * m_FBXBakedExportFPS;
if (!m_bExportOnlyMasterCamera)
if (!m_bExportOnlyPrimaryCamera)
{
AddObjectsFromSequence(pSequence);
}
@@ -1365,10 +1365,10 @@ bool CExportManager::Export(const char* defaultName, const char* defaultExt, con
return returnRes;
}
void CExportManager::SetFBXExportSettings(bool bLocalCoordsToSelectedObject, bool bExportOnlyMasterCamera, const float fps)
void CExportManager::SetFBXExportSettings(bool bLocalCoordsToSelectedObject, bool bExportOnlyPrimaryCamera, const float fps)
{
m_bExportLocalCoords = bLocalCoordsToSelectedObject;
m_bExportOnlyMasterCamera = bExportOnlyMasterCamera;
m_bExportOnlyPrimaryCamera = bExportOnlyPrimaryCamera;
m_FBXBakedExportFPS = fps;
}
@@ -1439,10 +1439,10 @@ void CExportManager::SaveNodeKeysTimeToXML()
if (dlg.exec())
{
m_animTimeNode = XmlHelpers::CreateXmlNode(pSequence->GetName());
m_animTimeExportMasterSequenceName = pSequence->GetName();
m_animTimeExportPrimarySequenceName = pSequence->GetName();
m_data.Clear();
m_animTimeExportMasterSequenceCurrentTime = 0.0;
m_animTimeExportPrimarySequenceCurrentTime = 0.0;
AddObjectsFromSequence(pSequence, m_animTimeNode);
+4 -4
View File
@@ -171,7 +171,7 @@ private:
bool AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNodeRef seqNode = 0);
bool IsDuplicateObjectBeingAdded(const QString& newObject);
void SetFBXExportSettings(bool bLocalCoordsToSelectedObject, bool bExportOnlyMasterCamera, const float fps);
void SetFBXExportSettings(bool bLocalCoordsToSelectedObject, bool bExportOnlyPrimaryCamera, const float fps);
bool ProcessObjectsForExport();
bool ShowFBXExportDialog();
@@ -193,13 +193,13 @@ private:
float m_FBXBakedExportFPS;
bool m_bExportLocalCoords;
bool m_bExportOnlyMasterCamera;
bool m_bExportOnlyPrimaryCamera;
int m_numberOfExportFrames;
CEntityObject* m_pivotEntityObject;
bool m_bBakedKeysSequenceExport;
QString m_animTimeExportMasterSequenceName;
float m_animTimeExportMasterSequenceCurrentTime;
QString m_animTimeExportPrimarySequenceName;
float m_animTimeExportPrimarySequenceCurrentTime;
XmlNodeRef m_animTimeNode;
bool m_animKeyTimeExport;
+3 -3
View File
@@ -55,9 +55,9 @@ bool CFBXExporterDialog::GetExportCoordsLocalToTheSelectedObject() const
return m_ui->m_exportLocalCoordsCheckbox->isChecked();
}
bool CFBXExporterDialog::GetExportOnlyMasterCamera() const
bool CFBXExporterDialog::GetExportOnlyPrimaryCamera() const
{
return m_ui->m_exportOnlyMasterCameraCheckBox->isChecked();
return m_ui->m_exportOnlyPrimaryCameraCheckBox->isChecked();
}
void CFBXExporterDialog::SetExportLocalCoordsCheckBoxEnable(bool checked)
@@ -100,7 +100,7 @@ int CFBXExporterDialog::exec()
if (m_bDisplayOnlyFPSSetting)
{
m_ui->m_exportLocalCoordsCheckbox->setEnabled(false);
m_ui->m_exportOnlyMasterCameraCheckBox->setEnabled(false);
m_ui->m_exportOnlyPrimaryCameraCheckBox->setEnabled(false);
}
m_ui->m_fpsCombo->addItem("24");
+2 -2
View File
@@ -36,7 +36,7 @@ public:
float GetFPS() const;
bool GetExportCoordsLocalToTheSelectedObject() const;
bool GetExportOnlyMasterCamera() const;
bool GetExportOnlyPrimaryCamera() const;
void SetExportLocalCoordsCheckBoxEnable(bool checked);
int exec() override;
@@ -44,7 +44,7 @@ public:
protected:
void OnFPSChange();
void SetExportLocalToTheSelectedObjectCheckBox();
void SetExportOnlyMasterCameraCheckBox();
void SetExportOnlyPrimaryCameraCheckBox();
void accept() override;
+2 -2
View File
@@ -49,9 +49,9 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="m_exportOnlyMasterCameraCheckBox">
<widget class="QCheckBox" name="m_exportOnlyPrimaryCameraCheckBox">
<property name="text">
<string>Export Only Master Camera</string>
<string>Export Only Primary Camera</string>
</property>
</widget>
</item>
-14
View File
@@ -318,17 +318,6 @@ enum EOperationMode
eModellingMode // Geometry modeling mode
};
enum EEditMode
{
eEditModeSelect,
eEditModeSelectArea,
eEditModeMove,
eEditModeRotate,
eEditModeScale,
eEditModeTool,
eEditModeRotateCircle,
};
//! Mouse events that viewport can send
enum EMouseEvent
{
@@ -619,9 +608,6 @@ struct IEditor
virtual void SetOperationMode(EOperationMode mode) = 0;
virtual EOperationMode GetOperationMode() = 0;
//! editMode - EEditMode
virtual void SetEditMode(int editMode) = 0;
virtual int GetEditMode() = 0;
//! Shows/Hides transformation manipulator.
//! if bShow is true also returns a valid ITransformManipulator pointer.
virtual ITransformManipulator* ShowTransformManipulator(bool bShow) = 0;
+1 -112
View File
@@ -144,8 +144,7 @@ namespace
const char* CEditorImpl::m_crashLogFileName = "SessionStatus/editor_statuses.json";
CEditorImpl::CEditorImpl()
: m_currEditMode(eEditModeSelect)
, m_operationMode(eOperationModeNone)
: m_operationMode(eOperationModeNone)
, m_pSystem(nullptr)
, m_pFileUtil(nullptr)
, m_pClassFactory(nullptr)
@@ -236,18 +235,6 @@ CEditorImpl::CEditorImpl()
m_pRuler = new CRuler;
m_selectedRegion.min = Vec3(0, 0, 0);
m_selectedRegion.max = Vec3(0, 0, 0);
ZeroStruct(m_lastAxis);
m_lastAxis[eEditModeSelect] = AXIS_TERRAIN;
m_lastAxis[eEditModeSelectArea] = AXIS_TERRAIN;
m_lastAxis[eEditModeMove] = AXIS_TERRAIN;
m_lastAxis[eEditModeRotate] = AXIS_Z;
m_lastAxis[eEditModeScale] = AXIS_XY;
ZeroStruct(m_lastCoordSys);
m_lastCoordSys[eEditModeSelect] = COORDS_LOCAL;
m_lastCoordSys[eEditModeSelectArea] = COORDS_LOCAL;
m_lastCoordSys[eEditModeMove] = COORDS_WORLD;
m_lastCoordSys[eEditModeRotate] = COORDS_WORLD;
m_lastCoordSys[eEditModeScale] = COORDS_WORLD;
DetectVersion();
RegisterTools();
@@ -257,8 +244,6 @@ CEditorImpl::CEditorImpl()
m_pAssetBrowserRequestHandler = nullptr;
m_assetEditorRequestsHandler = nullptr;
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
AZ::IO::SystemFile::CreateDir("SessionStatus");
QFile::setPermissions(m_crashLogFileName, QFileDevice::ReadOther | QFileDevice::WriteOther);
}
@@ -282,8 +267,6 @@ void CEditorImpl::Initialize()
// Activate QT immediately so that its available as soon as CEditorImpl is (and thus GetIEditor())
InitializeEditorCommon(GetIEditor());
LoadSettings();
}
//The only purpose of that function is to be called at the very begining of the shutdown sequence so that we can instrument and track
@@ -298,8 +281,6 @@ void CEditorImpl::OnEarlyExitShutdownSequence()
void CEditorImpl::Uninitialize()
{
SaveSettings();
if (m_pSystem)
{
UninitializeEditorCommonISystem(m_pSystem);
@@ -360,8 +341,6 @@ void CEditorImpl::LoadPlugins()
CEditorImpl::~CEditorImpl()
{
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
gSettings.Save();
m_bExiting = true; // Can't save level after this point (while Crash)
SAFE_RELEASE(m_pSourceControl);
@@ -650,40 +629,6 @@ IMainStatusBar* CEditorImpl::GetMainStatusBar()
return MainWindow::instance()->StatusBar();
}
int CEditorImpl::GetEditMode()
{
return m_currEditMode;
}
void CEditorImpl::SetEditMode(int editMode)
{
bool isEditorInGameMode = false;
EBUS_EVENT_RESULT(isEditorInGameMode, AzToolsFramework::EditorEntityContextRequestBus, IsEditorRunningGame);
if (isEditorInGameMode)
{
if (editMode != eEditModeSelect)
{
if (SelectionContainsComponentEntities())
{
return;
}
}
}
EEditMode newEditMode = (EEditMode)editMode;
if (m_currEditMode == newEditMode)
{
return;
}
m_currEditMode = newEditMode;
AABB box(Vec3(0, 0, 0), Vec3(0, 0, 0));
SetSelectedRegion(box);
Notify(eNotify_OnEditModeChange);
}
void CEditorImpl::SetOperationMode(EOperationMode mode)
{
m_operationMode = mode;
@@ -728,7 +673,6 @@ ITransformManipulator* CEditorImpl::GetTransformManipulator()
void CEditorImpl::SetAxisConstraints(AxisConstrains axisFlags)
{
m_selectedAxis = axisFlags;
m_lastAxis[m_currEditMode] = m_selectedAxis;
m_pViewManager->SetAxisConstrain(axisFlags);
SetTerrainAxisIgnoreObjects(false);
@@ -754,7 +698,6 @@ bool CEditorImpl::IsTerrainAxisIgnoreObjects()
void CEditorImpl::SetReferenceCoordSys(RefCoordSys refCoords)
{
m_refCoordsSys = refCoords;
m_lastCoordSys[m_currEditMode] = m_refCoordsSys;
// Update all views.
UpdateViews(eUpdateObjects, NULL);
@@ -1884,60 +1827,6 @@ bool CEditorImpl::IsNewViewportInteractionModelEnabled() const
return m_isNewViewportInteractionModelEnabled;
}
void CEditorImpl::OnStartPlayInEditor()
{
if (SelectionContainsComponentEntities())
{
SetEditMode(eEditModeSelect);
}
}
namespace
{
const std::vector<std::pair<EEditMode, QString>> s_editModeNames = {
{ eEditModeSelect, QStringLiteral("Select") },
{ eEditModeSelectArea, QStringLiteral("SelectArea") },
{ eEditModeMove, QStringLiteral("Move") },
{ eEditModeRotate, QStringLiteral("Rotate") },
{ eEditModeScale, QStringLiteral("Scale") }
};
}
void CEditorImpl::LoadSettings()
{
QSettings settings(QStringLiteral("Amazon"), QStringLiteral("O3DE"));
settings.beginGroup(QStringLiteral("Editor"));
settings.beginGroup(QStringLiteral("CoordSys"));
for (const auto& editMode : s_editModeNames)
{
if (settings.contains(editMode.second))
{
m_lastCoordSys[editMode.first] = static_cast<RefCoordSys>(settings.value(editMode.second).toInt());
}
}
settings.endGroup(); // CoordSys
settings.endGroup(); // Editor
}
void CEditorImpl::SaveSettings() const
{
QSettings settings(QStringLiteral("Amazon"), QStringLiteral("O3DE"));
settings.beginGroup(QStringLiteral("Editor"));
settings.beginGroup(QStringLiteral("CoordSys"));
for (const auto& editMode : s_editModeNames)
{
settings.setValue(editMode.second, static_cast<int>(m_lastCoordSys[editMode.first]));
}
settings.endGroup(); // CoordSys
settings.endGroup(); // Editor
}
IEditorPanelUtils* CEditorImpl::GetEditorPanelUtils()
{
return m_panelEditorUtils;
+1 -15
View File
@@ -23,7 +23,6 @@
#include <memory> // for shared_ptr
#include <QMap>
#include <QApplication>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
#include <AzCore/std/string/string.h>
@@ -86,13 +85,12 @@ namespace AssetDatabase
class CEditorImpl
: public IEditor
, protected AzToolsFramework::EditorEntityContextNotificationBus::Handler
{
Q_DECLARE_TR_FUNCTIONS(CEditorImpl)
public:
CEditorImpl();
~CEditorImpl();
virtual ~CEditorImpl();
void Initialize();
void OnBeginShutdownSequence();
@@ -226,8 +224,6 @@ public:
void SetDataModified();
void SetOperationMode(EOperationMode mode);
EOperationMode GetOperationMode();
void SetEditMode(int editMode);
int GetEditMode();
ITransformManipulator* ShowTransformManipulator(bool bShow);
ITransformManipulator* GetTransformManipulator();
@@ -348,23 +344,15 @@ public:
protected:
//////////////////////////////////////////////////////////////////////////
// EditorEntityContextNotificationBus implementation
void OnStartPlayInEditor() override;
//////////////////////////////////////////////////////////////////////////
AZStd::string LoadProjectIdFromProjectData();
void DetectVersion();
void RegisterTools();
void SetPrimaryCDFolder();
void LoadSettings();
void SaveSettings() const;
//! List of all notify listeners.
std::list<IEditorNotifyListener*> m_listeners;
EEditMode m_currEditMode;
EOperationMode m_operationMode;
ISystem* m_pSystem;
IFileUtil* m_pFileUtil;
@@ -378,8 +366,6 @@ protected:
AABB m_selectedRegion;
AxisConstrains m_selectedAxis;
RefCoordSys m_refCoordsSys;
AxisConstrains m_lastAxis[16];
RefCoordSys m_lastCoordSys[16];
bool m_bAxisVectorLock;
bool m_bUpdates;
bool m_bTerrainAxisIgnoreObjects;
+2 -465
View File
@@ -30,6 +30,8 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_InfoBar.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <QLineEdit>
#include <AzQtComponents/Components/Style.h>
#include "CryPhysicsDeprecation.h"
@@ -52,10 +54,6 @@ CInfoBar::CInfoBar(QWidget* parent)
{
ui->setupUi(this);
m_enabledVector = false;
m_bVectorLock = false;
m_prevEditMode = 0;
m_bSelectionLocked = false;
m_bSelectionChanged = false;
m_bDragMode = false;
m_prevMoveSpeed = 0;
@@ -70,25 +68,14 @@ CInfoBar::CInfoBar(QWidget* parent)
OnInitDialog();
connect(ui->m_vectorLock, &QToolButton::clicked, this, &CInfoBar::OnVectorLock);
connect(ui->m_lockSelection, &QToolButton::clicked, this, &CInfoBar::OnLockSelection);
auto comboBoxTextChanged = static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged);
connect(ui->m_moveSpeed, comboBoxTextChanged, this, &CInfoBar::OnUpdateMoveSpeedText);
connect(ui->m_moveSpeed->lineEdit(), &QLineEdit::returnPressed, this, &CInfoBar::OnSpeedComboBoxEnter);
connect(ui->m_posCtrl, &AzQtComponents::VectorInput::valueChanged, this, &CInfoBar::OnVectorChanged);
// Hide some buttons from the expander menu
AzQtComponents::Style::addClass(ui->m_posCtrl, "expanderMenu_hide");
AzQtComponents::Style::addClass(ui->m_physDoStepBtn, "expanderMenu_hide");
AzQtComponents::Style::addClass(ui->m_physSingleStepBtn, "expanderMenu_hide");
// posCtrl is a VectorInput initialized via UI; as such, we can't construct it to have only 3 elements.
// We can just hide the W element as it is unused.
ui->m_posCtrl->getElements()[3]->setVisible(false);
connect(ui->m_setVector, &QToolButton::clicked, this, &CInfoBar::OnBnClickedSetVector);
connect(ui->m_physicsBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedPhysics);
connect(ui->m_physSingleStepBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedSingleStepPhys);
connect(ui->m_physDoStepBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedDoStepPhys);
@@ -99,12 +86,6 @@ CInfoBar::CInfoBar(QWidget* parent)
connect(this, &CInfoBar::ActionTriggered, MainWindow::instance()->GetActionManager(), &ActionManager::ActionTriggered);
connect(ui->m_lockSelection, &QAbstractButton::toggled, ui->m_lockSelection, [this](bool checked) {
ui->m_lockSelection->setToolTip(checked ? tr("Unlock Object Selection") : tr("Lock Object Selection"));
});
connect(ui->m_vectorLock, &QAbstractButton::toggled, ui->m_vectorLock, [this](bool checked) {
ui->m_vectorLock->setToolTip(checked ? tr("Unlock Axis Vectors") : tr("Lock Axis Vectors"));
});
connect(ui->m_physicsBtn, &QAbstractButton::toggled, ui->m_physicsBtn, [this](bool checked) {
ui->m_physicsBtn->setToolTip(checked ? tr("Stop Simulation (Ctrl+P)") : tr("Simulate (Ctrl+P)"));
});
@@ -121,27 +102,6 @@ CInfoBar::CInfoBar(QWidget* parent)
ui->m_vrBtn->setToolTip(checked ? tr("Disable VR Preview") : tr("Enable VR Preview"));
});
// hide old ui elements that are not valid with the new viewport interaction model
if (GetIEditor()->IsNewViewportInteractionModelEnabled())
{
ui->m_lockSelection->setVisible(false);
AzQtComponents::Style::addClass(ui->m_lockSelection, "expanderMenu_hide");
ui->m_posCtrl->setVisible(false);
AzQtComponents::Style::addClass(ui->m_posCtrl, "expanderMenu_hide");
ui->m_setVector->setVisible(false);
AzQtComponents::Style::addClass(ui->m_setVector, "expanderMenu_hide");
ui->m_vectorLock->setVisible(false);
AzQtComponents::Style::addClass(ui->m_vectorLock, "expanderMenu_hide");
// As we're hiding some of the icons, we have an extra spacer to deal with.
// We cannot set the visibility of separators, so we'll have to take it out.
int separatorIndex = layout()->indexOf(ui->verticalSpacer_2);
QLayoutItem* separator = layout()->takeAt(separatorIndex);
// takeAt() removes the item from the layout; delete to avoid memory leaks.
delete separator;
}
ui->m_moveSpeed->setValidator(new QDoubleValidator(m_minSpeed, m_maxSpeed, m_numDecimals, ui->m_moveSpeed));
// Save off the move speed here since setting up the combo box can cause it to update values in the background.
@@ -207,150 +167,6 @@ void CInfoBar::OnEditorNotifyEvent(EEditorNotifyEvent event)
{
m_bSelectionChanged = true;
}
else if (event == eNotify_OnEditModeChange)
{
int emode = GetIEditor()->GetEditMode();
switch (emode)
{
case eEditModeMove:
ui->m_setVector->setToolTip(tr("Set Position of Selected Objects"));
break;
case eEditModeRotate:
ui->m_setVector->setToolTip(tr("Set Rotation of Selected Objects"));
break;
case eEditModeScale:
ui->m_setVector->setToolTip(tr("Set Scale of Selected Objects"));
break;
default:
ui->m_setVector->setToolTip(tr("Set Position/Rotation/Scale of Selected Objects (None Selected)"));
break;
}
}
}
//////////////////////////////////////////////////////////////////////////
void CInfoBar::OnVectorChanged()
{
SetVector(GetVector());
OnVectorUpdate(false);
}
void CInfoBar::OnVectorUpdate(bool followTerrain)
{
int emode = GetIEditor()->GetEditMode();
if (emode != eEditModeMove && emode != eEditModeRotate && emode != eEditModeScale)
{
return;
}
Vec3 v = GetVector();
ITransformManipulator* pManipulator = GetIEditor()->GetTransformManipulator();
if (pManipulator)
{
return;
}
CSelectionGroup* selection = GetIEditor()->GetObjectManager()->GetSelection();
if (selection->IsEmpty())
{
return;
}
GetIEditor()->RestoreUndo();
int referenceCoordSys = GetIEditor()->GetReferenceCoordSys();
CBaseObject* obj = GetIEditor()->GetSelectedObject();
Matrix34 tm;
AffineParts ap;
if (obj)
{
tm = obj->GetWorldTM();
ap.SpectralDecompose(tm);
}
if (emode == eEditModeMove)
{
if (obj)
{
if (referenceCoordSys == COORDS_WORLD)
{
tm.SetTranslation(v);
obj->SetWorldTM(tm);
}
else
{
obj->SetPos(v);
}
}
else
{
GetIEditor()->GetSelection()->MoveTo(v, followTerrain ? CSelectionGroup::eMS_FollowTerrain : CSelectionGroup::eMS_None, referenceCoordSys);
}
}
if (emode == eEditModeRotate)
{
if (obj)
{
AZ::Vector3 av = LYVec3ToAZVec3(v);
AZ::Transform tr = AZ::ConvertEulerDegreesToTransform(av);
Matrix34 lyTransform = AZTransformToLYTransform(tr);
AffineParts newap;
newap.SpectralDecompose(lyTransform);
if (referenceCoordSys == COORDS_WORLD)
{
tm = Matrix34::Create(ap.scale, newap.rot, ap.pos);
obj->SetWorldTM(tm);
}
else
{
obj->SetRotation(newap.rot);
}
}
else
{
CBaseObject *refObj;
CSelectionGroup* pGroup = GetIEditor()->GetSelection();
if (pGroup && pGroup->GetCount() > 0)
{
refObj = pGroup->GetObject(0);
AffineParts ap2;
ap2.SpectralDecompose(refObj->GetWorldTM());
Vec3 oldEulerRotation = AZVec3ToLYVec3(AZ::ConvertQuaternionToEulerDegrees(LYQuaternionToAZQuaternion(ap2.rot)));
Vec3 diff = v - oldEulerRotation;
GetIEditor()->GetSelection()->Rotate((Ang3)diff, referenceCoordSys);
}
}
}
if (emode == eEditModeScale)
{
if (v.x == 0 || v.y == 0 || v.z == 0)
{
return;
}
if (obj)
{
if (referenceCoordSys == COORDS_WORLD)
{
tm = Matrix34::Create(v, ap.rot, ap.pos);
obj->SetWorldTM(tm);
}
else
{
obj->SetScale(v);
}
}
else
{
GetIEditor()->GetSelection()->SetScale(v, referenceCoordSys);
}
}
}
void CInfoBar::IdleUpdate()
@@ -375,21 +191,6 @@ void CInfoBar::IdleUpdate()
Vec3 marker = GetIEditor()->GetMarkerPosition();
/*
// Get active viewport.
int hx = marker.x / 2;
int hy = marker.y / 2;
if (m_heightMapX != hx || m_heightMapY != hy)
{
m_heightMapX = hx;
m_heightMapY = hy;
updateUI = true;
}
*/
RefCoordSys coordSys = GetIEditor()->GetReferenceCoordSys();
bool bWorldSpace = GetIEditor()->GetReferenceCoordSys() == COORDS_WORLD;
CSelectionGroup* selection = GetIEditor()->GetSelection();
if (selection->GetCount() != m_numSelected)
{
@@ -447,198 +248,11 @@ void CInfoBar::IdleUpdate()
}
}
bool bSelLocked = GetIEditor()->IsSelectionLocked();
if (bSelLocked != m_bSelectionLocked)
{
m_bSelectionLocked = bSelLocked;
ui->m_lockSelection->setChecked(m_bSelectionLocked);
}
if (GetIEditor()->GetSelection()->IsEmpty())
{
if (ui->m_lockSelection->isEnabled())
{
ui->m_lockSelection->setEnabled(false);
}
}
else
{
if (!ui->m_lockSelection->isEnabled())
{
ui->m_lockSelection->setEnabled(true);
}
}
//////////////////////////////////////////////////////////////////////////
// Update vector.
//////////////////////////////////////////////////////////////////////////
Vec3 v(0, 0, 0);
bool enable = false;
float min = 0, max = 10000;
int emode = GetIEditor()->GetEditMode();
ITransformManipulator* pManipulator = GetIEditor()->GetTransformManipulator();
if (pManipulator)
{
AffineParts ap;
ap.SpectralDecompose(pManipulator->GetTransformation(coordSys));
if (emode == eEditModeMove)
{
v = ap.pos;
enable = true;
min = -64000;
max = 64000;
}
if (emode == eEditModeRotate)
{
v = Vec3(RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(ap.rot))));
enable = true;
min = -10000;
max = 10000;
}
if (emode == eEditModeScale)
{
v = ap.scale;
enable = true;
min = -10000;
max = 10000;
}
}
else
{
if (selection->IsEmpty())
{
// Show marker position.
EnableVector(false);
SetVector(marker);
SetVectorRange(-100000, 100000);
return;
}
CBaseObject* obj = GetIEditor()->GetSelectedObject();
if (!obj)
{
CSelectionGroup* pGroup = GetIEditor()->GetSelection();
if (pGroup && pGroup->GetCount() > 0)
{
obj = pGroup->GetObject(0);
}
}
if (obj)
{
v = obj->GetWorldPos();
}
if (emode == eEditModeMove)
{
if (obj)
{
if (bWorldSpace)
{
v = obj->GetWorldTM().GetTranslation();
}
else
{
v = obj->GetPos();
}
}
enable = true;
min = -64000;
max = 64000;
}
if (emode == eEditModeRotate)
{
if (obj)
{
Quat objRot;
if (bWorldSpace)
{
AffineParts ap;
ap.SpectralDecompose(obj->GetWorldTM());
objRot = ap.rot;
}
else
{
objRot = obj->GetRotation();
}
// Always convert objRot to v in order to ensure that the inspector and info bar are always in sync
v = AZVec3ToLYVec3(AZ::ConvertQuaternionToEulerDegrees(LYQuaternionToAZQuaternion(objRot)));
}
enable = true;
min = -10000;
max = 10000;
}
if (emode == eEditModeScale)
{
if (obj)
{
if (bWorldSpace)
{
AffineParts ap;
ap.SpectralDecompose(obj->GetWorldTM());
v = ap.scale;
}
else
{
v = obj->GetScale();
}
}
enable = true;
min = -10000;
max = 10000;
}
}
bool updateDisplayVector = (m_currValue != v);
// If Edit mode changed.
if (m_prevEditMode != emode)
{
// Scale mode enables vector lock.
SetVectorLock(emode == eEditModeScale);
// Change undo strings.
QString undoString("Modify Object(s)");
int mode = GetIEditor()->GetEditMode();
switch (mode)
{
case eEditModeMove:
undoString = QStringLiteral("Move Object(s)");
break;
case eEditModeRotate:
undoString = QStringLiteral("Rotate Object(s)");
break;
case eEditModeScale:
undoString = QStringLiteral("Scale Object(s)");
break;
}
// edit mode changed, we must update the number values
updateDisplayVector = true;
}
SetVectorRange(min, max);
EnableVector(enable);
// if our selection changed, or if our display values are out of date
if (m_bSelectionChanged)
{
updateDisplayVector = true;
m_bSelectionChanged = false;
}
if (updateDisplayVector)
{
SetVector(v);
}
m_prevEditMode = emode;
}
inline double Round(double fVal, double fStep)
@@ -650,71 +264,6 @@ inline double Round(double fVal, double fStep)
return fVal;
}
void CInfoBar::SetVector(const Vec3& v)
{
if (!m_bDragMode)
{
m_lastValue = m_currValue;
}
if (m_currValue != v)
{
ui->m_posCtrl->setValuebyIndex(v.x, 0);
ui->m_posCtrl->setValuebyIndex(v.y, 1);
ui->m_posCtrl->setValuebyIndex(v.z, 2);
m_currValue = v;
}
}
Vec3 CInfoBar::GetVector()
{
Vec3 v;
v.x = ui->m_posCtrl->getElements()[0]->getValue();
v.y = ui->m_posCtrl->getElements()[1]->getValue();
v.z = ui->m_posCtrl->getElements()[2]->getValue();
m_currValue = v;
return v;
}
void CInfoBar::EnableVector(bool enable)
{
if (m_enabledVector != enable)
{
m_enabledVector = enable;
ui->m_posCtrl->setEnabled(enable);
ui->m_vectorLock->setEnabled(enable);
ui->m_setVector->setEnabled(enable);
}
}
void CInfoBar::SetVectorLock(bool bVectorLock)
{
m_bVectorLock = bVectorLock;
ui->m_vectorLock->setChecked(bVectorLock);
GetIEditor()->SetAxisVectorLock(bVectorLock);
}
void CInfoBar::SetVectorRange(float min, float max)
{
// Worth noting that this gets called every IdleUpdate, so it is necessary to make sure
// setting the min/max doesn't result in the Qt event queue being pumped
ui->m_posCtrl->setMinimum(min);
ui->m_posCtrl->setMaximum(max);
}
void CInfoBar::OnVectorLock()
{
SetVectorLock(!m_bVectorLock);
}
void CInfoBar::OnLockSelection()
{
bool newLockSelectionValue = !m_bSelectionLocked;
m_bSelectionLocked = newLockSelectionValue;
ui->m_lockSelection->setChecked(newLockSelectionValue);
GetIEditor()->LockSelection(newLockSelectionValue);
}
void CInfoBar::OnUpdateMoveSpeedText(const QString& text)
{
gSettings.cameraMoveSpeed = aznumeric_cast<float>(Round(text.toDouble(), m_speedStep));
@@ -730,12 +279,6 @@ void CInfoBar::OnInitDialog()
QFontMetrics metrics({});
int width = metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier;
ui->m_posCtrl->setEnabled(false);
ui->m_posCtrl->getElements()[0]->setFixedWidth(width);
ui->m_posCtrl->getElements()[1]->setFixedWidth(width);
ui->m_posCtrl->getElements()[2]->setFixedWidth(width);
ui->m_setVector->setEnabled(false);
ui->m_moveSpeed->setFixedWidth(width);
ui->m_physicsBtn->setEnabled(false);
@@ -809,12 +352,6 @@ void CInfoBar::OnBnClickedGotoPosition()
emit ActionTriggered(ID_DISPLAY_GOTOPOSITION);
}
//////////////////////////////////////////////////////////////////////////
void CInfoBar::OnBnClickedSetVector()
{
emit ActionTriggered(ID_DISPLAY_SETVECTOR);
}
//////////////////////////////////////////////////////////////////////////
void CInfoBar::OnBnClickedMuteAudio()
{
-20
View File
@@ -59,24 +59,9 @@ protected:
virtual void OnOK() {};
virtual void OnCancel() {};
void OnVectorUpdate(bool followTerrain);
// this gets called by stepper or text edit changes
void OnVectorChanged();
void SetVector(const Vec3& v);
void SetVectorRange(float min, float max);
Vec3 GetVector();
void EnableVector(bool enable);
void SetVectorLock(bool bVectorLock);
void OnBnClickedSyncplayer();
void OnBnClickedGotoPosition();
void OnVectorLock();
void OnLockSelection();
void OnBnClickedSetVector();
void OnSpeedComboBoxEnter();
void OnUpdateMoveSpeedText(const QString&);
void OnBnClickedTerrainCollision();
@@ -98,13 +83,10 @@ protected:
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
bool m_enabledVector;
float m_width, m_height;
//int m_heightMapX,m_heightMapY;
double m_fieldWidthMultiplier = 1.8;
int m_prevEditMode;
int m_numSelected;
float m_prevMoveSpeed;
@@ -117,8 +99,6 @@ protected:
// Speed presets
float m_speedPresetValues[3] = { 0.1f, 1.0f, 10.0f };
bool m_bVectorLock;
bool m_bSelectionLocked;
bool m_bSelectionChanged;
bool m_bDragMode;
-105
View File
@@ -57,42 +57,6 @@
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::VectorInput" name="m_posCtrl" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Position</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="m_setVector">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>XYZ</string>
</property>
<property name="icon">
<iconset resource="InfoBar.qrc">
<normaloff>:/InfoBar/XYZ-default.svg</normaloff>:/InfoBar/XYZ-default.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="m_gotoPos">
<property name="sizePolicy">
@@ -135,68 +99,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="m_lockSelection">
<property name="toolTip">
<string>Lock Object Selection</string>
</property>
<property name="text">
<string>Lock Selection</string>
</property>
<property name="icon">
<iconset resource="InfoBar.qrc">
<normaloff>:/InfoBar/LockSelection-default.svg</normaloff>:/InfoBar/LockSelection-default.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="m_vectorLock">
<property name="toolTip">
<string>Lock Scale Axis Vectors</string>
</property>
<property name="text">
<string>Lock Scale</string>
</property>
<property name="icon">
<iconset resource="InfoBar.qrc">
<normaloff>:/InfoBar/LockScale-default.svg</normaloff>:/InfoBar/LockScale-default.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
@@ -424,13 +326,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AzQtComponents::VectorInput</class>
<extends>QWidget</extends>
<header location="global">AzQtComponents/Components/Widgets/VectorInput.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="InfoBar.qrc"/>
</resources>
+1 -3
View File
@@ -20,7 +20,7 @@ class CEditorMock
: public IEditor
{
public:
// GMock does not work with a variadic function (https://github.com/google/googlemock/blob/master/googlemock/docs/FrequentlyAskedQuestions.md)
// GMock does not work with a variadic function
void ExecuteCommand(const char* sCommand, ...) override
{
va_list args;
@@ -123,8 +123,6 @@ public:
MOCK_METHOD0(GetRuler, CRuler* ());
MOCK_METHOD1(SetOperationMode, void(EOperationMode ));
MOCK_METHOD0(GetOperationMode, EOperationMode());
MOCK_METHOD1(SetEditMode, void(int ));
MOCK_METHOD0(GetEditMode, int());
MOCK_METHOD1(ShowTransformManipulator, ITransformManipulator* (bool));
MOCK_METHOD0(GetTransformManipulator, ITransformManipulator* ());
MOCK_METHOD1(SetAxisConstraints, void(AxisConstrains ));
@@ -151,9 +151,6 @@ namespace EditorPythonBindingsUnitTests
EXPECT_TRUE(behaviorContext->m_methods.find("get_axis_constraint") != behaviorContext->m_methods.end());
EXPECT_TRUE(behaviorContext->m_methods.find("set_axis_constraint") != behaviorContext->m_methods.end());
EXPECT_TRUE(behaviorContext->m_methods.find("get_edit_mode") != behaviorContext->m_methods.end());
EXPECT_TRUE(behaviorContext->m_methods.find("set_edit_mode") != behaviorContext->m_methods.end());
EXPECT_TRUE(behaviorContext->m_methods.find("get_pak_from_file") != behaviorContext->m_methods.end());
EXPECT_TRUE(behaviorContext->m_methods.find("log") != behaviorContext->m_methods.end());
@@ -200,8 +197,6 @@ namespace EditorPythonBindingsUnitTests
EXPECT_TRUE(behaviorBus->m_events.find("OpenFileBox") != behaviorBus->m_events.end());
EXPECT_TRUE(behaviorBus->m_events.find("GetAxisConstraint") != behaviorBus->m_events.end());
EXPECT_TRUE(behaviorBus->m_events.find("SetAxisConstraint") != behaviorBus->m_events.end());
EXPECT_TRUE(behaviorBus->m_events.find("GetEditMode") != behaviorBus->m_events.end());
EXPECT_TRUE(behaviorBus->m_events.find("SetEditMode") != behaviorBus->m_events.end());
EXPECT_TRUE(behaviorBus->m_events.find("GetPakFromFile") != behaviorBus->m_events.end());
EXPECT_TRUE(behaviorBus->m_events.find("Log") != behaviorBus->m_events.end());
EXPECT_TRUE(behaviorBus->m_events.find("Undo") != behaviorBus->m_events.end());
@@ -1,92 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "EditorDefs.h"
#include <AzTest/AzTest.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <SetVectorDlg.h>
using namespace AZ;
using namespace ::testing;
namespace UnitTest
{
class TestSetVectorDlg
: public ::testing::Test
{
public:
};
const float SetVectorDlgNearTolerance = 0.0001f;
TEST_F(TestSetVectorDlg, GetVectorFromString_ThreeParams_Success)
{
QString testStr{ "1,2,3" };
Vec3 result{ 0, 0, 0 };
result = CSetVectorDlg::GetVectorFromString(testStr);
EXPECT_NEAR(result[0], 1.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[1], 2.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[2], 3.0f, SetVectorDlgNearTolerance);
}
TEST_F(TestSetVectorDlg, GetVectorFromString_FourParams_ThreeParsed)
{
QString testStr{ "1,2,3,4" };
Vec3 result{ 0, 0, 0 };
result = CSetVectorDlg::GetVectorFromString(testStr);
EXPECT_NEAR(result[0], 1.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[1], 2.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[2], 3.0f, SetVectorDlgNearTolerance);
}
TEST_F(TestSetVectorDlg, GetVectorFromString_TwoParams_ThirdZero)
{
QString testStr{ "1,2" };
Vec3 result{ 0, 0, 0 };
result = CSetVectorDlg::GetVectorFromString(testStr);
EXPECT_NEAR(result[0], 1.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[1], 2.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[2], 0.0f, SetVectorDlgNearTolerance);
}
TEST_F(TestSetVectorDlg, GetVectorFromString_NoParams_AllZero)
{
QString testStr;
Vec3 result{ 0, 0, 0 };
result = CSetVectorDlg::GetVectorFromString(testStr);
EXPECT_NEAR(result[0], 0.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[1], 0.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[2], 0.0f, SetVectorDlgNearTolerance);
}
TEST_F(TestSetVectorDlg, GetVectorFromString_BadStrings_AllZero)
{
QString testStr{ "some,illegal,strings" };
Vec3 resultExpected{ 0, 1, 0 };
auto result = CSetVectorDlg::GetVectorFromString(testStr);
EXPECT_NEAR(result[0], 0.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[1], 0.0f, SetVectorDlgNearTolerance);
EXPECT_NEAR(result[2], 0.0f, SetVectorDlgNearTolerance);
}
} // namespace UnitTest
-140
View File
@@ -750,11 +750,6 @@ void MainWindow::InitActions()
am->AddAction(ID_TOOLBAR_SEPARATOR, QString());
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_TOOLBAR_WIDGET_REF_COORD, QString());
}
am->AddAction(ID_TOOLBAR_WIDGET_UNDO, QString());
am->AddAction(ID_TOOLBAR_WIDGET_REDO, QString());
am->AddAction(ID_TOOLBAR_WIDGET_SNAP_ANGLE, QString());
@@ -996,18 +991,6 @@ void MainWindow::InitActions()
am->AddAction(ID_EDIT_RENAMEOBJECT, tr("Rename Object(s)..."))
.SetStatusTip(tr("Rename Object"));
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_EDITMODE_SELECT, tr("Select mode"))
.SetIcon(Style::icon("Select"))
.SetApplyHoverEffect()
.SetShortcut(tr("1"))
.SetToolTip(tr("Select mode (1)"))
.SetCheckable(true)
.SetStatusTip(tr("Select object(s)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeSelect);
}
am->AddAction(ID_EDITMODE_MOVE, tr("Move"))
.SetIcon(Style::icon("Move"))
.SetApplyHoverEffect()
@@ -1033,69 +1016,6 @@ void MainWindow::InitActions()
.SetStatusTip(tr("Select and scale selected object(s)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeScale);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
am->AddAction(ID_EDITMODE_SELECTAREA, tr("Select terrain"))
.SetIcon(Style::icon("Select_terrain"))
.SetApplyHoverEffect()
.SetShortcut(tr("5"))
.SetToolTip(tr("Select terrain (5)"))
.SetCheckable(true)
.SetStatusTip(tr("Switch to terrain selection mode"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeSelectarea);
am->AddAction(ID_SELECT_AXIS_X, tr("Constrain to X axis"))
.SetIcon(Style::icon("X_axis"))
.SetApplyHoverEffect()
.SetShortcut(tr("Ctrl+1"))
.SetToolTip(tr("Constrain to X axis (Ctrl+1)"))
.SetCheckable(true)
.SetStatusTip(tr("Lock movement on X axis"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisX);
am->AddAction(ID_SELECT_AXIS_Y, tr("Constrain to Y axis"))
.SetIcon(Style::icon("Y_axis"))
.SetApplyHoverEffect()
.SetShortcut(tr("Ctrl+2"))
.SetToolTip(tr("Constrain to Y axis (Ctrl+2)"))
.SetCheckable(true)
.SetStatusTip(tr("Lock movement on Y axis"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisY);
am->AddAction(ID_SELECT_AXIS_Z, tr("Constrain to Z axis"))
.SetIcon(Style::icon("Z_axis"))
.SetApplyHoverEffect()
.SetShortcut(tr("Ctrl+3"))
.SetToolTip(tr("Constrain to Z axis (Ctrl+3)"))
.SetCheckable(true)
.SetStatusTip(tr("Lock movement on Z axis"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisZ);
am->AddAction(ID_SELECT_AXIS_XY, tr("Constrain to XY plane"))
.SetIcon(Style::icon("XY2_copy"))
.SetApplyHoverEffect()
.SetShortcut(tr("Ctrl+4"))
.SetToolTip(tr("Constrain to XY plane (Ctrl+4)"))
.SetCheckable(true)
.SetStatusTip(tr("Lock movement on XY plane"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisXy);
am->AddAction(ID_SELECT_AXIS_TERRAIN, tr("Constrain to terrain/geometry"))
.SetIcon(Style::icon("Object_follow_terrain"))
.SetApplyHoverEffect()
.SetShortcut(tr("Ctrl+5"))
.SetToolTip(tr("Constrain to terrain/geometry (Ctrl+5)"))
.SetCheckable(true)
.SetStatusTip(tr("Lock object movement to follow terrain"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisTerrain);
am->AddAction(ID_SELECT_AXIS_SNAPTOALL, tr("Follow terrain and snap to objects"))
.SetIcon(Style::icon("Follow_terrain"))
.SetApplyHoverEffect()
.SetShortcut(tr("Ctrl+6"))
.SetToolTip(tr("Follow terrain and snap to objects (Ctrl+6)"))
.SetCheckable(true)
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelectAxisSnapToAll);
am->AddAction(ID_OBJECTMODIFY_ALIGNTOGRID, tr("Align to grid"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelected)
.SetIcon(Style::icon("Align_to_grid"))
.SetApplyHoverEffect();
}
am->AddAction(ID_SNAP_TO_GRID, tr("Snap to grid"))
.SetIcon(Style::icon("Grid"))
.SetApplyHoverEffect()
@@ -1154,7 +1074,6 @@ void MainWindow::InitActions()
am->AddAction(ID_CHANGEMOVESPEED_CHANGESTEP, tr("Change Step"))
.SetStatusTip(tr("Change Flycam Movement Step"));
am->AddAction(ID_DISPLAY_GOTOPOSITION, tr("Go to Position..."));
am->AddAction(ID_DISPLAY_SETVECTOR, tr("Display Set Vector"));
am->AddAction(ID_MODIFY_GOTO_SELECTION, tr("Center on Selection"))
.SetShortcut(tr("Z"))
.SetToolTip(tr("Center on Selection (Z)"))
@@ -1501,62 +1420,6 @@ void MainWindow::InitToolBars()
AdjustToolBarIconSize(static_cast<AzQtComponents::ToolBar::ToolBarIconSize>(gSettings.gui.nToolbarIconSize));
}
QComboBox* MainWindow::CreateRefCoordComboBox()
{
// ID_REF_COORDS_SYS;
auto coordSysCombo = new RefCoordComboBox(this);
connect(this, &MainWindow::ToggleRefCoordSys, coordSysCombo, &RefCoordComboBox::ToggleRefCoordSys);
connect(this, &MainWindow::UpdateRefCoordSys, coordSysCombo, &RefCoordComboBox::UpdateRefCoordSys);
return coordSysCombo;
}
RefCoordComboBox::RefCoordComboBox(QWidget* parent)
: QComboBox(parent)
{
addItems(coordSysList());
setCurrentIndex(0);
connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [](int index)
{
if (index >= 0 && index < LAST_COORD_SYSTEM)
{
RefCoordSys coordSys = (RefCoordSys)index;
if (GetIEditor()->GetReferenceCoordSys() != index)
{
GetIEditor()->SetReferenceCoordSys(coordSys);
}
}
});
UpdateRefCoordSys();
}
QStringList RefCoordComboBox::coordSysList() const
{
static QStringList list = { tr("View"), tr("Local"), tr("Parent"), tr("World"), tr("Custom") };
return list;
}
void RefCoordComboBox::UpdateRefCoordSys()
{
RefCoordSys coordSys = GetIEditor()->GetReferenceCoordSys();
if (coordSys >= 0 && coordSys < LAST_COORD_SYSTEM)
{
setCurrentIndex(coordSys);
}
}
void RefCoordComboBox::ToggleRefCoordSys()
{
QStringList coordSys = coordSysList();
const int localIndex = coordSys.indexOf(tr("Local"));
const int worldIndex = coordSys.indexOf(tr("World"));
const int newIndex = currentIndex() == localIndex ? worldIndex : localIndex;
setCurrentIndex(newIndex);
}
QToolButton* MainWindow::CreateUndoRedoButton(int command)
{
// We do either undo or redo below, sort that out here
@@ -2529,9 +2392,6 @@ QWidget* MainWindow::CreateToolbarWidget(int actionId)
case ID_TOOLBAR_WIDGET_REDO:
w = CreateUndoRedoButton(ID_REDO);
break;
case ID_TOOLBAR_WIDGET_REF_COORD:
w = CreateRefCoordComboBox();
break;
case ID_TOOLBAR_WIDGET_SNAP_GRID:
w = CreateSnapToGridWidget();
break;
-15
View File
@@ -77,19 +77,6 @@ namespace AzToolsFramework
// Subclassing so we can add slots to our toolbar widgets
// Using lambdas is crashy since the lamdba doesn't know when the widget is deleted.
class RefCoordComboBox
: public QComboBox
{
Q_OBJECT
public:
explicit RefCoordComboBox(QWidget* parent);
public Q_SLOTS:
void ToggleRefCoordSys();
void UpdateRefCoordSys();
private:
QStringList coordSysList() const;
};
class UndoRedoToolButton
: public QToolButton
{
@@ -230,8 +217,6 @@ private:
QWidget* CreateSnapToAngleWidget();
QWidget* CreateSpacerRightWidget();
QComboBox* CreateRefCoordComboBox();
QToolButton* CreateUndoRedoButton(int command);
QToolButton* CreateEnvironmentModeButton();
+1 -208
View File
@@ -137,36 +137,6 @@ void CAxisGizmo::GetWorldBounds(AABB& bbox)
void CAxisGizmo::DrawAxis(DisplayContext& dc)
{
m_pAxisHelper->SetHighlightAxis(m_highlightAxis);
// Only enable axis planes when editor is in Move mode.
int nEditMode = GetIEditor()->GetEditMode();
int nModeFlags = 0;
switch (nEditMode)
{
case eEditModeMove:
nModeFlags |= CAxisHelper::MOVE_MODE;
break;
case eEditModeRotate:
nModeFlags |= CAxisHelper::ROTATE_MODE;
nModeFlags &= ~(CAxisHelper::ROTATE_CIRCLE_MODE);
break;
case eEditModeRotateCircle:
nModeFlags |= CAxisHelper::ROTATE_CIRCLE_MODE;
nModeFlags &= ~(CAxisHelper::ROTATE_MODE);
break;
case eEditModeScale:
nModeFlags |= CAxisHelper::SCALE_MODE;
break;
case eEditModeSelect:
nModeFlags |= CAxisHelper::SELECT_MODE;
break;
case eEditModeSelectArea:
nModeFlags |= CAxisHelper::SELECT_MODE;
break;
}
//nModeFlags |= CAxisHelper::MOVE_MODE | CAxisHelper::ROTATE_MODE | CAxisHelper::SCALE_MODE;
m_pAxisHelper->SetMode(nModeFlags);
Matrix34 tm = GetTransformation(m_bAlwaysUseLocal ? COORDS_LOCAL : GetIEditor()->GetReferenceCoordSys(), dc.view);
m_pAxisHelper->DrawAxis(tm, GetIEditor()->GetGlobalGizmoParameters(), dc);
@@ -177,21 +147,6 @@ void CAxisGizmo::DrawAxis(DisplayContext& dc)
m_pAxisHelper->DrawDome(tm, GetIEditor()->GetGlobalGizmoParameters(), dc, objectBox);
}
//////////////////////////////////////////////////////////////////////////
// Draw extended infinite-axis gizmo
//////////////////////////////////////////////////////////////////////////
if (!(dc.flags & DISPLAY_2D) &&
(nModeFlags == CAxisHelper::MOVE_MODE ||
nModeFlags == CAxisHelper::ROTATE_MODE))
{
bool bClickedShift = CheckVirtualKey(Qt::Key_Shift);
if (bClickedShift && (m_axisGizmoCount == 1 || m_highlightAxis || (m_axisGizmoCount == 2 && m_object && m_object->IsSkipSelectionHelper())))
{
bool bClickedAlt = CheckVirtualKey(Qt::Key_Menu);
bool bUsePhysicalProxy = !bClickedAlt;
m_pAxisHelperExtended->DrawAxes(dc, tm, bUsePhysicalProxy);
}
}
}
//////////////////////////////////////////////////////////////////////////
@@ -324,7 +279,7 @@ Matrix34 CAxisGizmo::GetTransformation(RefCoordSys coordSys, IDisplayViewport* v
}
//////////////////////////////////////////////////////////////////////////
bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, int nFlags)
bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, [[maybe_unused]] int nFlags)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
@@ -364,22 +319,6 @@ bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point
m_cMouseDownPos = point;
m_initPos = GetTransformation(COORDS_WORLD).GetTranslation();
switch (hc.manipulatorMode)
{
case 1:
view->SetCurrentCursor(STD_CURSOR_MOVE);
GetIEditor()->SetEditMode(eEditModeMove);
break;
case 2:
view->SetCurrentCursor(STD_CURSOR_ROTATE);
GetIEditor()->SetEditMode(eEditModeRotate);
break;
case 3:
view->SetCurrentCursor(STD_CURSOR_SCALE);
GetIEditor()->SetEditMode(eEditModeScale);
break;
}
return true;
}
}
@@ -387,152 +326,6 @@ bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point
{
if (m_bDragging)
{
bool bCallBack = true;
Vec3 vDragValue(0, 0, 0);
// Dragging transform manipulator.
switch (GetIEditor()->GetEditMode())
{
case eEditModeMove:
{
view->SetCurrentCursor(STD_CURSOR_MOVE);
if (view->GetAxisConstrain() == AXIS_TERRAIN)
{
if (nFlags & MK_CONTROL)
{
bool bCollideWithTerrain;
Vec3 posOnTerrain = view->ViewToWorld(point, &bCollideWithTerrain, true);
if (!bCollideWithTerrain)
{
return true;
}
vDragValue = posOnTerrain - m_initPos;
}
else
{
Vec3 p1 = view->SnapToGrid(view->ViewToWorld(m_cMouseDownPos));
Vec3 p2 = view->SnapToGrid(view->ViewToWorld(point));
vDragValue = p2 - p1;
vDragValue.z = 0;
}
}
else
{
Vec3 p1 = view->MapViewToCP(m_cMouseDownPos);
Vec3 p2 = view->MapViewToCP(point);
if (p1.IsZero() || p2.IsZero())
{
return true;
}
vDragValue = view->GetCPVector(p1, p2);
}
}
break;
case eEditModeRotate:
{
view->SetCurrentCursor(STD_CURSOR_ROTATE);
Ang3 ang(0, 0, 0);
float ax = (point.x() - m_cMouseDownPos.x());
float ay = (point.y() - m_cMouseDownPos.y());
switch (view->GetAxisConstrain())
{
case AXIS_X:
ang.x = ay;
break;
case AXIS_Y:
ang.y = ay;
break;
case AXIS_Z:
ang.z = ay;
break;
case AXIS_XY:
ang(ax, ay, 0);
break;
case AXIS_XZ:
ang(ax, 0, ay);
break;
case AXIS_YZ:
ang(0, ay, ax);
break;
case AXIS_TERRAIN:
ang(ax, ay, 0);
break;
}
;
ang = gSettings.pGrid->SnapAngle(ang);
vDragValue = Vec3(DEG2RAD(ang));
}
break;
case eEditModeScale:
{
Vec3 scl(0, 0, 0);
float ay = 1.0f - 0.01f * (point.y() - m_cMouseDownPos.y());
if (ay < 0.01f)
{
ay = 0.01f;
}
scl(ay, ay, ay);
switch (view->GetAxisConstrain())
{
case AXIS_X:
scl(ay, 1, 1);
break;
case AXIS_Y:
scl(1, ay, 1);
break;
case AXIS_Z:
scl(1, 1, ay);
break;
case AXIS_XY:
scl(ay, ay, ay);
break;
case AXIS_XZ:
scl(ay, ay, ay);
break;
case AXIS_YZ:
scl(ay, ay, ay);
break;
case AXIS_XYZ:
scl(ay, ay, ay);
break;
case AXIS_TERRAIN:
scl(ay, ay, ay);
break;
}
;
view->SetCurrentCursor(STD_CURSOR_SCALE);
vDragValue = scl;
}
break;
case eEditModeRotateCircle:
{
Matrix34 tm = GetTransformation(m_bAlwaysUseLocal ? COORDS_LOCAL : GetIEditor()->GetReferenceCoordSys());
Vec3 v0, v1;
Vec3 vHitNormal;
if (m_pAxisHelper->HitTestForRotationCircle(tm, view, m_cMouseDownPos, 0.05f, &v0, &vHitNormal) && m_pAxisHelper->HitTestForRotationCircle(tm, view, point, 2.0f, &v1, &vHitNormal))
{
Vec3 vDir0 = (v0 - tm.GetTranslation()).GetNormalized();
Vec3 vDir1 = (v1 - tm.GetTranslation()).GetNormalized();
Vec3 vCurlDir = vDir0.Cross(vDir1).GetNormalized();
if (vHitNormal.Dot(vCurlDir) > 0)
{
vDragValue = Vec3(std::acos(vDir0.Dot(vDir1)), 0, 0);
}
else
{
vDragValue = Vec3(-std::acos(vDir0.Dot(vDir1)), 0, 0);
}
}
else
{
bCallBack = false;
}
}
break;
}
return true;
}
else
@@ -139,16 +139,6 @@ namespace AzToolsFramework
*/
virtual void SetAxisConstraint(AZStd::string_view pConstrain) = 0;
/*
* Gets edit mode.
*/
virtual const char* GetEditMode() = 0;
/*
* Sets edit mode.
*/
virtual void SetEditMode(AZStd::string_view pEditMode) = 0;
/*
* Finds a pak file name for a given file.
*/
-77
View File
@@ -688,68 +688,6 @@ namespace
}
}
//////////////////////////////////////////////////////////////////////////
// Edit Mode
//////////////////////////////////////////////////////////////////////////
const char* PyGetEditMode()
{
int actualEditMode = GetIEditor()->GetEditMode();
switch (actualEditMode)
{
case eEditModeSelect:
return "SELECT";
case eEditModeSelectArea:
return "SELECTAREA";
case eEditModeMove:
return "MOVE";
case eEditModeRotate:
return "ROTATE";
case eEditModeScale:
return "SCALE";
case eEditModeTool:
return "TOOL";
default:
throw std::logic_error("Invalid edit mode.");
}
}
void PySetEditMode(AZStd::string_view pEditMode)
{
if (pEditMode == "MOVE")
{
GetIEditor()->SetEditMode(eEditModeMove);
}
else if (pEditMode == "ROTATE")
{
GetIEditor()->SetEditMode(eEditModeRotate);
}
else if (pEditMode == "SCALE")
{
GetIEditor()->SetEditMode(eEditModeScale);
}
else if (pEditMode == "SELECT")
{
GetIEditor()->SetEditMode(eEditModeSelect);
}
else if (pEditMode == "SELECTAREA")
{
GetIEditor()->SetEditMode(eEditModeSelectArea);
}
else if (pEditMode == "TOOL")
{
GetIEditor()->SetEditMode(eEditModeTool);
}
else if (pEditMode == "RULER")
{
CRuler* pRuler = GetIEditor()->GetRuler();
pRuler->SetActive(!pRuler->IsActive());
}
else
{
throw std::logic_error("Invalid edit mode.");
}
}
//////////////////////////////////////////////////////////////////////////
const char* PyGetPakFromFile(const char* filename)
{
@@ -1031,8 +969,6 @@ namespace AzToolsFramework
->Event("OpenFileBox", &EditorLayerPythonRequestBus::Events::OpenFileBox)
->Event("GetAxisConstraint", &EditorLayerPythonRequestBus::Events::GetAxisConstraint)
->Event("SetAxisConstraint", &EditorLayerPythonRequestBus::Events::SetAxisConstraint)
->Event("GetEditMode", &EditorLayerPythonRequestBus::Events::GetEditMode)
->Event("SetEditMode", &EditorLayerPythonRequestBus::Events::SetEditMode)
->Event("GetPakFromFile", &EditorLayerPythonRequestBus::Events::GetPakFromFile)
->Event("Log", &EditorLayerPythonRequestBus::Events::Log)
->Event("Undo", &EditorLayerPythonRequestBus::Events::Undo)
@@ -1168,16 +1104,6 @@ namespace AzToolsFramework
return PySetAxisConstraint(pConstrain);
}
const char* PythonEditorComponent::GetEditMode()
{
return PyGetEditMode();
}
void PythonEditorComponent::SetEditMode(AZStd::string_view pEditMode)
{
return PySetEditMode(pEditMode);
}
const char* PythonEditorComponent::GetPakFromFile(const char* filename)
{
return PyGetPakFromFile(filename);
@@ -1252,9 +1178,6 @@ namespace AzToolsFramework
addLegacyGeneral(behaviorContext->Method("get_axis_constraint", PyGetAxisConstraint, nullptr, "Gets axis."));
addLegacyGeneral(behaviorContext->Method("set_axis_constraint", PySetAxisConstraint, nullptr, "Sets axis."));
addLegacyGeneral(behaviorContext->Method("get_edit_mode", PyGetEditMode, nullptr, "Gets edit mode."));
addLegacyGeneral(behaviorContext->Method("set_edit_mode", PySetEditMode, nullptr, "Sets edit mode."));
addLegacyGeneral(behaviorContext->Method("get_pak_from_file", PyGetPakFromFile, nullptr, "Finds a pak file name for a given file."));
addLegacyGeneral(behaviorContext->Method("log", PyLog, nullptr, "Prints the message to the editor console window."));
-4
View File
@@ -95,10 +95,6 @@ namespace AzToolsFramework
void SetAxisConstraint(AZStd::string_view pConstrain) override;
const char* GetEditMode() override;
void SetEditMode(AZStd::string_view pEditMode) override;
const char* GetPakFromFile(const char* filename) override;
void Log(const char* pMessage) override;
-75
View File
@@ -4301,11 +4301,6 @@ void CRenderViewport::RenderSnappingGrid()
{
return;
}
if (GetIEditor()->GetEditMode() != eEditModeMove
&& GetIEditor()->GetEditMode() != eEditModeRotate)
{
return;
}
CGrid* pGrid = GetViewManager()->GetGrid();
if (pGrid->IsEnabled() == false && pGrid->IsAngleSnapEnabled() == false)
{
@@ -4317,76 +4312,6 @@ void CRenderViewport::RenderSnappingGrid()
int prevState = dc.GetState();
dc.DepthWriteOff();
Vec3 p = pSelGroup->GetObject(0)->GetWorldPos();
AABB bbox;
pSelGroup->GetObject(0)->GetBoundBox(bbox);
float size = 2 * bbox.GetRadius();
float alphaMax = 1.0f, alphaMin = 0.2f;
dc.SetLineWidth(3);
if (GetIEditor()->GetEditMode() == eEditModeMove && pGrid->IsEnabled())
// Draw the translation grid.
{
Vec3 u = m_constructionPlaneAxisX;
Vec3 v = m_constructionPlaneAxisY;
float step = pGrid->scale * pGrid->size;
const int MIN_STEP_COUNT = 5;
const int MAX_STEP_COUNT = 300;
int nSteps = std::min(std::max(FloatToIntRet(size / step), MIN_STEP_COUNT), MAX_STEP_COUNT);
size = nSteps * step;
for (int i = -nSteps; i <= nSteps; ++i)
{
// Draw u lines.
float alphaCur = alphaMax - fabsf(float(i) / float(nSteps)) * (alphaMax - alphaMin);
dc.DrawLine(p + v * (step * i), p + u * size + v * (step * i),
ColorF(0, 0, 0, alphaCur), ColorF(0, 0, 0, alphaMin));
dc.DrawLine(p + v * (step * i), p - u * size + v * (step * i),
ColorF(0, 0, 0, alphaCur), ColorF(0, 0, 0, alphaMin));
// Draw v lines.
dc.DrawLine(p + u * (step * i), p + v * size + u * (step * i),
ColorF(0, 0, 0, alphaCur), ColorF(0, 0, 0, alphaMin));
dc.DrawLine(p + u * (step * i), p - v * size + u * (step * i),
ColorF(0, 0, 0, alphaCur), ColorF(0, 0, 0, alphaMin));
}
}
else if (GetIEditor()->GetEditMode() == eEditModeRotate && pGrid->IsAngleSnapEnabled())
// Draw the rotation grid.
{
int nAxis(GetAxisConstrain());
if (nAxis == AXIS_X || nAxis == AXIS_Y || nAxis == AXIS_Z)
{
RefCoordSys coordSys = GetIEditor()->GetReferenceCoordSys();
Vec3 xAxis(1, 0, 0);
Vec3 yAxis(0, 1, 0);
Vec3 zAxis(0, 0, 1);
Vec3 rotAxis;
if (nAxis == AXIS_X)
{
rotAxis = m_constructionMatrix[coordSys].TransformVector(xAxis);
}
else if (nAxis == AXIS_Y)
{
rotAxis = m_constructionMatrix[coordSys].TransformVector(yAxis);
}
else if (nAxis == AXIS_Z)
{
rotAxis = m_constructionMatrix[coordSys].TransformVector(zAxis);
}
Vec3 anotherAxis = m_constructionPlane.n * size;
float step = pGrid->angleSnap;
int nSteps = FloatToIntRet(180.0f / step);
for (int i = 0; i < nSteps; ++i)
{
AngleAxis rot(i* step* gf_PI / 180.0, rotAxis);
Vec3 dir = rot * anotherAxis;
dc.DrawLine(p, p + dir,
ColorF(0, 0, 0, alphaMax), ColorF(0, 0, 0, alphaMin));
dc.DrawLine(p, p - dir,
ColorF(0, 0, 0, alphaMax), ColorF(0, 0, 0, alphaMin));
}
}
}
dc.SetState(prevState);
}
-11
View File
@@ -141,18 +141,12 @@
#define ID_EDITMODE_ROTATE 33506
#define ID_EDITMODE_SCALE 33507
#define ID_EDITMODE_MOVE 33508
#define ID_EDITMODE_SELECT 33509
#define ID_EDITMODE_SELECTAREA 33510
#define ID_SELECTION_DELETE 33512
#define ID_EDIT_ESCAPE 33513
#define ID_OBJECTMODIFY_SETAREA 33514
#define ID_OBJECTMODIFY_SETHEIGHT 33515
#define ID_OBJECTMODIFY_FREEZE 33517
#define ID_OBJECTMODIFY_UNFREEZE 33518
#define ID_SELECT_AXIS_XY 33520
#define ID_SELECT_AXIS_X 33521
#define ID_SELECT_AXIS_Y 33522
#define ID_SELECT_AXIS_Z 33523
#define ID_UNDO 33524
#define ID_EDIT_CLONE 33525
#define ID_SELECTION_SAVE 33527
@@ -161,7 +155,6 @@
#define ID_EDIT_LEVELDATA 33542
#define ID_FILE_EDITEDITORINI 33543
#define ID_FILE_EDITLOGFILE 33544
#define ID_SELECT_AXIS_TERRAIN 33545
#define ID_PREFERENCES 33546
#define ID_RELOAD_GEOMETRY 33549
#define ID_REDO 33550
@@ -213,7 +206,6 @@
#define ID_TV_NEXTKEY 33603
#define ID_PLAY_LOOP 33607
#define ID_TERRAIN 33611
#define ID_OBJECTMODIFY_ALIGNTOGRID 33619
#define ID_PANEL_VEG_EXPORT 33672
#define ID_PANEL_VEG_IMPORT 33673
#define ID_PANEL_VEG_DISTRIBUTE 33674
@@ -226,7 +218,6 @@
#define ID_PANEL_VEG_ADDCATEGORY 33682
#define ID_PANEL_VEG_RENAMECATEGORY 33683
#define ID_PANEL_VEG_REMOVECATEGORY 33684
#define ID_SELECT_AXIS_SNAPTOALL 33685
#define ID_TOOLS_PREFERENCES 33691
#define ID_EDIT_INVERTSELECTION 33692
#define ID_TOOLTERRAINMODIFY_SMOOTH 33695
@@ -279,7 +270,6 @@
#define ID_DISPLAY_GOTOPOSITION 34004
#define ID_PHYSICS_SIMULATEOBJECTS 34007
#define ID_TERRAIN_TEXTURE_EXPORT 34008
#define ID_DISPLAY_SETVECTOR 34010
#define ID_TV_SEQUENCE_NEW 34049
#define ID_TV_MODE_DOPESHEET 34052
#define ID_VIEW_LAYOUTS 34053
@@ -403,7 +393,6 @@
#define ID_TOOLBAR_WIDGET_FIRST 50003
#define ID_TOOLBAR_WIDGET_UNDO 50003
#define ID_TOOLBAR_WIDGET_REDO 50004
#define ID_TOOLBAR_WIDGET_REF_COORD 50006
#define ID_TOOLBAR_WIDGET_SNAP_ANGLE 50007
#define ID_TOOLBAR_WIDGET_SNAP_GRID 50008
#define ID_TOOLBAR_WIDGET_ENVIRONMENT_MODE 50011
-257
View File
@@ -1,257 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#include "EditorDefs.h"
#include "SetVectorDlg.h"
// Editor
#include "MainWindow.h"
#include "MathConversion.h"
#include "ActionManager.h"
#include "Objects/BaseObject.h"
#include "Objects/SelectionGroup.h"
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include "ui_SetVectorDlg.h"
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
/////////////////////////////////////////////////////////////////////////////
// CSetVectorDlg dialog
CSetVectorDlg::CSetVectorDlg(QWidget* pParent /*=NULL*/)
: QDialog(pParent)
, m_ui(new Ui::SetVectorDlg)
{
m_ui->setupUi(this);
OnInitDialog();
connect(m_ui->buttonOk, &QPushButton::clicked, this, &CSetVectorDlg::accept);
connect(m_ui->buttonCancel, &QPushButton::clicked, this, &CSetVectorDlg::reject);
}
CSetVectorDlg::~CSetVectorDlg()
{
}
/////////////////////////////////////////////////////////////////////////////
// CSetVectorDlg message handlers
void CSetVectorDlg::OnInitDialog()
{
QString editModeString;
int emode = GetIEditor()->GetEditMode();
if (emode == eEditModeMove)
{
editModeString = tr("Position");
}
else if (emode == eEditModeRotate)
{
editModeString = tr("Rotation");
}
else if (emode == eEditModeScale)
{
editModeString = tr("Scale");
}
m_ui->label->setText(tr("Enter %1 here:").arg(editModeString));
currentVec = GetVectorFromEditor();
m_ui->edit->setText(QStringLiteral("%1, %2, %3").arg(currentVec.x, 2, 'f', 2).arg(currentVec.y, 2, 'f', 2).arg(currentVec.z, 2, 'f', 2));
}
void CSetVectorDlg::accept()
{
Vec3 newVec = GetVectorFromText();
SetVector(newVec);
if (GetIEditor()->GetEditMode() == eEditModeMove && currentVec.GetDistance(newVec) > 10.0f)
{
MainWindow::instance()->GetActionManager()->GetAction(ID_GOTO_SELECTED)->trigger();
}
QDialog::accept();
}
Vec3 CSetVectorDlg::GetVectorFromEditor()
{
Vec3 v;
int emode = GetIEditor()->GetEditMode();
CBaseObject* obj = GetIEditor()->GetSelectedObject();
bool bWorldSpace = GetIEditor()->GetReferenceCoordSys() == COORDS_WORLD;
if (obj)
{
v = obj->GetWorldPos();
}
if (emode == eEditModeMove)
{
if (obj)
{
if (bWorldSpace)
{
v = obj->GetWorldTM().GetTranslation();
}
else
{
v = obj->GetPos();
}
}
}
if (emode == eEditModeRotate)
{
if (obj)
{
Quat qrot;
if (bWorldSpace)
{
AffineParts ap;
ap.SpectralDecompose(obj->GetWorldTM());
qrot = ap.rot;
}
else
{
qrot = obj->GetRotation();
}
v = AZVec3ToLYVec3(AZ::ConvertQuaternionToEulerDegrees(LYQuaternionToAZQuaternion(qrot)));
}
}
if (emode == eEditModeScale)
{
if (obj)
{
if (bWorldSpace)
{
AffineParts ap;
ap.SpectralDecompose(obj->GetWorldTM());
v = ap.scale;
}
else
{
v = obj->GetScale();
}
}
}
return v;
}
Vec3 CSetVectorDlg::GetVectorFromText()
{
return GetVectorFromString(m_ui->edit->text());
}
Vec3 CSetVectorDlg::GetVectorFromString(const QString& vecString)
{
const int maxCoordinates = 3;
float vec[maxCoordinates] = { 0, 0, 0 };
const QStringList parts = vecString.split(QRegularExpression("[\\s,;\\t]"), Qt::SkipEmptyParts);
const int checkCoords = AZStd::GetMin(parts.count(), maxCoordinates);
for (int k = 0; k < checkCoords; ++k)
{
vec[k] = parts[k].toDouble();
}
return Vec3(vec[0], vec[1], vec[2]);
}
void CSetVectorDlg::SetVector(const Vec3& v)
{
int emode = GetIEditor()->GetEditMode();
if (emode != eEditModeMove && emode != eEditModeRotate && emode != eEditModeScale)
{
return;
}
int referenceCoordSys = GetIEditor()->GetReferenceCoordSys();
CBaseObject* obj = GetIEditor()->GetSelectedObject();
Matrix34 tm;
AffineParts ap;
if (obj)
{
tm = obj->GetWorldTM();
ap.SpectralDecompose(tm);
}
if (emode == eEditModeMove)
{
if (obj)
{
CUndo undo("Set Position");
if (referenceCoordSys == COORDS_WORLD)
{
tm.SetTranslation(v);
obj->SetWorldTM(tm, eObjectUpdateFlags_UserInput);
}
else
{
obj->SetPos(v, eObjectUpdateFlags_UserInput);
}
}
}
if (emode == eEditModeRotate)
{
CUndo undo("Set Rotation");
if (obj)
{
Quat qrot = AZQuaternionToLYQuaternion(AZ::ConvertEulerDegreesToQuaternion(LYVec3ToAZVec3(v)));
if (referenceCoordSys == COORDS_WORLD)
{
tm = Matrix34::Create(ap.scale, qrot, ap.pos);
obj->SetWorldTM(tm, eObjectUpdateFlags_UserInput);
}
else
{
obj->SetRotation(qrot, eObjectUpdateFlags_UserInput);
}
}
else
{
GetIEditor()->GetSelection()->Rotate((Ang3)v, referenceCoordSys);
}
}
if (emode == eEditModeScale)
{
if (v.x == 0 || v.y == 0 || v.z == 0)
{
return;
}
CUndo undo("Set Scale");
if (obj)
{
if (referenceCoordSys == COORDS_WORLD)
{
tm = Matrix34::Create(v, ap.rot, ap.pos);
obj->SetWorldTM(tm, eObjectUpdateFlags_UserInput);
}
else
{
obj->SetScale(v, eObjectUpdateFlags_UserInput);
}
}
else
{
GetIEditor()->GetSelection()->Scale(v, referenceCoordSys);
}
}
}
#include <moc_SetVectorDlg.cpp>
-61
View File
@@ -1,61 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_EDITOR_SETVECTORDLG_H
#define CRYINCLUDE_EDITOR_SETVECTORDLG_H
#pragma once
// GotoPositionDlg.h : header file
//
#if !defined(Q_MOC_RUN)
#include <QDialog>
#endif
namespace Ui
{
class SetVectorDlg;
}
/////////////////////////////////////////////////////////////////////////////
// CSetVectorDlg dialog
class SANDBOX_API CSetVectorDlg
: public QDialog
{
Q_OBJECT
// Construction
public:
CSetVectorDlg(QWidget* pParent = NULL); // standard constructor
~CSetVectorDlg();
static Vec3 GetVectorFromString(const QString& vecString);
// Implementation
protected:
void OnInitDialog();
void accept() override;
void SetVector(const Vec3& v);
Vec3 GetVectorFromText();
Vec3 GetVectorFromEditor();
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
Vec3 currentVec;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
private:
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
QScopedPointer<Ui::SetVectorDlg> m_ui;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
#endif // CRYINCLUDE_EDITOR_SETVECTORDLG_H
-55
View File
@@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SetVectorDlg</class>
<widget class="QDialog" name="SetVectorDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>270</width>
<height>99</height>
</rect>
</property>
<property name="windowTitle">
<string>Set Vector</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>29</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLineEdit" name="edit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>Set</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
-14
View File
@@ -589,24 +589,11 @@ AmazonToolbar ToolbarManager::GetEditModeToolbar() const
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
t.AddAction(ID_EDITMODE_SELECT, ORIGINAL_TOOLBAR_VERSION);
}
t.AddAction(ID_EDITMODE_MOVE, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_EDITMODE_ROTATE, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_EDITMODE_SCALE, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_EDITMODE_SELECTAREA, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_WIDGET_REF_COORD, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_SELECT_AXIS_X, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_SELECT_AXIS_Y, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_SELECT_AXIS_Z, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_SELECT_AXIS_XY, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_SELECT_AXIS_TERRAIN, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_SELECT_AXIS_SNAPTOALL, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_WIDGET_SNAP_GRID, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_WIDGET_SNAP_ANGLE, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_RULER, ORIGINAL_TOOLBAR_VERSION);
@@ -623,7 +610,6 @@ AmazonToolbar ToolbarManager::GetObjectToolbar() const
AmazonToolbar t = AmazonToolbar("Object", QObject::tr("Object Toolbar"));
t.SetMainToolbar(true);
t.AddAction(ID_GOTO_SELECTED, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_OBJECTMODIFY_ALIGNTOGRID, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_OBJECTMODIFY_SETHEIGHT, ORIGINAL_TOOLBAR_VERSION);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
@@ -484,9 +484,6 @@ set(FILES
SelectLightAnimationDialog.h
SelectSequenceDialog.cpp
SelectSequenceDialog.h
SetVectorDlg.cpp
SetVectorDlg.h
SetVectorDlg.ui
ShadersDialog.cpp
ShadersDialog.h
ShadersDialog.ui
@@ -20,7 +20,6 @@ set(FILES
Lib/Tests/test_MainWindowPythonBindings.cpp
Lib/Tests/test_MaterialPythonFuncs.cpp
Lib/Tests/test_ObjectManagerPythonBindings.cpp
Lib/Tests/test_SetVectorDlg.cpp
Lib/Tests/test_TrackViewPythonBindings.cpp
Lib/Tests/test_ViewPanePythonBindings.cpp
Lib/Tests/test_ViewportTitleDlgPythonBindings.cpp
@@ -73,7 +73,7 @@ namespace AZ
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (serializeContext)
{
serializeContext->Class<FbxImporter, SceneCore::LoadingComponent>()->Version(1);
serializeContext->Class<FbxImporter, SceneCore::LoadingComponent>()->Version(2); // SPEC-5776
}
}
@@ -51,7 +51,7 @@ namespace AZ
AZStd::unique_ptr<SDKScene::SceneWrapperBase> m_sceneWrapper;
AZStd::shared_ptr<FbxSceneSystem> m_sceneSystem;
bool m_useAssetImporterSDK = false;
bool m_useAssetImporterSDK = true;
};
} // namespace FbxSceneBuilder
} // namespace SceneAPI
@@ -51,6 +51,7 @@ namespace AZ
AZ_Warning("AnimationImporter", false, "Animation ticks per second should not be zero, defaulting to %d keyframes for animation.", keysSize);
return keysSize;
}
const double totalTicks = duration / ticksPerSecond;
AZ::u32 numKeys = keysSize;
// +1 because the animation is from [0, duration] - we have a keyframe at the end of the duration which needs to be included
@@ -422,10 +423,12 @@ namespace AZ
// If there is no bone animation on the current node, then generate one here.
AZStd::shared_ptr<SceneData::GraphData::AnimationData> createdAnimationData =
AZStd::make_shared<SceneData::GraphData::AnimationData>();
createdAnimationData->ReserveKeyFrames(
animation->mDuration +
1); // +1 because we start at 0 and the last keyframe is at mDuration instead of mDuration-1
createdAnimationData->SetTimeStepBetweenFrames(1.0 / animation->mTicksPerSecond);
const size_t numKeyframes = animation->mDuration + 1; // +1 because we start at 0 and the last keyframe is at mDuration instead of mDuration-1
createdAnimationData->ReserveKeyFrames(numKeyframes);
const double timeStepBetweenFrames = 1.0 / animation->mTicksPerSecond;
createdAnimationData->SetTimeStepBetweenFrames(timeStepBetweenFrames);
// Set every frame of the animation to the start location of the node.
aiMatrix4x4 combinedTransform = GetConcatenatedLocalTransform(currentNode);
@@ -527,7 +530,7 @@ namespace AZ
// are less predictable than just using a fixed time step.
// AssImp documentation claims animation->mDuration is the duration of the animation in ticks, but
// not all animations we've tested follow that pattern. Sometimes duration is in seconds.
const AZ::u32 numKeyFrames = GetNumKeyFrames(
const size_t numKeyFrames = GetNumKeyFrames(
AZStd::max(AZStd::max(anim->mNumScalingKeys, anim->mNumPositionKeys), anim->mNumRotationKeys),
animation->mDuration,
animation->mTicksPerSecond);
@@ -543,8 +546,10 @@ namespace AZ
for (AZ::u32 frame = 0; frame < numKeyFrames; ++frame)
{
const double time = GetTimeForFrame(frame, animation->mTicksPerSecond);
aiVector3D scale = aiVector3D(1.f, 1.f, 1.f), position = aiVector3D(0.f, 0.f, 0.f);
aiQuaternion rotation(1.f, 0.f, 0.f, 0.f);
aiVector3D scale(1.0f, 1.0f, 1.0f);
aiVector3D position(0.0f, 0.0f, 0.0f);
aiQuaternion rotation(1.0f, 0.0f, 0.0f, 0.0f);
if (!SampleKeyFrame(scale, anim->mScalingKeys, anim->mNumScalingKeys, time, lastScaleIndex) ||
!SampleKeyFrame(position, anim->mPositionKeys, anim->mNumPositionKeys, time, lastPositionIndex) ||
!SampleKeyFrame(rotation, anim->mRotationKeys, anim->mNumRotationKeys, time, lastRotationIndex))
@@ -553,7 +558,6 @@ namespace AZ
}
aiMatrix4x4 transform(scale, rotation, position);
DataTypes::MatrixType animTransform = AssImpSDKWrapper::AssImpTypeConverter::ToTransform(transform);
context.m_sourceSceneSystem.SwapTransformForUpAxis(animTransform);
@@ -618,7 +622,7 @@ namespace AZ
AZStd::shared_ptr<SceneData::GraphData::BlendShapeAnimationData> morphAnimNode =
AZStd::make_shared<SceneData::GraphData::BlendShapeAnimationData>();
const AZ::u32 numKeyFrames = GetNumKeyFrames(keys.size(), animation->mDuration, animation->mTicksPerSecond);
const size_t numKeyFrames = GetNumKeyFrames(keys.size(), animation->mDuration, animation->mTicksPerSecond);
morphAnimNode->ReserveKeyFrames(numKeyFrames);
morphAnimNode->SetTimeStepBetweenFrames(s_defaultTimeStepBetweenFrames);
@@ -627,7 +631,7 @@ namespace AZ
const AZ::u32 maxKeys = keys.size();
AZ::u32 keyIdx = 0;
for (AZ::u32 frame = 0; frame <= numKeyFrames; ++frame)
for (AZ::u32 frame = 0; frame < numKeyFrames; ++frame)
{
const double time = GetTimeForFrame(frame, animation->mTicksPerSecond);
@@ -640,7 +644,6 @@ namespace AZ
morphAnimNode->AddKeyFrame(weight);
}
const size_t dotIndex = nodeName.find_last_of('.');
nodeName = nodeName.substr(dotIndex + 1);
@@ -32,7 +32,7 @@ namespace AZ
{
namespace FbxSceneBuilder
{
const char* AssImpUvMapImporter::m_defaultNodeName = "UVMap";
const char* AssImpUvMapImporter::m_defaultNodeName = "UV";
AssImpUvMapImporter::AssImpUvMapImporter()
{
@@ -44,7 +44,7 @@ namespace AZ
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (serializeContext)
{
serializeContext->Class<AssImpUvMapImporter, SceneCore::LoadingComponent>()->Version(2); // LYN-2576
serializeContext->Class<AssImpUvMapImporter, SceneCore::LoadingComponent>()->Version(3); // LYN-2506
}
}
@@ -84,7 +84,13 @@ namespace AZ
AZStd::shared_ptr<SceneData::GraphData::MeshVertexUVData> uvMap =
AZStd::make_shared<AZ::SceneData::GraphData::MeshVertexUVData>();
uvMap->ReserveContainerSpace(vertexCount);
AZStd::string name(AZStd::string::format("%s%d", m_defaultNodeName, texCoordIndex));
if (mesh->mTextureCoordsNames[texCoordIndex].length)
{
name = mesh->mTextureCoordsNames[texCoordIndex].C_Str();
}
uvMap->SetCustomName(name.c_str());
for (int v = 0; v < mesh->mNumVertices; ++v)
@@ -86,7 +86,7 @@ namespace AZ
if (sourceFileExists && !updateMaterial)
{
// Don't write to the cache if there's a source material as this will be the master material.
// Don't write to the cache if there's a source material as this will be the primary material.
continue;
}
@@ -84,7 +84,7 @@ namespace AZ
NoneCheckable, // No nodes can be checked.
OnlyFilterTypesCheckable // Only nodes in the filter type list can be checked.
};
// Updates the tree to include/exclude check boxes and the master selection. Call "BuildTree()" to rebuild the tree.
// Updates the tree to include/exclude check boxes and the primary selection. Call "BuildTree()" to rebuild the tree.
virtual void MakeCheckable(CheckableOption option);
// Add a type to filter for. Filter types are used to determine if a check box is added and/or to be shown if
// the type is an end point. See "IncludeEndPoints" and "MakeCheckable" for more details.