Merge branch 'o3de:development' into rapidjson-natvis

This commit is contained in:
lumberyard-employee-dm
2021-07-16 11:44:56 -05:00
committed by GitHub
23 changed files with 381 additions and 82 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ namespace AZ
#define AZ_TraceFmtCompileTimeCheck(expression, isVaArgs, baseMsg, msg, msgVargs) \
{ \
using namespace AZ::TraceInternal; \
const auto& rTraceFmtCompileTimeCheckExpressionHelper = (expression); /* This is needed for edge cases for expressions containing lambdas, that were unsupported before C++20 */ \
[[maybe_unused]] const auto& rTraceFmtCompileTimeCheckExpressionHelper = (expression); /* This is needed for edge cases for expressions containing lambdas, that were unsupported before C++20 */ \
constexpr ExpressionValidResult isValidTraceFmtResult = ExpressionIsValid<decltype(rTraceFmtCompileTimeCheckExpressionHelper)>::value; \
/* Assert different message depending whether it's const char array or if we have extra arguments */ \
static_assert(!(isVaArgs) ? isValidTraceFmtResult != ExpressionValidResult::Invalid_ConstCharArray : true, baseMsg " " msg); \
@@ -6,7 +6,7 @@
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="component-header" transform="translate(-426.000000, -6.000000)" fill="#FFFFFF">
<g id="Buttons-/-Dropdown-button-with-Icon-/-Default" transform="translate(424.000000, 4.000000)">
<polygon id="Triangle" transform="translate(19.000000, 8.500000) scale(1, -1) translate(-19.000000, -8.500000) " points="19 7 22 10 16 10"></polygon>
<polygon id="Triangle" transform="translate(19.000000, 8.500000) scale(1, -1) translate(-19.000000, -8.500000) " points="20 9 23 12 17 12"></polygon>
<g id="Sky-Icon-/-System-/-Menu">
<rect id="Rectangle-11" x="2" y="2" width="12" height="2"></rect>
<rect id="Rectangle-11" x="2" y="7" width="12" height="2"></rect>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -3,9 +3,9 @@
<title>Buttons / Dropdown button with Icon / no arrow</title>
<g id="Buttons-/-Dropdown-button-with-Icon-/-no-arrow" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Icons-/-System-/-Menu" fill="#FFFFFF">
<rect id="Rectangle-11" x="1.33333333" y="2.66666667" width="13.3333333" height="1.33333333"></rect>
<rect id="Rectangle-11" x="1.33333333" y="7.33333333" width="13.3333333" height="1.33333333"></rect>
<rect id="Rectangle-11" x="1.33333333" y="12" width="13.3333333" height="1.33333333"></rect>
<rect id="Rectangle-11" x="4" y="2.66666667" width="12" height="2"></rect>
<rect id="Rectangle-11" x="4" y="7.33333333" width="12" height="2"></rect>
<rect id="Rectangle-11" x="4" y="12" width="12" height="2"></rect>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 786 B

After

Width:  |  Height:  |  Size: 708 B

@@ -1145,6 +1145,12 @@ namespace AzToolsFramework
{
if (interaction.m_keyboardModifiers.Alt())
{
if (!CanDeleteSelection<Vertex>(entityComponentIdPair.GetEntityId(), /*selectedCount=*/1))
{
ShowVertexDeletionWarning();
return;
}
SafeRemoveVertex<Vertex>(entityComponentIdPair, vertexIndex);
}
else
@@ -27,6 +27,8 @@ using namespace AzToolsFramework;
namespace UnitTest
{
const auto TestComponentId = AZ::ComponentId(1234);
// test implementation of variable/fixed vertex request buses
// (to be used in place of spline/polygon prism etc)
class TestVariableVerticesVertexContainer
@@ -86,6 +88,9 @@ namespace UnitTest
void TearDownEditorFixtureImpl() override
{
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
&AzToolsFramework::EditorEntityContextRequestBus::Events::DestroyEditorEntity, m_entityId);
m_vertexContainer.Disconnect();
m_vertexSelection.Destroy();
}
@@ -106,7 +111,7 @@ namespace UnitTest
void EditorVertexSelectionFixture::RecreateVertexSelection()
{
m_vertexSelection.Create(
AZ::EntityComponentIdPair(m_entityId, AZ::InvalidComponentId),
AZ::EntityComponentIdPair(m_entityId, TestComponentId),
g_mainManipulatorManagerId, AZStd::make_unique<NullHoverSelection>(),
TranslationManipulators::Dimensions::Three, ConfigureTranslationManipulatorAppearance3d);
}
@@ -116,7 +121,7 @@ namespace UnitTest
for (size_t vertIndex = 0; vertIndex < EditorVertexSelectionFixture::VertexCount; ++vertIndex)
{
InsertVertexAfter(
AZ::EntityComponentIdPair(m_entityId, AZ::InvalidComponentId), 0, AZ::Vector3::CreateZero());
AZ::EntityComponentIdPair(m_entityId, TestComponentId), 0, AZ::Vector3::CreateZero());
}
}
void EditorVertexSelectionFixture::ClearVertices()
@@ -124,7 +129,7 @@ namespace UnitTest
for (size_t vertIndex = 0; vertIndex < EditorVertexSelectionFixture::VertexCount; ++vertIndex)
{
SafeRemoveVertex<AZ::Vector3>(
AZ::EntityComponentIdPair(m_entityId, AZ::InvalidComponentId), 0);
AZ::EntityComponentIdPair(m_entityId, TestComponentId), 0);
}
}
@@ -197,7 +202,7 @@ namespace UnitTest
{
using ::testing::Eq;
const auto entityComponentIdPair = AZ::EntityComponentIdPair(m_entityId, AZ::InvalidComponentId);
const auto entityComponentIdPair = AZ::EntityComponentIdPair(m_entityId, TestComponentId);
const float horizontalPositions[] = {-1.5f, -0.5f, 0.5f, 1.5f};
for (size_t vertIndex = 0; vertIndex < std::size(horizontalPositions); ++vertIndex)
@@ -252,4 +257,45 @@ namespace UnitTest
// deleting all vertices is disallowed - size should remain the same
EXPECT_THAT(vertexCountAfter, Eq(EditorVertexSelectionFixture::VertexCount));
}
TEST_F(EditorVertexSelectionManipulatorFixture, CannotDeleteLastVertexWithManipulator)
{
using ::testing::Eq;
const auto entityComponentIdPair = AZ::EntityComponentIdPair(m_entityId, TestComponentId);
// add a single vertex (in front of the camera)
InsertVertexAfter(entityComponentIdPair, 0, AZ::Vector3::CreateAxisY(5.0f));
// rebuild the vertex selection after adding the new verts
RecreateVertexSelection();
AzFramework::ScreenPoint vertexScreenPosition;
{
AZ::Vector3 localVertex;
bool found = false;
AZ::FixedVerticesRequestBus<AZ::Vector3>::EventResult(
found, m_entityId, &AZ::FixedVerticesRequestBus<AZ::Vector3>::Handler::GetVertex, 0, localVertex);
if (found)
{
// note: entity position is at the origin so localVertex position is equivalent to world
vertexScreenPosition = AzFramework::WorldToScreen(localVertex, m_cameraState);
}
}
// attempt to delete the vertex by clicking with Alt held
m_actionDispatcher->CameraState(m_cameraState)
->MousePosition(vertexScreenPosition)
->KeyboardModifierDown(AzToolsFramework::ViewportInteraction::KeyboardModifier::Alt)
->MouseLButtonDown()
->MouseLButtonUp();
size_t vertexCountAfter = 0;
AZ::VariableVerticesRequestBus<AZ::Vector3>::EventResult(
vertexCountAfter, m_entityId, &AZ::VariableVerticesRequestBus<AZ::Vector3>::Events::Size);
// deleting the last vertex through a manipulator is disallowed - size should remain the same
EXPECT_THAT(vertexCountAfter, Eq(1));
}
} // namespace UnitTest