Compare commits

...
Author SHA1 Message Date
Tanish Manku 4510368bd7 Fix imports in FK 2025-04-21 15:06:16 -07:00
Tanish Manku d773c4ddfe Add a blacklist filter for the FK bones 2025-04-21 15:03:46 -07:00
2 changed files with 37 additions and 1 deletions
@@ -0,0 +1,23 @@
export const FKBoneBlacklistStrings = [
"def",
"toe_end",
"thumb",
"index",
"handmiddle",
"handring",
"pinky",
"headtop",
"ear",
"teeth",
"eye",
"lid",
"jaw",
"tongue",
"lip",
"chin",
"brow",
"cheek",
"forehead",
"nose",
"temple"
];
@@ -1,5 +1,6 @@
import { TransformControls } from "three/examples/jsm/Addons";
import * as THREE from "three";
import { TransformControls } from "three/examples/jsm/Addons";
import { FKBoneBlacklistStrings } from "./FKBoneFilter";
export const FKHelperSphereName = "__FKHelperSphere__";
@@ -50,10 +51,21 @@ export class FKHelper {
// TODO: Highlight all the necessary bones
this.clear();
target.traverse((child) => {
// Skip if not bone
if (child.type !== "Bone") {
return;
}
// Skip if bones is one of the blacklisted ones
// This step could probably be optimized better
for (const blacklistedBone of FKBoneBlacklistStrings) {
if (child.name.toLowerCase().includes(blacklistedBone)) {
return;
}
}
console.log(child.name);
// For each target bone, display a sphere to show the FK target and raycast intersect
const geometry = new THREE.SphereGeometry(0.015, 16, 16);
const material = new THREE.MeshBasicMaterial({ color: 0xff0000, depthTest: false, transparent: true });
@@ -75,6 +87,7 @@ export class FKHelper {
this.skeletonHelper = new THREE.SkeletonHelper(target);
this.scene.add(this.skeletonHelper);
console.log("All bones:", this.skeletonHelper.bones.map((b) => b.name));
}
onMouseClick(mouse: THREE.Vector2) {