Closed kring closed 9 months ago
Thanks for the pull request @kring!
Reviewers, don't forget to make sure that:
connect to cesium ion.
Open up CesiumIonSaaS data asset.
change API to https://hello.cesium.com
Close and reopen the project.
the status will say connecting... and also show the full quick add panel.
I think it should show the login panel while connecting.
An error message will appear and the Server Selector widget causes an error.
Doesn't happen if you skip step 2.
Confirmed that when you open an old level for the first time, it will try to use the current server instance (as opposed to the intended default ion server). Maybe you could find / create the default ion server if this happens?
Alright I think I've addressed all of the feedback (thanks for the thorough review!) and this is working well.
Works well, but I found one bug:
pIonObject was not valid in CesiumIonTokenTroubleshooting::canConnectToCesiumIon()
Steps to reproduce:
Open CesiumIonSaaS.
Clear the Default Cesium ion Access Token and Token ID.
Open 04_MAIN_CesiumSublevels
The ion Token Troubleshooting panel should open.
Create a new token. The next ion Token Troubleshooting panel asks you to authorize the project default token.
Reopen Open 04_MAIN_CesiumSublevels
The Save Content window appears, asking you to save CesiumIonSaaS.
Hit Dont Save.
The error should appear.
@joseph-kaile I think I've addressed that. The token troubleshooting panel now holds a TWeakObjectPtr to the tileset or overlay, so we can more reliably detect if it's unloaded while the panel is open.
@joseph-kaile I think I've addressed that. The token troubleshooting panel now holds a TWeakObjectPtr to the tileset or overlay, so we can more reliably detect if it's unloaded while the panel is open.
I verified that it fixed the issue.
If there's no other issues @joseph-kaile or @kring, I'll merge once CI passes. Thanks!
This is useful for self-hosted Cesium ion, and also makes it easy to switch between multiple SaaS accounts.
Initially, the Cesium panel looks much the same as before:
Small differences:
After connecting, it looks like this:
Note the name of the signed-in user (
CesiumJS
) in the dropdown at the top.Cesium ion servers are represented as Unreal "data assets" of type
CesiumIonServer
. Click the folder and magnifying glass icon next to the dropdown to browse to the asset for the selected server in the Content Browser:Double-click the
CesiumIonSaaS
server definition to edit it:To add a server, we can right-click on the existing one and choose "Duplicate". Or Add -> Miscellaneous -> Data Asset and then select CesiumIonServer. Edit the server properties as desired:
(Note that I've specified the normal SaaS API URL and OAuth application ID so that I can actually use this server. But a user with a self-hosted Cesium ion would specify the appropriate values for their server.)
The new server shows up in the dropdown:
When I select it, the panel shows that that we are not currently connected to this server. We remain connected to the other one, though. Click the Connect to Cesium ion button to sign in to this server, too. The dropdown shows that we're connected to both:
If we close Unreal now, and reopen it, Cesium for Unreal will automatically "resume" both connections.
The toolbar buttons work much the same as before. The Add button opens the "Cesium ion Assets" panel, which has its own dropdown to select the server. Changing the current server on either panel also changes it on the other one (they always stay in sync):
The Upload button opens a web browser on the upload page of the current server. The Token button opens the token panel for the current server, and it now displays which server you're configuring the project default token for:
The "Sign Out" button signs out of the currently selected server.
When we create a new
Cesium3DTileset
orCesiumIonRasterOverlay
, it is configured to reference the currently selected server. This is a new property in the "Advanced" section of the object's properties:This property replaces the old IonAssetEndpointUrl. When loading all levels that used this property, Cesium for Unreal will automatically create a corresponding server definition.
If there's a problem with the token, the token troubleshooting panel indicates which server is being used, and any "fixes" will apply to that server.
When packaging a game, Unreal automatically embeds any CesiumIonServer data assets that are referenced by any of the levels. And these data assets include the server details as well as the project default token, so this information is shipped with the game. The login token is still stored in EditorPerProjectUserSettings.ini, so it is not shipped with the game (this is vitally important!)