Cesium for Unreal 2.12.0
Loading...
Searching...
No Matches
CesiumSubLevelSwitcherComponent.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "Components/ActorComponent.h"
6#include "CesiumSubLevelSwitcherComponent.generated.h"
7
9class ALevelInstance;
10class ULevelStreaming;
11class UWorld;
12
18UCLASS(ClassGroup = "Cesium")
19class CESIUMRUNTIME_API UCesiumSubLevelSwitcherComponent
20 : public UActorComponent {
21 GENERATED_BODY()
22
23public:
25
30 UFUNCTION(BlueprintPure, Category = "Cesium|Sub-levels")
31 TArray<ALevelInstance*> GetRegisteredSubLevels() const noexcept;
32
38 const TArray<TWeakObjectPtr<ALevelInstance>>&
39 GetRegisteredSubLevelsWeak() const noexcept {
40 return this->_sublevels;
41 }
42
46 UFUNCTION(BlueprintPure, Category = "Cesium|Sub-levels")
47 ALevelInstance* GetCurrentSubLevel() const noexcept;
48
53 UFUNCTION(BlueprintPure, Category = "Cesium|Sub-levels")
54 ALevelInstance* GetTargetSubLevel() const noexcept;
55
60 UFUNCTION(BlueprintCallable, Category = "Cesium|Sub-levels")
61 void SetTargetSubLevel(ALevelInstance* LevelInstance) noexcept;
62
63private:
64 // To allow the sub-level to register/unregister itself with the functions
65 // below.
66 friend class UCesiumSubLevelComponent;
67 friend class CesiumEditorSubLevelMutex;
68
73 void RegisterSubLevel(ALevelInstance* pSubLevel) noexcept;
74
79 void UnregisterSubLevel(ALevelInstance* pSubLevel) noexcept;
80
81 virtual void TickComponent(
82 float DeltaTime,
83 enum ELevelTick TickType,
84 FActorComponentTickFunction* ThisTickFunction) override;
85
86 void _updateSubLevelStateGame();
87#if WITH_EDITOR
88 void _updateSubLevelStateEditor();
89#endif
90
95 ULevelStreaming*
96 _getLevelStreamingForSubLevel(ALevelInstance* SubLevel) const;
97
98 // Don't save/load or copy this.
99 UPROPERTY(Transient, DuplicateTransient, TextExportTransient)
100 TArray<TWeakObjectPtr<ALevelInstance>> _sublevels;
101
102 // Don't save/load or copy this.
103 UPROPERTY(Transient, DuplicateTransient, TextExportTransient)
104 TWeakObjectPtr<ALevelInstance> _pCurrent = nullptr;
105
106 // Save/load this, but don't copy it.
107 UPROPERTY(DuplicateTransient, TextExportTransient)
108 TWeakObjectPtr<ALevelInstance> _pTarget = nullptr;
109
110 bool _doExtraChecksOnNextTick = false;
111 bool _isTransitioningSubLevels = false;
112};
Controls how global geospatial coordinates are mapped to coordinates in the Unreal Engine level.
Manages the asynchronous switching between sub-levels, making sure that a previous sub-level is hidde...