Ejemplo n.º 1
0
        private void pasteModelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Attach attach = (Attach)Clipboard.GetData(GetAttachType().AssemblyQualifiedName);

            if (selectedObject.Attach != null)
            {
                attach.Name = selectedObject.Attach.Name;
            }
            if (attach is BasicAttach)
            {
                BasicAttach batt = (BasicAttach)attach;
                batt.VertexName   = "vertex_" + Extensions.GenerateIdentifier();
                batt.NormalName   = "normal_" + Extensions.GenerateIdentifier();
                batt.MaterialName = "material_" + Extensions.GenerateIdentifier();
                batt.MeshName     = "mesh_" + Extensions.GenerateIdentifier();
                foreach (NJS_MESHSET m in batt.Mesh)
                {
                    m.PolyName       = "poly_" + Extensions.GenerateIdentifier();
                    m.PolyNormalName = "polynormal_" + Extensions.GenerateIdentifier();
                    m.UVName         = "uv_" + Extensions.GenerateIdentifier();
                    m.VColorName     = "vcolor_" + Extensions.GenerateIdentifier();
                }
            }
            else if (attach is ChunkAttach)
            {
                ChunkAttach catt = (ChunkAttach)attach;
                catt.VertexName = "vertex_" + Extensions.GenerateIdentifier();
                catt.PolyName   = "poly_" + Extensions.GenerateIdentifier();
            }
            selectedObject.Attach = attach;
            attach.ProcessVertexData();
            NJS_OBJECT[] models = model.GetObjects();
            try { meshes[Array.IndexOf(models, selectedObject)] = attach.CreateD3DMesh(d3ddevice); }
            catch { }
            DrawLevel();
        }