public void Import(object sender, EventArgs args) { using (OpenFileDialog fd = new OpenFileDialog()) { fd.Filter = "Supported Formats|*.omo;*.anim;*.chr0;*.smd;*.mta;|" + "Object Motion|*.omo|" + "Maya Animation|*.anim|" + "NW4R Animation|*.chr0|" + "Source Animation (SMD)|*.smd|" + "Smash 4 Material Animation (MTA)|*.mta|" + "All files(*.*)|*.*"; if (fd.ShowDialog() == DialogResult.OK) { foreach (string filename in fd.FileNames) { if (filename.EndsWith(".mta")) { MTA mta = new MTA(); try { mta.Read(filename); Runtime.MaterialAnimations.Add(filename, mta); Nodes.Add(filename); } catch (Exception) { mta = null; } } else if (filename.EndsWith(".smd")) { var anim = new Animation(filename); if (Runtime.TargetVbn == null) { Runtime.TargetVbn = new VBN(); } Smd.Read(filename, anim, Runtime.TargetVbn); Nodes.Add(anim); } if (filename.EndsWith(".omo")) { Animation a = OMOOld.read(new FileData(filename)); a.Text = filename; Nodes.Add(a); } if (filename.EndsWith(".chr0")) { Nodes.Add(CHR0.read(new FileData(filename), Runtime.TargetVbn)); } if (filename.EndsWith(".anim")) { Nodes.Add(ANIM.read(filename, Runtime.TargetVbn)); } } } } }
private void loadViewportButton_Click(object sender, EventArgs e) { // Compile the MTA just in case and load into the active viewport. mta = new MTA(); mta.Compile(new List <string>(richTextBox1.Text.Split('\n'))); ModelViewport modelViewport = (ModelViewport)MainForm.Instance.GetActiveModelViewport(); if (modelViewport != null) { modelViewport.CurrentMaterialAnimation = mta; } }
public ModelContainer() { ImageKey = "folder"; SelectedImageKey = "folder"; nud = new Nud(); nut = new NUT(); mta = new MTA(); MOI = new MOI(); jtb = new JTB(); XMB = new XMBFile(); Checked = true; Refresh(); }
public void ImportAnimation(string filename) { if (filename.ToLower().EndsWith(".pac")) { PAC p = new PAC(); p.Read(filename); AnimationGroupNode animGroup = new AnimationGroupNode() { Text = filename }; string groupname = null; foreach (var pair in p.Files) { if (pair.Key.EndsWith(".omo")) { var anim = OMOOld.read(new FileData(pair.Value)); animGroup.Nodes.Add(anim); string animName = Regex.Match(pair.Key, @"([A-Z][0-9][0-9])(.*)").Groups[0].ToString(); if (!string.IsNullOrEmpty(animName)) { if (groupname == null) { groupname = pair.Key.Replace(animName, ""); } anim.Text = animName; } //Runtime.acmdEditor.updateCrcList(); } else if (pair.Key.EndsWith(".mta")) { MTA mta = new MTA(); mta.read(new FileData(pair.Value)); mta.Text = pair.Key; animGroup.Nodes.Add(mta); } } if (groupname != null && !groupname.Equals("")) { animGroup.useGroupName = true; animGroup.Text = groupname; } treeView1.Nodes.Add(animGroup); } }
public MtaEditor(MTA mta) { InitializeComponent(); this.mta = mta; }
public BFRES_FSHU(MTA mta, ShaderParamAnim fshu, ResFile b) { mta.Text = fshu.Name; mta.FrameCount = (uint)fshu.FrameCount; foreach (ShaderParamMatAnim matanim in fshu.ShaderParamMatAnims) { MatAnimEntry mat = new MatAnimEntry(); mat.Text = matanim.Name; Console.WriteLine($"MatAnim = {mat.Text}"); Console.WriteLine($"Curve Count = {matanim.Curves.Count}"); if (matanim.Curves.Count == 0) { } //First set the data then iterpolate foreach (AnimCurve cr in matanim.Curves) { mat.InterpolateWU(cr); } mta.matEntries.Add(mat); for (int Frame = 0; Frame < fshu.FrameCount; Frame++) { foreach (MatAnimData track in mat.matCurves) { AnimKey left = track.GetLeft(Frame); AnimKey right = track.GetRight(Frame); track.Value = Animation.Hermite(Frame, left.frame, right.frame, 0, 0, left.unk1, right.unk1); } } int CurCurve = 0; for (int Frame = 0; Frame < fshu.FrameCount; Frame++) { foreach (MatAnimData track in mat.matCurves) { //This works like this //Each param has their own info. While this loop through each curve determine which data is which //Set the param name. Then detemine the data in between begin curve and total count //Example. Begin curve starts at 0. Count may be 3 for RGB values //Then for next curve would start at 3 and so on //For color I simply use the values starting from RGBA //Then for the next param i subtract the start value to reset the index back to 0 foreach (ParamAnimInfo inf in matanim.ParamAnimInfos) { track.shaderParamName = inf.Name; if (inf.BeginCurve >= CurCurve) { if (inf.FloatCurveCount >= CurCurve) { int ColorIndex = CurCurve - inf.BeginCurve; track.AnimColorType = (MatAnimData.ColorType)ColorIndex; } } } } CurCurve++; } mta.matEntries.Add(mat); } }