void FWidgetBlueprintEditor::RegisterApplicationModes(const TArray<UBlueprint*>& InBlueprints, bool bShouldOpenInDefaultsMode, bool bNewlyCreated/* = false*/) { //FBlueprintEditor::RegisterApplicationModes(InBlueprints, bShouldOpenInDefaultsMode); if ( InBlueprints.Num() == 1 ) { TSharedPtr<FWidgetBlueprintEditor> ThisPtr(SharedThis(this)); // Create the modes and activate one (which will populate with a real layout) TArray< TSharedRef<FApplicationMode> > TempModeList; TempModeList.Add(MakeShareable(new FWidgetDesignerApplicationMode(ThisPtr))); TempModeList.Add(MakeShareable(new FWidgetGraphApplicationMode(ThisPtr))); for ( TSharedRef<FApplicationMode>& AppMode : TempModeList ) { AddApplicationMode(AppMode->GetModeName(), AppMode); } SetCurrentMode(FWidgetBlueprintApplicationModes::DesignerMode); } else { //// We either have no blueprints or many, open in the defaults mode for multi-editing //AddApplicationMode( // FBlueprintEditorApplicationModes::BlueprintDefaultsMode, // MakeShareable(new FBlueprintDefaultsApplicationMode(SharedThis(this)))); //SetCurrentMode(FBlueprintEditorApplicationModes::BlueprintDefaultsMode); } }
void FSkeletonEditor::InitSkeletonEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, USkeleton* InSkeleton) { Skeleton = InSkeleton; FPersonaModule& PersonaModule = FModuleManager::LoadModuleChecked<FPersonaModule>("Persona"); PersonaToolkit = PersonaModule.CreatePersonaToolkit(InSkeleton); PersonaToolkit->GetPreviewScene()->SetDefaultAnimationMode(EPreviewSceneDefaultAnimationMode::ReferencePose); TSharedRef<IAssetFamily> AssetFamily = PersonaModule.CreatePersonaAssetFamily(InSkeleton); AssetFamily->RecordAssetOpened(FAssetData(InSkeleton)); FSkeletonTreeArgs SkeletonTreeArgs(OnPostUndo); SkeletonTreeArgs.OnObjectSelected = FOnObjectSelected::CreateSP(this, &FSkeletonEditor::HandleObjectSelected); SkeletonTreeArgs.PreviewScene = PersonaToolkit->GetPreviewScene(); ISkeletonEditorModule& SkeletonEditorModule = FModuleManager::GetModuleChecked<ISkeletonEditorModule>("SkeletonEditor"); SkeletonTree = SkeletonEditorModule.CreateSkeletonTree(PersonaToolkit->GetSkeleton(), PersonaToolkit->GetMesh(), SkeletonTreeArgs); const bool bCreateDefaultStandaloneMenu = true; const bool bCreateDefaultToolbar = true; const TSharedRef<FTabManager::FLayout> DummyLayout = FTabManager::NewLayout("NullLayout")->AddArea(FTabManager::NewPrimaryArea()); FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, SkeletonEditorAppIdentifier, DummyLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, InSkeleton); BindCommands(); AddApplicationMode( SkeletonEditorModes::SkeletonEditorMode, MakeShareable(new FSkeletonEditorMode(SharedThis(this), SkeletonTree.ToSharedRef()))); SetCurrentMode(SkeletonEditorModes::SkeletonEditorMode); // set up our editor mode check(AssetEditorModeManager); AssetEditorModeManager->SetDefaultMode(FPersonaEditModes::SkeletonSelection); ExtendMenu(); ExtendToolbar(); RegenerateMenusAndToolbars(); }