public void setSkeleton(Skeleton skeleton) { if(bone != null) boneIndex = skeleton.getBoneIndex(bone); }
/** * The method writes the indexes for the connection vertices. Used in non-length mode. * @param indexBuf * the index buffer * @param bone * the bone */ private void writeConnections(ShortBuffer indexBuf, Bone bone) { for (Bone child : bone.getChildren()) { // write myself indexBuf.put((short) skeleton.getBoneIndex(bone)); // write the child indexBuf.put((short) skeleton.getBoneIndex(child)); this.writeConnections(indexBuf, child); } } }
/** * Enumerate the bone indices of the specified bone and all its descendents. * * @param bone the input bone (not null) * @param skeleton the skeleton containing the bone (not null) * @param boneList a set of bone names (not null, unaffected) * * @return a new list (not null) */ public static List<Integer> getBoneIndices(Bone bone, Skeleton skeleton, Set<String> boneList) { List<Integer> list = new LinkedList<Integer>(); if (boneList.isEmpty()) { list.add(skeleton.getBoneIndex(bone)); } else { list.add(skeleton.getBoneIndex(bone)); for (Bone chilBone : bone.getChildren()) { if (!boneList.contains(chilBone.getName())) { list.addAll(getBoneIndices(chilBone, skeleton, boneList)); } } } return list; }
/** * Enumerate the bone indices of the specified bone and all its descendents. * * @param bone the input bone (not null) * @param skeleton the skeleton containing the bone (not null) * @param boneList a set of bone names (not null, unaffected) * * @return a new list (not null) */ public static List<Integer> getBoneIndices(Bone bone, Skeleton skeleton, Set<String> boneList) { List<Integer> list = new LinkedList<Integer>(); if (boneList.isEmpty()) { list.add(skeleton.getBoneIndex(bone)); } else { list.add(skeleton.getBoneIndex(bone)); for (Bone chilBone : bone.getChildren()) { if (!boneList.contains(chilBone.getName())) { list.addAll(getBoneIndices(chilBone, skeleton, boneList)); } } } return list; }
/** * Add a single bone to be influenced by this animation channel. */ public void addBone(Bone bone) { int boneIndex = control.getSkeleton().getBoneIndex(bone); if(affectedBones == null) { affectedBones = new BitSet(control.getSkeleton().getBoneCount()); } affectedBones.set(boneIndex); }
/** * Converts the action into JME bone animation tracks. * * @param skeleton * the skeleton that will be animated * @return the bone tracks for the node */ public BoneTrack[] toTracks(Skeleton skeleton, BlenderContext blenderContext) { List<BoneTrack> tracks = new ArrayList<BoneTrack>(featuresTracks.size()); for (Entry<String, Ipo> entry : featuresTracks.entrySet()) { int boneIndex = skeleton.getBoneIndex(entry.getKey()); BoneContext boneContext = blenderContext.getBoneContext(skeleton.getBone(boneIndex)); tracks.add((BoneTrack) entry.getValue().calculateTrack(boneIndex, boneContext, boneContext.getBone().getBindPosition(), boneContext.getBone().getBindRotation(), boneContext.getBone().getBindScale(), 1, stopFrame, fps, false)); } return tracks.toArray(new BoneTrack[tracks.size()]); }
Bone bone = limb.getJmeBone(); Skeleton skeleton = limb.getSkeletonHolder().getJmeSkeleton(); int boneIndex = skeleton.getBoneIndex(bone);
/** * 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 boneName the name of the bone * @return the attachments node of the bone */ public Node getAttachmentsNode(String boneName) { Bone b = skeleton.getBone(boneName); if (b == null) { throw new IllegalArgumentException("Given bone name does not exist " + "in the skeleton."); } updateTargetsAndMaterials(spatial); int boneIndex = skeleton.getBoneIndex(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; }
for (Bone rootBone : skeleton.getRoots()) { if (skeleton.getBoneIndex(rootBone) > 0) { this.applyConstraints(rootBone, alteredOmas, applied, frame, new Stack<Bone>()); int boneIndex = skeleton.getBoneIndex(boneContext.getBone()); if (!tracks.containsKey(boneIndex)) { tracks.put(boneIndex, new VirtualTrack(boneContext.getBone().getName(), maxFrame, maxTime));
int index = skeleton.getBoneIndex(bone); Joint joint = joints[index]; if (joint == null) {
int boneIndex = skeleton.getBoneIndex(bone);
public void setSkeleton(Skeleton skeleton) { if(bone != null) boneIndex = skeleton.getBoneIndex(bone); }
private void writeConnections(ShortBuffer indexBuf, Bone bone){ for (Bone child : bone.getChildren()){ // write myself indexBuf.put( (short) skeleton.getBoneIndex(bone) ); // write the child indexBuf.put( (short) skeleton.getBoneIndex(child) ); writeConnections(indexBuf, child); } }
/** * The method writes the indexes for the connection vertices. Used in non-length mode. * @param indexBuf * the index buffer * @param bone * the bone */ private void writeConnections(ShortBuffer indexBuf, Bone bone) { for (Bone child : bone.getChildren()) { // write myself indexBuf.put((short) skeleton.getBoneIndex(bone)); // write the child indexBuf.put((short) skeleton.getBoneIndex(child)); this.writeConnections(indexBuf, child); } } }
public static List<Integer> getBoneIndices(Bone bone, Skeleton skeleton, Set<String> boneList) { List<Integer> list = new LinkedList<Integer>(); if (boneList.isEmpty()) { list.add(skeleton.getBoneIndex(bone)); } else { list.add(skeleton.getBoneIndex(bone)); for (Bone chilBone : bone.getChildren()) { if (!boneList.contains(chilBone.getName())) { list.addAll(getBoneIndices(chilBone, skeleton, boneList)); } } } return list; }
public static List<Integer> getBoneIndices(Bone bone, Skeleton skeleton, Set<String> boneList) { List<Integer> list = new LinkedList<Integer>(); if (boneList.isEmpty()) { list.add(skeleton.getBoneIndex(bone)); } else { list.add(skeleton.getBoneIndex(bone)); for (Bone chilBone : bone.getChildren()) { if (!boneList.contains(chilBone.getName())) { list.addAll(getBoneIndices(chilBone, skeleton, boneList)); } } } return list; }
/** * Add a single bone to be influenced by this animation channel. */ public void addBone(Bone bone) { int boneIndex = control.getSkeleton().getBoneIndex(bone); if(affectedBones == null) { affectedBones = new BitSet(control.getSkeleton().getBoneCount()); } affectedBones.set(boneIndex); }
/** * Add a single bone to be influenced by this animation channel. */ public void addBone(Bone bone) { int boneIndex = control.getSkeleton().getBoneIndex(bone); if(affectedBones == null) { affectedBones = new BitSet(control.getSkeleton().getBoneCount()); } affectedBones.set(boneIndex); }
private void computeLength(Bone b, Map<Integer, Float> boneLengths, Skeleton skeleton) { if (b.getChildren().isEmpty()) { if (b.getParent() != null) { boneLengths.put(skeleton.getBoneIndex(b), boneLengths.get(skeleton.getBoneIndex(b.getParent())) * 0.75f); } else { boneLengths.put(skeleton.getBoneIndex(b), 0.1f); } } else { float length = Float.MAX_VALUE; for (Bone bone : b.getChildren()) { float len = b.getModelSpacePosition().subtract(bone.getModelSpacePosition()).length(); if (len < length) { length = len; } } boneLengths.put(skeleton.getBoneIndex(b), length); for (Bone bone : b.getChildren()) { computeLength(bone, boneLengths, skeleton); } } }
Bone bone = limb.getJmeBone(); Skeleton skeleton = limb.getSkeletonHolder().getJmeSkeleton(); int boneIndex = skeleton.getBoneIndex(bone);