Cesium for Unreal 2.13.2
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()
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 */
32
33 /**
34 * Gets the current server to be assigned to new objects. In the Editor, this
35 * is the server that is currently selected on the Cesium panel. At runtime,
36 * this returns `GetDefault`, unless `SetCurrentForNewObjects` has been called
37 * to set it to something different.
38 */
40
41 /**
42 * Sets the current server to be assigned to new objects. If set to nullptr,
43 * the value of `GetDefault` will be returned from `GetCurrentForNewObjects`.
44 */
46
47#if WITH_EDITOR
48 /**
49 * Gets or creates a server from a given API URL. This is used for backward
50 * compatibility with the old `IonAssetEndpointUrl` property. The new server,
51 * if needed, is created in `/Game/CesiumSettings/CesiumIonServers`.
52 */
53 static UCesiumIonServer* GetBackwardCompatibleServer(const FString& apiUrl);
54#endif
55
56 /**
57 * The name to display for this server.
58 */
59 UPROPERTY(
60 EditAnywhere,
61 AssetRegistrySearchable,
62 Category = "Cesium",
63 meta = (DisplayName = "Display Name"))
64 FString DisplayName = "ion.cesium.com";
65
66 /**
67 * The main URL of the Cesium ion server. For example, the server URL for the
68 * public Cesium ion is https://ion.cesium.com.
69 */
70 UPROPERTY(
71 EditAnywhere,
72 AssetRegistrySearchable,
73 Category = "Cesium",
74 meta = (DisplayName = "Server URL"))
75 FString ServerUrl = "https://ion.cesium.com";
76
77 /**
78 * The URL of the main API endpoint of the Cesium ion server. For example, for
79 * the default, public Cesium ion server, this is `https://api.cesium.com`. If
80 * left blank, the API URL is automatically inferred from the Server URL.
81 */
82 UPROPERTY(
83 EditAnywhere,
84 AssetRegistrySearchable,
85 Category = "Cesium",
86 meta = (DisplayName = "API URL"))
87 FString ApiUrl = "https://api.cesium.com";
88
89 /**
90 * The application ID to use to log in to this server using OAuth2. This
91 * OAuth2 application must be configured on the server with the exact URL
92 * `http://127.0.0.1/cesium-for-unreal/oauth2/callback`.
93 */
94 UPROPERTY(
95 EditAnywhere,
96 AssetRegistrySearchable,
97 Category = "Cesium",
98 meta = (DisplayName = "OAuth Application ID"))
99 int64 OAuth2ApplicationID = 190;
100
101 /**
102 * The ID of the default access token to use to access Cesium ion assets at
103 * runtime. This property may be an empty string, in which case the ID is
104 * found by searching the logged-in Cesium ion account for the
105 * DefaultIonAccessToken.
106 */
107 UPROPERTY(
108 EditAnywhere,
109 Category = "Cesium",
110 meta = (DisplayName = "Default Cesium ion Access Token ID"))
111 FString DefaultIonAccessTokenId;
112
113 /**
114 * The default token used to access Cesium ion assets at runtime. This token
115 * is embedded in packaged games for use at runtime.
116 */
117 UPROPERTY(
118 EditAnywhere,
119 AssetRegistrySearchable,
120 Category = "Cesium",
121 meta = (DisplayName = "Default Cesium ion Access Token"))
122 FString DefaultIonAccessToken;
123
124#if WITH_EDITOR
125 /**
126 * If the `ApiUrl` property is blank, this method asynchronously resolves it
127 * by consulting with the `ServerUrl`. If the `ApiUrl` is not blank, this
128 * method returns an already-resolved future.
129 */
130 CesiumAsync::Future<void> ResolveApiUrl();
131#endif
132
133private:
134 static UCesiumIonServer* _pDefaultForNewObjects;
135};
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.
static UCesiumIonServer * GetServerForNewObjects()
Gets the current server to be assigned to new objects.