Cesium for Unreal 2.18.0
Loading...
Searching...
No Matches
CesiumIonServer.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "Engine/DataAsset.h"
6#include "UObject/Object.h"
7#include "CesiumIonServer.generated.h"
8
9namespace CesiumAsync {
10template <typename T> class Future;
11}
12
13/**
14 * Defines a Cesium ion Server. This may be the public (SaaS) Cesium ion server
15 * at ion.cesium.com, or it may be a self-hosted instance.
16 */
17UCLASS(BlueprintType)
18class CESIUMRUNTIME_API UCesiumIonServer : public UDataAsset {
19 GENERATED_BODY()
20
21public:
22 /**
23 * Gets the default Cesium ion Server (ion.cesium.com).
24 *
25 * It is expected to be found at
26 * `/Game/CesiumSettings/CesiumIonServers/CesiumIonSaaS`. In the Editor, it
27 * will be created if it does not already exist, so this method always returns
28 * a valid instance. At runtime, this method returns nullptr if the object
29 * does not exist.
30 */
31 UFUNCTION(BlueprintCallable, Category = "Cesium|ion")
33
34 /**
35 * Gets the current server to be assigned to new objects. In the Editor, this
36 * is the server that is currently selected on the Cesium panel. At runtime,
37 * this returns `GetDefault`, unless `SetCurrentForNewObjects` has been called
38 * to set it to something different.
39 */
41
42 /**
43 * Sets the current server to be assigned to new objects. If set to nullptr,
44 * the value of `GetDefault` will be returned from `GetCurrentForNewObjects`.
45 */
47
48#if WITH_EDITOR
49 /**
50 * Gets or creates a server from a given API URL. This is used for backward
51 * compatibility with the old `IonAssetEndpointUrl` property. The new server,
52 * if needed, is created in `/Game/CesiumSettings/CesiumIonServers`.
53 */
54 static UCesiumIonServer* GetBackwardCompatibleServer(const FString& apiUrl);
55#endif
56
57 /**
58 * The name to display for this server.
59 */
60 UPROPERTY(
61 EditAnywhere,
62 AssetRegistrySearchable,
63 BlueprintReadOnly,
64 Category = "Cesium|ion",
65 meta = (DisplayName = "Display Name"))
66 FString DisplayName = "ion.cesium.com";
67
68 /**
69 * The main URL of the Cesium ion server. For example, the server URL for the
70 * public Cesium ion is https://ion.cesium.com.
71 */
72 UPROPERTY(
73 EditAnywhere,
74 AssetRegistrySearchable,
75 BlueprintReadOnly,
76 Category = "Cesium|ion",
77 meta = (DisplayName = "Server URL"))
78 FString ServerUrl = "https://ion.cesium.com";
79
80 /**
81 * The URL of the main API endpoint of the Cesium ion server. For example, for
82 * the default, public Cesium ion server, this is `https://api.cesium.com`. If
83 * left blank, the API URL is automatically inferred from the Server URL.
84 */
85 UPROPERTY(
86 EditAnywhere,
87 AssetRegistrySearchable,
88 BlueprintReadOnly,
89 Category = "Cesium|ion",
90 meta = (DisplayName = "API URL"))
91 FString ApiUrl = "https://api.cesium.com";
92
93 /**
94 * The application ID to use to log in to this server using OAuth2. This
95 * OAuth2 application must be configured on the server with the exact URL
96 * `http://127.0.0.1/cesium-for-unreal/oauth2/callback`.
97 */
98 UPROPERTY(
99 EditAnywhere,
100 AssetRegistrySearchable,
101 BlueprintReadOnly,
102 Category = "Cesium|ion",
103 meta = (DisplayName = "OAuth Application ID"))
105
106 /**
107 * The ID of the default access token to use to access Cesium ion assets at
108 * runtime. This property may be an empty string, in which case the ID is
109 * found by searching the logged-in Cesium ion account for the
110 * DefaultIonAccessToken.
111 */
112 UPROPERTY(
113 EditAnywhere,
114 BlueprintReadOnly,
115 Category = "Cesium|ion",
116 meta = (DisplayName = "Default Cesium ion Access Token ID"))
118
119 /**
120 * The default token used to access Cesium ion assets at runtime. This token
121 * is embedded in packaged games for use at runtime.
122 */
123 UPROPERTY(
124 EditAnywhere,
125 AssetRegistrySearchable,
126 BlueprintReadOnly,
127 Category = "Cesium|ion",
128 meta = (DisplayName = "Default Cesium ion Access Token"))
130
131#if WITH_EDITOR
132 /**
133 * If the `ApiUrl` property is blank, this method asynchronously resolves it
134 * by consulting with the `ServerUrl`. If the `ApiUrl` is not blank, this
135 * method returns an already-resolved future.
136 */
137 CesiumAsync::Future<void> ResolveApiUrl();
138#endif
139
140private:
141 static UCesiumIonServer* _pDefaultForNewObjects;
142};
Defines a Cesium ion Server.
static UCesiumIonServer * GetDefaultServer()
Gets the default Cesium ion Server (ion.cesium.com).
static void SetServerForNewObjects(UCesiumIonServer *Server)
Sets the current server to be assigned to new objects.
FString DefaultIonAccessToken
The default token used to access Cesium ion assets at runtime.
int64 OAuth2ApplicationID
The application ID to use to log in to this server using OAuth2.
static UCesiumIonServer * GetServerForNewObjects()
Gets the current server to be assigned to new objects.
FString DisplayName
The name to display for this server.
FString ServerUrl
The main URL of the Cesium ion server.
FString ApiUrl
The URL of the main API endpoint of the Cesium ion server.
FString DefaultIonAccessTokenId
The ID of the default access token to use to access Cesium ion assets at runtime.