public unsafe static void importCN6(string sourceFilename, string outputFilename, GrannyContext grannyContext, int vertexFormat) { string templateFilename = getTemplateFilename(vertexFormat); IGrannyFile file = CivNexusSixApplicationForm.form.OpenFileAsTempFileCopy(templateFilename, "tempimport"); GrannyFileWrapper fileWrapper = new GrannyFileWrapper(file); fileWrapper.setNumMeshes(0); fileWrapper.setNumVertexDatas(0); fileWrapper.setNumSkeletons(0); fileWrapper.setNumTriTopologies(0); List <GrannyModelInfo> modelInfos = loadModelInfos(sourceFilename, vertexFormat); fileWrapper.setNumMeshes(0); fileWrapper.setNumModels(0); foreach (GrannyModelInfo modelInfo in modelInfos) { doBoneBindings(modelInfo); List <IGrannyFile> meshFileList = new List <IGrannyFile>(); foreach (GrannyMeshInfo meshInfo in modelInfo.meshBindings) { meshFileList.Add(writeMesh(meshInfo, templateFilename)); } IGrannyFile modelFile = CivNexusSixApplicationForm.form.OpenFileAsTempFileCopy(templateFilename, "tempimport"); IGrannyModel model = modelFile.Models[0]; GrannyModelWrapper modelWrapper = new GrannyModelWrapper(model); modelWrapper.setNumMeshBindings(0); model.MeshBindings.Clear(); GrannySkeletonWrapper skeletonWrapper = new GrannySkeletonWrapper(modelFile.Models[0].Skeleton); skeletonWrapper.writeSkeletonInfo(modelInfo.skeleton); string worldBoneName = modelInfo.skeleton.bones[0].name; string modelName = worldBoneName; foreach (GrannyBoneInfo bone in modelInfo.skeleton.bones) { if (!bone.name.Contains("ADJUSTMENT_BONE")) { modelName = bone.name; break; } } modelWrapper.setName(modelName); skeletonWrapper.setName(modelName); foreach (IGrannyFile meshFile in meshFileList) { doAppendMeshBinding(modelFile, meshFile, 0); } foreach (IGrannyMesh mesh in model.MeshBindings) { file.AddMeshReference(mesh); } file.AddModelReference(model); CivNexusSixApplicationForm.form.RefreshAppData(); } fileWrapper.setNumModels(modelInfos.Count()); fileWrapper.setFromArtToolInfo("Blender", 2, 0); float[] matrix = { 1f, 0f, 0f, 0f, 0f, 1f, 0f, -1f, 0f }; fileWrapper.setMatrix(matrix); CivNexusSixApplicationForm.SetExporterInfo(fileWrapper); fileWrapper.setFromFileName(sourceFilename); createAndBindMaterials(outputFilename, file, modelInfos); }