Skip to content

Commit e16b6fa

Browse files
committed
Add FirstActor pivot setting
1 parent e92c2bf commit e16b6fa

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Source/PrefabricatorRuntime/Private/Asset/PrefabricatorAsset.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ FVector FPrefabricatorAssetUtils::FindPivot(const TArray<AActor*>& InActors)
3232
FBox ActorBounds = FPrefabTools::GetPrefabBounds(Actor, false);
3333
Bounds += ActorBounds;
3434
}
35+
36+
AActor* FirstActor = InActors[0];
3537

36-
switch (GetDefault< UPrefabricatorSettings>()->PivotPosition)
38+
switch (GetDefault<UPrefabricatorSettings>()->PivotPosition)
3739
{
3840
case EPrefabricatorPivotPosition::ExtremeLeft:
3941
Pivot = Bounds.GetCenter() - Bounds.GetExtent();
@@ -44,16 +46,14 @@ FVector FPrefabricatorAssetUtils::FindPivot(const TArray<AActor*>& InActors)
4446
case EPrefabricatorPivotPosition::Center:
4547
Pivot = Bounds.GetCenter();
4648
break;
49+
case EPrefabricatorPivotPosition::FirstActor:
50+
Pivot = FirstActor->GetActorLocation();
51+
return Pivot;
4752
default:;
4853
}
4954
Pivot.Z = Bounds.Min.Z;
5055
}
5156

52-
TSharedPtr<IPrefabricatorService> Service = FPrefabricatorService::Get();
53-
if (Service.IsValid()) {
54-
Pivot = Service->SnapToGrid(Pivot);
55-
}
56-
5757
return Pivot;
5858
}
5959

Source/PrefabricatorRuntime/Public/PrefabricatorSettings.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ enum class EPrefabricatorPivotPosition : uint8
1111
{
1212
ExtremeLeft,
1313
ExtremeRight,
14-
Center
14+
Center,
15+
FirstActor
1516
};
1617

1718
/**

0 commit comments

Comments
 (0)