Merge branch 'development' into Prefabs/PlayInEditorMissingAssets
This commit is contained in:
+47
-36
@@ -8,13 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzFramework/Render/GeometryIntersectionStructures.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.h>
|
||||
|
||||
class CEntityObject;
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
struct ViewportInfo;
|
||||
@@ -22,56 +20,68 @@ namespace AzFramework
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
/// Bus for customizing Entity selection logic from within the EditorComponents.
|
||||
/// Used to provide with custom implementation for Ray intersection tests, specifying AABB, etc.
|
||||
class EditorComponentSelectionRequests
|
||||
: public AZ::ComponentBus
|
||||
//! Bus for customizing Entity selection logic from within the EditorComponents.
|
||||
//! Used to provide with custom implementation for Ray intersection tests, specifying AABB, etc.
|
||||
class EditorComponentSelectionRequests : public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
/// @brief Returns an AABB that encompasses the object.
|
||||
/// @return AABB that encompasses the object.
|
||||
/// @note ViewportInfo may be necessary if the all or part of the object
|
||||
/// stays at a constant size regardless of camera position.
|
||||
virtual AZ::Aabb GetEditorSelectionBoundsViewport(
|
||||
const AzFramework::ViewportInfo& /*viewportInfo*/)
|
||||
//! @brief Returns an AABB that encompasses the object.
|
||||
//! @return AABB that encompasses the object.
|
||||
//! @note ViewportInfo may be necessary if the all or part of the object
|
||||
//! stays at a constant size regardless of camera position.
|
||||
virtual AZ::Aabb GetEditorSelectionBoundsViewport([[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo)
|
||||
{
|
||||
AZ_Assert(!SupportsEditorRayIntersect(),
|
||||
AZ_Assert(
|
||||
!SupportsEditorRayIntersect(),
|
||||
"Component claims to support ray intersection but GetEditorSelectionBoundsViewport "
|
||||
"has not been implemented in the derived class");
|
||||
|
||||
return AZ::Aabb::CreateNull();
|
||||
}
|
||||
|
||||
/// @brief Returns true if editor selection ray intersects with the handler.
|
||||
/// @return True if the editor selection ray intersects the handler.
|
||||
/// @note ViewportInfo may be necessary if the all or part of the object
|
||||
/// stays at a constant size regardless of camera position.
|
||||
//! @brief Returns true if editor selection ray intersects with the handler.
|
||||
//! @return True if the editor selection ray intersects the handler.
|
||||
//! @note ViewportInfo may be necessary if the all or part of the object
|
||||
//! stays at a constant size regardless of camera position.
|
||||
virtual bool EditorSelectionIntersectRayViewport(
|
||||
const AzFramework::ViewportInfo& /*viewportInfo*/,
|
||||
const AZ::Vector3& /*src*/, const AZ::Vector3& /*dir*/, float& /*distance*/)
|
||||
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo,
|
||||
[[maybe_unused]] const AZ::Vector3& src,
|
||||
[[maybe_unused]] const AZ::Vector3& dir,
|
||||
[[maybe_unused]] float& distance)
|
||||
{
|
||||
AZ_Assert(!SupportsEditorRayIntersect(),
|
||||
AZ_Assert(
|
||||
!SupportsEditorRayIntersect(),
|
||||
"Component claims to support ray intersection but EditorSelectionIntersectRayViewport "
|
||||
"has not been implemented in the derived class");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @brief Returns true if the component overrides EditorSelectionIntersectRay method,
|
||||
/// otherwise selection will be based only on AABB test.
|
||||
/// @return True if EditorSelectionIntersectRay method is implemented.
|
||||
virtual bool SupportsEditorRayIntersect() { return false; }
|
||||
//! @brief Returns if the component overrides EditorSelectionIntersectRay(Viewport) interface,
|
||||
//! otherwise selection will be based only on an AABB test.
|
||||
virtual bool SupportsEditorRayIntersect()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//! @brief Returns if the component overrides EditorSelectionIntersectRay(Viewport) interface,
|
||||
//! otherwise selection will be based only on an AABB test.
|
||||
//! @note Overload of SupportsEditorRayIntersect which accepts a ViewportInfo containing the ViewportId, this can be used to
|
||||
//! lookup the intersection setting per viewport.
|
||||
virtual bool SupportsEditorRayIntersectViewport([[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo)
|
||||
{
|
||||
return SupportsEditorRayIntersect();
|
||||
}
|
||||
|
||||
protected:
|
||||
~EditorComponentSelectionRequests() = default;
|
||||
};
|
||||
|
||||
/// Type to inherit to implement EditorComponentSelectionRequests.
|
||||
//! Type to inherit to implement EditorComponentSelectionRequests.
|
||||
using EditorComponentSelectionRequestsBus = AZ::EBus<EditorComponentSelectionRequests>;
|
||||
|
||||
/// Bus that provides notifications about selection events of the parent Entity.
|
||||
class EditorComponentSelectionNotifications
|
||||
: public AZ::EBusTraits
|
||||
//! Bus that provides notifications about selection events of the parent Entity.
|
||||
class EditorComponentSelectionNotifications : public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
// EBusTraits overrides
|
||||
@@ -79,20 +89,21 @@ namespace AzToolsFramework
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef AZ::EntityId BusIdType;
|
||||
|
||||
/// @brief Notifies listeners about in-editor selection events (mouse hover, selected, etc.)
|
||||
virtual void OnAccentTypeChanged(EntityAccentType /*accent*/) {}
|
||||
//! @brief Notifies listeners about in-editor selection events (mouse hover, selected, etc.)
|
||||
virtual void OnAccentTypeChanged([[maybe_unused]] EntityAccentType accent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
~EditorComponentSelectionNotifications() = default;
|
||||
};
|
||||
|
||||
/// Type to inherit to implement EditorComponentSelectionNotifications.
|
||||
//! Type to inherit to implement EditorComponentSelectionNotifications.
|
||||
using EditorComponentSelectionNotificationsBus = AZ::EBus<EditorComponentSelectionNotifications>;
|
||||
|
||||
/// Returns the union of all editor selection bounds on a given Entity.
|
||||
/// @note The returned Aabb is in world space.
|
||||
inline AZ::Aabb CalculateEditorEntitySelectionBounds(
|
||||
const AZ::EntityId entityId, const AzFramework::ViewportInfo& viewportInfo)
|
||||
//! Returns the union of all editor selection bounds on a given Entity.
|
||||
//! @note The returned Aabb is in world space.
|
||||
inline AZ::Aabb CalculateEditorEntitySelectionBounds(const AZ::EntityId entityId, const AzFramework::ViewportInfo& viewportInfo)
|
||||
{
|
||||
AZ::EBusReduceResult<AZ::Aabb, AzFramework::AabbUnionAggregator> aabbResult(AZ::Aabb::CreateNull());
|
||||
EditorComponentSelectionRequestsBus::EventResult(
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
|
||||
class CVegetationMap;
|
||||
struct CVegetationInstance;
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace EditorVegetation
|
||||
{
|
||||
/**
|
||||
* Bus used to talk to VegetationMap across the application
|
||||
*/
|
||||
class EditorVegetationRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
using Bus = AZ::EBus<EditorVegetationRequests>;
|
||||
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
typedef CVegetationMap* BusIdType;
|
||||
|
||||
virtual ~EditorVegetationRequests() {}
|
||||
|
||||
virtual AZStd::vector<CVegetationInstance*> GetObjectInstances(const AZ::Vector2& min, const AZ::Vector2& max) = 0;
|
||||
virtual void DeleteObjectInstance(CVegetationInstance* instance) = 0;
|
||||
};
|
||||
|
||||
using EditorVegetationRequestsBus = AZ::EBus<EditorVegetationRequests>;
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "NullArchiveComponent.h"
|
||||
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
|
||||
void NullArchiveComponent::Activate()
|
||||
{
|
||||
ArchiveCommandsBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void NullArchiveComponent::Deactivate()
|
||||
{
|
||||
ArchiveCommandsBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
std::future<bool> DefaultFuture()
|
||||
{
|
||||
std::promise<bool> p;
|
||||
p.set_value(false);
|
||||
return p.get_future();
|
||||
}
|
||||
|
||||
std::future<bool> NullArchiveComponent::CreateArchive(
|
||||
const AZStd::string& /*archivePath*/,
|
||||
const AZStd::string& /*dirToArchive*/)
|
||||
{
|
||||
return DefaultFuture();
|
||||
}
|
||||
|
||||
std::future<bool> NullArchiveComponent::ExtractArchive(
|
||||
const AZStd::string& /*archivePath*/,
|
||||
const AZStd::string& /*destinationPath*/)
|
||||
{
|
||||
return DefaultFuture();
|
||||
}
|
||||
|
||||
std::future<bool> NullArchiveComponent::ExtractFile(
|
||||
const AZStd::string& /*archivePath*/,
|
||||
const AZStd::string& /*fileInArchive*/,
|
||||
const AZStd::string& /*destinationPath*/)
|
||||
{
|
||||
return DefaultFuture();
|
||||
}
|
||||
|
||||
bool NullArchiveComponent::ListFilesInArchive(const AZStd::string& /*archivePath*/, AZStd::vector<AZStd::string>& /*outFileEntries*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::future<bool> NullArchiveComponent::AddFileToArchive(
|
||||
const AZStd::string& /*archivePath*/,
|
||||
const AZStd::string& /*fileToAdd*/,
|
||||
const AZStd::string& /*pathInArchive*/)
|
||||
{
|
||||
return DefaultFuture();
|
||||
}
|
||||
|
||||
std::future<bool> NullArchiveComponent::AddFilesToArchive(
|
||||
const AZStd::string& /*archivePath*/,
|
||||
const AZStd::string& /*workingDirectory*/,
|
||||
const AZStd::string& /*listFilePath*/)
|
||||
{
|
||||
return DefaultFuture();
|
||||
}
|
||||
|
||||
void NullArchiveComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<NullArchiveComponent, AZ::Component>()
|
||||
;
|
||||
}
|
||||
}
|
||||
} // namespace AzToolsFramework
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzToolsFramework/Archive/ArchiveAPI.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
class NullArchiveComponent
|
||||
: public AZ::Component
|
||||
, private ArchiveCommandsBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(NullArchiveComponent, "{D665B6B1-5FF4-4203-B19F-BBDB82587129}")
|
||||
|
||||
NullArchiveComponent() = default;
|
||||
~NullArchiveComponent() override = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Component overrides
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
private:
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ArchiveCommandsBus::Handler overrides
|
||||
[[nodiscard]] std::future<bool> CreateArchive(
|
||||
const AZStd::string& archivePath,
|
||||
const AZStd::string& dirToArchive) override;
|
||||
|
||||
[[nodiscard]] std::future<bool> ExtractArchive(
|
||||
const AZStd::string& archivePath,
|
||||
const AZStd::string& destinationPath) override;
|
||||
|
||||
[[nodiscard]] std::future<bool> ExtractFile(
|
||||
const AZStd::string& archivePath,
|
||||
const AZStd::string& fileInArchive,
|
||||
const AZStd::string& destinationPath) override;
|
||||
|
||||
bool ListFilesInArchive(const AZStd::string& archivePath, AZStd::vector<AZStd::string>& outFileEntries) override;
|
||||
|
||||
[[nodiscard]] std::future<bool> AddFileToArchive(
|
||||
const AZStd::string& archivePath,
|
||||
const AZStd::string& workingDirectory,
|
||||
const AZStd::string& fileToAdd) override;
|
||||
|
||||
[[nodiscard]] std::future<bool> AddFilesToArchive(
|
||||
const AZStd::string& archivePath,
|
||||
const AZStd::string& workingDirectory,
|
||||
const AZStd::string& listFilePath) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
} // namespace AzToolsFramework
|
||||
@@ -286,5 +286,3 @@ namespace AzToolsFramework
|
||||
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.inl>
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/std/function/function_fwd.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
#include <QImage>
|
||||
|
||||
class QImage;
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace AssetBrowser
|
||||
{
|
||||
class AssetBrowserModel;
|
||||
|
||||
//! Sends requests to output preview image for texture assets. Used for internal only!
|
||||
class AssetBrowserTexturePreviewRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
// Only a single handler is allowed
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
|
||||
//! Request to get a preview image for texture product
|
||||
//@return whether the output image is valid or not
|
||||
virtual bool GetProductTexturePreview(const char* /*fullProductFileName*/, QImage& /*previewImage*/, AZStd::string& /*productInfo*/, AZStd::string& /*productAlphaInfo*/) { return false; }
|
||||
};
|
||||
|
||||
using AssetBrowserTexturePreviewRequestsBus = AZ::EBus<AssetBrowserTexturePreviewRequests>;
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework
|
||||
-186
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include "SortFilterProxyModel.hxx"
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace AssetBrowser
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//SortFilterProxyModel
|
||||
SortFilterProxyModel::SortFilterProxyModel(QObject* parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
, m_assetMatchFiltersOperator(AzToolsFramework::FilterOperatorType::And)
|
||||
{
|
||||
//uncomment any column you want to see in the view
|
||||
m_showColumn.insert(AssetBrowserEntry::Column::Name);
|
||||
//m_showColumn.insert( Entry::Column_SourceID );
|
||||
//m_showColumn.insert( Entry::Column_FingerprintValue );
|
||||
//m_showColumn.insert( Entry::Colbumn_Guid );
|
||||
//m_showColumn.insert( Entry::Column_ScanFolderID );
|
||||
//m_showColumn.insert( Entry::Column_ProductID );
|
||||
//m_showColumn.insert( Entry::Column_JobID );
|
||||
//m_showColumn.insert( Entry::Column_JobKey );
|
||||
//m_showColumn.insert( Entry::Column_SubID );
|
||||
//m_showColumn.insert( Entry::Column_AssetType );
|
||||
//m_showColumn.insert( Entry::Column_Platform );
|
||||
//m_showColumn.insert( Entry::Column_ClassID );
|
||||
}
|
||||
|
||||
void SortFilterProxyModel::OnSearchCriteriaChanged(QStringList& criteriaList, AzToolsFramework::FilterOperatorType filterOperator)
|
||||
{
|
||||
removeAllAssetMatchFilters();
|
||||
setAssetMatchFilterOperator(filterOperator);
|
||||
|
||||
for (QString criteria : criteriaList)
|
||||
{
|
||||
auto parts = criteria.split(": ", QString::SkipEmptyParts);
|
||||
addAssetMatchFilter(parts.last().toUtf8().constData());
|
||||
}
|
||||
}
|
||||
|
||||
void SortFilterProxyModel::addAssetTypeFilter(AZ::Data::AssetType assetType)
|
||||
{
|
||||
m_assetTypeFilters.push_back(assetType);
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void SortFilterProxyModel::addAssetPathFilter(const char* assetPathFilter)
|
||||
{
|
||||
m_assetPathFilters.push_back(assetPathFilter);
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void SortFilterProxyModel::removeAllAssetPathFilters()
|
||||
{
|
||||
m_assetPathFilters.clear();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void SortFilterProxyModel::setAssetMatchSubDirFilter(bool val)
|
||||
{
|
||||
m_includeSubdir = val;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void SortFilterProxyModel::removeAllAssetMatchFilters()
|
||||
{
|
||||
m_assetMatchFilters.clear();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void SortFilterProxyModel::addAssetMatchFilter(const char* assetMatchFilter)
|
||||
{
|
||||
m_assetMatchFilters.push_back(assetMatchFilter);
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void SortFilterProxyModel::setAssetMatchFilterOperator(AzToolsFramework::FilterOperatorType type)
|
||||
{
|
||||
m_assetMatchFiltersOperator = type;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool SortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
|
||||
{
|
||||
//get the source idx, if invalid early out
|
||||
QModelIndex idx = sourceModel()->index(source_row, 0, source_parent);
|
||||
if (!idx.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//the entry is the internal pointer of the index
|
||||
auto entry = static_cast<AssetBrowserEntry*>(idx.internalPointer());
|
||||
|
||||
if (!entry->isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//we only want to see assets that have at least one child product that has a valid assetType
|
||||
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
|
||||
{
|
||||
//we have a asset with at least one valid child product assetType
|
||||
//we only want to see assets that have at least one child product that matches the assetType filter
|
||||
if (!m_assetTypeFilters.empty())
|
||||
{
|
||||
for (int i = 0; i < entry->GetChildCount(); ++i)
|
||||
{
|
||||
auto product = static_cast<ProductAssetBrowserEntry*>(entry->GetChild(i));
|
||||
if (product->isValid())
|
||||
{
|
||||
if (AZStd::find(m_assetTypeFilters.begin(), m_assetTypeFilters.end(), product->GetAssetType()) == m_assetTypeFilters.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//we only want to see assets that match all the match filters
|
||||
if (!m_assetMatchFilters.empty())
|
||||
{
|
||||
if (m_assetMatchFiltersOperator == AzToolsFramework::FilterOperatorType::And)
|
||||
{
|
||||
for (const auto& item : m_assetMatchFilters)
|
||||
{
|
||||
if (!entry->Match(item.c_str()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_assetMatchFiltersOperator == AzToolsFramework::FilterOperatorType::Or)
|
||||
{
|
||||
for (const auto& item : m_assetMatchFilters)
|
||||
{
|
||||
if (entry->Match(item.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SortFilterProxyModel::filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const
|
||||
{
|
||||
(void)source_parent;
|
||||
|
||||
//if the column is in the set we want to show it
|
||||
return m_showColumn.find(static_cast<AssetBrowserEntry::Column>(source_column)) != m_showColumn.end();
|
||||
}
|
||||
|
||||
bool SortFilterProxyModel::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const
|
||||
{
|
||||
if (source_left.column() == source_right.column())
|
||||
{
|
||||
QVariant leftData = sourceModel()->data(source_left);
|
||||
QVariant rightData = sourceModel()->data(source_right);
|
||||
if ((leftData.type() == QVariant::String) &&
|
||||
(rightData.type() == QVariant::String))
|
||||
{
|
||||
QString leftString = leftData.toString();
|
||||
QString rightString = rightData.toString();
|
||||
return QString::compare(leftString, rightString, Qt::CaseInsensitive) > 0;
|
||||
}
|
||||
}
|
||||
return QSortFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework// namespace AssetBrowser
|
||||
|
||||
#include <AssetBrowser/moc_SortFilterProxyModel.cpp>
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Asset/AssetTypeInfoBus.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Thumbnails/ProductThumbnail.h>
|
||||
#include <QPixmap>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace AssetBrowser
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ProductThumbnailKey
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ProductThumbnailKey::ProductThumbnailKey(const AZ::Data::AssetId& assetId)
|
||||
: ThumbnailKey()
|
||||
, m_assetId(assetId)
|
||||
{
|
||||
AZ::Data::AssetInfo info;
|
||||
AZ::Data::AssetCatalogRequestBus::BroadcastResult(info, &AZ::Data::AssetCatalogRequests::GetAssetInfoById, m_assetId);
|
||||
m_assetType = info.m_assetType;
|
||||
}
|
||||
|
||||
const AZ::Data::AssetId& ProductThumbnailKey::GetAssetId() const { return m_assetId; }
|
||||
|
||||
const AZ::Data::AssetType& ProductThumbnailKey::GetAssetType() const { return m_assetType; }
|
||||
|
||||
size_t ProductThumbnailKey::GetHash() const
|
||||
{
|
||||
return m_assetType.GetHash();
|
||||
}
|
||||
|
||||
bool ProductThumbnailKey::Equals(const ThumbnailKey* other) const
|
||||
{
|
||||
if (!ThumbnailKey::Equals(other))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// products displayed in Asset Browser have icons based on asset type, so multiple different products with same asset type will have same thumbnail
|
||||
return m_assetId == azrtti_cast<const ProductThumbnailKey*>(other)->GetAssetId();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ProductThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const char* DEFAULT_PRODUCT_ICON_PATH = "Editor/Icons/AssetBrowser/DefaultProduct_16.svg";
|
||||
|
||||
ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
{}
|
||||
|
||||
void ProductThumbnail::LoadThread()
|
||||
{
|
||||
auto productKey = azrtti_cast<const ProductThumbnailKey*>(m_key.data());
|
||||
AZ_Assert(productKey, "Incorrect key type, excpected ProductThumbnailKey");
|
||||
|
||||
QString iconPath;
|
||||
AZ::AssetTypeInfoBus::EventResult(iconPath, productKey->GetAssetType(), &AZ::AssetTypeInfo::GetBrowserIcon);
|
||||
if (!iconPath.isEmpty())
|
||||
{
|
||||
// is it an embedded resource or absolute path?
|
||||
bool isUsablePath = (iconPath.startsWith(":") || (!AzFramework::StringFunc::Path::IsRelative(iconPath.toUtf8().constData())));
|
||||
|
||||
if (!isUsablePath)
|
||||
{
|
||||
// getting here means it needs resolution. Can we find the real path of the file? This also searches in gems for sources.
|
||||
bool foundIt = false;
|
||||
AZStd::string watchFolder;
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(foundIt, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, iconPath.toUtf8().constData(), assetInfo, watchFolder);
|
||||
|
||||
if (foundIt)
|
||||
{
|
||||
// the absolute path is join(watchfolder, relativepath); // since its relative to the watch folder.
|
||||
AZStd::string finalPath;
|
||||
AzFramework::StringFunc::Path::Join(watchFolder.c_str(), assetInfo.m_relativePath.c_str(), finalPath);
|
||||
iconPath = QString::fromUtf8(finalPath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no pixmap specified - use default.
|
||||
iconPath = QString::fromUtf8(DEFAULT_PRODUCT_ICON_PATH);
|
||||
}
|
||||
|
||||
m_icon = QIcon(iconPath);
|
||||
|
||||
if (m_icon.isNull())
|
||||
{
|
||||
m_state = State::Failed;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ProductThumbnailCache
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ProductThumbnailCache::ProductThumbnailCache()
|
||||
: ThumbnailCache<ProductThumbnail>() {}
|
||||
|
||||
ProductThumbnailCache::~ProductThumbnailCache() = default;
|
||||
|
||||
const char* ProductThumbnailCache::GetProviderName() const
|
||||
{
|
||||
return ProviderName;
|
||||
}
|
||||
|
||||
bool ProductThumbnailCache::IsSupportedThumbnail(Thumbnailer::SharedThumbnailKey key) const
|
||||
{
|
||||
return azrtti_istypeof<const ProductThumbnailKey*>(key.data());
|
||||
}
|
||||
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
#include "AssetBrowser/Thumbnails/moc_AssetBrowserProductThumbnail.cpp"
|
||||
+2
-4
@@ -177,7 +177,6 @@ namespace AzToolsFramework
|
||||
auto data = index.data(AssetBrowserModel::Roles::EntryRole);
|
||||
if (data.canConvert<const AssetBrowserEntry*>())
|
||||
{
|
||||
[[maybe_unused]] bool isEnabled = (option.state & QStyle::State_Enabled) != 0;
|
||||
|
||||
QStyle* style = option.widget ? option.widget->style() : QApplication::style();
|
||||
|
||||
@@ -223,7 +222,6 @@ namespace AzToolsFramework
|
||||
// sources with no children should be greyed out.
|
||||
if (sourceEntry->GetChildCount() == 0)
|
||||
{
|
||||
isEnabled = false; // draw in disabled style.
|
||||
actualPalette.setCurrentColorGroup(QPalette::Disabled);
|
||||
}
|
||||
}
|
||||
@@ -285,7 +283,7 @@ namespace AzToolsFramework
|
||||
initStyleOption(&optionV4, index);
|
||||
optionV4.state &= ~(QStyle::State_HasFocus | QStyle::State_Selected);
|
||||
|
||||
if (m_assetBrowserFilerModel && m_assetBrowserFilerModel->GetStringFilter()
|
||||
if (m_assetBrowserFilerModel && m_assetBrowserFilerModel->GetStringFilter()
|
||||
&& !m_assetBrowserFilerModel->GetStringFilter()->GetFilterString().isEmpty())
|
||||
{
|
||||
displayString = RichTextHighlighter::HighlightText(displayString, m_assetBrowserFilerModel->GetStringFilter()->GetFilterString());
|
||||
@@ -316,7 +314,7 @@ namespace AzToolsFramework
|
||||
absoluteIconPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / TreeIconPathOneChild;
|
||||
break;
|
||||
}
|
||||
[[maybe_unused]] bool pixmapLoadedSuccess = pixmap.load(absoluteIconPath.c_str());
|
||||
[[maybe_unused]] bool pixmapLoadedSuccess = pixmap.load(absoluteIconPath.c_str());
|
||||
AZ_Assert(pixmapLoadedSuccess, "Error loading Branch Icons in SearchEntryDelegate");
|
||||
|
||||
m_branchIcons[static_cast<EntryBranchType>(branchType)] = pixmap;
|
||||
|
||||
-1
@@ -14,7 +14,6 @@
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzToolsFramework/SQLite/SQLiteConnection.h>
|
||||
#include <AzToolsFramework/API/AssetDatabaseBus.h>
|
||||
#include <AzToolsFramework/Debug/TraceContext.h>
|
||||
#include <AzToolsFramework/SQLite/SQLiteQuery.h>
|
||||
#include <AzToolsFramework/SQLite/SQLiteBoundColumnSet.h>
|
||||
#include <cinttypes>
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
|
||||
#include "EntityTransformCommand.h"
|
||||
#include <HexEdFramework/FrameworkCore/SelectionMessages.h>
|
||||
#include <HexEd/WorldEditor/ToolsComponents/TransformComponentBus.h>
|
||||
#include <AzToolsFramework/Undo/UndoCacheInterface.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
TransformCommand::TransformCommand(const AZ::u64& contextId, const AZStd::string& friendlyName, const EntityList& captureEntities)
|
||||
: UndoSystem::URSequencePoint(friendlyName)
|
||||
, m_contextId(contextId)
|
||||
{
|
||||
for (auto it = captureEntities.begin(); it != captureEntities.end(); ++it)
|
||||
{
|
||||
SRT current;
|
||||
EBUS_EVENT_ID_RESULT(current, *it, TransformComponentMessages::Bus, GetLocalSRT);
|
||||
m_priorTransforms[*it] = current;
|
||||
m_nextTransforms[*it] = current;
|
||||
}
|
||||
|
||||
m_undoCacheInterface = AZ::Interface<UndoSystem::UndoCacheInterface>::Get();
|
||||
AZ_Assert(m_undoCacheInterface, "Could not get UndoCacheInterface on TransformCommand construction.");
|
||||
}
|
||||
|
||||
void TransformCommand::Post()
|
||||
{
|
||||
// add to undo stack
|
||||
UndoSystem::UndoStack* undoStack = NULL;
|
||||
EBUS_EVENT_ID_RESULT(undoStack, m_contextId, SelectionMessages::Bus, GetUndoStack);
|
||||
|
||||
if (undoStack)
|
||||
{
|
||||
undoStack->Post(this);
|
||||
}
|
||||
|
||||
for (auto it = m_priorTransforms.begin(); it != m_priorTransforms.end(); ++it)
|
||||
{
|
||||
m_undoCacheInterface->UpdateCache(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
void TransformCommand::Undo()
|
||||
{
|
||||
for (auto it = m_priorTransforms.begin(); it != m_priorTransforms.end(); ++it)
|
||||
{
|
||||
EBUS_EVENT_ID(it->first, TransformComponentMessages::Bus, SetLocalSRT, it->second);
|
||||
m_undoCacheInterface->UpdateCache(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
void TransformCommand::Redo()
|
||||
{
|
||||
for (auto it = m_nextTransforms.begin(); it != m_nextTransforms.end(); ++it)
|
||||
{
|
||||
EBUS_EVENT_ID(it->first, TransformComponentMessages::Bus, SetLocalSRT, it->second);
|
||||
m_undoCacheInterface->UpdateCache(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
void TransformCommand::CaptureNewTransform(const AZ::EntityId entityId)
|
||||
{
|
||||
AZ_Assert(m_priorTransforms.find(entityId) != m_priorTransforms.end(), "You can't add new transforms during an operation");
|
||||
AZ_Assert(m_nextTransforms.find(entityId) != m_nextTransforms.end(), "You can't add new transforms during an operation");
|
||||
|
||||
SRT current;
|
||||
EBUS_EVENT_ID_RESULT(current, entityId, TransformComponentMessages::Bus, GetLocalSRT);
|
||||
m_nextTransforms[entityId] = current;
|
||||
}
|
||||
|
||||
void TransformCommand::RevertToPriorTransform(const AZ::EntityId entityId)
|
||||
{
|
||||
AZ_Assert(m_priorTransforms.find(entityId) != m_priorTransforms.end(), "No such entity!");
|
||||
|
||||
m_nextTransforms[entityId] = m_priorTransforms[entityId];
|
||||
EBUS_EVENT_ID(entityId, TransformComponentMessages::Bus, SetLocalSRT, m_priorTransforms[entityId]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef TRANSFORM_COMMAND_H
|
||||
#define TRANSFORM_COMMAND_H
|
||||
|
||||
#if 0
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Component/ComponentBus.h>
|
||||
#include <HexEdFramework/FrameworkCore/UndoSystem.h>
|
||||
#include <HexEd/WorldEditor/ToolsComponents/TransformComponentBus.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace UndoSystem
|
||||
{
|
||||
class UndoCacheInterface;
|
||||
}
|
||||
|
||||
typedef AZStd::vector<AZ::EntityId> EntityList;
|
||||
|
||||
// transform command specializes undo to just care about the transform of an entity instead of the entire thing, for performance.
|
||||
class TransformCommand
|
||||
: public UndoSystem::URSequencePoint
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(TransformCommand, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(TransformCommand);
|
||||
|
||||
TransformCommand(const AZ::u64& contextId, const AZStd::string& friendlyName, const EditorFramework::EntityList& captureEntities);
|
||||
virtual ~TransformCommand() {}
|
||||
|
||||
// the default will work for selections with out an undo stack(maybe move the undo stack here too
|
||||
void CaptureNewTransform(const AZ::EntityId entityId);
|
||||
void RevertToPriorTransform(const AZ::EntityId entityID);
|
||||
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
|
||||
virtual void Post();
|
||||
|
||||
protected:
|
||||
AZ::u64 m_contextId;
|
||||
|
||||
typedef AZStd::unordered_map<AZ::EntityId, Components::SRT> CapturedTransforms;
|
||||
|
||||
CapturedTransforms m_priorTransforms;
|
||||
CapturedTransforms m_nextTransforms;
|
||||
|
||||
private:
|
||||
UndoCacheInterface* m_undoCacheInterface;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // disabled
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzFramework/Application/Application.h>
|
||||
#include <AzToolsFramework/Undo/UndoSystem.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
/**
|
||||
* AzToolsFramework URSequencePoint wrapper around legacy IUndoObject
|
||||
* Allows using IUndoObject with AzToolsFramework undo system
|
||||
*/
|
||||
template<typename UndoObjectType>
|
||||
class LegacyCommand
|
||||
: public AzToolsFramework::UndoSystem::URSequencePoint
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(LegacyCommand<UndoObjectType>, "{9ED33CB6-04D0-4924-A121-D8C27DC09066}", AzToolsFramework::UndoSystem::URSequencePoint);
|
||||
AZ_CLASS_ALLOCATOR(LegacyCommand<UndoObjectType>, AZ::SystemAllocator, 0);
|
||||
|
||||
explicit LegacyCommand(const AZStd::string& friendlyName, AZStd::unique_ptr<UndoObjectType>&& legacyUndo)
|
||||
: AzToolsFramework::UndoSystem::URSequencePoint(friendlyName)
|
||||
{
|
||||
m_legacyUndo = AZStd::move(legacyUndo);
|
||||
}
|
||||
virtual ~LegacyCommand() = default;
|
||||
|
||||
void Undo() override { m_legacyUndo->Undo(); }
|
||||
void Redo() override { m_legacyUndo->Redo(); }
|
||||
|
||||
bool Changed() const override { return true; }
|
||||
|
||||
protected:
|
||||
AZStd::unique_ptr<UndoObjectType> m_legacyUndo;
|
||||
};
|
||||
} // namespace AzToolsFramework
|
||||
-149
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzToolsFramework/Debug/TraceContext.h>
|
||||
#include <AzToolsFramework/Debug/TraceContextBufferedFormatter.h>
|
||||
|
||||
#ifdef AZ_ENABLE_TRACE_CONTEXT
|
||||
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzToolsFramework/Debug/TraceContextStackInterface.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#endif // AZ_ENABLE_TRACE_CONTEXT
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Debug
|
||||
{
|
||||
|
||||
#ifdef AZ_ENABLE_TRACE_CONTEXT
|
||||
|
||||
int TraceContextBufferedFormatter::Print(char* buffer, size_t bufferSize, const TraceContextStackInterface& stack, bool printUuids, size_t startIndex)
|
||||
{
|
||||
if (bufferSize == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Make sure there's always a terminator, even if nothing has been written.
|
||||
buffer[0] = 0;
|
||||
|
||||
size_t stackSize = stack.GetStackCount();
|
||||
for (size_t i = startIndex; i < stackSize; ++i)
|
||||
{
|
||||
int written = 0;
|
||||
switch (stack.GetType(i))
|
||||
{
|
||||
case TraceContextStackInterface::ContentType::StringType:
|
||||
written = azsnprintf(buffer, bufferSize, "%s=%s\n", stack.GetKey(i), stack.GetStringValue(i));
|
||||
break;
|
||||
case TraceContextStackInterface::ContentType::BoolType:
|
||||
written = azsnprintf(buffer, bufferSize, "%s=%c\n", stack.GetKey(i), (stack.GetBoolValue(i) ? '1' : '0'));
|
||||
break;
|
||||
case TraceContextStackInterface::ContentType::IntType:
|
||||
written = azsnprintf(buffer, bufferSize, "%s=%" PRIi64 "\n", stack.GetKey(i), stack.GetIntValue(i));
|
||||
break;
|
||||
case TraceContextStackInterface::ContentType::UintType:
|
||||
written = azsnprintf(buffer, bufferSize, "%s=%" PRIu64 "\n", stack.GetKey(i), stack.GetUIntValue(i));
|
||||
break;
|
||||
case TraceContextStackInterface::ContentType::FloatType:
|
||||
written = azsnprintf(buffer, bufferSize, "%s=%f\n", stack.GetKey(i), stack.GetFloatValue(i));
|
||||
break;
|
||||
case TraceContextStackInterface::ContentType::DoubleType:
|
||||
written = azsnprintf(buffer, bufferSize, "%s=%f\n", stack.GetKey(i), stack.GetDoubleValue(i));
|
||||
break;
|
||||
case TraceContextStackInterface::ContentType::UuidType:
|
||||
if (printUuids)
|
||||
{
|
||||
written = azsnprintf(buffer, bufferSize, "%s=", stack.GetKey(i));
|
||||
if (written > 0)
|
||||
{
|
||||
int uuidWritten = PrintUuid(buffer + written, bufferSize - written, stack.GetUuidValue(i));
|
||||
written = (uuidWritten < 0 ? -1 : (written + uuidWritten));
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
case TraceContextStackInterface::ContentType::Undefined:
|
||||
written = azsnprintf(buffer, bufferSize, "<UNDEFINED>\n");
|
||||
break;
|
||||
default:
|
||||
written = azsnprintf(buffer, bufferSize, "<UNKNOWN>\n");
|
||||
break;
|
||||
}
|
||||
|
||||
// If successful azsnprintf will return the number of characters that were
|
||||
// written, so move the buffer forward and reduce the available space.
|
||||
// Otherwise see if there's anything written that needs to be recovered
|
||||
// or to simply move to the next entry upon re-entry.
|
||||
if (written > 0)
|
||||
{
|
||||
buffer += written;
|
||||
bufferSize -= written;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the startIndex is the same as the current index, this is the first
|
||||
// entry to be written. It means this is the largest the buffer will
|
||||
// ever get, so leave whatever has been written in place. Do however
|
||||
// add a newline.
|
||||
if (startIndex == i)
|
||||
{
|
||||
if (bufferSize >= 2)
|
||||
{
|
||||
buffer[bufferSize - 2] = '\n';
|
||||
buffer[bufferSize - 1] = 0;
|
||||
}
|
||||
return aznumeric_caster(i + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bufferSize > 0)
|
||||
{
|
||||
// Remove whatever part has been written as it's not complete.
|
||||
*buffer = 0;
|
||||
}
|
||||
}
|
||||
return aznumeric_caster(i);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int TraceContextBufferedFormatter::PrintUuid(char* buffer, size_t bufferSize, const AZ::Uuid& uuid)
|
||||
{
|
||||
int written = uuid.ToString(buffer, aznumeric_caster(bufferSize), false);
|
||||
if (written > 0)
|
||||
{
|
||||
if (bufferSize > written)
|
||||
{
|
||||
buffer[written - 1] = '\n';
|
||||
buffer[written] = 0;
|
||||
return written + 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else // AZ_ENABLE_TRACE_CONTEXT
|
||||
|
||||
int TraceContextBufferedFormatter::Print(char* /*buffer*/, size_t /*bufferSize*/,
|
||||
const TraceContextStackInterface& /*stack*/, bool /*printUuids*/, size_t /*startIndex*/)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif // AZ_ENABLE_TRACE_CONTEXT
|
||||
} // Debug
|
||||
} // AzToolsFramework
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
struct Uuid;
|
||||
}
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Debug
|
||||
{
|
||||
class TraceContextStackInterface;
|
||||
|
||||
// TraceContexBufferedFormatter takes a trace context stack and prints it to the given buffer.
|
||||
// It's aimed to be used with small to micro sized character buffers. (At least 50-100
|
||||
// characters is advised.) If the entire context couldn't be written to the buffer, Build
|
||||
// can be called repeatedly with the returned index to continue printing the buffer. If a
|
||||
// single context entry doesn't fit in the buffer, TraceContexBufferedFormatter will attempt
|
||||
// to write as much data as can be fitted in the buffer.
|
||||
//
|
||||
// Typical usage looks like:
|
||||
// TraceContextSingleStackHandler stackHandler;
|
||||
// ...
|
||||
// TraceContexBufferedFormatter buffered;
|
||||
// char buffer[64];
|
||||
// int index = 0;
|
||||
// do
|
||||
// {
|
||||
// index = buffered.Build(buffer, stackHandler.GetStack(), true, index);
|
||||
// Print(buffer);
|
||||
// } while (index >= 0);
|
||||
//
|
||||
// Example output:
|
||||
// String=text
|
||||
// Integer=42
|
||||
// Float=3.141500
|
||||
// Uuid=E2C7EEFA-B1CA-465F-A4BC-30514F76B7B5
|
||||
|
||||
class TraceContextBufferedFormatter
|
||||
{
|
||||
public:
|
||||
// Prints the trace context to the given buffer, tags.
|
||||
// If printUuids is true, the uuid of objects and tags is printed as well.
|
||||
// Use startIndex to continue from a specific entry.
|
||||
// Returns the index of the next entry to be written or -1 if no entries are left.
|
||||
static int Print(char* buffer, size_t bufferSize, const TraceContextStackInterface& stack, bool printUuids, size_t startIndex = 0);
|
||||
|
||||
template<size_t size>
|
||||
static inline int Print(char(&buffer)[size], const TraceContextStackInterface& stack, bool printUuids, size_t startIndex = 0);
|
||||
|
||||
private:
|
||||
static int PrintUuid(char* buffer, size_t bufferSize, const AZ::Uuid& uuid);
|
||||
};
|
||||
} // Debug
|
||||
} // AzToolsFramework
|
||||
|
||||
#include <AzToolsFramework/Debug/TraceContextBufferedFormatter.inl>
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Debug
|
||||
{
|
||||
template<size_t size>
|
||||
inline int TraceContextBufferedFormatter::Print(char(&buffer)[size], const TraceContextStackInterface& stack, bool printUuids, size_t startIndex)
|
||||
{
|
||||
return Print(buffer, size, stack, printUuids, startIndex);
|
||||
}
|
||||
} // Debug
|
||||
} // AzToolsFramework
|
||||
+1
-1
@@ -447,7 +447,7 @@ namespace AzToolsFramework
|
||||
else
|
||||
{
|
||||
loadedSuccessfully = static_cast<PrefabEditorEntityOwnershipService*>(m_entityOwnershipService.get())->LoadFromStream(
|
||||
stream, AZStd::string_view(levelPakFile.toUtf8(), levelPakFile.size()) );
|
||||
stream, AZStd::string_view(levelPakFile.toUtf8().constData(), levelPakFile.size()) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -693,7 +693,12 @@ namespace AzToolsFramework
|
||||
SliceEditorEntityOwnershipServiceNotificationBus::Broadcast(
|
||||
&SliceEditorEntityOwnershipServiceNotifications::OnSaveStreamForGameBegin, stream, streamType, tempEntities);
|
||||
|
||||
sourceEntities.insert(sourceEntities.end(), tempEntities.begin(), tempEntities.end());
|
||||
sourceEntities.reserve(sourceEntities.size() + tempEntities.size());
|
||||
for (AZStd::unique_ptr<AZ::Entity>& tempEntity : tempEntities)
|
||||
{
|
||||
sourceEntities.emplace_back(tempEntity.release());
|
||||
}
|
||||
tempEntities = {};
|
||||
// Add the root slice metadata entity so that we export any level components
|
||||
sourceEntities.push_back(GetRootSlice()->GetMetadataEntity());
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
using EntityIdList = AZStd::vector<AZ::EntityId>;
|
||||
|
||||
//! FocusModeInterface
|
||||
//! Interface to handle the Editor Focus Mode.
|
||||
class FocusModeInterface
|
||||
@@ -36,6 +38,9 @@ namespace AzToolsFramework
|
||||
//! @return The entity id of the root of the Editor focus, or an invalid entity id if no focus is set.
|
||||
virtual AZ::EntityId GetFocusRoot(AzFramework::EntityContextId entityContextId) = 0;
|
||||
|
||||
//! Returns a list of the ids of all the entities that are descendants of the focus root.
|
||||
virtual EntityIdList GetFocusedEntities(AzFramework::EntityContextId entityContextId) = 0;
|
||||
|
||||
//! Returns whether the entity id provided is part of the focused sub-tree.
|
||||
virtual bool IsInFocusSubTree(AZ::EntityId entityId) const = 0;
|
||||
};
|
||||
|
||||
+62
@@ -40,10 +40,14 @@ namespace AzToolsFramework
|
||||
void FocusModeSystemComponent::Activate()
|
||||
{
|
||||
AZ::Interface<FocusModeInterface>::Register(this);
|
||||
EditorEntityInfoNotificationBus::Handler::BusConnect();
|
||||
Prefab::PrefabPublicNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void FocusModeSystemComponent::Deactivate()
|
||||
{
|
||||
Prefab::PrefabPublicNotificationBus::Handler::BusDisconnect();
|
||||
EditorEntityInfoNotificationBus::Handler::BusDisconnect();
|
||||
AZ::Interface<FocusModeInterface>::Unregister(this);
|
||||
}
|
||||
|
||||
@@ -89,6 +93,9 @@ namespace AzToolsFramework
|
||||
|
||||
AZ::EntityId previousFocusEntityId = m_focusRoot;
|
||||
m_focusRoot = entityId;
|
||||
|
||||
RefreshFocusedEntityIdList();
|
||||
|
||||
FocusModeNotificationBus::Broadcast(&FocusModeNotifications::OnEditorFocusChanged, previousFocusEntityId, m_focusRoot);
|
||||
}
|
||||
|
||||
@@ -102,6 +109,11 @@ namespace AzToolsFramework
|
||||
return m_focusRoot;
|
||||
}
|
||||
|
||||
EntityIdList FocusModeSystemComponent::GetFocusedEntities([[maybe_unused]] AzFramework::EntityContextId entityContextId)
|
||||
{
|
||||
return m_focusedEntityIdList;
|
||||
}
|
||||
|
||||
bool FocusModeSystemComponent::IsInFocusSubTree(AZ::EntityId entityId) const
|
||||
{
|
||||
if (m_focusRoot == AZ::EntityId())
|
||||
@@ -112,4 +124,54 @@ namespace AzToolsFramework
|
||||
return AzToolsFramework::IsInFocusSubTree(entityId, m_focusRoot);
|
||||
}
|
||||
|
||||
void FocusModeSystemComponent::OnEntityInfoUpdatedAddChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
|
||||
{
|
||||
// If the parent's entityId is in the list, add the child.
|
||||
if (auto iter = AZStd::find(m_focusedEntityIdList.begin(), m_focusedEntityIdList.end(), parentId);
|
||||
iter != m_focusedEntityIdList.end())
|
||||
{
|
||||
m_focusedEntityIdList.push_back(childId);
|
||||
}
|
||||
}
|
||||
|
||||
void FocusModeSystemComponent::OnEntityInfoUpdatedRemoveChildEnd([[maybe_unused]] AZ::EntityId parentId, AZ::EntityId childId)
|
||||
{
|
||||
// If the removed entityId is in the list, remove it.
|
||||
if (auto iter = AZStd::find(m_focusedEntityIdList.begin(), m_focusedEntityIdList.end(), childId);
|
||||
iter != m_focusedEntityIdList.end())
|
||||
{
|
||||
m_focusedEntityIdList.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
void FocusModeSystemComponent::OnPrefabInstancePropagationEnd()
|
||||
{
|
||||
// Can't rely on any of the entities in the list to still exist, refresh the whole thing.
|
||||
RefreshFocusedEntityIdList();
|
||||
}
|
||||
|
||||
void FocusModeSystemComponent::RefreshFocusedEntityIdList()
|
||||
{
|
||||
m_focusedEntityIdList.clear();
|
||||
|
||||
AZStd::queue<AZ::EntityId> entityIdQueue;
|
||||
entityIdQueue.push(m_focusRoot);
|
||||
|
||||
while (!entityIdQueue.empty())
|
||||
{
|
||||
AZ::EntityId entityId = entityIdQueue.front();
|
||||
entityIdQueue.pop();
|
||||
|
||||
m_focusedEntityIdList.push_back(entityId);
|
||||
|
||||
EntityIdList children;
|
||||
EditorEntityInfoRequestBus::EventResult(children, entityId, &EditorEntityInfoRequestBus::Events::GetChildren);
|
||||
|
||||
for (AZ::EntityId childEntityId : children)
|
||||
{
|
||||
entityIdQueue.push(childEntityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
|
||||
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
|
||||
#include <AzToolsFramework/FocusMode/FocusModeInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -21,6 +23,8 @@ namespace AzToolsFramework
|
||||
class FocusModeSystemComponent final
|
||||
: public AZ::Component
|
||||
, private FocusModeInterface
|
||||
, private EditorEntityInfoNotificationBus::Handler
|
||||
, private Prefab::PrefabPublicNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(FocusModeSystemComponent, "{6CE522FE-2057-4794-BD05-61E04BD8EA30}");
|
||||
@@ -42,10 +46,21 @@ namespace AzToolsFramework
|
||||
void SetFocusRoot(AZ::EntityId entityId) override;
|
||||
void ClearFocusRoot(AzFramework::EntityContextId entityContextId) override;
|
||||
AZ::EntityId GetFocusRoot(AzFramework::EntityContextId entityContextId) override;
|
||||
EntityIdList GetFocusedEntities(AzFramework::EntityContextId entityContextId) override;
|
||||
bool IsInFocusSubTree(AZ::EntityId entityId) const override;
|
||||
|
||||
// EditorEntityInfoNotificationBus overrides ...
|
||||
void OnEntityInfoUpdatedAddChildEnd(AZ::EntityId parentId, AZ::EntityId childId) override;
|
||||
void OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId) override;
|
||||
|
||||
// PrefabPublicNotificationBus overrides ...
|
||||
void OnPrefabInstancePropagationEnd() override;
|
||||
|
||||
private:
|
||||
void RefreshFocusedEntityIdList();
|
||||
|
||||
AZ::EntityId m_focusRoot;
|
||||
EntityIdList m_focusedEntityIdList;
|
||||
};
|
||||
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
@@ -65,6 +65,9 @@ namespace AzToolsFramework
|
||||
|
||||
bool Connection::Open(const AZStd::string& filename, bool readOnly)
|
||||
{
|
||||
AZ_Assert(sqlite3_libversion_number() == SQLITE_VERSION_NUMBER, "Sqlite header version number does not match library");
|
||||
AZ_Assert(strncmp(sqlite3_sourceid(), SQLITE_SOURCE_ID, 80) == 0, "Sqlite header source id does not match library");
|
||||
AZ_Assert(strcmp(sqlite3_libversion(), SQLITE_VERSION) == 0, "Sqlite header version does not match library");
|
||||
AZ_Assert(m_db == NULL, "You have to close the database prior to opening a new one.");
|
||||
if (m_db)
|
||||
{
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
class QWidget;
|
||||
class QPainter;
|
||||
class QStyleOptionViewItem;
|
||||
class QAbstractItemModel;
|
||||
class QModelIndex;
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
//! Thumbnail delegate can be used as within item views to draw thumbnails
|
||||
class ThumbnailDelegate
|
||||
: public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ThumbnailDelegate(QWidget* parent = nullptr);
|
||||
~ThumbnailDelegate() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// QStyledItemDelegate
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||
void setEditorData(QWidget* editor, const QModelIndex& index) const override;
|
||||
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
|
||||
//! Set location where thumbnails are searched
|
||||
void SetThumbnailContext(const char* thumbnailContext);
|
||||
|
||||
private:
|
||||
AZStd::string m_thumbnailContext;
|
||||
};
|
||||
} // namespace Thumbnailer
|
||||
} // namespace AzToolsFramework
|
||||
@@ -22,7 +22,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
//! A widget used to display thumbnail. To display thumbnails within item views, use ThumbnailDelegate
|
||||
//! A widget used to display thumbnail
|
||||
class ThumbnailWidget
|
||||
: public QWidget
|
||||
{
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ namespace AzToolsFramework
|
||||
worldFromLocal.ExtractUniformScale();
|
||||
m_manipulators = AZStd::make_unique<ScaleManipulators>(worldFromLocal);
|
||||
m_manipulators->Register(g_mainManipulatorManagerId);
|
||||
m_manipulators->AddEntityComponentIdPair(entityComponentIdPair);
|
||||
m_manipulators->SetAxes(AZ::Vector3::CreateAxisX(), AZ::Vector3::CreateAxisY(), AZ::Vector3::CreateAxisZ());
|
||||
const float axisLength = 2.0f;
|
||||
m_manipulators->ConfigureView(
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ComponentPaletteModelFilter.hxx"
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
|
||||
ComponentPaletteModelFilter::ComponentPaletteModelFilter(QObject* parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool ComponentPaletteModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
if (!index.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!filterRegExp().isValid())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
auto componentClass = reinterpret_cast<const AZ::SerializeContext::ClassData*>(sourceModel()->data(index, Qt::ItemDataRole::UserRole + 1).toULongLong());
|
||||
if (componentClass)
|
||||
{
|
||||
const QString componentName = sourceModel()->data(index, Qt::DisplayRole).toString();
|
||||
return componentName.contains(filterRegExp());
|
||||
}
|
||||
|
||||
const int childRowCount = sourceModel()->rowCount(index);
|
||||
for (int childRow = 0; childRow < childRowCount; ++childRow)
|
||||
{
|
||||
if (filterAcceptsRow(childRow, index))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#include "UI/ComponentPalette/moc_ComponentPaletteModelFilter.cpp"
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QSortFilterProxyModel>
|
||||
#endif
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
class ComponentPaletteModelFilter : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ComponentPaletteModelFilter(QObject* parent = nullptr);
|
||||
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
|
||||
protected:
|
||||
QRegExp m_filterRegExp;
|
||||
};
|
||||
}
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "UIFrameworkAPI.h"
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/std/delegate/delegate.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <QtGui/qpa/qplatformnativeinterface.h>
|
||||
#endif
|
||||
|
||||
#include <AzToolsFramework/UI/UICore/OverwritePromptDialog.hxx>
|
||||
|
||||
#include <QWindow>
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace
|
||||
{
|
||||
// an aggregator utility which essentially provides the operation of returning the last result of an ebus event
|
||||
// which returned something which returns a non-false value (like for example if its a pointer, then the last non-null value)
|
||||
template<class T>
|
||||
struct EBusLastNonNullResult
|
||||
{
|
||||
T value;
|
||||
EBusLastNonNullResult() { value = NULL; }
|
||||
AZ_FORCE_INLINE void operator=(const T& rhs)
|
||||
{
|
||||
if (rhs)
|
||||
{
|
||||
value = rhs;
|
||||
}
|
||||
}
|
||||
AZ_FORCE_INLINE T& operator->() { return value; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct EBusAnyTrueResult
|
||||
{
|
||||
T value;
|
||||
AZ_FORCE_INLINE void operator=(const T& rhs) { value = rhs || value; }
|
||||
AZ_FORCE_INLINE T& operator->() { return value; }
|
||||
};
|
||||
}
|
||||
|
||||
bool GetOverwritePromptResult(QWidget* pParentWidget, const char* assetNameToOvewrite)
|
||||
{
|
||||
OverwritePromptDialog dlg(pParentWidget);
|
||||
if (assetNameToOvewrite)
|
||||
{
|
||||
dlg.UpdateLabel(QString::fromUtf8(assetNameToOvewrite));
|
||||
}
|
||||
|
||||
if (!dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return dlg.m_result;
|
||||
}
|
||||
}
|
||||
@@ -890,6 +890,7 @@ namespace AzToolsFramework
|
||||
|
||||
m_actionGoToEntitiesInViewport = new QAction(tr("Find in viewport"), this);
|
||||
m_actionGoToEntitiesInViewport->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
m_actionGoToEntitiesInViewport->setShortcut(tr("Z"));
|
||||
connect(m_actionGoToEntitiesInViewport, &QAction::triggered, this, &EntityOutlinerWidget::GoToEntitiesInViewport);
|
||||
addAction(m_actionGoToEntitiesInViewport);
|
||||
}
|
||||
|
||||
+2
-2
@@ -217,7 +217,7 @@ namespace AzToolsFramework
|
||||
});
|
||||
|
||||
EditorActionRequestBus::Broadcast(
|
||||
&EditorActionRequests::AddActionViaBusCrc, AZ_CRC_CE("com.o3de.action.editortransform.prefabopen"),
|
||||
&EditorActionRequests::AddActionViaBusCrc, AZ_CRC_CE("org.o3de.action.editortransform.prefabopen"),
|
||||
m_actions.back().get());
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace AzToolsFramework
|
||||
});
|
||||
|
||||
EditorActionRequestBus::Broadcast(
|
||||
&EditorActionRequests::AddActionViaBusCrc, AZ_CRC_CE("com.o3de.action.editortransform.prefabclose"),
|
||||
&EditorActionRequests::AddActionViaBusCrc, AZ_CRC_CE("org.o3de.action.editortransform.prefabclose"),
|
||||
m_actions.back().get());
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -44,6 +44,9 @@ namespace AzToolsFramework::Prefab
|
||||
m_breadcrumbsWidget = breadcrumbsWidget;
|
||||
m_backButton = backButton;
|
||||
|
||||
// Add icons to the widget
|
||||
m_breadcrumbsWidget->setDefaultIcon(QString(":/Entity/prefab_edit.svg"));
|
||||
|
||||
// If a part of the path is clicked, focus on that instance
|
||||
connect(m_breadcrumbsWidget, &AzQtComponents::BreadCrumbs::linkClicked, this,
|
||||
[&](const QString&, int linkIndex)
|
||||
@@ -73,6 +76,12 @@ namespace AzToolsFramework::Prefab
|
||||
{
|
||||
// Push new Path
|
||||
m_breadcrumbsWidget->pushPath(m_prefabFocusPublicInterface->GetPrefabFocusPath(m_editorEntityContextId).c_str());
|
||||
|
||||
// Set root icon
|
||||
m_breadcrumbsWidget->setIconAt(0, QString(":/Level/level.svg"));
|
||||
|
||||
// If root instance is focused, disable the back button; else enable it.
|
||||
m_backButton->setEnabled(m_prefabFocusPublicInterface->GetPrefabFocusPathLength(m_editorEntityContextId) > 1);
|
||||
}
|
||||
|
||||
} // namespace AzToolsFramework::Prefab
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include "DHQSlider.hxx"
|
||||
#include "PropertyQTConstants.h"
|
||||
#include <QtWidgets/QAbstractSpinBox>
|
||||
AZ_PUSH_DISABLE_WARNING(4244 4251, "-Wunknown-warning-option") // 4244: conversion from 'int' to 'float', possible loss of data
|
||||
// 4251: 'QInputEvent::modState': class 'QFlags<Qt::KeyboardModifier>' needs to have dll-interface to be used by clients of class 'QInputEvent'
|
||||
#include <QWheelEvent>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
void DHQSlider::wheelEvent(QWheelEvent* e)
|
||||
{
|
||||
if (hasFocus())
|
||||
{
|
||||
QSlider::wheelEvent(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
e->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeSliderPropertyWidgets(QSlider* slider, QAbstractSpinBox* spinbox)
|
||||
{
|
||||
if (slider == nullptr || spinbox == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// A 2:1 ratio between spinbox and slider gives the slider more room,
|
||||
// but leaves some space for the spin box to expand.
|
||||
const int spinBoxStretch = 1;
|
||||
const int sliderStretch = 2;
|
||||
|
||||
QSizePolicy sizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||
sizePolicy.setHorizontalStretch(spinBoxStretch);
|
||||
spinbox->setSizePolicy(sizePolicy);
|
||||
spinbox->setMinimumWidth(PropertyQTConstant_MinimumWidth);
|
||||
spinbox->setFixedHeight(PropertyQTConstant_DefaultHeight);
|
||||
spinbox->setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
sizePolicy.setHorizontalStretch(sliderStretch);
|
||||
slider->setSizePolicy(sizePolicy);
|
||||
slider->setMinimumWidth(PropertyQTConstant_MinimumWidth);
|
||||
slider->setFixedHeight(PropertyQTConstant_DefaultHeight);
|
||||
slider->setFocusPolicy(Qt::StrongFocus);
|
||||
slider->setFocusProxy(spinbox);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AZ_Q_SLIDER_HXX
|
||||
#define AZ_Q_SLIDER_HXX
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <QtWidgets/QSlider>
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
class QAbstractSpinBox;
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
class DHQSlider
|
||||
: public QSlider
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(DHQSlider, AZ::SystemAllocator, 0);
|
||||
|
||||
explicit DHQSlider(QWidget* parent = 0)
|
||||
: QSlider(parent) {}
|
||||
|
||||
DHQSlider(Qt::Orientation orientation, QWidget* parent = 0)
|
||||
: QSlider(orientation, parent) {}
|
||||
|
||||
void wheelEvent(QWheelEvent* e);
|
||||
};
|
||||
|
||||
// Share widget initialization code between double and int based slider properties.
|
||||
void InitializeSliderPropertyWidgets(QSlider*, QAbstractSpinBox*);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzToolsFramework/Debug/TraceContext.h>
|
||||
#include <AzCore/PlatformDef.h>
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // 4251: 'QRawFont::d': class 'QExplicitlySharedDataPointer<QRawFontPrivate>' needs to have dll-interface to be used by clients of class 'QRawFont'
|
||||
// 4800: 'QTextEngine *const ': forcing value to bool 'true' or 'false' (performance warning)
|
||||
#include <QTextBlock>
|
||||
|
||||
+1
-2
@@ -18,8 +18,7 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option")
|
||||
#include <QPainter>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
#include <QtWidgets/QToolButton>
|
||||
|
||||
#include "../UICore/ColorPickerDelegate.hxx"
|
||||
#include <QtGui/QRegExpValidator>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
|
||||
-1
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
#include <cmath>
|
||||
#include "PropertyDoubleSliderCtrl.hxx"
|
||||
#include "DHQSlider.hxx"
|
||||
#include "PropertyQTConstants.h"
|
||||
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: 'QLayoutItem::align': class 'QFlags<Qt::AlignmentFlag>' needs to have dll-interface to be used by clients of class 'QLayoutItem'
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
|
||||
-346
@@ -1,346 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef PROPERTYEDITOR_UITYPES_H
|
||||
#define PROPERTYEDITOR_UITYPES_H
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include "PropertyEditor/EditorClassReflectionTest.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace PropertySystem
|
||||
{
|
||||
typedef AZStd::function < void(const AZStd::string& FieldName, AZStd::vector<AZStd::string>& dEnumNames) >
|
||||
EnumNamesCallback;
|
||||
|
||||
class EditorUIInfo_Enum
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_Enum, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_Enum, AZ::SystemAllocator, 0);
|
||||
|
||||
EnumNamesCallback m_enumNamesCallBack;
|
||||
|
||||
EditorUIInfo_Enum(EnumNamesCallback enumNamesCallBack, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
, m_enumNamesCallBack(enumNamesCallBack)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_EnumComboBox
|
||||
: public EditorUIInfo_Enum
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_EnumComboBox, EditorUIInfo_Enum);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_EnumComboBox, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_EnumComboBox(EnumNamesCallback enumNamesCallBack, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Enum(enumNamesCallBack, inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
typedef AZStd::function < void(const AZStd::string& FieldName, AZStd::vector<AZStd::string>& dEnumNames) >
|
||||
ChoiceNamesCallback;
|
||||
|
||||
class EditorUIInfo_Choice
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_Choice, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_Choice, AZ::SystemAllocator, 0);
|
||||
|
||||
ChoiceNamesCallback m_choiceNamesCallBack;
|
||||
|
||||
EditorUIInfo_Choice(ChoiceNamesCallback choiceNamesCallBack, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
, m_choiceNamesCallBack(choiceNamesCallBack)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_ChoiceComboBox
|
||||
: public EditorUIInfo_Choice
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_ChoiceComboBox, EditorUIInfo_Choice);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_ChoiceComboBox, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_ChoiceComboBox(ChoiceNamesCallback choiceNamesCallBack, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Choice(choiceNamesCallBack, inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_Bool
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_Bool, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_Bool, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_Bool(AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_BoolComboBox
|
||||
: public EditorUIInfo_Bool
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_BoolComboBox, EditorUIInfo_Bool);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_BoolComboBox, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_BoolComboBox(AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Bool(inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_BoolDialogBox
|
||||
: public EditorUIInfo_Bool
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_BoolDialogBox, EditorUIInfo_Bool);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_BoolDialogBox, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_BoolDialogBox(AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Bool(inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class EditorUIInfo_Int
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_Int, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_Int, AZ::SystemAllocator, 0);
|
||||
|
||||
int m_minVal;
|
||||
int m_maxVal;
|
||||
|
||||
EditorUIInfo_Int(int minVal = INT_MIN, int maxVal = INT_MAX, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
, m_minVal(minVal)
|
||||
, m_maxVal(maxVal)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_IntSpinBox
|
||||
: public EditorUIInfo_Int
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_IntSpinBox, EditorUIInfo_Int);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_IntSpinBox, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_IntSpinBox(int minVal = INT_MIN, int maxVal = INT_MAX, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Int(minVal, maxVal, inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_IntSlider
|
||||
: public EditorUIInfo_Int
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_IntSlider, EditorUIInfo_Int);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_IntSlider, AZ::SystemAllocator, 0);
|
||||
|
||||
int m_step;
|
||||
|
||||
EditorUIInfo_IntSlider(int step = 1, int minVal = INT_MIN, int maxVal = INT_MAX, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Int(minVal, maxVal, inFlags)
|
||||
, m_step(step)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_Float
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_Float, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_Float, AZ::SystemAllocator, 0);
|
||||
|
||||
float m_minVal;
|
||||
float m_maxVal;
|
||||
|
||||
EditorUIInfo_Float(float minVal = std::numeric_limits<float>::min(), float maxVal = std::numeric_limits<float>::max(), AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
, m_minVal(minVal)
|
||||
, m_maxVal(maxVal)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_FloatSpinBox
|
||||
: public EditorUIInfo_Float
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_FloatSpinBox, EditorUIInfo_Float);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_FloatSpinBox, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_FloatSpinBox(float minVal = std::numeric_limits<float>::min(), float maxVal = std::numeric_limits<float>::max(), AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Float(minVal, maxVal, inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_FloatSlider
|
||||
: public EditorUIInfo_Float
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_FloatSlider, EditorUIInfo_Float);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_FloatSlider, AZ::SystemAllocator, 0);
|
||||
|
||||
float m_step;
|
||||
|
||||
EditorUIInfo_FloatSlider(float step = 1.f, float minVal = std::numeric_limits<float>::min(), float maxVal = std::numeric_limits<float>::max(), AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Float(minVal, maxVal, inFlags)
|
||||
, m_step(step)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_Double
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_Double, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_Double, AZ::SystemAllocator, 0);
|
||||
|
||||
double m_minVal;
|
||||
double m_maxVal;
|
||||
|
||||
EditorUIInfo_Double(double minVal = DBL_MIN, double maxVal = DBL_MAX, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
, m_minVal(minVal)
|
||||
, m_maxVal(maxVal)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_DoubleSpinBox
|
||||
: public EditorUIInfo_Double
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_DoubleSpinBox, EditorUIInfo_Double);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_DoubleSpinBox, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_DoubleSpinBox(double minVal = DBL_MIN, double maxVal = DBL_MAX, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Double(minVal, maxVal, inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_DoubleSlider
|
||||
: public EditorUIInfo_Double
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_DoubleSlider, EditorUIInfo_Double);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_DoubleSlider, AZ::SystemAllocator, 0);
|
||||
|
||||
double m_step;
|
||||
|
||||
EditorUIInfo_DoubleSlider(double step = 1.0, double minVal = DBL_MIN, double maxVal = DBL_MAX, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_Double(minVal, maxVal, inFlags)
|
||||
, m_step(step)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_String
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_String, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_String, AZ::SystemAllocator, 0);
|
||||
|
||||
int m_maxChars;
|
||||
|
||||
EditorUIInfo_String(int maxchars = -1, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
, m_maxChars(maxchars)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EditorUIInfo_StringLineEdit
|
||||
: public EditorUIInfo_String
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_StringLineEdit, EditorUIInfo_String);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_StringLineEdit, AZ::SystemAllocator, 0);
|
||||
|
||||
EditorUIInfo_StringLineEdit(int maxchars = -1, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo_String(maxchars, inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
typedef AZStd::function<AZStd::string(int /*Index*/, int /*purpose*/)> DropListInfoCallback;
|
||||
|
||||
class EditorUIInfo_DropdownList
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_DropdownList, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_DropdownList, AZ::SystemAllocator, 0);
|
||||
EditorUIInfo_DropdownList(DropListInfoCallback info, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// this function, if you supply it, will be called by the UI and other system to determine whether or not to show
|
||||
// your property at all. This allows you to make properties which only show up when certain other properties are set.
|
||||
typedef AZStd::function < bool(const AZStd::string& /*property name*/, void* /* propertyOwner */, const EditorDataContext::ToolsComponentInfo* /* component info */) >
|
||||
GroupDisplayBooleanFunction;
|
||||
|
||||
// a group is special in that it has children and uses a function to determine what to write for the group and whether to show the group
|
||||
class EditorUIInfo_Group
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_Group, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_Group, AZ::SystemAllocator, 0);
|
||||
EditorUIInfo_Group(GroupDisplayBooleanFunction displayBoolFn = 0, AZ::u32 inFlags = 0)
|
||||
: EditorUIInfo(inFlags)
|
||||
, m_displayBoolFn(displayBoolFn)
|
||||
{
|
||||
}
|
||||
GroupDisplayBooleanFunction m_displayBoolFn;
|
||||
};
|
||||
|
||||
class EditorUIInfo_Class
|
||||
: public EditorUIInfo
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorUIInfo_Class, EditorUIInfo);
|
||||
AZ_CLASS_ALLOCATOR(EditorUIInfo_Class, AZ::SystemAllocator, 0);
|
||||
|
||||
AZ::Uuid m_classID;
|
||||
|
||||
EditorUIInfo_Class(const AZ::Uuid& classID = AZ::Uuid::CreateNull())
|
||||
: m_classID(classID)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
#endif
|
||||
-1
@@ -6,7 +6,6 @@
|
||||
*
|
||||
*/
|
||||
#include "PropertyIntSliderCtrl.hxx"
|
||||
#include "DHQSlider.hxx"
|
||||
#include "PropertyQTConstants.h"
|
||||
#include <AzQtComponents/Components/Widgets/SpinBox.h>
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzToolsFramework/Debug/TraceContext.h>
|
||||
#include <AzCore/PlatformDef.h>
|
||||
|
||||
// 4251: 'QRawFont::d': class 'QExplicitlySharedDataPointer<QRawFontPrivate>' needs to have dll-interface to be used by clients of class
|
||||
// 'QRawFont' 4800: 'QTextEngine *const ': forcing value to bool 'true' or 'false' (performance warning)
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "AZAutoSizingScrollArea.hxx"
|
||||
|
||||
#include <qscrollbar.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
|
||||
AZAutoSizingScrollArea::AZAutoSizingScrollArea(QWidget* parent)
|
||||
: QScrollArea(parent)
|
||||
{
|
||||
}
|
||||
|
||||
// this code was copied from the regular implementation of the same function in QScrollArea, but converted
|
||||
// the private calls to public calls and removed the cache.
|
||||
QSize AZAutoSizingScrollArea::sizeHint() const
|
||||
{
|
||||
int initialSize = 2 * frameWidth();
|
||||
QSize sizeHint(initialSize, initialSize);
|
||||
|
||||
if (widget())
|
||||
{
|
||||
sizeHint += this->widgetResizable() ? widget()->sizeHint() : widget()->size();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we don't have a widget, we want to reserve some space visually for ourselves.
|
||||
int fontHeight = fontMetrics().height();
|
||||
sizeHint += QSize(2 * fontHeight, 2 * fontHeight);
|
||||
}
|
||||
|
||||
if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOn)
|
||||
{
|
||||
sizeHint.setWidth(sizeHint.width() + verticalScrollBar()->sizeHint().width());
|
||||
}
|
||||
|
||||
if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOn)
|
||||
{
|
||||
sizeHint.setHeight(sizeHint.height() + horizontalScrollBar()->sizeHint().height());
|
||||
}
|
||||
|
||||
return sizeHint;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "UI/UICore/moc_AZAutoSizingScrollArea.cpp"
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AZAUTOSIZINGSCROLLAREA_HXX
|
||||
#define AZAUTOSIZINGSCROLLAREA_HXX
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtWidgets/QScrollArea>
|
||||
#endif
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
// This fixes a bug in QScrollArea which makes it so that you can dynamically add and remove elements from inside it, and the scroll
|
||||
// area will take up as much room as it needs to, to prevent the need for scroll bars. Scroll bars will still appear if there is not enough
|
||||
// room, but the view will scale up to eat all available room before that happens.
|
||||
|
||||
// QScrollArea was supposed to do this, but it appears to cache the size of its embedded widget on startup, and never clears that cache.
|
||||
class AZAutoSizingScrollArea
|
||||
: public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(AZAutoSizingScrollArea, AZ::SystemAllocator, 0);
|
||||
|
||||
explicit AZAutoSizingScrollArea(QWidget* parent = 0);
|
||||
|
||||
QSize sizeHint() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include <QtCore/QAbstractItemModel>
|
||||
#include "ColorPickerDelegate.hxx"
|
||||
|
||||
#include <AzQtComponents/Components/Widgets/ColorPicker.h>
|
||||
#include <AzQtComponents/Utilities/Conversions.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
ColorPickerDelegate::ColorPickerDelegate(QObject* pParent)
|
||||
: QStyledItemDelegate(pParent)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget* ColorPickerDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
(void)index;
|
||||
(void)option;
|
||||
AzQtComponents::ColorPicker* ptrDialog = new AzQtComponents::ColorPicker(AzQtComponents::ColorPicker::Configuration::RGB,
|
||||
tr("Select Color"), parent);
|
||||
ptrDialog->setWindowFlags(Qt::Tool);
|
||||
return ptrDialog;
|
||||
}
|
||||
|
||||
void ColorPickerDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
|
||||
{
|
||||
AzQtComponents::ColorPicker* colorEditor = qobject_cast<AzQtComponents::ColorPicker*>(editor);
|
||||
|
||||
if (!editor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QVariant colorResult = index.data(COLOR_PICKER_ROLE);
|
||||
if (colorResult == QVariant())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QColor pickedColor = qvariant_cast<QColor>(colorResult);
|
||||
colorEditor->setCurrentColor(AzQtComponents::fromQColor(pickedColor));
|
||||
}
|
||||
|
||||
void ColorPickerDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
|
||||
{
|
||||
AzQtComponents::ColorPicker* colorEditor = qobject_cast<AzQtComponents::ColorPicker*>(editor);
|
||||
|
||||
if (!editor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QVariant colorVariant = AzQtComponents::toQColor(colorEditor->currentColor());
|
||||
model->setData(index, colorVariant, COLOR_PICKER_ROLE);
|
||||
}
|
||||
|
||||
void ColorPickerDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
(void)index;
|
||||
QRect pickerpos = option.rect;
|
||||
|
||||
pickerpos.setTopLeft(editor->parentWidget()->mapToGlobal(pickerpos.topLeft()));
|
||||
pickerpos.adjust(64, 0, 0, 0);
|
||||
editor->setGeometry(pickerpos);
|
||||
}
|
||||
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
#include "UI/UICore/moc_ColorPickerDelegate.cpp"
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef COLOR_PICKER_DELEGATE_HXX
|
||||
#define COLOR_PICKER_DELEGATE_HXX
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <QtWidgets/QStyledItemDelegate>
|
||||
#endif
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
/**
|
||||
* A delegate which handles the double clicking to pop open a color picker dialog, as long as the role is COLOR_PICKER_ROLE.
|
||||
* To use it, just add a setData() and a data() function to your model which returns a QColor (or accepts one) whenever the COLOR_PICKER_ROLE is queried.
|
||||
**/
|
||||
class ColorPickerDelegate
|
||||
: public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
static const int COLOR_PICKER_ROLE = Qt::UserRole + 1;
|
||||
|
||||
AZ_CLASS_ALLOCATOR(ColorPickerDelegate, AZ::SystemAllocator, 0);
|
||||
ColorPickerDelegate(QObject* pParent);
|
||||
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||
virtual void setEditorData(QWidget* editor, const QModelIndex& index) const;
|
||||
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
|
||||
virtual void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||
};
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
#endif //COLOR_PICKER_DELEGATE_HXX
|
||||
@@ -23,11 +23,11 @@ namespace AzToolsFramework
|
||||
/// @name Reverse URLs.
|
||||
/// Used to identify common actions and override them when necessary.
|
||||
//@{
|
||||
static const AZ::Crc32 s_backAction = AZ_CRC("com.o3de.action.common.back", 0x80c3030f);
|
||||
static const AZ::Crc32 s_deleteAction = AZ_CRC("com.o3de.action.common.delete", 0x58e78eed);
|
||||
static const AZ::Crc32 s_duplicateAction = AZ_CRC("com.o3de.action.common.duplicate", 0xbc5a4a23);
|
||||
static const AZ::Crc32 s_nextComponentMode = AZ_CRC("com.o3de.action.common.nextComponentMode", 0xf9aca3a8);
|
||||
static const AZ::Crc32 s_previousComponentMode = AZ_CRC("com.o3de.action.common.previousComponentMode", 0x0580eaec);
|
||||
static const AZ::Crc32 s_backAction = AZ_CRC_CE("org.o3de.action.common.back");
|
||||
static const AZ::Crc32 s_deleteAction = AZ_CRC_CE("org.o3de.action.common.delete");
|
||||
static const AZ::Crc32 s_duplicateAction = AZ_CRC_CE("org.o3de.action.common.duplicate");
|
||||
static const AZ::Crc32 s_nextComponentMode = AZ_CRC_CE("org.o3de.action.common.nextComponentMode");
|
||||
static const AZ::Crc32 s_previousComponentMode = AZ_CRC_CE("org.o3de.action.common.previousComponentMode");
|
||||
//@}
|
||||
|
||||
/// Specific Action properties to be sent to a type implementing
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
|
||||
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportInteractionHelpers.h>
|
||||
|
||||
|
||||
namespace AzToolsFramework::ViewportInteraction
|
||||
{
|
||||
MouseButton Helpers::GetMouseButton(const AzFramework::InputChannel& inputChannel)
|
||||
{
|
||||
using AzToolsFramework::ViewportInteraction::MouseButton;
|
||||
using InputButton = AzFramework::InputDeviceMouse::Button;
|
||||
const AzFramework::InputChannelId& id = inputChannel.GetInputChannelId();
|
||||
if (id == InputButton::Left)
|
||||
{
|
||||
return MouseButton::Left;
|
||||
}
|
||||
if (id == InputButton::Middle)
|
||||
{
|
||||
return MouseButton::Middle;
|
||||
}
|
||||
if (id == InputButton::Right)
|
||||
{
|
||||
return MouseButton::Right;
|
||||
}
|
||||
return MouseButton::None;
|
||||
}
|
||||
|
||||
bool Helpers::IsMouseMove(const AzFramework::InputChannel& inputChannel)
|
||||
{
|
||||
return inputChannel.GetInputChannelId() == AzFramework::InputDeviceMouse::SystemCursorPosition;
|
||||
}
|
||||
|
||||
KeyboardModifier Helpers::GetKeyboardModifier(const AzFramework::InputChannel& inputChannel)
|
||||
{
|
||||
using AzToolsFramework::ViewportInteraction::KeyboardModifier;
|
||||
using Key = AzFramework::InputDeviceKeyboard::Key;
|
||||
const auto& id = inputChannel.GetInputChannelId();
|
||||
if (id == Key::ModifierAltL || id == Key::ModifierAltR)
|
||||
{
|
||||
return KeyboardModifier::Alt;
|
||||
}
|
||||
if (id == Key::ModifierCtrlL || id == Key::ModifierCtrlR)
|
||||
{
|
||||
return KeyboardModifier::Ctrl;
|
||||
}
|
||||
if (id == Key::ModifierShiftL || id == Key::ModifierShiftR)
|
||||
{
|
||||
return KeyboardModifier::Shift;
|
||||
}
|
||||
return KeyboardModifier::None;
|
||||
}
|
||||
} // namespace AzToolsFramework::ViewportInteraction
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Input/Channels/InputChannel.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportTypes.h>
|
||||
|
||||
|
||||
namespace AzToolsFramework::ViewportInteraction
|
||||
{
|
||||
class Helpers
|
||||
{
|
||||
public:
|
||||
static MouseButton GetMouseButton(const AzFramework::InputChannel& inputChannel);
|
||||
static bool IsMouseMove(const AzFramework::InputChannel& inputChannel);
|
||||
static KeyboardModifier GetKeyboardModifier(const AzFramework::InputChannel& inputChannel);
|
||||
};
|
||||
} // namespace AzToolsFramework::ViewportInteraction
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <AzFramework/Render/IntersectorInterface.h>
|
||||
#include <AzFramework/Terrain/TerrainDataRequestBus.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
@@ -66,15 +67,19 @@ namespace AzToolsFramework
|
||||
|
||||
AZ::Vector3 FindClosestPickIntersection(const AzFramework::RenderGeometry::RayRequest& rayRequest, const float defaultDistance)
|
||||
{
|
||||
AzFramework::RenderGeometry::RayResult renderGeometryIntersectionResult;
|
||||
// attempt a ray intersection with any visible mesh or terrain and return the intersection position if successful
|
||||
AZ::EBusReduceResult<AzFramework::RenderGeometry::RayResult, AzFramework::RenderGeometry::RayResultClosestAggregator> renderGeometryIntersectionResult;
|
||||
AzFramework::RenderGeometry::IntersectorBus::EventResult(
|
||||
renderGeometryIntersectionResult, AzToolsFramework::GetEntityContextId(),
|
||||
&AzFramework::RenderGeometry::IntersectorBus::Events::RayIntersect, rayRequest);
|
||||
AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(
|
||||
renderGeometryIntersectionResult,
|
||||
&AzFramework::Terrain::TerrainDataRequests::GetClosestIntersection,
|
||||
rayRequest);
|
||||
|
||||
// attempt a ray intersection with any visible mesh and return the intersection position if successful
|
||||
if (renderGeometryIntersectionResult)
|
||||
if (renderGeometryIntersectionResult.value)
|
||||
{
|
||||
return renderGeometryIntersectionResult.m_worldPosition;
|
||||
return renderGeometryIntersectionResult.value.m_worldPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -150,6 +150,9 @@ namespace AzToolsFramework
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
//! A bus to listen to just the MouseViewportRequests.
|
||||
using ViewportMouseRequestBus = AZ::EBus<MouseViewportRequests, ViewportEBusTraits>;
|
||||
|
||||
//! Requests that can be made to the viewport to query and modify its state.
|
||||
class ViewportInteractionRequests
|
||||
{
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
}
|
||||
|
||||
AZ::Crc32 m_uri; //!< Unique identifier for the Action. (In the form 'com.o3de.action.---").
|
||||
AZ::Crc32 m_uri; //!< Unique identifier for the Action. (In the form 'org.o3de.action.---").
|
||||
AZStd::vector<AZStd::function<void()>> m_callbacks; //!< Callbacks associated with this Action (note: with multi-selections
|
||||
//!< there will be a callback per Entity/Component).
|
||||
AZStd::unique_ptr<QAction> m_action; //!< The QAction associated with the overrideWidget for all ComponentMode actions.
|
||||
|
||||
+3
-2
@@ -95,11 +95,12 @@ namespace AzToolsFramework
|
||||
entityId,
|
||||
[mouseInteraction, &entityPicked, &closestDistance, viewportId](EditorComponentSelectionRequests* handler) -> bool
|
||||
{
|
||||
if (handler->SupportsEditorRayIntersect())
|
||||
const auto viewportInfo = AzFramework::ViewportInfo{ viewportId };
|
||||
if (handler->SupportsEditorRayIntersectViewport(viewportInfo))
|
||||
{
|
||||
float distance = std::numeric_limits<float>::max();
|
||||
const bool intersection = handler->EditorSelectionIntersectRayViewport(
|
||||
{ viewportId }, mouseInteraction.m_mousePick.m_rayOrigin, mouseInteraction.m_mousePick.m_rayDirection, distance);
|
||||
viewportInfo, mouseInteraction.m_mousePick.m_rayOrigin, mouseInteraction.m_mousePick.m_rayDirection, distance);
|
||||
|
||||
if (intersection && distance < closestDistance)
|
||||
{
|
||||
|
||||
+17
-17
@@ -17,23 +17,23 @@ namespace AzToolsFramework
|
||||
//! @name Reverse URLs.
|
||||
//! Used to identify common actions and override them when necessary.
|
||||
//@{
|
||||
constexpr inline AZ::Crc32 LockSelection = AZ_CRC_CE("com.o3de.action.editortransform.lockselect");
|
||||
constexpr inline AZ::Crc32 UnlockSelection = AZ_CRC_CE("com.o3de.action.editortransform.unlockselect");
|
||||
constexpr inline AZ::Crc32 HideSelection = AZ_CRC_CE("com.o3de.action.editortransform.hideselect");
|
||||
constexpr inline AZ::Crc32 ShowSelection = AZ_CRC_CE("com.o3de.action.editortransform.showselect");
|
||||
constexpr inline AZ::Crc32 UnlockAll = AZ_CRC_CE("com.o3de.action.editortransform.unlockall");
|
||||
constexpr inline AZ::Crc32 ShowAll = AZ_CRC_CE("com.o3de.action.editortransform.unhideall");
|
||||
constexpr inline AZ::Crc32 SelectAll = AZ_CRC_CE("com.o3de.action.editortransform.selectall");
|
||||
constexpr inline AZ::Crc32 InvertSelect = AZ_CRC_CE("com.o3de.action.editortransform.invertselect");
|
||||
constexpr inline AZ::Crc32 DuplicateSelect = AZ_CRC_CE("com.o3de.action.editortransform.duplicateselect");
|
||||
constexpr inline AZ::Crc32 DeleteSelect = AZ_CRC_CE("com.o3de.action.editortransform.deleteselect");
|
||||
constexpr inline AZ::Crc32 EditEscaspe = AZ_CRC_CE("com.o3de.action.editortransform.editescape");
|
||||
constexpr inline AZ::Crc32 EditPivot = AZ_CRC_CE("com.o3de.action.editortransform.editpivot");
|
||||
constexpr inline AZ::Crc32 EditReset = AZ_CRC_CE("com.o3de.action.editortransform.editreset");
|
||||
constexpr inline AZ::Crc32 EditResetManipulator = AZ_CRC_CE("com.o3de.action.editortransform.editresetmanipulator");
|
||||
constexpr inline AZ::Crc32 ViewportUiVisible = AZ_CRC_CE("com.o3de.action.editortransform.viewportuivisible");
|
||||
constexpr inline AZ::Crc32 Helpers = AZ_CRC_CE("com.o3de.action.editor.helpers");
|
||||
constexpr inline AZ::Crc32 Icons = AZ_CRC_CE("com.o3de.action.editor.icons");
|
||||
constexpr inline AZ::Crc32 LockSelection = AZ_CRC_CE("org.o3de.action.editortransform.lockselect");
|
||||
constexpr inline AZ::Crc32 UnlockSelection = AZ_CRC_CE("org.o3de.action.editortransform.unlockselect");
|
||||
constexpr inline AZ::Crc32 HideSelection = AZ_CRC_CE("org.o3de.action.editortransform.hideselect");
|
||||
constexpr inline AZ::Crc32 ShowSelection = AZ_CRC_CE("org.o3de.action.editortransform.showselect");
|
||||
constexpr inline AZ::Crc32 UnlockAll = AZ_CRC_CE("org.o3de.action.editortransform.unlockall");
|
||||
constexpr inline AZ::Crc32 ShowAll = AZ_CRC_CE("org.o3de.action.editortransform.unhideall");
|
||||
constexpr inline AZ::Crc32 SelectAll = AZ_CRC_CE("org.o3de.action.editortransform.selectall");
|
||||
constexpr inline AZ::Crc32 InvertSelect = AZ_CRC_CE("org.o3de.action.editortransform.invertselect");
|
||||
constexpr inline AZ::Crc32 DuplicateSelect = AZ_CRC_CE("org.o3de.action.editortransform.duplicateselect");
|
||||
constexpr inline AZ::Crc32 DeleteSelect = AZ_CRC_CE("org.o3de.action.editortransform.deleteselect");
|
||||
constexpr inline AZ::Crc32 EditEscaspe = AZ_CRC_CE("org.o3de.action.editortransform.editescape");
|
||||
constexpr inline AZ::Crc32 EditPivot = AZ_CRC_CE("org.o3de.action.editortransform.editpivot");
|
||||
constexpr inline AZ::Crc32 EditReset = AZ_CRC_CE("org.o3de.action.editortransform.editreset");
|
||||
constexpr inline AZ::Crc32 EditResetManipulator = AZ_CRC_CE("org.o3de.action.editortransform.editresetmanipulator");
|
||||
constexpr inline AZ::Crc32 ViewportUiVisible = AZ_CRC_CE("org.o3de.action.editortransform.viewportuivisible");
|
||||
constexpr inline AZ::Crc32 Helpers = AZ_CRC_CE("org.o3de.action.editor.helpers");
|
||||
constexpr inline AZ::Crc32 Icons = AZ_CRC_CE("org.o3de.action.editor.icons");
|
||||
//@}
|
||||
|
||||
//! Provide interface for EditorTransformComponentSelection requests.
|
||||
|
||||
@@ -38,7 +38,6 @@ set(FILES
|
||||
API/EditorLevelNotificationBus.h
|
||||
API/ViewportEditorModeTrackerNotificationBus.h
|
||||
API/ViewportEditorModeTrackerNotificationBus.cpp
|
||||
API/EditorVegetationRequestsBus.h
|
||||
API/EditorPythonConsoleBus.h
|
||||
API/EditorPythonRunnerRequestsBus.h
|
||||
API/EditorPythonScriptNotificationsBus.h
|
||||
@@ -106,9 +105,6 @@ set(FILES
|
||||
Debug/TraceContextSingleStackHandler.cpp
|
||||
Debug/TraceContextMultiStackHandler.h
|
||||
Debug/TraceContextMultiStackHandler.cpp
|
||||
Debug/TraceContextBufferedFormatter.cpp
|
||||
Debug/TraceContextBufferedFormatter.inl
|
||||
Debug/TraceContextBufferedFormatter.h
|
||||
Debug/TraceContextLogFormatter.cpp
|
||||
Debug/TraceContextLogFormatter.h
|
||||
Component/EditorComponentAPIBus.h
|
||||
@@ -360,8 +356,6 @@ set(FILES
|
||||
UI/ComponentPalette/ComponentPaletteWidget.cpp
|
||||
UI/ComponentPalette/ComponentPaletteModel.hxx
|
||||
UI/ComponentPalette/ComponentPaletteModel.cpp
|
||||
UI/ComponentPalette/ComponentPaletteModelFilter.hxx
|
||||
UI/ComponentPalette/ComponentPaletteModelFilter.cpp
|
||||
UI/ComponentPalette/ComponentPaletteUtil.hxx
|
||||
UI/ComponentPalette/ComponentPaletteUtil.cpp
|
||||
UI/Layer/NameConflictWarning.hxx
|
||||
@@ -374,8 +368,6 @@ set(FILES
|
||||
UI/PropertyEditor/QtWidgetLimits.h
|
||||
UI/PropertyEditor/DHQComboBox.hxx
|
||||
UI/PropertyEditor/DHQComboBox.cpp
|
||||
UI/PropertyEditor/DHQSlider.hxx
|
||||
UI/PropertyEditor/DHQSlider.cpp
|
||||
UI/PropertyEditor/EntityIdQLabel.hxx
|
||||
UI/PropertyEditor/EntityIdQLabel.cpp
|
||||
UI/PropertyEditor/EntityIdQLineEdit.h
|
||||
@@ -406,7 +398,6 @@ set(FILES
|
||||
UI/PropertyEditor/PropertyDoubleSliderCtrl.cpp
|
||||
UI/PropertyEditor/PropertyDoubleSpinCtrl.hxx
|
||||
UI/PropertyEditor/PropertyDoubleSpinCtrl.cpp
|
||||
UI/PropertyEditor/PropertyEditor_UITypes.h
|
||||
UI/PropertyEditor/PropertyEditorAPI.h
|
||||
UI/PropertyEditor/PropertyEditorApi.cpp
|
||||
UI/PropertyEditor/PropertyEditorAPI_Internals.h
|
||||
@@ -453,10 +444,6 @@ set(FILES
|
||||
UI/Slice/SliceRelationshipWidget.hxx
|
||||
UI/UICore/AspectRatioAwarePixmapWidget.hxx
|
||||
UI/UICore/AspectRatioAwarePixmapWidget.cpp
|
||||
UI/UICore/AZAutoSizingScrollArea.hxx
|
||||
UI/UICore/AZAutoSizingScrollArea.cpp
|
||||
UI/UICore/ColorPickerDelegate.hxx
|
||||
UI/UICore/ColorPickerDelegate.cpp
|
||||
UI/UICore/ClickableLabel.hxx
|
||||
UI/UICore/ClickableLabel.cpp
|
||||
UI/UICore/IconButton.hxx
|
||||
@@ -484,11 +471,8 @@ set(FILES
|
||||
Commands/EntityStateCommand.h
|
||||
Commands/SelectionCommand.cpp
|
||||
Commands/SelectionCommand.h
|
||||
Commands/EntityTransformCommand.cpp
|
||||
Commands/EntityTransformCommand.h
|
||||
Commands/PreemptiveUndoCache.cpp
|
||||
Commands/PreemptiveUndoCache.h
|
||||
Commands/LegacyCommand.h
|
||||
Commands/BaseSliceCommand.cpp
|
||||
Commands/BaseSliceCommand.h
|
||||
Commands/SliceDetachEntityCommand.cpp
|
||||
@@ -504,6 +488,8 @@ set(FILES
|
||||
Viewport/EditorContextMenu.cpp
|
||||
Viewport/VertexContainerDisplay.h
|
||||
Viewport/VertexContainerDisplay.cpp
|
||||
Viewport/ViewportInteractionHelpers.h
|
||||
Viewport/ViewportInteractionHelpers.cpp
|
||||
Viewport/ViewportMessages.h
|
||||
Viewport/ViewportMessages.cpp
|
||||
Viewport/ViewportTypes.h
|
||||
@@ -643,8 +629,6 @@ set(FILES
|
||||
AssetBrowser/Previewer/PreviewerFrame.h
|
||||
Archive/ArchiveComponent.h
|
||||
Archive/ArchiveComponent.cpp
|
||||
Archive/NullArchiveComponent.h
|
||||
Archive/NullArchiveComponent.cpp
|
||||
Archive/ArchiveAPI.h
|
||||
UI/PropertyEditor/Model/AssetCompleterModel.h
|
||||
UI/PropertyEditor/Model/AssetCompleterModel.cpp
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
#
|
||||
|
||||
set(FILES
|
||||
UI/LegacyFramework/MainWindowSavedState.h
|
||||
UI/LegacyFramework/MainWindowSavedState.cpp
|
||||
UI/LegacyFramework/UIFramework.hxx
|
||||
UI/LegacyFramework/UIFramework.cpp
|
||||
UI/LegacyFramework/UIFrameworkAPI.h
|
||||
UI/LegacyFramework/UIFrameworkAPI.cpp
|
||||
UI/LegacyFramework/UIFrameworkPreferences.cpp
|
||||
UI/LegacyFramework/Resources/sharedResources.qrc
|
||||
UI/LegacyFramework/Core/EditorContextBus.h
|
||||
UI/LegacyFramework/Core/EditorFrameworkAPI.h
|
||||
UI/LegacyFramework/Core/EditorFrameworkAPI.cpp
|
||||
UI/LegacyFramework/Core/EditorFrameworkApplication.h
|
||||
UI/LegacyFramework/Core/EditorFrameworkApplication.cpp
|
||||
UI/LegacyFramework/Core/IPCComponent.h
|
||||
UI/LegacyFramework/Core/IPCComponent.cpp
|
||||
UI/LegacyFramework/CustomMenus/CustomMenusAPI.h
|
||||
UI/LegacyFramework/CustomMenus/CustomMenusComponent.cpp
|
||||
UI/UICore/OverwritePromptDialog.hxx
|
||||
UI/UICore/OverwritePromptDialog.cpp
|
||||
UI/UICore/OverwritePromptDialog.ui
|
||||
UI/UICore/SaveChangesDialog.hxx
|
||||
UI/UICore/SaveChangesDialog.cpp
|
||||
UI/UICore/SaveChangesDialog.ui
|
||||
ToolsFileUtils/ToolsFileUtils_win.cpp
|
||||
)
|
||||
@@ -12,7 +12,6 @@ set(FILES
|
||||
UI/LegacyFramework/UIFramework.hxx
|
||||
UI/LegacyFramework/UIFramework.cpp
|
||||
UI/LegacyFramework/UIFrameworkAPI.h
|
||||
UI/LegacyFramework/UIFrameworkAPI.cpp
|
||||
UI/LegacyFramework/UIFrameworkPreferences.cpp
|
||||
UI/LegacyFramework/Resources/sharedResources.qrc
|
||||
UI/LegacyFramework/Core/EditorContextBus.h
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
// overrides all new and delete and forwards them to the AZ allocator system
|
||||
// for tracking purposes.
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/Memory/allocatorbase.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
|
||||
void* operator new(std::size_t size, const AZ::Internal::AllocatorDummy*)
|
||||
{
|
||||
if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
|
||||
{
|
||||
AZ_Warning("MEMORY", false, "Memory is being allocated at static startup!");
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().Allocate(size, AZCORE_GLOBAL_NEW_ALIGNMENT, 0, "global operator aznew", 0, 0);
|
||||
}
|
||||
void* operator new[](std::size_t size, const AZ::Internal::AllocatorDummy*)
|
||||
{
|
||||
if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
|
||||
{
|
||||
AZ_Warning("MEMORY", false, "Memory is being allocated at static startup!");
|
||||
return malloc(size);
|
||||
}
|
||||
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().Allocate(size, AZCORE_GLOBAL_NEW_ALIGNMENT, 0, "global operator aznew[]", 0, 0);
|
||||
}
|
||||
void* operator new(std::size_t size, const char* fileName, int lineNum, const char* name, const AZ::Internal::AllocatorDummy*)
|
||||
{
|
||||
if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
|
||||
{
|
||||
AZ_Warning("MEMORY", false, "Memory is being allocated at static startup!");
|
||||
return malloc(size);
|
||||
}
|
||||
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().Allocate(size, AZCORE_GLOBAL_NEW_ALIGNMENT, 0, name ? name : "global operator aznew", fileName, lineNum);
|
||||
}
|
||||
void* operator new[](std::size_t size, const char* fileName, int lineNum, const char* name, const AZ::Internal::AllocatorDummy*)
|
||||
{
|
||||
if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
|
||||
{
|
||||
AZ_Warning("MEMORY", false, "Memory is being allocated at static startup!");
|
||||
return malloc(size);
|
||||
}
|
||||
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().Allocate(size, AZCORE_GLOBAL_NEW_ALIGNMENT, 0, name ? name : "global operator aznew[]", fileName, lineNum);
|
||||
}
|
||||
|
||||
void* operator new(std::size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
size = 1;
|
||||
}
|
||||
|
||||
if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
|
||||
{
|
||||
AZ_Warning("MEMORY", false, "Memory is being allocated at static startup!");
|
||||
return malloc(size);
|
||||
}
|
||||
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().Allocate(size, AZCORE_GLOBAL_NEW_ALIGNMENT, 0, "global operator new", 0, 0);
|
||||
}
|
||||
|
||||
//-----------------------------------
|
||||
void* operator new[](std::size_t size)
|
||||
//-----------------------------------
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
size = 1;
|
||||
}
|
||||
|
||||
if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
|
||||
{
|
||||
AZ_Warning("MEMORY", false, "Memory is being allocated at static startup!");
|
||||
return _aligned_malloc(size, AZCORE_GLOBAL_NEW_ALIGNMENT);
|
||||
}
|
||||
|
||||
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().Allocate(size, AZCORE_GLOBAL_NEW_ALIGNMENT, 0, "global operator new[]", 0, 0);
|
||||
}
|
||||
|
||||
//-----------------------------------
|
||||
void* operator new(std::size_t size, std::nothrow_t const&)
|
||||
//-----------------------------------
|
||||
{
|
||||
return operator new(size);
|
||||
}
|
||||
|
||||
//-----------------------------------
|
||||
void* operator new[](std::size_t size, std::nothrow_t const&)
|
||||
//-----------------------------------
|
||||
{
|
||||
return operator new[](size);
|
||||
}
|
||||
|
||||
// these deletes have to be created to match the new()
|
||||
// and will only happen during exception handling when allocation fails.
|
||||
void operator delete(void* ptr, const AZ::Internal::AllocatorDummy*)
|
||||
{
|
||||
if (ptr == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Get().DeAllocate(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void* ptr, const AZ::Internal::AllocatorDummy*)
|
||||
{
|
||||
if (ptr == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Get().DeAllocate(ptr);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr, const char* fileName, int lineNum, const char* name, const AZ::Internal::AllocatorDummy*)
|
||||
{
|
||||
(void)fileName;
|
||||
(void)lineNum;
|
||||
(void)name;
|
||||
if (ptr == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Get().DeAllocate(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void* ptr, const char* fileName, int lineNum, const char* name, const AZ::Internal::AllocatorDummy*)
|
||||
{
|
||||
(void)fileName;
|
||||
(void)lineNum;
|
||||
(void)name;
|
||||
if (ptr == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Get().DeAllocate(ptr);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
if (ptr == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Get().DeAllocate(ptr);
|
||||
}
|
||||
|
||||
//-----------------------------------
|
||||
void operator delete[](void* ptr)
|
||||
//-----------------------------------
|
||||
{
|
||||
if (ptr == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AZ::AllocatorInstance<AZ::SystemAllocator>::Get().DeAllocate(ptr);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace //anonymous
|
||||
"project_id": "{91FB81A1-072C-4A80-8FCC-7E2C4C767B4D}",
|
||||
|
||||
"android_settings" : {
|
||||
"package_name" : "com.lumberyard.yourgame",
|
||||
"package_name" : "org.o3de.yourgame",
|
||||
"version_number" : 1,
|
||||
"version_name" : "1.0.0.0",
|
||||
"orientation" : "landscape"
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace AzToolsFramework
|
||||
|
||||
AZStd::vector<AzToolsFramework::ActionOverride> PlaceHolderComponentMode::PopulateActionsImpl()
|
||||
{
|
||||
const AZ::Crc32 placeHolderComponentModeAction = AZ_CRC_CE("com.o3de.action.placeholder.test");
|
||||
const AZ::Crc32 placeHolderComponentModeAction = AZ_CRC_CE("org.o3de.action.placeholder.test");
|
||||
|
||||
return AZStd::vector<AzToolsFramework::ActionOverride>
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <Tests/FocusMode/EditorFocusModeFixture.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
@@ -30,6 +31,58 @@ namespace UnitTest
|
||||
EXPECT_EQ(m_focusModeInterface->GetFocusRoot(m_editorEntityContextId), AZ::EntityId());
|
||||
}
|
||||
|
||||
TEST_F(EditorFocusModeFixture, GetFocusedEntitiesBase)
|
||||
{
|
||||
m_focusModeInterface->SetFocusRoot(m_entityMap[StreetEntityName]);
|
||||
|
||||
AzToolsFramework::EntityIdList entities = m_focusModeInterface->GetFocusedEntities(m_editorEntityContextId);
|
||||
|
||||
EXPECT_EQ(entities.size(), 5);
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[StreetEntityName]) != entities.end());
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[CarEntityName]) != entities.end());
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[Passenger1EntityName]) != entities.end());
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[SportsCarEntityName]) != entities.end());
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[Passenger2EntityName]) != entities.end());
|
||||
}
|
||||
|
||||
TEST_F(EditorFocusModeFixture, GetFocusedEntitiesSiblings)
|
||||
{
|
||||
m_focusModeInterface->SetFocusRoot(m_entityMap[SportsCarEntityName]);
|
||||
|
||||
AzToolsFramework::EntityIdList entities = m_focusModeInterface->GetFocusedEntities(m_editorEntityContextId);
|
||||
|
||||
EXPECT_EQ(entities.size(), 2);
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[SportsCarEntityName]) != entities.end());
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[Passenger2EntityName]) != entities.end());
|
||||
}
|
||||
|
||||
TEST_F(EditorFocusModeFixture, GetFocusedEntitiesAddEntity)
|
||||
{
|
||||
m_focusModeInterface->SetFocusRoot(m_entityMap[SportsCarEntityName]);
|
||||
|
||||
AZ::EntityId testEntityId = CreateEditorEntity("Test", m_entityMap[Passenger2EntityName]);
|
||||
|
||||
AzToolsFramework::EntityIdList entities = m_focusModeInterface->GetFocusedEntities(m_editorEntityContextId);
|
||||
|
||||
EXPECT_EQ(entities.size(), 3);
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[SportsCarEntityName]) != entities.end());
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[Passenger2EntityName]) != entities.end());
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), testEntityId) != entities.end());
|
||||
}
|
||||
|
||||
TEST_F(EditorFocusModeFixture, GetFocusedEntitiesRemoveEntity)
|
||||
{
|
||||
m_focusModeInterface->SetFocusRoot(m_entityMap[SportsCarEntityName]);
|
||||
|
||||
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
|
||||
&AzToolsFramework::ToolsApplicationRequests::DeleteEntityAndAllDescendants, m_entityMap[Passenger2EntityName]);
|
||||
|
||||
AzToolsFramework::EntityIdList entities = m_focusModeInterface->GetFocusedEntities(m_editorEntityContextId);
|
||||
|
||||
EXPECT_EQ(entities.size(), 1);
|
||||
EXPECT_TRUE(AZStd::find(entities.begin(), entities.end(), m_entityMap[SportsCarEntityName]) != entities.end());
|
||||
}
|
||||
|
||||
TEST_F(EditorFocusModeFixture, IsInFocusSubTreeAncestorsDescendants)
|
||||
{
|
||||
// When the focus is set to an entity, all its descendants are in the focus subtree while the ancestors aren't.
|
||||
|
||||
Reference in New Issue
Block a user