/// FTMOチャンクを書き込みます。 public void WriteFTMO(TMOFile tmo) { MemoryStream ms = new MemoryStream(); tmo.Save(ms); ms.Seek(0, SeekOrigin.Begin); WriteFTMO(ms); }
static void Main(string[] args) { if (args.Length != 2) { System.Console.WriteLine("Usage: TMOAppend <source tmo> <motion tmo>"); return; } string source_file = args[0]; string motion_file = args[1]; Console.WriteLine("Load File: " + source_file); TMOFile source = new TMOFile(); try { source.Load(source_file); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } Console.WriteLine("Load File: " + motion_file); TMOFile motion = new TMOFile(); try { motion.Load(motion_file); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } try { source.AppendFrameFrom(motion); Console.WriteLine("source nodes {0}", source.nodes.Length); Console.WriteLine("motion nodes {0}", motion.nodes.Length); Console.WriteLine("source frames {0}", source.frames.Length); Console.WriteLine("motion frames {0}", motion.frames.Length); Console.WriteLine("Save File: " + source_file); source.Save(source_file); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); return; } }
static void Main(string[] args) { if (args.Length < 2) { System.Console.WriteLine("Usage: TMOAnim <source tmo> <motion tmo> [append length]"); return; } string source_file = args[0]; string motion_file = args[1]; int append_length = 200; if (args.Length > 2) { append_length = int.Parse(args[2]); } Console.WriteLine("Load File: " + source_file); TMOFile source = new TMOFile(); try { source.Load(source_file); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } Console.WriteLine("Load File: " + motion_file); TMOFile motion = new TMOFile(); try { motion.Load(motion_file); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } source.SlerpFrameEndTo(motion, append_length); Console.WriteLine("source nodes Length {0}", source.nodes.Length); Console.WriteLine("motion nodes Length {0}", motion.nodes.Length); Console.WriteLine("source frames Length {0}", source.frames.Length); Console.WriteLine("motion frames Length {0}", motion.frames.Length); Console.WriteLine("Save File: " + source_file); source.Save(source_file); }
static void Main(string[] args) { if (args.Length < 2) { System.Console.WriteLine("Usage: TMONodeCopy <source tmo> <motion tmo> [node name]"); return; } string source_file = args[0]; string motion_file = args[1]; string node_name = "face_oya"; List <string> except_node_names = new List <string>(); except_node_names.Add("Kami_Oya"); if (args.Length > 2) { node_name = args[2]; } Console.WriteLine("Load File: " + source_file); TMOFile source = new TMOFile(); try { source.Load(source_file); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } Console.WriteLine("Load File: " + motion_file); TMOFile motion = new TMOFile(); try { motion.Load(motion_file); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } source.CopyNodeFrom(motion, node_name, except_node_names); Console.WriteLine("Save File: " + source_file); source.Save(source_file); }
public static int UpdateTmo(string source_file, float angle, string node_name) { string dest_file = source_file + ".tmp"; TMOFile tmo = new TMOFile(); try { tmo.Load(source_file); } catch (Exception ex) { Console.WriteLine(ex.Message); return(-1); } if (tmo.nodes[0].ShortName != "W_Hips") { Console.WriteLine("Passed: root node is not W_Hips"); return(1); } Dictionary <string, TMONode> nodes = new Dictionary <string, TMONode>(); foreach (TMONode node in tmo.nodes) { try { nodes.Add(node.ShortName, node); } catch (ArgumentException) { Console.WriteLine("node {0} already exists.", node.ShortName); } } try { TMONode node; node = nodes[node_name]; node.RotateWorldY(DegreeToRadian(angle)); } catch (KeyNotFoundException) { Console.WriteLine("node not found."); } tmo.Save(dest_file); System.IO.File.Delete(source_file); System.IO.File.Move(dest_file, source_file); Console.WriteLine("updated " + source_file); return(0); }
static void Main(string[] args) { if (args.Length < 1) { System.Console.WriteLine("Usage: TMOPose <tmo file> [frame]"); return; } string source_file = args[0]; int frame_index = 0; if (args.Length > 1) { try { frame_index = Int32.Parse(args[1]); } catch (FormatException ex) { Console.WriteLine(ex.Message); return; } } Console.WriteLine("Load File: " + source_file); TMOFile source = new TMOFile(); try { source.Load(source_file); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } source.TruncateFrame(frame_index); Console.WriteLine("Save File: " + source_file); source.Save(source_file); }