Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

file has to be in src folder for Vite to do the process string substitution

Scott Petrovicd3af42516228
diff --git a/src/Mesh2MotionEngine.ts b/src/Mesh2MotionEngine.ts
index 406b662..6c1f04d 100644
--- a/src/Mesh2MotionEngine.ts
+++ b/src/Mesh2MotionEngine.ts
@@ -4,6 +4,7 @@ import { TransformControls } from 'three/examples/jsm/controls/TransformControls
import { CustomViewHelper } from './lib/CustomViewHelper.ts'
import tippy from 'tippy.js'
+import './environment.js'
import 'tippy.js/dist/tippy.css' // optional for styling
import { Utility } from './lib/Utilities.ts'
diff --git a/src/create.html b/src/create.html
index cc71dc1..50e1593 100644
--- a/src/create.html
+++ b/src/create.html
@@ -392,7 +392,6 @@
<div id="view-control-hitbox"></div>
<!-- build version information-->
- <script src="./environment.js"></script>
<span id="build-version"></span>
</body>
diff --git a/src/environment.js b/src/environment.js
new file mode 100644
index 0000000..3b41c31
--- /dev/null
+++ b/src/environment.js
@@ -0,0 +1,4 @@
+// grab a couple environment variables from Clourflare build process
+// Vite actually does the injection, so look at vite.config.js with the "define" block
+window.CLOUDFLARE_COMMIT_SHA = PROCESS_ENV.WORKERS_CI_COMMIT_SHA || 'unknown'
+window.CLOUDFLARE_BRANCH = PROCESS_ENV.WORKERS_CI_BRANCH || 'unknown'
diff --git a/src/index.html b/src/index.html
index cf484fb..8d084ff 100644
--- a/src/index.html
+++ b/src/index.html
@@ -187,7 +187,6 @@
<div id="view-control-hitbox"></div>
<!-- build version information-->
- <script src="./environment.js"></script>
<span id="build-version"></span>
</body>
diff --git a/static/environment.js b/static/environment.js
deleted file mode 100644
index cbcb594..0000000
--- a/static/environment.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// typeof check is safer to check if undefined
-// during local development this variable won't exist
-if (typeof PROCESS_ENV === 'undefined') {
- window.CLOUDFLARE_COMMIT_SHA = window.location.hostname
- window.CLOUDFLARE_BRANCH = 'dev'
-}
-else {
- // grab a couple environment variables from Clourflare build process
- // Vite actually does the injection, so look at vite.config.js with the "define" block
- window.CLOUDFLARE_COMMIT_SHA = PROCESS_ENV.WORKERS_CI_COMMIT_SHA
- window.CLOUDFLARE_BRANCH = PROCESS_ENV.WORKERS_CI_BRANCH || 'unknown'
-}