示例#1
0
        private void cameraToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var menuItem = sender as ToolStripMenuItem;

            int.TryParse(menuItem.Tag.ToString(), out int cameraTypeInt);
            CameraType type = (CameraType)cameraTypeInt;

            if (cameraDialog == null || cameraDialog.IsDisposed)
            {
                cameraDialog = new CameraDialog(type);
                cameraDialog.Show();

                ToolStripMenuItem item = new ToolStripMenuItem(cameraDialog.NewCamera.Name);
                item.Name = "viewCamera" +
                            viewCameraToolStripMenuItem.DropDownItems.Count.ToString();
                item.CheckOnClick = true;
                item.Checked      = false;
                item.Click       += viewCameraToolStripMenuItem_Click;
                viewCameraToolStripMenuItem.DropDownItems.Add(item);
            }
        }
示例#2
0
        private void outlinerTree_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                // Get the clicked on node from mouse position and set the selected node
                var node = outlinerTree.GetNodeAt(e.X, e.Y);
                outlinerTree.SelectedNode = node;

                if (node == null)
                {
                    return;
                }

                // Get light from clicked on node
                var light = Scene.Instance.GetLight(node.Text);
                if (light != null)
                {
                    // Show light dialog with selected light
                    if (lightDialog == null || lightDialog.IsDisposed)
                    {
                        lightDialog = new LightDialog(light);
                        lightDialog.Show();
                        return;
                    }
                }

                // Get Camera from clicked on node
                var camera = Scene.Instance.GetCamera(node.Text);
                if (camera != null)
                {
                    if (cameraDialog == null || cameraDialog.IsDisposed)
                    {
                        cameraDialog = new CameraDialog(camera);
                        cameraDialog.Show();
                        return;
                    }
                }
            }
        }