Import a 3D Model and automatically assign and export animations
TypeScript
If we have weight paint display and move a bone, automatically update weight display results
Scott Petrovicde4f88c050d0
diff --git a/src/lib/EventListeners.ts b/src/lib/EventListeners.tsindex d2460b1..2791592 100644--- a/src/lib/EventListeners.ts+++ b/src/lib/EventListeners.ts@@ -30,9 +30,18 @@ export class EventListeners {}}, false)+ // custom event listeners for the transform controls.+ // we can know about the "mouseup" event with thisthis.bootstrap.transform_controls?.addEventListener('dragging-changed', (event: any) => {this.bootstrap.is_transform_controls_dragging = event.valuethis.bootstrap.controls.enabled = !event.value++ // if we stopped dragging, that means a mouse up.+ // if we are editing skeleton and viewing weight painted mesh, refresh the weight painting+ if (this.bootstrap.process_step === ProcessStep.EditSkeleton &&+ this.bootstrap.mesh_preview_display_type === ModelPreviewDisplay.WeightPainted) {+ this.bootstrap.regenerate_weight_painted_preview_mesh()+ }})this.bootstrap.load_model_step.addEventListener('modelLoaded', () => {diff --git a/src/lib/Generators.ts b/src/lib/Generators.tsindex b337f6c..0314ef9 100644--- a/src/lib/Generators.ts+++ b/src/lib/Generators.ts@@ -283,7 +283,7 @@ export class Generators {let b = 0.8// Darkening factor (0 < factor < 1)- const darken = 0.8+ const darken = 0.6 // lower value is darker// Generate a list of colors based on the countconst colors: Vector3[] = []diff --git a/src/script.ts b/src/script.tsindex ae26440..b75dd13 100644--- a/src/script.ts+++ b/src/script.ts@@ -287,7 +287,7 @@ export class Bootstrap {})}- private regenerate_weight_painted_preview_mesh (): void {+ public regenerate_weight_painted_preview_mesh (): void {// needed for skinning processthis.calculate_skin_weighting_for_models()@@ -295,9 +295,6 @@ export class Bootstrap {if (this.scene.getObjectByName('Weight Painted Mesh') === undefined) {this.scene.add(this.weight_skin_step.weight_painted_mesh_group())}-- // check to see how many weight painted meshes we hae- console.log('Weight Painted Meshes in scene:', this.scene.children)}private calculate_skin_weighting_for_models (): void {