Skip to content

Commit 4153694

Browse files
committed
Fixed parent issuing with Geometry Collection Actors.
1 parent a7a7a3b commit 4153694

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

Source/HoudiniEngine/Private/HoudiniGeoImporter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,11 @@ UHoudiniGeoImporter::CreateInstancers(
491491

492492
if (bHasGeometryCollection)
493493
{
494+
// TODO: We need to know who to parent new outputs too. This should be a Cookable, but we don't have one...
495+
UObject* OutputOwner = OuterComponent;
496+
494497
FHoudiniGeometryCollectionTranslator::SetupGeometryCollectionComponentFromOutputs(
495-
InAllOutputs, OuterComponent, PackageParams, World);
498+
InAllOutputs, OutputOwner, OuterComponent, PackageParams, World);
496499

497500
if (InAllOutputs.Last()->GetType() != EHoudiniOutputType::GeometryCollection)
498501
{

Source/HoudiniEngine/Private/HoudiniGeometryCollectionTranslator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
void
2929
FHoudiniGeometryCollectionTranslator::SetupGeometryCollectionComponentFromOutputs(
3030
TArray<TObjectPtr<UHoudiniOutput>>& InAllOutputs,
31+
UObject* InOutputParent, // Probably a cookable, but not for GeoImporter.
3132
UObject* InOuterComponent,
3233
const FHoudiniPackageParams& InPackageParams,
3334
UWorld * InWorld)
@@ -72,7 +73,7 @@ FHoudiniGeometryCollectionTranslator::SetupGeometryCollectionComponentFromOutput
7273
{
7374
// Create the actual HoudiniOutput.
7475
HoudiniOutput = NewObject<UHoudiniOutput>(
75-
InOuterComponent,
76+
InOutputParent,
7677
UHoudiniOutput::StaticClass(),
7778
FName(*GCName), // Used for baking identification
7879
RF_NoFlags);
@@ -128,10 +129,9 @@ FHoudiniGeometryCollectionTranslator::SetupGeometryCollectionComponentFromOutput
128129

129130
GeometryCollectionActor->GetGeometryCollectionComponent()->SetRestCollection(GeometryCollection);
130131

131-
UHoudiniCookable* HC = FHoudiniEngineUtils::GetOuterHoudiniCookable(HoudiniOutput);
132-
if (IsValid(HC) && HC->GetComponent())
132+
if (IsValid(ParentComponent))
133133
{
134-
GeometryCollectionActor->AttachToComponent(HC->GetComponent(), FAttachmentTransformRules::KeepWorldTransform);
134+
GeometryCollectionActor->AttachToComponent(ParentComponent, FAttachmentTransformRules::KeepWorldTransform);
135135
}
136136

137137
ActorTransform = ParentComponent->GetOwner()->GetTransform();

Source/HoudiniEngine/Private/HoudiniGeometryCollectionTranslator.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ struct HOUDINIENGINE_API FHoudiniGeometryCollectionTranslator
7272
};
7373

7474
public:
75-
static void SetupGeometryCollectionComponentFromOutputs(TArray<TObjectPtr<UHoudiniOutput>>& InAllOutputs,
76-
UObject* InOuterComponent, const FHoudiniPackageParams& InPackageParams, UWorld * InWorld);
75+
static void SetupGeometryCollectionComponentFromOutputs(
76+
TArray<TObjectPtr<UHoudiniOutput>>& InAllOutputs,
77+
UObject* InOutputParent,
78+
UObject* InOuterComponent,
79+
const FHoudiniPackageParams& InPackageParams,
80+
UWorld * InWorld);
7781

7882
static bool GetFracturePieceAttribute(const HAPI_NodeId& GeoId, const HAPI_NodeId& PartId, int& OutInt);
7983
static bool GetClusterPieceAttribute(const HAPI_NodeId& GeoId, const HAPI_NodeId& PartId, int& OutInt);

Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ FHoudiniOutputTranslator::CreateAllOutputs(
333333

334334
// TODO COOKABLE: Handle the case where the Out is NOT a component
335335
// we need to split output asset creation from component creation!
336+
UHoudiniCookable* OuterHC = Cast<UHoudiniCookable>(InOuter);
336337
USceneComponent* InOuterComponent = Cast<USceneComponent>(InOuter);
337338
if (!InOuterComponent)
338339
{
339-
UHoudiniCookable* OuterHC = Cast<UHoudiniCookable>(InOuter);
340340
InOuterComponent = OuterHC ? OuterHC->GetComponent() : nullptr;
341341
}
342342

@@ -668,7 +668,9 @@ FHoudiniOutputTranslator::CreateAllOutputs(
668668

669669
if (HasGeometryCollection)
670670
{
671-
FHoudiniGeometryCollectionTranslator::SetupGeometryCollectionComponentFromOutputs(Outputs, InOuterComponent, PackageParams, InWorld);
671+
UObject* OutputOwner = OuterHC ? Cast<UObject>(OuterHC) : Cast<UObject>(InOuterComponent);
672+
673+
FHoudiniGeometryCollectionTranslator::SetupGeometryCollectionComponentFromOutputs(Outputs, OutputOwner, InOuterComponent, PackageParams, InWorld);
672674
}
673675

674676
if (NumVisibleOutputs > 0)

0 commit comments

Comments
 (0)