Skip to content

Commit 1d75486

Browse files
authored
Merge pull request #1 from CognitiveVR/develop
pushing v0.1.3 from develop to main
2 parents 7531f74 + b3fc92e commit 1d75486

25 files changed

+1419
-222
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.DS_Store
2+
*object*.json

README.md

Lines changed: 146 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
This repo contains a shell script (bash) for uploading scene files to the Cognitive3D platform.
44

5-
## Scene Upload Script
6-
7-
This script uploads a set of 3D scene files to the Cognitive3D API.
8-
9-
### Requirements
5+
## Requirements
106

11-
* Bash (macOS/Linux)
7+
* Bash (macOS / Linux / Windows Subsystem for Linux (WSL))
128
* `curl`
139
* `jq`
1410

15-
### Installation
11+
### Installation of required dependencies
1612

1713
Make sure the following tools are installed:
1814

@@ -22,59 +18,60 @@ sudo apt install jq curl # Ubuntu/Debian
2218
dnf install jq curl # Fedora/RHEL
2319
```
2420

25-
### Usage
21+
### Environment Variables
22+
23+
You must set your Cognitive3D Developer API key as an environment variable:
2624

2725
```bash
28-
./scene-upload.sh <scene_directory> [environment] [scene_id]
26+
export C3D_DEVELOPER_API_KEY="your_api_key"
2927
```
3028

31-
#### Parameters
32-
33-
* `<scene_directory>` (required): Path to a folder containing:
34-
35-
* `scene.bin`
36-
* `scene.gltf`
37-
* `screenshot.png`
38-
* `settings.json`
29+
You can get your developer API key from the Cognitive3D web dashboard. Look for the "Manage developer key" option in the settings (gear icon) menu.
3930

40-
* `[environment]` (optional): Either `prod` (default) or `dev`
31+
> Note: We strongly recommend you _do not_ store your developer API key in version control.
4132
42-
* `[scene_id]` (optional): Scene ID to append to the API endpoint to upload a new version of an existing scene
33+
## Scene Upload Script
4334

44-
#### Environment Variables
35+
This script uploads a set of 3D scene files to the Cognitive3D platform using our API.
4536

46-
You must set your Cognitive3D developer API key as an environment variable:
37+
### Usage
4738

4839
```bash
49-
export C3D_DEVELOPER_API_KEY="your_api_key"
40+
./upload-scene.sh --scene_dir <scene_directory> [--env <prod|dev>] [--scene_id <scene_id_from_dashboard>]
5041
```
5142

52-
You can get your developer API key from the Cognitive3D web dashboard. Look for the "Manage developer key" option in the settings (gear icon) menu.
43+
#### Parameters
5344

54-
> Note: We strongly recommend you _do not_ store your developer API key in version control.
45+
* `--scene_dir <scene_directory>` (required): Path to a folder containing:
46+
* `scene.bin`
47+
* `scene.gltf`
48+
* `screenshot.png`
49+
* `settings.json`
50+
* `[--env <prod/dev>]` (optional): Either `prod` (default) or `dev`
51+
* `[--scene_id <scene_id_from_dashboard>]` (optional): Scene ID to append to the API endpoint to upload a new version of an existing scene
5552

5653
### Example
5754

5855
For the first time you upload your scene you won't have a scene ID, so we don't pass that parameter. The first time you run this script, without a scene ID, it creates the scene and returns the new scene ID (output to the console at the end of the script.)
5956

6057
```bash
61-
export C3D_DEVELOPER_API_KEY="abc123xyz"
62-
./scene-upload.sh ./TestScene prod
58+
export C3D_DEVELOPER_API_KEY=<abc123xyz>
59+
./upload-scene.sh --scene_dir ./TestScene --env prod
6360
```
6461

6562
For subsequent (new) versions of the same scene, pass in your scene ID as the third parameter to the script. This will upload the scene assets again and the platform will auto-increment the scene version.
6663

6764
You can find the scene ID on the Cognitive3D dashboard on the Scenes page. Look for the "information" icon (letter 'i' in a circle) and hover over it.
6865

6966
```bash
70-
export C3D_DEVELOPER_API_KEY="abc123xyz"
71-
./scene-upload.sh ./TestScene prod my-scene-id
67+
export C3D_DEVELOPER_API_KEY=<abc123xyz>
68+
./upload-scene.sh --scene_dir ./TestScene --env prod --scene_id my_scene_id
7269
```
7370

7471
### Behavior
7572

7673
* Reads the SDK version from `sdk-version.txt` in the same directory as the script.
77-
* Replaces the `sdkVersion` field inside `settings.json` using `jq`.
74+
* Replaces the `sdkVersion` field inside `settings.json` file in the scene directory using `jq`.
7875
* Uploads the four files to the correct API endpoint.
7976
* Verifies API response and prints success or error.
8077

@@ -83,9 +80,127 @@ export C3D_DEVELOPER_API_KEY="abc123xyz"
8380
To see usage information:
8481

8582
```bash
86-
./scene-upload.sh --help
83+
./upload-scene.sh --help
8784
```
8885

8986
## Dynamic object uploader script
9087

91-
Coming soon.
88+
This Bash script uploads dynamic 3D object assets to the Cognitive3D platform, supporting GLTF + BIN files, optional textures, and thumbnail metadata. It supports both development and production environments.
89+
90+
Uploading a scene to the platform is required before you can upload any dynamic object models. The scene_id is a required parameter.
91+
92+
### Dynamic object uploader usage
93+
94+
```bash
95+
./upload-object.sh \
96+
--scene_id <scene-uuid> \
97+
--object_filename <object-name> \
98+
--object_dir <path-to-object-directory> \
99+
[--object_id <existing-object-id>] \
100+
[--env dev|prod] \
101+
[--verbose] \
102+
[--dry_run]
103+
```
104+
105+
#### Required Parameters
106+
107+
* `--scene_id`: The Scene ID UUID where the object will be uploaded.
108+
* `--object_filename`: The base filename (no extension) of the object, used to find `.gltf` and `.bin` files.
109+
* `--object_dir`: The directory containing the object files.
110+
111+
#### Optional Parameters
112+
113+
* `--object_id`: If specified, uploads as a new version of an existing object.
114+
* `--env`: Target environment (`prod` or `dev`). Defaults to `prod`.
115+
* `--verbose`: Enables detailed logging.
116+
* `--dry_run`: Prints the constructed `curl` command but skips execution.
117+
118+
### Dynamic object uploader environment variables
119+
120+
* `C3D_DEVELOPER_API_KEY`: Your Cognitive3D Developer API key (required).
121+
122+
### File Requirements
123+
124+
The following files must exist in the `--object_dir`:
125+
126+
* `<object_filename>.gltf`
127+
* `<object_filename>.bin`
128+
* (Optional, recommended) `cvr_object_thumbnail.png`, a representative screenshot of the object; used by the dashboard
129+
* (Optional) Any additional `.png` textures used by the model
130+
131+
### Dynamic object uploader example
132+
133+
```bash
134+
export C3D_DEVELOPER_API_KEY=<your-api-key>
135+
136+
./upload-object.sh \
137+
--scene_id <scene_id_goes_here> \
138+
--object_filename cube \
139+
--object_dir object-test \
140+
--env prod \
141+
--object_id cube
142+
--verbose
143+
```
144+
145+
### Exit Codes
146+
147+
* `0`: Success
148+
* `1`: Missing argument or setup error
149+
* Non-zero: Returned by `curl` if upload fails
150+
151+
### Logging
152+
153+
* `--verbose` prints detailed steps
154+
* `--dry_run` shows the `curl` command without executing it
155+
* Colored output highlights info, warnings, errors, and debug details
156+
157+
### Uploading the object manifest
158+
159+
After uploading the dynamic object asset files (mesh, textures) you must upload the dynamic object manifest file to display the objects on the Cognitive3D dashboard for your project and scene.
160+
161+
### Dynamic object manifest uploader usage
162+
163+
The dynamic object manifest for your scene and object is created automatically after successfully uploading the dynamic object assets. It will be in a file named `<scene_id>_object_manifest.json`.
164+
165+
```bash
166+
./upload-object-manifest.sh \
167+
--scene_id <scene-uuid> \
168+
[--env dev|prod] \
169+
[--verbose] \
170+
```
171+
172+
#### Dynamic object manifest uploader required parameters
173+
174+
* `--scene_id`: The Scene ID UUID where the object will be uploaded.
175+
176+
#### Object manifest uploader optional parameters
177+
178+
* `--object_id`: If specified, uploads as a new version of an existing object.
179+
* `--env`: Target environment (`prod` or `dev`). Defaults to `prod`.
180+
* `--verbose`: Enables detailed logging.
181+
* `--dry_run`: Prints the constructed `curl` command but skips execution.
182+
183+
### Dynamic object manifest uploader environment variables
184+
185+
* `C3D_DEVELOPER_API_KEY`: Your Cognitive3D Developer API key (required).
186+
187+
### Dynamic object manifest uploader file requirements
188+
189+
The following files must exist in the same directory where you are calling the script from:
190+
191+
* `<scene_id>_object_manifest.json`, which is automatically created after successfully uploading your dynamic object meshes
192+
193+
### Dynamic object manifest uploader example
194+
195+
```bash
196+
export C3D_DEVELOPER_API_KEY=<your-api-key>
197+
198+
./upload-object-manifest.sh \
199+
--scene_id <scene_id_goes_here> \
200+
--env prod \
201+
--verbose
202+
```
203+
204+
The reason we don't automatically upload the manifest after uploading the object assets is to allow you to modify the manifest JSON before uploading.
205+
206+
If you have any questions or problems using these scripts contact our customer support team using the Intercom button (public circle) on any Cognitive3D web page.

cspell.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// cSpell Settings
2+
{
3+
// Version of the setting file. Always 0.2
4+
"version": "0.2",
5+
// language - current active spelling language
6+
"language": "en-ca",
7+
// words - list of words to be always considered correct
8+
"words": [
9+
"APIKEY",
10+
"globoff",
11+
"gltf",
12+
"visualstudio"
13+
],
14+
// flagWords - list of words to be always considered incorrect
15+
// This is useful for offensive words and common spelling errors.
16+
// For example "hte" should be "the"
17+
"flagWords": [
18+
"hte"
19+
]
20+
}

lantern-test/Lantern.bin

226 KB
Binary file not shown.

0 commit comments

Comments
 (0)