Skip to content

Commit 894dc99

Browse files
committed
Update PCGExFitting.cpp
1 parent 2c2146e commit 894dc99

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

Source/PCGExtendedToolkit/Private/Transform/PCGExFitting.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ bool FPCGExJustificationDetails::Init(FPCGExContext* InContext, const TSharedRef
282282
void FPCGExFittingVariationsDetails::Init(const int InSeed)
283283
{
284284
Seed = InSeed;
285+
285286
bEnabledBefore = (Offset == EPCGExVariationMode::Before || Rotation == EPCGExVariationMode::Before || Scale == EPCGExVariationMode::Before);
286287
bEnabledAfter = (Offset == EPCGExVariationMode::After || Rotation == EPCGExVariationMode::After || Scale == EPCGExVariationMode::After);
287288
}
@@ -363,15 +364,11 @@ void FPCGExFittingDetailsHandler::ComputeTransform(const int32 TargetIndex, FTra
363364
if (bWorldSpace) { OutTransform = InTransform; }
364365

365366
FVector OutScale = InTransform.GetScale3D();
366-
const FBox RefBounds = PCGExMath::GetLocalBounds<EPCGExPointBoundsSource::ScaledBounds>(TargetPoint);
367+
FVector OutTranslation = FVector::ZeroVector;
367368

368369
ScaleToFit.Process(TargetPoint, InOutBounds, OutScale, InOutBounds);
369-
370-
//
371-
372-
FVector OutTranslation = FVector::ZeroVector;
373370
Justification.Process(
374-
TargetIndex, RefBounds,
371+
TargetIndex, PCGExMath::GetLocalBounds<EPCGExPointBoundsSource::ScaledBounds>(TargetPoint),
375372
FBox(InOutBounds.Min * OutScale, InOutBounds.Max * OutScale),
376373
OutTranslation);
377374

@@ -384,16 +381,12 @@ void FPCGExFittingDetailsHandler::ComputeLocalTransform(const int32 TargetIndex,
384381
check(TargetDataFacade);
385382
const PCGExData::FConstPoint& TargetPoint = TargetDataFacade->Source->GetInPoint(TargetIndex);
386383

387-
const FQuat OriginalRotation = OutTransform.GetRotation();
388384
FVector OutScale = OutTransform.GetScale3D();
389-
const FBox RefBounds = PCGExMath::GetLocalBounds<EPCGExPointBoundsSource::ScaledBounds>(TargetPoint);
390-
391-
FBox RotatedAABB = InOutBounds.TransformBy(InLocalXForm);
392-
ScaleToFit.Process(TargetPoint, RotatedAABB, OutScale, InOutBounds);
393-
394385
FVector OutTranslation = FVector::ZeroVector;
386+
387+
ScaleToFit.Process(TargetPoint, InOutBounds.TransformBy(InLocalXForm), OutScale, InOutBounds);
395388
Justification.Process(
396-
TargetIndex, RefBounds,
389+
TargetIndex, PCGExMath::GetLocalBounds<EPCGExPointBoundsSource::ScaledBounds>(TargetPoint),
397390
FBox(InOutBounds.Min * OutScale, InOutBounds.Max * OutScale),
398391
OutTranslation);
399392

0 commit comments

Comments
 (0)