Merge branch 'development' into cmake/SPEC-2513_w4018
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp
This commit is contained in:
+2
-1
@@ -186,6 +186,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
invalidateFilter();
|
||||
|
||||
Q_EMIT filterChanged();
|
||||
}
|
||||
|
||||
@@ -205,6 +206,6 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework// namespace AssetBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
#include "AssetBrowser/moc_AssetBrowserFilterModel.cpp"
|
||||
|
||||
@@ -134,7 +134,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//If the column of the parent is one of those we don't want any more rows as children
|
||||
if (parent.isValid())
|
||||
{
|
||||
if ((parent.column() != aznumeric_cast<int>(AssetBrowserEntry::Column::DisplayName)) &&
|
||||
|
||||
+32
-14
@@ -90,24 +90,38 @@ namespace AzToolsFramework
|
||||
const QAbstractItemModel* model, const QModelIndex& parent /*= QModelIndex()*/, int row /*= 0*/)
|
||||
{
|
||||
int rows = model ? model->rowCount(parent) : 0;
|
||||
for (int i = 0; i < rows; ++i)
|
||||
|
||||
if (parent == QModelIndex())
|
||||
{
|
||||
QModelIndex index = model->index(i, 0, parent);
|
||||
AssetBrowserEntry* entry = GetAssetEntry(m_filterModel->mapToSource(index));
|
||||
//We only wanna see the source assets.
|
||||
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
|
||||
{
|
||||
beginInsertRows(parent, row, row);
|
||||
m_indexMap[row] = index;
|
||||
endInsertRows();
|
||||
m_displayedItemsCounter = 0;
|
||||
}
|
||||
|
||||
Q_EMIT dataChanged(index, index);
|
||||
++row;
|
||||
for (int currentRow = 0; currentRow < rows; ++currentRow)
|
||||
{
|
||||
if (m_displayedItemsCounter < m_numberOfItemsDisplayed)
|
||||
{
|
||||
QModelIndex index = model->index(currentRow, 0, parent);
|
||||
AssetBrowserEntry* entry = GetAssetEntry(m_filterModel->mapToSource(index));
|
||||
// We only want to see the source assets.
|
||||
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
|
||||
{
|
||||
beginInsertRows(parent, row, row);
|
||||
m_indexMap[row] = index;
|
||||
endInsertRows();
|
||||
|
||||
Q_EMIT dataChanged(index, index);
|
||||
++row;
|
||||
++m_displayedItemsCounter;
|
||||
}
|
||||
|
||||
if (model->hasChildren(index))
|
||||
{
|
||||
row = BuildTableModelMap(model, index, row);
|
||||
}
|
||||
}
|
||||
|
||||
if (model->hasChildren(index))
|
||||
else
|
||||
{
|
||||
row = BuildTableModelMap(model, index, row);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return row;
|
||||
@@ -135,6 +149,10 @@ namespace AzToolsFramework
|
||||
m_indexMap.clear();
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
AzToolsFramework::EditorSettingsAPIBus::BroadcastResult(
|
||||
m_numberOfItemsDisplayed, &AzToolsFramework::EditorSettingsAPIBus::Handler::GetMaxNumberOfItemsShownInSearchView);
|
||||
|
||||
BuildTableModelMap(sourceModel());
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QPointer>
|
||||
#endif
|
||||
#include <Editor/EditorSettingsAPIBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -50,6 +51,8 @@ namespace AzToolsFramework
|
||||
int BuildTableModelMap(const QAbstractItemModel* model, const QModelIndex& parent = QModelIndex(), int row = 0);
|
||||
|
||||
private:
|
||||
int m_numberOfItemsDisplayed = 50;
|
||||
int m_displayedItemsCounter = 0;
|
||||
QPointer<AssetBrowserFilterModel> m_filterModel;
|
||||
QMap<int, QModelIndex> m_indexMap;
|
||||
};
|
||||
|
||||
+1
-11
@@ -6,18 +6,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <API/EditorAssetSystemAPI.h>
|
||||
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntryCache.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Entries/ProductAssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Entries/SourceAssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Views/EntryDelegate.h>
|
||||
|
||||
@@ -28,9 +20,7 @@ AZ_PUSH_DISABLE_WARNING(
|
||||
#include <QCoreApplication>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QPen>
|
||||
|
||||
#include <QTimer>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
namespace AzToolsFramework
|
||||
|
||||
-2
@@ -9,7 +9,6 @@
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserTableModel.h>
|
||||
@@ -55,7 +54,6 @@ namespace AzToolsFramework
|
||||
void OnAssetBrowserComponentReady() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void selectionChangedSignal(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
void ClearStringFilter();
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace AzToolsFramework
|
||||
virtual SettingOutcome GetValue(const AZStd::string_view path) = 0;
|
||||
virtual SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) = 0;
|
||||
virtual ConsoleColorTheme GetConsoleColorTheme() const = 0;
|
||||
virtual int GetMaxNumberOfItemsShownInSearchView() const = 0;
|
||||
};
|
||||
|
||||
using EditorSettingsAPIBus = AZ::EBus<EditorSettingsAPIRequests>;
|
||||
|
||||
-10
@@ -1107,17 +1107,7 @@ namespace AzToolsFramework
|
||||
ElementAttribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
|
||||
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
|
||||
|
||||
ec->Class<AZ::ScriptPropertyAsset>("Script Property Asset(asset)", "A script asset property")->
|
||||
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyEditorAsset's class attributes.")->
|
||||
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
|
||||
DataElement("Asset", &AZ::ScriptPropertyAsset::m_value, "m_value", "An object")->
|
||||
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
|
||||
|
||||
ec->Class<AZ::ScriptPropertyEntityRef>("Script Property Entity(EntityRef)", "A script entity reference property")->
|
||||
ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyEditorEntityRef's class attributes.")->
|
||||
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)->
|
||||
DataElement("EntityRef", &AZ::ScriptPropertyEntityRef::m_value, "m_entity", "An entity reference")->
|
||||
Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -65,6 +65,35 @@ namespace UnitTest
|
||||
}
|
||||
}
|
||||
|
||||
bool FocusInteractionWidget::event(QEvent* event)
|
||||
{
|
||||
using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
|
||||
|
||||
auto eventType = event->type();
|
||||
|
||||
switch (eventType)
|
||||
{
|
||||
case QEvent::MouseButtonPress:
|
||||
EditorInteractionSystemViewportSelectionRequestBus::Event(
|
||||
AzToolsFramework::GetEntityContextId(), &EditorInteractionSystemViewportSelectionRequestBus::Events::SetDefaultHandler);
|
||||
return true;
|
||||
case QEvent::FocusIn:
|
||||
case QEvent::FocusOut:
|
||||
{
|
||||
bool handled = false;
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction mouseInteraction;
|
||||
EditorInteractionSystemViewportSelectionRequestBus::EventResult(
|
||||
handled, AzToolsFramework::GetEntityContextId(),
|
||||
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
|
||||
AzToolsFramework::ViewportInteraction::MouseInteractionEvent(
|
||||
mouseInteraction, AzToolsFramework::ViewportInteraction::MouseEvent::Down));
|
||||
return handled;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
void TestEditorActions::Connect()
|
||||
{
|
||||
using AzToolsFramework::GetEntityContextId;
|
||||
|
||||
+15
-11
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Slice/SliceAsset.h>
|
||||
@@ -31,6 +32,7 @@
|
||||
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
|
||||
#include <AzToolsFramework/SourceControl/PerforceConnection.h>
|
||||
#include <AzToolsFramework/UnitTest/ToolsTestApplication.h>
|
||||
#endif // !defined(Q_MOC_RUN)
|
||||
|
||||
#include <ostream>
|
||||
|
||||
@@ -40,7 +42,7 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
#define AUTO_RESULT_IF_SETTING_TRUE(_settingName, _result) \
|
||||
{ \
|
||||
bool settingValue = true; \
|
||||
bool settingValue = true; \
|
||||
if (auto* registry = AZ::SettingsRegistry::Get()) \
|
||||
{ \
|
||||
registry->Get(settingValue, _settingName); \
|
||||
@@ -51,23 +53,16 @@ AZ_POP_DISABLE_WARNING
|
||||
EXPECT_TRUE(_result); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class Entity;
|
||||
class EntityId;
|
||||
|
||||
} // namespace AZ
|
||||
}
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
constexpr AZStd::string_view prefabSystemSetting = "/Amazon/Preferences/EnablePrefabSystem";
|
||||
|
||||
/// Test widget to store QActions generated by EditorTransformComponentSelection.
|
||||
class TestWidget
|
||||
: public QWidget
|
||||
class TestWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TestWidget()
|
||||
: QWidget()
|
||||
@@ -79,6 +74,15 @@ namespace UnitTest
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
};
|
||||
|
||||
/// Widget used to trigger a viewport interaction event while a focus change is happening.
|
||||
class FocusInteractionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FocusInteractionWidget(QWidget* parent = nullptr) : QWidget(parent) {}
|
||||
bool event(QEvent* event) override;
|
||||
};
|
||||
|
||||
/// Stores actions registered for either normal mode (regular viewport) editing and
|
||||
/// component mode editing.
|
||||
class TestEditorActions
|
||||
|
||||
@@ -50,6 +50,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
ly_add_target(
|
||||
NAME AzToolsFrameworkTestCommon STATIC
|
||||
NAMESPACE AZ
|
||||
AUTOMOC
|
||||
FILES_CMAKE
|
||||
AzToolsFramework/aztoolsframeworktestcommon_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
@@ -68,6 +69,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
ly_add_target(
|
||||
NAME AzToolsFramework.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE AZ
|
||||
AUTOMOC
|
||||
FILES_CMAKE
|
||||
Tests/aztoolsframeworktests_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
|
||||
@@ -31,8 +31,10 @@
|
||||
#include <AzToolsFramework/Viewport/ActionBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorDefaultSelection.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorPickEntitySelection.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiManager.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -188,6 +190,47 @@ namespace UnitTest
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// EditorTransformComponentSelection Tests
|
||||
|
||||
TEST_F(EditorTransformComponentSelectionFixture, Focus_is_not_changed_while_switching_viewport_interaction_request_instance)
|
||||
{
|
||||
// setup a dummy widget and make it the active window to ensure focus in/out events are fired
|
||||
auto dummyWidget = AZStd::make_unique<QWidget>();
|
||||
QApplication::setActiveWindow(dummyWidget.get());
|
||||
|
||||
// note: it is important to make sure the focus widget is parented to the dummy widget to have focus in/out events fire
|
||||
auto focusWidget = AZStd::make_unique<UnitTest::FocusInteractionWidget>(dummyWidget.get());
|
||||
|
||||
const auto previousFocusWidget = QApplication::focusWidget();
|
||||
|
||||
// Given
|
||||
// setup viewport ui system
|
||||
AzToolsFramework::ViewportUi::ViewportUiManager viewportUiManager;
|
||||
viewportUiManager.ConnectViewportUiBus(AzToolsFramework::ViewportUi::DefaultViewportId);
|
||||
viewportUiManager.InitializeViewportUi(&m_editorActions.m_defaultWidget, focusWidget.get());
|
||||
|
||||
// begin EditorPickEntitySelection
|
||||
using AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus;
|
||||
EditorInteractionSystemViewportSelectionRequestBus::Event(
|
||||
AzToolsFramework::GetEntityContextId(), &EditorInteractionSystemViewportSelectionRequestBus::Events::SetHandler,
|
||||
[](const AzToolsFramework::EditorVisibleEntityDataCache* entityDataCache)
|
||||
{
|
||||
return AZStd::make_unique<AzToolsFramework::EditorPickEntitySelection>(entityDataCache);
|
||||
});
|
||||
|
||||
// When
|
||||
// a mouse event is sent to the focus widget (set to be the render overlay in the viewport ui system)
|
||||
QTest::mouseClick(focusWidget.get(), Qt::MouseButton::LeftButton);
|
||||
|
||||
// Then
|
||||
// focus should not change
|
||||
EXPECT_FALSE(focusWidget->hasFocus());
|
||||
EXPECT_EQ(previousFocusWidget, QApplication::focusWidget());
|
||||
|
||||
// clean up
|
||||
viewportUiManager.DisconnectViewportUiBus();
|
||||
focusWidget.reset();
|
||||
dummyWidget.reset();
|
||||
}
|
||||
|
||||
TEST_F(EditorTransformComponentSelectionFixture, ManipulatorOrientationIsResetWhenEntityOrientationIsReset)
|
||||
{
|
||||
using AzToolsFramework::EditorTransformComponentSelectionRequestBus;
|
||||
|
||||
@@ -245,12 +245,15 @@ namespace UnitTest
|
||||
{
|
||||
using testing::StrEq;
|
||||
|
||||
QLocale testLocale{ QLocale() };
|
||||
QString testString = "10" + QString(testLocale.decimalPoint()) + "0";
|
||||
|
||||
m_doubleSpinBox->setSuffix("m");
|
||||
m_doubleSpinBox->setValue(10.0);
|
||||
|
||||
// test internal logic (textFromValue() calls private StringValue())
|
||||
QString value = m_doubleSpinBox->textFromValue(10.0);
|
||||
EXPECT_THAT(value.toUtf8().constData(), StrEq("10.0"));
|
||||
EXPECT_THAT(value.toUtf8().constData(), testString);
|
||||
|
||||
m_doubleSpinBox->setFocus();
|
||||
EXPECT_THAT(m_doubleSpinBox->suffix().toUtf8().constData(), StrEq(""));
|
||||
@@ -293,31 +296,44 @@ namespace UnitTest
|
||||
|
||||
TEST_F(SpinBoxFixture, SpinBoxCheckHighValueTruncatesCorrectly)
|
||||
{
|
||||
QString value = setupTruncationTest("0.9999999");
|
||||
QLocale testLocale{ QLocale() };
|
||||
QString testString = "0" + QString(testLocale.decimalPoint()) + "9999999";
|
||||
QString value = setupTruncationTest(testString);
|
||||
|
||||
EXPECT_TRUE(value == "0.999");
|
||||
testString = "0" + QString(testLocale.decimalPoint()) + "999";
|
||||
EXPECT_TRUE(value == testString);
|
||||
}
|
||||
|
||||
TEST_F(SpinBoxFixture, SpinBoxCheckLowValueTruncatesCorrectly)
|
||||
{
|
||||
QString value = setupTruncationTest("0.0000001");
|
||||
QLocale testLocale{ QLocale() };
|
||||
QString testString = "0" + QString(testLocale.decimalPoint()) + "0000001";
|
||||
QString value = setupTruncationTest(testString);
|
||||
|
||||
EXPECT_TRUE(value == "0.0");
|
||||
testString = "0" + QString(testLocale.decimalPoint()) + "0";
|
||||
EXPECT_TRUE(value == testString);
|
||||
}
|
||||
|
||||
TEST_F(SpinBoxFixture, SpinBoxCheckBugValuesTruncatesCorrectly)
|
||||
{
|
||||
QString value = setupTruncationTest("0.12395");
|
||||
QLocale testLocale{ QLocale() };
|
||||
QString testString = "0" + QString(testLocale.decimalPoint()) + "12395";
|
||||
QString value = setupTruncationTest(testString);
|
||||
|
||||
EXPECT_TRUE(value == "0.123");
|
||||
testString = "0" + QString(testLocale.decimalPoint()) + "123";
|
||||
EXPECT_TRUE(value == testString);
|
||||
|
||||
value = setupTruncationTest("0.94496");
|
||||
testString = "0" + QString(testLocale.decimalPoint()) + "94496";
|
||||
value = setupTruncationTest(testString);
|
||||
|
||||
EXPECT_TRUE(value == "0.944");
|
||||
testString = "0" + QString(testLocale.decimalPoint()) + "944";
|
||||
EXPECT_TRUE(value == testString);
|
||||
|
||||
value = setupTruncationTest("0.0009999");
|
||||
testString = "0" + QString(testLocale.decimalPoint()) + "0009999";
|
||||
value = setupTruncationTest(testString);
|
||||
|
||||
EXPECT_TRUE(value == "0.0");
|
||||
testString = "0" + QString(testLocale.decimalPoint()) + "0";
|
||||
EXPECT_TRUE(value == testString);
|
||||
}
|
||||
|
||||
} // namespace UnitTest
|
||||
|
||||
Reference in New Issue
Block a user