/** * Constructor. Creates the basic set of bone's data. * * @param boneStructure the bone's structure * @param parent bone's parent (null if the bone is the root bone) * @param objectToArmatureMatrix object-to-armature transformation matrix * @param bonesPoseChannels a map of pose channels for each bone OMA * @param blenderContext the blender context * @throws BlenderFileException an exception is thrown when problem with blender data reading * occurs */ private BoneContext( Structure boneStructure, BoneContext parent, Matrix4f objectToArmatureMatrix, final Map<Long, Structure> bonesPoseChannels, BlenderContext blenderContext) throws BlenderFileException { this.parent = parent; this.boneStructure = boneStructure; boneName = boneStructure.getFieldValue("name").toString(); ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class); armatureMatrix = objectHelper.getMatrix(boneStructure, "arm_mat", true); fixUpAxis = blenderContext.getBlenderKey().isFixUpAxis(); this.computeRestMatrix(objectToArmatureMatrix); List<Structure> childbase = ((Structure) boneStructure.getFieldValue("childbase")).evaluateListBase(blenderContext); for (Structure child : childbase) { this.children.add( new BoneContext(child, this, objectToArmatureMatrix, bonesPoseChannels, blenderContext)); } poseChannel = bonesPoseChannels.get(boneStructure.getOldMemoryAddress()); blenderContext.setBoneContext(boneStructure.getOldMemoryAddress(), this); }