Beispiel #1
0
        public virtual void Initialize()
        {
            // register a custom menu without any commands, so it won't appear in the main menu bar
            MenuInfo  menuInfo = m_commandService.RegisterMenu(this, "RenderModes", "Rendering modes");
            ToolStrip strip    = menuInfo.GetToolStrip();

            CommandInfo cmdInfo = m_commandService.RegisterCommand(
                Command.RenderSmooth,
                StandardMenu.View,
                m_commandGroup,
                "Solid".Localize(),
                "Solid rendering".Localize(),
                Keys.None,
                Resources.SmoothImage,
                CommandVisibility.Menu,
                this);

            strip.Items.Add(cmdInfo.GetButton());

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderWireFrame,
                StandardMenu.View,
                m_commandGroup,
                "Wireframe".Localize(),
                "Wireframe rendering".Localize(),
                Keys.None,
                Resources.WireframeImage,
                CommandVisibility.Menu,
                this);
            strip.Items.Add(cmdInfo.GetButton());

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderOutlined,
                StandardMenu.View,
                m_commandGroup,
                "SolidOverWire",
                "Solid over wireframe rendering".Localize(),
                Keys.None,
                Resources.OutlinedImage,
                CommandVisibility.Menu,
                this);
            strip.Items.Add(cmdInfo.GetButton());

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderTextured,
                StandardMenu.View,
                m_commandGroup,
                "Textured".Localize(),
                "Textured rendering".Localize(),
                Keys.T,
                Resources.TexturedImage,
                CommandVisibility.Menu,
                this);
            strip.Items.Add(cmdInfo.GetButton());


            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderLight,
                StandardMenu.View,
                m_commandGroup,
                "Lighting".Localize(),
                "Lighting".Localize(),
                Keys.L,
                Resources.LightImage,
                CommandVisibility.Menu,
                this);
            strip.Items.Add(cmdInfo.GetButton());

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderBackFace,
                StandardMenu.View,
                m_commandGroup,
                "BackFace".Localize(),
                "Render back faces".Localize(),
                Keys.B,
                Resources.BackfaceImage,
                CommandVisibility.Menu,
                this);
            strip.Items.Add(cmdInfo.GetButton());

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderShadow,
                StandardMenu.View,
                m_commandGroup,
                "Shadow".Localize(),
                "Render shadow".Localize(),
                Keys.None,
                Resources.ShadowImage,
                CommandVisibility.Menu,
                this);
            strip.Items.Add(cmdInfo.GetButton());


            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderNormals,
                StandardMenu.View,
                m_commandGroup,
                "Normals".Localize(),
                "Render Normals".Localize(),
                Keys.None,
                Resources.NormalImage,
                CommandVisibility.Menu,
                this);
            strip.Items.Add(cmdInfo.GetButton());


            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderCycle,
                StandardMenu.View,
                m_commandGroup,
                "CycleRenderModes".Localize(),
                "Cycle render modes".Localize(),
                Keys.Space,
                null,
                CommandVisibility.Menu,
                this);

            //cmdInfo = m_commandService.RegisterCommand(
            //  Command.RealTime,
            //  StandardMenu.View,
            //  m_commandGroup,
            //  "RealTime".Localize(),
            //  "Toggle real time rendering".Localize(),
            //  Keys.None,
            //  Resources.RealTimeImage,
            //  CommandVisibility.Menu,
            //  this);
            //strip.Items.Add(cmdInfo.GetButton());


            ControlInfo controlInfo = new ControlInfo("Render settings", "per view port render settings", StandardControlGroup.Hidden);

            m_propGrid = new PropertyGrid();
            m_propGrid.PropertyValueChanged += delegate
            {
                m_designView.InvalidateViews();
            };

            m_controlHostService.RegisterControl(m_propGrid, controlInfo, null);

            if (m_scriptingService != null)
            {
                m_scriptingService.SetVariable("renderCommands", this);
            }
        }
