void FAssetTypeActions_AnimationAsset::RetargetNonSkeletonAnimationHandler(USkeleton* OldSkeleton, USkeleton* NewSkeleton, bool bRemapReferencedAssets, bool bConvertSpaces, bool bDuplicateAssets, TArray<TWeakObjectPtr<UObject>> InAnimAssets, TWeakPtr<IToolkitHost> EditWithinLevelEditor) { RetargetAnimationHandler(OldSkeleton, NewSkeleton, bRemapReferencedAssets, bConvertSpaces, bDuplicateAssets, InAnimAssets); if(NewSkeleton) { for(auto Asset : InAnimAssets) { if (Asset.IsValid()) { const bool bBringToFrontIfOpen = false; if(IAssetEditorInstance* EditorInstance = FAssetEditorManager::Get().FindEditorForAsset(NewSkeleton, bBringToFrontIfOpen)) { // The skeleton is already open in an editor. // Tell persona that an animation asset was requested EditorInstance->FocusWindow(Asset.Get()); } else { EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone; TSharedPtr<IToolkitHost> EditWithInEditor = EditWithinLevelEditor.IsValid()? EditWithinLevelEditor.Pin() : NULL; FPersonaModule& PersonaModule = FModuleManager::LoadModuleChecked<FPersonaModule>("Persona"); PersonaModule.CreatePersona(Mode, EditWithInEditor, NewSkeleton, NULL, Cast<UAnimationAsset>(Asset.Get()), NULL); } } } } else { FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("FailedToLoadSkeletonlessAnimAsset", "The Anim Asset could not be loaded because it's skeleton is missing.")); } }
void FDistanceFieldBuildNotificationImpl::Tick(float DeltaTime) { if (GDistanceFieldAsyncQueue) { // Trigger a new notification if we are doing an async build, and we haven't displayed the notification recently if (GDistanceFieldAsyncQueue->GetNumOutstandingTasks() > 0 && !DistanceFieldNotificationPtr.IsValid() && (FPlatformTime::Seconds() - LastEnableTime) > 5) { DistanceFieldBuildStarted(); } // Disable the notification when we are no longer doing an async compile else if (GDistanceFieldAsyncQueue->GetNumOutstandingTasks() == 0 && DistanceFieldNotificationPtr.IsValid()) { DistanceFieldBuildFinished(); } else if (GDistanceFieldAsyncQueue->GetNumOutstandingTasks() > 0 && DistanceFieldNotificationPtr.IsValid()) { TSharedPtr<SNotificationItem> NotificationItem = DistanceFieldNotificationPtr.Pin(); if (NotificationItem.IsValid()) { FFormatNamedArguments Args; Args.Add( TEXT("BuildTasks"), FText::AsNumber( GDistanceFieldAsyncQueue->GetNumOutstandingTasks() ) ); FText ProgressMessage = FText::Format(NSLOCTEXT("DistanceFieldBuild", "DistanceFieldBuildInProgressFormat", "Building Mesh Distance Fields ({BuildTasks})"), Args); NotificationItem->SetText( ProgressMessage ); } } } }
EVisibility SMultiBoxWidget::GetCustomizationVisibility( TWeakPtr<const FMultiBlock> BlockWeakPtr, TWeakPtr<SWidget> BlockWidgetWeakPtr ) const { if( MultiBox->IsInEditMode() && BlockWidgetWeakPtr.IsValid() && BlockWeakPtr.IsValid() && (!DragPreview.PreviewBlock.IsValid() || BlockWeakPtr.Pin() != DragPreview.PreviewBlock->GetActualBlock() ) ) { // If in edit mode and this is not the block being dragged, the customization widget should be visible if the default block beging customized would have been visible return BlockWeakPtr.Pin()->GetAction().IsValid() && BlockWidgetWeakPtr.Pin()->GetVisibility() == EVisibility::Visible ? EVisibility::Visible : EVisibility::Collapsed; } else { return EVisibility::Collapsed; } }
bool FPropertyEditorToolkit::IsExposedAsColumn( const TWeakPtr< IPropertyTreeRow >& Row ) const { bool Result = false; if (Row.IsValid()) { const TSharedPtr< FPropertyPath > RowPathPtr = Row.Pin()->GetPropertyPath(); if ( RowPathPtr.IsValid() ) { TSharedRef< FPropertyPath > TrimmedPath = RowPathPtr->TrimRoot( PropertyTable->GetRootPath()->GetNumProperties() ); const TSet< TSharedRef< IPropertyTableRow > > SelectedRows = PropertyTable->GetSelectedRows(); for( auto RowIter = SelectedRows.CreateConstIterator(); RowIter; ++RowIter ) { TrimmedPath = TrimmedPath->TrimRoot( (*RowIter)->GetPartialPath()->GetNumProperties() ); break; } for (int Index = 0; Index < PropertyPathsAddedAsColumns.Num(); Index++) { if ( FPropertyPath::AreEqual( TrimmedPath, PropertyPathsAddedAsColumns[ Index ] ) ) { Result = true; break; } } } } return Result; }
/** * An analytics hook, for tracking when a node was spawned from the palette * (updates the "node creation stats" with a palette drag-placement flag). * * @param BlueprintEditorPtr A pointer to the blueprint editor currently being worked in. */ static void OnNodePlacement(TWeakPtr<FBlueprintEditor> BlueprintEditorPtr) { if( BlueprintEditorPtr.IsValid() ) { BlueprintEditorPtr.Pin()->UpdateNodeCreationStats( ENodeCreateAction::PaletteDragPlacement ); } }
//------------------------------------------------------------------------------ void FFauxStandaloneToolManager::Tick(float DeltaTime) { if (MainEditorWindow.IsValid()) { FSlateApplication& WindowManager = FSlateApplication::Get(); TArray< TSharedRef<SWindow> > ActiveWindows = WindowManager.GetInteractiveTopLevelWindows(); bool bVisibleWindowFound = false; for (TSharedRef<SWindow> Window : ActiveWindows) { if (Window->IsVisible()) { bVisibleWindowFound = true; break; } } if (!bVisibleWindowFound) { EditorCommandLineUtilsImpl::ForceCloseEditor(); } } else { EditorCommandLineUtilsImpl::ForceCloseEditor(); } }
//------------------------------------------------------------------------------ void FFauxStandaloneToolManager::Disable() { if (MainEditorWindow.IsValid()) { MainEditorWindow.Pin()->ShowWindow(); } }
FGameplayTagNode::FGameplayTagNode(FName InTag, TWeakPtr<FGameplayTagNode> InParentNode, FText InCategoryDescription) : Tag(InTag) , CompleteTag(NAME_None) , CategoryDescription(InCategoryDescription) , ParentNode(InParentNode) { TArray<FName> Tags; Tags.Add(InTag); TWeakPtr<FGameplayTagNode> CurNode = InParentNode; while (CurNode.IsValid()) { Tags.Add(CurNode.Pin()->GetSimpleTag()); CurNode = CurNode.Pin()->GetParentTagNode(); } FString CompleteTagString; for (int32 TagIdx = Tags.Num() - 1; TagIdx >= 0; --TagIdx) { CompleteTagString += Tags[TagIdx].ToString(); if (TagIdx > 0) { CompleteTagString += TEXT("."); } } CompleteTag = FName(*CompleteTagString); }
bool SGraphPanel::IsNodeTitleVisible(const class UEdGraphNode* Node, bool bRequestRename) { bool bTitleVisible = false; TSharedRef<SNode>* pWidget = NodeToWidgetLookup.Find(Node); if (pWidget != NULL) { TWeakPtr<SGraphNode> GraphNode = StaticCastSharedRef<SGraphNode>(*pWidget); if(GraphNode.IsValid() && !HasMouseCapture()) { FSlateRect TitleRect = GraphNode.Pin()->GetTitleRect(); const FVector2D TopLeft = FVector2D( TitleRect.Left, TitleRect.Top ); const FVector2D BottomRight = FVector2D( TitleRect.Right, TitleRect.Bottom ); if( IsRectVisible( TopLeft, BottomRight )) { bTitleVisible = true; } else if( bRequestRename ) { bTitleVisible = JumpToRect( TopLeft, BottomRight ); } if( bTitleVisible && bRequestRename ) { GraphNode.Pin()->RequestRename(); SelectAndCenterObject(Node, false); } } } return bTitleVisible; }
//------------------------------------------------------------------------------ TSharedPtr<FGraphActionNode> FGraphActionNode::NewGroupDividerNode(TWeakPtr<FGraphActionNode> Parent, int32 Grouping) { FGraphActionNode* DividerNode = new FGraphActionNode(Grouping, INVALID_SECTION_ID); DividerNode->ParentNode = Parent; checkSlow(Parent.IsValid()); return MakeShareable(DividerNode); }
void UMatineeTrackVectorPropHelper::OnCreateTrackTextEntry(const FString& ChosenText, TWeakPtr<SWindow> Window, FString* OutputString) { *OutputString = ChosenText; if( Window.IsValid() ) { Window.Pin()->RequestDestroyWindow(); } }
FReply FPropertyEditorToolkit::OnToggleColumnClicked( const TWeakPtr< IPropertyTreeRow > Row ) { if (Row.IsValid()) { ToggleColumnForProperty( Row.Pin()->GetPropertyPath() ); } return FReply::Handled(); }
FReply FLightmapCustomNodeBuilder::OnLightMapListMouseButtonDoubleClick(const FGeometry& MyGeom, const FPointerEvent& PointerEvent, TWeakPtr<FLightmapItem> SelectedLightmap) { if ( ensure(SelectedLightmap.IsValid()) ) { ExecuteViewLightmap(SelectedLightmap.Pin()->ObjectPath); } return FReply::Handled(); }
FReply STimelineLabelAnchor::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { if (MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && TimelineOwner.IsValid() && TimelineOwner.Pin()->IsSelected()) { SetIsOpen(!IsOpen()); return FReply::Handled(); } return FReply::Unhandled(); }
FSlateColor FPropertyEditorToolkit::GetPinColorAndOpacity( const TWeakPtr< IPropertyTreeRow > Row ) const { if ( Row.IsValid() && ( Row.Pin()->IsCursorHovering() || IsExposedAsColumn( Row ) ) ) { return FSlateColor( FLinearColor::White ); } return PinColor; }
void UInterpTrackAkAudioEventHelper::OnAkEventSet(UAkAudioEvent * in_SelectedAkEvent, const FString& in_AkEventName, IMatineeBase *InterpEd, UInterpTrack * ActiveTrack) { if (EntryMenu.IsValid()) { EntryMenu.Pin()->Dismiss(); } SelectedAkEvent = in_SelectedAkEvent; SelectedAkEventName = in_AkEventName; InterpEd->FinishAddKey(ActiveTrack, true); }
void UMatineeTrackToggleHelper::OnAddKeyTextEntry(const FString& ChosenText, IMatineeBase* Matinee, UInterpTrack* Track) { if (EntryPopupWindow.IsValid()) { EntryPopupWindow.Pin()->RequestDestroyWindow(); } KeyframeAddDataName = FName(*ChosenText); Matinee->FinishAddKey(Track,true); }
FReply SMultiBoxWidget::OnDeleteBlockClicked( TWeakPtr<const FMultiBlock> BlockWeakPtr ) { if( BlockWeakPtr.IsValid() ) { MultiBox->RemoveCustomMultiBlock( BlockWeakPtr.Pin().ToSharedRef() ); BuildMultiBoxWidget(); } return FReply::Handled(); }
void UMatineeTrackToggleHelper::OnAddKeyTextEntry(const FString& ChosenText, IMatineeBase* Matinee, UInterpTrack* Track) { if (EntryMenu.IsValid()) { EntryMenu.Pin()->Dismiss(); } KeyframeAddDataName = FName(*ChosenText); Matinee->FinishAddKey(Track,true); }
//------------------------------------------------------------------------------ TSharedPtr<FGraphActionNode> FGraphActionNode::NewSectionHeadingNode(TWeakPtr<FGraphActionNode> Parent, int32 Grouping, int32 SectionID) { checkSlow(SectionID != INVALID_SECTION_ID); FGraphActionNode* SectionNode = new FGraphActionNode(Grouping, SectionID); SectionNode->ParentNode = Parent; checkSlow(Parent.IsValid()); return MakeShareable(SectionNode); }
void SFindInBT::MatchTokens(const TArray<FString>& Tokens) { RootSearchResult.Reset(); TWeakPtr<SGraphEditor> FocusedGraphEditor = BehaviorTreeEditorPtr.Pin()->GetFocusedGraphPtr(); UEdGraph* Graph = NULL; if (FocusedGraphEditor.IsValid()) { Graph = FocusedGraphEditor.Pin()->GetCurrentGraph(); } if (Graph == NULL) { return; } RootSearchResult = FSearchResult(new FFindInBTResult(FString("BehaviorTreeRoot"))); for (auto It(Graph->Nodes.CreateConstIterator()); It; ++It) { UEdGraphNode* Node = *It; const FString NodeName = Node->GetNodeTitle(ENodeTitleType::ListView).ToString(); FSearchResult NodeResult(new FFindInBTResult(NodeName, RootSearchResult, Node)); FString NodeSearchString = NodeName + Node->GetClass()->GetName() + Node->NodeComment; NodeSearchString = NodeSearchString.Replace(TEXT(" "), TEXT("")); bool bNodeMatchesSearch = StringMatchesSearchTokens(Tokens, NodeSearchString); UBehaviorTreeGraphNode* BTNode = Cast<UBehaviorTreeGraphNode>(Node); if (BTNode) { // searching through nodes' decorators for (auto DecoratorIt(BTNode->Decorators.CreateConstIterator()); DecoratorIt; ++DecoratorIt) { UBehaviorTreeGraphNode* Decorator = *DecoratorIt; MatchTokensInChild(Tokens, Decorator, NodeResult); } // searching through nodes' services for (auto ServiceIt(BTNode->Services.CreateConstIterator()); ServiceIt; ++ServiceIt) { UBehaviorTreeGraphNode* Service = *ServiceIt; MatchTokensInChild(Tokens, Service, NodeResult); } } if ((NodeResult->Children.Num() > 0) || bNodeMatchesSearch) { NodeResult->SetNodeHighlight(true); ItemsFound.Add(NodeResult); } } }
FSlateColor SPropertyEditorAsset::GetAssetClassColor() { FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools")); TWeakPtr<IAssetTypeActions> AssetTypeActions = AssetToolsModule.Get().GetAssetTypeActionsForClass(GetDisplayedClass()); if(AssetTypeActions.IsValid()) { return FSlateColor(AssetTypeActions.Pin()->GetTypeColor()); } return FSlateColor::UseForeground(); }
void FPrimitiveStatsPage::OnEditorNewCurrentLevel( TWeakPtr< IStatsViewer > InParentStatsViewer ) { if(InParentStatsViewer.IsValid()) { int32 ObjectSetIndex = InParentStatsViewer.Pin()->GetObjectSetIndex(); if( ObjectSetIndex == PrimitiveObjectSets_CurrentLevel ) { InParentStatsViewer.Pin()->Refresh(); } } }
void FPrimitiveStatsPage::OnEditorSelectionChanged( UObject* NewSelection, TWeakPtr< IStatsViewer > InParentStatsViewer ) { if(InParentStatsViewer.IsValid()) { int32 ObjectSetIndex = InParentStatsViewer.Pin()->GetObjectSetIndex(); if( ObjectSetIndex == PrimitiveObjectSets_SelectedObjects ) { InParentStatsViewer.Pin()->Refresh(); } } }
void FStaticMeshLightingInfoStatsPage::OnEditorLevelSelected( TWeakPtr<IStatsViewer> InParentStatsViewer ) { if(InParentStatsViewer.IsValid()) { int32 ObjectSetIndex = InParentStatsViewer.Pin()->GetObjectSetIndex(); if( ObjectSetIndex == StaticMeshLightingInfoObjectSets_SelectedLevels ) { InParentStatsViewer.Pin()->Refresh(); } } }
void UMatineeTrackAnimControlHelper::OnAddKeyTextEntry(const FAssetData& AssetData, IMatineeBase* Matinee, UInterpTrack* Track) { if( EntryPopupWindow.IsValid() ) { EntryPopupWindow.Pin()->RequestDestroyWindow(); } KeyframeAddAnimSequence = CastChecked<UAnimSequence>(AssetData.GetAsset()); Matinee->FinishAddKey(Track,true); }
void SViewportToolBarIconMenu::OnMouseEnter( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { // See if there is another menu on the same tool bar already open TWeakPtr<SMenuAnchor> OpenedMenu = ParentToolBar.Pin()->GetOpenMenu(); if( OpenedMenu.IsValid() && OpenedMenu.Pin()->IsOpen() && OpenedMenu.Pin() != MenuAnchor ) { // There is another menu open so we open this menu and close the other ParentToolBar.Pin()->SetOpenMenu( MenuAnchor ); MenuAnchor->SetIsOpen( true ); } }
void ShowNotification(FText Text, SNotificationItem::ECompletionState State = SNotificationItem::CS_Fail) { FNotificationInfo Info(Text); Info.bFireAndForget = true; Info.FadeOutDuration = 1.0f; Info.ExpireDuration = 2.0f; TWeakPtr<SNotificationItem> NotificationPtr = FSlateNotificationManager::Get().AddNotification(Info); if (NotificationPtr.IsValid()) { NotificationPtr.Pin()->SetCompletionState(State); } }
void FIntroTutorials::LaunchTutorial(UEditorTutorial* InTutorial, ETutorialStartType InStartType, TWeakPtr<SWindow> InNavigationWindow, FSimpleDelegate OnTutorialClosed, FSimpleDelegate OnTutorialExited) { if(TutorialRoot.IsValid()) { if(!InNavigationWindow.IsValid()) { IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame")); InNavigationWindow = MainFrameModule.GetParentWindow(); } TutorialRoot->LaunchTutorial(InTutorial, InStartType, InNavigationWindow, OnTutorialClosed, OnTutorialExited); } }
void FStaticMeshLightingInfoStatsPage::GetUserSetStaticLightmapResolution(TWeakPtr<IStatsViewer> InParentStatsViewer, bool bSwap) const { if(InParentStatsViewer.IsValid()) { int32 DefaultRes = 0; verify(GConfig->GetInt(TEXT("DevOptions.StaticLighting"), TEXT("DefaultStaticMeshLightingRes"), DefaultRes, GLightmassIni)); TSharedRef<STextEntryPopup> TextEntry = SNew(STextEntryPopup) .Label(LOCTEXT("StaticMeshLightingInfo_GetResolutionTitle", "Enter Lightmap Resolution")) .HintText(LOCTEXT("StaticMeshLightingInfo_GetResolutionToolTip", "Will round to power of two")) .DefaultText(FText::AsNumber(DefaultRes)) .OnTextCommitted( FOnTextCommitted::CreateSP( this, &FStaticMeshLightingInfoStatsPage::OnResolutionCommitted, InParentStatsViewer, bSwap ) ) .ClearKeyboardFocusOnCommit( false ); ResolutionEntryPopupWindow = FSlateApplication::Get().PushMenu( InParentStatsViewer.Pin().ToSharedRef(), TextEntry, FSlateApplication::Get().GetCursorPos(), FPopupTransitionEffect( FPopupTransitionEffect::TypeInPopup ) ); TextEntry->FocusDefaultWidget(); } }