Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Make skeleton joint colors a bit larger and make semi-transparent

Scott Petrovicb1c101810079
diff --git a/src/Mesh2MotionEngine.ts b/src/Mesh2MotionEngine.ts
index 6ad9adf..1d8924f 100644
--- a/src/Mesh2MotionEngine.ts
+++ b/src/Mesh2MotionEngine.ts
@@ -237,7 +237,7 @@ export class Mesh2MotionEngine {
}
if (this.use_custom_skeleton_helper) {
- this.skeleton_helper = new CustomSkeletonHelper(new_skeleton.bones[0], { linewidth: 4, color: 0x4e7d58 })
+ this.skeleton_helper = new CustomSkeletonHelper(new_skeleton.bones[0], { linewidth: 4, color: 0x4e7d58 }) // line segment color
} else {
this.skeleton_helper = new THREE.SkeletonHelper(new_skeleton.bones[0])
}
diff --git a/src/lib/CustomSkeletonHelper.ts b/src/lib/CustomSkeletonHelper.ts
index 9a3eb05..f025902 100644
--- a/src/lib/CustomSkeletonHelper.ts
+++ b/src/lib/CustomSkeletonHelper.ts
@@ -20,6 +20,7 @@ class CustomSkeletonHelper extends LineSegments {
const vertices = []
const colors = []
const color = new Color(options.color || 0x0000ff) // Default color blue
+ const joint_color = new Color(options.jointColor || 0x0000ff) // Default joint color blue
for (let i = 0; i < bones.length; i++) {
const bone = bones[i]
@@ -31,7 +32,7 @@ class CustomSkeletonHelper extends LineSegments {
colors.push(color.r, color.g, color.b)
}
}
-
+
geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3))
geometry.setAttribute('color', new Float32BufferAttribute(colors, 3))
@@ -56,12 +57,13 @@ class CustomSkeletonHelper extends LineSegments {
// Add points for joints
const pointsGeometry = new BufferGeometry()
const pointsMaterial = new PointsMaterial({
- size: 14, // Size of the joint circles on skeleton
- color: options.jointColor || 0xffffff,
+ size: 25, // Size of the joint circles on skeleton
+ color: joint_color,
depthTest: false,
sizeAttenuation: false, // Disable size attenuation to keep size constant in screen space
map: this.jointTexture,
- transparent: true // Enable transparency for the circular texture
+ transparent: true, // Enable transparency for the circular texture
+ opacity: 0.3
})
const pointPositions = new Float32BufferAttribute(bones.length * 3, 3)
diff --git a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts b/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
index 5422e52..a692030 100644
--- a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
+++ b/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
@@ -501,10 +501,11 @@ export class StepEditSkeleton extends EventTarget {
const material = new PointsMaterial({
color: 0x69a1d0, // Blue color
- size: 20, // Size of the point in pixels
+ size: 30, // Size of the point in pixels
sizeAttenuation: false, // Disable size attenuation
depthTest: false, // always render on top
map: this.joint_texture, // Use a circular texture
+ opacity: 0.7,
transparent: true // Enable transparency for the circular texture
})
diff --git a/static/images/skeleton-joint-point.png b/static/images/skeleton-joint-point.png
index 29f41b1..7c00620 100644
Binary files a/static/images/skeleton-joint-point.png and b/static/images/skeleton-joint-point.png differ