예제 #1
0
파일: Editor.cs 프로젝트: juanjp600/cbre
 private static void LoadFileGame(string fileName, Game game)
 {
     try {
         Image[] lightmaps;
         var     map = MapProvider.GetMapFromFile(fileName, Directories.ModelDirs, out lightmaps);
         if (MapProvider.warnings != "")
         {
             MessageBox.Show(MapProvider.warnings, "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         Document doc = new Document(fileName, map, game);
         DocumentManager.AddAndSwitch(doc);
         if (lightmaps != null)
         {
             lock (doc.TextureCollection.Lightmaps) {
                 for (int i = 0; i < lightmaps.Length; i++)
                 {
                     doc.TextureCollection.Lightmaps[i]?.Dispose();
                     doc.TextureCollection.Lightmaps[i] = new Bitmap(lightmaps[i]);
                     lightmaps[i].Dispose();
                 }
                 doc.TextureCollection.LightmapTextureOutdated = true;
             }
             foreach (var viewport in ViewportManager.Viewports.Where(vp => vp is Viewport3D).Select(vp => vp as Viewport3D))
             {
                 viewport.Type = Viewport3D.ViewType.Lightmapped;
                 var listener = viewport.Listeners.Find(l => l is ViewportLabelListener) as ViewportLabelListener;
                 listener?.Rebuild();
             }
         }
     } catch (ProviderException e) {
         Error.Warning("The map file could not be opened:\n" + e.Message);
     }
 }
예제 #2
0
파일: Editor.cs 프로젝트: valera6285/sledge
 private static void LoadFileGame(string fileName, Game game)
 {
     try
     {
         var map = MapProvider.GetMapFromFile(fileName);
         DocumentManager.AddAndSwitch(new Document(fileName, map, game));
     }
     catch (ProviderException e)
     {
         Error.Warning("The map file could not be opened:\n" + e.Message);
     }
 }
예제 #3
0
        public void Initialize()
        {
            MapProvider.Register(new RmfProvider());
            MapProvider.Register(new VmfProvider());

            var fi   = new FileInfo(@"verc_18.rmf");
            var ctor = typeof(Document).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null);

            _document     = (Document)ctor.Invoke(null);
            _document.Map = MapProvider.GetMapFromFile(fi.FullName);

            SaveBefore();
        }
예제 #4
0
        public void TestInvalidDecalGeometry()
        {
            MapProvider.Register(new RmfProvider());
            MapProvider.Register(new VmfProvider());

            var fi       = new FileInfo("decalflip_bad.rmf");
            var ctor     = typeof(Document).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null);
            var document = (Document)ctor.Invoke(null);

            document.Map = MapProvider.GetMapFromFile(fi.FullName);

            var ents = document.Map.WorldSpawn.FindAll().OfType <Entity>();

            foreach (var entity in ents)
            {
                entity.SetDecal(new MockTexture(64, 64, "Test"));
            }
        }
예제 #5
0
파일: MainForm.cs 프로젝트: xbloke/sledge
        private void OpenToolStripButtonClick(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog();

            ofd.Filter = @"Map Files (*.rmf, *.vmf, *.map)|*.rmf;*.vmf;*.map;*.rmx;*.vmx;*.max";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var map = MapProvider.GetMapFromFile(ofd.FileName);
                    lstLog.Items.Insert(0, Path.GetFileName(ofd.FileName) + ": Map Loaded.");
                    LoadMap(map);
                }
                catch (Exception ex)
                {
                    lstLog.Items.Insert(0, Path.GetFileName(ofd.FileName) + ": " + ex.Message);
                }
            }
        }
예제 #6
0
 public static void PostStart(Editor.Editor editor)
 {
     if (File.Exists(MapFile) && Game != null)
     {
         var map = MapProvider.GetMapFromFile(MapFile);
         DocumentManager.AddAndSwitch(new Document(MapFile, map, Game));
     }
     // Texture panel
     //using (var tlp = new TextureListPanel())
     //{
     //    tlp.ImageSize = 128;
     //    tlp.Dock = DockStyle.Fill;
     //    tlp.AddTextures(TexturePackage.GetLoadedItems());
     //    using (var dialog = new Form())
     //    {
     //        dialog.Controls.Add(tlp);
     //        dialog.ShowDialog();
     //    }
     //}
     // Texture tool
     editor.SelectTool(ToolManager.Tools[0]);
 }
예제 #7
0
 public void LoadVmfTest()
 {
     MapProvider.Register(new VmfProvider());
     var file = @"D:\Github\sledge\_Resources\VMF\sdk_d2_coast_12.vmf";
     var map  = MapProvider.GetMapFromFile(file);
 }