Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Try to add build number logic to UI

Scott Petrovic21447bab0283
diff --git a/src/environment.js b/src/environment.js
new file mode 100644
index 0000000..bd43546
--- /dev/null
+++ b/src/environment.js
@@ -0,0 +1 @@
+export const build_version = '0.0.1'
diff --git a/src/index.html b/src/index.html
index ea729cf..350f12f 100644
--- a/src/index.html
+++ b/src/index.html
@@ -205,6 +205,7 @@
<!-- github project link-->
<a id="github-logo" href="https://github.com/scottpetrovic/ModelMotionizer/tree/main" target="_blank">
<span>View on</span><img src="images/GitHub_Logo_White.png" />
+ <span id="build-version">0.0.0</span>
</a>
diff --git a/src/lib/UI.ts b/src/lib/UI.ts
index fbf7caf..1290b22 100644
--- a/src/lib/UI.ts
+++ b/src/lib/UI.ts
@@ -33,6 +33,7 @@ export class UI {
dom_extend_arm_input: Element | null = null
dom_extend_arm_button: Element | null = null
dom_export_button_hidden_link: Element | null = null
+ dom_build_version: Element | null = null
constructor () {
this.initialize_dom_elements()
@@ -83,6 +84,8 @@ export class UI {
this.dom_extend_arm_input = document.querySelector('#extend-arm-input')
this.dom_extend_arm_button = document.querySelector('#extend-arm-button')
+ this.dom_build_version = document.querySelector('#build-version')
+
// UI for exporting the animation
this.dom_export_button_hidden_link = document.querySelector('#download-hidden-link')
}
diff --git a/src/script.ts b/src/script.ts
index e19b864..95d199e 100644
--- a/src/script.ts
+++ b/src/script.ts
@@ -17,7 +17,9 @@ import { StepWeightSkin } from './lib/processes/StepWeightSkin.ts'
import { ProcessStep } from './lib/enums/ProcessStep.ts'
import { type Bone, Group, Scene, type Skeleton, type Vector3, type SkeletonHelper, type Points } from 'three'
-import BoneTesterData from './lib/models/BoneTesterData.ts'
+import type BoneTesterData from './lib/models/BoneTesterData.ts'
+
+import { build_version } from './environment.js'
export class Bootstrap {
private readonly camera = Generators.create_camera()
@@ -52,6 +54,7 @@ export class Bootstrap {
this.process_step = this.process_step_changed(ProcessStep.LoadModel)
this.animate()
+ this.inject_build_version()
} // end initialize()
constructor () {
@@ -59,6 +62,14 @@ export class Bootstrap {
this.animate = this.animate.bind(this)
}
+ private inject_build_version (): void {
+ if (this.ui.dom_build_version !== null) {
+ this.ui.dom_build_version.innerHTML = build_version
+ } else {
+ console.warn('Build version DOM element is null. Cannot set number')
+ }
+ }
+
private setup_environment (): void {
this.renderer.setSize(window.innerWidth, window.innerHeight)
this.renderer.shadowMap.enabled = true