Conversation
…scene creation. Sample command line scripts are provided to create the CookieFactory scene, integrate with the Cesium Ion tiling pipeline, and delete scenes.
…E with installation instructions.
| twinMakerScene.addRootNodeIfNameNotExist(rootNode); | ||
|
|
||
| // Save the changes to the Scene | ||
| await factory.save(twinMakerScene); |
There was a problem hiding this comment.
IIUC the behavior here is to not overwrite the scene if it already exists? If so, we may want to update some of the messages in the sample or adjust to early exit if scene already exists so not making any changes. e.g. I ran and got the following and thought the updated scene was saved to cloud but saw no change there:
Scene already exists, loading scene...
Creating/Editing Cookie Factory scene...
Adding Cookie Lines...
Adding Mixers and WaterTank...
Saving scene scene01...
Scene saved!
There was a problem hiding this comment.
Looking at save and overrideSave there wasn't any difference in implementation. I will remove overrideSave since save will already override the scene if it already exists. Added a comment to clarify this to save() in scene_factory.ts.
The method loadOrCreateSceneIfNotExists will load an existing scene into memory if it already exists. I don't think it makes sense to have a method to save a scene only if it doesn't exist.
…ant overrideSave() method from the scene_factory class. Added minor bug fixes and cleaned up client classes.
…irectly to an S3 bucket. Updated README with more instructions for getting started with Cesium.
| // IN_PROGRESS | ||
| logProgress(`Asset is ${assetMetadata.percentComplete}% complete.`); | ||
| } | ||
| console.error(`Unrecognized response when requesting the tiling status of asset ${assetId}`); |
There was a problem hiding this comment.
should this output the unrecognized status as well?
| // Log progress of Cesium asset export to S3 | ||
| private async waitForExport(accessToken: string, assetId: string, exportId: string) { | ||
| const timeout = 10000; // 10 seconds | ||
| let maxChecks = 30; // Will wait for 5 minutes |
There was a problem hiding this comment.
just curious: is there an SLA for Cesium? is this something customers may need to be able to adjust depending on asset size?
There was a problem hiding this comment.
I don't know the Cesium SLA, but good idea to make wait times adjustable. Will add the parameters and set it in the sample.
| prefix: outputPath, | ||
| accessKeyId: process.env.AWS_ACCESS_KEY_ID, | ||
| secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, | ||
| sessionToken: process.env.AWS_SESSION_TOKEN, |
There was a problem hiding this comment.
Will this work for the case where someone is using long-lived credentials? (without SessionToken)
There was a problem hiding this comment.
No, the API only supports temporary credentials
src/libs/scene_utils/README.md
Outdated
|
|
||
| e. Click “Create” | ||
|
|
||
| f. Copy and use this asset token for the `--cesiumAccessToken` parameter in the commands below |
There was a problem hiding this comment.
how "confidential" is the Cesium token? Is it ok for it to be exposed in the command line as an argument or should it be via environment variables like the AWS credentials?
There was a problem hiding this comment.
If someone has access to a Cesium token then they will be able to perform any action the token allows in the customer's Cesium account. If it's more secure as an env var then I can enforce the use of an env var for this token.
…the tiles folder is already uploaded to the workspace S3 bucket.
…Split Cesium script into 5 steps to jump into at any step of the conversion/scene upload process.
Added @iot-twinmaker/scene-utils lib to enable customers to automate scene creation. Sample command line scripts are provided to create the CookieFactory scene, integrate with the Cesium Ion tiling pipeline, and delete scenes.
Issue #, if available:
Description of changes:
Introducing an SDK with command line scripts to automatically manipulate IoT TwinMaker scenes. This library enables customers to manage 3D models that are uploaded to S3 and applied to the scene hierarchy as interactive nodes. A scene node can be a 3D mesh or a built-in augmentation like a tag or motion indicator. You can set the 3D transform of the node and apply a data binding with an entity, component, and property path of a time stream data connector. This SDK also supports adding scene rules to dynamically change an icon or mesh color when data is applied to the scene viewer on your IoT TwinMaker application. Finally, there is an integration with Cesium Ion's REST APIs to compress 3D assets into 3D tiles for consumption in an IoT TwinMaker scene.
Security
This lib uses the AWS JS SDK to connect to IoT TwinMaker and S3. It also has a Cesium client that uses Cesium's REST API to upload 3D models and export 3D tilesets to a customer's S3 bucket.
Customers will use temporary AWS credentials to authenticate into the AWS SDK. To use Cesium customer's must have a Cesium Ion account and an access token with the permissions for writing assets and exports. This access token is used to authenticate into the Cesium REST APIs.
Scripts
Summary of sample command line scripts:
Cookie Factory Sample
Use the 3D models in this repo's
scenesdirectory to build theCookieFactory.jsonscene with the SDK.This sample is meant as a starting point for users with local 3D models they want to add to a scene with all scene features (tags, motion indicator, data binding, rules, etc.).
Cesium Ion File Upload
Create an account with Cesium, get an access token, and use it to upload a local file to your Cesium account. Cesium will run its tiling pipeline to generate 3D tiles for your asset. After tiling is complete the tileset will be downloaded into memory and uploaded to your IoT TwinMaker workspace S3 bucket and added to a new scene.
Delete your scene
Example to clean up nodes in your scene or delete it from your workspace.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.