AoMEngineLibrary.AMP.GrnMax.Import C# (CSharp) Method

Import() public method

public Import ( ) : void
return void
        public void Import()
        {
            Maxscript.Command("importStartTime = timeStamp()");
            string mainObject = "mainObject";
            string boneArray = "boneArray";

            if (this.File.Meshes.Count > 0 || Maxscript.QueryBoolean("boneArray == undefined or not(isvalidnode boneArray[1])"))
            {
                this.boneMap = new Dictionary<string, int>();
            }

            if (this.File.Materials.Count > 0)
            {
                Maxscript.Command("matGroup = multimaterial numsubs:{0}", this.File.Materials.Count);
            }

            //this.Plugin.ProgDialog.SetProgressText("Importing skeleton...");
            this.ImportSkeleton(boneArray);
            //this.Plugin.ProgDialog.SetProgressValue(35);

            //this.Plugin.ProgDialog.SetProgressText("Importing meshes...");
            for (int i = 0; i < this.File.Meshes.Count; i++)
            {
                this.ImportMesh(this.File.Meshes[i], mainObject, boneArray);
                Maxscript.Command("{0}.material = matGroup", mainObject);
            }
            //this.Plugin.ProgDialog.SetProgressValue(70);

            //this.Plugin.ProgDialog.SetProgressText("Importing animation...");
            if (this.File.Animation.Duration > 0)
            {
                this.ImportAnimation(boneArray);
            }
            //this.Plugin.ProgDialog.SetProgressValue(85);

            //this.Plugin.ProgDialog.SetProgressText("Importing materials...");
            for (int i = 0; i < this.File.Materials.Count; i++)
            {
                Maxscript.Command("matGroup[{0}] = {1}", i + 1, ImportMaterial(this.File.Materials[i]));
            }
            //this.Plugin.ProgDialog.SetProgressValue(100);

            Maxscript.Command("max select none");
            Maxscript.Command("max zoomext sel all");
            Maxscript.Command("max zoomext sel all");
            Maxscript.Command("importEndTime = timeStamp()");
            Maxscript.Format("Import took % seconds\n", "((importEndTime - importStartTime) / 1000.0)");
            //if (this.Plugin.ProgDialog.InvokeRequired)
            //{
            //    this.Plugin.ProgDialog.BeginInvoke(new Action(() => this.Plugin.ProgDialog.Close()));
            //}
        }