Skip to content

Commit 8dc474a

Browse files
committed
UE5.6
- Fixed last remaining build warnings with UE5.6 - Fixed crash in 5.6 when building Skeletal Meshes. - Fixed skeletal mesh test (electra) failing in 5.6
1 parent 17a3db8 commit 8dc474a

6 files changed

Lines changed: 110 additions & 35 deletions

File tree

Source/HoudiniEngine/Private/HoudiniLandscapeTranslator.cpp

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,23 @@ FHoudiniLandscapeTranslator::ProcessLandscapeOutput(
145145
{
146146
int EditLayerIndex = Result->Landscape->GetLayerIndex(FName(Result->BakedEditLayer));
147147
if (EditLayerIndex != INDEX_NONE)
148+
{
149+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
150+
Result->Landscape->GetEditLayer(EditLayerIndex)->SetVisible(false, true);
151+
#else
148152
Result->Landscape->SetLayerVisibility(EditLayerIndex, false);
153+
#endif
154+
}
149155

150156
EditLayerIndex = Result->Landscape->GetLayerIndex(FName(Result->CookedEditLayer));
151157
if (EditLayerIndex != INDEX_NONE)
158+
{
159+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
160+
Result->Landscape->GetEditLayer(EditLayerIndex)->SetVisible(true, true);
161+
#else
152162
Result->Landscape->SetLayerVisibility(EditLayerIndex, true);
163+
#endif
164+
}
153165
}
154166

155167
OutputObj.CachedAttributes.Add(HAPI_UNREAL_ATTRIB_BAKE_OUTLINER_FOLDER, Part.BakeOutlinerFolder);
@@ -619,7 +631,7 @@ FHoudiniLandscapeTranslator::TranslateHeightFieldPart(
619631
if (Part.bWriteLockedLayers)
620632
{
621633
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
622-
OutputLandscape->SetLayerLocked(OutputLandscape->GetLayerIndex(UnrealEditLayer->EditLayer->GetName()), false);
634+
UnrealEditLayer->EditLayer->SetLocked(false, true);
623635
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
624636
OutputLandscape->SetLayerLocked(OutputLandscape->GetLayerIndex(UnrealEditLayer->Name), false);
625637
#else
@@ -698,11 +710,23 @@ FHoudiniLandscapeTranslator::TranslateHeightFieldPart(
698710

699711
if (OutputLandscape->bHasLayersContent)
700712
{
701-
if (Part.bSubtractiveEditLayer != OutputLandscape->IsLayerBlendSubstractive(UnrealEditLayerIndex, TargetLayerInfo))
713+
bool bLayerSubractive = false;
714+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
715+
ULandscapeEditLayerBase* EditLayer = OutputLandscape->GetEditLayer(UnrealEditLayerIndex);
716+
if (EditLayer != nullptr)
702717
{
703-
OutputLandscape->SetLayerSubstractiveBlendStatus(UnrealEditLayerIndex, Part.bSubtractiveEditLayer, TargetLayerInfo);
718+
// Great, these are the Epic recommended replacements for Is/SetLayerBlendSubstractive,
719+
// But this throws a warning anyway...
720+
const bool* AllocationBlend = EditLayer->GetWeightmapLayerAllocationBlend().Find(TargetLayerInfo);
721+
if (AllocationBlend != nullptr && (Part.bSubtractiveEditLayer != *AllocationBlend))
722+
{
723+
EditLayer->AddOrUpdateWeightmapAllocationLayerBlend(TargetLayerInfo, Part.bSubtractiveEditLayer, true);
724+
}
704725
}
705-
726+
#else
727+
if (Part.bSubtractiveEditLayer != OutputLandscape->IsLayerBlendSubstractive(UnrealEditLayerIndex, TargetLayerInfo))
728+
OutputLandscape->SetLayerSubstractiveBlendStatus(UnrealEditLayerIndex, Part.bSubtractiveEditLayer, TargetLayerInfo);
729+
#endif
706730
if (TargetLayerInfo)
707731
TargetLayerInfo->bNoWeightBlend = !Part.bIsWeightBlended;
708732
}
@@ -810,7 +834,7 @@ FHoudiniLandscapeTranslator::TranslateHeightFieldPart(
810834
if (bWasLocked && UnrealEditLayer)
811835
{
812836
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
813-
OutputLandscape->SetLayerLocked(OutputLandscape->GetLayerIndex(UnrealEditLayer->EditLayer->GetName()), true);
837+
UnrealEditLayer->EditLayer->SetLocked(true, true);
814838
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
815839
OutputLandscape->SetLayerLocked(OutputLandscape->GetLayerIndex(UnrealEditLayer->Name), true);
816840
#else

Source/HoudiniEngine/Private/HoudiniLandscapeUtils.cpp

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,65 +94,81 @@ FHoudiniLandscapeUtils::GetCookedLandscapeLayers(UHoudiniAssetComponent& HAC, AL
9494
void
9595
FHoudiniLandscapeUtils::SetNonCookedLayersVisibility(UHoudiniAssetComponent& HAC, ALandscape& Landscape, bool bVisible)
9696
{
97+
FString LayerName;
9798
TSet<FString> CookedLayers = GetCookedLandscapeLayers(HAC, Landscape);
9899
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
99100
TArrayView<const FLandscapeLayer> Layers = Landscape.GetLayersConst();
101+
for (int LayerIndex = 0; LayerIndex < Landscape.GetLayersConst().Num(); LayerIndex++)
102+
{
103+
LayerName = Layers[LayerIndex].EditLayer->GetName().ToString();
104+
if (!CookedLayers.Contains(LayerName))
105+
{
106+
// Non cooked Layer
107+
Layers[LayerIndex].EditLayer->SetVisible(bVisible, true);
108+
}
109+
}
100110
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
101111
TArrayView<const FLandscapeLayer> Layers = Landscape.GetLayers();
102-
#endif
103-
104-
FString LayerName;
105-
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
106-
for(int LayerIndex = 0; LayerIndex < Landscape.GetLayersConst().Num(); LayerIndex++)
107-
#else
108112
for (int LayerIndex = 0; LayerIndex < Landscape.GetLayerCount(); LayerIndex++)
109-
#endif
110113
{
111-
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
112-
LayerName = Layers[LayerIndex].EditLayer->GetName().ToString();
113-
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
114114
LayerName = Layers[LayerIndex].Name.ToString();
115+
if (!CookedLayers.Contains(LayerName))
116+
{
117+
// Non cooked Layer
118+
Landscape.SetLayerVisibility(LayerIndex, bVisible);
119+
}
120+
}
115121
#else
122+
for (int LayerIndex = 0; LayerIndex < Landscape.GetLayerCount(); LayerIndex++)
123+
{
116124
LayerName = Landscape.LandscapeLayers[LayerIndex].Name.ToString();
117-
#endif
118125
if (!CookedLayers.Contains(LayerName))
119126
{
120127
// Non cooked Layer
121128
Landscape.SetLayerVisibility(LayerIndex, bVisible);
122129
}
123130
}
131+
#endif
124132
}
125133

126134
void
127135
FHoudiniLandscapeUtils::SetCookedLayersVisibility(UHoudiniAssetComponent& HAC, ALandscape& Landscape, bool bVisible)
128136
{
137+
FString LayerName;
129138
TSet<FString> CookedLayers = GetCookedLandscapeLayers(HAC, Landscape);
130139
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
131140
TArrayView<const FLandscapeLayer> Layers = Landscape.GetLayersConst();
141+
for (int LayerIndex = 0; LayerIndex < Landscape.GetLayersConst().Num(); LayerIndex++)
142+
{
143+
LayerName = Layers[LayerIndex].EditLayer->GetName().ToString();
144+
if (CookedLayers.Contains(LayerName))
145+
{
146+
// Cooked Layer
147+
Layers[LayerIndex].EditLayer->SetVisible(bVisible, true);
148+
}
149+
}
132150
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
133151
TArrayView<const FLandscapeLayer> Layers = Landscape.GetLayers();
134-
#endif
135-
136-
FString LayerName;
137-
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
138-
for (int LayerIndex = 0; LayerIndex < Landscape.GetLayersConst().Num(); LayerIndex++)
139-
#else
140152
for (int LayerIndex = 0; LayerIndex < Landscape.GetLayerCount(); LayerIndex++)
141-
#endif
142153
{
143-
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
144-
LayerName = Layers[LayerIndex].EditLayer.GetName();
145-
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
146154
LayerName = Layers[LayerIndex].Name.ToString();
155+
if (CookedLayers.Contains(LayerName))
156+
{
157+
// Cooked Layer
158+
Landscape.SetLayerVisibility(LayerIndex, bVisible);
159+
}
160+
}
147161
#else
162+
for (int LayerIndex = 0; LayerIndex < Landscape.GetLayerCount(); LayerIndex++)
163+
{
148164
LayerName = Landscape.LandscapeLayers[LayerIndex].Name.ToString();
149-
#endif
150165
if (CookedLayers.Contains(LayerName))
151166
{
152167
// Cooked Layer
153168
Landscape.SetLayerVisibility(LayerIndex, bVisible);
154169
}
155170
}
171+
#endif
156172
}
157173

158174
void FHoudiniLandscapeUtils::RealignHeightFieldData(TArray<float>& Data, float ZeroPoint, float Scale)
@@ -655,7 +671,12 @@ FHoudiniLandscapeUtils::ResolveLandscapes(
655671

656672
// Rename the default height layer if needed.
657673
const FString DefaultLayerName = TEXT("Layer");
658-
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
674+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
675+
if (LandscapeActor->HasLayersContent() && HeightPart->UnrealLayerName != DefaultLayerName)
676+
{
677+
LandscapeActor->GetEditLayer(0)->SetName(FName(HeightPart->UnrealLayerName), true);
678+
}
679+
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 5
659680
if (LandscapeActor->HasLayersContent() && HeightPart->UnrealLayerName != DefaultLayerName)
660681
{
661682
LandscapeActor->SetLayerName(0, FName(HeightPart->UnrealLayerName));
@@ -1549,7 +1570,9 @@ void FHoudiniLandscapeUtils::ApplyLocks(UHoudiniLandscapeTargetLayerOutput* Outp
15491570
if (EditLayerIndex == INDEX_NONE)
15501571
return;
15511572

1552-
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
1573+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
1574+
Output->Landscape->GetEditLayer(EditLayerIndex)->SetLocked(true, true);
1575+
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 5
15531576
Output->Landscape->SetLayerLocked(EditLayerIndex, true);
15541577
#else
15551578
FLandscapeLayer* UnrealEditLayer = Output->Landscape->GetLayer(EditLayerIndex);

Source/HoudiniEngine/Private/HoudiniSkeletalMeshTranslator.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,19 @@ FHoudiniSkeletalMeshTranslator::CreateUnrealData(FHoudiniSkeletalMeshBuildSettin
340340
//New MeshDescription build process
341341
IMeshBuilderModule& MeshBuilderModule = IMeshBuilderModule::GetForRunningPlatform();
342342
//We must build the LODModel so we can restore properly the mesh, but we do not have to regenerate LODs
343-
344343
FSkeletalMeshBuildParameters SkeletalMeshBuildParameters = FSkeletalMeshBuildParameters(BuildSettings.SKMesh, GetTargetPlatformManagerRef().GetRunningTargetPlatform(), ImportLODModelIndex, false);
344+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
345+
FSkeletalMeshRenderData* RenderData = BuildSettings.SKMesh->GetResourceForRendering();
346+
if (RenderData == nullptr)
347+
{
348+
BuildSettings.SKMesh->AllocateResourceForRendering();
349+
RenderData = BuildSettings.SKMesh->GetResourceForRendering();
350+
}
351+
352+
bool bBuildSuccess = MeshBuilderModule.BuildSkeletalMesh(*RenderData, SkeletalMeshBuildParameters);
353+
#else
345354
bool bBuildSuccess = MeshBuilderModule.BuildSkeletalMesh(SkeletalMeshBuildParameters);
355+
#endif
346356

347357
//We need to have a valid render data to create physic asset
348358
BuildSettings.SKMesh->CalculateInvRefMatrices();

Source/HoudiniEngineEditor/Private/HoudiniBakeLandscape.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ FHoudiniLandscapeBake::BakeLandscapeLayer(
185185

186186
if (bWasLocked && BakedLayer)
187187
{
188-
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
188+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
189+
BakedLayer->EditLayer->SetLocked(false, true);
190+
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 5
189191
OutputLandscape->SetLayerLocked(EditLayerIndex, true);
190192
#else
191193
BakedLayer->bLocked = true;
@@ -195,7 +197,11 @@ FHoudiniLandscapeBake::BakeLandscapeLayer(
195197
// Make sure baked layer is visible.
196198
//---------------------------------------------------------------------------------------------------------------------------
197199
if (EditLayerIndex != INDEX_NONE)
200+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
201+
OutputLandscape->GetEditLayer(EditLayerIndex)->SetVisible(true, true);
202+
#else
198203
OutputLandscape->SetLayerVisibility(EditLayerIndex, true);
204+
#endif
199205

200206
return true;
201207
}
@@ -696,7 +702,13 @@ FHoudiniLandscapeBake::BakeLandscapeSplinesLayer(
696702
//---------------------------------------------------------------------------------------------------------------------------
697703
int EditLayerIndex = OutputLandscape->GetLayerIndex(BakedEditLayer);
698704
if (EditLayerIndex != INDEX_NONE)
705+
{
706+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
707+
OutputLandscape->GetEditLayer(EditLayerIndex)->SetVisible(true, true);
708+
#else
699709
OutputLandscape->SetLayerVisibility(EditLayerIndex, true);
710+
#endif
711+
}
700712

701713
return true;
702714
}

Source/HoudiniEngineEditor/Private/HoudiniEngineDetails.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,14 @@ FHoudiniEngineDetails::CreateHoudiniEngineIconWidget(
217217

218218

219219
void
220-
FHoudiniEngineDetails::CreateHoudiniEngineActionWidget(IDetailCategoryBuilder& HoudiniEngineCategoryBuilder,
220+
FHoudiniEngineDetails::CreateHoudiniEngineActionWidget(
221+
IDetailCategoryBuilder& HoudiniEngineCategoryBuilder,
221222
const TArray<TWeakObjectPtr<UHoudiniAssetComponent>>& InHACs)
222223
{
223224
if (InHACs.Num() <= 0)
224225
return;
225226

226227
const TWeakObjectPtr<UHoudiniAssetComponent>& MainHAC = InHACs[0];
227-
IDetailLayoutBuilder* SavedLayoutBuilder = &HoudiniEngineCategoryBuilder.GetParentLayout();
228-
229228
if (!IsValidWeakPointer(MainHAC))
230229
return;
231230

@@ -234,7 +233,8 @@ FHoudiniEngineDetails::CreateHoudiniEngineActionWidget(IDetailCategoryBuilder& H
234233
if (!HoudiniEngineUIIconBrush.IsValid())
235234
return;
236235

237-
FDetailWidgetRow & Row = HoudiniEngineCategoryBuilder.AddCustomRow(FText::GetEmpty());
236+
IDetailLayoutBuilder* SavedLayoutBuilder = &HoudiniEngineCategoryBuilder.GetParentLayout();
237+
FDetailWidgetRow& Row = HoudiniEngineCategoryBuilder.AddCustomRow(FText::GetEmpty());
238238
TSharedRef<SHorizontalBox> Box = SNew(SHorizontalBox);
239239
TSharedPtr<SImage> Image;
240240

Source/HoudiniEngineEditor/Private/HoudiniInputDetails.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,13 @@ FHoudiniInputDetails::CreateWidget(
222222
TSharedRef< SVerticalBox > VerticalBox = SNew(SVerticalBox);
223223

224224
// ComboBox : Input Type
225+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 6
226+
TSharedPtr<IDetailsView> DetailsViewShared = HouInputCategory.GetParentLayout().GetDetailsViewSharedPtr();
227+
const IDetailsView* DetailsView = DetailsViewShared.Get();
228+
#else
225229
const IDetailsView* DetailsView = HouInputCategory.GetParentLayout().GetDetailsView();
230+
#endif
231+
226232
AddInputTypeComboBox(HouInputCategory, VerticalBox, InInputs, DetailsView);
227233

228234
switch (MainInput->GetInputType())

0 commit comments

Comments
 (0)