本文整理汇总了C++中UClass::GetFName方法的典型用法代码示例。如果您正苦于以下问题:C++ UClass::GetFName方法的具体用法?C++ UClass::GetFName怎么用?C++ UClass::GetFName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UClass
的用法示例。
在下文中一共展示了UClass::GetFName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SNew
TSharedRef<SWidget> SContentReference::MakeAssetPickerMenu()
{
FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser"));
FAssetPickerConfig AssetPickerConfig;
UClass* FilterClass = AllowedClass.Get();
if (FilterClass != NULL)
{
AssetPickerConfig.Filter.ClassNames.Add(FilterClass->GetFName());
AssetPickerConfig.Filter.bRecursiveClasses = true;
}
AssetPickerConfig.OnAssetSelected = FOnAssetSelected::CreateSP(this, &SContentReference::OnAssetSelectedFromPicker);
AssetPickerConfig.OnShouldFilterAsset = OnShouldFilterAsset;
AssetPickerConfig.bAllowNullSelection = true;
AssetPickerConfig.ThumbnailLabel = EThumbnailLabel::ClassName;
AssetPickerConfig.InitialAssetViewType = InitialAssetViewType;
return SNew(SBox)
.WidthOverride(AssetPickerSizeOverride.Get().X)
.HeightOverride(AssetPickerSizeOverride.Get().Y)
[
ContentBrowserModule.Get().CreateAssetPicker(AssetPickerConfig)
];
}
示例2: CollectTestsByClass
/**
* Generates a list of assets from the ENGINE and the GAME by a specific type.
* This is to be used by the GetTest() function.
*/
void FEditorAutomationTestUtilities::CollectTestsByClass(UClass * Class, TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands)
{
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
TArray<FAssetData> ObjectList;
AssetRegistryModule.Get().GetAssetsByClass(Class->GetFName(), ObjectList);
for (TObjectIterator<UClass> AllClassesIt; AllClassesIt; ++AllClassesIt)
{
UClass* ClassList = *AllClassesIt;
FName ClassName = ClassList->GetFName();
}
for (auto ObjIter = ObjectList.CreateConstIterator(); ObjIter; ++ObjIter)
{
const FAssetData& Asset = *ObjIter;
FString Filename = Asset.ObjectPath.ToString();
//convert to full paths
Filename = FPackageName::LongPackageNameToFilename(Filename);
if (FAutomationTestFramework::GetInstance().ShouldTestContent(Filename))
{
FString BeautifiedFilename = Asset.AssetName.ToString();
OutBeautifiedNames.Add(BeautifiedFilename);
OutTestCommands.Add(Asset.ObjectPath.ToString());
}
}
}
示例3:
TSharedRef<SWidget> SGraphPinObject::GenerateAssetPicker()
{
// This class and its children are the classes that we can show objects for
UClass* AllowedClass = Cast<UClass>(GraphPinObj->PinType.PinSubCategoryObject.Get());
if (AllowedClass == NULL)
{
AllowedClass = UObject::StaticClass();
}
FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser"));
FAssetPickerConfig AssetPickerConfig;
AssetPickerConfig.Filter.ClassNames.Add(AllowedClass->GetFName());
AssetPickerConfig.bAllowNullSelection = true;
AssetPickerConfig.Filter.bRecursiveClasses = true;
AssetPickerConfig.OnAssetSelected = FOnAssetSelected::CreateSP(this, &SGraphPinObject::OnAssetSelectedFromPicker);
AssetPickerConfig.ThumbnailScale = 0;
AssetPickerConfig.InitialAssetViewType = EAssetViewType::List;
return
SNew(SBox)
.HeightOverride(300)
.WidthOverride(300)
[
SNew(SBorder)
.BorderImage( FEditorStyle::GetBrush("Menu.Background") )
[
ContentBrowserModule.Get().CreateAssetPicker(AssetPickerConfig)
]
];
}
示例4: if
static int
luaURPropertyActor(lua_State *L)
{
char* actor = (char*) lua_topointer(L, lua_upvalueindex(1));
UObjectProperty* property = (UObjectProperty*) lua_topointer(L, lua_upvalueindex(2));
char* ptr = actor + property->Offset;
UObject** uobj = (UObject**) ptr;
if (lua_gettop(L) == 1) {
struct UnLuaActor* ula = (struct UnLuaActor*) luaL_testudata(L, -1, "UnrealActor");
struct UnrealClass *ulc = (struct UnrealClass*) luaL_testudata(L, -1, "UnrealClass");
if ((ula == NULL) && (ulc == NULL)) {
*uobj = NULL;
} else {
if (property->PropertyClass == UClass::StaticClass()) {
if (ulc == NULL) {
lua_pushliteral(L, "Invalid type");
lua_error(L);
}
*uobj = ulc->uclass;
} else {
if ((ula != NULL) && (ula->actor->IsA(property->PropertyClass))) {
*uobj = ula->actor;
} else {
lua_pushliteral(L, "Invalid type");
lua_error(L);
}
}
}
} else {
if (*uobj == NULL) {
lua_pushnil(L);
return 1;
}
if ((*uobj)->IsA(AActor::StaticClass())) {
lua_pushlightuserdata(L, *uobj);
luaGetActorByPointer(L);
return 1;
} else if ((*uobj)->IsA(UClass::StaticClass())) {
UClass* uclass = Cast<UClass>(*uobj);
struct UnrealClass* uc = (struct UnrealClass*)
lua_newuserdata(L, sizeof(struct UnrealClass));
luaL_setmetatable(L, "UnrealClass");
uc->uclass = uclass;
uc->classname = fname2dupstr(uclass->GetFName());
return 1;
} else {
lua_pushliteral(L, "Only getting actor classes or metaclasses is supported");
lua_error(L);
}
}
return 0;
}
示例5: FName
TSharedRef<SWidget> SGraphPinObject::GenerateAssetPicker()
{
// This class and its children are the classes that we can show objects for
UClass* AllowedClass = Cast<UClass>(GraphPinObj->PinType.PinSubCategoryObject.Get());
if (AllowedClass == NULL)
{
AllowedClass = UObject::StaticClass();
}
FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser"));
FAssetPickerConfig AssetPickerConfig;
AssetPickerConfig.Filter.ClassNames.Add(AllowedClass->GetFName());
AssetPickerConfig.bAllowNullSelection = true;
AssetPickerConfig.Filter.bRecursiveClasses = true;
AssetPickerConfig.OnAssetSelected = FOnAssetSelected::CreateSP(this, &SGraphPinObject::OnAssetSelectedFromPicker);
AssetPickerConfig.InitialAssetViewType = EAssetViewType::List;
AssetPickerConfig.bAllowDragging = false;
// Check with the node to see if there is any "AllowClasses" metadata for the pin
FString ClassFilterString = GraphPinObj->GetOwningNode()->GetPinMetaData(GraphPinObj->PinName, FName(TEXT("AllowedClasses")));
if( !ClassFilterString.IsEmpty() )
{
// Clear out the allowed class names and have the pin's metadata override.
AssetPickerConfig.Filter.ClassNames.Empty();
// Parse and add the classes from the metadata
TArray<FString> CustomClassFilterNames;
ClassFilterString.ParseIntoArray(CustomClassFilterNames, TEXT(","), true);
for(auto It = CustomClassFilterNames.CreateConstIterator(); It; ++It)
{
AssetPickerConfig.Filter.ClassNames.Add(FName(**It));
}
}
return
SNew(SBox)
.HeightOverride(300)
.WidthOverride(300)
[
SNew(SBorder)
.BorderImage( FEditorStyle::GetBrush("Menu.Background") )
[
ContentBrowserModule.Get().CreateAssetPicker(AssetPickerConfig)
]
];
}
示例6: InitializeResaveParameters
int32 UKismetUpdateCommandlet::InitializeResaveParameters(const TArray<FString>& Tokens, const TArray<FString>& Switches, TArray<FString>& MapPathNames)
{
// Do the inherited setup
int32 Result = Super::InitializeResaveParameters(Tokens, Switches, MapPathNames);
// Limit resaving to packages that contain a blueprint
for (TObjectIterator<UClass> ClassIt; ClassIt; ++ClassIt)
{
UClass* TestClass = *ClassIt;
if (TestClass->IsChildOf(UBlueprint::StaticClass()))
{
ResaveClasses.AddUnique(TestClass->GetFName());
}
}
// Filter out a lot of un-needed debugging information
Verbosity = INFORMATIVE;
//@TODO: Should not be required!
AddToRoot();
return Result;
}
示例7: DestroyChildActor
void UChildActorComponent::DestroyChildActor()
{
// If we own an Actor, kill it now unless we don't have authority on it, for that we rely on the server
// If the level that the child actor is being removed then don't destory the child actor so re-adding it doesn't
// need to create a new actor
if (ChildActor && ChildActor->HasAuthority() && !GetOwner()->GetLevel()->bIsBeingRemoved)
{
if (!GExitPurge)
{
// if still alive, destroy, otherwise just clear the pointer
if (!ChildActor->IsPendingKillOrUnreachable())
{
#if WITH_EDITOR
if (CachedInstanceData)
{
delete CachedInstanceData;
CachedInstanceData = nullptr;
}
#else
check(!CachedInstanceData);
#endif
// If we're already tearing down we won't be needing this
if (!HasAnyFlags(RF_BeginDestroyed) && !IsUnreachable())
{
CachedInstanceData = new FChildActorComponentInstanceData(this);
}
UWorld* World = ChildActor->GetWorld();
// World may be nullptr during shutdown
if (World != nullptr)
{
UClass* ChildClass = ChildActor->GetClass();
// We would like to make certain that our name is not going to accidentally get taken from us while we're destroyed
// so we increment ClassUnique beyond our index to be certain of it. This is ... a bit hacky.
int32& ClassUnique = ChildActor->GetOutermost()->ClassUniqueNameIndexMap.FindOrAdd(ChildClass->GetFName());
ClassUnique = FMath::Max(ClassUnique, ChildActor->GetFName().GetNumber());
// If we are getting here due to garbage collection we can't rename, so we'll have to abandon this child actor name and pick up a new one
if (!IsGarbageCollecting())
{
const FString ObjectBaseName = FString::Printf(TEXT("DESTROYED_%s_CHILDACTOR"), *ChildClass->GetName());
const ERenameFlags RenameFlags = ((GetWorld()->IsGameWorld() || IsLoading()) ? REN_DoNotDirty | REN_ForceNoResetLoaders : REN_DoNotDirty);
ChildActor->Rename(*MakeUniqueObjectName(ChildActor->GetOuter(), ChildClass, *ObjectBaseName).ToString(), nullptr, RenameFlags);
}
else
{
ChildActorName = NAME_None;
if (CachedInstanceData)
{
CachedInstanceData->ChildActorName = NAME_None;
}
}
World->DestroyActor(ChildActor);
}
}
}
ChildActor = nullptr;
}
}
示例8: Main
//.........这里部分代码省略.........
TArray<FString> PackageFileNameFilters;
GetStringArrayFromConfig(*SectionName, TEXT("PackageFileNameFilters"), PackageFileNameFilters, GatherTextConfigPath);
// PackageExtensions (DEPRECATED)
{
TArray<FString> PackageExtensions;
GetStringArrayFromConfig(*SectionName, TEXT("PackageExtensions"), PackageExtensions, GatherTextConfigPath);
if (PackageExtensions.Num())
{
PackageFileNameFilters.Append(PackageExtensions);
UE_LOG(LogGatherTextFromAssetsCommandlet, Warning, TEXT("PackageExtensions detected in section %s. PackageExtensions is deprecated, please use PackageFileNameFilters."), *SectionName);
}
}
if (PackageFileNameFilters.Num() == 0)
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Error, TEXT("No package file name filters in section %s."), *SectionName);
return -1;
}
//asset class exclude
TArray<FString> ExcludeClasses;
GetStringArrayFromConfig(*SectionName, TEXT("ExcludeClasses"), ExcludeClasses, GatherTextConfigPath);
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
AssetRegistryModule.Get().SearchAllAssets( true );
FARFilter Filter;
for(const auto& ExcludeClass : ExcludeClasses)
{
UClass* FilterClass = FindObject<UClass>(ANY_PACKAGE, *ExcludeClass);
if(FilterClass)
{
Filter.ClassNames.Add( FilterClass->GetFName() );
}
else
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Warning, TEXT("Invalid exclude class %s"), *ExcludeClass);
}
}
TArray<FAssetData> AssetDataArray;
AssetRegistryModule.Get().GetAssets(Filter, AssetDataArray);
FString UAssetPackageExtension = FPackageName::GetAssetPackageExtension();
TSet< FString > LongPackageNamesToExclude;
for (int Index = 0; Index < AssetDataArray.Num(); Index++)
{
LongPackageNamesToExclude.Add( FPackageName::LongPackageNameToFilename( AssetDataArray[Index].PackageName.ToString(), UAssetPackageExtension ) );
}
//Get whether we should fix broken properties that we find.
if (!GetBoolFromConfig(*SectionName, TEXT("bFixBroken"), bFixBroken, GatherTextConfigPath))
{
bFixBroken = false;
}
// Get whether we should gather editor-only data. Typically only useful for the localization of UE4 itself.
if (!GetBoolFromConfig(*SectionName, TEXT("ShouldGatherFromEditorOnlyData"), ShouldGatherFromEditorOnlyData, GatherTextConfigPath))
{
ShouldGatherFromEditorOnlyData = false;
}
// Add any manifest dependencies if they were provided
TArray<FString> ManifestDependenciesList;
GetPathArrayFromConfig(*SectionName, TEXT("ManifestDependencies"), ManifestDependenciesList, GatherTextConfigPath);
示例9: RunAssetDiffCommand
//.........这里部分代码省略.........
FString& FilePath = Tokens[FileIndex];
FMergeAsset& MergeAsset = MergeAssets[ParsedFileCount];
if (MergeAsset.SetSourceFile(FilePath, ErrorReporter))
{
++ParsedFileCount;
}
}
//--------------------------------------
// Verify file count
//--------------------------------------
const bool bWantsMerge = (ParsedFileCount > FilesNeededForDiff);
if (ParsedFileCount < FilesNeededForDiff)
{
ErrorReporter.ReportFatalError(LOCTEXT("TooFewParamsTitle", "Too Few Parameters"),
LOCTEXT("TooFewParamsError", "At least two files are needed (for a diff)."));
}
else if (bWantsMerge && (ParsedFileCount < FilesNeededForMerge))
{
ErrorReporter.ReportFatalError(LOCTEXT("TooFewParamsTitle", "Too Few Parameters"),
LOCTEXT("TooFewMergeParamsError", "To merge, at least two files are needed."));
}
else if (Tokens.Num() > FilesNeededForMerge)
{
ErrorReporter.ReportFatalError(LOCTEXT("TooManyParamsTitle", "Too Many Parameters"),
FText::Format( LOCTEXT("TooManyParamsError", "There were too many command arguments supplied. The maximum files needed are {0} (for merging)"), FText::AsNumber(FilesNeededForMerge) ));
}
//--------------------------------------
// Load diff/merge asset files
//--------------------------------------
bool bLoadSuccess = true;
if (bWantsMerge)
{
bLoadSuccess &= ThierAsset.Load(ErrorReporter);
bLoadSuccess &= OurAsset.Load(ErrorReporter);
bLoadSuccess &= BaseAsset.Load(ErrorReporter);
}
else
{
bLoadSuccess &= LeftAsset.Load(ErrorReporter);
bLoadSuccess &= RightAsset.Load(ErrorReporter);
}
//--------------------------------------
// Verify asset types
//--------------------------------------
IAssetTools& AssetTools = FModuleManager::GetModuleChecked<FAssetToolsModule>("AssetTools").Get();
if (bLoadSuccess)
{
if (LeftAsset.GetClass() != RightAsset.GetClass())
{
ErrorReporter.ReportFatalError(LOCTEXT("TypeMismatchTitle", "Asset Type Mismatch"),
LOCTEXT("TypeMismatchError", "Cannot compare files of different asset types."));
}
else if (bWantsMerge)
{
UClass* AssetClass = OurAsset.GetClass();
TWeakPtr<IAssetTypeActions> AssetActions = AssetTools.GetAssetTypeActionsForClass(AssetClass);
if (AssetClass != BaseAsset.GetClass())
{
ErrorReporter.ReportFatalError(LOCTEXT("TypeMismatchTitle", "Asset Type Mismatch"),
LOCTEXT("MergeTypeMismatchError", "Cannot merge files of different asset types."));
}
else if(!AssetActions.IsValid() || !AssetActions.Pin()->CanMerge())
{
ErrorReporter.ReportFatalError(LOCTEXT("CannotMergeTitle", "Cannot Merge"),
FText::Format(LOCTEXT("CannotMergeError", "{0} asset files can not be merged."), FText::FromName(AssetClass->GetFName())));
}
}
}
//--------------------------------------
// Preform diff/merge
//--------------------------------------
if (bLoadSuccess && !ErrorReporter.HasBlockingError())
{
if (bWantsMerge)
{
// unlike with diff'ing, for merging we rely on asset editors for
// merging, and those windows get childed to the main window (so it
// needs to be visible)
//
// @TODO: get it so asset editor windows can be shown standalone
FauxStandaloneToolManager.Disable();
RunAssetMerge(BaseAsset, ThierAsset, OurAsset, MergeResult);
}
else
{
AssetTools.DiffAssets(LeftAsset.GetAssetObj(), RightAsset.GetAssetObj(), LeftAsset.GetRevisionInfo(), RightAsset.GetRevisionInfo());
}
}
}
示例10: Main
int32 UGatherTextFromAssetsCommandlet::Main(const FString& Params)
{
// Parse command line.
TArray<FString> Tokens;
TArray<FString> Switches;
TMap<FString, FString> ParamVals;
UCommandlet::ParseCommandLine(*Params, Tokens, Switches, ParamVals);
//Set config file
const FString* ParamVal = ParamVals.Find(FString(TEXT("Config")));
FString GatherTextConfigPath;
if ( ParamVal )
{
GatherTextConfigPath = *ParamVal;
}
else
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Error, TEXT("No config specified."));
return -1;
}
//Set config section
ParamVal = ParamVals.Find(FString(TEXT("Section")));
FString SectionName;
if ( ParamVal )
{
SectionName = *ParamVal;
}
else
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Error, TEXT("No config section specified."));
return -1;
}
//Include paths
TArray<FString> IncludePaths;
GetConfigArray(*SectionName, TEXT("IncludePaths"), IncludePaths, GatherTextConfigPath);
if (IncludePaths.Num() == 0)
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Error, TEXT("No include paths in section %s"), *SectionName);
return -1;
}
//Exclude paths
TArray<FString> ExcludePaths;
GetConfigArray(*SectionName, TEXT("ExcludePaths"), ExcludePaths, GatherTextConfigPath);
//package extensions
TArray<FString> PackageExts;
GetConfigArray(*SectionName, TEXT("PackageExtensions"), PackageExts, GatherTextConfigPath);
if (PackageExts.Num() == 0)
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Warning, TEXT("No package extensions specified in section %s, using defaults"), *SectionName);
PackageExts.Add(FString("*") + FPackageName::GetAssetPackageExtension());
PackageExts.Add(FString("*") + FPackageName::GetMapPackageExtension());
}
//asset class exclude
TArray<FString> ExcludeClasses;
GetConfigArray(*SectionName, TEXT("ExcludeClasses"), ExcludeClasses, GatherTextConfigPath);
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
AssetRegistryModule.Get().SearchAllAssets( true );
FARFilter Filter;
for(int32 i = 0; i < ExcludeClasses.Num(); i++)
{
UClass* FilterClass = FindObject<UClass>(ANY_PACKAGE, *ExcludeClasses[i]);
if(FilterClass)
{
Filter.ClassNames.Add( FilterClass->GetFName() );
}
else
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Warning, TEXT("Invalid exclude class %s"), *ExcludeClasses[i]);
}
}
TArray<FAssetData> AssetData;
AssetRegistryModule.Get().GetAssets(Filter, AssetData);
FString UAssetPackageExtension = FPackageName::GetAssetPackageExtension();
TSet< FString > LongPackageNamesToExclude;
for (int Index = 0; Index < AssetData.Num(); Index++)
{
LongPackageNamesToExclude.Add( FPackageName::LongPackageNameToFilename( AssetData[Index].PackageName.ToString(), UAssetPackageExtension ) );
}
//Get whether we should fix broken properties that we find.
GetConfigBool(*SectionName, TEXT("bFixBroken"), bFixBroken, GatherTextConfigPath);
// Add any manifest dependencies if they were provided
TArray<FString> ManifestDependenciesList;
GetConfigArray(*SectionName, TEXT("ManifestDependencies"), ManifestDependenciesList, GatherTextConfigPath);
//.........这里部分代码省略.........
示例11: QueryCustomDetailLayout
void SDetailsViewBase::QueryCustomDetailLayout(FDetailLayoutData& LayoutData)
{
FPropertyEditorModule& ParentPlugin = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
// Get the registered classes that customize details
FCustomDetailLayoutNameMap& GlobalCustomLayoutNameMap = ParentPlugin.ClassNameToDetailLayoutNameMap;
UStruct* BaseStruct = LayoutData.DetailLayout->GetRootNode()->GetBaseStructure();
LayoutData.CustomizationClassInstances.Empty();
//Ask for generic details not specific to an object being viewed
if (GenericLayoutDelegate.IsBound())
{
// Create a new instance of the custom detail layout for the current class
TSharedRef<IDetailCustomization> CustomizationInstance = GenericLayoutDelegate.Execute();
// Ask for details immediately
CustomizationInstance->CustomizeDetails(*LayoutData.DetailLayout);
// Save the instance from destruction until we refresh
LayoutData.CustomizationClassInstances.Add(CustomizationInstance);
}
// Sort them by query order. @todo not good enough
struct FCompareFDetailLayoutCallback
{
FORCEINLINE bool operator()(const FDetailLayoutCallback& A, const FDetailLayoutCallback& B) const
{
return A.Order < B.Order;
}
};
TMap< TWeakObjectPtr<UStruct>, FDetailLayoutCallback*> FinalCallbackMap;
for (auto ClassIt = LayoutData.ClassesWithProperties.CreateConstIterator(); ClassIt; ++ClassIt)
{
// Must be a class
UClass* Class = Cast<UClass>(ClassIt->Get());
if (!Class)
{
continue;
}
// Check the instanced map first
FDetailLayoutCallback* Callback = InstancedClassToDetailLayoutMap.Find(Class);
if (!Callback)
{
// callback wasn't found in the per instance map, try the global instances instead
Callback = GlobalCustomLayoutNameMap.Find(Class->GetFName());
}
if (Callback)
{
FinalCallbackMap.Add(Class, Callback);
}
}
FinalCallbackMap.ValueSort(FCompareFDetailLayoutCallback());
TSet<UStruct*> QueriedClasses;
if (FinalCallbackMap.Num() > 0)
{
// Ask each class that we have properties for to customize its layout
for (auto LayoutIt(FinalCallbackMap.CreateConstIterator()); LayoutIt; ++LayoutIt)
{
const TWeakObjectPtr<UStruct> WeakClass = LayoutIt.Key();
if (WeakClass.IsValid())
{
UStruct* Class = WeakClass.Get();
FClassInstanceToPropertyMap& InstancedPropertyMap = LayoutData.ClassToPropertyMap.FindChecked(Class->GetFName());
for (FClassInstanceToPropertyMap::TIterator InstanceIt(InstancedPropertyMap); InstanceIt; ++InstanceIt)
{
FName Key = InstanceIt.Key();
LayoutData.DetailLayout->SetCurrentCustomizationClass(Class, Key);
const FOnGetDetailCustomizationInstance& DetailDelegate = LayoutIt.Value()->DetailLayoutDelegate;
if (DetailDelegate.IsBound())
{
QueriedClasses.Add(Class);
// Create a new instance of the custom detail layout for the current class
TSharedRef<IDetailCustomization> CustomizationInstance = DetailDelegate.Execute();
// Ask for details immediately
CustomizationInstance->CustomizeDetails(*LayoutData.DetailLayout);
// Save the instance from destruction until we refresh
LayoutData.CustomizationClassInstances.Add(CustomizationInstance);
}
}
}
}
}
//.........这里部分代码省略.........
示例12: OldVariableName
void UK2Node_Variable::ReconstructNode()
{
// update the variable reference if the property was renamed
UClass* const VarClass = GetVariableSourceClass();
if (VarClass)
{
bool bRemappedProperty = false;
UClass* SearchClass = VarClass;
while (SearchClass != NULL)
{
const TMap<FName, FName>* const ClassTaggedPropertyRedirects = UStruct::TaggedPropertyRedirects.Find( SearchClass->GetFName() );
if (ClassTaggedPropertyRedirects)
{
const FName* const NewPropertyName = ClassTaggedPropertyRedirects->Find( VariableReference.GetMemberName() );
if (NewPropertyName)
{
if (VariableReference.IsSelfContext())
{
VariableReference.SetSelfMember( *NewPropertyName );
}
else
{
VariableReference.SetExternalMember( *NewPropertyName, VarClass );
}
// found, can break
bRemappedProperty = true;
break;
}
}
SearchClass = SearchClass->GetSuperClass();
}
if (!bRemappedProperty)
{
static FName OldVariableName(TEXT("UpdatedComponent"));
static FName NewVariableName(TEXT("UpdatedPrimitive"));
bRemappedProperty = RemapRestrictedLinkReference(OldVariableName, NewVariableName, UMovementComponent::StaticClass(), UPrimitiveComponent::StaticClass(), true);
}
}
const FGuid VarGuid = VariableReference.GetMemberGuid();
if (VarGuid.IsValid())
{
const FName VarName = UBlueprint::GetFieldNameFromClassByGuid<UProperty>(VarClass, VarGuid);
if (VarName != NAME_None && VarName != VariableReference.GetMemberName())
{
if (VariableReference.IsSelfContext())
{
VariableReference.SetSelfMember( VarName );
}
else
{
VariableReference.SetExternalMember( VarName, VarClass );
}
}
}
Super::ReconstructNode();
}
示例13: NewSeparator
FComponentClassComboEntryPtr NewSeparator(new FComponentClassComboEntry());
ComponentClassList.Add(NewSeparator);
}
TArray<FComponentClassComboEntryPtr> SortedClassList;
AddBasicShapeComponents(SortedClassList);
TArray<FName> InMemoryClasses;
for (TObjectIterator<UClass> It; It; ++It)
{
UClass* Class = *It;
// If this is a subclass of Actor Component, not abstract, and tagged as spawnable from Kismet
if (Class->IsChildOf(UActorComponent::StaticClass()))
{
InMemoryClasses.Push(Class->GetFName());
if (!Class->HasAnyClassFlags(CLASS_Abstract) && Class->HasMetaData(FBlueprintMetadata::MD_BlueprintSpawnableComponent) && !FKismetEditorUtilities::IsClassABlueprintSkeleton(Class)) //@TODO: Fold this logic together with the one in UEdGraphSchema_K2::GetAddComponentClasses
{
TArray<FString> ClassGroupNames;
Class->GetClassGroupNames(ClassGroupNames);
if (ClassGroupNames.Contains(CommonClassGroup))
{
FString ClassGroup = CommonClassGroup;
FComponentClassComboEntryPtr NewEntry(new FComponentClassComboEntry(ClassGroup, Class, ClassGroupNames.Num() <= 1, EComponentCreateAction::SpawnExistingClass));
SortedClassList.Add(NewEntry);
}
if (ClassGroupNames.Num() && !ClassGroupNames[0].Equals(CommonClassGroup))
{
const bool bIncludeInFilter = true;
示例14: DestroyChildActor
void UChildActorComponent::DestroyChildActor(const bool bRequiresRename)
{
// If we own an Actor, kill it now
if (ChildActor != nullptr && !GExitPurge)
{
// if still alive, destroy, otherwise just clear the pointer
if (!ChildActor->IsPendingKill())
{
#if WITH_EDITOR
if (CachedInstanceData)
{
delete CachedInstanceData;
}
#else
check(!CachedInstanceData);
#endif
CachedInstanceData = new FChildActorComponentInstanceData(this);
UWorld* World = ChildActor->GetWorld();
// World may be nullptr during shutdown
if (World != nullptr)
{
UClass* ChildClass = ChildActor->GetClass();
// We would like to make certain that our name is not going to accidentally get taken from us while we're destroyed
// so we increment ClassUnique beyond our index to be certain of it. This is ... a bit hacky.
int32& ClassUnique = ChildActor->GetOutermost()->ClassUniqueNameIndexMap.FindOrAdd(ChildClass->GetFName());
ClassUnique = FMath::Max(ClassUnique, ChildActor->GetFName().GetNumber());
if (bRequiresRename)
{
const FString ObjectBaseName = FString::Printf(TEXT("DESTROYED_%s_CHILDACTOR"), *ChildClass->GetName());
const ERenameFlags RenameFlags = ((GetWorld()->IsGameWorld() || IsLoading()) ? REN_DoNotDirty | REN_ForceNoResetLoaders : REN_DoNotDirty);
ChildActor->Rename(*MakeUniqueObjectName(ChildActor->GetOuter(), ChildClass, *ObjectBaseName).ToString(), nullptr, RenameFlags);
}
World->DestroyActor(ChildActor);
}
}
}
ChildActor = nullptr;
}