Example #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Form1()
        {
            //Init the editor manager before the engine view gets initialized (so that we have an engine manager)
              //Note: this could cause problems if plugins need the form to exist during init
              EditorApp.InitEditorApp(this);

              EditorApp.EditorAppDelegates.SetFormTextDelegate = new SetTextDelegate(this.SetText);
              EditorApp.EditorAppDelegates.LoadProjectDelegate = new LoadFileDelegate(this.LoadProject);
              EditorApp.EditorAppDelegates.LoadSceneDelegate = new LoadFileDelegate(this.LoadScene);

              // Create the app interface for the docking library. Used to retrieve application specific data from
              // within the isolated docking library.
              WeifenLuo.WinFormsUI.AppInterface.Instance = new DockingApp();
              LoadSettings(); // load settings from XML file

              //
              // Required for Windows Form Designer support
              //
              InitializeComponent();
              InitializeMyComponent(); // init the engine view

              // We have to call the update titlebar here so we have the DX11 flag in the titlebar
              EditorApp.UpdateTitleBar();

              // remove the 'Tests' menu if the Test data directory is not available, i.e. when vForge is shipped
              if (!TestManager.Helpers.TestDataDirExists)
              {
            this.mainMenu.Items.Remove(Menu_Tests);
              }

              EditorManager.InitPlugins(Application.StartupPath);

              EditorManager.EngineManager.SetExecutablePath(Path.GetFullPath(Application.StartupPath));
              EditorManager.EngineManager.SetSDKPath(Path.GetFullPath(Application.StartupPath + @"\..\..\..\..\"));

              UpdateToolbars();

              EditorManager.Actions.ActionEvent += new ActionEventHandler(Actions_ActionEvent);
              EditorManager.SceneChanged += new SceneChangedEventHandler(EditorManager_SceneChanged);
              EditorManager.EditorModeChanged += new EditorModeChangedEventHandler(EditorManager_EditorModeChanged);
              EditorManager.ShapeSelectionChanged += new ShapeSelectionChangedEventHandler(EditorManager_ShapeSelectionChanged);
              EditorManager.ApplicationLayout.ActiveLayoutChanged += new LayoutManager.ActiveLayoutChangedEventHandler(ApplicationLayout_ActiveLayoutChanged);
              EditorManager.ApplicationLayout.AvailableLayoutsChanged += new CSharpFramework.Layout.LayoutManager.AvailableLayoutsChangedEventHandler(ApplicationLayout_AvailableLayoutsChanged);
              EditorManager.BeforeEditorAppShutdown += new EditorAppShutdownEventHandler(EditorManager_BeforeEditorAppShutdown);
              Load += new EventHandler(Form1_Load);
              IVisibilityBuilder.OnVisibilityStatusChanged += new EventHandler(IVisibilityBuilder_OnVisibilityStatusChanged);
              IVisibilityBuilder.OnVisibilityUseInEngineChanged += new EventHandler(IVisibilityBuilder_OnVisibilityUseInEngineChanged);
              IScene.OnDirtyFlagChanged += new EventHandler(IScene_OnDirtyFlagChanged);
              Application.Idle += new EventHandler(Application_Idle);

              Scene2DView.RelevantObjects.Add(ZoneActionProvider.ACTION_PROVIDER); // register one global instance

              // Initialize Remote Manager
              ManagedFramework.ManagedFramework.OneTimeInit();
              InitializeRemoteManager();

              // Initially update status bar
              UpdateStatusBar();

              // special case shapes
              if (EditorManager.Settings.ExposeVisibilityShapes)
              {
            EditorManager.ShapeCreatorPlugins.Add(new VisibilityZoneShapeCreator());
            EditorManager.ShapeCreatorPlugins.Add(new VisibilityZoneShapeCreator_HallwayX());
            EditorManager.ShapeCreatorPlugins.Add(new VisibilityZoneShapeCreator_HallwayY());
            EditorManager.ShapeCreatorPlugins.Add(new VisibilityZoneShapeCreator_Room());
            EditorManager.ShapeCreatorPlugins.Add(new PortalShapeCreator());

              }

              // hotkeys:
              ShortCutConfig shortcuts = EditorManager.ShortCuts;
              shortcuts.Add(new GizmoModeShortCut(Keys.W, ShapeDragMode.MOVE));
              shortcuts.Add(new GizmoModeShortCut(Keys.E, ShapeDragMode.ROTATE));
              shortcuts.Add(new GizmoModeShortCut(Keys.R, ShapeDragMode.UNIFORMSCALE));
              shortcuts.Add(new GizmoModeShortCut(Keys.None, ShapeDragMode.LINK));
              shortcuts.Add(new GizmoSwitchShortCut(Keys.Q));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MaxStyle));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MayaStyle));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MiddleMouseOrbitSelection));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MiddleMousePan));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MiddleMousePanHorizontal));
              shortcuts.Add(new ShapeSelectionModeShortCut(Keys.None, EditorSettingsBase.ShapeSelectionMode_e.ActiveLayer));
              shortcuts.Add(new ShapeSelectionModeShortCut(Keys.None, EditorSettingsBase.ShapeSelectionMode_e.All));
              shortcuts.Add(new ShapeSelectionModeShortCut(Keys.None, EditorSettingsBase.ShapeSelectionMode_e.VisibleLayer));
              shortcuts.Add(new ToggleLocalOrientation(Keys.None));
              shortcuts.Add(new PerspectiveModeShortCut(VisionViewBase.ProjectionMode_e.Perspective, Keys.None));
              shortcuts.Add(new PerspectiveModeShortCut(VisionViewBase.ProjectionMode_e.Top, Keys.None));
              shortcuts.Add(new PerspectiveModeShortCut(VisionViewBase.ProjectionMode_e.Front, Keys.None));
              shortcuts.Add(new PerspectiveModeShortCut(VisionViewBase.ProjectionMode_e.Right, Keys.None));

              shortcuts.Add(new MenuItemShortCut(Menu_File_New_Scene, Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_File_Open_Scene, Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_File_Save_Scene, Keys.Control | Keys.S));
              shortcuts.Add(new MenuItemShortCut(Menu_File_Save_SceneAs, Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_File_Export_Scene,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_Edit_FindShapes, Keys.Control | Keys.F));
              shortcuts.Add(new MenuItemShortCut(Menu_Play_Animate,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_Play_RunInEditor,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_Play_PlayTheGame,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_Engine_ReloadResources,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_Engine_SaveScreenshot,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_Engine_SaveScreenshotAs,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_StaticLighting_EditSettings, Keys.None));

              shortcuts.Add(new ReservedShortCut("Menu File", Keys.Alt | Keys.F));
              shortcuts.Add(new ReservedShortCut("Menu Edit", Keys.Alt | Keys.E));
              shortcuts.Add(new ReservedShortCut("Menu View", Keys.Alt | Keys.V));
              shortcuts.Add(new ReservedShortCut("Menu Create", Keys.Alt | Keys.C));
              shortcuts.Add(new ReservedShortCut("Menu Play", Keys.Alt | Keys.P));
              shortcuts.Add(new ReservedShortCut("Menu Engine", Keys.Alt | Keys.N));
              shortcuts.Add(new ReservedShortCut("Menu Static Lighting", Keys.Alt | Keys.S));
              shortcuts.Add(new ReservedShortCut("Menu Help", Keys.Alt | Keys.H));
              shortcuts.Add(new ReservedShortCut("Cut", (Keys)Shortcut.CtrlX));
              shortcuts.Add(new ReservedShortCut("Copy", (Keys)Shortcut.CtrlC));
              shortcuts.Add(new ReservedShortCut("Paste", (Keys)Shortcut.CtrlV));
              shortcuts.Add(new ReservedShortCut("Delete", (Keys)Shortcut.Del));
              shortcuts.Add(new ReservedShortCut("Insert", (Keys)Shortcut.Ins));
              shortcuts.Add(new ReservedShortCut("Undo", (Keys)Shortcut.CtrlZ));
              shortcuts.Add(new ReservedShortCut("Redo", (Keys)Shortcut.CtrlY));
              shortcuts.Add(new ReservedShortCut("Select All", (Keys)Shortcut.CtrlA));

              shortcuts.Add(SaveResourceThumbnailShortCut.Instance);

              // Add a message filter for processing the keyboard shortcuts
              _scMsgFilter= new ShortCutMessageFilter();
              Application.AddMessageFilter(_scMsgFilter);

              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Reload Resources", Menu_Engine_ReloadResources);
              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Purge Resources", Menu_Engine_PurgeResources);
              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Save Screenshot", Menu_Engine_SaveScreenshot);
              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Calculate Visibility", Menu_Engine_CalculateVisibility);
              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Use Visibility", Menu_Engine_UseVisibility);

              // register to clipboard notification chain
              nextClipboardChainViewer = SetClipboardViewer(this.Handle);
        }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Form1()
        {
            //Init the editor manager before the engine view gets initialized (so that we have an engine manager)
              //Note: this could cause problems if plugins need the form to exist during init
              EditorApp.InitEditorApp(this);

              EditorApp.EditorAppDelegates.SetFormTextDelegate = new SetTextDelegate(this.SetText);
              EditorApp.EditorAppDelegates.LoadProjectDelegate = new LoadFileDelegate(this.LoadProject);
              EditorApp.EditorAppDelegates.LoadSceneDelegate = new LoadFileDelegate(this.LoadScene);

              // Create the app interface for the docking library. Used to retrieve application specific data from
              // within the isolated docking library.
              WeifenLuo.WinFormsUI.AppInterface.Instance = new DockingApp();
              LoadSettings(); // load settings from XML file

              // Init Help System (must be done after LoadSettings)
              EditorManager.HelpSystem = new HelpSystem();

              //
              // Required for Windows Form Designer support
              //
              InitializeComponent();
              InitializeMyComponent(); // init the engine view

              this.statusPanel_Main.Click += statusPanel_Main_Click;
              this.statusPanel_Main.MouseEnter += statusPanel_Main_MouseEnter;
              this.statusPanel_Main.MouseLeave += statusPanel_Main_MouseLeave;

              // Init help button
              _helpLanguageToolStripMenuItem = new SelectHelpLanguageMenuItem();
              Menu_Help.DropDownItems.Add(_helpLanguageToolStripMenuItem);

              // We have to call the update titlebar here so we have the DX11 flag in the titlebar
              EditorApp.UpdateTitleBar();

              // remove the 'Tests' menu if the Test data directory is not available, i.e. when vForge is shipped
              if (!TestManager.Helpers.TestDataDirExists)
              {
            Menu_Help.DropDownItems.Remove(reloadHelpContextFilesToolStripMenuItem);
            this.mainMenu.Items.Remove(Menu_Tests);
              }

              // Initialize managed framework
              ManagedFramework.ManagedFramework.OneTimeInit();

              // Initialize editor plugins
              EditorManager.InitPlugins(Application.StartupPath);

              EditorManager.EngineManager.SetExecutablePath(Path.GetFullPath(Application.StartupPath));
              EditorManager.EngineManager.SetSDKPath(Path.GetFullPath(Application.StartupPath + @"\..\..\..\..\"));

              UpdateToolbars();

              EditorManager.Actions.ActionEvent += new ActionEventHandler(Actions_ActionEvent);
              EditorManager.SceneChanged += new SceneChangedEventHandler(EditorManager_SceneChanged);
              EditorManager.EditorModeChanged += new EditorModeChangedEventHandler(EditorManager_EditorModeChanged);
              EditorManager.ShapeSelectionChanged += new ShapeSelectionChangedEventHandler(EditorManager_ShapeSelectionChanged);
              EditorManager.ApplicationLayout.ActiveLayoutChanged += new LayoutManager.ActiveLayoutChangedEventHandler(ApplicationLayout_ActiveLayoutChanged);
              EditorManager.ApplicationLayout.AvailableLayoutsChanged += new CSharpFramework.Layout.LayoutManager.AvailableLayoutsChangedEventHandler(ApplicationLayout_AvailableLayoutsChanged);
              EditorManager.BeforeEditorAppShutdown += new EditorAppShutdownEventHandler(EditorManager_BeforeEditorAppShutdown);
              Load += new EventHandler(Form1_Load);
              IVisibilityBuilder.OnVisibilityStatusChanged += new EventHandler(IVisibilityBuilder_OnVisibilityStatusChanged);
              IVisibilityBuilder.OnVisibilityUseInEngineChanged += new EventHandler(IVisibilityBuilder_OnVisibilityUseInEngineChanged);
              IScene.OnDirtyFlagChanged += new EventHandler(IScene_OnDirtyFlagChanged);
              Application.Idle += new EventHandler(Application_Idle);

              Scene2DView.RelevantObjects.Add(ZoneActionProvider.ACTION_PROVIDER); // register one global instance

              // Initialize Remote Manager
              _pGlobalLogHandler.SetForm1(this);
              GlobalLog.AddLogWriter(_pGlobalLogHandler);

              InitializeRemoteManager();

              // Set up the status bar
              _statusbar_LogMsg            = new System.Drawing.Font(statusPanel_Main.Font.FontFamily, ((float)statusPanel_Main.Font.SizeInPoints), FontStyle.Bold                      , GraphicsUnit.Point);
              _statusbar_LogMsg_Hover      = new System.Drawing.Font(statusPanel_Main.Font.FontFamily, ((float)statusPanel_Main.Font.SizeInPoints), FontStyle.Underline | FontStyle.Bold, GraphicsUnit.Point);
              _statusbar_DefaultText       = new System.Drawing.Font(statusPanel_Main.Font.FontFamily, ((float)statusPanel_Main.Font.SizeInPoints), FontStyle.Regular                   , GraphicsUnit.Point);
              _statusbar_DefaultText_Hover = new System.Drawing.Font(statusPanel_Main.Font.FontFamily, ((float)statusPanel_Main.Font.SizeInPoints), FontStyle.Underline                 , GraphicsUnit.Point);

              ResourceViewerPanel.AddOnClearLogMessagesHandler(new vResourceViewerBase80.Controls.MasterPanel.ClearLogMessagesDelegate(LogMessagesCleared));

              _updateStatusBarTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnLogMsgTimeOut);
              _updateStatusBarTimer.AutoReset = true;

              UpdateStatusBar();

              // special case shapes
              if (EditorManager.Settings.ExposeVisibilityShapes)
              {
            EditorManager.ShapeCreatorPlugins.Add(new VisibilityZoneShapeCreator());
            EditorManager.ShapeCreatorPlugins.Add(new VisibilityZoneShapeCreator_HallwayX());
            EditorManager.ShapeCreatorPlugins.Add(new VisibilityZoneShapeCreator_HallwayY());
            EditorManager.ShapeCreatorPlugins.Add(new VisibilityZoneShapeCreator_Room());
            EditorManager.ShapeCreatorPlugins.Add(new PortalShapeCreator());

              }

              // hotkeys:
              ShortCutConfig shortcuts = EditorManager.ShortCuts;
              shortcuts.Add(new GizmoModeShortCut(Keys.W, ShapeDragMode.MOVE, false));
              shortcuts.Add(new GizmoModeShortCut(Keys.E, ShapeDragMode.ROTATE, false));
              shortcuts.Add(new GizmoModeShortCut(Keys.R, ShapeDragMode.UNIFORMSCALE, false));
              shortcuts.Add(new GizmoModeShortCut(Keys.None, ShapeDragMode.LINK, false));
              shortcuts.Add(new GizmoSwitchShortCut(Keys.Q, true, false));
              shortcuts.Add(new GizmoSwitchShortCut(Keys.Shift | Keys.Q, false, false));

              // Alternate gizmo mode shortcuts to use with WASD fly mode controls
              shortcuts.Add(new GizmoModeShortCut(Keys.D1, ShapeDragMode.MOVE, true));
              shortcuts.Add(new GizmoModeShortCut(Keys.D2, ShapeDragMode.ROTATE, true));
              shortcuts.Add(new GizmoModeShortCut(Keys.D3, ShapeDragMode.UNIFORMSCALE, true));
              shortcuts.Add(new GizmoModeShortCut(Keys.D4, ShapeDragMode.LINK, true));
              shortcuts.Add(new GizmoSwitchShortCut(Keys.F1, true, true));
              shortcuts.Add(new GizmoSwitchShortCut(Keys.Shift | Keys.F1, false, true));

            shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MaxStyle));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MayaStyle));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MiddleMouseOrbitSelection));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MiddleMousePan));
              shortcuts.Add(new CameraStyleShortCut(Keys.None, EditorSettingsBase.CameraStyle_e.MiddleMousePanHorizontal));
              shortcuts.Add(new ShapeSelectionModeShortCut(Keys.None, EditorSettingsBase.ShapeSelectionMode_e.ActiveLayer));
              shortcuts.Add(new ShapeSelectionModeShortCut(Keys.None, EditorSettingsBase.ShapeSelectionMode_e.All));
              shortcuts.Add(new ShapeSelectionModeShortCut(Keys.None, EditorSettingsBase.ShapeSelectionMode_e.VisibleLayer));
              shortcuts.Add(new ToggleLocalOrientation(Keys.None));
              shortcuts.Add(new PerspectiveModeShortCut(VisionViewBase.ProjectionMode_e.Perspective, Keys.None));
              shortcuts.Add(new PerspectiveModeShortCut(VisionViewBase.ProjectionMode_e.Top, Keys.None));
              shortcuts.Add(new PerspectiveModeShortCut(VisionViewBase.ProjectionMode_e.Front, Keys.None));
              shortcuts.Add(new PerspectiveModeShortCut(VisionViewBase.ProjectionMode_e.Right, Keys.None));

              shortcuts.Add(new MenuItemShortCut(Menu_File_New_Scene, Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_File_Open_Scene, Keys.Control | Keys.O));
              shortcuts.Add(new MenuItemShortCut(Menu_File_Save_Scene, Keys.Control | Keys.S));
              shortcuts.Add(new MenuItemShortCut(Menu_File_Save_SceneAs, Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_File_Export_Scene, Keys.Control | Keys.E));
              shortcuts.Add(new MenuItemShortCut(Menu_Edit_FindShapes, Keys.Control | Keys.F));
              shortcuts.Add(new MenuItemShortCut(Menu_Play_Animate, Keys.F5));
              shortcuts.Add(new MenuItemShortCut(Menu_Play_RunInEditor, Keys.Shift | Keys.F5));
              shortcuts.Add(new MenuItemShortCut(Menu_Play_PlayTheGame, Keys.Control | Keys.F5));
              shortcuts.Add(new MenuItemShortCut(Menu_Engine_ReloadResources,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_Engine_SaveScreenshot,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_Engine_ScreenshotSettings,Keys.None));
              shortcuts.Add(new MenuItemShortCut(Menu_StaticLighting_EditSettings, Keys.None));

              shortcuts.Add(new ReservedShortCut("Menu File", Keys.Alt | Keys.F));
              shortcuts.Add(new ReservedShortCut("Menu Edit", Keys.Alt | Keys.E));
              shortcuts.Add(new ReservedShortCut("Menu View", Keys.Alt | Keys.V));
              shortcuts.Add(new ReservedShortCut("Menu Create", Keys.Alt | Keys.C));
              shortcuts.Add(new ReservedShortCut("Menu Play", Keys.Alt | Keys.P));
              shortcuts.Add(new ReservedShortCut("Menu Engine", Keys.Alt | Keys.N));
              shortcuts.Add(new ReservedShortCut("Menu Static Lighting", Keys.Alt | Keys.S));
              shortcuts.Add(new ReservedShortCut("Menu Help", Keys.Alt | Keys.H));
              shortcuts.Add(new ReservedShortCut("Cut", (Keys)Shortcut.CtrlX));
              shortcuts.Add(new ReservedShortCut("Copy", (Keys)Shortcut.CtrlC));
              shortcuts.Add(new ReservedShortCut("Paste", (Keys)Shortcut.CtrlV));
              shortcuts.Add(new ReservedShortCut("Delete", (Keys)Shortcut.Del));
              shortcuts.Add(new ReservedShortCut("Insert", (Keys)Shortcut.Ins));
              shortcuts.Add(new ReservedShortCut("Undo", (Keys)Shortcut.CtrlZ));
              shortcuts.Add(new ReservedShortCut("Redo", (Keys)Shortcut.CtrlY));
              shortcuts.Add(new ReservedShortCut("Select All", (Keys)Shortcut.CtrlA));

              shortcuts.Add(SaveResourceThumbnailShortCut.Instance);

              // Add a message filter for processing the keyboard shortcuts
              _scMsgFilter= new ShortCutMessageFilter();
              Application.AddMessageFilter(_scMsgFilter);

              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Reload Resources", Menu_Engine_ReloadResources);
              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Purge Resources", Menu_Engine_PurgeResources);
              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Save Screenshot", Menu_Engine_SaveScreenshot);
              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Calculate Visibility", Menu_Engine_CalculateVisibility);
              EditorManager.GUI.RecordableControls.Add("Menu->Engine->Use Visibility", Menu_Engine_UseVisibility);

              // register to clipboard notification chain
              nextClipboardChainViewer = SetClipboardViewer(this.Handle);

              // Is GameSolutionCreator available?
              Menu_vGameSolutionCreatorToolStripMenuItem.Enabled = File.Exists(EditorManager.GameSolutionCreatorPath);
        }