Skip to content

Commit bb55d0f

Browse files
committed
Merge branch 'master' into 4.21
2 parents 2bb39c4 + 121daa5 commit bb55d0f

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CHANGELOG: Prefabricator
33

44
Version 1.0.4
55
-------------
6+
* Fixed a mobility bug with prefabs
67
* Added whitelist platforms to the plugin descriptor as per the marketplace requirements
78
* Added categories to all blueprint UFUNCTIONs so it doesn't cause compile errors on engine source builds
89
* Added authors page

Prefabricator.uplugin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion" : 3,
33
"FriendlyName" : "Prefabricator",
4-
"Version" : 5,
4+
"Version" : 6,
55
"VersionName" : "1.0.4",
66
"CreatedBy" : "Code Respawn",
77
"CreatedByURL" : "http://prefabricator.io",

Source/PrefabricatorRuntime/Private/Asset/PrefabricatorAsset.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,24 @@ FVector FPrefabricatorAssetUtils::FindPivot(const TArray<AActor*>& InActors)
4040

4141
EComponentMobility::Type FPrefabricatorAssetUtils::FindMobility(const TArray<AActor*>& InActors)
4242
{
43-
EComponentMobility::Type Mobility = EComponentMobility::Static;
44-
43+
return EComponentMobility::Static;
44+
/*
45+
EComponentMobility::Type Mobility = EComponentMobility::Movable;
4546
for (AActor* Actor : InActors) {
4647
if (!Actor || !Actor->GetRootComponent()) {
4748
continue;
4849
}
4950
EComponentMobility::Type ActorMobility = Actor->GetRootComponent()->Mobility;
50-
if (Mobility == EComponentMobility::Static && ActorMobility != EComponentMobility::Static) {
51-
Mobility = ActorMobility;
51+
if (Mobility == EComponentMobility::Movable && ActorMobility == EComponentMobility::Stationary) {
52+
Mobility = EComponentMobility::Stationary;
5253
}
53-
if (Mobility == EComponentMobility::Stationary && ActorMobility == EComponentMobility::Movable) {
54-
Mobility = EComponentMobility::Movable;
54+
else if (ActorMobility == EComponentMobility::Static) {
55+
Mobility = EComponentMobility::Static;
5556
}
5657
}
5758
5859
return Mobility;
60+
*/
5961
}
6062

6163
UPrefabricatorAsset* UPrefabricatorAssetCollection::GetPrefabAsset(const FPrefabAssetSelectionConfig& InConfig)

Source/PrefabricatorRuntime/Private/Prefab/PrefabTools.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ void FPrefabTools::CreatePrefabFromActors(const TArray<AActor*>& InActors)
164164
PrefabActor->PrefabComponent->PrefabAssetInterface = PrefabAsset;
165165
// Attach the actors to the prefab
166166
for (AActor* Actor : Actors) {
167-
if (Actor->GetRootComponent()) {
168-
Actor->GetRootComponent()->SetMobility(Mobility);
169-
}
170167
ParentActors(PrefabActor, Actor);
171168
}
172169

@@ -339,9 +336,10 @@ namespace {
339336
continue;
340337
}
341338

339+
bool bForceSerialize = FPrefabTools::ShouldForcePropertySerialization(Property->GetFName());
340+
342341
// Check if it has the default value
343-
FString PropertyName = Property->GetName();
344-
if (HasDefaultValue(ObjToSerialize, PropertyName)) {
342+
if (!bForceSerialize && HasDefaultValue(ObjToSerialize, Property->GetName())) {
345343
continue;
346344
}
347345

@@ -357,6 +355,7 @@ namespace {
357355
UPrefabricatorProperty* PrefabProperty = nullptr;
358356
FString PropertyName = Property->GetName();
359357

358+
360359
if (ShouldSkipSerialization(Property, ObjToSerialize, PrefabActor)) {
361360
continue;
362361
}
@@ -419,6 +418,15 @@ bool FPrefabTools::ShouldIgnorePropertySerialization(const FName& InPropertyName
419418
return IgnoredFields.Contains(InPropertyName);
420419
}
421420

421+
bool FPrefabTools::ShouldForcePropertySerialization(const FName& PropertyName)
422+
{
423+
static const TSet<FName> FieldsToForceSerialize = {
424+
"Mobility"
425+
};
426+
427+
return FieldsToForceSerialize.Contains(PropertyName);
428+
}
429+
422430
void FPrefabTools::SaveStateToPrefabAsset(AActor* InActor, APrefabActor* PrefabActor, FPrefabricatorActorData& OutActorData)
423431
{
424432
if (!InActor) return;

Source/PrefabricatorRuntime/Public/Prefab/PrefabTools.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class PREFABRICATORRUNTIME_API FPrefabTools {
3232

3333
static FBox GetPrefabBounds(AActor* PrefabActor);
3434
static bool ShouldIgnorePropertySerialization(const FName& PropertyName);
35+
static bool ShouldForcePropertySerialization(const FName& PropertyName);
3536

3637
static void ParentActors(AActor* ParentActor, AActor* ChildActor);
3738
static void SelectPrefabActor(AActor* PrefabActor);

0 commit comments

Comments
 (0)