private static void createBones(FbxNode skeletonHolderNode, FbxLimbNode limb, List<Bone> bones) { limb.skeletonHolder = skeletonHolderNode; Bone parentBone = limb.getJmeBone(); bones.add(parentBone); for (FbxNode child : limb.children) { if (child instanceof FbxLimbNode) { FbxLimbNode childLimb = (FbxLimbNode) child; createBones(skeletonHolderNode, childLimb, bones); parentBone.addChild(childLimb.getJmeBone()); } } }
private Bone recreateBoneStructure(Bone sourceRoot) { Bone targetRoot = getBone(sourceRoot.getName()); List<Bone> children = sourceRoot.getChildren(); for (int i = 0; i < children.size(); i++) { Bone sourceChild = children.get(i); // find my version of the child Bone targetChild = getBone(sourceChild.getName()); targetRoot.addChild(targetChild); recreateBoneStructure(sourceChild); } return targetRoot; }
@Override @SuppressWarnings("unchecked") public void read(JmeImporter im) throws IOException { InputCapsule input = im.getCapsule(this); name = input.readString("name", null); int ver = input.getSavableVersion(Bone.class); if(ver < 2){ bindPos = (Vector3f) input.readSavable("initialPos", null); bindRot = (Quaternion) input.readSavable("initialRot", null); bindScale = (Vector3f) input.readSavable("initialScale", new Vector3f(1.0f, 1.0f, 1.0f)); }else{ bindPos = (Vector3f) input.readSavable("bindPos", null); bindRot = (Quaternion) input.readSavable("bindRot", null); bindScale = (Vector3f) input.readSavable("bindScale", new Vector3f(1.0f, 1.0f, 1.0f)); } attachNode = (Node) input.readSavable("attachNode", null); targetGeometry = (Geometry) input.readSavable("targetGeometry", null); localPos.set(bindPos); localRot.set(bindRot); localScale.set(bindScale); ArrayList<Bone> childList = input.readSavableArrayList("children", null); for (int i = childList.size() - 1; i >= 0; i--) { this.addChild(childList.get(i)); } // NOTE: Parent skeleton will call update() then setBindingPose() // after Skeleton has been de-serialized. // Therefore, worldBindInversePos and worldBindInverseRot // will be reconstructed based on that information. }
if(n.bone == null) n.bone = new Bone(n.name); bone.addChild(n.bone);
bone.addChild(child.buildBone(bones, skeletonOwnerOma, blenderContext));
private static void createBones(FbxNode skeletonHolderNode, FbxLimbNode limb, List<Bone> bones) { limb.skeletonHolder = skeletonHolderNode; Bone parentBone = limb.getJmeBone(); bones.add(parentBone); for (FbxNode child : limb.children) { if (child instanceof FbxLimbNode) { FbxLimbNode childLimb = (FbxLimbNode) child; createBones(skeletonHolderNode, childLimb, bones); parentBone.addChild(childLimb.getJmeBone()); } } }
Bone bone = nameToBone.get(boneName); Bone parent = nameToBone.get(parentName); parent.addChild(bone); } else if (qName.equals("bone")) { assert elementStack.peek().equals("bones");
Bone bone = nameToBone.get(boneName); Bone parent = nameToBone.get(parentName); parent.addChild(bone); } else if (qName.equals("bone")) { assert elementStack.peek().equals("bones");
Bone bone = nameToBone.get(boneName); Bone parent = nameToBone.get(parentName); parent.addChild(bone); } else if (qName.equals("bone")) { assert elementStack.peek().equals("bones");
private Bone recreateBoneStructure(Bone sourceRoot) { Bone targetRoot = getBone(sourceRoot.getName()); List<Bone> children = sourceRoot.getChildren(); for (int i = 0; i < children.size(); i++) { Bone sourceChild = children.get(i); // find my version of the child Bone targetChild = getBone(sourceChild.getName()); targetRoot.addChild(targetChild); recreateBoneStructure(sourceChild); } return targetRoot; }
private Bone recreateBoneStructure(Bone sourceRoot) { Bone targetRoot = getBone(sourceRoot.getName()); List<Bone> children = sourceRoot.getChildren(); for (int i = 0; i < children.size(); i++) { Bone sourceChild = children.get(i); // find my version of the child Bone targetChild = getBone(sourceChild.getName()); targetRoot.addChild(targetChild); recreateBoneStructure(sourceChild); } return targetRoot; }
private void findChildren(int nodeIndex) throws IOException { BoneWrapper bw = fetchFromCache("nodes", nodeIndex, BoneWrapper.class); JsonObject nodeData = nodes.get(nodeIndex).getAsJsonObject(); JsonArray children = nodeData.getAsJsonArray("children"); if (children != null) { for (JsonElement child : children) { int childIndex = child.getAsInt(); if (bw.children.contains(childIndex)) { //bone already has the child in its children continue; } BoneWrapper cbw = fetchFromCache("nodes", childIndex, BoneWrapper.class); if (cbw != null) { bw.bone.addChild(cbw.bone); bw.children.add(childIndex); } else { //The child might be a Node //Creating a dummy node to read the subgraph Node n = new Node(); readChild(n, child); Spatial s = n.getChild(0); //removing the spatial from the dummy node, it will be attached to the attachment node of the bone s.removeFromParent(); bw.attachedSpatial = s; } } } }
/** * sid of bone nodes is the name of the jme bones. * @param boneNodes * @param jmeBones */ private void mapBoneTree(DAENode[] boneNodes, Bone[] jmeBones) { for (int i = 0; i < boneNodes.length; i++) { DAENode daeNode = boneNodes[i]; Bone bone = jmeBones[i]; for (DAENode c : daeNode.getChildren()) { if (c.hasParsedData(Bone.class)) { bone.addChild(c.getParsedData(Bone.class)); } } } }
Bone bone = bones.get(limbId); Bone root = bones.get(rootLimbId); root.addChild(bone);
@Override @SuppressWarnings("unchecked") public void read(JmeImporter im) throws IOException { InputCapsule input = im.getCapsule(this); name = input.readString("name", null); initialPos = (Vector3f) input.readSavable("initialPos", null); initialRot = (Quaternion) input.readSavable("initialRot", null); initialScale = (Vector3f) input.readSavable("initialScale", new Vector3f(1.0f, 1.0f, 1.0f)); attachNode = (Node) input.readSavable("attachNode", null); localPos.set(initialPos); localRot.set(initialRot); ArrayList<Bone> childList = input.readSavableArrayList("children", null); for (int i = childList.size() - 1; i >= 0; i--) { this.addChild(childList.get(i)); } // NOTE: Parent skeleton will call update() then setBindingPose() // after Skeleton has been de-serialized. // Therefore, worldBindInversePos and worldBindInverseRot // will be reconstructed based on that information. }
@Override @SuppressWarnings("unchecked") public void read(JmeImporter im) throws IOException { InputCapsule input = im.getCapsule(this); name = input.readString("name", null); int ver = input.getSavableVersion(Bone.class); if(ver < 2){ bindPos = (Vector3f) input.readSavable("initialPos", null); bindRot = (Quaternion) input.readSavable("initialRot", null); bindScale = (Vector3f) input.readSavable("initialScale", new Vector3f(1.0f, 1.0f, 1.0f)); }else{ bindPos = (Vector3f) input.readSavable("bindPos", null); bindRot = (Quaternion) input.readSavable("bindRot", null); bindScale = (Vector3f) input.readSavable("bindScale", new Vector3f(1.0f, 1.0f, 1.0f)); } attachNode = (Node) input.readSavable("attachNode", null); targetGeometry = (Geometry) input.readSavable("targetGeometry", null); localPos.set(bindPos); localRot.set(bindRot); localScale.set(bindScale); ArrayList<Bone> childList = input.readSavableArrayList("children", null); for (int i = childList.size() - 1; i >= 0; i--) { this.addChild(childList.get(i)); } // NOTE: Parent skeleton will call update() then setBindingPose() // after Skeleton has been de-serialized. // Therefore, worldBindInversePos and worldBindInverseRot // will be reconstructed based on that information. }
if(n.bone == null) n.bone = new Bone(n.name); bone.addChild(n.bone);
Bone parent = boneArray[pmdBone.getParentBoneIndex()]; PMDBone parentPMDBone = model.getBoneList().getBones()[pmdBone.getParentBoneIndex()]; parent.addChild(bone);
if (parent != null) parent.addChild(bone);