本文整理汇总了C++中FName类的典型用法代码示例。如果您正苦于以下问题:C++ FName类的具体用法?C++ FName怎么用?C++ FName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TimelineVariableNameToTemplateName
FString UTimelineTemplate::TimelineVariableNameToTemplateName(FName Name)
{
return Name.ToString() + TEXT("_Template");
}
示例2: check
void UInternationalizationConditioningCommandlet::FLocalizationFile::CompareToCounterpart( TSharedPtr<FLocalizationFile> Other )
{
check(Other.IsValid());
FConfigFile* OtherFile = Other->GetFile();
check(Other.IsValid());
check(LocFile != NULL);
// Iterate through all sections in the loc file
for ( FConfigFile::TIterator SectionIt(*LocFile); SectionIt; ++SectionIt )
{
const FString& LocSectionName = SectionIt.Key();
FConfigSection& MySection = SectionIt.Value();
// Skip the [Language] and [Public] sections
if( LocSectionName == TEXT("Language") || LocSectionName == TEXT("Public") )
{
continue;
}
// Find this section in the counterpart loc file
FConfigSection* OtherSection = OtherFile->Find(LocSectionName);
if ( OtherSection != NULL )
{
// Iterate through all keys in this section
for ( FConfigSection::TIterator It(MySection); It; ++It )
{
const FName Propname = It.Key();
const FString& PropValue = It.Value();
FString EscapedPropValue = PropValue.ReplaceQuotesWithEscapedQuotes();
// Find this key in the counterpart loc file
FString* OtherValue = OtherSection->Find(Propname);
if ( OtherValue != NULL )
{
FString EscapedOtherValue = *OtherValue->ReplaceQuotesWithEscapedQuotes();
// If the counterpart has the same value as we do or is empty, the value is untranslated
if( OtherValue->IsEmpty() )
{
// If the entry is empty we do nothing for the time being.
}
else if ( PropValue == *OtherValue )
{
new(IdenticalProperties) FLocalizationFileEntry( Other->GetFilename(), LocSectionName, Propname.ToString(), EscapedPropValue, EscapedPropValue );
}
else
{
new(TranslatedProperties) FLocalizationFileEntry( Other->GetFilename(), LocSectionName, Propname.ToString(), EscapedPropValue, EscapedOtherValue );
}
}
else
{
// The counterpart didn't contain this key
new(UnmatchedProperties) FString(LocSectionName + TEXT(".") + Propname.ToString());
}
}
}
else
{
// The counterpart didn't contain this section
new(UnmatchedSections) FString(FPaths::GetBaseFilename(LocFilename) + TEXT(".") + LocSectionName);
}
}
}
示例3: bAscending
void FAssetViewSortManager::SortList(TArray<TSharedPtr<FAssetViewItem>>& AssetItems, const FName& MajorityAssetType) const
{
//double SortListStartTime = FPlatformTime::Seconds();
TArray<TUniquePtr<FCompareFAssetItemBase>> SortMethod;
for (int32 PriorityIdx = 0; PriorityIdx < EColumnSortPriority::Max; PriorityIdx++)
{
const bool bAscending(SortMode[PriorityIdx] == EColumnSortMode::Ascending);
const FName& Tag(SortColumnId[PriorityIdx]);
if (Tag == NAME_None)
{
break;
}
if (Tag == NameColumnId)
{
SortMethod.Add(MakeUnique<FCompareFAssetItemByName>(bAscending, Tag));
}
else if (Tag == ClassColumnId)
{
SortMethod.Add(MakeUnique<FCompareFAssetItemByClass>(bAscending, Tag));
}
else if (Tag == PathColumnId)
{
SortMethod.Add(MakeUnique<FCompareFAssetItemByPath>(bAscending, Tag));
}
else
{
// Since this SortData.Tag is not one of preset columns, sort by asset registry tag
UObject::FAssetRegistryTag::ETagType TagType = UObject::FAssetRegistryTag::TT_Alphabetical;
if (MajorityAssetType != NAME_None)
{
UClass* Class = FindObject<UClass>(ANY_PACKAGE, *MajorityAssetType.ToString());
if (Class)
{
UObject* CDO = Class->GetDefaultObject();
if (CDO)
{
TArray<UObject::FAssetRegistryTag> TagList;
CDO->GetAssetRegistryTags(TagList);
for (auto TagIt = TagList.CreateConstIterator(); TagIt; ++TagIt)
{
if (TagIt->Name == Tag)
{
TagType = TagIt->Type;
break;
}
}
}
}
}
if (TagType == UObject::FAssetRegistryTag::TT_Numerical)
{
// The property is a Num2er, compare using atof
SortMethod.Add(MakeUnique<FCompareFAssetItemByTagNumerical>(bAscending, Tag));
}
else if (TagType == UObject::FAssetRegistryTag::TT_Dimensional)
{
// The property is a series of Num2ers representing dimensions, compare by using atof for each Num2er, delimited by an "x"
SortMethod.Add(MakeUnique<FCompareFAssetItemByTagDimensional>(bAscending, Tag));
}
else
{
// Unknown or alphabetical, sort alphabetically either way
SortMethod.Add(MakeUnique<FCompareFAssetItemByTag>(bAscending, Tag));
}
}
}
// Sort the list...
if (SortMethod.Num() > 0)
{
TUniquePtr<FCompareFAssetItemBase> PrimarySortMethod = MoveTemp(SortMethod[EColumnSortPriority::Primary]);
check(PrimarySortMethod);
SortMethod.RemoveAt(0);
// Move all the comparisons to the primary sort method
PrimarySortMethod->SetNextComparisons(SortMethod);
AssetItems.Sort(*(PrimarySortMethod.Get()));
// Move the comparisons back for ease of cleanup
SortMethod = MoveTemp(PrimarySortMethod->GetNextComparisons());
SortMethod.Insert(MoveTemp(PrimarySortMethod), 0);
}
// Cleanup the methods we no longer need.
for (int32 PriorityIdx = 0; PriorityIdx < SortMethod.Num(); PriorityIdx++)
{
SortMethod[PriorityIdx].Reset();
}
SortMethod.Empty();
//UE_LOG(LogContentBrowser, Warning/*VeryVerbose*/, TEXT("FAssetViewSortManager Sort Time: %0.4f seconds."), FPlatformTime::Seconds() - SortListStartTime);
}
示例4: Construct
/**
* Construct this widget. Called by the SNew() Slate macro.
*
* @param InArgs Declaration used by the SNew() macro to construct this widget
* @param Factory The factory this menu entry represents
*/
void Construct( const FArguments& InArgs, UFactory* Factory )
{
const FName ClassThumbnailBrushOverride = Factory->GetNewAssetThumbnailOverride();
const FSlateBrush* ClassThumbnail = nullptr;
if (ClassThumbnailBrushOverride.IsNone())
{
ClassThumbnail = FClassIconFinder::FindThumbnailForClass(Factory->GetSupportedClass());
}
else
{
// Instead of getting the override thumbnail directly from the editor style here get it from the
// ClassIconFinder since it may have additional styles registered which can be searched by passing
// it as a default with no class to search for.
ClassThumbnail = FClassIconFinder::FindThumbnailForClass(nullptr, ClassThumbnailBrushOverride);
}
FAssetToolsModule& AssetToolsModule = FAssetToolsModule::GetModule();
TWeakPtr<IAssetTypeActions> AssetTypeActions = AssetToolsModule.Get().GetAssetTypeActionsForClass(Factory->GetSupportedClass());
FLinearColor AssetColor = FLinearColor::White;
if ( AssetTypeActions.IsValid() )
{
AssetColor = AssetTypeActions.Pin()->GetTypeColor();
}
ChildSlot
[
SNew( SHorizontalBox )
+SHorizontalBox::Slot()
.Padding( 4, 0, 0, 0 )
.VAlign(VAlign_Center)
.AutoWidth()
[
SNew( SOverlay )
+SOverlay::Slot()
[
SNew( SBox )
.WidthOverride( InArgs._Width + 4 )
.HeightOverride( InArgs._Height + 4 )
[
SNew( SBorder )
.BorderImage( FEditorStyle::GetBrush("AssetThumbnail.AssetBackground") )
.BorderBackgroundColor(AssetColor.CopyWithNewOpacity(0.3f))
.Padding( 2.0f )
.VAlign( VAlign_Center )
.HAlign( HAlign_Center )
[
SNew( SImage )
.Image( ClassThumbnail )
]
]
]
+SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Bottom)
[
SNew( SBorder )
.BorderImage( FEditorStyle::GetBrush("WhiteBrush") )
.BorderBackgroundColor( AssetColor )
.Padding( FMargin(0, FMath::Max(FMath::CeilToFloat(InArgs._Width*0.025f), 3.0f), 0, 0) )
]
]
+SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.Padding(4, 0, 4, 0)
[
SNew( SVerticalBox )
+SVerticalBox::Slot()
.Padding(0, 0, 0, 1)
.AutoHeight()
[
SNew(STextBlock)
.Font( FEditorStyle::GetFontStyle("LevelViewportContextMenu.AssetLabel.Text.Font") )
.Text( Factory->GetDisplayName() )
]
]
];
SetToolTip(IDocumentation::Get()->CreateToolTip(Factory->GetToolTip(), nullptr, Factory->GetToolTipDocumentationPage(), Factory->GetToolTipDocumentationExcerpt()));
}
示例5: Modify
void AActor::SetActorLabelInternal( const FString& NewActorLabelDirty, bool bMakeGloballyUniqueFName )
{
// Clean up the incoming string a bit
FString NewActorLabel = NewActorLabelDirty;
NewActorLabel.Trim();
NewActorLabel.TrimTrailing();
// First, update the actor label
{
// Has anything changed?
if( FCString::Strcmp( *NewActorLabel, *GetActorLabel() ) != 0 )
{
// Store new label
Modify();
ActorLabel = NewActorLabel;
}
}
// Next, update the actor's name
{
// Generate an object name for the actor's label
const FName OldActorName = GetFName();
FName NewActorName = MakeObjectNameFromActorLabel( GetActorLabel(), OldActorName );
// Has anything changed?
if( OldActorName != NewActorName )
{
// Try to rename the object
UObject* NewOuter = NULL; // Outer won't be changing
ERenameFlags RenFlags = bMakeGloballyUniqueFName ? (REN_DontCreateRedirectors | REN_ForceGlobalUnique) : REN_DontCreateRedirectors;
bool bCanRename = Rename( *NewActorName.ToString(), NewOuter, REN_Test | REN_DoNotDirty | REN_NonTransactional | RenFlags );
if( bCanRename )
{
// NOTE: Will assert internally if rename fails
const bool bWasRenamed = Rename( *NewActorName.ToString(), NewOuter, RenFlags );
}
else
{
// Unable to rename the object. Use a unique object name variant.
NewActorName = MakeUniqueObjectName( bMakeGloballyUniqueFName ? ANY_PACKAGE : GetOuter(), GetClass(), NewActorName );
bCanRename = Rename( *NewActorName.ToString(), NewOuter, REN_Test | REN_DoNotDirty | REN_NonTransactional | RenFlags );
if( bCanRename )
{
// NOTE: Will assert internally if rename fails
const bool bWasRenamed = Rename( *NewActorName.ToString(), NewOuter, RenFlags );
}
else
{
// Unable to rename the object. Oh well, not a big deal.
}
}
}
}
FPropertyChangedEvent PropertyEvent( FindField<UProperty>( AActor::StaticClass(), "ActorLabel" ) );
PostEditChangeProperty(PropertyEvent);
FCoreDelegates::OnActorLabelChanged.Broadcast(this);
}
示例6: Transaction
bool FActorFolders::RenameFolderInWorld(UWorld& World, FName OldPath, FName NewPath)
{
if (OldPath.IsNone() || OldPath == NewPath || PathIsChildOf(NewPath.ToString(), OldPath.ToString()))
{
return false;
}
const FScopedTransaction Transaction(LOCTEXT("UndoAction_RenameFolder", "Rename Folder"));
const FString OldPathString = OldPath.ToString();
const FString NewPathString = NewPath.ToString();
TSet<FName> RenamedFolders;
// Move any folders we currently hold - old ones will be deleted later
UEditorActorFolders& FoldersInWorld = GetOrCreateFoldersForWorld(World);
FoldersInWorld.Modify();
auto ExistingFoldersCopy = FoldersInWorld.Folders;
for (const auto& Pair : ExistingFoldersCopy)
{
auto Path = Pair.Key;
const FString FolderPath = Path.ToString();
if (OldPath == Path || PathIsChildOf(FolderPath, OldPathString))
{
const FName NewFolder = OldPathToNewPath(OldPathString, NewPathString, FolderPath);
if (!FoldersInWorld.Folders.Contains(NewFolder))
{
// Use the existing properties for the folder if we have them
if (FActorFolderProps* ExistingProperties = FoldersInWorld.Folders.Find(Path))
{
FoldersInWorld.Folders.Add(NewFolder, *ExistingProperties);
}
else
{
// Otherwise use default properties
FoldersInWorld.Folders.Add(NewFolder);
}
OnFolderCreate.Broadcast(World, NewFolder);
}
RenamedFolders.Add(Path);
}
}
// Now that we have folders created, move any actors that ultimately reside in that folder too
for (auto ActorIt = FActorIterator(&World); ActorIt; ++ActorIt)
{
const FName& OldActorPath = ActorIt->GetFolderPath();
AActor* Actor = *ActorIt;
if (OldActorPath.IsNone())
{
continue;
}
if (Actor->GetFolderPath() == OldPath || PathIsChildOf(OldActorPath.ToString(), OldPathString))
{
RenamedFolders.Add(OldActorPath);
ActorIt->SetFolderPath(OldPathToNewPath(OldPathString, NewPathString, OldActorPath.ToString()));
}
}
// Cleanup any old folders
for (const auto& Path : RenamedFolders)
{
FoldersInWorld.Folders.Remove(Path);
OnFolderDelete.Broadcast(World, Path);
}
return RenamedFolders.Num() != 0;
}
示例7: ConvertToString
std::string ConvertToString(FName name)
{
std::string t = TCHAR_TO_UTF8(*name.ToString());
return t;
}
示例8: ListGroup
void ListGroup(FName Group)
{
FGroupEnable* Found = HighPerformanceEnable.Find(Group);
if (Found)
{
UE_LOG(LogStatGroupEnableManager, Display, TEXT(" %d default %d %s"), !!Found->CurrentEnable, !!Found->DefaultEnable, *Group.ToString());
}
}
示例9: EffectorLocation
void FAnimNode_MMDIK::EvaluateBoneTransforms(USkeletalMeshComponent* SkelComp, const FBoneContainer& RequiredBones, FA2CSPose& MeshBases, TArray<FBoneTransform>& OutBoneTransforms)
{
FVector EffectorLocation(FVector::ZeroVector);
FVector JointTargetLocation(FVector::ZeroVector);
TEnumAsByte<enum EBoneControlSpace> EffectorLocationSpace(BCS_BoneSpace);
TEnumAsByte<enum EBoneControlSpace> JointTargetLocationSpace(BCS_ParentBoneSpace);
FTransform UpperLimbCSTransform;
FTransform LowerLimbCSTransform;
FTransform EndBoneCSTransform;
FTransform JointTargetTransform;
const float BlendWeight = FMath::Clamp<float>(1.0f, 0.f, 1.f);
check(OutBoneTransforms.Num() == 0);
const FStringAssetReference& AssetRef = MMDExtendAssetRef.ToStringReference();
UMMDExtendAsset* MMDExtendAssetPtr = MMDExtendAssetRef.Get();
if (MMDExtendAssetPtr == nullptr)
{
UE_LOG(LogAnimation, Warning, TEXT("FAnimNode_MMDIK::EvaluateBoneTransforms: MMExtendPtr is nullptr!"));
return;
}
for (int32 indexIK = 0; indexIK < MMDExtendAssetPtr->IkInfoList.Num(); indexIK++)
{
JointTargetLocationSpace = BCS_ParentBoneSpace;
// Get indices of the lower and upper limb bones and check validity.
bool bInvalidLimb = false;
// IKBoneIndex
const FName EffectorSpaceBoneName = MMDExtendAssetPtr->IkInfoList[indexIK].IKBoneName;
const int32 EffectorSpaceBoneIndex = MMDExtendAssetPtr->IkInfoList[indexIK].IKBoneIndex;
const FName EndBoneName = MMDExtendAssetPtr->IkInfoList[indexIK].TargetBoneName;
const int32 EndBoneIndex = MMDExtendAssetPtr->IkInfoList[indexIK].TargetBoneIndex;
if (EffectorSpaceBoneName.IsEqual(TEXT("左つま先IK")) || EffectorSpaceBoneName.IsEqual(TEXT("右つま先IK")))
{
JointTargetLocationSpace = BCS_BoneSpace;
}
const int32 LowerLimbIndex = RequiredBones.GetParentBoneIndex(EndBoneIndex);
if (LowerLimbIndex == INDEX_NONE)
{
bInvalidLimb = true;
}
int32 UpperLimbIndex = INDEX_NONE;
if (!bInvalidLimb)
{
UpperLimbIndex = RequiredBones.GetParentBoneIndex(LowerLimbIndex);
if (UpperLimbIndex == INDEX_NONE)
{
bInvalidLimb = true;
}
}
if (!bInvalidLimb)
{
int32 JointTargetSpaceBoneIndex = INDEX_NONE;
if (MMDExtendAssetPtr->IkInfoList[indexIK].ikLinkList.Num() > 0)
{
JointTargetSpaceBoneIndex = MMDExtendAssetPtr->IkInfoList[indexIK].ikLinkList[0].BoneIndex;
}
UpperLimbCSTransform = MeshBases.GetComponentSpaceTransform(UpperLimbIndex);
LowerLimbCSTransform = MeshBases.GetComponentSpaceTransform(LowerLimbIndex);
EndBoneCSTransform = MeshBases.GetComponentSpaceTransform(EndBoneIndex);
FTransform JointTargetTransform(JointTargetLocation);
FAnimationRuntime::ConvertBoneSpaceTransformToCS(SkelComp, MeshBases, JointTargetTransform, JointTargetSpaceBoneIndex, JointTargetLocationSpace);
const FVector RootPos = UpperLimbCSTransform.GetTranslation();
const FVector InitialJointPos = LowerLimbCSTransform.GetTranslation();
const FVector InitialEndPos = EndBoneCSTransform.GetTranslation();
FTransform EffectorTransform(EffectorLocation);
FAnimationRuntime::ConvertBoneSpaceTransformToCS(SkelComp, MeshBases, EffectorTransform, EffectorSpaceBoneIndex, EffectorLocationSpace);
FVector DesiredPos = EffectorTransform.GetTranslation();
FVector DesiredDelta = DesiredPos - RootPos;
float DesiredLength = DesiredDelta.Size();
// Check to handle case where DesiredPos is the same as RootPos.
FVector DesiredDir;
if (DesiredLength < (float)KINDA_SMALL_NUMBER)
{
DesiredLength = (float)KINDA_SMALL_NUMBER;
DesiredDir = FVector(1, 0, 0);
}
else
{
//.........这里部分代码省略.........
示例10: GetHighPerformanceEnableForStat
virtual TStatId GetHighPerformanceEnableForStat(FName StatShortName, const char* InGroup, const char* InCategory, bool bDefaultEnable, bool bShouldClearEveryFrame, EStatDataType::Type InStatType, TCHAR const* InDescription, bool bCycleStat, FPlatformMemory::EMemoryCounterRegion MemoryRegion = FPlatformMemory::MCR_Invalid) override
{
FScopeLock ScopeLock(&SynchronizationObject);
FStatNameAndInfo LongName(StatShortName, InGroup, InCategory, InDescription, InStatType, bShouldClearEveryFrame, bCycleStat, MemoryRegion);
FName Stat = LongName.GetEncodedName();
FName Group(InGroup);
FGroupEnable* Found = HighPerformanceEnable.Find(Group);
if (Found)
{
if (Found->DefaultEnable != bDefaultEnable)
{
UE_LOG(LogStatGroupEnableManager, Fatal, TEXT("Stat group %s was was defined both on and off by default."), *Group.ToString());
}
TStatIdData** StatFound = Found->NamesInThisGroup.Find( Stat );
TStatIdData** StatFoundAlways = Found->AlwaysEnabledNamesInThisGroup.Find( Stat );
if( StatFound )
{
if( StatFoundAlways )
{
UE_LOG( LogStatGroupEnableManager, Fatal, TEXT( "Stat %s is both always enabled and not always enabled, so it was used for two different things." ), *Stat.ToString() );
}
return TStatId( *StatFound );
}
else if( StatFoundAlways )
{
return TStatId( *StatFoundAlways );
}
}
else
{
Found = &HighPerformanceEnable.Add( Group, FGroupEnable( bDefaultEnable || !bShouldClearEveryFrame ) );
// this was set up before we saw the group, so set the enable now
if (EnableForNewGroup.Contains(Group))
{
Found->CurrentEnable = EnableForNewGroup.FindChecked(Group);
EnableForNewGroup.Remove(Group); // by definition, we will never need this again
}
else if (UseEnableForNewGroups)
{
Found->CurrentEnable = EnableForNewGroups;
}
}
if (PendingCount < 1)
{
PendingStatIds = new TStatIdData[NUM_PER_BLOCK];
FMemory::Memzero( PendingStatIds, NUM_PER_BLOCK * sizeof( TStatIdData ) );
PendingCount = NUM_PER_BLOCK;
}
--PendingCount;
TStatIdData* Result = PendingStatIds;
const FString StatDescription = InDescription ? InDescription : StatShortName.GetPlainNameString();
// Get the wide stat description.
const int32 StatDescLen = StatDescription.Len() + 1;
// We are leaking this. @see STAT_StatDescMemory
WIDECHAR* StatDescWide = new WIDECHAR[StatDescLen];
TCString<WIDECHAR>::Strcpy( StatDescWide, StatDescLen, StringCast<WIDECHAR>( *StatDescription ).Get() );
Result->WideString = reinterpret_cast<uint64>(StatDescWide);
// Get the ansi stat description.
// We are leaking this. @see STAT_StatDescMemory
ANSICHAR* StatDescAnsi = new ANSICHAR[StatDescLen];
TCString<ANSICHAR>::Strcpy( StatDescAnsi, StatDescLen, StringCast<ANSICHAR>( *StatDescription ).Get() );
Result->AnsiString = reinterpret_cast<uint64>(StatDescAnsi);
MemoryCounter.Add( StatDescLen*(sizeof( ANSICHAR ) + sizeof( WIDECHAR )) );
++PendingStatIds;
if( Found->CurrentEnable )
{
EnableStat( Stat, Result );
}
if( bShouldClearEveryFrame )
{
Found->NamesInThisGroup.Add( Stat, Result );
}
else
{
Found->AlwaysEnabledNamesInThisGroup.Add( Stat, Result );
}
return TStatId(Result);
}
示例11: GetReferenceSkeleton
void USkeleton::UpdateRetargetSource( const FName Name )
{
FReferencePose * PoseFound = AnimRetargetSources.Find(Name);
if (PoseFound)
{
USkeletalMesh * ReferenceMesh = PoseFound->ReferenceMesh;
// reference mesh can be deleted after base pose is created, don't update it if it's not there.
if(ReferenceMesh)
{
const TArray<FTransform>& MeshRefPose = ReferenceMesh->RefSkeleton.GetRefBonePose();
const TArray<FTransform>& SkeletonRefPose = GetReferenceSkeleton().GetRefBonePose();
const TArray<FMeshBoneInfo> & SkeletonBoneInfo = GetReferenceSkeleton().GetRefBoneInfo();
PoseFound->ReferencePose.Empty(SkeletonRefPose.Num());
PoseFound->ReferencePose.AddUninitialized(SkeletonRefPose.Num());
for (int32 SkeletonBoneIndex=0; SkeletonBoneIndex<SkeletonRefPose.Num(); ++SkeletonBoneIndex)
{
FName SkeletonBoneName = SkeletonBoneInfo[SkeletonBoneIndex].Name;
int32 MeshBoneIndex = ReferenceMesh->RefSkeleton.FindBoneIndex(SkeletonBoneName);
if (MeshBoneIndex != INDEX_NONE)
{
PoseFound->ReferencePose[SkeletonBoneIndex] = MeshRefPose[MeshBoneIndex];
}
else
{
PoseFound->ReferencePose[SkeletonBoneIndex] = FTransform::Identity;
}
}
}
else
{
UE_LOG(LogAnimation, Warning, TEXT("Reference Mesh for Retarget Source %s has been removed."), *Name.ToString());
}
}
}
示例12: RunningPlatformName
TSharedPtr<IMediaPlayer> UMediaPlayer::FindPlayerForUrl(const FString& Url, const IMediaOptions& Options)
{
FName PlayerName = Options.GetDesiredPlayerName();
if (PlayerName == NAME_None)
{
PlayerName = DesiredPlayerName;
}
// reuse existing player if desired
if (Player.IsValid() && (PlayerName == Player->GetName()))
{
return Player;
}
// load media module
IMediaModule* MediaModule = FModuleManager::LoadModulePtr<IMediaModule>("Media");
if (MediaModule == nullptr)
{
UE_LOG(LogMediaAssets, Error, TEXT("Failed to load Media module"));
return nullptr;
}
// try to create desired player
if (PlayerName != NAME_None)
{
IMediaPlayerFactory* Factory = MediaModule->GetPlayerFactory(PlayerName);
if (Factory == nullptr)
{
UE_LOG(LogMediaAssets, Error, TEXT("Could not find desired player %s for %s"), *PlayerName.ToString(), *Url);
return nullptr;
}
TSharedPtr<IMediaPlayer> NewPlayer = Factory->CreatePlayer();
if (!NewPlayer.IsValid())
{
UE_LOG(LogMediaAssets, Error, TEXT("Failed to create desired player %s for %s"), *PlayerName.ToString(), *Url);
return nullptr;
}
return NewPlayer;
}
// try to reuse existing player
if (Player.IsValid())
{
IMediaPlayerFactory* Factory = MediaModule->GetPlayerFactory(Player->GetName());
if ((Factory != nullptr) && Factory->CanPlayUrl(Url, Options))
{
return Player;
}
}
// try to auto-select new player
const TArray<IMediaPlayerFactory*>& PlayerFactories = MediaModule->GetPlayerFactories();
const FString RunningPlatformName(FPlatformProperties::IniPlatformName());
for (IMediaPlayerFactory* Factory : PlayerFactories)
{
if (!Factory->SupportsPlatform(RunningPlatformName) || !Factory->CanPlayUrl(Url, Options))
{
continue;
}
TSharedPtr<IMediaPlayer> NewPlayer = Factory->CreatePlayer();
if (NewPlayer.IsValid())
{
return NewPlayer;
}
}
UE_LOG(LogMediaAssets, Error, TEXT("Could not find a native player for %s"), *Url);
return nullptr;
}
示例13: GetEditorMode
bool SLandscapeEditor::GetIsPropertyVisible(const FPropertyAndParent& PropertyAndParent) const
{
const UProperty& Property = PropertyAndParent.Property;
FEdModeLandscape* LandscapeEdMode = GetEditorMode();
if (LandscapeEdMode != NULL && LandscapeEdMode->CurrentTool != NULL)
{
if (Property.HasMetaData("ShowForMask"))
{
const bool bMaskEnabled = LandscapeEdMode->CurrentTool &&
LandscapeEdMode->CurrentTool->SupportsMask() &&
LandscapeEdMode->CurrentToolTarget.LandscapeInfo.IsValid() &&
LandscapeEdMode->CurrentToolTarget.LandscapeInfo->SelectedRegion.Num() > 0;
if (bMaskEnabled)
{
return true;
}
}
if (Property.HasMetaData("ShowForTools"))
{
const FName CurrentToolName = LandscapeEdMode->CurrentTool->GetToolName();
TArray<FString> ShowForTools;
Property.GetMetaData("ShowForTools").ParseIntoArray(&ShowForTools, TEXT(","), true);
if (!ShowForTools.Contains(CurrentToolName.ToString()))
{
return false;
}
}
if (Property.HasMetaData("ShowForBrushes"))
{
const FName CurrentBrushSetName = LandscapeEdMode->LandscapeBrushSets[LandscapeEdMode->CurrentBrushSetIndex].BrushSetName;
// const FName CurrentBrushName = LandscapeEdMode->CurrentBrush->GetBrushName();
TArray<FString> ShowForBrushes;
Property.GetMetaData("ShowForBrushes").ParseIntoArray(&ShowForBrushes, TEXT(","), true);
if (!ShowForBrushes.Contains(CurrentBrushSetName.ToString()))
//&& !ShowForBrushes.Contains(CurrentBrushName.ToString())
{
return false;
}
}
if (Property.HasMetaData("ShowForTargetTypes"))
{
static const TCHAR* TargetTypeNames[] = { TEXT("Heightmap"), TEXT("Weightmap"), TEXT("Visibility") };
TArray<FString> ShowForTargetTypes;
Property.GetMetaData("ShowForTargetTypes").ParseIntoArray(&ShowForTargetTypes, TEXT(","), true);
const ELandscapeToolTargetType::Type CurrentTargetType = LandscapeEdMode->CurrentToolTarget.TargetType;
if (CurrentTargetType == ELandscapeToolTargetType::Invalid ||
ShowForTargetTypes.FindByKey(TargetTypeNames[CurrentTargetType]) == nullptr)
{
return false;
}
}
return true;
}
return false;
}
示例14: OnDestroyForJoinSessionComplete
void UOnlineSessionClient::OnDestroyForJoinSessionComplete(FName SessionName, bool bWasSuccessful)
{
UE_LOG(LogOnline, Verbose, TEXT("OnDestroyForJoinSessionComplete %s bSuccess: %d"), *SessionName.ToString(), bWasSuccessful);
IOnlineSessionPtr SessionInt = GetSessionInt();
if (SessionInt.IsValid())
{
SessionInt->ClearOnDestroySessionCompleteDelegate_Handle(OnDestroyForJoinSessionCompleteDelegateHandle);
}
if (bWasSuccessful)
{
JoinSession(SessionName, CachedSessionResult);
}
bHandlingDisconnect = false;
}
示例15: UI_COMMAND
/** UI_COMMAND takes long for the compile to optimize */
PRAGMA_DISABLE_OPTIMIZATION
void FLevelViewportCommands::RegisterCommands()
{
UI_COMMAND( ToggleMaximize, "Maximize Viewport", "Toggles the Maximize state of the current viewport", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ToggleGameView, "Game View", "Toggles game view. Game view shows the scene as it appears in game", EUserInterfaceActionType::ToggleButton, FInputChord( EKeys::G ) );
UI_COMMAND( ToggleImmersive, "Immersive Mode", "Switches this viewport between immersive mode and regular mode", EUserInterfaceActionType::ToggleButton, FInputChord( EKeys::F11 ) );
UI_COMMAND( CreateCamera, "Create Camera Here", "Creates a new camera actor at the current location of this viewport's camera", EUserInterfaceActionType::Button, FInputChord() );
UI_COMMAND( HighResScreenshot, "High Resolution Screenshot...", "Opens the control panel for high resolution screenshots", EUserInterfaceActionType::Button, FInputChord() );
UI_COMMAND( UseDefaultShowFlags, "Use Defaults", "Resets all show flags to default", EUserInterfaceActionType::Button, FInputChord() );
UI_COMMAND( PilotSelectedActor, "Pilot Selected Actor", "Move the selected actor around using the viewport controls, and bind the viewport to the actor's location and orientation.", EUserInterfaceActionType::Button, FInputChord( EModifierKey::Control | EModifierKey::Shift, EKeys::P ) );
UI_COMMAND( EjectActorPilot, "Eject from Actor Pilot", "Stop piloting an actor with the current viewport. Unlocks the viewport's position and orientation from the actor the viewport is currently piloting.", EUserInterfaceActionType::Button, FInputChord() );
UI_COMMAND( ToggleActorPilotCameraView, "Actor Pilot Camera View", "Toggles showing the exact camera view when using the viewport to pilot a camera", EUserInterfaceActionType::ToggleButton, FInputChord( EModifierKey::Control | EModifierKey::Shift, EKeys::C ) );
UI_COMMAND( ViewportConfig_OnePane, "Layout One Pane", "Changes the viewport arrangement to one pane", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_TwoPanesH, "Layout Two Panes (horizontal)", "Changes the viewport arrangement to two panes, side-by-side", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_TwoPanesV, "Layout Two Panes (vertical)", "Changes the viewport arrangement to two panes, one above the other", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_ThreePanesLeft, "Layout Three Panes (one left, two right)", "Changes the viewport arrangement to three panes, one on the left, two on the right", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_ThreePanesRight, "Layout Three Panes (one right, two left)", "Changes the viewport arrangement to three panes, one on the right, two on the left", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_ThreePanesTop, "Layout Three Panes (one top, two bottom)", "Changes the viewport arrangement to three panes, one on the top, two on the bottom", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_ThreePanesBottom, "Layout Three Panes (one bottom, two top)", "Changes the viewport arrangement to three panes, one on the bottom, two on the top", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_FourPanesLeft, "Layout Four Panes (one left, three right)", "Changes the viewport arrangement to four panes, one on the left, three on the right", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_FourPanesRight, "Layout Four Panes (one right, three left)", "Changes the viewport arrangement to four panes, one on the right, three on the left", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_FourPanesTop, "Layout Four Panes (one top, three bottom)", "Changes the viewport arrangement to four panes, one on the top, three on the bottom", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_FourPanesBottom, "Layout Four Panes (one bottom, three top)", "Changes the viewport arrangement to four panes, one on the bottom, three on the top", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ViewportConfig_FourPanes2x2, "Layout Four Panes (2x2)", "Changes the viewport arrangement to four panes, in a 2x2 grid", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( ApplyMaterialToActor, "Apply Material", "Attempts to apply a dropped material to this object", EUserInterfaceActionType::Button, FInputChord() );
UI_COMMAND( ToggleCinematicPreview, "Toggles Cinematic Preview", "If enabled, allows Matinee or Sequencer previews to play in this viewport", EUserInterfaceActionType::ToggleButton, FInputChord() );
UI_COMMAND( FindInLevelScriptBlueprint, "Find In Level Script", "Finds references of a selected actor in the level script blueprint", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::K) );
UI_COMMAND( AdvancedSettings, "Advanced Settings...", "Opens the advanced viewport settings", EUserInterfaceActionType::Button, FInputChord());
// Generate a command for each buffer visualization mode
{
struct FMaterialIterator
{
const TSharedRef<class FBindingContext> Parent;
FLevelViewportCommands::TBufferVisualizationModeCommandMap& CommandMap;
FMaterialIterator(const TSharedRef<class FBindingContext> InParent, FLevelViewportCommands::TBufferVisualizationModeCommandMap& InCommandMap)
: Parent(InParent)
, CommandMap(InCommandMap)
{
}
void ProcessValue(const FString& InMaterialName, const UMaterial* InMaterial, const FText& InDisplayName)
{
FName ViewportCommandName = *(FString(TEXT("BufferVisualizationMenu")) + InMaterialName);
FBufferVisualizationRecord& Record = CommandMap.Add(ViewportCommandName, FBufferVisualizationRecord());
Record.Name = *InMaterialName;
const FText MaterialNameText = FText::FromString( InMaterialName );
Record.Command = FUICommandInfoDecl( Parent, ViewportCommandName, MaterialNameText, MaterialNameText )
.UserInterfaceType( EUserInterfaceActionType::RadioButton )
.DefaultChord( FInputChord() );
}
};
BufferVisualizationModeCommands.Empty();
FName ViewportCommandName = *(FString(TEXT("BufferVisualizationOverview")));
FBufferVisualizationRecord& OverviewRecord = BufferVisualizationModeCommands.Add(ViewportCommandName, FBufferVisualizationRecord());
OverviewRecord.Name = NAME_None;
OverviewRecord.Command = FUICommandInfoDecl( this->AsShared(), ViewportCommandName, LOCTEXT("BufferVisualization", "Overview"), LOCTEXT("BufferVisualization", "Overview") )
.UserInterfaceType( EUserInterfaceActionType::RadioButton )
.DefaultChord( FInputChord() );
FMaterialIterator It(this->AsShared(), BufferVisualizationModeCommands);
GetBufferVisualizationData().IterateOverAvailableMaterials(It);
}
const TArray<FShowFlagData>& ShowFlagData = GetShowFlagMenuItems();
// Generate a command for each show flag
for( int32 ShowFlag = 0; ShowFlag < ShowFlagData.Num(); ++ShowFlag )
{
const FShowFlagData& SFData = ShowFlagData[ShowFlag];
FFormatNamedArguments Args;
Args.Add( TEXT("ShowFlagName"), SFData.DisplayName );
FText LocalizedName;
switch( SFData.Group )
{
case SFG_Visualize:
LocalizedName = FText::Format( LOCTEXT("VisualizeFlagLabel", "Visualize {ShowFlagName}"), Args );
break;
default:
LocalizedName = FText::Format( LOCTEXT("ShowFlagLabel", "Show {ShowFlagName}"), Args );
break;
}
//@todo Slate: The show flags system does not support descriptions currently
const FText ShowFlagDesc;
TSharedPtr<FUICommandInfo> ShowFlagCommand
//.........这里部分代码省略.........