Merge branch 'development' of https://github.com/o3de/o3de into sc-editor-asset-redux

This commit is contained in:
chcurran
2021-10-29 16:25:37 -07:00
202 changed files with 3441 additions and 1090 deletions
@@ -215,11 +215,6 @@ namespace AZ
m_oldProjectPath = newProjectPath;
// Merge the project.json file into settings registry under ProjectSettingsRootKey path.
AZ::IO::FixedMaxPath projectMetadataFile{ AZ::SettingsRegistryMergeUtils::FindEngineRoot(m_registry) / newProjectPath };
projectMetadataFile /= "project.json";
m_registry.MergeSettingsFile(projectMetadataFile.Native(),
AZ::SettingsRegistryInterface::Format::JsonMergePatch, AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey);
// Update all the runtime file paths based on the new "project_path" value.
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(m_registry);
}
@@ -168,6 +168,11 @@ namespace AZ
//! Rotation modifiers
//! @{
//! Set the world rotation matrix using the composition of rotations around
//! the principle axes in the order of z-axis first and y-axis and then x-axis.
//! @param eulerRadianAngles A Vector3 denoting radian angles of the rotations around each principle axis.
virtual void SetWorldRotation([[maybe_unused]] const AZ::Vector3& eulerAnglesRadian) {}
//! Sets the entity's rotation in the world in quaternion notation.
//! The origin of the axes is the entity's position in world space.
//! @param quaternion A quaternion that represents the rotation to use for the entity.
@@ -634,12 +634,18 @@ namespace AZ::SettingsRegistryMergeUtils
}
// Project name - if it was set via merging project.json use that value, otherwise use the project path's folder name.
auto projectNameKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey)
constexpr auto projectNameKey =
FixedValueString(AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey)
+ "/project_name";
AZ::SettingsRegistryInterface::FixedValueString projectName;
if (!registry.Get(projectName, projectNameKey))
// Read the project name from the project.json file if it exists
if (AZ::IO::FixedMaxPath projectJsonPath = normalizedProjectPath / "project.json";
AZ::IO::SystemFile::Exists(projectJsonPath.c_str()))
{
registry.MergeSettingsFile(projectJsonPath.Native(),
AZ::SettingsRegistryInterface::Format::JsonMergePatch, AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey);
}
if (FixedValueString projectName; !registry.Get(projectName, projectNameKey))
{
projectName = path.Filename().Native();
registry.Set(projectNameKey, projectName);
@@ -323,6 +323,13 @@ namespace AzFramework
return localZ;
}
void TransformComponent::SetWorldRotation(const AZ::Vector3& eulerAnglesRadian)
{
AZ::Transform newWorldTransform = m_worldTM;
newWorldTransform.SetRotation(AZ::Quaternion::CreateFromEulerAnglesRadians(eulerAnglesRadian));
SetWorldTM(newWorldTransform);
}
void TransformComponent::SetWorldRotationQuaternion(const AZ::Quaternion& quaternion)
{
AZ::Transform newWorldTransform = m_worldTM;
@@ -108,6 +108,7 @@ namespace AzFramework
float GetLocalZ() override;
// Rotation modifiers
void SetWorldRotation(const AZ::Vector3& eulerAnglesRadian) override;
void SetWorldRotationQuaternion(const AZ::Quaternion& quaternion) override;
AZ::Vector3 GetWorldRotation() override;
@@ -10,6 +10,7 @@
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AzPhysics
{
@@ -28,6 +29,71 @@ namespace AzPhysics
->Field("ChildLocalPosition", &JointConfiguration::m_childLocalPosition)
->Field("StartSimulationEnabled", &JointConfiguration::m_startSimulationEnabled)
;
if (auto* editContext = serializeContext->GetEditContext())
{
editContext->Class<JointConfiguration>("Joint Configuration", "Joint configuration.")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_parentLocalRotation,
"Parent local rotation", "Parent joint frame relative to parent body.")
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetParentLocalRotationVisibility)
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_parentLocalPosition,
"Parent local position", "Joint position relative to parent body.")
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetParentLocalPositionVisibility)
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_childLocalRotation,
"Child local rotation", "Child joint frame relative to child body.")
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetChildLocalRotationVisibility)
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_childLocalPosition,
"Child local position", "Joint position relative to child body.")
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetChildLocalPositionVisibility)
->DataElement(AZ::Edit::UIHandlers::Default, &JointConfiguration::m_startSimulationEnabled,
"Start simulation enabled", "When active, the joint will be enabled when the simulation begins.")
->Attribute(AZ::Edit::Attributes::Visibility, &JointConfiguration::GetStartSimulationEnabledVisibility)
;
}
}
}
}
AZ::Crc32 JointConfiguration::GetPropertyVisibility(JointConfiguration::PropertyVisibility property) const
{
return (m_propertyVisibilityFlags & property) != 0 ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide;
}
void JointConfiguration::SetPropertyVisibility(JointConfiguration::PropertyVisibility property, bool isVisible)
{
if (isVisible)
{
m_propertyVisibilityFlags |= property;
}
else
{
m_propertyVisibilityFlags &= ~property;
}
}
AZ::Crc32 JointConfiguration::GetParentLocalRotationVisibility() const
{
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::ParentLocalRotation);
}
AZ::Crc32 JointConfiguration::GetParentLocalPositionVisibility() const
{
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::ParentLocalPosition);
}
AZ::Crc32 JointConfiguration::GetChildLocalRotationVisibility() const
{
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::ChildLocalRotation);
}
AZ::Crc32 JointConfiguration::GetChildLocalPositionVisibility() const
{
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::ChildLocalPosition);
}
AZ::Crc32 JointConfiguration::GetStartSimulationEnabledVisibility() const
{
return GetPropertyVisibility(JointConfiguration::PropertyVisibility::StartSimulationEnabled);
}
} // namespace AzPhysics
@@ -31,6 +31,25 @@ namespace AzPhysics
JointConfiguration() = default;
virtual ~JointConfiguration() = default;
// Visibility helpers for use in the Editor when reflected.
enum PropertyVisibility : AZ::u8
{
ParentLocalRotation = 1 << 0, //!< Whether the parent local rotation is visible.
ParentLocalPosition = 1 << 1, //!< Whether the parent local position is visible.
ChildLocalRotation = 1 << 2, //!< Whether the child local rotation is visible.
ChildLocalPosition = 1 << 3, //!< Whether the child local position is visible.
StartSimulationEnabled = 1 << 4 //!< Whether the start simulation enabled setting is visible.
};
AZ::Crc32 GetPropertyVisibility(PropertyVisibility property) const;
void SetPropertyVisibility(PropertyVisibility property, bool isVisible);
AZ::Crc32 GetParentLocalRotationVisibility() const;
AZ::Crc32 GetParentLocalPositionVisibility() const;
AZ::Crc32 GetChildLocalRotationVisibility() const;
AZ::Crc32 GetChildLocalPositionVisibility() const;
AZ::Crc32 GetStartSimulationEnabledVisibility() const;
// Entity/object association.
void* m_customUserData = nullptr;
@@ -40,8 +59,11 @@ namespace AzPhysics
AZ::Quaternion m_childLocalRotation = AZ::Quaternion::CreateIdentity(); ///< Child joint frame relative to child body.
AZ::Vector3 m_childLocalPosition = AZ::Vector3::CreateZero(); ///< Joint position relative to child body.
bool m_startSimulationEnabled = true;
// For debugging/tracking purposes only.
AZStd::string m_debugName;
// Default all visibility settings to invisible, since most joint configurations don't need to display these.
AZ::u8 m_propertyVisibilityFlags = 0;
};
}
@@ -82,7 +82,7 @@ namespace AzGameFramework
// Used the lowercase the platform name since the bootstrap.game.<config>.<platform>.setreg is being loaded
// from the asset cache root where all the files are in lowercased from regardless of the filesystem case-sensitivity
static constexpr char filename[] = "bootstrap.game." AZ_BUILD_CONFIGURATION_TYPE "." AZ_TRAIT_OS_PLATFORM_CODENAME_LOWER ".setreg";
static constexpr char filename[] = "bootstrap.game." AZ_BUILD_CONFIGURATION_TYPE ".setreg";
AZ::IO::FixedMaxPath cacheRootPath;
if (registry.Get(cacheRootPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder))
@@ -1387,7 +1387,10 @@ namespace AzToolsFramework
QDataStream stream(&pixmapBytes, QIODevice::ReadOnly);
QPixmap pixmap;
stream >> pixmap;
GUI->SetBrowseButtonIcon(pixmap);
if (!pixmap.isNull())
{
GUI->SetBrowseButtonIcon(pixmap);
}
}
}
}
@@ -1417,6 +1420,8 @@ namespace AzToolsFramework
}
else if (attrib == AZ_CRC_CE("ThumbnailIcon"))
{
GUI->SetCustomThumbnailEnabled(false);
AZStd::string iconPath;
if (attrValue->Read<AZStd::string>(iconPath) && !iconPath.empty())
{
@@ -1434,8 +1439,11 @@ namespace AzToolsFramework
QDataStream stream(&pixmapBytes, QIODevice::ReadOnly);
QPixmap pixmap;
stream >> pixmap;
GUI->SetCustomThumbnailEnabled(true);
GUI->SetCustomThumbnailPixmap(pixmap);
if (!pixmap.isNull())
{
GUI->SetCustomThumbnailEnabled(true);
GUI->SetCustomThumbnailPixmap(pixmap);
}
}
}
}
@@ -67,16 +67,9 @@ namespace AzToolsFramework
void ThumbnailPropertyCtrl::SetThumbnailKey(Thumbnailer::SharedThumbnailKey key, const char* contextName)
{
if (m_customThumbnailEnabled)
{
ClearThumbnail();
}
else
{
m_key = key;
m_thumbnail->SetThumbnailKey(m_key, contextName);
m_thumbnailEnlarged->SetThumbnailKey(m_key, contextName);
}
m_key = key;
m_thumbnail->SetThumbnailKey(m_key, contextName);
m_thumbnailEnlarged->SetThumbnailKey(m_key, contextName);
UpdateVisibility();
}
@@ -301,6 +301,7 @@ namespace AzToolsFramework::ViewportUi::Internal
HighlightBorderSize + ViewportUiOverlayMargin, HighlightBorderSize + ViewportUiOverlayMargin);
m_componentModeBorderText.setVisible(true);
m_componentModeBorderText.setText(borderTitle.c_str());
UpdateUiOverlayGeometry();
}
void ViewportUiDisplay::RemoveViewportBorder()