Example #1
0
        protected override void OnKeyDown(KeyboardKeyEventArgs e)
        {
            base.OnKeyDown(e);
            input.handleKeydown(e);

            if (e.Control && e.Key == Key.O)
            {
                var open = new OpenFileDialog();
                open.Multiselect = false;
                open.Title       = "StoneVox - Open File";
                open.DefaultExt  = ".qb";

                open.FileOk += (s, o) =>
                {
                    Client.OpenGLContextThread.Add(() =>
                    {
                        ImportExportUtil.Import(open.FileName);
                    });
                };

                Thread thread = new Thread(() =>
                {
                    open.ShowDialog();
                });

                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            if (e.Control && e.Key == Key.S)
            {
                var save = new SaveFileDialog();
                save.Title      = "StoneVox - Save File";
                save.Filter     = "StoneVox Project (.svp)|*.svp|Qubicle Binary (.qb)|*.qb|Wavefront OBJ (.obj)|*.obj|All files (*.*)|*.*";
                save.DefaultExt = ".svp";

                save.FileOk += (s, t) =>
                {
                    QbModel model = manager.ActiveModel;
                    model.name = save.FileName.Split('\\').Last();
                    if (model.name.Contains('.'))
                    {
                        model.name = model.name.Split('.').First();
                    }
                    broadcaster.Broadcast(Message.ModelRenamed, model, model.name);
                    ImportExportUtil.Export(save.FileName.Split('\\').Last().Replace(model.name, ""), model.name, Path.GetDirectoryName(save.FileName), model);
                };

                Thread thread = new Thread(() =>
                {
                    save.ShowDialog();
                });

                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            else if (e.Control && e.Key == Key.F12)
            {
                GUIEditor editor = new GUIEditor();
                editor.Show();
            }
            //else if (e.Key == Key.T)
            //{
            //    Stopwatch w = Stopwatch.StartNew();
            //    var model = Singleton<QbManager>.INSTANCE.ActiveMatrix;

            //    Colort color = new Colort(1f, 0f, 0f);

            //    var volume = new VoxelVolume()
            //    {
            //        minx = 0,
            //        maxx = 100,
            //        miny = 0,
            //        maxy = 100,
            //        minz = 0,
            //        maxz = 100
            //    };

            //    model.Add(volume, ref color);

            //    w.Stop();
            //    Console.WriteLine("add " + w.ElapsedMilliseconds.ToString());
            //}
            //else if (e.Key == Key.T)
            //{
            //    Stopwatch w = Stopwatch.StartNew();
            //    var model = Singleton<QbManager>.INSTANCE.ActiveMatrix;

            //    Colort color = new Colort(1f, 0f, 0f);
            //    for (int x = 0; x < 100; x++)
            //        for (int z = 0; z < 100; z++)
            //        for (int y = 0; y< 100; y++)
            //                model.Add(x, y, z, color);

            //    w.Stop();
            //    Console.WriteLine("add " +w.ElapsedMilliseconds.ToString());
            //}

            //else if (e.Key == Key.Y)
            //{
            //    Stopwatch w = Stopwatch.StartNew();
            //    var model = Singleton<QbManager>.INSTANCE.ActiveMatrix;

            //    Colort color = new Colort(1f, 0f, 0f);
            //    for (int x = 0; x < 100; x++)
            //        for (int z = 0; z < 100; z++)
            //            for (int y = 0; y < 100; y++)

            //                model.Remove(x, y, z);

            //    w.Stop();
            //    Console.WriteLine("earse " + w.ElapsedMilliseconds.ToString());
            //}
        }
Example #2
0
 void SetActiveModel(int index)
 {
     activemodelindex = index;
     broadcaster.Broadcast(Message.ActiveModelChanged, ActiveModel, ActiveModelIndex);
     broadcaster.Broadcast(Message.ActiveMatrixChanged, ActiveMatrix, ActiveMatrixIndex);
 }