在不知道什么版本的UE推出的ToolMenus模块,这个模块主要工作就是像它的名字一样,用来创建和管理编辑器菜单的工具。在此之前UE编辑器的扩展方式需要先加载想添加的模块,在找到对应的变量或函数进行修改。而ToolMenus的出现就是为了简化这一流程,
关于UToolMenus的开发与样例代码网上已经有非常多了,此处不再赘述。
因官方没有提供ToolMenus的扩展路径,所以这里我们需要自己来获取:
原理通过反射将初始化过的所有菜单都保存到文件中:
static void PrintAllMenus() { FMapProperty* MapProp = FindFProperty<FMapProperty>(UToolMenus::StaticClass(), FName("Menus")); TMap<FName, TObjectPtr<UToolMenu>>* MapValuePtr = MapProp->ContainerPtrToValuePtr<TMap<FName, TObjectPtr<UToolMenu>>>(UToolMenus::Get()); TArray<FName> Out; MapValuePtr->GetKeys(Out); Out.Sort(); FString Str; for (auto Item : Out) { Str += Item.ToString(); Str += TEXT('\n'); } FFileHelper::SaveStringToFile(Str, TEXT("D:/a.txt")); }
这里简单列举几个比较常用的路径
AssetEditor.AnimationEditor.ToolBar 动画编辑器工具栏 AssetEditor.BlueprintEditor.ToolBar 蓝图编辑器工具栏 AssetEditor.MaterialEditor.ToolBar 材质编辑器工具栏 AssetEditor.SkeletalMeshEditor.ToolBar 骨骼网格体编辑器工具栏 AssetEditor.SkeletonEditor.ToolBar 骨骼编辑器工具栏 AssetEditor.StaticMeshEditor.ToolBar 网格编辑器工具栏 ContentBrowser.ToolBar 内容浏览器工具栏 LevelEditor.LevelEditorToolBar 关卡编辑器工具栏 LevelEditor.MainMenu 关卡编辑器主菜单
更多但也不是全部的路径:
AnimationEditorApp.ToolBar AssetEditor.AnimationEditor.MainMenu AssetEditor.AnimationEditor.MainMenu.File AssetEditor.AnimationEditor.MainMenu.Help AssetEditor.AnimationEditor.ToolBar AssetEditor.AnimationEditor.ToolBar.AnimationEditorMode AssetEditor.BlueprintEditor.MainMenu AssetEditor.BlueprintEditor.MainMenu.Edit AssetEditor.BlueprintEditor.MainMenu.File AssetEditor.BlueprintEditor.MainMenu.Help AssetEditor.BlueprintEditor.ToolBar AssetEditor.BlueprintEditor.ToolBar.GraphName AssetEditor.DefaultToolBar AssetEditor.MaterialEditor.MainMenu AssetEditor.MaterialEditor.MainMenu.File AssetEditor.MaterialEditor.MainMenu.Help AssetEditor.MaterialEditor.ToolBar AssetEditor.MaterialEditor.ToolBar.GraphName AssetEditor.SkeletalMeshEditor.ToolBar AssetEditor.SkeletonEditor.MainMenu AssetEditor.SkeletonEditor.MainMenu.File AssetEditor.SkeletonEditor.MainMenu.Help AssetEditor.SkeletonEditor.ToolBar AssetEditor.SkeletonEditor.ToolBar.SkeletonEditorMode AssetEditor.StaticMeshEditor.MainMenu AssetEditor.StaticMeshEditor.MainMenu.File AssetEditor.StaticMeshEditor.MainMenu.Help AssetEditor.StaticMeshEditor.ToolBar BlueprintEditorApp.ToolBar ContentBrowser.AddNewContextMenu ContentBrowser.AssetContextMenu ContentBrowser.AssetContextMenu.AimOffsetBlendSpace ContentBrowser.AssetContextMenu.AnimationAsset ContentBrowser.AssetContextMenu.AnimBlueprint ContentBrowser.AssetContextMenu.AnimCompositeBase ContentBrowser.AssetContextMenu.AnimMontage ContentBrowser.AssetContextMenu.AnimSequence ContentBrowser.AssetContextMenu.AnimSequenceBase ContentBrowser.AssetContextMenu.BlendSpace ContentBrowser.AssetContextMenu.BlendSpace1D ContentBrowser.AssetContextMenu.Blueprint ContentBrowser.AssetContextMenu.BlueprintCore ContentBrowser.AssetContextMenu.CameraAnim ContentBrowser.AssetContextMenu.EditorUtilityBlueprint ContentBrowser.AssetContextMenu.LevelSequence ContentBrowser.AssetContextMenu.Material ContentBrowser.AssetContextMenu.MaterialInterface ContentBrowser.AssetContextMenu.MovieSceneSequence ContentBrowser.AssetContextMenu.MovieSceneSignedObject ContentBrowser.AssetContextMenu.Object ContentBrowser.AssetContextMenu.PoseAsset ContentBrowser.AssetContextMenu.SkeletalMesh.CreateSkeletalMeshSubmenu ContentBrowser.AssetContextMenu.Skeleton.CreateSkeletalMeshSubmenu ContentBrowser.AssetContextMenu.SoundWave ContentBrowser.AssetContextMenu.StaticMesh ContentBrowser.AssetContextMenu.StreamableRenderAsset ContentBrowser.AssetContextMenu.World ContentBrowser.AssetViewOptions ContentBrowser.AssetViewOptions.PathViewFilters ContentBrowser.DragDropContextMenu ContentBrowser.FolderContextMenu ContentBrowser.ToolBar ControlRigEditor.RigHierarchy.ContextMenu.New ControlRigEditor.RigHierarchy.DragDropMenu.Align ControlRigEditor.RigHierarchy.DragDropMenu.Align.Translation EditorSettingsViewer.LevelEditorPlaySettings GraphEditor.GraphContextMenu.Common GraphEditor.GraphContextMenu.EdGraphSchema GraphEditor.GraphContextMenu.EdGraphSchema_K2 GraphEditor.GraphContextMenu.MaterialGraphSchema GraphEditor.GraphNodeContextMenu.K2Node_CallFunction GraphEditor.GraphNodeContextMenu.MaterialGraphNode GraphEditor.GraphNodeContextMenu.MaterialGraphNode_Root LevelEditor.ActorContextMenu LevelEditor.ActorContextMenu.AssetToolsSubMenu LevelEditor.ActorContextMenu.LevelSubMenu LevelEditor.ComponentContextMenu LevelEditor.ElementContextMenu LevelEditor.EmptySelectionContextMenu LevelEditor.InViewportPanel LevelEditor.LevelEditorSceneOutliner.ContextMenu LevelEditor.LevelEditorSceneOutliner.ContextMenu.LevelSubMenu LevelEditor.LevelEditorToolBar LevelEditor.LevelEditorToolBar.AddQuickMenu LevelEditor.LevelEditorToolBar.AssetsToolBar LevelEditor.LevelEditorToolBar.Cinematics LevelEditor.LevelEditorToolBar.LevelToolbarQuickSettings LevelEditor.LevelEditorToolBar.ModesToolBar LevelEditor.LevelEditorToolBar.OpenBlueprint LevelEditor.LevelEditorToolBar.PlayToolBar LevelEditor.LevelEditorToolBar.SettingsToolbar LevelEditor.LevelEditorToolBar.User LevelEditor.LevelViewportToolBar.Options LevelEditor.MainMenu LevelEditor.MainMenu.Build LevelEditor.MainMenu.Build.LightingInfo LevelEditor.MainMenu.Build.LightingInfo.LightingDensity LevelEditor.MainMenu.Build.LightingInfo.LightingResolution LevelEditor.MainMenu.Build.LightingQuality LevelEditor.MainMenu.Edit LevelEditor.MainMenu.File LevelEditor.MainMenu.Help LevelEditor.MainMenu.Select LevelEditor.MainMenu.Tools LevelEditor.MainMenu.Window LevelEditor.MenuBarEmptyContextMenu LevelEditor.SceneOutlinerContextMenu LevelEditor.StatusBar.ToolBar LevelEditor.StatusBar.ToolBar.CompileComboButton MainFrame.MainMenu MainFrame.MainMenu.Asset MainFrame.MainMenu.Edit MainFrame.MainMenu.File MainFrame.MainMenu.Help MainFrame.MainMenu.Tools MainFrame.MainMenu.Window MainFrame.MainTabMenu.File MainFrame.NomadMainMenu MaterialEditorApp.ToolBar MediaPlayer.AssetPickerAssetContextMenu SceneOutliner.DefaultContextMenu SceneOutliner.DefaultContextMenuBase SkeletonEditorApp.ToolBar StaticMeshEditorApp.ToolBar UnrealEd.PlayWorldCommands.PlatformsMenu UnrealEd.PlayWorldCommands.PlayMenu
文章评论