Beispiel #2
0
        public virtual void Initialize()
        {
            // register a custom menu without any commands, so it won't appear in the main menu bar
            MenuInfo  menuInfo = m_commandService.RegisterMenu(this, "RenderModes", "Rendering modes");
            ToolStrip strip    = null; // menuInfo.GetToolStrip(); (disabling this tool strip, because it feels a bit redundant)

            CommandInfo cmdInfo = m_commandService.RegisterCommand(
                Command.RenderSmooth,
                StandardMenu.View,
                m_commandGroup,
                "Solid".Localize(),
                "Solid rendering".Localize(),
                Keys.None,
                LevelEditorCore.Resources.SmoothImage,
                CommandVisibility.Menu,
                this);

            if (strip != null)
            {
                strip.Items.Add(cmdInfo.GetButton());
            }

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderWireFrame,
                StandardMenu.View,
                m_commandGroup,
                "Wireframe".Localize(),
                "Wireframe rendering".Localize(),
                Keys.None,
                LevelEditorCore.Resources.WireframeImage,
                CommandVisibility.Menu,
                this);
            if (strip != null)
            {
                strip.Items.Add(cmdInfo.GetButton());
            }

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderOutlined,
                StandardMenu.View,
                m_commandGroup,
                "SolidOverWire",
                "Solid over wireframe rendering".Localize(),
                Keys.None,
                LevelEditorCore.Resources.OutlinedImage,
                CommandVisibility.Menu,
                this);
            if (strip != null)
            {
                strip.Items.Add(cmdInfo.GetButton());
            }

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderTextured,
                StandardMenu.View,
                m_commandGroup,
                "Textured".Localize(),
                "Textured rendering".Localize(),
                Keys.T,
                LevelEditorCore.Resources.TexturedImage,
                CommandVisibility.Menu,
                this);
            if (strip != null)
            {
                strip.Items.Add(cmdInfo.GetButton());
            }


            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderLight,
                StandardMenu.View,
                m_commandGroup,
                "Lighting".Localize(),
                "Lighting".Localize(),
                Keys.L,
                LevelEditorCore.Resources.LightImage,
                CommandVisibility.Menu,
                this);
            if (strip != null)
            {
                strip.Items.Add(cmdInfo.GetButton());
            }

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderBackFace,
                StandardMenu.View,
                m_commandGroup,
                "BackFace".Localize(),
                "Render back faces".Localize(),
                Keys.B,
                LevelEditorCore.Resources.BackfaceImage,
                CommandVisibility.Menu,
                this);
            if (strip != null)
            {
                strip.Items.Add(cmdInfo.GetButton());
            }

            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderShadow,
                StandardMenu.View,
                m_commandGroup,
                "Shadow".Localize(),
                "Render shadow".Localize(),
                Keys.None,
                LevelEditorCore.Resources.ShadowImage,
                CommandVisibility.Menu,
                this);
            if (strip != null)
            {
                strip.Items.Add(cmdInfo.GetButton());
            }


            cmdInfo = m_commandService.RegisterCommand(
                Command.RenderNormals,
                StandardMenu.View,
                m_commandGroup,
                "Normals".Localize(),
                "Render Normals".Localize(),
                Keys.None,
                LevelEditorCore.Resources.NormalImage,
                CommandVisibility.Menu,
                this);
            if (strip != null)
            {
                strip.Items.Add(cmdInfo.GetButton());
            }

            m_commandService.RegisterCommand(
                Command.RenderCycle,
                StandardMenu.View,
                m_commandGroup,
                "CycleRenderModes".Localize(),
                "Cycle render modes".Localize(),
                Keys.Space,
                null,
                CommandVisibility.Menu,
                this);

            //cmdInfo = m_commandService.RegisterCommand(
            //  Command.RealTime,
            //  StandardMenu.View,
            //  m_commandGroup,
            //  "RealTime".Localize(),
            //  "Toggle real time rendering".Localize(),
            //  Keys.None,
            //  Resources.RealTimeImage,
            //  CommandVisibility.Menu,
            //  this);
            //strip.Items.Add(cmdInfo.GetButton());

            m_rsPropertyGrid = new MultiPropControl();
            m_controlHostService.RegisterControl(m_rsPropertyGrid,
                                                 new ControlInfo("Render settings", "Per viewport render settings", StandardControlGroup.Hidden), null);

            if (m_scriptingService != null)
            {
                m_scriptingService.SetVariable("renderCommands", this);
            }
        }
        void IInitializable.Initialize()
        {
            // register a custom menu without any commands, so it won't appear in the main menu bar
            var       cameraMenu = CommandService.RegisterMenu(this, "Camera", "Camera");
            ToolStrip strip      = cameraMenu.GetToolStrip();


            string camera = "Camera".Localize();

            CommandInfo cmdInfo =
                CommandService.RegisterCommand(
                    Command.Arcball,
                    StandardMenu.View,
                    StandardCommandGroup.ViewCamera,
                    camera + "/" + "Arcball".Localize(),
                    "Arcball".Localize(),
                    Keys.None,
                    Resources.ArcballImage,
                    CommandVisibility.Menu,
                    this);

            strip.Items.Add(cmdInfo.GetButton());

            cmdInfo =
                CommandService.RegisterCommand(
                    Command.Maya,
                    StandardMenu.View,
                    StandardCommandGroup.ViewCamera,
                    camera + "/" + "Maya".Localize(),
                    "Maya style camera".Localize(),
                    Keys.None,
                    Resources.MayaImage,
                    CommandVisibility.Menu,
                    this);
            strip.Items.Add(cmdInfo.GetButton());

            cmdInfo =
                CommandService.RegisterCommand(
                    Command.Fly,
                    StandardMenu.View,
                    StandardCommandGroup.ViewCamera,
                    camera + "/" + "Fly".Localize(),
                    "Fly:  WASD + Middle Mouse navigation, mouse-wheel to adjust speed".Localize(),
                    Keys.None,
                    Resources.FlyImage,
                    CommandVisibility.Menu,
                    this);
            strip.Items.Add(cmdInfo.GetButton());

            cmdInfo =
                CommandService.RegisterCommand(
                    Command.Walk,
                    StandardMenu.View,
                    StandardCommandGroup.ViewCamera,
                    camera + "/" + "Walk".Localize(),
                    "Walk: WASD + Middle Mouse, press Alt+MiddleMouse for height, mouse wheel to adjust walk speed".Localize(),
                    Keys.None,
                    Resources.WalkImage,
                    CommandVisibility.Menu,
                    this);
            strip.Items.Add(cmdInfo.GetButton());

            SettingsService.RegisterSettings(
                this,
                new BoundPropertyDescriptor(this, () => CameraMode, "CameraMode", null, null));
        }