本文整理汇总了C++中SNew函数的典型用法代码示例。如果您正苦于以下问题:C++ SNew函数的具体用法?C++ SNew怎么用?C++ SNew使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SNew函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FVector2D
void UVREditorMode::Enter()
{
bWantsToExitMode = false;
ExitType = EVREditorExitType::Normal;
{
IViewportWorldInteractionManager& ViewportWorldInteraction = IViewportInteractionModule::Get().GetWorldInteractionManager();
ViewportWorldInteraction.OnPreWorldInteractionTick().AddUObject( this, &UVREditorMode::PreTick );
ViewportWorldInteraction.OnPostWorldInteractionTick().AddUObject( this, &UVREditorMode::Tick );
}
// @todo vreditor: We need to make sure the user can never switch to orthographic mode, or activate settings that
// would disrupt the user's ability to view the VR scene.
// @todo vreditor: Don't bother drawing toolbars in VR, or other things that won't matter in VR
{
const TSharedRef< ILevelEditor >& LevelEditor = FModuleManager::GetModuleChecked<FLevelEditorModule>("LevelEditor").GetFirstLevelEditor().ToSharedRef();
bool bSummonNewWindow = true;
// Do we have an active perspective viewport that is valid for VR? If so, go ahead and use that.
TSharedPtr<SLevelViewport> ExistingActiveLevelViewport;
{
TSharedPtr<ILevelViewport> ActiveLevelViewport = LevelEditor->GetActiveViewportInterface();
if(ActiveLevelViewport.IsValid())
{
ExistingActiveLevelViewport = StaticCastSharedRef< SLevelViewport >(ActiveLevelViewport->AsWidget());
// Use the currently active window instead
bSummonNewWindow = false;
}
}
TSharedPtr< SLevelViewport > VREditorLevelViewport;
if(bSummonNewWindow)
{
// @todo vreditor: The resolution we set here doesn't matter, as HMDs will draw at their native resolution
// no matter what. We should probably allow the window to be freely resizable by the user
// @todo vreditor: Should save and restore window position and size settings
FVector2D WindowSize;
{
IHeadMountedDisplay::MonitorInfo HMDMonitorInfo;
if(bActuallyUsingVR && GEngine->HMDDevice->GetHMDMonitorInfo(HMDMonitorInfo))
{
WindowSize = FVector2D(HMDMonitorInfo.ResolutionX, HMDMonitorInfo.ResolutionY);
}
else
{
// @todo vreditor: Hard-coded failsafe window size
WindowSize = FVector2D(1920.0f, 1080.0f);
}
}
// @todo vreditor: Use SLevelEditor::GetTableTitle() for the VR window title (needs dynamic update)
const FText VREditorWindowTitle = NSLOCTEXT("VREditor", "VRWindowTitle", "Unreal Editor VR");
TSharedRef< SWindow > VREditorWindow = SNew(SWindow)
.Title(VREditorWindowTitle)
.ClientSize(WindowSize)
.AutoCenter(EAutoCenter::PreferredWorkArea)
.UseOSWindowBorder(true) // @todo vreditor: Allow window to be freely resized? Shouldn't really hurt anything. We should save position/size too.
.SizingRule(ESizingRule::UserSized);
this->VREditorWindowWeakPtr = VREditorWindow;
VREditorLevelViewport =
SNew(SLevelViewport)
.ViewportType(LVT_Perspective) // Perspective
.Realtime(true)
// .ParentLayout( AsShared() ) // @todo vreditor: We don't have one and we probably don't need one, right? Make sure a null parent layout is handled properly everywhere.
.ParentLevelEditor(LevelEditor)
// .ConfigKey( BottomLeftKey ) // @todo vreditor: This is for saving/loading layout. We would need this in order to remember viewport settings like show flags, etc.
.IsEnabled(FSlateApplication::Get().GetNormalExecutionAttribute());
// Allow the editor to keep track of this editor viewport. Because it's not inside of a normal tab,
// we need to explicitly tell the level editor about it
LevelEditor->AddStandaloneLevelViewport(VREditorLevelViewport.ToSharedRef());
VREditorWindow->SetContent(VREditorLevelViewport.ToSharedRef());
// NOTE: We're intentionally not adding this window natively parented to the main frame window, because we don't want it
// to minimize/restore when the main frame is minimized/restored
FSlateApplication::Get().AddWindow(VREditorWindow);
VREditorWindow->SetOnWindowClosed(FOnWindowClosed::CreateUObject(this, &UVREditorMode::OnVREditorWindowClosed));
VREditorWindow->BringToFront(); // @todo vreditor: Not sure if this is needed, especially if we decide the window should be hidden (copied this from PIE code)
}
else
{
VREditorLevelViewport = ExistingActiveLevelViewport;
if(bActuallyUsingVR)
{
// Switch to immersive mode
const bool bWantImmersive = true;
const bool bAllowAnimation = false;
ExistingActiveLevelViewport->MakeImmersive(bWantImmersive, bAllowAnimation);
}
}
//.........这里部分代码省略.........
示例2: SNew
void FIOSTargetSettingsCustomization::BuildPListSection(IDetailLayoutBuilder& DetailLayout)
{
// Info.plist category
IDetailCategoryBuilder& AppManifestCategory = DetailLayout.EditCategory(TEXT("Info.plist"));
IDetailCategoryBuilder& BundleCategory = DetailLayout.EditCategory(TEXT("Bundle Information"));
IDetailCategoryBuilder& OrientationCategory = DetailLayout.EditCategory(TEXT("Orientation"));
IDetailCategoryBuilder& RenderCategory = DetailLayout.EditCategory(TEXT("Rendering"));
TSharedRef<SPlatformSetupMessage> PlatformSetupMessage = SNew(SPlatformSetupMessage, GameInfoPath)
.PlatformName(LOCTEXT("iOSPlatformName", "iOS"))
.OnSetupClicked(this, &FIOSTargetSettingsCustomization::CopySetupFilesIntoProject);
SetupForPlatformAttribute = PlatformSetupMessage->GetReadyToGoAttribute();
AppManifestCategory.AddCustomRow(TEXT("Warning"), false)
.WholeRowWidget
[
PlatformSetupMessage
];
AppManifestCategory.AddCustomRow(TEXT("Info.plist Hyperlink"), false)
.WholeRowWidget
[
SNew(SBox)
.HAlign(HAlign_Center)
[
SNew(SHyperlinkLaunchURL, TEXT("https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html"))
.Text(LOCTEXT("ApplePlistPage", "About Information Property List Files"))
.ToolTipText(LOCTEXT("ApplePlistPageTooltip", "Opens a page that discusses Info.plist"))
]
];
AppManifestCategory.AddCustomRow(TEXT("Info.plist"), false)
.IsEnabled(SetupForPlatformAttribute)
.NameContent()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(FMargin(0, 1, 0, 1))
.FillWidth(1.0f)
[
SNew(STextBlock)
.Text(LOCTEXT("PlistLabel", "Info.plist"))
.Font(DetailLayout.GetDetailFont())
]
]
.ValueContent()
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew(SButton)
.Text(LOCTEXT("OpenPlistFolderButton", "Open PList Folder"))
.ToolTipText(LOCTEXT("OpenPlistFolderButton_Tooltip", "Opens the folder containing the plist for the current project in Explorer or Finder"))
.OnClicked(this, &FIOSTargetSettingsCustomization::OpenPlistFolder)
]
];
// Show properties that are gated by the plist being present and writable
FSimpleDelegate PlistModifiedDelegate = FSimpleDelegate::CreateRaw(this, &FIOSTargetSettingsCustomization::OnPlistPropertyModified);
#define SETUP_PLIST_PROP(PropName, Category, Tip) \
{ \
TSharedRef<IPropertyHandle> PropertyHandle = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UIOSRuntimeSettings, PropName)); \
PropertyHandle->SetOnPropertyValueChanged(PlistModifiedDelegate); \
Category.AddProperty(PropertyHandle) \
.EditCondition(SetupForPlatformAttribute, NULL) \
.ToolTip(Tip); \
}
SETUP_PLIST_PROP(BundleDisplayName, BundleCategory, TEXT("Specifies the the display name for the application. This will be displayed under the icon on the device."));
SETUP_PLIST_PROP(BundleName, BundleCategory, TEXT("Specifies the the name of the application bundle. This is the short name for the application bundle."));
SETUP_PLIST_PROP(BundleIdentifier, BundleCategory, TEXT("Specifies the bundle identifier for the application."));
SETUP_PLIST_PROP(VersionInfo, BundleCategory, TEXT("Specifies the version for the application."));
SETUP_PLIST_PROP(bSupportsPortraitOrientation, OrientationCategory, TEXT("Supports default portrait orientation. Landscape will not be supported."));
SETUP_PLIST_PROP(bSupportsUpsideDownOrientation, OrientationCategory, TEXT("Supports upside down portrait orientation. Landscape will not be supported."));
SETUP_PLIST_PROP(bSupportsLandscapeLeftOrientation, OrientationCategory, TEXT("Supports left landscape orientation. Protrait will not be supported."));
SETUP_PLIST_PROP(bSupportsLandscapeRightOrientation, OrientationCategory, TEXT("Supports right landscape orientation. Protrait will not be supported."));
SETUP_PLIST_PROP(bSupportsMetal, RenderCategory, TEXT("Whether or not to add support for Metal API (requires IOS8 and A7 processors)."));
SETUP_PLIST_PROP(bSupportsOpenGLES2, RenderCategory, TEXT("Whether or not to add support for OpenGL ES2 (if this is false, then your game should specify minimum IOS8 version and use \"metal\" instead of \"opengles-2\" in UIRequiredDeviceCapabilities)"));
#undef SETUP_PLIST_PROP
}
示例3: SNew
void FBodySetupDetails::CustomizeDetails( IDetailLayoutBuilder& DetailBuilder )
{
// Customize collision section
{
if ( DetailBuilder.GetProperty("DefaultInstance")->IsValidHandle() )
{
IDetailCategoryBuilder& PhysicsCategory = DetailBuilder.EditCategory("Physics");
IDetailCategoryBuilder& CollisionCategory = DetailBuilder.EditCategory("Collision");
TSharedPtr<IPropertyHandle> BodyInstanceHandler = DetailBuilder.GetProperty("DefaultInstance");
DetailBuilder.HideProperty(BodyInstanceHandler);
TSharedPtr<IPropertyHandle> CollisionTraceHandler = DetailBuilder.GetProperty("CollisionTraceFlag");
DetailBuilder.HideProperty(CollisionTraceHandler);
// add physics properties to physics category
uint32 NumChildren = 0;
BodyInstanceHandler->GetNumChildren(NumChildren);
// Get the objects being customized so we can enable/disable editing of 'Simulate Physics'
DetailBuilder.GetObjectsBeingCustomized(ObjectsCustomized);
PhysicsCategory.AddCustomRow(TEXT("Mass"), false)
.NameContent()
[
SNew (STextBlock)
.Text(NSLOCTEXT("MassInKG", "MassInKG_Name", "Mass in KG"))
.ToolTipText(NSLOCTEXT("MassInKG", "MassInKG_ToolTip", "Mass of the body in KG"))
.Font( IDetailLayoutBuilder::GetDetailFont() )
]
.ValueContent()
[
SNew(SEditableTextBox)
.Text(this, &FBodySetupDetails::OnGetBodyMass)
.IsReadOnly(this, &FBodySetupDetails::IsBodyMassReadOnly)
.Font(IDetailLayoutBuilder::GetDetailFont())
];
// add all properties of this now - after adding
for (uint32 ChildIndex=0; ChildIndex < NumChildren; ++ChildIndex)
{
TSharedPtr<IPropertyHandle> ChildProperty = BodyInstanceHandler->GetChildHandle(ChildIndex);
FString Category = FObjectEditorUtils::GetCategory(ChildProperty->GetProperty());
if (ChildProperty->GetProperty()->GetName() == TEXT("bSimulatePhysics"))
{
// skip bSimulatePhysics
// this is because we don't want bSimulatePhysics to show up
// phat editor
// staitc mesh already hides everything else not interested in
// so phat editor just should not show this option
continue;
}
if (Category == TEXT("Physics"))
{
PhysicsCategory.AddProperty(ChildProperty);
}
else if (Category == TEXT("Collision"))
{
CollisionCategory.AddProperty(ChildProperty);
}
}
}
}
}
示例4: SNew
/**
* Allocates a widget for this type of MultiBlock. Override this in derived classes.
*
* @return MultiBlock widget object
*/
TSharedRef< class IMultiBlockBaseWidget > FGroupEndBlock::ConstructWidget() const
{
return SNew( SGroupMarkerBlock );
}
示例5: SNew
void FVehicleTransmissionDataCustomization::BuildColumnsHeaderHelper(TSharedRef<class IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& GearsSetup)
{
GearsSetup
.NameContent()
[
SNew(STextBlock)
.Text(LOCTEXT("GearSetup", "Gear Setup"))
.Font(IDetailLayoutBuilder::GetDetailFontBold())
]
.ValueContent()
.MaxDesiredWidth(GearColumnsWidth)
.MinDesiredWidth(GearColumnsWidth)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.FillWidth(0.3333f)
.VAlign(VAlign_Center)
[
SNew(SBox)
.WidthOverride(RowWidth_Customization)
.HAlign(HAlign_Left)
.Content()
[
SNew(STextBlock)
.Text(LOCTEXT("RatioLabel", "Gear Ratio"))
.Font(IDetailLayoutBuilder::GetDetailFontBold())
]
]
+ SHorizontalBox::Slot()
.FillWidth(0.3333f)
.VAlign(VAlign_Center)
[
SNew(SBox)
.HAlign(HAlign_Left)
.WidthOverride(RowWidth_Customization)
.Content()
[
SNew(STextBlock)
.Text(LOCTEXT("LowRPMLabel", "Down Ratio"))
.Font(IDetailLayoutBuilder::GetDetailFontBold())
]
]
+ SHorizontalBox::Slot()
.FillWidth(0.3333f)
.VAlign(VAlign_Center)
[
SNew(STextBlock)
.Text(LOCTEXT("HighRPMLabel", "Up Ratio"))
.Font(IDetailLayoutBuilder::GetDetailFontBold())
]
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
[
PropertyCustomizationHelpers::MakeAddButton(FSimpleDelegate::CreateSP(this, &FVehicleTransmissionDataCustomization::AddGear, StructPropertyHandle), LOCTEXT("AddGearToolTip", "Adds a new gear"))
]
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
[
PropertyCustomizationHelpers::MakeEmptyButton(FSimpleDelegate::CreateSP(this, &FVehicleTransmissionDataCustomization::EmptyGears, StructPropertyHandle), LOCTEXT("EmptyGearToolTip", "Removes all gears"))
]
];
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:66,代码来源:VehicleTransmissionDataCustomization.cpp
示例6: GenerateWidgetForColumn
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
virtual TSharedRef<SWidget> GenerateWidgetForColumn(const FName& ColumnName) override
{
// Get info to apply to all columns (color and tooltip)
FSlateColor ResultColor = FSlateColor::UseForeground();
FText TooltipText = FText::GetEmpty();
if(Info->bMiss)
{
ResultColor = FLinearColor(0.4f,0.4f,0.65f);
TooltipText = FText::Format(LOCTEXT("MissToolTipFmt", "Miss: {0}"), GetReasonForMiss(Info->Result.Component.Get(), OwnerDetailsPtr.Pin()->GetCurrentQuery()));
}
else if(Info->Result.bBlockingHit && Info->Result.bStartPenetrating)
{
ResultColor = FLinearColor(1.f,0.25f,0.25f);
}
// Generate widget for column
if (ColumnName == TEXT("Time"))
{
static const FNumberFormattingOptions TimeNumberFormat = FNumberFormattingOptions()
.SetMinimumFractionalDigits(3)
.SetMaximumFractionalDigits(3);
return SNew(STextBlock)
.ColorAndOpacity( ResultColor )
.ToolTipText( TooltipText )
.Text( FText::AsNumber(Info->Result.Time, &TimeNumberFormat) );
}
else if (ColumnName == TEXT("Type"))
{
FText TypeText = FText::GetEmpty();
if(Info->bMiss)
{
TypeText = LOCTEXT("MissLabel", "Miss");
}
else if(Info->Result.bBlockingHit)
{
TypeText = LOCTEXT("BlockLabel", "Block");
}
else
{
TypeText = LOCTEXT("TouchLabel", "Touch");
}
return SNew(STextBlock)
.ColorAndOpacity( ResultColor )
.ToolTipText( TooltipText )
.Text( TypeText );
}
else if (ColumnName == TEXT("Component"))
{
FText LongName = LOCTEXT("InvalidLabel", "Invalid");
if(Info->Result.Component.IsValid())
{
LongName = FText::FromString(Info->Result.Component.Get()->GetReadableName());
}
return SNew(STextBlock)
.ColorAndOpacity( ResultColor )
.ToolTipText( TooltipText )
.Text( LongName );
}
else if (ColumnName == TEXT("Normal"))
{
return SNew(STextBlock)
.ColorAndOpacity( ResultColor )
.ToolTipText( TooltipText )
.Text( FText::FromString(Info->Result.Normal.ToString()) );
}
return SNullWidget::NullWidget;
}
示例7: check
void FLandscapeEditorDetails::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
{
//FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
//TSharedPtr<SLevelEditor> LevelEditor = StaticCastSharedPtr<SLevelEditor>(LevelEditorModule.GetFirstLevelEditor());
//CommandList = LevelEditor->GetLevelEditorActions();
check(!CommandList.IsValid());
CommandList = MakeShareable(new FUICommandList);
auto NameToCommandMap = FLandscapeEditorCommands::Get().NameToCommandMap;
#define MAP_TOOL(ToolSetName) CommandList->MapAction(NameToCommandMap.FindChecked(ToolSetName), FUIAction(FExecuteAction::CreateSP(this, &FLandscapeEditorDetails::OnChangeTool, FName(ToolSetName)), FCanExecuteAction::CreateSP(this, &FLandscapeEditorDetails::IsToolEnabled, FName(ToolSetName)), FIsActionChecked::CreateStatic(&FLandscapeEditorDetails::IsToolActive, FName(ToolSetName))));
MAP_TOOL("ToolSet_NewLandscape");
MAP_TOOL("ToolSet_ResizeLandscape");
MAP_TOOL("ToolSet_Sculpt");
MAP_TOOL("ToolSet_Paint");
MAP_TOOL("ToolSet_Smooth");
MAP_TOOL("ToolSet_Flatten");
MAP_TOOL("ToolSet_Ramp");
MAP_TOOL("ToolSet_Erosion");
MAP_TOOL("ToolSet_HydraErosion");
MAP_TOOL("ToolSet_Noise");
MAP_TOOL("ToolSet_Retopologize");
MAP_TOOL("ToolSet_Visibility");
MAP_TOOL("ToolSet_Select");
MAP_TOOL("ToolSet_AddComponent");
MAP_TOOL("ToolSet_DeleteComponent");
MAP_TOOL("ToolSet_MoveToLevel");
MAP_TOOL("ToolSet_Mask");
MAP_TOOL("ToolSet_CopyPaste");
MAP_TOOL("ToolSet_Splines");
#undef MAP_TOOL
#define MAP_BRUSH_SET(BrushSetName) CommandList->MapAction(NameToCommandMap.FindChecked(BrushSetName), FUIAction(FExecuteAction::CreateSP(this, &FLandscapeEditorDetails::OnChangeBrushSet, FName(BrushSetName)), FCanExecuteAction::CreateSP(this, &FLandscapeEditorDetails::IsBrushSetEnabled, FName(BrushSetName)), FIsActionChecked::CreateStatic(&FLandscapeEditorDetails::IsBrushSetActive, FName(BrushSetName))));
MAP_BRUSH_SET("BrushSet_Circle");
MAP_BRUSH_SET("BrushSet_Alpha");
MAP_BRUSH_SET("BrushSet_Pattern");
MAP_BRUSH_SET("BrushSet_Component");
MAP_BRUSH_SET("BrushSet_Gizmo");
#undef MAP_BRUSH_SET
#define MAP_BRUSH(BrushName) CommandList->MapAction(NameToCommandMap.FindChecked(BrushName), FUIAction(FExecuteAction::CreateSP(this, &FLandscapeEditorDetails::OnChangeBrush, FName(BrushName)), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &FLandscapeEditorDetails::IsBrushActive, FName(BrushName))));
MAP_BRUSH("Circle_Smooth");
MAP_BRUSH("Circle_Linear");
MAP_BRUSH("Circle_Spherical");
MAP_BRUSH("Circle_Tip");
#undef MAP_BRUSH
static const FLinearColor BorderColor = FLinearColor(0.2f, 0.2f, 0.2f, 0.2f);
static const FSlateBrush* BorderStyle = FEditorStyle::GetBrush("DetailsView.GroupSection");
IDetailCategoryBuilder& LandscapeEditorCategory = DetailBuilder.EditCategory("LandscapeEditor", TEXT(""), ECategoryPriority::TypeSpecific);
LandscapeEditorCategory.AddCustomRow("")
.Visibility(TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateStatic(&FLandscapeEditorDetails::GetTargetLandscapeSelectorVisibility)))
[
SNew(SComboButton)
.OnGetMenuContent_Static(&FLandscapeEditorDetails::GetTargetLandscapeMenu)
.ButtonContent()
[
SNew(STextBlock)
.Text(GetTargetLandscapeName())
]
];
FToolSelectorBuilder ToolBrushSelectorButtons(CommandList, FMultiBoxCustomization::None);
{
FUIAction ToolSelectorUIAction;
//ToolSelectorUIAction.IsActionVisibleDelegate.BindSP(this, &FLandscapeEditorDetails::GetToolSelectorIsVisible);
ToolBrushSelectorButtons.AddComboButton(
ToolSelectorUIAction,
FOnGetContent::CreateSP(this, &FLandscapeEditorDetails::GetToolSelector),
LOCTEXT("ToolSelector", "Tool"),
TAttribute<FText>(this, &FLandscapeEditorDetails::GetCurrentToolName),
LOCTEXT("ToolSelector.Tooltip", "Select Tool"),
TAttribute<FSlateIcon>(this, &FLandscapeEditorDetails::GetCurrentToolIcon)
);
FUIAction BrushSelectorUIAction;
BrushSelectorUIAction.IsActionVisibleDelegate.BindSP(this, &FLandscapeEditorDetails::GetBrushSelectorIsVisible);
ToolBrushSelectorButtons.AddComboButton(
BrushSelectorUIAction,
FOnGetContent::CreateSP(this, &FLandscapeEditorDetails::GetBrushSelector),
LOCTEXT("BrushSelector", "Brush"),
TAttribute<FText>(this, &FLandscapeEditorDetails::GetCurrentBrushName),
LOCTEXT("BrushSelector.Tooltip", "Select Brush"),
TAttribute<FSlateIcon>(this, &FLandscapeEditorDetails::GetCurrentBrushIcon)
);
FUIAction BrushFalloffSelectorUIAction;
BrushFalloffSelectorUIAction.IsActionVisibleDelegate.BindSP(this, &FLandscapeEditorDetails::GetBrushFalloffSelectorIsVisible);
ToolBrushSelectorButtons.AddComboButton(
BrushFalloffSelectorUIAction,
FOnGetContent::CreateSP(this, &FLandscapeEditorDetails::GetBrushFalloffSelector),
LOCTEXT("BrushFalloffSelector", "Falloff"),
TAttribute<FText>(this, &FLandscapeEditorDetails::GetCurrentBrushFalloffName),
LOCTEXT("BrushFalloffSelector.Tooltip", "Select Brush Falloff Type"),
TAttribute<FSlateIcon>(this, &FLandscapeEditorDetails::GetCurrentBrushFalloffIcon)
//.........这里部分代码省略.........
示例8: Notification
void FEditorLiveStreaming::BroadcastStatusCallback( const FLiveStreamingStatus& Status )
{
TSharedPtr< SNotificationItem > Notification( NotificationWeakPtr.Pin() );
if( Notification.IsValid() )
{
// Don't bother clobbering existing message with text about web cam starting/stopping, unless we're already broadcasting.
// We want to make sure people see the persistent text about login state.
if( SubmittedVideoFrameCount > 0 ||
( Status.StatusType != FLiveStreamingStatus::EStatusType::WebCamStarted &&
Status.StatusType != FLiveStreamingStatus::EStatusType::WebCamStopped &&
Status.StatusType != FLiveStreamingStatus::EStatusType::WebCamTextureNotReady &&
Status.StatusType != FLiveStreamingStatus::EStatusType::WebCamTextureReady &&
Status.StatusType != FLiveStreamingStatus::EStatusType::ChatConnected &&
Status.StatusType != FLiveStreamingStatus::EStatusType::ChatDisconnected ) )
{
Notification->SetText( Status.CustomStatusDescription );
}
}
else
{
// Only spawn a notification if we're actually still trying to broadcast, not if we're stopping broadcasting. We don't want
// to revive our notification that we intentionally expired.
if( bIsBroadcasting )
{
FNotificationInfo Info( Status.CustomStatusDescription );
Info.FadeInDuration = 0.1f;
Info.FadeOutDuration = 0.5f;
Info.ExpireDuration = 1.5f;
Info.bUseThrobber = false;
Info.bUseSuccessFailIcons = true;
Info.bUseLargeFont = true;
Info.bFireAndForget = false;
Info.bAllowThrottleWhenFrameRateIsLow = false;
NotificationWeakPtr = FSlateNotificationManager::Get().AddNotification( Info );
}
}
Notification = NotificationWeakPtr.Pin();
if( Notification.IsValid() )
{
SNotificationItem::ECompletionState State = SNotificationItem::CS_Pending;
if( Status.StatusType == FLiveStreamingStatus::EStatusType::Failure )
{
State = SNotificationItem::CS_Fail;
}
else if( Status.StatusType == FLiveStreamingStatus::EStatusType::BroadcastStarted ||
Status.StatusType == FLiveStreamingStatus::EStatusType::WebCamStarted ||
Status.StatusType == FLiveStreamingStatus::EStatusType::ChatConnected )
{
State = SNotificationItem::CS_Success;
}
Notification->SetCompletionState( State );
}
// If the web cam just turned on, then we'll go ahead and show it
if( Status.StatusType == FLiveStreamingStatus::EStatusType::WebCamTextureReady )
{
bool bIsImageFlippedHorizontally = false;
bool bIsImageFlippedVertically = false;
UTexture2D* WebCamTexture = LiveStreamer->GetWebCamTexture( bIsImageFlippedHorizontally, bIsImageFlippedVertically );
if( ensure( WebCamTexture != nullptr ) )
{
IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>( TEXT( "MainFrame" ) );
check( MainFrameModule.IsWindowInitialized() );
auto RootWindow = MainFrameModule.GetParentWindow();
check( RootWindow.IsValid() );
// Allow the user to customize the image mirroring, too!
const auto& Settings = *GetDefault< UEditorLiveStreamingSettings >();
if( Settings.bMirrorWebCamImage )
{
bIsImageFlippedHorizontally = !bIsImageFlippedHorizontally;
}
// How many pixels from the edge of the main frame window to where the broadcast status window appears
const int WindowBorderPadding = 50;
// @todo livestream: Currently this window is not created as "topmost". We don't really want it to be OS-topmost, but we do want it to be the most
// topmost "regular" window in our application (not on top of tooltips, etc.)
// Create a window that will show the web cam video feed
BroadcastStatusWindow = SNew( SWindow )
.Title( LOCTEXT( "StreamingWindowTitle", "Web Camera" ) )
.ClientSize( FVector2D( WebCamTexture->GetSizeX(), WebCamTexture->GetSizeY() ) )
.ScreenPosition( FVector2D(
RootWindow->GetRectInScreen().Right - WebCamTexture->GetSizeX() - WindowBorderPadding,
RootWindow->GetRectInScreen().Top + WindowBorderPadding ) )
// @todo livestream: Ideally the user could freely resize the window, but it gets a bit tricky to preserve the web cam aspect. Plus, we don't really like how letterboxing/columnboxing looks with this.
.SizingRule( ESizingRule::FixedSize )
.AutoCenter( EAutoCenter::None )
.bDragAnywhere( true )
.SupportsMaximize( true )
.SupportsMinimize( true )
.FocusWhenFirstShown( false )
.ActivateWhenFirstShown( false )
.SaneWindowPlacement( false );
//.........这里部分代码省略.........
示例9: SNew
void FDetailPropertyRow::MakeNameOrKeyWidget( FDetailWidgetRow& Row, const TSharedPtr<FDetailWidgetRow> InCustomRow ) const
{
EVerticalAlignment VerticalAlignment = VAlign_Center;
EHorizontalAlignment HorizontalAlignment = HAlign_Fill;
bool bHasKeyNode = PropertyNode->GetPropertyKeyNode().IsValid();
if( !bHasKeyNode && InCustomRow.IsValid() )
{
VerticalAlignment = InCustomRow->NameWidget.VerticalAlignment;
HorizontalAlignment = InCustomRow->NameWidget.HorizontalAlignment;
}
TAttribute<bool> IsEnabledAttrib = CustomIsEnabledAttrib;
TSharedRef<SHorizontalBox> NameHorizontalBox = SNew( SHorizontalBox );
if( HasEditCondition() )
{
IsEnabledAttrib.Bind( this, &FDetailPropertyRow::GetEnabledState );
NameHorizontalBox->AddSlot()
.AutoWidth()
.Padding( 0.0f, 0.0f )
.VAlign(VAlign_Center)
[
SNew( SEditConditionWidget, PropertyEditor )
.CustomEditCondition( CustomEditCondition.IsValid() ? *CustomEditCondition : FCustomEditCondition() )
];
}
TSharedPtr<SWidget> NameWidget;
// Key nodes will take precedence over custom rows.
if (bHasKeyNode)
{
const TSharedRef<IPropertyUtilities> PropertyUtilities = ParentCategory.Pin()->GetParentLayoutImpl().GetPropertyUtilities();
NameWidget =
SNew(SPropertyValueWidget, PropertyKeyEditor, PropertyUtilities)
.IsEnabled(IsEnabledAttrib)
.ShowPropertyButtons(false);
}
else if(InCustomRow.IsValid())
{
NameWidget =
SNew( SBox )
.IsEnabled( IsEnabledAttrib )
[
InCustomRow->NameWidget.Widget
];
}
else
{
NameWidget =
SNew( SPropertyNameWidget, PropertyEditor )
.IsEnabled( IsEnabledAttrib )
.DisplayResetToDefault( false );
}
SHorizontalBox::FSlot& Slot = NameHorizontalBox->AddSlot()
[
NameWidget.ToSharedRef()
];
if (bHasKeyNode)
{
Slot.Padding(0.0f, 0.0f, 20.0f, 0.0f);
}
else
{
Slot.AutoWidth();
}
Row.NameContent()
.HAlign( HorizontalAlignment )
.VAlign( VerticalAlignment )
[
NameHorizontalBox
];
}
示例10: GenerateWidgetForColumn
/** Overridden from SMultiColumnTableRow. Generates a widget for this column of the list view. */
virtual TSharedRef<SWidget> GenerateWidgetForColumn(const FName& ColumnName) override
{
if (ColumnName == FbxSceneReimportStaticMesh::CheckBoxSelectionHeaderIdName)
{
return SNew(SBox)
.HAlign(HAlign_Center)
[
SNew(SCheckBox)
.OnCheckStateChanged(this, &SFbxMeshReimportItemTableListViewRow::OnItemCheckChanged)
.IsChecked(this, &SFbxMeshReimportItemTableListViewRow::IsItemChecked)
.IsEnabled(!FbxMeshInfo->bOriginalTypeChanged)
];
}
else if (ColumnName == FbxSceneReimportStaticMesh::ClassIconHeaderIdName && SlateBrush != nullptr)
{
UClass *IconClass = FbxMeshInfo->GetType();
const FSlateBrush* ClassIcon = FSlateIconFinder::FindIconBrushForClass(IconClass);
TSharedRef<SOverlay> IconContent = SNew(SOverlay)
+ SOverlay::Slot()
.HAlign(HAlign_Right)
.VAlign(VAlign_Center)
[
SNew(SImage)
.Image(ClassIcon)
]
+ SOverlay::Slot()
.HAlign(HAlign_Left)
[
SNew(SImage)
.Image(this, &SFbxMeshReimportItemTableListViewRow::GetIconOverlay)
]
+ SOverlay::Slot()
.HAlign(HAlign_Left)
[
SNew(SImage)
.Image(this, &SFbxMeshReimportItemTableListViewRow::GetBrushForOverrideIcon)
];
return IconContent;
}
else if (ColumnName == FbxSceneReimportStaticMesh::AssetNameHeaderIdName)
{
return SNew(STextBlock)
.Text(FText::FromString(FbxMeshInfo->Name))
.ToolTipText(FText::FromString(FbxMeshInfo->Name));
}
else if (ColumnName == FbxSceneReimportStaticMesh::AssetStatusHeaderIdName)
{
return SNew(STextBlock)
.Text(this, &SFbxMeshReimportItemTableListViewRow::GetAssetStatus)
.ToolTipText(this, &SFbxMeshReimportItemTableListViewRow::GetAssetStatusTooltip);
}
else if (ColumnName == FbxSceneReimportStaticMesh::ContentPathHeaderIdName)
{
return SNew(STextBlock)
.Text(this, &SFbxMeshReimportItemTableListViewRow::GetAssetFullName)
.ColorAndOpacity(this, &SFbxMeshReimportItemTableListViewRow::GetContentPathTextColor)
.ToolTipText(this, &SFbxMeshReimportItemTableListViewRow::GetAssetFullName);
}
else if (ColumnName == FbxSceneReimportStaticMesh::OptionNameHeaderIdName)
{
return SNew(STextBlock)
.Text(this, &SFbxMeshReimportItemTableListViewRow::GetOptionName)
.ToolTipText(this, &SFbxMeshReimportItemTableListViewRow::GetOptionName);
}
else if (ColumnName == FbxSceneBaseListViewColumn::PivotColumnId)
{
return SNew(STextBlock)
.Text(this, &SFbxMeshReimportItemTableListViewRow::GetAssetPivotNodeName)
.ToolTipText(this, &SFbxMeshReimportItemTableListViewRow::GetAssetPivotNodeName);
}
return SNullWidget::NullWidget;
}
示例11: LOCTEXT
void FInputActionMappingCustomization::CustomizeChildren( TSharedRef<class IPropertyHandle> InStructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
{
TSharedPtr<IPropertyHandle> KeyHandle = InStructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FInputActionKeyMapping, Key));
TSharedPtr<IPropertyHandle> ShiftHandle = InStructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FInputActionKeyMapping, bShift));
TSharedPtr<IPropertyHandle> CtrlHandle = InStructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FInputActionKeyMapping, bCtrl));
TSharedPtr<IPropertyHandle> AltHandle = InStructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FInputActionKeyMapping, bAlt));
TSharedPtr<IPropertyHandle> CmdHandle = InStructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FInputActionKeyMapping, bCmd));
TSharedRef<SWidget> RemoveButton = PropertyCustomizationHelpers::MakeDeleteButton(FSimpleDelegate::CreateSP(this, &FInputActionMappingCustomization::RemoveActionMappingButton_OnClick),
LOCTEXT("RemoveActionMappingToolTip", "Removes Action Mapping"));
StructBuilder.AddChildContent( LOCTEXT("KeySearchStr", "Key").ToString() )
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.AutoWidth()
[
SNew( SBox )
.WidthOverride( InputConstants::TextBoxWidth )
[
StructBuilder.GenerateStructValueWidget( KeyHandle.ToSharedRef() )
]
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
ShiftHandle->CreatePropertyNameWidget()
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
ShiftHandle->CreatePropertyValueWidget()
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
CtrlHandle->CreatePropertyNameWidget()
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
CtrlHandle->CreatePropertyValueWidget()
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
AltHandle->CreatePropertyNameWidget()
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
AltHandle->CreatePropertyValueWidget()
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
CmdHandle->CreatePropertyNameWidget()
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
CmdHandle->CreatePropertyValueWidget()
]
+ SHorizontalBox::Slot()
.Padding(InputConstants::PropertyPadding)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
RemoveButton
]
];
}
示例12: while
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,6,0)
[
SNew(SImage)
.Image(ActorIcon)
.ToolTip(FEditorClassUtils::GetTooltip(BaseClass))
];
}
// 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, 3, 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()
.HAlign(HAlign_Right)
.FillWidth(1.0f)
[
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
{
//.........这里部分代码省略.........
示例13: check
/** Generate a widget for the specified column name */
TSharedRef<SWidget> FPListNodeDictionary::GenerateWidgetForColumn(const FName& ColumnName, int32 InDepth, ITableRow* RowPtr)
{
TableRow = RowPtr;
check(TableRow);
if(ColumnName == "PListKeyColumn")
{
return
SNew(SBorder)
.BorderImage_Static(&IPListNode::GetOverlayBrushDelegate, AsShared())
[
SNew(SOverlay)
+ SOverlay::Slot()
[
SNew(SHorizontalBox)
// Space item representing item expansion
+ SHorizontalBox::Slot()
[
SNew(SSpacer)
.Size(FVector2D(20 * InDepth, 0))
]
+ SHorizontalBox::Slot()
.FillWidth(1.0f)
[
SAssignNew(KeyStringTextBox, SEditableTextBox)
.Text(bArrayMember ? FText::FromString(FString::FromInt(ArrayIndex)) : FText::FromString(TEXT("dictionary")))
.IsReadOnly(true)
]
// Spacer between type
+ SHorizontalBox::Slot()
[
SNew(SSpacer)
.Size(FVector2D(30, 0))
]
]
// Expander for innards
+ SOverlay::Slot()
.HAlign(HAlign_Left)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
[
// Space before expander
SNew(SSpacer)
.Size(FVector2D(20 * (InDepth - 1), 0))
]
+ SHorizontalBox::Slot()
[
SAssignNew(ExpanderArrow, SButton)
.ButtonStyle( FEditorStyle::Get(), "NoBorder" )
.ClickMethod( EButtonClickMethod::MouseDown )
.Visibility( this, &FPListNodeDictionary::GetExpanderVisibility )
.OnClicked( this, &FPListNodeDictionary::OnArrowClicked )
.ContentPadding(2.1f)
.ForegroundColor( FSlateColor::UseForeground() )
[
SNew(SImage)
.Image( this, &FPListNodeDictionary::GetExpanderImage )
.ColorAndOpacity( FSlateColor::UseForeground() )
]
]
]
];
}
else if(ColumnName == "PListValueTypeColumn")
{
return
SNew(SBorder)
.BorderImage_Static(&IPListNode::GetOverlayBrushDelegate, AsShared())
[
SNew(STextBlock)
.Text(NSLOCTEXT("PListEditor", "dictionaryValueTypeLabel", "dictionary"))
];
}
else if(ColumnName == "PListValueColumn")
{
return
SNew(SBorder)
.BorderImage_Static(&IPListNode::GetOverlayBrushDelegate, AsShared())
[
SAssignNew(InfoTextWidget, STextBlock)
.Text(FText::Format(NSLOCTEXT("PListEditor", "NumKeyValuePairsFmt", "[{0} key/value pairs]"), FText::AsNumber(GetNumPairs())))
];
}
// Invalid column name
else
{
return SNew(STextBlock) .Text(NSLOCTEXT("PListEditor", "UnknownColumn", "Unknown Column"));
}
//.........这里部分代码省略.........
示例14: Construct
/**
* Construct this widget
*/
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void Construct( const FArguments& InArgs )
{
FPSAnalyzer = InArgs._FPSAnalyzer;
ChildSlot
[
SNew( SBorder )
.BorderImage( FEditorStyle::GetBrush("ToolPanel.GroupBorder") )
.Padding( 2.0f )
[
SNew( SVerticalBox )
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(LOCTEXT("StatisticsLabel", "Statistics"))
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleSampleCount)
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleMinFPS)
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleMaxFPS)
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleAverageFPS)
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleFPS90)
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleFPS60)
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleFPS30)
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleFPS25)
]
+SVerticalBox::Slot()
.AutoHeight()
[
SNew(STextBlock)
.Text(this, &SProfilerFPSStatisticsPanel::HandleFPS20)
]
]
];
}
示例15: Initialize
TSharedRef<SWidget> UUserWidget::RebuildWidget()
{
// In the event this widget is replaced in memory by the blueprint compiler update
// the widget won't be properly initialized, so we ensure it's initialized and initialize
// it if it hasn't been.
if ( !bInitialized )
{
Initialize();
}
// Setup the player context on sub user widgets, if we have a valid context
if (PlayerContext.IsValid())
{
WidgetTree->ForEachWidget([&] (UWidget* Widget) {
if ( UUserWidget* UserWidget = Cast<UUserWidget>(Widget) )
{
UserWidget->SetPlayerContext(PlayerContext);
}
});
}
// Add the first component to the root of the widget surface.
TSharedRef<SWidget> UserRootWidget = WidgetTree->RootWidget ? WidgetTree->RootWidget->TakeWidget() : TSharedRef<SWidget>(SNew(SSpacer));
return UserRootWidget;
}