public void SaveAnimNodes(ICLIFlags toolFlags) { if (!(toolFlags is ExtractFlags flags)) { throw new Exception("wat"); } string path = Path.Combine(flags.OutputPath, "DebugAnimNodes"); IO.CreateDirectoryFromFile(Path.Combine(path, "daivd clyde")); // I didn't want to write code for a viewer so use: https://github.com/cb109/qtnodes foreach (ulong key in TrackedFiles[0x20]) { /*if (key != 1116892707587883363) continue; // 020 reaper hero select * STUAnimBlendTree tree = GetInstance<STUAnimBlendTree>(key); * GraphRoot root = new GraphRoot {nodes = new List<GraphNode>(), edges = new List<GraphEdge>()}; * if (tree?.AnimNodes == null) continue; * List<uint> doneNodes = new List<uint>(); * foreach (STUAnimNode_Base node in tree.AnimNodes) { * if (node == null) continue; * string uuid = node.UniqueID.ToString(); * if (doneNodes.Contains(node.UniqueID)) continue; * doneNodes.Add(node.UniqueID); * root.nodes.Add(new GraphNode {x = node.Pos.X, y = node.Pos.Y, uuid = uuid, @class = "MaxObject", name = node.GetType().Name}); * * * if (node.m_0DE1BA16 == null) continue; * foreach (STU_40274C18 stu_6C0Bbd69 in node.m_0DE1BA16) { * if (stu_6C0Bbd69.m_AF632ACD != null) { * uint parId = stu_6C0Bbd69.m_AF632ACD.UniqueID; * root.edges.Add(new GraphEdge {source_nodeId = node.UniqueID.ToString(), target_name = "parent", source_name = "children", target_nodeId = parId.ToString()}); * } * } * } * ParseJSON(root, flags);*/ // notes: (all oldhash) // {STU_2D84E49E} for strafe stuff // <= breakpoint here GraphRoot root = new GraphRoot { nodes = new List <GraphNode>(), edges = new List <GraphEdge>() }; STUAnimBlendTree blendTree = GetInstance <STUAnimBlendTree>(key); if (blendTree.m_animNodes == null) { continue; } foreach (STUAnimNode_Base animNode in blendTree.m_animNodes) { ParseNode(root, animNode); } string json = JsonConvert.SerializeObject(root, Formatting.Indented); string output = Path.Combine(path, $"{teResourceGUID.AsString(key)}.json"); using (Stream file = File.OpenWrite(output)) { file.SetLength(0); using (TextWriter writer = new StreamWriter(file)) { writer.WriteLine(json); } } } }
public void SaveAnimNodes(ICLIFlags toolFlags) { ListFlags flags = toolFlags as ListFlags; // I didn't want to write code for a viewer so use: https://github.com/cb109/qtnodes foreach (ulong key in TrackedFiles[0x20]) { if (key != 1116892707587883363) { continue; // 020 reaper hero select } STUAnimBlendTree tree = GetInstance <STUAnimBlendTree>(key); GraphRoot root = new GraphRoot { nodes = new List <GraphNode>(), edges = new List <GraphEdge>() }; if (tree?.AnimNodes == null) { continue; } List <uint> doneNodes = new List <uint>(); foreach (STUAnimNode_Base node in tree.AnimNodes) { if (node == null) { continue; } string uuid = node.UniqueID.ToString(); if (doneNodes.Contains(node.UniqueID)) { continue; } doneNodes.Add(node.UniqueID); root.nodes.Add(new GraphNode { x = node.Pos.X, y = node.Pos.Y, uuid = uuid, @class = "MaxObject", name = node.GetType().Name }); if (node.m_0DE1BA16 == null) { continue; } foreach (STU_40274C18 stu_6C0Bbd69 in node.m_0DE1BA16) { if (stu_6C0Bbd69.m_AF632ACD != null) { uint parId = stu_6C0Bbd69.m_AF632ACD.UniqueID; root.edges.Add(new GraphEdge { source_nodeId = node.UniqueID.ToString(), target_name = "parent", source_name = "children", target_nodeId = parId.ToString() }); } } } ParseJSON(root, flags); // notes: (all oldhash) // {STU_2D84E49E} for strafe stuff // <= breakpoint here } }