Example #1
0
        public xxFrame Clone(bool mesh, bool childFrames)
        {
            xxFrame frame = new xxFrame();

            frame.InitChildren(children.Count);
            frame.Name     = Name;
            frame.Matrix   = Matrix;
            frame.Unknown1 = (byte[])Unknown1.Clone();
            frame.Bounds   = Bounds;
            frame.Unknown2 = (byte[])Unknown2.Clone();
            if (Name2 != null)
            {
                frame.Name2 = Name2;
            }

            if (mesh && (Mesh != null))
            {
                frame.Mesh = Mesh.Clone(true, true, true);
            }
            if (childFrames)
            {
                for (int i = 0; i < children.Count; i++)
                {
                    frame.AddChild(children[i].Clone(mesh, true));
                }
            }
            return(frame);
        }
Example #2
0
        public xxFrame Clone(bool mesh, bool childFrames, int[] matTranslations)
        {
            xxFrame frame = new xxFrame();

            frame.InitChildren(children.Count);
            frame.Name     = Name;
            frame.Matrix   = Matrix;
            frame.Unknown1 = (byte[])Unknown1.Clone();
            frame.Bounds   = Bounds;
            frame.Unknown2 = (byte[])Unknown2.Clone();
            if (Name2 != null)
            {
                frame.Name2 = Name2;
            }

            if (mesh && (Mesh != null))
            {
                frame.Mesh = Mesh.Clone(true, true, true);
                if (matTranslations != null)
                {
                    foreach (xxSubmesh submesh in frame.Mesh.SubmeshList)
                    {
                        if (submesh.MaterialIndex >= 0)
                        {
                            submesh.MaterialIndex = matTranslations[submesh.MaterialIndex];
                        }
                    }
                }
            }
            if (childFrames)
            {
                for (int i = 0; i < children.Count; i++)
                {
                    frame.AddChild(children[i].Clone(mesh, true, matTranslations));
                }
            }
            return(frame);
        }