org.outernet.cesium-unity 1.15.3-linux.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +420 -0
- package/CHANGES.md.meta +7 -0
- package/Editor/BuildCesiumForUnity.cs +186 -0
- package/Editor/BuildCesiumForUnity.cs.meta +11 -0
- package/Editor/Cesium3DTilesetEditor.cs +542 -0
- package/Editor/Cesium3DTilesetEditor.cs.meta +11 -0
- package/Editor/CesiumBingMapsRasterOverlayEditor.cs +66 -0
- package/Editor/CesiumBingMapsRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumCameraControllerEditor.cs +174 -0
- package/Editor/CesiumCameraControllerEditor.cs.meta +11 -0
- package/Editor/CesiumCameraManagerEditor.cs +65 -0
- package/Editor/CesiumCameraManagerEditor.cs.meta +11 -0
- package/Editor/CesiumCartographicPolygonEditor.cs +23 -0
- package/Editor/CesiumCartographicPolygonEditor.cs.meta +11 -0
- package/Editor/CesiumDebugColorizeTilesRasterOverlayEditor.cs +41 -0
- package/Editor/CesiumDebugColorizeTilesRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumEditor.asmdef +26 -0
- package/Editor/CesiumEditor.asmdef.meta +7 -0
- package/Editor/CesiumEditorStyle.cs +188 -0
- package/Editor/CesiumEditorStyle.cs.meta +11 -0
- package/Editor/CesiumEditorUtility.cs +394 -0
- package/Editor/CesiumEditorUtility.cs.meta +11 -0
- package/Editor/CesiumEditorWindow.cs +447 -0
- package/Editor/CesiumEditorWindow.cs.meta +11 -0
- package/Editor/CesiumFlyToControllerEditor.cs +76 -0
- package/Editor/CesiumFlyToControllerEditor.cs.meta +11 -0
- package/Editor/CesiumGeoreferenceEditor.cs +277 -0
- package/Editor/CesiumGeoreferenceEditor.cs.meta +11 -0
- package/Editor/CesiumGlobeAnchorEditor.cs +202 -0
- package/Editor/CesiumGlobeAnchorEditor.cs.meta +11 -0
- package/Editor/CesiumInspectorGUI.cs +187 -0
- package/Editor/CesiumInspectorGUI.cs.meta +11 -0
- package/Editor/CesiumIonAsset.cs +192 -0
- package/Editor/CesiumIonAsset.cs.meta +11 -0
- package/Editor/CesiumIonAssetsWindow.cs +257 -0
- package/Editor/CesiumIonAssetsWindow.cs.meta +11 -0
- package/Editor/CesiumIonRasterOverlayEditor.cs +87 -0
- package/Editor/CesiumIonRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumIonServerManager.cs +153 -0
- package/Editor/CesiumIonServerManager.cs.meta +11 -0
- package/Editor/CesiumIonServerSelector.cs +127 -0
- package/Editor/CesiumIonServerSelector.cs.meta +11 -0
- package/Editor/CesiumIonSession.cs +102 -0
- package/Editor/CesiumIonSession.cs.meta +11 -0
- package/Editor/CesiumPolygonRasterOverlayEditor.cs +102 -0
- package/Editor/CesiumPolygonRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumRasterOverlayEditor.cs +230 -0
- package/Editor/CesiumRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumSubSceneEditor.cs +201 -0
- package/Editor/CesiumSubSceneEditor.cs.meta +11 -0
- package/Editor/CesiumTileMapServiceRasterOverlayEditor.cs +88 -0
- package/Editor/CesiumTileMapServiceRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumWebMapServiceRasterOverlayEditor.cs +111 -0
- package/Editor/CesiumWebMapServiceRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumWebMapTileServiceRasterOverlayEditor.cs +277 -0
- package/Editor/CesiumWebMapTileServiceRasterOverlayEditor.cs.meta +3 -0
- package/Editor/CompileCesiumForUnityNative.cs +581 -0
- package/Editor/CompileCesiumForUnityNative.cs.meta +11 -0
- package/Editor/ConfigureReinterop.cs +255 -0
- package/Editor/ConfigureReinterop.cs.meta +11 -0
- package/Editor/Helpers.cs +102 -0
- package/Editor/Helpers.cs.meta +11 -0
- package/Editor/IonAssetsMultiColumnHeader.cs +45 -0
- package/Editor/IonAssetsMultiColumnHeader.cs.meta +11 -0
- package/Editor/IonAssetsTreeView.cs +214 -0
- package/Editor/IonAssetsTreeView.cs.meta +11 -0
- package/Editor/IonMissingAssetWindow.cs +65 -0
- package/Editor/IonMissingAssetWindow.cs.meta +11 -0
- package/Editor/IonTokenTroubleshootingWindow.cs +615 -0
- package/Editor/IonTokenTroubleshootingWindow.cs.meta +11 -0
- package/Editor/NativeDownloadHandler.cs +35 -0
- package/Editor/NativeDownloadHandler.cs.meta +11 -0
- package/Editor/QuickAddItem.cs +43 -0
- package/Editor/QuickAddItem.cs.meta +11 -0
- package/Editor/Resources/Cesium-128x128.png +0 -0
- package/Editor/Resources/Cesium-128x128.png.meta +98 -0
- package/Editor/Resources/Cesium-24x24.png +0 -0
- package/Editor/Resources/Cesium-24x24.png.meta +123 -0
- package/Editor/Resources/Cesium-64x64.png +0 -0
- package/Editor/Resources/Cesium-64x64.png.meta +98 -0
- package/Editor/Resources/Cesium-for-Unity-dark.png +0 -0
- package/Editor/Resources/Cesium-for-Unity-dark.png.meta +123 -0
- package/Editor/Resources/Cesium-for-Unity-light.png +0 -0
- package/Editor/Resources/Cesium-for-Unity-light.png.meta +123 -0
- package/Editor/Resources/Cesium-icon-16x16.png +0 -0
- package/Editor/Resources/Cesium-icon-16x16.png.meta +98 -0
- package/Editor/Resources/FontAwesome/attribution.txt +9 -0
- package/Editor/Resources/FontAwesome/attribution.txt.meta +7 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.png +0 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/check-solid.png +0 -0
- package/Editor/Resources/FontAwesome/check-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/check-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/check-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/folder.png +0 -0
- package/Editor/Resources/FontAwesome/folder.png.meta +147 -0
- package/Editor/Resources/FontAwesome/folder.svg +5 -0
- package/Editor/Resources/FontAwesome/folder.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.png +0 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/key-solid.png +0 -0
- package/Editor/Resources/FontAwesome/key-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/key-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/key-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/plus-solid.png +0 -0
- package/Editor/Resources/FontAwesome/plus-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/plus-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/plus-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/times-solid.png +0 -0
- package/Editor/Resources/FontAwesome/times-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/times-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/times-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome.meta +8 -0
- package/Editor/Resources.meta +8 -0
- package/Editor/SelectIonTokenWindow.cs +249 -0
- package/Editor/SelectIonTokenWindow.cs.meta +11 -0
- package/Editor/arm64.meta +8 -0
- package/Editor/csc.rsp +1 -0
- package/Editor/csc.rsp.meta +7 -0
- package/Editor/libCesiumForUnityNative-Editor.so +0 -0
- package/Editor/libCesiumForUnityNative-Editor.so.meta +2 -0
- package/Editor/libCesiumForUnityNative-Runtime.so +0 -0
- package/Editor/libCesiumForUnityNative-Runtime.so.meta +2 -0
- package/Editor/x86_64.meta +8 -0
- package/Editor.meta +8 -0
- package/LICENSE +201 -0
- package/LICENSE.meta +7 -0
- package/Plugins/Standalone/libCesiumForUnityNative-Runtime.so +0 -0
- package/Plugins/Standalone/libCesiumForUnityNative-Runtime.so.meta +2 -0
- package/Plugins/Standalone.meta +8 -0
- package/Plugins.meta +8 -0
- package/README.md +39 -0
- package/README.md.meta +7 -0
- package/Reinterop.deps.json +172 -0
- package/Reinterop.deps.json.meta +7 -0
- package/Reinterop.dll +0 -0
- package/Reinterop.dll.meta +79 -0
- package/Runtime/Cesium3DTile.cs +37 -0
- package/Runtime/Cesium3DTile.cs.meta +11 -0
- package/Runtime/Cesium3DTileset.cs +788 -0
- package/Runtime/Cesium3DTileset.cs.meta +11 -0
- package/Runtime/Cesium3DTilesetLoadFailureDetails.cs +65 -0
- package/Runtime/Cesium3DTilesetLoadFailureDetails.cs.meta +11 -0
- package/Runtime/CesiumBackwardCompatibility.cs +163 -0
- package/Runtime/CesiumBackwardCompatibility.cs.meta +11 -0
- package/Runtime/CesiumBingMapsRasterOverlay.cs +72 -0
- package/Runtime/CesiumBingMapsRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumCameraController.cs +827 -0
- package/Runtime/CesiumCameraController.cs.meta +11 -0
- package/Runtime/CesiumCameraManager.cs +105 -0
- package/Runtime/CesiumCameraManager.cs.meta +11 -0
- package/Runtime/CesiumCartographicPolygon.cs +152 -0
- package/Runtime/CesiumCartographicPolygon.cs.meta +11 -0
- package/Runtime/CesiumCreditSystem.cs +343 -0
- package/Runtime/CesiumCreditSystem.cs.meta +11 -0
- package/Runtime/CesiumCreditSystemUI.cs +402 -0
- package/Runtime/CesiumCreditSystemUI.cs.meta +11 -0
- package/Runtime/CesiumDebugColorizeTilesRasterOverlay.cs +21 -0
- package/Runtime/CesiumDebugColorizeTilesRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumEllipsoid.cs +107 -0
- package/Runtime/CesiumEllipsoid.cs.meta +11 -0
- package/Runtime/CesiumFeature.cs +279 -0
- package/Runtime/CesiumFeature.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdAttribute.cs +61 -0
- package/Runtime/CesiumFeatureIdAttribute.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdSet.cs +165 -0
- package/Runtime/CesiumFeatureIdSet.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdTexture.cs +68 -0
- package/Runtime/CesiumFeatureIdTexture.cs.meta +11 -0
- package/Runtime/CesiumFlyToController.cs +539 -0
- package/Runtime/CesiumFlyToController.cs.meta +11 -0
- package/Runtime/CesiumGeoreference.cs +628 -0
- package/Runtime/CesiumGeoreference.cs.meta +11 -0
- package/Runtime/CesiumGlobeAnchor.cs +664 -0
- package/Runtime/CesiumGlobeAnchor.cs.meta +11 -0
- package/Runtime/CesiumGlobeAnchorBackwardCompatibility0dot2dot0.cs +105 -0
- package/Runtime/CesiumGlobeAnchorBackwardCompatibility0dot2dot0.cs.meta +11 -0
- package/Runtime/CesiumIntMatN.cs +398 -0
- package/Runtime/CesiumIntMatN.cs.meta +11 -0
- package/Runtime/CesiumIntVecN.cs +525 -0
- package/Runtime/CesiumIntVecN.cs.meta +11 -0
- package/Runtime/CesiumIonRasterOverlay.cs +110 -0
- package/Runtime/CesiumIonRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumIonServer.cs +137 -0
- package/Runtime/CesiumIonServer.cs.meta +11 -0
- package/Runtime/CesiumMetadata.cs +33 -0
- package/Runtime/CesiumMetadata.cs.meta +11 -0
- package/Runtime/CesiumMetadataValue.cs +1764 -0
- package/Runtime/CesiumMetadataValue.cs.meta +11 -0
- package/Runtime/CesiumMetadataValueType.cs +203 -0
- package/Runtime/CesiumMetadataValueType.cs.meta +11 -0
- package/Runtime/CesiumModelMetadata.cs +26 -0
- package/Runtime/CesiumModelMetadata.cs.meta +11 -0
- package/Runtime/CesiumObjectPool.cs +74 -0
- package/Runtime/CesiumObjectPool.cs.meta +11 -0
- package/Runtime/CesiumObjectPools.cs +39 -0
- package/Runtime/CesiumObjectPools.cs.meta +11 -0
- package/Runtime/CesiumOriginShift.cs +146 -0
- package/Runtime/CesiumOriginShift.cs.meta +11 -0
- package/Runtime/CesiumPointCloudRenderer.cs +246 -0
- package/Runtime/CesiumPointCloudRenderer.cs.meta +11 -0
- package/Runtime/CesiumPointCloudShading.cs +76 -0
- package/Runtime/CesiumPointCloudShading.cs.meta +11 -0
- package/Runtime/CesiumPolygonRasterOverlay.cs +109 -0
- package/Runtime/CesiumPolygonRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumPrimitiveFeatures.cs +130 -0
- package/Runtime/CesiumPrimitiveFeatures.cs.meta +11 -0
- package/Runtime/CesiumPropertyArray.cs +64 -0
- package/Runtime/CesiumPropertyArray.cs.meta +11 -0
- package/Runtime/CesiumPropertyTable.cs +126 -0
- package/Runtime/CesiumPropertyTable.cs.meta +11 -0
- package/Runtime/CesiumPropertyTableProperty.cs +1734 -0
- package/Runtime/CesiumPropertyTableProperty.cs.meta +11 -0
- package/Runtime/CesiumRasterOverlay.cs +239 -0
- package/Runtime/CesiumRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumRasterOverlayLoadFailureDetails.cs +65 -0
- package/Runtime/CesiumRasterOverlayLoadFailureDetails.cs.meta +11 -0
- package/Runtime/CesiumRuntime.asmdef +32 -0
- package/Runtime/CesiumRuntime.asmdef.meta +7 -0
- package/Runtime/CesiumRuntime.cs +3 -0
- package/Runtime/CesiumRuntime.cs.meta +11 -0
- package/Runtime/CesiumRuntimeSettings.cs +188 -0
- package/Runtime/CesiumRuntimeSettings.cs.meta +11 -0
- package/Runtime/CesiumSampleHeightResult.cs +47 -0
- package/Runtime/CesiumSampleHeightResult.cs.meta +11 -0
- package/Runtime/CesiumSimplePlanarEllipsoidCurve.cs +93 -0
- package/Runtime/CesiumSimplePlanarEllipsoidCurve.cs.meta +11 -0
- package/Runtime/CesiumSubScene.cs +473 -0
- package/Runtime/CesiumSubScene.cs.meta +11 -0
- package/Runtime/CesiumTileExcluder.cs +47 -0
- package/Runtime/CesiumTileExcluder.cs.meta +11 -0
- package/Runtime/CesiumTileMapServiceRasterOverlay.cs +93 -0
- package/Runtime/CesiumTileMapServiceRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumWebMapServiceRasterOverlay.cs +129 -0
- package/Runtime/CesiumWebMapServiceRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumWebMapTileServiceRasterOverlay.cs +414 -0
- package/Runtime/CesiumWebMapTileServiceRasterOverlay.cs.meta +3 -0
- package/Runtime/CesiumWgs84Ellipsoid.cs +75 -0
- package/Runtime/CesiumWgs84Ellipsoid.cs.meta +11 -0
- package/Runtime/ConfigureReinterop.cs +926 -0
- package/Runtime/ConfigureReinterop.cs.meta +11 -0
- package/Runtime/Helpers.cs +122 -0
- package/Runtime/Helpers.cs.meta +11 -0
- package/Runtime/ICesiumRestartable.cs +17 -0
- package/Runtime/ICesiumRestartable.cs.meta +11 -0
- package/Runtime/NativeCoroutine.cs +28 -0
- package/Runtime/NativeCoroutine.cs.meta +11 -0
- package/Runtime/NativeDownloadHandler.cs +29 -0
- package/Runtime/NativeDownloadHandler.cs.meta +11 -0
- package/Runtime/Resources/CesiumCreditSystem.prefab +78 -0
- package/Runtime/Resources/CesiumCreditSystem.prefab.meta +7 -0
- package/Runtime/Resources/CesiumCreditSystemRuntimeTheme.tss +2 -0
- package/Runtime/Resources/CesiumCreditSystemRuntimeTheme.tss.meta +11 -0
- package/Runtime/Resources/CesiumCreditSystemUI.uxml +4 -0
- package/Runtime/Resources/CesiumCreditSystemUI.uxml.meta +10 -0
- package/Runtime/Resources/CesiumCreditSystemUIPanelSettings.asset +38 -0
- package/Runtime/Resources/CesiumCreditSystemUIPanelSettings.asset.meta +8 -0
- package/Runtime/Resources/CesiumDefaultTilesetMaterial.mat +232 -0
- package/Runtime/Resources/CesiumDefaultTilesetMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumDefaultTilesetShader.shadergraph +14271 -0
- package/Runtime/Resources/CesiumDefaultTilesetShader.shadergraph.meta +10 -0
- package/Runtime/Resources/CesiumPointCloudShading.hlsl +156 -0
- package/Runtime/Resources/CesiumPointCloudShading.hlsl.meta +7 -0
- package/Runtime/Resources/CesiumPointCloudShadingMaterial.mat +125 -0
- package/Runtime/Resources/CesiumPointCloudShadingMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumPointCloudShadingShader.shader +73 -0
- package/Runtime/Resources/CesiumPointCloudShadingShader.shader.meta +10 -0
- package/Runtime/Resources/CesiumRasterOverlay.shadersubgraph +2207 -0
- package/Runtime/Resources/CesiumRasterOverlay.shadersubgraph.meta +10 -0
- package/Runtime/Resources/CesiumSelectTexCoords.shadersubgraph +722 -0
- package/Runtime/Resources/CesiumSelectTexCoords.shadersubgraph.meta +10 -0
- package/Runtime/Resources/CesiumUnlitTilesetMaterial.mat +261 -0
- package/Runtime/Resources/CesiumUnlitTilesetMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumUnlitTilesetShader.shadergraph +5873 -0
- package/Runtime/Resources/CesiumUnlitTilesetShader.shadergraph.meta +10 -0
- package/Runtime/Resources/DynamicCamera.prefab +253 -0
- package/Runtime/Resources/DynamicCamera.prefab.meta +7 -0
- package/Runtime/Resources/TransformTextureCoordinates.shadersubgraph +2171 -0
- package/Runtime/Resources/TransformTextureCoordinates.shadersubgraph.meta +10 -0
- package/Runtime/Resources/green1x1.png +0 -0
- package/Runtime/Resources/green1x1.png.meta +123 -0
- package/Runtime/Resources.meta +8 -0
- package/Runtime/TestGltfModel.cs +56 -0
- package/Runtime/TestGltfModel.cs.meta +11 -0
- package/Runtime/TestReinterop.cs +21 -0
- package/Runtime/TestReinterop.cs.meta +11 -0
- package/Runtime/UnityLifetime.cs +27 -0
- package/Runtime/UnityLifetime.cs.meta +11 -0
- package/Runtime/WaitForTask.cs +25 -0
- package/Runtime/WaitForTask.cs.meta +11 -0
- package/Runtime/csc.rsp +1 -0
- package/Runtime/csc.rsp.meta +7 -0
- package/Runtime.meta +8 -0
- package/ThirdParty.json +27 -0
- package/ThirdParty.json.meta +7 -0
- package/WGS84.asset +18 -0
- package/WGS84.asset.meta +8 -0
- package/package.json +29 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace CesiumForUnity
|
|
5
|
+
{
|
|
6
|
+
public class IonMissingAssetWindow : EditorWindow
|
|
7
|
+
{
|
|
8
|
+
private string _missingAssetName = "";
|
|
9
|
+
private string _missingAssetURL = "";
|
|
10
|
+
|
|
11
|
+
public static void ShowWindow(string assetName, long assetID)
|
|
12
|
+
{
|
|
13
|
+
IonMissingAssetWindow currentWindow =
|
|
14
|
+
GetWindow<IonMissingAssetWindow>("Asset is not available in MyAssets");
|
|
15
|
+
|
|
16
|
+
currentWindow._missingAssetName = assetName;
|
|
17
|
+
currentWindow._missingAssetURL = "https://cesium.com/ion/assetdepot/" + assetID;
|
|
18
|
+
|
|
19
|
+
Rect position = currentWindow.position;
|
|
20
|
+
position.width = 400;
|
|
21
|
+
position.height = 225;
|
|
22
|
+
position.x = (Screen.width / 2) + (position.width / 2);
|
|
23
|
+
position.y = (Screen.height / 2);
|
|
24
|
+
currentWindow.position = position;
|
|
25
|
+
|
|
26
|
+
currentWindow.ShowModalUtility();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private void OnGUI()
|
|
30
|
+
{
|
|
31
|
+
GUILayout.Space(5);
|
|
32
|
+
|
|
33
|
+
EditorGUILayout.LabelField("Before " + this._missingAssetName + " can be added " +
|
|
34
|
+
"to your level, it must be added to \"My Assets\" in your Cesium ion account.",
|
|
35
|
+
EditorStyles.wordWrappedLabel);
|
|
36
|
+
|
|
37
|
+
GUILayout.Space(10);
|
|
38
|
+
|
|
39
|
+
if (EditorGUILayout.LinkButton("Open this asset in the Cesium ion Asset Depot"))
|
|
40
|
+
{
|
|
41
|
+
Application.OpenURL(this._missingAssetURL);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
GUILayout.Space(10);
|
|
45
|
+
|
|
46
|
+
EditorGUILayout.LabelField(
|
|
47
|
+
"Click \"Add to my assets\" in the Cesium ion web page, " +
|
|
48
|
+
"then return to Cesium For Unity and try adding this asset again.",
|
|
49
|
+
EditorStyles.wordWrappedLabel);
|
|
50
|
+
|
|
51
|
+
GUILayout.FlexibleSpace();
|
|
52
|
+
|
|
53
|
+
GUILayout.BeginHorizontal();
|
|
54
|
+
GUILayout.FlexibleSpace();
|
|
55
|
+
if(GUILayout.Button("Close", GUILayout.Width(180), GUILayout.Height(35)))
|
|
56
|
+
{
|
|
57
|
+
this.Close();
|
|
58
|
+
}
|
|
59
|
+
GUILayout.FlexibleSpace();
|
|
60
|
+
GUILayout.EndHorizontal();
|
|
61
|
+
|
|
62
|
+
GUILayout.FlexibleSpace();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
using Reinterop;
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace CesiumForUnity
|
|
8
|
+
{
|
|
9
|
+
public class TokenTroubleshootingDetails
|
|
10
|
+
{
|
|
11
|
+
private string _token;
|
|
12
|
+
public string token
|
|
13
|
+
{
|
|
14
|
+
get => this._token;
|
|
15
|
+
set
|
|
16
|
+
{
|
|
17
|
+
this._token = value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private bool _isValid;
|
|
22
|
+
public bool isValid
|
|
23
|
+
{
|
|
24
|
+
get => this._isValid;
|
|
25
|
+
set
|
|
26
|
+
{
|
|
27
|
+
this._isValid = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private bool _allowsAccessToAsset;
|
|
32
|
+
public bool allowsAccessToAsset
|
|
33
|
+
{
|
|
34
|
+
get => this._allowsAccessToAsset;
|
|
35
|
+
set
|
|
36
|
+
{
|
|
37
|
+
this._allowsAccessToAsset = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private bool _associatedWithUserAccount;
|
|
42
|
+
public bool associatedWithUserAccount
|
|
43
|
+
{
|
|
44
|
+
get => this._associatedWithUserAccount;
|
|
45
|
+
set
|
|
46
|
+
{
|
|
47
|
+
this._associatedWithUserAccount = value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private bool _loaded;
|
|
52
|
+
public bool loaded
|
|
53
|
+
{
|
|
54
|
+
get => this._loaded;
|
|
55
|
+
set
|
|
56
|
+
{
|
|
57
|
+
this._loaded = value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public TokenTroubleshootingDetails() : this("") { }
|
|
62
|
+
|
|
63
|
+
public TokenTroubleshootingDetails(string token)
|
|
64
|
+
{
|
|
65
|
+
this._token = token;
|
|
66
|
+
this._isValid = false;
|
|
67
|
+
this._allowsAccessToAsset = false;
|
|
68
|
+
this._associatedWithUserAccount = false;
|
|
69
|
+
this._loaded = false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public class AssetTroubleshootingDetails
|
|
74
|
+
{
|
|
75
|
+
private long _assetID;
|
|
76
|
+
public long assetID
|
|
77
|
+
{
|
|
78
|
+
get => this._assetID;
|
|
79
|
+
set
|
|
80
|
+
{
|
|
81
|
+
this._assetID = value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private bool _assetExistsInUserAccount;
|
|
86
|
+
public bool assetExistsInUserAccount
|
|
87
|
+
{
|
|
88
|
+
get => this._assetExistsInUserAccount;
|
|
89
|
+
set
|
|
90
|
+
{
|
|
91
|
+
this._assetExistsInUserAccount = value;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private bool _loaded;
|
|
96
|
+
public bool loaded
|
|
97
|
+
{
|
|
98
|
+
get => this._loaded;
|
|
99
|
+
set
|
|
100
|
+
{
|
|
101
|
+
this._loaded = value;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public AssetTroubleshootingDetails() : this(0)
|
|
106
|
+
{ }
|
|
107
|
+
|
|
108
|
+
public AssetTroubleshootingDetails(long assetID)
|
|
109
|
+
{
|
|
110
|
+
this._assetID = assetID;
|
|
111
|
+
this._assetExistsInUserAccount = false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[ReinteropNativeImplementation(
|
|
116
|
+
"CesiumForUnityNative::IonTokenTroubleshootingWindowImpl",
|
|
117
|
+
"IonTokenTroubleshootingWindowImpl.h",
|
|
118
|
+
staticOnly: true)]
|
|
119
|
+
public partial class IonTokenTroubleshootingWindow : EditorWindow
|
|
120
|
+
{
|
|
121
|
+
private static List<IonTokenTroubleshootingWindow> _existingWindows =
|
|
122
|
+
new List<IonTokenTroubleshootingWindow>();
|
|
123
|
+
|
|
124
|
+
private bool _triggeredByError = false;
|
|
125
|
+
private CesiumIonAsset _ionAsset = new CesiumIonAsset();
|
|
126
|
+
|
|
127
|
+
public CesiumIonAsset ionAsset
|
|
128
|
+
{
|
|
129
|
+
get => this._ionAsset;
|
|
130
|
+
internal set
|
|
131
|
+
{
|
|
132
|
+
this._ionAsset = value;
|
|
133
|
+
this._assetTokenDetails.token = value.ionAccessToken;
|
|
134
|
+
this._assetDetails.assetID = value.ionAssetID;
|
|
135
|
+
this._defaultTokenDetails.token = this.server.defaultIonAccessToken;
|
|
136
|
+
this.GetTroubleshootingDetails();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private TokenTroubleshootingDetails _assetTokenDetails;
|
|
141
|
+
public TokenTroubleshootingDetails assetTokenDetails
|
|
142
|
+
{
|
|
143
|
+
get => this._assetTokenDetails;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private TokenTroubleshootingDetails _defaultTokenDetails;
|
|
147
|
+
public TokenTroubleshootingDetails defaultTokenDetails
|
|
148
|
+
{
|
|
149
|
+
get => this._defaultTokenDetails;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private AssetTroubleshootingDetails _assetDetails;
|
|
153
|
+
public AssetTroubleshootingDetails assetDetails
|
|
154
|
+
{
|
|
155
|
+
get => this._assetDetails;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private static void RemoveWindowWithPredicate(
|
|
159
|
+
Predicate<CesiumIonAsset> pred, bool closeWindow)
|
|
160
|
+
{
|
|
161
|
+
for (int i = 0; i < IonTokenTroubleshootingWindow._existingWindows.Count; i++)
|
|
162
|
+
{
|
|
163
|
+
IonTokenTroubleshootingWindow existingWindow =
|
|
164
|
+
IonTokenTroubleshootingWindow._existingWindows[i];
|
|
165
|
+
if (pred(existingWindow._ionAsset))
|
|
166
|
+
{
|
|
167
|
+
IonTokenTroubleshootingWindow._existingWindows.RemoveAt(i);
|
|
168
|
+
if (closeWindow)
|
|
169
|
+
{
|
|
170
|
+
existingWindow.Close();
|
|
171
|
+
}
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public static void ShowWindow(Cesium3DTileset tileset, bool triggeredByError)
|
|
178
|
+
{
|
|
179
|
+
ShowWindow(new CesiumIonAsset(tileset), triggeredByError);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public static void ShowWindow(CesiumIonRasterOverlay overlay, bool triggeredByError)
|
|
183
|
+
{
|
|
184
|
+
ShowWindow(new CesiumIonAsset(overlay), triggeredByError);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private static void ShowWindow(CesiumIonAsset ionAsset, bool triggeredByError)
|
|
188
|
+
{
|
|
189
|
+
if (ionAsset.IsNull())
|
|
190
|
+
{
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// If a window is already open for this object, close it.
|
|
195
|
+
Predicate<CesiumIonAsset> containsSameAsset =
|
|
196
|
+
delegate (CesiumIonAsset windowAsset)
|
|
197
|
+
{
|
|
198
|
+
return windowAsset.ionAssetID == ionAsset.ionAssetID;
|
|
199
|
+
};
|
|
200
|
+
RemoveWindowWithPredicate(containsSameAsset, true);
|
|
201
|
+
|
|
202
|
+
// If this is a tileset, close any existing windows associated with its
|
|
203
|
+
// overlays. Overlays won't appear until the tileset is working anyway.
|
|
204
|
+
Cesium3DTileset tilesetAsset = ionAsset.tileset;
|
|
205
|
+
if (tilesetAsset != null)
|
|
206
|
+
{
|
|
207
|
+
CesiumRasterOverlay[] rasterOverlays =
|
|
208
|
+
tilesetAsset.gameObject.GetComponents<CesiumRasterOverlay>();
|
|
209
|
+
|
|
210
|
+
for (int i = 0; i < rasterOverlays.Length; i++)
|
|
211
|
+
{
|
|
212
|
+
CesiumRasterOverlay overlay = rasterOverlays[i];
|
|
213
|
+
Predicate<CesiumIonAsset> containsOverlay
|
|
214
|
+
= delegate (CesiumIonAsset windowAsset)
|
|
215
|
+
{
|
|
216
|
+
return windowAsset.overlay == overlay;
|
|
217
|
+
};
|
|
218
|
+
RemoveWindowWithPredicate(containsOverlay, true);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// If this is a raster overlay and this panel is already open for its attached
|
|
223
|
+
// tileset, don't open the panel for the overlay for the same reason as above.
|
|
224
|
+
CesiumRasterOverlay overlayAsset = ionAsset.overlay;
|
|
225
|
+
if (overlayAsset != null)
|
|
226
|
+
{
|
|
227
|
+
Cesium3DTileset tileset
|
|
228
|
+
= overlayAsset.gameObject.GetComponent<Cesium3DTileset>();
|
|
229
|
+
if (tileset != null)
|
|
230
|
+
{
|
|
231
|
+
for (int i = 0;
|
|
232
|
+
i < IonTokenTroubleshootingWindow._existingWindows.Count; i++)
|
|
233
|
+
{
|
|
234
|
+
IonTokenTroubleshootingWindow existingWindow =
|
|
235
|
+
IonTokenTroubleshootingWindow._existingWindows[i];
|
|
236
|
+
if (existingWindow._ionAsset.tileset == tileset)
|
|
237
|
+
{
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
IonTokenTroubleshootingWindow window =
|
|
245
|
+
EditorWindow.CreateInstance<IonTokenTroubleshootingWindow>();
|
|
246
|
+
window.ionAsset = ionAsset;
|
|
247
|
+
window._triggeredByError = triggeredByError;
|
|
248
|
+
|
|
249
|
+
window.titleContent =
|
|
250
|
+
new GUIContent(ionAsset.objectName + ": Cesium ion Token Troubleshooting");
|
|
251
|
+
window.Show();
|
|
252
|
+
window.Focus();
|
|
253
|
+
|
|
254
|
+
IonTokenTroubleshootingWindow._existingWindows.Add(window);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public IonTokenTroubleshootingWindow()
|
|
258
|
+
{
|
|
259
|
+
this._assetTokenDetails = new TokenTroubleshootingDetails();
|
|
260
|
+
this._defaultTokenDetails = new TokenTroubleshootingDetails();
|
|
261
|
+
this._assetDetails = new AssetTroubleshootingDetails();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
private CesiumIonServer server
|
|
265
|
+
{
|
|
266
|
+
get
|
|
267
|
+
{
|
|
268
|
+
if (this.ionAsset.tileset != null)
|
|
269
|
+
return this.ionAsset.tileset.ionServer;
|
|
270
|
+
else if (this.ionAsset.overlay != null)
|
|
271
|
+
return this.ionAsset.overlay.ionServer;
|
|
272
|
+
else
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
private partial void GetTroubleshootingDetails();
|
|
278
|
+
|
|
279
|
+
private void Update()
|
|
280
|
+
{
|
|
281
|
+
// If the asset has been deleted at some point, close the window.
|
|
282
|
+
if (this._ionAsset.IsNull())
|
|
283
|
+
{
|
|
284
|
+
this.Close();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
private void OnDisable()
|
|
289
|
+
{
|
|
290
|
+
Predicate<CesiumIonAsset> containsSameAsset =
|
|
291
|
+
delegate (CesiumIonAsset windowAsset) { return windowAsset == this._ionAsset; };
|
|
292
|
+
RemoveWindowWithPredicate(containsSameAsset, false);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private bool _isConnectedToIon = false;
|
|
296
|
+
|
|
297
|
+
private void OnGUI()
|
|
298
|
+
{
|
|
299
|
+
if (Event.current.type == EventType.Layout)
|
|
300
|
+
{
|
|
301
|
+
CesiumIonSession ion = CesiumIonServerManager.instance.GetSession(this.server);
|
|
302
|
+
this._isConnectedToIon = ion.IsConnected();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
GUILayout.Space(5);
|
|
306
|
+
|
|
307
|
+
if (!this._ionAsset.IsUsingCesiumIon())
|
|
308
|
+
{
|
|
309
|
+
EditorGUILayout.LabelField(
|
|
310
|
+
"This object is not configured to connect to Cesium ion.",
|
|
311
|
+
EditorStyles.wordWrappedLabel);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (this._triggeredByError)
|
|
316
|
+
{
|
|
317
|
+
string descriptor = this._ionAsset.type + " " + this._ionAsset.objectName +
|
|
318
|
+
" (" + this._ionAsset.componentType + ")";
|
|
319
|
+
EditorGUILayout.LabelField(descriptor + " tried to access Cesium ion for " +
|
|
320
|
+
"asset ID " + this._ionAsset.ionAssetID + ", but it didn't work, " +
|
|
321
|
+
"probably due to a problem with the access token. This panel will " +
|
|
322
|
+
"help you fix it!", EditorStyles.wordWrappedLabel);
|
|
323
|
+
GUILayout.Space(5);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
CesiumIonServerSelector.DisplaySelected(this.server);
|
|
327
|
+
GUILayout.Space(5);
|
|
328
|
+
|
|
329
|
+
bool hasAssetToken = !string.IsNullOrEmpty(this._ionAsset.ionAccessToken);
|
|
330
|
+
if (hasAssetToken)
|
|
331
|
+
{
|
|
332
|
+
GUILayout.BeginHorizontal();
|
|
333
|
+
DrawAssetAccessTokenTroubleshootDetails();
|
|
334
|
+
DrawDefaultAccessTokenTroubleshootDetails();
|
|
335
|
+
GUILayout.EndHorizontal();
|
|
336
|
+
GUILayout.Space(5);
|
|
337
|
+
DrawAssetTroubleshootDetails();
|
|
338
|
+
}
|
|
339
|
+
else
|
|
340
|
+
{
|
|
341
|
+
GUILayout.BeginHorizontal();
|
|
342
|
+
DrawDefaultAccessTokenTroubleshootDetails();
|
|
343
|
+
DrawAssetTroubleshootDetails();
|
|
344
|
+
GUILayout.EndHorizontal();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
DrawSolutionPanel();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
private void DrawConditionCheck(string text, bool isChecked)
|
|
351
|
+
{
|
|
352
|
+
GUILayout.BeginHorizontal();
|
|
353
|
+
if (isChecked)
|
|
354
|
+
{
|
|
355
|
+
GUILayout.Box(CesiumEditorStyle.checkIcon, GUILayout.Width(20));
|
|
356
|
+
}
|
|
357
|
+
else
|
|
358
|
+
{
|
|
359
|
+
GUILayout.Box(CesiumEditorStyle.xIcon, GUILayout.Width(20));
|
|
360
|
+
}
|
|
361
|
+
GUILayout.Label(text);
|
|
362
|
+
GUILayout.EndHorizontal();
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
private void DrawAssetAccessTokenTroubleshootDetails()
|
|
366
|
+
{
|
|
367
|
+
GUILayout.BeginVertical();
|
|
368
|
+
GUILayout.Label("This " + this._ionAsset.type + "'s Access Token",
|
|
369
|
+
CesiumEditorStyle.subheaderStyle);
|
|
370
|
+
if (this._assetTokenDetails.loaded)
|
|
371
|
+
{
|
|
372
|
+
DrawConditionCheck("Is a valid Cesium ion Token",
|
|
373
|
+
this._assetTokenDetails.isValid);
|
|
374
|
+
DrawConditionCheck("Allows access to this asset",
|
|
375
|
+
this._assetTokenDetails.allowsAccessToAsset);
|
|
376
|
+
DrawConditionCheck("Is associated with your user account",
|
|
377
|
+
this._assetTokenDetails.associatedWithUserAccount);
|
|
378
|
+
}
|
|
379
|
+
GUILayout.EndVertical();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
private void DrawDefaultAccessTokenTroubleshootDetails()
|
|
383
|
+
{
|
|
384
|
+
GUILayout.BeginVertical();
|
|
385
|
+
GUILayout.Label("Project Default Access Token",
|
|
386
|
+
CesiumEditorStyle.subheaderStyle);
|
|
387
|
+
if (this._defaultTokenDetails.loaded)
|
|
388
|
+
{
|
|
389
|
+
DrawConditionCheck("Is a valid Cesium ion Token",
|
|
390
|
+
this._defaultTokenDetails.isValid);
|
|
391
|
+
DrawConditionCheck("Allows access to this asset",
|
|
392
|
+
this._defaultTokenDetails.allowsAccessToAsset);
|
|
393
|
+
DrawConditionCheck("Is associated with your user account",
|
|
394
|
+
this._defaultTokenDetails.associatedWithUserAccount);
|
|
395
|
+
}
|
|
396
|
+
GUILayout.EndVertical();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
private void DrawAssetTroubleshootDetails()
|
|
400
|
+
{
|
|
401
|
+
if (!this._isConnectedToIon)
|
|
402
|
+
{
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
GUILayout.BeginVertical();
|
|
407
|
+
GUILayout.Label("Asset", CesiumEditorStyle.subheaderStyle);
|
|
408
|
+
if (this._assetDetails.loaded)
|
|
409
|
+
{
|
|
410
|
+
DrawConditionCheck("Asset ID exists in your user account",
|
|
411
|
+
this._assetDetails.assetExistsInUserAccount);
|
|
412
|
+
}
|
|
413
|
+
GUILayout.EndVertical();
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
private void DrawSolutionPanel()
|
|
417
|
+
{
|
|
418
|
+
if (this.HasNoAutomaticRemedies())
|
|
419
|
+
{
|
|
420
|
+
EditorGUILayout.LabelField(
|
|
421
|
+
"No automatic remedies are possible for Asset ID " +
|
|
422
|
+
this._ionAsset.ionAssetID + ", because:\n" +
|
|
423
|
+
" - The current token does not authorize access to the specified " +
|
|
424
|
+
"asset ID, and\n" +
|
|
425
|
+
" - The asset ID does not exist in your Cesium ion account.\n" +
|
|
426
|
+
"\n" +
|
|
427
|
+
"Please click the button below to open Cesium ion and check:\n" +
|
|
428
|
+
" - The " + this._ionAsset.type + "'s \"Ion Asset ID\" property " +
|
|
429
|
+
"is correct.\n" +
|
|
430
|
+
" - If the asset is from the \"Asset Depot\", verify that it has " +
|
|
431
|
+
"been added to \"My Assets\".",
|
|
432
|
+
EditorStyles.wordWrappedLabel);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
GUILayout.FlexibleSpace();
|
|
436
|
+
|
|
437
|
+
if (!this._isConnectedToIon)
|
|
438
|
+
{
|
|
439
|
+
this.DrawConnectToIonButton();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (this.CanUseDefaultToken())
|
|
443
|
+
{
|
|
444
|
+
this.DrawUseDefaultTokenButton();
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
if (this.CanAuthorizeToken(this._assetTokenDetails))
|
|
448
|
+
{
|
|
449
|
+
this.DrawAuthorizeAssetTokenButton();
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (this.CanAuthorizeToken(this._defaultTokenDetails))
|
|
453
|
+
{
|
|
454
|
+
this.DrawAuthorizeDefaultTokenButton();
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (this.CanSelectNewDefaultToken())
|
|
458
|
+
{
|
|
459
|
+
this.DrawSelectNewDefaultTokenButton();
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (this._isConnectedToIon)
|
|
463
|
+
{
|
|
464
|
+
this.DrawOpenCesiumIonButton();
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
GUILayout.FlexibleSpace();
|
|
468
|
+
|
|
469
|
+
// Force the window to repaint if it is focused. By default,
|
|
470
|
+
// it only repaints sporadically, so the token details will
|
|
471
|
+
// take a long time to visually update.
|
|
472
|
+
if (EditorWindow.focusedWindow == this)
|
|
473
|
+
{
|
|
474
|
+
this.Repaint();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
private bool CanUseDefaultToken()
|
|
479
|
+
{
|
|
480
|
+
TokenTroubleshootingDetails details = this._defaultTokenDetails;
|
|
481
|
+
return !string.IsNullOrEmpty(this._ionAsset.ionAccessToken)
|
|
482
|
+
&& details.isValid
|
|
483
|
+
&& details.allowsAccessToAsset;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
private void DrawUseDefaultTokenButton()
|
|
487
|
+
{
|
|
488
|
+
if (GUILayout.Button("Use the project default token for this "
|
|
489
|
+
+ this._ionAsset.type, CesiumEditorStyle.cesiumButtonStyle))
|
|
490
|
+
{
|
|
491
|
+
this.UseDefaultToken();
|
|
492
|
+
this.Close();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
private void UseDefaultToken()
|
|
497
|
+
{
|
|
498
|
+
IonTokenTroubleshootingWindow.UseDefaultToken(this._ionAsset);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
public static void UseDefaultToken(CesiumIonAsset asset)
|
|
502
|
+
{
|
|
503
|
+
if (asset.IsNull())
|
|
504
|
+
{
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (asset.tileset != null)
|
|
509
|
+
{
|
|
510
|
+
Undo.RecordObject(asset.tileset, "Use Default ion Access Token for Tileset");
|
|
511
|
+
}
|
|
512
|
+
else if (asset.overlay != null)
|
|
513
|
+
{
|
|
514
|
+
Undo.RecordObject(asset.overlay, "Use Default ion Access Token for Raster Overlay");
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
asset.ionAccessToken = "";
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
private partial void AuthorizeToken(string token, bool isDefaultToken);
|
|
521
|
+
|
|
522
|
+
private bool CanAuthorizeToken(TokenTroubleshootingDetails tokenDetails)
|
|
523
|
+
{
|
|
524
|
+
AssetTroubleshootingDetails assetDetails = this._assetDetails;
|
|
525
|
+
if (!assetDetails.assetExistsInUserAccount)
|
|
526
|
+
{
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
return tokenDetails.isValid
|
|
531
|
+
&& !tokenDetails.allowsAccessToAsset
|
|
532
|
+
&& tokenDetails.associatedWithUserAccount;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
private void DrawAuthorizeAssetTokenButton()
|
|
536
|
+
{
|
|
537
|
+
if (GUILayout.Button(
|
|
538
|
+
"Authorize the " + this._ionAsset.type + "'s token to access this asset",
|
|
539
|
+
CesiumEditorStyle.cesiumButtonStyle))
|
|
540
|
+
{
|
|
541
|
+
this.AuthorizeToken(this._ionAsset.ionAccessToken, false);
|
|
542
|
+
this.Close();
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
private void DrawAuthorizeDefaultTokenButton()
|
|
547
|
+
{
|
|
548
|
+
if (GUILayout.Button(
|
|
549
|
+
"Authorize the project's default token to access this asset",
|
|
550
|
+
CesiumEditorStyle.cesiumButtonStyle))
|
|
551
|
+
{
|
|
552
|
+
this.AuthorizeToken(this.server.defaultIonAccessToken, true);
|
|
553
|
+
this.Close();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
private partial void SelectNewDefaultToken();
|
|
558
|
+
|
|
559
|
+
private bool CanSelectNewDefaultToken()
|
|
560
|
+
{
|
|
561
|
+
if (!this._isConnectedToIon || !this._assetDetails.assetExistsInUserAccount)
|
|
562
|
+
{
|
|
563
|
+
return false;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
TokenTroubleshootingDetails details = this._defaultTokenDetails;
|
|
567
|
+
return !details.isValid ||
|
|
568
|
+
!(details.allowsAccessToAsset || details.associatedWithUserAccount);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
private void DrawSelectNewDefaultTokenButton()
|
|
572
|
+
{
|
|
573
|
+
if (GUILayout.Button("Select or create a new project default token",
|
|
574
|
+
CesiumEditorStyle.cesiumButtonStyle))
|
|
575
|
+
{
|
|
576
|
+
this.SelectNewDefaultToken();
|
|
577
|
+
this.Close();
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
private bool CannotRemedyToken(TokenTroubleshootingDetails details)
|
|
582
|
+
{
|
|
583
|
+
return string.IsNullOrEmpty(details.token) || !details.allowsAccessToAsset;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
private bool HasNoAutomaticRemedies()
|
|
587
|
+
{
|
|
588
|
+
return this.CannotRemedyToken(this._assetTokenDetails)
|
|
589
|
+
&& this.CannotRemedyToken(this._defaultTokenDetails)
|
|
590
|
+
&& !this._assetDetails.assetExistsInUserAccount;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
private void DrawOpenCesiumIonButton()
|
|
594
|
+
{
|
|
595
|
+
if (GUILayout.Button("Open Cesium ion on the Web",
|
|
596
|
+
CesiumEditorStyle.cesiumButtonStyle))
|
|
597
|
+
{
|
|
598
|
+
Application.OpenURL("https://cesium.com/ion/tokens");
|
|
599
|
+
this.Close();
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
private void DrawConnectToIonButton()
|
|
604
|
+
{
|
|
605
|
+
if (GUILayout.Button("Connect to Cesium ion",
|
|
606
|
+
CesiumEditorStyle.cesiumButtonStyle))
|
|
607
|
+
{
|
|
608
|
+
CesiumEditorWindow.ShowWindow();
|
|
609
|
+
CesiumIonSession ion = CesiumIonServerManager.instance.GetSession(this.server);
|
|
610
|
+
ion.Connect();
|
|
611
|
+
this.Close();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|