public static ImportedMesh FindMesh(ImportedFrame frame, List <ImportedMesh> importedMeshList) { StringBuilder sb = new StringBuilder(); string framePath; ImportedFrame root = frame; while (root.Parent != null) { sb.Insert(0, root.Name).Insert(0, '/'); root = root.Parent; } if (sb.Length > 0) { sb.Remove(0, 1); framePath = sb.ToString(); } else { framePath = frame.Name; } foreach (ImportedMesh mesh in importedMeshList) { if (mesh.Name == framePath) { return(mesh); } } return(null); }
public static ImportedFrame FindFrame(String name, ImportedFrame root) { String[] path = name.Split('/'); ImportedFrame frame = root; bool found = false; for (int i = 0; i < path.Length; i++) { found = false; for (int j = 0; j < frame.Count; j++) { if (frame[j].Name == path[i]) { frame = frame[j]; found = true; break; } } if (!found) { Report.ReportLog("Wrong path= " + name + ". Child " + path[i] + " not found."); return(null); } } return(found ? frame : root.Name == name ? root : null); }
void InitFrames(ImportedFrame frame) { Frames.Add(frame); foreach (var child in frame) { InitFrames(child); } }
public void MergeFrame(ImportedFrame srcFrame, int destParentId, int meshMatOffset) { xxFrame newFrame = xx.CreateFrame(srcFrame); xx.CopyOrCreateUnknowns(newFrame, Parser.Frame, Parser.Format); MeshMatOffset(newFrame, meshMatOffset); MergeFrame(newFrame, destParentId); }
public static Matrix WorldTransform(ImportedFrame frame) { Matrix world = frame.Matrix; while (frame.Parent != null) { frame = frame.Parent; world = world * frame.Matrix; } return(world); }
private void BuildTree(string editorVar, ImportedFrame frame, TreeNode parent, ImportedEditor editor) { TreeNode node = new TreeNode(frame.Name); node.Checked = true; node.Tag = new DragSource(editorVar, typeof(ImportedFrame), editor.Frames.IndexOf(frame)); this.treeView.AddChild(parent, node); foreach (var child in frame) { BuildTree(editorVar, child, node, editor); } }
public static xxFrame CreateFrame(ImportedFrame frame) { xxFrame xxFrame = new xxFrame(); xxFrame.Matrix = frame.Matrix; xxFrame.Bounds = new BoundingBox(); xxFrame.Name = frame.Name; xxFrame.InitChildren(frame.Count); for (int i = 0; i < frame.Count; i++) { xxFrame.AddChild(CreateFrame(frame[i])); } return(xxFrame); }
public static ImportedFrame FindFrame(String name, ImportedFrame root) { ImportedFrame frame = root; if ((frame != null) && (frame.Name == name)) { return(frame); } for (int i = 0; i < root.Count; i++) { if ((frame = FindFrame(name, root[i])) != null) { return(frame); } } return(null); }
public static ImportedMesh FindMesh(ImportedFrame frame, List <ImportedMesh> importedMeshList) { string framePath = frame.Name; ImportedFrame root = frame; while (root.Parent != null) { root = root.Parent; framePath = root.Name + "/" + framePath; } foreach (ImportedMesh mesh in importedMeshList) { if (mesh.Name == framePath) { return(mesh); } } return(null); }