Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Make weight painting less intense. Make joint image have border to make easier to see. Make sure weight painted mesh goes behind the skeleton

Scott Petrovicee7c56c22003
diff --git a/src/lib/Generators.ts b/src/lib/Generators.ts
index 88a92af..b337f6c 100644
--- a/src/lib/Generators.ts
+++ b/src/lib/Generators.ts
@@ -236,10 +236,10 @@ export class Generators {
static create_wireframe_mesh_from_geometry (orig_geometry: BufferGeometry): Mesh {
const wireframe_material = new MeshBasicMaterial({
- color: 0xabd9ef, // light blue color
+ color: 0x337baa, // light blue color
wireframe: true,
- opacity: 1.0,
- transparent: false
+ opacity: 0.2,
+ transparent: true
})
const cloned_geometry = orig_geometry.clone()
@@ -282,6 +282,9 @@ export class Generators {
let g = 0.5
let b = 0.8
+ // Darkening factor (0 < factor < 1)
+ const darken = 0.8
+
// Generate a list of colors based on the count
const colors: Vector3[] = []
const step = [-0.1, 0.1, 0.3]
@@ -290,11 +293,10 @@ export class Generators {
r = (r + step[0] + 1) % 1
g = (g + step[1] + 1) % 1
b = (b + step[2] + 1) % 1
- colors.push(new Vector3(r, g, b))
+
+ // Apply darkening factor
+ colors.push(new Vector3(r * darken, g * darken, b * darken))
}
return colors
}
-
-
-
}
diff --git a/src/lib/processes/StepWeightSkin.ts b/src/lib/processes/StepWeightSkin.ts
index 55db7f0..a71d833 100644
--- a/src/lib/processes/StepWeightSkin.ts
+++ b/src/lib/processes/StepWeightSkin.ts
@@ -37,6 +37,9 @@ export class StepWeightSkin extends EventTarget {
constructor () {
super()
this.weight_painted_mesh_preview.name = 'Weight Painted Mesh Preview'
+
+ // helps skeleton mesh render on top of this
+ this.weight_painted_mesh_preview.renderOrder = -1
}
public begin (): void {
diff --git a/src/script.ts b/src/script.ts
index 335df74..ae26440 100644
--- a/src/script.ts
+++ b/src/script.ts
@@ -255,16 +255,11 @@ export class Bootstrap {
// we will change which skeleton we do an intersection test with
// depending on what step we are on. We are either moving the setup skeleton
// or moving the bind pose skeleton
- let skeleton_to_test: Skeleton | undefined
+ const skeleton_to_test: Skeleton | undefined = this.edit_skeleton_step.skeleton()
- if (this.process_step === ProcessStep.EditSkeleton) {
- skeleton_to_test = this.edit_skeleton_step.skeleton()
- } else {
- skeleton_to_test = this.weight_skin_step.skeleton()
- }
-
- // ig no skeleton to test, abort
+ // if no skeleton to test, abort
if (skeleton_to_test === undefined) {
+ console.warn('No skeleton to test for intersection, aborting transform controls mouse down')
return
}
@@ -279,7 +274,7 @@ export class Bootstrap {
if (closest_bone !== null) {
this.transform_controls.attach(closest_bone)
this.edit_skeleton_step.set_currently_selected_bone(closest_bone)
- this.weight_skin_step.set_bone_index_to_test(closest_bone_index)
+ // this.weight_skin_step.set_bone_index_to_test(closest_bone_index)
} else {
this.edit_skeleton_step.set_currently_selected_bone(null)
}
diff --git a/static/images/skeleton-joint-point.png b/static/images/skeleton-joint-point.png
index 88e1233..29f41b1 100644
Binary files a/static/images/skeleton-joint-point.png and b/static/images/skeleton-joint-point.png differ