public void Import() { BrgFile brg = this.File as BrgFile; Maxscript.Output.Clear(); Maxscript.Command("importStartTime = timeStamp()"); Maxscript.Command("frameRate = 30 --{0}", Math.Round(1 / this.File.Animation.TimeStep)); Maxscript.Interval(0, this.File.Animation.Duration); if (this.File.Meshes.Count > 0) { string mainObject = "mainObj"; for (int i = 0; i <= this.File.Meshes[0].MeshAnimations.Count; i++) { Maxscript.CommentTitle("ANIMATE FRAME " + i); if (i > 0) { ImportBrgMesh(mainObject, ((BrgMesh)brg.Meshes[0].MeshAnimations[i - 1]), brg.Animation.MeshKeys[i]); } else { ImportBrgMesh(mainObject, brg.Meshes[0], brg.Animation.MeshKeys[0]); } } Maxscript.Command("update {0}", mainObject); if (this.modelAtCenter) { Maxscript.Command("moveAmount = [0,0,0] - $Dummy_hotspot.position"); Maxscript.Command("max select all"); Maxscript.Command("move $ moveAmount"); } Maxscript.Command("max select none"); Maxscript.Command("max zoomext sel all"); Maxscript.Command("max zoomext sel all"); if (this.File.Materials.Count > 0) { Maxscript.CommentTitle("LOAD MATERIALS"); Maxscript.Command("matGroup = multimaterial numsubs:{0}", this.File.Materials.Count); for (int i = 0; i < this.File.Materials.Count; i++) { Maxscript.Command("matGroup[{0}] = {1}", i + 1, ImportBrgMaterial(brg.Materials[i])); Maxscript.Command("matGroup.materialIDList[{0}] = {1}", i + 1, this.File.Materials[i].Id); } Maxscript.Command("{0}.material = matGroup", mainObject); } } Maxscript.Command("importEndTime = timeStamp()"); Maxscript.Format("Import took % seconds\n", "((importEndTime - importStartTime) / 1000.0)"); }