private Joint findJoint(Armature armature, String jointName) { Joint joint = armature.getJoint(jointName); if (joint == null) { throw new IllegalArgumentException("Cannot find joint " + jointName); } return joint; }
/** * Access the attachments node of the named bone. If the bone doesn't * already have an attachments node, create one and attach it to the scene * graph. Models and effects attached to the attachments node will follow * the bone's motions. * * @param jointName the name of the joint * @return the attachments node of the joint */ public Node getAttachmentsNode(String jointName) { Joint b = armature.getJoint(jointName); if (b == null) { throw new IllegalArgumentException("Given bone name does not exist " + "in the armature."); } updateTargetsAndMaterials(spatial); int boneIndex = armature.getJointIndex(b); Node n = b.getAttachmentsNode(boneIndex, targets); /* * Select a node to parent the attachments node. */ Node parent; if (spatial instanceof Node) { parent = (Node) spatial; // the usual case } else { parent = spatial.getParent(); } parent.attachChild(n); return n; }
public static ArmatureMask createMask(Armature armature, String... joints) { ArmatureMask mask = new ArmatureMask(); mask.addBones(armature, joints); for (String joint : joints) { mask.affectedJoints.set(armature.getJoint(joint).getId()); } return mask; }