fix bug with wrong number of tube manipulators returned
Signed-off-by: hultonha <hultonha@amazon.co.uk>
This commit is contained in:
@@ -268,28 +268,6 @@ namespace LmbrCentral
|
||||
ContainerChanged();
|
||||
}
|
||||
|
||||
AZStd::vector<EditorTubeShapeComponentMode::TubeManipulatorState> EditorTubeShapeComponentMode::GenerateTubeManipulatorStates(
|
||||
const AZ::Spline& spline)
|
||||
{
|
||||
const AZ::u64 startVertex = spline.GetAddressByFraction(0.0f).m_segmentIndex;
|
||||
const AZ::u64 endVertex = startVertex + spline.GetSegmentCount() + (spline.IsClosed() ? 0 : 1);
|
||||
|
||||
AZStd::vector<TubeManipulatorState> splineAddresses;
|
||||
for (AZ::u64 vertIndex = startVertex; vertIndex < endVertex; ++vertIndex)
|
||||
{
|
||||
if (vertIndex + 1 == endVertex)
|
||||
{
|
||||
splineAddresses.push_back({ AZ::SplineAddress(vertIndex - 1, 1.0f), vertIndex });
|
||||
}
|
||||
else
|
||||
{
|
||||
splineAddresses.push_back({ AZ::SplineAddress(vertIndex), vertIndex });
|
||||
}
|
||||
}
|
||||
|
||||
return splineAddresses;
|
||||
}
|
||||
|
||||
void EditorTubeShapeComponentMode::RefreshManipulatorsLocal(const AZ::EntityId entityId)
|
||||
{
|
||||
AZ::SplinePtr spline;
|
||||
@@ -318,4 +296,37 @@ namespace LmbrCentral
|
||||
m_radiusManipulators[manipulatorIndex]->SetBoundsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::vector<EditorTubeShapeComponentMode::TubeManipulatorState> GenerateTubeManipulatorStates(const AZ::Spline& spline)
|
||||
{
|
||||
if (spline.GetVertexCount() == 0)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto segmentCount = spline.GetSegmentCount();
|
||||
if (segmentCount == 0)
|
||||
{
|
||||
return { { AZ::SplineAddress(0), 0 } };
|
||||
}
|
||||
|
||||
const AZ::u64 startVertex = spline.GetAddressByFraction(0.0f).m_segmentIndex;
|
||||
const AZ::u64 endVertex = startVertex + segmentCount + (spline.IsClosed() ? 0 : 1);
|
||||
|
||||
AZStd::vector<EditorTubeShapeComponentMode::TubeManipulatorState> splineAddresses;
|
||||
for (AZ::u64 vertIndex = startVertex; vertIndex < endVertex; ++vertIndex)
|
||||
{
|
||||
if (vertIndex + 1 == endVertex)
|
||||
{
|
||||
AZ_Assert(vertIndex > 0, "vertexIndex is 0 and not safe to subtract from")
|
||||
splineAddresses.push_back({ AZ::SplineAddress(vertIndex - 1, 1.0f), vertIndex });
|
||||
}
|
||||
else
|
||||
{
|
||||
splineAddresses.push_back({ AZ::SplineAddress(vertIndex), vertIndex });
|
||||
}
|
||||
}
|
||||
|
||||
return splineAddresses;
|
||||
}
|
||||
} // namespace LmbrCentral
|
||||
|
||||
Reference in New Issue
Block a user