void InitMenus() { if (mMenuInitialized) { return; } mMenuInitialized = true; var menuDatas = new Dictionary <string, EditorCommon.Menu.MenuItemDataBase>(); // Toolbar var toolBarMenuData = new EditorCommon.Menu.MenuItemData_ShowHideControl("Toolbar"); toolBarMenuData.MenuNames = new string[] { "Window", "Material Editor|Toolbar" }; toolBarMenuData.Count = 1; toolBarMenuData.OperationControlType = typeof(EditorCommon.ViewPort.ViewPortControl); toolBarMenuData.Icons = new ImageSource[] { new BitmapImage(new Uri("/ResourceLibrary;component/Icons/Icons/icon_tab_Toolbars_40x.png", UriKind.Relative)) }; menuDatas[toolBarMenuData.KeyName] = toolBarMenuData; // Graph var graphMenuData = new EditorCommon.Menu.MenuItemData_ShowHideControl("Graph"); graphMenuData.MenuNames = new string[] { "Window", "Material Editor|Graph" }; graphMenuData.Count = 1; graphMenuData.OperationControlType = typeof(EditorCommon.ViewPort.ViewPortControl); graphMenuData.Icons = new ImageSource[] { new BitmapImage(new Uri("/ResourceLibrary;component/Icons/Icons/icon_Blueprint_EventGraph_24x.png", UriKind.Relative)) }; menuDatas[graphMenuData.KeyName] = graphMenuData; EditorCommon.Menu.GeneralMenuManager.GenerateMenuItems(Menu_Main, menuDatas); EditorCommon.Menu.GeneralMenuManager.Instance.GenerateGeneralMenuItems(Menu_Main); }
void InitMenus() { if (mMenuInitialized) { return; } mMenuInitialized = true; var menuDatas = new Dictionary <string, EditorCommon.Menu.MenuItemDataBase>(); var menuData = new EditorCommon.Menu.MenuItemData_ShowHideControl("Viewport"); menuData.MenuNames = new string[] { "Window", "Level Editor|Viewports", "Viewport" }; menuData.Count = 4; menuData.OperationControlType = typeof(EditorCommon.ViewPort.ViewPortControl); menuData.Icons = new ImageSource[] { new BitmapImage(new Uri("/ResourceLibrary;component/Icons/Icons/icon_tab_Viewports_40x.png", UriKind.Relative)) }; menuDatas[menuData.KeyName] = menuData; EditorCommon.Menu.GeneralMenuManager.GenerateMenuItems(Menu_Main, menuDatas); menuData.BindOperationControl(0, VP1); EditorCommon.Menu.GeneralMenuManager.Instance.GenerateGeneralMenuItems(Menu_Main); var cbData = EditorCommon.Menu.GeneralMenuManager.Instance.GetMenuData("ContentBrowser") as EditorCommon.Menu.MenuItemData_ShowHideControl; cbData?.BindOperationControl(BrowserCtrl.Index, BrowserCtrl); //nodes.BindViewPort(VP1); }
//private void DoTick(object obj, EventArgs e) //{ // CEditorEngine.EditorEngine.MainTick(); //} void InitGeneralMenus() { var dataBase = new EditorCommon.Menu.MenuItemData_ShowHideControl("ContentBrowser"); dataBase.MenuNames = new string[] { "Window", "General|Content Browser", "Content Browser" }; dataBase.Count = 4; dataBase.OperationControlType = typeof(EditorCommon.Controls.ResourceBrowser.BrowserControl); dataBase.Icons = new ImageSource[] { new BitmapImage(new Uri("/ResourceLibrary;component/Icons/Icons/icon_ContentBrowser_40x.png", UriKind.Relative)) }; EditorCommon.Menu.GeneralMenuManager.Instance.RegisterMenuItem(dataBase); var types = EngineNS.Rtti.RttiHelper.GetTypes(); var tt = new List <Type>(types); tt.AddRange(this.GetType().Assembly.GetTypes()); foreach (var type in tt) { foreach (var method in type.GetMethods()) { if (!method.IsStatic) { continue; } var atts = method.GetCustomAttributes(typeof(EngineNS.Editor.Editor_MenuMethod), true); if (atts != null && atts.Length > 0) { var att = atts[0] as EngineNS.Editor.Editor_MenuMethod; var menuData = new EditorCommon.Menu.MenuItemData_Function(method.Name); menuData.MenuNames = att.MenuNames; menuData.Count = 1; menuData.Method = method; EditorCommon.Menu.GeneralMenuManager.Instance.RegisterMenuItem(menuData); } } foreach (var pro in type.GetProperties()) { if (pro.GetMethod == null || pro.SetMethod == null) { continue; } if (!pro.GetMethod.IsStatic || !pro.SetMethod.IsStatic) { continue; } if (pro.PropertyType != typeof(bool)) { continue; } var atts = pro.GetCustomAttributes(typeof(EngineNS.Editor.Editor_MenuMethod), true); if (atts != null && atts.Length > 0) { var att = atts[0] as EngineNS.Editor.Editor_MenuMethod; var menuData = new EditorCommon.Menu.MenuItemData_CheckAble(pro.Name); menuData.MenuNames = att.MenuNames; menuData.Count = 1; menuData.ProInfo = pro; EditorCommon.Menu.GeneralMenuManager.Instance.RegisterMenuItem(menuData); } } } // PVS debug var pvsDataBase = new EditorCommon.Menu.MenuItemData_ShowHideControl("PVSDebugger"); pvsDataBase.MenuNames = new string[] { "Debug", "General|PVSDebugger" }; pvsDataBase.Count = 1; pvsDataBase.OperationControlType = typeof(EditorCommon.Controls.Debugger.PVSDebugger); pvsDataBase.Icons = new ImageSource[] { new BitmapImage(new Uri("/ResourceLibrary;component/Icons/Icons/icon_tab_SceneOutliner_40x.png", UriKind.Relative)) }; EditorCommon.Menu.GeneralMenuManager.Instance.RegisterMenuItem(pvsDataBase); }