Skip to content

Commit d58decc

Browse files
committed
Hide implementation detail
* give access to Tileset actor
1 parent 335d612 commit d58decc

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Source/CesiumRuntime/Private/CesiumGltfComponent.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,8 +3197,8 @@ static void loadPrimitiveGameThreadPart(
31973197
pBaseMaterial,
31983198
ImportedSlotName);
31993199
if (pMaterialForGltfPrimitive) {
3200-
// pMaterialForGltfPrimitive created above may not have used the suggested
3201-
// pBaseMaterial passed as input
3200+
// pMaterialForGltfPrimitive created above may not have used the
3201+
// suggested pBaseMaterial passed as input
32023202
pBaseMaterial = pMaterialForGltfPrimitive->Parent.Get();
32033203
// may have changed but we don't need it from now on:
32043204
pUserDesignatedMaterialAsDynamic = nullptr;
@@ -3559,8 +3559,7 @@ UCesiumGltfComponent::CreateOffGameThread(
35593559

35603560
void UCesiumGltfComponent::OnVisibilityChanged() {
35613561
USceneComponent::OnVisibilityChanged();
3562-
auto* pLifecycleEventReceiver =
3563-
Cast<ACesium3DTileset>(GetOuter())->GetLifecycleEventReceiver();
3562+
auto* pLifecycleEventReceiver = GetTilesetActor().GetLifecycleEventReceiver();
35643563
if (pLifecycleEventReceiver)
35653564
pLifecycleEventReceiver->OnVisibilityChanged(*this, GetVisibleFlag());
35663565
}
@@ -3603,6 +3602,10 @@ const Cesium3DTilesSelection::TileID& UCesiumGltfComponent::GetTileID() const {
36033602
return pTile->getTileID();
36043603
}
36053604

3605+
ACesium3DTileset& UCesiumGltfComponent::GetTilesetActor() {
3606+
return *Cast<ACesium3DTileset>(GetOuter());
3607+
}
3608+
36063609
FVector
36073610
UCesiumGltfComponent::GetGltfToUnrealLocalVertexPositionScaleFactor() const {
36083611
// Note: replicates logic from (static) loadPrimitive

Source/CesiumRuntime/Private/CesiumGltfComponent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class UCesiumGltfComponent : public USceneComponent, public ICesiumLoadedTile {
140140
// from ICesiumLoadedTile
141141
const FCesiumModelMetadata& GetModelMetadata() const override;
142142
const Cesium3DTilesSelection::TileID& GetTileID() const override;
143+
ACesium3DTileset& GetTilesetActor() override;
143144
FVector GetGltfToUnrealLocalVertexPositionScaleFactor() const override;
144145
void SetRenderReady(bool bToggle) override;
145146

Source/CesiumRuntime/Public/CesiumLoadedTile.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "CesiumLoadedTile.generated.h"
1414

15+
class ACesium3DTileset;
1516
class UStaticMeshComponent;
1617

1718
UINTERFACE()
@@ -25,10 +26,11 @@ class ICesiumLoadedTile {
2526
* guarantee of unicity */
2627
virtual const Cesium3DTilesSelection::TileID& GetTileID() const = 0;
2728
/** Scaling factor to be applied (component-wise multiplication) to glTF
28-
* vertices of this tile's models to obtain the values represented in their
29+
* vertices of this tile's model to obtain the values represented in their
2930
* matching mesh component (see @{link
3031
* UCesiumLoadedTilePrimitive::GetMeshComponent). */
3132
virtual FVector GetGltfToUnrealLocalVertexPositionScaleFactor() const = 0;
33+
virtual ACesium3DTileset& GetTilesetActor() = 0;
3234
virtual const FCesiumModelMetadata& GetModelMetadata() const = 0;
3335
virtual void SetRenderReady(bool bToggle) = 0;
3436
};

0 commit comments

Comments
 (0)