本文整理汇总了C++中NSLOCTEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ NSLOCTEXT函数的具体用法?C++ NSLOCTEXT怎么用?C++ NSLOCTEXT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NSLOCTEXT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NSLOCTEXT
int32 UUpdateGameProjectCommandlet::Main( const FString& InParams )
{
// Parse command line.
TArray<FString> Tokens;
TArray<FString> Switches;
UCommandlet::ParseCommandLine(*InParams, Tokens, Switches);
FString Category;
FText ChangelistDescription = NSLOCTEXT("UpdateGameProjectCmdlet", "ChangelistDescription", "Updated game project");
bool bAutoCheckout = false;
bool bAutoSubmit = false;
bool bSignSampleProject = false;
const FString CategorySwitch = TEXT("Category=");
const FString ChangelistDescriptionSwitch = TEXT("ChangelistDescription=");
for ( int32 SwitchIdx = 0; SwitchIdx < Switches.Num(); ++SwitchIdx )
{
const FString& Switch = Switches[SwitchIdx];
if ( Switch == TEXT("AutoCheckout") )
{
bAutoCheckout = true;
}
else if ( Switch == TEXT("AutoSubmit") )
{
bAutoSubmit = true;
}
else if ( Switch == TEXT("SignSampleProject") )
{
bSignSampleProject = true;
}
else if ( Switch.StartsWith(CategorySwitch) )
{
Category = Switch.Mid( CategorySwitch.Len() );
}
else if ( Switch.StartsWith(ChangelistDescriptionSwitch) )
{
ChangelistDescription = FText::FromString( Switch.Mid( ChangelistDescriptionSwitch.Len() ) );
}
}
if ( !FPaths::IsProjectFilePathSet() )
{
UE_LOG(LogUpdateGameProjectCommandlet, Error, TEXT("You must launch with a project file to be able to update it"));
return 1;
}
const FString ProjectFilePath = FPaths::GetProjectFilePath();
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
if ( bAutoCheckout )
{
SourceControlProvider.Init();
}
FString EngineIdentifier = GEngineVersion.ToString(EVersionComponent::Minor);
UE_LOG(LogUpdateGameProjectCommandlet, Display, TEXT("Updating project file %s to %s..."), *ProjectFilePath, *EngineIdentifier);
FText FailReason;
if ( !FGameProjectGenerationModule::Get().UpdateGameProject(ProjectFilePath, EngineIdentifier, FailReason) )
{
UE_LOG(LogUpdateGameProjectCommandlet, Error, TEXT("Couldn't update game project: %s"), *FailReason.ToString());
return 1;
}
if ( bSignSampleProject )
{
UE_LOG(LogUpdateGameProjectCommandlet, Display, TEXT("Attempting to sign project file %s..."), *ProjectFilePath);
FText LocalFailReason;
if ( IProjectManager::Get().SignSampleProject(ProjectFilePath, Category, LocalFailReason) )
{
UE_LOG(LogUpdateGameProjectCommandlet, Display, TEXT("Signed project file %s saved."), *ProjectFilePath);
}
else
{
UE_LOG(LogUpdateGameProjectCommandlet, Warning, TEXT("%s"), *LocalFailReason.ToString());
}
}
if ( bAutoSubmit )
{
if ( !bAutoCheckout )
{
// We didn't init SCC above so do it now
SourceControlProvider.Init();
}
if ( ISourceControlModule::Get().IsEnabled() )
{
const FString AbsoluteFilename = FPaths::ConvertRelativePathToFull(FPaths::GetProjectFilePath());
FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(AbsoluteFilename, EStateCacheUsage::ForceUpdate);
if ( SourceControlState.IsValid() && SourceControlState->IsCheckedOut() )
{
TSharedRef<FCheckIn, ESPMode::ThreadSafe> CheckInOperation = ISourceControlOperation::Create<FCheckIn>();
CheckInOperation->SetDescription(ChangelistDescription);
SourceControlProvider.Execute(CheckInOperation, AbsoluteFilename);
}
}
}
//.........这里部分代码省略.........
示例2: FillToolbar
/**
* Builds the Matinee Tool Bar
*/
void FMatinee::ExtendToolbar()
{
struct Local
{
static void FillToolbar(FToolBarBuilder& ToolbarBuilder, TSharedRef<SWidget> InterpolationBox, TSharedRef<SWidget> SpeedBox, TSharedRef<SWidget> SnapSettingBox)
{
ToolbarBuilder.BeginSection("CurveMode");
{
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().AddKey);
}
ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("Interpolation");
{
ToolbarBuilder.AddWidget(InterpolationBox);
}
ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("Play");
{
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().Play);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().PlayLoop);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().Stop);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().PlayReverse);
}
ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("Camera");
{
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().CreateCameraActor);
}
ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("Speed");
{
ToolbarBuilder.AddWidget(SpeedBox);
}
ToolbarBuilder.EndSection();
//ToolbarBuilder.BeginSection("History");
//{
// ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().Undo);
// ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().Redo);
//}
//ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("SnapSetting");
{
ToolbarBuilder.AddWidget(SnapSettingBox);
}
ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("Curve");
{
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().ToggleCurveEditor);
}
ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("Snap");
{
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().ToggleSnap);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().ToggleSnapTimeToFrames);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().FixedTimeStepPlayback);
}
ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("View");
{
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().FitSequence);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().FitViewToSelected);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().FitLoop);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().FitLoopSequence);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().ViewEndofTrack);
}
ToolbarBuilder.EndSection();
ToolbarBuilder.BeginSection("Record");
{
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().LaunchRecordWindow);
ToolbarBuilder.AddToolBarButton(FMatineeCommands::Get().CreateMovie);
}
ToolbarBuilder.EndSection();
}
};
TSharedPtr<FExtender> ToolbarExtender = MakeShareable(new FExtender);
InitialInterpModeStrings.Empty();
InitialInterpModeStrings.Add( MakeShareable( new FString(NSLOCTEXT("Matinee", "Linear", "Linear").ToString()) ) );
InitialInterpModeStrings.Add( MakeShareable( new FString(NSLOCTEXT("Matinee", "CurveAuto", "CurveAuto").ToString()) ) );
InitialInterpModeStrings.Add( MakeShareable( new FString(NSLOCTEXT("Matinee", "Constant", "Constant").ToString()) ) );
InitialInterpModeStrings.Add( MakeShareable( new FString(NSLOCTEXT("Matinee", "CurveUser", "CurveUser").ToString()) ) );
InitialInterpModeStrings.Add( MakeShareable( new FString(NSLOCTEXT("Matinee", "CurveBreak", "CurveBreak").ToString()) ) );
InitialInterpModeStrings.Add( MakeShareable( new FString(NSLOCTEXT("Matinee", "CurveAutoClamped", "CurveAutoClamped").ToString()) ) );
InitialInterpModeComboBox =
SNew( STextComboBox )
//.........这里部分代码省略.........
示例3: SNew
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
TSharedRef<SWidget> SReflectorTreeWidgetItem::GenerateWidgetForColumn(const FName& ColumnName)
{
if (ColumnName == TEXT("WidgetName"))
{
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
[
SNew(SExpanderArrow, SharedThis(this))
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2.0f, 0.0f)
.VAlign(VAlign_Center)
[
SNew(STextBlock)
.Text(this, &SReflectorTreeWidgetItem::GetWidgetType)
.ColorAndOpacity(this, &SReflectorTreeWidgetItem::GetTint)
];
}
else if (ColumnName == TEXT("WidgetInfo"))
{
return SNew(SBox)
.HAlign(HAlign_Left)
.VAlign(VAlign_Center)
.Padding(FMargin(2.0f, 0.0f))
[
SNew(SHyperlink)
.Text(this, &SReflectorTreeWidgetItem::GetReadableLocationAsText)
.OnNavigate(this, &SReflectorTreeWidgetItem::HandleHyperlinkNavigate)
];
}
else if (ColumnName == "Visibility")
{
return SNew(SBox)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.Padding(FMargin(2.0f, 0.0f))
[
SNew(STextBlock)
.Text(this, &SReflectorTreeWidgetItem::GetVisibilityAsString)
];
}
else if (ColumnName == "ForegroundColor")
{
TSharedPtr<SWidget> ThisWidget = WidgetInfo.Get()->Widget.Pin();
FSlateColor Foreground = (ThisWidget.IsValid())
? ThisWidget->GetForegroundColor()
: FSlateColor::UseForeground();
return SNew(SBorder)
// Show unset color as an empty space.
.Visibility(Foreground.IsColorSpecified() ? EVisibility::Visible : EVisibility::Hidden)
// Show a checkerboard background so we can see alpha values well
.BorderImage(FCoreStyle::Get().GetBrush("Checkerboard"))
.VAlign(VAlign_Center)
.Padding(FMargin(2.0f, 0.0f))
[
// Show a color block
SNew(SColorBlock)
.Color(Foreground.GetSpecifiedColor())
.Size(FVector2D(16.0f, 16.0f))
];
}
else if (ColumnName == "Address")
{
const TSharedPtr<SWidget> TheWidget = WidgetInfo.Get()->Widget.Pin();
const FText Address = (TheWidget.IsValid())
? FText::FromString(FString::Printf(TEXT("0x%08X"), TheWidget.Get()))
: NSLOCTEXT("SWidgetReflector","nullptr","nullptr");
return SNew(SHyperlink)
.ToolTipText(NSLOCTEXT("SWidgetReflector", "ClickToCopy", "Click to copy address."))
.Text(Address)
.OnNavigate_Lambda([Address](){ FPlatformMisc::ClipboardCopy(*Address.ToString()); }) ;
}
else
{
return SNullWidget::NullWidget;
}
}
示例4: SNew
void SBuildProgressWidget::Construct( const FArguments& InArgs )
{
BorderImage = FEditorStyle::GetBrush("Menu.Background");
this->ChildSlot
.VAlign(VAlign_Center)
[
SNew( SVerticalBox )
+SVerticalBox::Slot()
.AutoHeight()
.HAlign(HAlign_Fill)
.Padding( 10.0f, 4.0f )
[
SNew(SBorder)
[
SNew( SVerticalBox )
+SVerticalBox::Slot()
.AutoHeight()
.HAlign(HAlign_Fill)
.Padding( 10.0f, 4.0f )
[
SNew( STextBlock )
.Text( NSLOCTEXT("BuildProgress", "BuildStatusLabel", "Build Status") )
.ShadowOffset( FVector2D( 1.0f, 1.0f ) )
]
+SVerticalBox::Slot()
.AutoHeight()
.HAlign(HAlign_Fill)
.Padding( 10.0f, 4.0f )
[
SNew( SHorizontalBox)
+SHorizontalBox::Slot()
.AutoWidth()
.Padding( 0, 7.0f )
[
SNew( STextBlock )
.Text( this, &SBuildProgressWidget::OnGetBuildTimeText )
.ShadowOffset( FVector2D( 1.0f, 1.0f ) )
]
+SHorizontalBox::Slot()
.AutoWidth()
.Padding(10.0f, 7.0f, 10.0f, 7.0f)
[
SNew( STextBlock )
.Text( this, &SBuildProgressWidget::OnGetProgressText )
.ShadowOffset( FVector2D( 1.0f, 1.0f ) )
]
]
]
]
+SVerticalBox::Slot()
.AutoHeight()
.HAlign(HAlign_Fill)
.Padding(10.0f, 1.0f)
[
SNew(SBorder)
[
SNew( SVerticalBox )
+SVerticalBox::Slot()
.AutoHeight()
.HAlign(HAlign_Fill)
.Padding( 10.0f, 4.0f )
[
SNew( STextBlock )
.Text( NSLOCTEXT("BuildProgress", "BuildProgressLabel", "Build Progress") )
.ShadowOffset( FVector2D( 1.0f, 1.0f ) )
]
+SVerticalBox::Slot()
.AutoHeight()
.HAlign(HAlign_Fill)
.Padding( 10.0f, 7.0f, 10.0f, 7.0f )
[
SNew(SProgressBar)
.Percent( this, &SBuildProgressWidget::OnGetProgressFraction )
]
]
]
+SVerticalBox::Slot()
.AutoHeight()
.Padding(15.0f, 4.0f)
.HAlign(HAlign_Center)
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew(SButton)
.Text( NSLOCTEXT("BuildProgress", "StopBuildButtonLabel", "Stop Build") )
.ContentPadding( 5 )
.OnClicked( this, &SBuildProgressWidget::OnStopBuild )
]
]
];
// Reset progress indicators
BuildStartTime = -1;
bStoppingBuild = false;
SetBuildStatusText( FText::GetEmpty() );
SetBuildProgressPercent( 0, 100 );
}
示例5: NSLOCTEXT
void FLevelCollectionModel::SaveLevels(const FLevelModelList& InLevelList)
{
if (IsReadOnly())
{
return;
}
FLevelModelList LevelModelsToSave;
TArray<ULevel*> LevelsToSave;
for (auto It = InLevelList.CreateConstIterator(); It; ++It)
{
if ((*It)->GetLevelObject())
{
if (!(*It)->IsVisible())
{
FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "UnableToSaveInvisibleLevels", "Save aborted. Levels must be made visible before they can be saved.") );
return;
}
else if ((*It)->IsLocked())
{
FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "UnableToSaveLockedLevels", "Save aborted. Level must be unlocked before it can be saved.") );
return;
}
LevelModelsToSave.Add(*It);
LevelsToSave.Add((*It)->GetLevelObject());
}
}
TArray< UPackage* > PackagesNotNeedingCheckout;
// Prompt the user to check out the levels from source control before saving
if (FEditorFileUtils::PromptToCheckoutLevels(false, LevelsToSave, &PackagesNotNeedingCheckout))
{
for (auto It = LevelsToSave.CreateIterator(); It; ++It)
{
FEditorFileUtils::SaveLevel(*It);
}
}
else if (PackagesNotNeedingCheckout.Num() > 0)
{
// The user canceled the checkout dialog but some packages didn't need to be checked out in order to save
// For each selected level if the package its in didn't need to be saved, save the level!
for (int32 LevelIdx = 0; LevelIdx < LevelsToSave.Num(); ++LevelIdx)
{
ULevel* Level = LevelsToSave[LevelIdx];
if (PackagesNotNeedingCheckout.Contains(Level->GetOutermost()))
{
FEditorFileUtils::SaveLevel(Level);
}
else
{
//remove it from the list, so that only successfully saved levels are highlighted when saving is complete
LevelModelsToSave.RemoveAt(LevelIdx);
LevelsToSave.RemoveAt(LevelIdx);
}
}
}
// Select tiles that were saved successfully
SetSelectedLevels(LevelModelsToSave);
}
示例6: NSLOCTEXT
void FColorStructCustomization::OnColorPickerInteractiveBegin()
{
bIsInteractive = true;
GEditor->BeginTransaction( NSLOCTEXT("FColorStructCustomization", "SetColorProperty", "Set Color Property") );
}
示例7: NSLOCTEXT
void FEdModeGeometry::GetFromSource()
{
GWarn->BeginSlowTask( NSLOCTEXT("EditorModes", "GeometryMode-BeginRebuildingBSPTask", "Rebuilding BSP"), false);
TArray<HGeomMidPoints> GeomData;
// Go through each brush and update its components before updating below
for( int32 i=0; i<GeomObjects.Num(); i++ )
{
FGeomObject* GeomObject = GeomObjects[i];
if(GeomObject && GeomObject->ActualBrush)
{
#ifdef BSP_RESELECT
// Cache any information that'll help us reselect the object after it's reconstructed
CacheSelectedData( GeomData, *GeomObject );
#endif // BSP_RESELECT
GeomObject->ActualBrush->UnregisterAllComponents();
if (GeomObject->ActualBrush->GetWorld())
{
GeomObject->ActualBrush->RegisterAllComponents();
}
delete GeomObject;
}
}
GeomObjects.Empty();
TArray<FGeomBase*> SelectedGeom;
// Notify the selected actors that they have been moved.
bool bFound = true;
for ( FSelectionIterator It( GEditor->GetSelectedActorIterator() ) ; It ; ++It )
{
AActor* Actor = static_cast<AActor*>( *It );
checkSlow( Actor->IsA(AActor::StaticClass()) );
ABrush* BrushActor = Cast< ABrush >( Actor );
if ( BrushActor )
{
if( BrushActor->Brush != NULL )
{
FGeomObject* GeomObject = new FGeomObject();
GeomObject->SetParentObjectIndex( GeomObjects.Add( GeomObject ) );
GeomObject->ActualBrush = BrushActor;
GeomObject->GetFromSource();
#ifdef BSP_RESELECT
// Attempt to find all the previously selected geometry on this object if everything has gone OK so far
if ( bFound && !FindFromCache( GeomData, *GeomObject, SelectedGeom ) )
{
#ifdef BSP_RESELECT__ALL_OR_NOTHING
// If it didn't succeed, don't attempt to reselect anything as the user will only end up moving part of their previous selection
UE_LOG(LogGeometryMode, Warning, TEXT( "Unable to find all previously selected geometry data, resetting selection" ) );
SelectedGeom.Empty();
GeomData.Empty();
bFound = false;
#endif // BSP_RESELECT__ALL_OR_NOTHING
}
#endif // BSP_RESELECT
}
}
}
#ifdef BSP_RESELECT
// Reselect anything that came close to the cached midpoints
SelectCachedData( SelectedGeom );
#endif // BSP_RESELECT
GWarn->EndSlowTask();
}
示例8: TextItem
void FStaticMeshEditorViewportClient::DrawCanvas( FViewport& InViewport, FSceneView& View, FCanvas& Canvas )
{
#if TODO_STATICMESH
if ( StaticMesh->bHasBeenSimplified && SimplygonLogo && SimplygonLogo->Resource )
{
const float LogoSizeX = 64.0f;
const float LogoSizeY = 40.65f;
const float Padding = 6.0f;
const float LogoX = Viewport->GetSizeXY().X - Padding - LogoSizeX;
const float LogoY = Viewport->GetSizeXY().Y - Padding - LogoSizeY;
Canvas->DrawTile(
LogoX,
LogoY,
LogoSizeX,
LogoSizeY,
0.0f,
0.0f,
1.0f,
1.0f,
FLinearColor::White,
SimplygonLogo->Resource,
SE_BLEND_Opaque );
}
#endif // #if TODO_STATICMESH
auto StaticMeshEditor = StaticMeshEditorPtr.Pin();
auto StaticMeshEditorViewport = StaticMeshEditorViewportPtr.Pin();
if (!StaticMeshEditor.IsValid() || !StaticMeshEditorViewport.IsValid())
{
return;
}
const int32 HalfX = Viewport->GetSizeXY().X/2;
const int32 HalfY = Viewport->GetSizeXY().Y/2;
// Draw socket names if desired.
if( bShowSockets )
{
for(int32 i=0; i<StaticMesh->Sockets.Num(); i++)
{
UStaticMeshSocket* Socket = StaticMesh->Sockets[i];
if(Socket!=NULL)
{
FMatrix SocketTM;
Socket->GetSocketMatrix(SocketTM, StaticMeshComponent);
const FVector SocketPos = SocketTM.GetOrigin();
const FPlane proj = View.Project( SocketPos );
if(proj.W > 0.f)
{
const int32 XPos = HalfX + ( HalfX * proj.X );
const int32 YPos = HalfY + ( HalfY * (proj.Y * -1) );
FCanvasTextItem TextItem( FVector2D( XPos, YPos ), FText::FromString( Socket->SocketName.ToString() ), GEngine->GetSmallFont(), FLinearColor(FColor(255,196,196)) );
Canvas.DrawItem( TextItem );
const UStaticMeshSocket* SelectedSocket = StaticMeshEditor->GetSelectedSocket();
if (bManipulating && SelectedSocket == Socket)
{
//Figure out the text height
FTextSizingParameters Parameters(GEngine->GetSmallFont(), 1.0f, 1.0f);
UCanvas::CanvasStringSize(Parameters, *Socket->SocketName.ToString());
int32 YL = FMath::TruncToInt(Parameters.DrawYL);
DrawAngles(&Canvas, XPos, YPos + YL,
Widget->GetCurrentAxis(),
GetWidgetMode(),
Socket->RelativeRotation,
Socket->RelativeLocation);
}
}
}
}
}
TArray<SStaticMeshEditorViewport::FOverlayTextItem> TextItems;
int32 CurrentLODLevel = StaticMeshEditor->GetCurrentLODLevel();
if (CurrentLODLevel == 0)
{
CurrentLODLevel = ComputeStaticMeshLOD(StaticMesh->RenderData, StaticMeshComponent->Bounds.Origin, StaticMeshComponent->Bounds.SphereRadius, View);
}
else
{
CurrentLODLevel -= 1;
}
TextItems.Add(SStaticMeshEditorViewport::FOverlayTextItem(
FText::Format(NSLOCTEXT("UnrealEd", "LOD_F", "LOD: {0}"), FText::AsNumber(CurrentLODLevel))));
float CurrentScreenSize = ComputeBoundsScreenSize(StaticMeshComponent->Bounds.Origin, StaticMeshComponent->Bounds.SphereRadius, View);
FNumberFormattingOptions FormatOptions;
FormatOptions.MinimumFractionalDigits = 3;
FormatOptions.MaximumFractionalDigits = 6;
FormatOptions.MaximumIntegralDigits = 6;
TextItems.Add(SStaticMeshEditorViewport::FOverlayTextItem(
FText::Format(NSLOCTEXT("UnrealEd", "ScreenSize_F", "Current Screen Size: {0}"), FText::AsNumber(CurrentScreenSize, &FormatOptions))));
TextItems.Add(SStaticMeshEditorViewport::FOverlayTextItem(
FText::Format(NSLOCTEXT("UnrealEd", "Triangles_F", "Triangles: {0}"), FText::AsNumber(StaticMeshEditorPtr.Pin()->GetNumTriangles(CurrentLODLevel)))));
//.........这里部分代码省略.........
示例9: GenerateInvalidRow
/** Generates a widget for a TableView row */
TSharedRef<ITableRow> FPListNodeString::GenerateWidget(const TSharedRef<STableViewBase>& OwnerTable)
{
return GenerateInvalidRow(OwnerTable, NSLOCTEXT("FPListNodeString", "ArrayUsesColumns", "FPListNodeString uses columns"));
}
示例10: SNew
TSharedRef<SWidget> SGraphPinObject::GetDefaultValueWidget()
{
if( AllowSelfPinWidget() )
{
UObject* DefaultObject = GraphPinObj->DefaultObject;
if(GraphPinObj->GetSchema()->IsSelfPin(*GraphPinObj))
{
return SNew(SEditableTextBox)
.Style( FEditorStyle::Get(), "Graph.EditableTextBox" )
.Text( this, &SGraphPinObject::GetValue )
.SelectAllTextWhenFocused(false)
.Visibility( this, &SGraphPinObject::GetDefaultValueVisibility )
.IsReadOnly(true)
.ForegroundColor( FSlateColor::UseForeground() );
}
}
// Don't show literal buttons for component type objects
if (GraphPinObj->GetSchema()->ShouldShowAssetPickerForPin(GraphPinObj))
{
return
SNew(SHorizontalBox)
.Visibility( this, &SGraphPin::GetDefaultValueVisibility )
+SHorizontalBox::Slot()
.AutoWidth()
.Padding(2,0)
.MaxWidth(100.0f)
[
SAssignNew(AssetPickerAnchor, SComboButton)
.ButtonStyle( FEditorStyle::Get(), "PropertyEditor.AssetComboStyle" )
.ForegroundColor( this, &SGraphPinObject::OnGetComboForeground)
.ContentPadding( FMargin(2,2,2,1) )
.ButtonColorAndOpacity( this, &SGraphPinObject::OnGetWidgetBackground )
.MenuPlacement(MenuPlacement_BelowAnchor)
.ButtonContent()
[
SNew(STextBlock)
.ColorAndOpacity( this, &SGraphPinObject::OnGetComboForeground )
.TextStyle( FEditorStyle::Get(), "PropertyEditor.AssetClass" )
.Font( FEditorStyle::GetFontStyle( "PropertyWindow.NormalFont" ) )
.Text( this, &SGraphPinObject::OnGetComboTextValue )
.ToolTipText( this, &SGraphPinObject::GetObjectToolTip )
]
.OnGetMenuContent(this, &SGraphPinObject::GenerateAssetPicker)
]
// Use button
+SHorizontalBox::Slot()
.AutoWidth()
.Padding(1,0)
.VAlign(VAlign_Center)
[
SAssignNew(UseButton, SButton)
.ButtonStyle( FEditorStyle::Get(), "NoBorder" )
.ButtonColorAndOpacity( this, &SGraphPinObject::OnGetWidgetBackground )
.OnClicked( GetOnUseButtonDelegate() )
.ContentPadding(1.f)
.ToolTipText(NSLOCTEXT("GraphEditor", "ObjectGraphPin_Use_Tooltip", "Use asset browser selection"))
[
SNew(SImage)
.ColorAndOpacity( this, &SGraphPinObject::OnGetWidgetForeground )
.Image( FEditorStyle::GetBrush(TEXT("PropertyWindow.Button_Use")) )
]
]
// Browse button
+SHorizontalBox::Slot()
.AutoWidth()
.Padding(1,0)
.VAlign(VAlign_Center)
[
SAssignNew(BrowseButton, SButton)
.ButtonStyle( FEditorStyle::Get(), "NoBorder" )
.ButtonColorAndOpacity( this, &SGraphPinObject::OnGetWidgetBackground )
.OnClicked( GetOnBrowseButtonDelegate() )
.ContentPadding(0)
.ToolTipText(NSLOCTEXT("GraphEditor", "ObjectGraphPin_Browse_Tooltip", "Browse"))
[
SNew(SImage)
.ColorAndOpacity( this, &SGraphPinObject::OnGetWidgetForeground )
.Image( FEditorStyle::GetBrush(TEXT("PropertyWindow.Button_Browse")) )
]
];
}
return SNullWidget::NullWidget;
}
示例11: Transaction
void AGroupActor::AddSelectedActorsToSelectedGroup()
{
UWorld* EditorWorld = GEditor->GetEditorWorldContext().World();
if (EditorWorld)
{
int32 SelectedGroupIndex = -1;
for(int32 GroupIdx=0; GroupIdx < EditorWorld->ActiveGroupActors.Num(); ++GroupIdx )
{
AGroupActor* GroupActor = Cast<AGroupActor>(EditorWorld->ActiveGroupActors[GroupIdx]);
if( GroupActor != NULL )
{
if(GroupActor->HasSelectedActors(false))
{
// Assign the index of the selected group.
// If this is the second group we find, too many groups are selected, return.
if( SelectedGroupIndex == -1 )
{
SelectedGroupIndex = GroupIdx;
}
else
{
return;
}
}
}
}
AGroupActor* SelectedGroup = Cast<AGroupActor>(EditorWorld->ActiveGroupActors[SelectedGroupIndex]);
if( SelectedGroupIndex != -1 && SelectedGroup != NULL )
{
ULevel* GroupLevel = SelectedGroup->GetLevel();
// We've established that only one group is selected, so we can just call Add on all these actors.
// Any actors already in the group will be ignored.
TArray<AActor*> ActorsToAdd;
bool bActorsInSameLevel = true;
for ( FSelectionIterator It( GEditor->GetSelectedActorIterator() ) ; It ; ++It )
{
AActor* Actor = CastChecked<AActor>( *It );
if( Actor->GetLevel() == GroupLevel )
{
ActorsToAdd.Add( Actor );
}
else
{
bActorsInSameLevel = false;
break;
}
}
if( bActorsInSameLevel )
{
if( ActorsToAdd.Num() > 0 )
{
const FScopedTransaction Transaction( NSLOCTEXT("UnrealEd", "Group_Add", "Add Actors to Group") );
for( int32 ActorIndex = 0; ActorIndex < ActorsToAdd.Num(); ++ActorIndex )
{
if ( ActorsToAdd[ActorIndex] != SelectedGroup )
{
SelectedGroup->Add( *ActorsToAdd[ActorIndex] );
}
}
}
}
else
{
FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "Group_CantCreateGroupMultipleLevels", "Can't group the selected actors because they are in different levels.") );
}
}
}
}
示例12: CreateSpritesFromTextures
void CreateSpritesFromTextures(TArray<UTexture2D*>& Textures)
{
const FString DefaultSuffix = TEXT("_Sprite");
FAssetToolsModule& AssetToolsModule = FModuleManager::Get().LoadModuleChecked<FAssetToolsModule>("AssetTools");
FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked<FContentBrowserModule>("ContentBrowser");
TArray<UObject*> ObjectsToSync;
for (auto TextureIt = Textures.CreateConstIterator(); TextureIt; ++TextureIt)
{
UTexture2D* Texture = *TextureIt;
// Create the factory used to generate the sprite
UPaperSpriteFactory* SpriteFactory = ConstructObject<UPaperSpriteFactory>(UPaperSpriteFactory::StaticClass());
SpriteFactory->InitialTexture = Texture;
// Create the sprite
FString Name;
FString PackageName;
if (!bExtractSprites)
{
// Get a unique name for the sprite
AssetToolsModule.Get().CreateUniqueAssetName(Texture->GetOutermost()->GetName(), DefaultSuffix, /*out*/ PackageName, /*out*/ Name);
const FString PackagePath = FPackageName::GetLongPackagePath(PackageName);
if (UObject* NewAsset = AssetToolsModule.Get().CreateAsset(Name, PackagePath, UPaperSprite::StaticClass(), SpriteFactory))
{
ObjectsToSync.Add(NewAsset);
}
}
else
{
FScopedSlowTask Feedback(1, NSLOCTEXT("Paper2D", "Paper2D_ExtractSpritesFromTexture", "Extracting Sprites From Texture"));
Feedback.MakeDialog(true);
// First extract the rects from the texture
TArray<FIntRect> ExtractedRects;
UPaperSprite::ExtractRectsFromTexture(Texture, /*out*/ ExtractedRects);
// Sort the rectangles by approximate row
struct FRectangleSortHelper
{
FRectangleSortHelper(TArray<FIntRect>& InOutSprites)
{
// Sort by Y, then by X (top left corner), descending order (so we can use it as a stack from the top row down)
TArray<FIntRect> SpritesLeft = InOutSprites;
SpritesLeft.Sort([](const FIntRect& A, const FIntRect& B) { return (A.Min.Y == B.Min.Y) ? (A.Min.X > B.Min.X) : (A.Min.Y > B.Min.Y); });
InOutSprites.Reset();
// Start pulling sprites out, the first one in each row will dominate remaining ones and cause them to get labeled
TArray<FIntRect> DominatedSprites;
DominatedSprites.Empty(SpritesLeft.Num());
while (SpritesLeft.Num())
{
FIntRect DominatingSprite = SpritesLeft.Pop();
DominatedSprites.Add(DominatingSprite);
// Find the sprites that are dominated (intersect the infinite horizontal band described by the dominating sprite)
for (int32 Index = 0; Index < SpritesLeft.Num();)
{
const FIntRect& CurElement = SpritesLeft[Index];
if ((CurElement.Min.Y <= DominatingSprite.Max.Y) && (CurElement.Max.Y >= DominatingSprite.Min.Y))
{
DominatedSprites.Add(CurElement);
SpritesLeft.RemoveAt(Index, /*Count=*/ 1, /*bAllowShrinking=*/ false);
}
else
{
++Index;
}
}
// Sort the sprites in the band by X and add them to the result
DominatedSprites.Sort([](const FIntRect& A, const FIntRect& B) { return (A.Min.X < B.Min.X); });
InOutSprites.Append(DominatedSprites);
DominatedSprites.Reset();
}
}
};
FRectangleSortHelper RectSorter(ExtractedRects);
Feedback.TotalAmountOfWork = ExtractedRects.Num();
for (int ExtractedRectIndex = 0; ExtractedRectIndex < ExtractedRects.Num(); ++ExtractedRectIndex)
{
Feedback.EnterProgressFrame(1, NSLOCTEXT("Paper2D", "Paper2D_ExtractSpritesFromTexture", "Extracting Sprites From Texture"));
FIntRect& ExtractedRect = ExtractedRects[ExtractedRectIndex];
SpriteFactory->bUseSourceRegion = true;
SpriteFactory->InitialSourceUV = FVector2D(ExtractedRect.Min.X, ExtractedRect.Min.Y);
SpriteFactory->InitialSourceDimension = FVector2D(ExtractedRect.Width(), ExtractedRect.Height());
// Get a unique name for the sprite
const FString Suffix = FString::Printf(TEXT("%s_%d"), *DefaultSuffix, ExtractedRectIndex);
AssetToolsModule.Get().CreateUniqueAssetName(Texture->GetOutermost()->GetName(), Suffix, /*out*/ PackageName, /*out*/ Name);
const FString PackagePath = FPackageName::GetLongPackagePath(PackageName);
if (UObject* NewAsset = AssetToolsModule.Get().CreateAsset(Name, PackagePath, UPaperSprite::StaticClass(), SpriteFactory))
//.........这里部分代码省略.........
示例13: GenerateInvalidRow
/** Generate a widget for the specified column name */
TSharedRef<SWidget> FPListNodeFile::GenerateWidgetForColumn(const FName& ColumnName, int32 Depth, ITableRow* RowPtr)
{
return GenerateInvalidRow(NSLOCTEXT("PListNodeArray", "PListNodeFileArrayUsesColumns", "PListNodeFile does not use columns"));
}
示例14: Super
UPaperFlipbookActorFactory::UPaperFlipbookActorFactory(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
DisplayName = NSLOCTEXT("Paper2D", "PaperFlipbookFactoryDisplayName", "Add Animated Sprite");
NewActorClass = APaperFlipbookActor::StaticClass();
}
示例15: check
void AOnlineBeaconClient::NotifyControlMessage(UNetConnection* Connection, uint8 MessageType, class FInBunch& Bunch)
{
if(NetDriver->ServerConnection)
{
check(Connection == NetDriver->ServerConnection);
// We are the client
#if !(UE_BUILD_SHIPPING && WITH_EDITOR)
UE_LOG(LogNet, Log, TEXT("Beacon: Client received: %s"), FNetControlMessageInfo::GetName(MessageType));
#endif
switch (MessageType)
{
case NMT_BeaconWelcome:
{
Connection->ClientResponse = TEXT("0");
FNetControlMessage<NMT_Netspeed>::Send(Connection, Connection->CurrentNetSpeed);
FString BeaconType = GetBeaconType();
if (!BeaconType.IsEmpty())
{
FNetControlMessage<NMT_BeaconJoin>::Send(Connection, BeaconType);
NetDriver->ServerConnection->FlushNet();
}
else
{
// Force close the session
UE_LOG(LogNet, Log, TEXT("Beacon close from invalid beacon type"));
OnFailure();
}
break;
}
case NMT_BeaconAssignGUID:
{
FNetworkGUID NetGUID;
FNetControlMessage<NMT_BeaconAssignGUID>::Receive(Bunch, NetGUID);
if (NetGUID.IsValid())
{
Connection->Driver->GuidCache->RegisterNetGUID_Client( NetGUID, this );
FString BeaconType = GetBeaconType();
FNetControlMessage<NMT_BeaconNetGUIDAck>::Send(Connection, BeaconType);
// Server will send ClientOnConnected() when it gets this control message
// Fail safe for connection to server but no client connection RPC
FTimerDelegate TimerDelegate = FTimerDelegate::CreateUObject(this, &AOnlineBeaconClient::OnFailure);
GetWorldTimerManager().SetTimer(TimerHandle_OnFailure, TimerDelegate, BEACON_RPC_TIMEOUT, false);
}
else
{
// Force close the session
UE_LOG(LogNet, Log, TEXT("Beacon close from invalid NetGUID"));
OnFailure();
}
break;
}
case NMT_Upgrade:
{
// Report mismatch.
uint32 RemoteNetworkVersion;
FNetControlMessage<NMT_Upgrade>::Receive(Bunch, RemoteNetworkVersion);
// Upgrade
const FString ConnectionError = NSLOCTEXT("Engine", "ClientOutdated", "The match you are trying to join is running an incompatible version of the game. Please try upgrading your game version.").ToString();
GEngine->BroadcastNetworkFailure(GetWorld(), NetDriver, ENetworkFailure::OutdatedClient, ConnectionError);
break;
}
case NMT_Failure:
{
FString ErrorMsg;
FNetControlMessage<NMT_Failure>::Receive(Bunch, ErrorMsg);
if (ErrorMsg.IsEmpty())
{
ErrorMsg = NSLOCTEXT("NetworkErrors", "GenericBeaconConnectionFailed", "Beacon Connection Failed.").ToString();
}
// Force close the session
UE_LOG(LogNet, Log, TEXT("Beacon close from NMT_Failure %s"), *ErrorMsg);
OnFailure();
break;
}
case NMT_BeaconJoin:
case NMT_BeaconNetGUIDAck:
default:
{
// Force close the session
UE_LOG(LogNet, Log, TEXT("Beacon close from unexpected control message"));
OnFailure();
break;
}
}
}
}