本文整理汇总了C++中TSharedRef::AddSlot方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedRef::AddSlot方法的具体用法?C++ TSharedRef::AddSlot怎么用?C++ TSharedRef::AddSlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedRef
的用法示例。
在下文中一共展示了TSharedRef::AddSlot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetContextMenuActions
void UEdGraphSchema::GetContextMenuActions(const UEdGraph* CurrentGraph, const UEdGraphNode* InGraphNode, const UEdGraphPin* InGraphPin, class FMenuBuilder* MenuBuilder, bool bIsDebugging) const
{
#if WITH_EDITOR
FGraphNodeContextMenuBuilder Context(CurrentGraph, InGraphNode, InGraphPin, MenuBuilder, bIsDebugging);
if (Context.Node)
{
Context.Node->GetContextMenuActions(Context);
}
if (InGraphNode)
{
// Helper to do the node comment editing
struct Local
{
// Called by the EditableText widget to get the current comment for the node
static FString GetNodeComment(TWeakObjectPtr<UEdGraphNode> NodeWeakPtr)
{
if (UEdGraphNode* SelectedNode = NodeWeakPtr.Get())
{
return SelectedNode->NodeComment;
}
return FString();
}
// Called by the EditableText widget when the user types a new comment for the selected node
static void OnNodeCommentTextCommitted(const FText& NewText, ETextCommit::Type /*CommitInfo*/, TWeakObjectPtr<UEdGraphNode> NodeWeakPtr)
{
// Apply the change to the selected actor
UEdGraphNode* SelectedNode = NodeWeakPtr.Get();
FString NewString = NewText.ToString();
if (SelectedNode && !SelectedNode->NodeComment.Equals( NewString, ESearchCase::CaseSensitive ))
{
// send property changed events
const FScopedTransaction Transaction( LOCTEXT("EditNodeComment", "Change Node Comment") );
SelectedNode->Modify();
UProperty* NodeCommentProperty = FindField<UProperty>(SelectedNode->GetClass(), "NodeComment");
if(NodeCommentProperty != NULL)
{
SelectedNode->PreEditChange(NodeCommentProperty);
SelectedNode->NodeComment = NewString;
FPropertyChangedEvent NodeCommentPropertyChangedEvent(NodeCommentProperty);
SelectedNode->PostEditChangeProperty(NodeCommentPropertyChangedEvent);
}
}
FSlateApplication::Get().DismissAllMenus();
}
};
if( !InGraphPin )
{
int32 SelectionCount = GetNodeSelectionCount(CurrentGraph);
if( SelectionCount == 1 )
{
// Node comment area
TSharedRef<SHorizontalBox> NodeCommentBox = SNew(SHorizontalBox);
MenuBuilder->BeginSection("GraphNodeComment", LOCTEXT("NodeCommentMenuHeader", "Node Comment"));
{
MenuBuilder->AddWidget(NodeCommentBox, FText::GetEmpty() );
}
TWeakObjectPtr<UEdGraphNode> SelectedNodeWeakPtr = InGraphNode;
FText NodeCommentText;
if ( UEdGraphNode* SelectedNode = SelectedNodeWeakPtr.Get() )
{
NodeCommentText = FText::FromString( SelectedNode->NodeComment );
}
const FSlateBrush* NodeIcon = FCoreStyle::Get().GetDefaultBrush();//@TODO: FActorIconFinder::FindIconForActor(SelectedActors(0).Get());
// Comment label
NodeCommentBox->AddSlot()
.VAlign(VAlign_Center)
.FillWidth( 1.0f )
[
SNew(SEditableTextBox)
.Text( NodeCommentText )
.ToolTipText(LOCTEXT("NodeComment_ToolTip", "Comment for this node"))
.OnTextCommitted_Static(&Local::OnNodeCommentTextCommitted, SelectedNodeWeakPtr)
.MinDesiredWidth( 120.f )
//.IsReadOnly( !SelectedActors(0)->IsActorLabelEditable() )
.SelectAllTextWhenFocused( true )
.RevertTextOnEscape( true )
];
MenuBuilder->EndSection();
}
else if( SelectionCount > 1 )
{
struct SCommentUtility
{
static void CreateComment(const UEdGraphSchema* Schema, UEdGraph* Graph)
{
if( Schema && Graph )
{
//.........这里部分代码省略.........
示例2: BuildObjectNameAreaSelectionLabel
void SDetailNameArea::BuildObjectNameAreaSelectionLabel( TSharedRef< SHorizontalBox > SelectionLabelBox, const TWeakObjectPtr<UObject> ObjectWeakPtr, const int32 NumSelectedObjects )
{
check( NumSelectedObjects > 1 || ObjectWeakPtr.IsValid() );
if( NumSelectedObjects == 1 )
{
UClass* ObjectClass = ObjectWeakPtr.Get()->GetClass();
if( ObjectClass != nullptr )
{
if (UBlueprint* Blueprint = Cast<UBlueprint>(ObjectClass->ClassGeneratedBy))
{
TWeakObjectPtr<UBlueprint> BlueprintPtr = Blueprint;
SelectionLabelBox->AddSlot()
.VAlign( VAlign_Center )
.HAlign( HAlign_Left )
.Padding( 6.0f, 1.0f, 0.0f, 0.0f )
.FillWidth( 1.0f )
[
SNew(SHyperlink)
.Style(FEditorStyle::Get(), "HoverOnlyHyperlink")
.TextStyle(FEditorStyle::Get(), "DetailsView.EditBlueprintHyperlinkStyle")
.OnNavigate(this, &SDetailNameArea::OnEditBlueprintClicked, BlueprintPtr, ObjectWeakPtr)
.Text(FText::Format(LOCTEXT("EditBlueprint", "(Edit {0})"), FText::FromString( Blueprint->GetName() ) ))
.ToolTipText(LOCTEXT("EditBlueprint_ToolTip", "Click to edit the blueprint"))
];
}
else if( FSourceCodeNavigation::IsCompilerAvailable() )
{
FString ClassHeaderPath;
if( FSourceCodeNavigation::FindClassHeaderPath( ObjectClass, ClassHeaderPath ) && IFileManager::Get().FileSize( *ClassHeaderPath ) != INDEX_NONE )
{
struct Local
{
static void OnEditCodeClicked( FString ClassHeaderPath )
{
FString AbsoluteHeaderPath = IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead( *ClassHeaderPath );
FSourceCodeNavigation::OpenSourceFile( AbsoluteHeaderPath );
}
};
SelectionLabelBox->AddSlot()
.VAlign( VAlign_Center )
.HAlign( HAlign_Left )
.Padding( 6.0f, 1.0f, 0.0f, 0.0f )
.FillWidth( 1.0f )
[
SNew(SHyperlink)
.Style(FEditorStyle::Get(), "HoverOnlyHyperlink")
.TextStyle(FEditorStyle::Get(), "DetailsView.GoToCodeHyperlinkStyle")
.OnNavigate_Static(&Local::OnEditCodeClicked, ClassHeaderPath)
// .Text(LOCTEXT("GoToCode", "(C++)" ))
.Text(FText::Format(LOCTEXT("GoToCode", "({0})" ), FText::FromString(FPaths::GetCleanFilename( *ClassHeaderPath ) ) ) )
.ToolTipText(LOCTEXT("GoToCode_ToolTip", "Click to open this source file in a text editor"))
];
}
}
else
{
// Fill the empty space
SelectionLabelBox->AddSlot();
}
}
else
{
// Fill the empty space
SelectionLabelBox->AddSlot();
}
}
else
{
const FString SelectionText = FString::Printf( *LOCTEXT("MultipleObjectsSelected", "%d objects").ToString(), NumSelectedObjects );
SelectionLabelBox->AddSlot()
.VAlign(VAlign_Center)
.HAlign( HAlign_Left )
.FillWidth( 1.0f )
[
SNew(STextBlock)
.Text( SelectionText )
];
}
}
示例3: SNew
/** Overridden from SMultiColumnTableRow. Generates a widget for this column of the list view. */
virtual TSharedRef<SWidget> GenerateWidgetForColumn(const FName& ColumnName) override
{
if (ColumnName == FbxSceneImportSkeletalMesh::SceneImportCheckBoxSelectionHeaderIdName)
{
return SNew(SBox)
.HAlign(HAlign_Center)
[
SNew(SCheckBox)
.OnCheckStateChanged(this, &SFbxSleletalItemTableListViewRow::OnItemCheckChanged)
.IsChecked(this, &SFbxSleletalItemTableListViewRow::IsItemChecked)
];
}
else if (ColumnName == FbxSceneImportSkeletalMesh::SceneImportClassIconHeaderIdName)
{
UClass *IconClass = FbxMeshInfo->GetType();
const FSlateBrush* ClassIcon = FClassIconFinder::FindIconForClass(IconClass);
TSharedRef<SOverlay> IconContent = SNew(SOverlay)
+ SOverlay::Slot()
.HAlign(HAlign_Right)
.VAlign(VAlign_Center)
[
SNew(SImage)
.Image(ClassIcon)
];
// Add the component mobility icon
IconContent->AddSlot()
.HAlign(HAlign_Left)
[
SNew(SImage)
.Image(this, &SFbxSleletalItemTableListViewRow::GetBrushForOverrideIcon)
];
return IconContent;
}
else if (ColumnName == FbxSceneImportSkeletalMesh::SceneImportAssetNameHeaderIdName)
{
return SNew(STextBlock)
.Text(FText::FromString(FbxMeshInfo->Name))
.ToolTipText(FText::FromString(FbxMeshInfo->Name));
}
else if (ColumnName == FbxSceneImportSkeletalMesh::SceneImportContentPathHeaderIdName)
{
return SNew(STextBlock)
.Text(this, &SFbxSleletalItemTableListViewRow::GetAssetFullName)
.ColorAndOpacity(this, &SFbxSleletalItemTableListViewRow::GetContentPathTextColor)
.ToolTipText(this, &SFbxSleletalItemTableListViewRow::GetAssetFullName);
}
else if (ColumnName == FbxSceneImportSkeletalMesh::SceneImportOptionsNameHeaderIdName)
{
return SNew(STextBlock)
.Text(this, &SFbxSleletalItemTableListViewRow::GetAssetOptionName)
.ToolTipText(this, &SFbxSleletalItemTableListViewRow::GetAssetOptionName);
}
else if (ColumnName == FbxSceneBaseListViewColumn::PivotColumnId)
{
return SNew(STextBlock)
.Text(this, &SFbxSleletalItemTableListViewRow::GetAssetPivotNodeName)
.ToolTipText(this, &SFbxSleletalItemTableListViewRow::GetAssetPivotNodeName);
}
return SNullWidget::NullWidget;
}
示例4: CustomizeDetails
void FEditorUtilityInstanceDetails::CustomizeDetails(IDetailLayoutBuilder& DetailLayoutBuilder)
{
SelectedObjectsList = DetailLayoutBuilder.GetDetailsView().GetSelectedObjects();
// Hide some useless categories
//@TODO: How to hide Actors, Layers, etc...?
// Build a list of unique selected blutilities
TArray<UClass*> UniqueBlutilityClasses;
bool bFoundAnyCDOs = false;
for (auto SelectedObjectIt = SelectedObjectsList.CreateConstIterator(); SelectedObjectIt; ++SelectedObjectIt)
{
UObject* Object = (*SelectedObjectIt).Get();
if (!Object->HasAnyFlags(RF_ClassDefaultObject))
{
UClass* ObjectClass = Object->GetClass();
if (UEditorUtilityBlueprint* Blutility = Cast<UEditorUtilityBlueprint>(ObjectClass->ClassGeneratedBy))
{
UniqueBlutilityClasses.Add(ObjectClass);
}
}
else
{
bFoundAnyCDOs = true;
}
}
// Run thru each one
UniqueBlutilityClasses.Sort(FCompareClassNames());
for (auto ClassIt = UniqueBlutilityClasses.CreateIterator(); ClassIt; ++ClassIt)
{
UClass* Class = *ClassIt;
FString CategoryName = FString::Printf(TEXT("%sActions"), *Class->ClassGeneratedBy->GetName());
IDetailCategoryBuilder& ActionsCategory = DetailLayoutBuilder.EditCategory(*CategoryName);
const APlacedEditorUtilityBase* PlacedActorCDO = Cast<const APlacedEditorUtilityBase>(Class->GetDefaultObject());
if (PlacedActorCDO)
{
ActionsCategory.AddCustomRow( PlacedActorCDO->HelpText )
[
SNew(STextBlock)
.Text(PlacedActorCDO->HelpText)
];
}
const UGlobalEditorUtilityBase* GlobalBlutilityCDO = Cast<const UGlobalEditorUtilityBase>(Class->GetDefaultObject());
if (GlobalBlutilityCDO)
{
ActionsCategory.AddCustomRow( GlobalBlutilityCDO->HelpText )
[
SNew(STextBlock)
.Text(GlobalBlutilityCDO->HelpText)
];
}
TSharedRef<SWrapBox> WrapBox = SNew(SWrapBox).UseAllottedWidth(true);
int32 NumButtons = 0;
for (TFieldIterator<UFunction> FuncIt(Class, EFieldIteratorFlags::IncludeSuper); FuncIt; ++FuncIt)
{
UFunction* Function = *FuncIt;
const bool bCanExecute = (Function->NumParms == 0) && Function->HasAllFunctionFlags(FUNC_Exec);
if (bCanExecute)
{
++NumButtons;
const FString ButtonCaption = FName::NameToDisplayString(*Function->GetName(), false);
//@TODO: Expose the code in UK2Node_CallFunction::GetUserFacingFunctionName / etc...
FString Tooltip = Function->GetToolTipText().ToString();
if (Tooltip.IsEmpty())
{
Tooltip = Function->GetName();
}
TWeakObjectPtr<UFunction> WeakFunctionPtr(Function);
WrapBox->AddSlot()
[
SNew(SButton)
.Text(ButtonCaption)
.OnClicked( FOnClicked::CreateSP(this, &FEditorUtilityInstanceDetails::OnExecuteAction, WeakFunctionPtr) )
.ToolTipText(Tooltip)
];
}
}
if (NumButtons > 0)
{
ActionsCategory.AddCustomRow(TEXT(""))
[
WrapBox
];
//.........这里部分代码省略.........
示例5: ConstructErrorWidget
/* Construct the error widget from an array of errors*/
TSharedRef<SWidget> ConstructErrorWidget(const TArray<TSharedRef<FMaliOCReport::FErrorReport>>& Errors)
{
TSharedRef<SVerticalBox> errorBox = SNew(SVerticalBox);
for (const auto& error : Errors)
{
TSharedPtr<SVerticalBox> errorWarningBox = nullptr;
errorBox->AddSlot()
.Padding(WidgetPadding)
.AutoHeight()
[
SNew(SExpandableArea)
.AreaTitle(FText::FromString(error->TitleName))
.AreaTitleFont(FEditorStyle::GetFontStyle(TEXT("DetailsView.CategoryFontStyle")))
.InitiallyCollapsed(false)
.Padding(WidgetPadding)
.BodyContent()
[
SAssignNew(errorWarningBox, SVerticalBox)
]
];
// Print the details of the shader (such as frequency)
errorWarningBox->AddSlot()
.AutoHeight()
[
GenerateFStringListView(error->Details)
];
if (error->Errors.Num() > 0)
{
errorWarningBox->AddSlot()
.AutoHeight()
[
SNew(SSeparator)
];
errorWarningBox->AddSlot()
.AutoHeight()
[
SNew(SExpandableArea)
.AreaTitle(FText::FromString(TEXT("Errors")))
.AreaTitleFont(FEditorStyle::GetFontStyle(TEXT("DetailsView.CategoryFontStyle")))
.InitiallyCollapsed(false)
.Padding(WidgetPadding)
.BodyContent()
[
GenerateFStringListView(error->Errors)
]
];
}
if (error->Warnings.Num() > 0)
{
errorWarningBox->AddSlot()
.AutoHeight()
[
SNew(SSeparator)
];
errorWarningBox->AddSlot()
.AutoHeight()
[
SNew(SExpandableArea)
.AreaTitle(FText::FromString(TEXT("Warnings")))
.AreaTitleFont(FEditorStyle::GetFontStyle(TEXT("DetailsView.CategoryFontStyle")))
.InitiallyCollapsed(false)
.Padding(WidgetPadding)
.BodyContent()
[
GenerateFStringListView(error->Warnings)
]
];
}
AddSourceCodeToVerticalBox(errorWarningBox, error->SourceCode);
}
return errorBox;
}
示例6: GenerateToolbar
void FAssetEditorToolkit::GenerateToolbar()
{
TSharedPtr<FExtender> Extender = FExtender::Combine(ToolbarExtenders);
FToolBarBuilder ToolbarBuilder( GetToolkitCommands(), FMultiBoxCustomization::AllowCustomization( GetToolkitFName() ), Extender);
ToolbarBuilder.SetIsFocusable(bIsToolbarFocusable);
ToolbarBuilder.BeginSection("Asset");
{
if( IsActuallyAnAsset() )
{
ToolbarBuilder.AddToolBarButton(FAssetEditorCommonCommands::Get().SaveAsset);
ToolbarBuilder.AddToolBarButton(FGlobalEditorCommonCommands::Get().FindInContentBrowser, NAME_None, LOCTEXT("FindInContentBrowserButton", "Find in CB"));
}
}
ToolbarBuilder.EndSection();
TSharedRef<SHorizontalBox> MiscWidgets = SNew(SHorizontalBox);
for (int32 WidgetIdx = 0; WidgetIdx < ToolbarWidgets.Num(); ++WidgetIdx)
{
MiscWidgets->AddSlot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(0.0f, 2.0f, 0.0f, 2.0f)
[
ToolbarWidgets[WidgetIdx]
];
}
Toolbar =
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
[
SNew(SVerticalBox)
+SVerticalBox::Slot()
.AutoHeight()
.VAlign(VAlign_Bottom)
[
ToolbarBuilder.MakeWidget()
]
]
+SHorizontalBox::Slot()
.HAlign(HAlign_Right)
.VAlign(VAlign_Center)
.AutoWidth()
[
SNew(SVerticalBox)
+SVerticalBox::Slot()
.AutoHeight()
.VAlign(VAlign_Bottom)
[
SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush(TEXT("Toolbar.Background")))
.Visibility(ToolbarWidgets.Num() > 0 ? EVisibility::Visible : EVisibility::Collapsed)
[
MiscWidgets
]
]
];
if (ToolbarWidgetContent.IsValid())
{
ToolbarWidgetContent->SetContent(Toolbar.ToSharedRef());
}
}
示例7: SNew
TSharedRef<SWidget> SKismetInspector::MakeContextualEditingWidget(struct FKismetSelectionInfo& SelectionInfo, const FShowDetailsOptions& Options)
{
TSharedRef< SVerticalBox > ContextualEditingWidget = SNew( SVerticalBox );
if(bShowTitleArea)
{
if (SelectedObjects.Num() == 0)
{
// Warning about nothing being selected
ContextualEditingWidget->AddSlot()
.AutoHeight()
.HAlign( HAlign_Center )
.Padding( 2.0f, 14.0f, 2.0f, 2.0f )
[
SNew( STextBlock )
.Text( LOCTEXT("NoNodesSelected", "Select a node to edit details.") )
];
}
else
{
// Title of things being edited
ContextualEditingWidget->AddSlot()
.AutoHeight()
.Padding( 2.0f, 0.0f, 2.0f, 0.0f )
[
SNew(STextBlock)
.Text(this, &SKismetInspector::GetContextualEditingWidgetTitle)
];
}
}
// Show the property editor
PropertyView->HideFilterArea(Options.bHideFilterArea);
PropertyView->SetObjects(SelectionInfo.ObjectsForPropertyEditing, Options.bForceRefresh);
if (SelectionInfo.ObjectsForPropertyEditing.Num())
{
ContextualEditingWidget->AddSlot()
.FillHeight( 0.9f )
.VAlign( VAlign_Top )
[
SNew( SBox )
.Visibility(this, &SKismetInspector::GetPropertyViewVisibility)
[
PropertyView.ToSharedRef()
]
];
if (bShowPublicView)
{
ContextualEditingWidget->AddSlot()
.AutoHeight()
.VAlign( VAlign_Top )
[
SNew(SCheckBox)
.ToolTipText(LOCTEXT("TogglePublicView", "Toggle Public View"))
.IsChecked(this, &SKismetInspector::GetPublicViewCheckboxState)
.OnCheckStateChanged( this, &SKismetInspector::SetPublicViewCheckboxState)
[
SNew(STextBlock)
.Text(LOCTEXT("PublicViewCheckboxLabel", "Public View"))
]
];
}
}
return ContextualEditingWidget;
}
示例8: HoverTargetChanged
void FDragConnection::HoverTargetChanged()
{
TArray<FPinConnectionResponse> UniqueMessages;
if (UEdGraphPin* TargetPinObj = GetHoveredPin())
{
TArray<UEdGraphPin*> ValidSourcePins;
ValidateGraphPinList(/*out*/ ValidSourcePins);
// Check the schema for connection responses
for (UEdGraphPin* StartingPinObj : ValidSourcePins)
{
if (TargetPinObj != StartingPinObj)
{
// The Graph object in which the pins reside.
UEdGraph* GraphObj = StartingPinObj->GetOwningNode()->GetGraph();
// Determine what the schema thinks about the wiring action
const FPinConnectionResponse Response = GraphObj->GetSchema()->CanCreateConnection( StartingPinObj, TargetPinObj );
if (Response.Response == ECanCreateConnectionResponse::CONNECT_RESPONSE_DISALLOW)
{
TSharedPtr<SGraphNode> NodeWidget = TargetPinObj->GetOwningNode()->NodeWidget.Pin();
if (NodeWidget.IsValid())
{
NodeWidget->NotifyDisallowedPinConnection(StartingPinObj, TargetPinObj);
}
}
UniqueMessages.AddUnique(Response);
}
}
}
else if(UEdGraphNode* TargetNodeObj = GetHoveredNode())
{
TArray<UEdGraphPin*> ValidSourcePins;
ValidateGraphPinList(/*out*/ ValidSourcePins);
// Check the schema for connection responses
for (UEdGraphPin* StartingPinObj : ValidSourcePins)
{
FPinConnectionResponse Response;
FText ResponseText;
if (StartingPinObj->GetOwningNode() != TargetNodeObj && StartingPinObj->GetSchema()->SupportsDropPinOnNode(TargetNodeObj, StartingPinObj->PinType, StartingPinObj->Direction, ResponseText))
{
Response.Response = ECanCreateConnectionResponse::CONNECT_RESPONSE_MAKE;
}
else
{
Response.Response = ECanCreateConnectionResponse::CONNECT_RESPONSE_DISALLOW;
}
// Do not display an error if there is no message
if (!ResponseText.IsEmpty())
{
Response.Message = ResponseText;
UniqueMessages.AddUnique(Response);
}
}
}
// Let the user know the status of dropping now
if (UniqueMessages.Num() == 0)
{
// Display the place a new node icon, we're not over a valid pin
SetSimpleFeedbackMessage(
FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.NewNode")),
FLinearColor::White,
NSLOCTEXT("GraphEditor.Feedback", "PlaceNewNode", "Place a new node."));
}
else
{
// Take the unique responses and create visual feedback for it
TSharedRef<SVerticalBox> FeedbackBox = SNew(SVerticalBox);
for (auto ResponseIt = UniqueMessages.CreateConstIterator(); ResponseIt; ++ResponseIt)
{
// Determine the icon
const FSlateBrush* StatusSymbol = NULL;
switch (ResponseIt->Response)
{
case CONNECT_RESPONSE_MAKE:
case CONNECT_RESPONSE_BREAK_OTHERS_A:
case CONNECT_RESPONSE_BREAK_OTHERS_B:
case CONNECT_RESPONSE_BREAK_OTHERS_AB:
StatusSymbol = FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.OK"));
break;
case CONNECT_RESPONSE_MAKE_WITH_CONVERSION_NODE:
StatusSymbol = FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.ViaCast"));
break;
case CONNECT_RESPONSE_DISALLOW:
default:
StatusSymbol = FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.Error"));
break;
}
// Add a new message row
FeedbackBox->AddSlot()
//.........这里部分代码省略.........
示例9: Construct
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SAssetDialog::Construct(const FArguments& InArgs, const FSharedAssetDialogConfig& InConfig)
{
DialogType = InConfig.GetDialogType();
AssetClassNames = InConfig.AssetClassNames;
const FString DefaultPath = InConfig.DefaultPath;
FPathPickerConfig PathPickerConfig;
PathPickerConfig.DefaultPath = DefaultPath;
PathPickerConfig.bFocusSearchBoxWhenOpened = false;
PathPickerConfig.OnPathSelected = FOnPathSelected::CreateSP(this, &SAssetDialog::HandlePathSelected);
PathPickerConfig.SetPathsDelegates.Add(&SetPathsDelegate);
FAssetPickerConfig AssetPickerConfig;
AssetPickerConfig.Filter.ClassNames.Append(AssetClassNames);
AssetPickerConfig.Filter.PackagePaths.Add(FName(*DefaultPath));
AssetPickerConfig.bAllowDragging = false;
AssetPickerConfig.InitialAssetViewType = EAssetViewType::Tile;
AssetPickerConfig.ThumbnailScale = 0.125;
AssetPickerConfig.OnAssetSelected = FOnAssetSelected::CreateSP(this, &SAssetDialog::OnAssetSelected);
AssetPickerConfig.OnAssetsActivated = FOnAssetsActivated::CreateSP(this, &SAssetDialog::OnAssetsActivated);
AssetPickerConfig.SetFilterDelegates.Add(&SetFilterDelegate);
AssetPickerConfig.GetCurrentSelectionDelegates.Add(&GetCurrentSelectionDelegate);
AssetPickerConfig.SaveSettingsName = TEXT("AssetDialog");
AssetPickerConfig.bCanShowFolders = true;
AssetPickerConfig.OnFolderEntered = FOnPathSelected::CreateSP(this, &SAssetDialog::HandleAssetViewFolderEntered);
SetCurrentlySelectedPath(DefaultPath);
// Open and save specific configuration
FText ConfirmButtonText;
bool bIncludeNameBox = false;
if ( DialogType == EAssetDialogType::Open )
{
const FOpenAssetDialogConfig& OpenAssetConfig = static_cast<const FOpenAssetDialogConfig&>(InConfig);
PathPickerConfig.bAllowContextMenu = false;
ConfirmButtonText = LOCTEXT("AssetDialogOpenButton", "Open");
AssetPickerConfig.SelectionMode = OpenAssetConfig.bAllowMultipleSelection ? ESelectionMode::Multi : ESelectionMode::Single;
AssetPickerConfig.bFocusSearchBoxWhenOpened = true;
bIncludeNameBox = false;
}
else if ( DialogType == EAssetDialogType::Save )
{
const FSaveAssetDialogConfig& SaveAssetConfig = static_cast<const FSaveAssetDialogConfig&>(InConfig);
PathPickerConfig.bAllowContextMenu = true;
ConfirmButtonText = LOCTEXT("AssetDialogSaveButton", "Save");
AssetPickerConfig.SelectionMode = ESelectionMode::Single;
AssetPickerConfig.bFocusSearchBoxWhenOpened = false;
bIncludeNameBox = true;
ExistingAssetPolicy = SaveAssetConfig.ExistingAssetPolicy;
SetCurrentlyEnteredAssetName(SaveAssetConfig.DefaultAssetName);
}
else
{
ensureMsgf(0, TEXT("AssetDialog type %d is not supported."), DialogType);
}
TSharedPtr<SWidget> PathPicker = FContentBrowserSingleton::Get().CreatePathPicker(PathPickerConfig);
TSharedPtr<SWidget> AssetPicker = FContentBrowserSingleton::Get().CreateAssetPicker(AssetPickerConfig);
// The root widget in this dialog.
TSharedRef<SVerticalBox> MainVerticalBox = SNew(SVerticalBox);
// Path/Asset view
MainVerticalBox->AddSlot()
.FillHeight(1)
.Padding(0, 0, 0, 4)
[
SNew(SSplitter)
+SSplitter::Slot()
.Value(0.25f)
[
SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
[
PathPicker.ToSharedRef()
]
]
+SSplitter::Slot()
.Value(0.75f)
[
SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
[
AssetPicker.ToSharedRef()
]
]
];
// Input error strip, if we are using a name box
if (bIncludeNameBox)
{
// Name Error label
MainVerticalBox->AddSlot()
.AutoHeight()
[
//.........这里部分代码省略.........
示例10: Construct
void SModeWidget::Construct(const FArguments& InArgs, const FText& InText, const FName InMode)
{
// Copy arguments
ModeText = InText;
ThisMode = InMode;
OnGetActiveMode = InArgs._OnGetActiveMode;
CanBeSelected = InArgs._CanBeSelected;
OnSetActiveMode = InArgs._OnSetActiveMode;
// Load resources
InactiveModeBorderImage = FEditorStyle::GetBrush("ModeSelector.ToggleButton.Normal");
ActiveModeBorderImage = FEditorStyle::GetBrush("ModeSelector.ToggleButton.Pressed");
HoverBorderImage = FEditorStyle::GetBrush("ModeSelector.ToggleButton.Hovered");
TSharedRef<SHorizontalBox> InnerRow = SNew(SHorizontalBox);
FMargin IconPadding(4.0f, 0.0f, 4.0f, 0.0f);
FMargin BodyPadding(0.0f, 0.0f, 0.0f, 0.0f);
// Large Icon
if (InArgs._IconImage.IsSet())
{
InnerRow->AddSlot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(IconPadding)
[
SNew(SImage)
.Image(InArgs._IconImage)
.Visibility(this, &SModeWidget::GetLargeIconVisibility)
];
}
// Small Icon
if (InArgs._SmallIconImage.IsSet())
{
InnerRow->AddSlot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(IconPadding)
[
SNew(SImage)
.Image(InArgs._SmallIconImage)
.Visibility(this, &SModeWidget::GetSmallIconVisibility)
];
}
// Label + content
InnerRow->AddSlot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(BodyPadding)
[
SNew(SVerticalBox)
// Mode 'tab'
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(SHorizontalBox)
//Mode Name
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew(STextBlock)
.Text(ModeText)
.Font(this, &SModeWidget::GetDesiredTitleFont)
]
//Dirty flag
+SHorizontalBox::Slot()
.AutoWidth()
.Padding(3)
[
SNew(SImage)
.Image( InArgs._DirtyMarkerBrush )
]
]
// Body of 'ribbon'
+SVerticalBox::Slot()
.AutoHeight()
[
InArgs._ShortContents.Widget
]
];
// Create the widgets
ChildSlot
.VAlign(VAlign_Fill)
[
SNew(SBorder)
.BorderImage(this, &SModeWidget::GetModeNameBorderImage)
.OnMouseButtonDown(this, &SModeWidget::OnModeTabClicked)
[
InnerRow
]
//.........这里部分代码省略.........
示例11: Construct
//.........这里部分代码省略.........
AssetComboButton = SNew(SComboButton)
.ToolTipText(TooltipAttribute)
.ButtonStyle( FEditorStyle::Get(), "PropertyEditor.AssetComboStyle" )
.ForegroundColor(FEditorStyle::GetColor("PropertyEditor.AssetName.ColorAndOpacity"))
.OnGetMenuContent( this, &SPropertyEditorAsset::OnGetMenuContent )
.OnMenuOpenChanged( this, &SPropertyEditorAsset::OnMenuOpenChanged )
.IsEnabled( IsEnabledAttribute )
.ContentPadding(2.0f)
.ButtonContent()
[
// Show the name of the asset or actor
SNew(STextBlock)
.TextStyle( FEditorStyle::Get(), "PropertyEditor.AssetClass" )
.Font( FEditorStyle::GetFontStyle( PropertyEditorConstants::PropertyFontStyle ) )
.Text(this,&SPropertyEditorAsset::OnGetAssetName)
];
if (bOldEnableAttribute && !InArgs._EnableContentPicker)
{
IsEnabledAttribute.Set(true);
}
TSharedRef<SHorizontalBox> ButtonBox = SNew( SHorizontalBox );
TSharedPtr<SVerticalBox> CustomContentBox;
if( ShouldDisplayThumbnail(InArgs) )
{
FObjectOrAssetData Value;
GetValue( Value );
AssetThumbnail = MakeShareable( new FAssetThumbnail( Value.AssetData, InArgs._ThumbnailSize.X, InArgs._ThumbnailSize.Y, InArgs._ThumbnailPool ) );
ValueContentBox->AddSlot()
.Padding( 0.0f, 0.0f, 2.0f, 0.0f )
.AutoWidth()
[
SAssignNew( ThumbnailBorder, SBorder )
.Padding( 5.0f )
.BorderImage( this, &SPropertyEditorAsset::GetThumbnailBorder )
.OnMouseDoubleClick( this, &SPropertyEditorAsset::OnAssetThumbnailDoubleClick )
[
SNew( SBox )
.ToolTipText(TooltipAttribute)
.WidthOverride( InArgs._ThumbnailSize.X )
.HeightOverride( InArgs._ThumbnailSize.Y )
[
AssetThumbnail->MakeThumbnailWidget()
]
]
];
ValueContentBox->AddSlot()
[
SNew( SBox )
.VAlign( VAlign_Center )
[
SAssignNew( CustomContentBox, SVerticalBox )
+ SVerticalBox::Slot()
[
AssetComboButton.ToSharedRef()
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding( 0.0f, 2.0f, 4.0f, 2.0f )
示例12: ConstructInternals
/**
* Returns the internals of the notification
*/
TSharedRef<SHorizontalBox> ConstructInternals( const FArguments& InArgs )
{
CheckBoxStateChanged = InArgs._CheckBoxStateChanged;
Hyperlink = InArgs._Hyperlink;
HyperlinkText = InArgs._HyperlinkText;
TSharedRef<SHorizontalBox> HorizontalBox = SNew(SHorizontalBox);
// Notification image
HorizontalBox->AddSlot()
.AutoWidth()
.Padding(10.f, 0.f, 0.f, 0.f)
.VAlign(VAlign_Center)
.HAlign(HAlign_Left)
[
SNew(SImage)
.Image( InArgs._Image )
];
{
const FSlateFontInfo Font = InArgs._bUseLargeFont.Get()
? FCoreStyle::Get().GetFontStyle(TEXT("NotificationList.FontBold"))
: FCoreStyle::Get().GetFontStyle(TEXT("NotificationList.FontLight"));
// Container for the text and optional interactive widgets (buttons, check box, and hyperlink)
TSharedRef<SVerticalBox> TextAndInteractiveWidgetsBox = SNew(SVerticalBox);
HorizontalBox->AddSlot()
.AutoWidth()
.Padding(10.f, 0.f, 15.f, 0.f)
.VAlign(VAlign_Center)
.HAlign(HAlign_Left)
[
TextAndInteractiveWidgetsBox
];
// Build Text box
TextAndInteractiveWidgetsBox->AddSlot()
.AutoHeight()
[
SNew(SBox)
.WidthOverride(InArgs._WidthOverride)
[
SAssignNew(MyTextBlock, STextBlock)
.Text(Text)
.Font(Font)
.AutoWrapText(InArgs._WidthOverride.IsSet()) // only auto-wrap the text if we've been given a size constraint; otherwise, fill the notification area
]
];
TSharedRef<SHorizontalBox> InteractiveWidgetsBox = SNew(SHorizontalBox);
TextAndInteractiveWidgetsBox->AddSlot()
.AutoHeight()
[
InteractiveWidgetsBox
];
// Adds any buttons that were passed in.
{
TSharedRef<SHorizontalBox> ButtonsBox = SNew(SHorizontalBox);
for (int32 idx = 0; idx < InArgs._ButtonDetails.Get().Num(); idx++)
{
FNotificationButtonInfo Button = InArgs._ButtonDetails.Get()[idx];
ButtonsBox->AddSlot()
.AutoWidth()
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
.Padding(0.0f, 0.0f, 4.0f, 0.0f)
[
SNew(SButton)
.Text(Button.Text)
.ToolTipText(Button.ToolTip)
.OnClicked(this, &SNotificationItemImpl::OnButtonClicked, Button.Callback)
.Visibility( this, &SNotificationItemImpl::GetButtonVisibility, Button.VisibilityOnNone, Button.VisibilityOnPending, Button.VisibilityOnSuccess, Button.VisibilityOnFail )
];
}
InteractiveWidgetsBox->AddSlot()
.AutoWidth()
.Padding(0.0f, 2.0f, 0.0f, 0.0f)
.VAlign(VAlign_Center)
.HAlign(HAlign_Left)
[
ButtonsBox
];
}
// Adds a check box, but only visible when bound
InteractiveWidgetsBox->AddSlot()
.AutoWidth()
.VAlign(VAlign_Center)
.HAlign(HAlign_Left)
[
SNew(SBox)
.Padding(FMargin(0.0f, 2.0f, 4.0f, 0.0f))
.VAlign(VAlign_Center)
.HAlign(HAlign_Left)
//.........这里部分代码省略.........
示例13: SNew
TSharedRef<SWidget> FSequencerTrackNode::GetCustomOutlinerContent()
{
TSharedPtr<FSequencerSectionKeyAreaNode> KeyAreaNode = GetTopLevelKeyNode();
if (KeyAreaNode.IsValid())
{
// @todo - Sequencer - Support multiple sections/key areas?
TArray<TSharedRef<IKeyArea>> KeyAreas = KeyAreaNode->GetAllKeyAreas();
if (KeyAreas.Num() > 0)
{
// Create the widgets for the key editor and key navigation buttons
TSharedRef<SHorizontalBox> BoxPanel = SNew(SHorizontalBox);
if (KeyAreas[0]->CanCreateKeyEditor())
{
BoxPanel->AddSlot()
.HAlign(HAlign_Right)
.VAlign(VAlign_Center)
[
SNew(SBox)
.WidthOverride(100)
.HAlign(HAlign_Left)
[
KeyAreas[0]->CreateKeyEditor(&GetSequencer())
]
];
}
else
{
BoxPanel->AddSlot()
[
SNew(SSpacer)
];
}
BoxPanel->AddSlot()
.AutoWidth()
.VAlign(VAlign_Center)
[
SNew(SKeyNavigationButtons, AsShared())
];
return SNew(SBox)
.VAlign(VAlign_Center)
.HAlign(HAlign_Right)
[
BoxPanel
];
}
}
else
{
FGuid ObjectBinding;
TSharedPtr<FSequencerDisplayNode> ParentSeqNode = GetParent();
if (ParentSeqNode.IsValid() && (ParentSeqNode->GetType() == ESequencerNode::Object))
{
ObjectBinding = StaticCastSharedPtr<FSequencerObjectBindingNode>(ParentSeqNode)->GetObjectBinding();
}
FBuildEditWidgetParams Params;
Params.NodeIsHovered = TAttribute<bool>::Create(TAttribute<bool>::FGetter::CreateSP(this, &FSequencerDisplayNode::IsHovered));
TSharedPtr<SWidget> Widget = AssociatedEditor.BuildOutlinerEditWidget(ObjectBinding, AssociatedTrack.Get(), Params);
TSharedRef<SHorizontalBox> BoxPanel = SNew(SHorizontalBox);
bool bHasKeyableAreas = false;
TArray<TSharedRef<FSequencerSectionKeyAreaNode>> ChildKeyAreaNodes;
FSequencerDisplayNode::GetChildKeyAreaNodesRecursively(ChildKeyAreaNodes);
for (int32 ChildIndex = 0; ChildIndex < ChildKeyAreaNodes.Num() && !bHasKeyableAreas; ++ChildIndex)
{
TArray< TSharedRef<IKeyArea> > ChildKeyAreas = ChildKeyAreaNodes[ChildIndex]->GetAllKeyAreas();
for (int32 ChildKeyAreaIndex = 0; ChildKeyAreaIndex < ChildKeyAreas.Num() && !bHasKeyableAreas; ++ChildKeyAreaIndex)
{
if (ChildKeyAreas[ChildKeyAreaIndex]->CanCreateKeyEditor())
{
bHasKeyableAreas = true;
}
}
}
if (Widget.IsValid())
{
BoxPanel->AddSlot()
.VAlign(VAlign_Center)
.HAlign(HAlign_Right)
[
Widget.ToSharedRef()
];
}
if (bHasKeyableAreas)
{
BoxPanel->AddSlot()
.AutoWidth()
.VAlign(VAlign_Center)
[
SNew(SKeyNavigationButtons, AsShared())
//.........这里部分代码省略.........
示例14: SNew
TSharedRef< SWidget > SDetailNameArea::BuildObjectNameArea( const TArray< TWeakObjectPtr<UObject> >& SelectedObjects )
{
// Get the common base class of the selected objects
UClass* BaseClass = NULL;
for( int32 ObjectIndex = 0; ObjectIndex < SelectedObjects.Num(); ++ObjectIndex )
{
TWeakObjectPtr<UObject> ObjectWeakPtr = SelectedObjects[ObjectIndex];
if( ObjectWeakPtr.IsValid() )
{
UClass* ObjClass = ObjectWeakPtr->GetClass();
if (!BaseClass)
{
BaseClass = ObjClass;
}
while (!ObjClass->IsChildOf(BaseClass))
{
BaseClass = BaseClass->GetSuperClass();
}
}
}
TSharedRef< SHorizontalBox > ObjectNameArea = SNew( SHorizontalBox );
if (BaseClass)
{
// Get selection icon based on actor(s) classes and add before the selection label
const FSlateBrush* ActorIcon = FClassIconFinder::FindIconForClass(BaseClass);
ObjectNameArea->AddSlot()
.AutoWidth()
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
.Padding(0,0,0,0)
.AspectRatio()
[
SNew(SImage)
.Image(ActorIcon)
.ToolTipText( FText::FromString( BaseClass->GetName() ) )
];
}
// Add the selected object(s) type name, along with buttons for either opening C++ code or editing blueprints
const int32 NumSelectedSurfaces = AssetSelectionUtils::GetNumSelectedSurfaces( GWorld );
if( SelectedObjects.Num() > 0 )
{
if ( bShowActorLabel )
{
FEditorWidgetsModule& EdWidgetsModule = FModuleManager::LoadModuleChecked<FEditorWidgetsModule>(TEXT("EditorWidgets"));
TSharedRef<IObjectNameEditableTextBox> ObjectNameBox = EdWidgetsModule.CreateObjectNameEditableTextBox(SelectedObjects);
ObjectNameArea->AddSlot()
.AutoWidth()
.Padding(0,0,6,0)
[
SNew(SBox)
.WidthOverride( 200.0f )
.VAlign(VAlign_Center)
[
ObjectNameBox
]
];
}
const TWeakObjectPtr< UObject > ObjectWeakPtr = SelectedObjects.Num() == 1 ? SelectedObjects[0] : NULL;
BuildObjectNameAreaSelectionLabel( ObjectNameArea, ObjectWeakPtr, SelectedObjects.Num() );
if( bShowLockButton )
{
ObjectNameArea->AddSlot()
.AutoWidth()
.HAlign(HAlign_Right)
[
SNew( SButton )
.ButtonStyle( FEditorStyle::Get(), "NoBorder" )
.OnClicked( OnLockButtonClicked )
.ToolTipText( LOCTEXT("LockSelectionButton_ToolTip", "Locks the current selection into the Details panel") )
[
SNew( SImage )
.Image( this, &SDetailNameArea::OnGetLockButtonImageResource )
]
];
}
}
else
{
if ( SelectionTip.Get() && NumSelectedSurfaces == 0 )
{
ObjectNameArea->AddSlot()
.FillWidth( 1.0f )
.HAlign( HAlign_Center )
.Padding( 2.0f, 24.0f, 2.0f, 2.0f )
[
SNew( STextBlock )
.Text( LOCTEXT("NoObjectsSelected", "Select an object to view details.") )
];
}
else
//.........这里部分代码省略.........
示例15: Construct
//.........这里部分代码省略.........
LOCTEXT("ExpandAll", "Expand All Categories"),
LOCTEXT("ExpandAll_ToolTip", "Expands all root level categories"),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(this, &SDetailsView::SetRootExpansionStates, /*bExpanded=*/true, /*bRecurse=*/false )));
FilterRow = SNew( SHorizontalBox )
.Visibility( this, &SDetailsView::GetFilterBoxVisibility )
+SHorizontalBox::Slot()
.FillWidth( 1 )
.VAlign( VAlign_Center )
[
// Create the search box
SAssignNew( SearchBox, SSearchBox )
.OnTextChanged( this, &SDetailsView::OnFilterTextChanged )
.AddMetaData<FTagMetaData>(TEXT("Details.Search"))
]
+SHorizontalBox::Slot()
.Padding( 4.0f, 0.0f, 0.0f, 0.0f )
.AutoWidth()
[
// Create the search box
SNew( SButton )
.OnClicked( this, &SDetailsView::OnOpenRawPropertyEditorClicked )
.IsEnabled( this, &SDetailsView::IsPropertyEditingEnabled )
.ToolTipText( LOCTEXT("RawPropertyEditorButtonLabel", "Open Selection in Property Matrix") )
[
SNew( SImage )
.Image( FEditorStyle::GetBrush("DetailsView.EditRawProperties") )
]
];
if (DetailsViewArgs.bShowOptions)
{
FilterRow->AddSlot()
.HAlign(HAlign_Right)
.AutoWidth()
[
SNew( SComboButton )
.ContentPadding(0)
.ForegroundColor( FSlateColor::UseForeground() )
.ButtonStyle( FEditorStyle::Get(), "ToggleButton" )
.AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ViewOptions")))
.MenuContent()
[
DetailViewOptions.MakeWidget()
]
.ButtonContent()
[
SNew(SImage)
.Image( FEditorStyle::GetBrush("GenericViewButton") )
]
];
}
// Create the name area which does not change when selection changes
SAssignNew(NameArea, SDetailNameArea, &SelectedObjects)
// the name area is only for actors
.Visibility(this, &SDetailsView::GetActorNameAreaVisibility)
.OnLockButtonClicked(this, &SDetailsView::OnLockButtonClicked)
.IsLocked(this, &SDetailsView::IsLocked)
.ShowLockButton(DetailsViewArgs.bLockable)
.ShowActorLabel(DetailsViewArgs.bShowActorLabel)
// only show the selection tip if we're not selecting objects
.SelectionTip(!DetailsViewArgs.bHideSelectionTip);
TSharedRef<SVerticalBox> VerticalBox = SNew(SVerticalBox);