本文整理汇总了C++中UClass::IsChildOf方法的典型用法代码示例。如果您正苦于以下问题:C++ UClass::IsChildOf方法的具体用法?C++ UClass::IsChildOf怎么用?C++ UClass::IsChildOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UClass
的用法示例。
在下文中一共展示了UClass::IsChildOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanVisualizeAsset
bool UClassThumbnailRenderer::CanVisualizeAsset(UObject* Object)
{
if (ThumbnailScene == nullptr)
{
ThumbnailScene = new FClassThumbnailScene();
}
UClass* Class = Cast<UClass>(Object);
// Only visualize actor based classes
if (Class && Class->IsChildOf(AActor::StaticClass()))
{
// Try to find any visible primitive components in the class' CDO
AActor* CDO = Class->GetDefaultObject<AActor>();
TInlineComponentArray<UActorComponent*> Components;
CDO->GetComponents(Components);
for (auto CompIt = Components.CreateConstIterator(); CompIt; ++CompIt)
{
if (ThumbnailScene->IsValidComponentForVisualization(*CompIt))
{
return true;
}
}
}
return false;
}
示例2: LoadCommandlet
/**
* Trys to load the UClass for the commandlet that was requested
*
* @param CommandletName the name of the commandlet to load
*/
static UClass* LoadCommandlet(const TCHAR* CommandletName)
{
// Try to find the UClass for the commandlet (works for all but script classes)
UClass* Class = FindObject<UClass>(ANY_PACKAGE,CommandletName,FALSE);
// Don't accept classes that are not commandlets...
if (!Class->IsChildOf(UCommandlet::StaticClass()))
{
Class = NULL;
}
// Name mangle by appending Commandlet
FString AppendedName(CommandletName);
AppendedName += TEXT("Commandlet");
if (Class == NULL)
{
Class = FindObject<UClass>(ANY_PACKAGE,*AppendedName,FALSE);
// Don't accept classes that are not commandlets...
if (!Class->IsChildOf(UCommandlet::StaticClass()))
{
Class = NULL;
}
}
// Let the user know that the commandlet wasn't found
if (Class == NULL)
{
warnf(TEXT("Failed to load commandlet %s"),CommandletName);
}
return Class;
}
示例3: FindIconForActors
const FSlateBrush* FClassIconFinder::FindIconForActors(const TArray< TWeakObjectPtr<AActor> >& InActors, UClass*& CommonBaseClass)
{
// Get the common base class of the selected actors
const FSlateBrush* CommonIcon = nullptr;
for( int32 ActorIdx = 0; ActorIdx < InActors.Num(); ++ActorIdx )
{
TWeakObjectPtr<AActor> Actor = InActors[ActorIdx];
UClass* ObjClass = Actor->GetClass();
if (!CommonBaseClass)
{
CommonBaseClass = ObjClass;
}
while (!ObjClass->IsChildOf(CommonBaseClass))
{
CommonBaseClass = CommonBaseClass->GetSuperClass();
}
const FSlateBrush* ActorIcon = FindIconForActor(Actor);
if (!CommonIcon)
{
CommonIcon = ActorIcon;
}
if (CommonIcon != ActorIcon)
{
CommonIcon = FindIconForClass(CommonBaseClass);
}
}
return CommonIcon;
}
示例4: GetToolkitName
FText FSimpleAssetEditor::GetToolkitName() const
{
const TArray<UObject*>& EditingObjs = GetEditingObjects();
check( EditingObjs.Num() > 0 );
FFormatNamedArguments Args;
Args.Add( TEXT("ToolkitName"), GetBaseToolkitName() );
if( EditingObjs.Num() == 1 )
{
const UObject* EditingObject = EditingObjs[ 0 ];
const bool bDirtyState = EditingObject->GetOutermost()->IsDirty();
Args.Add( TEXT("ObjectName"), FText::FromString( EditingObject->GetName() ) );
Args.Add( TEXT("DirtyState"), bDirtyState ? FText::FromString( TEXT( "*" ) ) : FText::GetEmpty() );
return FText::Format( LOCTEXT("ToolkitTitle", "{ObjectName}{DirtyState} - {ToolkitName}"), Args );
}
else
{
bool bDirtyState = false;
UClass* SharedBaseClass = nullptr;
for( int32 x = 0; x < EditingObjs.Num(); ++x )
{
UObject* Obj = EditingObjs[ x ];
check( Obj );
UClass* ObjClass = Cast<UClass>(Obj);
if (ObjClass == nullptr)
{
ObjClass = Obj->GetClass();
}
check( ObjClass );
// Initialize with the class of the first object we encounter.
if( SharedBaseClass == nullptr )
{
SharedBaseClass = ObjClass;
}
// If we've encountered an object that's not a subclass of the current best baseclass,
// climb up a step in the class hierarchy.
while( !ObjClass->IsChildOf( SharedBaseClass ) )
{
SharedBaseClass = SharedBaseClass->GetSuperClass();
}
// If any of the objects are dirty, flag the label
bDirtyState |= Obj->GetOutermost()->IsDirty();
}
check(SharedBaseClass);
Args.Add( TEXT("NumberOfObjects"), EditingObjs.Num() );
Args.Add( TEXT("ClassName"), FText::FromString( SharedBaseClass->GetName() ) );
Args.Add( TEXT("DirtyState"), bDirtyState ? FText::FromString( TEXT( "*" ) ) : FText::GetEmpty() );
return FText::Format( LOCTEXT("ToolkitTitle_EditingMultiple", "{NumberOfObjects} {ClassName}{DirtyState} - {ToolkitName}"), Args );
}
}
示例5: SpawnActorsForMovie
void UActorAnimationPlayer::SpawnActorsForMovie(TSharedRef<FMovieSceneSequenceInstance> MovieSceneInstance)
{
UWorld* WorldPtr = World.Get();
if (WorldPtr == nullptr)
{
return;
}
UMovieScene* MovieScene = MovieSceneInstance->GetSequence()->GetMovieScene();
if (MovieScene == nullptr)
{
return;
}
TArray<FSpawnedActorInfo>* FoundSpawnedActors = InstanceToSpawnedActorMap.Find(MovieSceneInstance);
if (FoundSpawnedActors != nullptr)
{
// Remove existing spawned actors for this movie
DestroyActorsForMovie( MovieSceneInstance );
}
TArray<FSpawnedActorInfo>& SpawnedActorList = InstanceToSpawnedActorMap.Add(MovieSceneInstance, TArray<FSpawnedActorInfo>());
for (auto SpawnableIndex = 0; SpawnableIndex < MovieScene->GetSpawnableCount(); ++SpawnableIndex)
{
auto& Spawnable = MovieScene->GetSpawnable(SpawnableIndex);
UClass* GeneratedClass = Spawnable.GetClass();
if ((GeneratedClass == nullptr) || !GeneratedClass->IsChildOf(AActor::StaticClass()))
{
continue;
}
AActor* ActorCDO = CastChecked<AActor>(GeneratedClass->ClassDefaultObject);
const FVector SpawnLocation = ActorCDO->GetRootComponent()->RelativeLocation;
const FRotator SpawnRotation = ActorCDO->GetRootComponent()->RelativeRotation;
FActorSpawnParameters SpawnInfo;
{
SpawnInfo.ObjectFlags = RF_NoFlags;
}
AActor* NewActor = WorldPtr->SpawnActor(GeneratedClass, &SpawnLocation, &SpawnRotation, SpawnInfo);
if (NewActor)
{
// Actor was spawned OK!
FSpawnedActorInfo NewInfo;
{
NewInfo.RuntimeGuid = Spawnable.GetGuid();
NewInfo.SpawnedActor = NewActor;
}
SpawnedActorList.Add(NewInfo);
}
}
}
示例6: IsBindingCompatible
//------------------------------------------------------------------------------
bool UBlueprintBoundEventNodeSpawner::IsBindingCompatible(UObject const* BindingCandidate) const
{
bool bMatchesNodeType = false;
if (NodeClass->IsChildOf<UK2Node_ComponentBoundEvent>())
{
UObjectProperty const* BindingProperty = Cast<UObjectProperty>(BindingCandidate);
bMatchesNodeType = (BindingProperty != nullptr);
}
else if (NodeClass->IsChildOf<UK2Node_ActorBoundEvent>())
{
bMatchesNodeType = BindingCandidate->IsA<AActor>();
}
const UMulticastDelegateProperty* Delegate = GetEventDelegate();
if ( !ensureMsgf(!FBlueprintNodeSpawnerUtils::IsStaleFieldAction(this),
TEXT("Invalid BlueprintBoundEventNodeSpawner (for %s). Was the action database properly updated when this class was compiled?"),
*Delegate->GetOwnerClass()->GetName()))
{
return false;
}
UClass* DelegateOwner = Delegate->GetOwnerClass()->GetAuthoritativeClass();
UClass* BindingClass = FBlueprintNodeSpawnerUtils::GetBindingClass(BindingCandidate)->GetAuthoritativeClass();
return bMatchesNodeType && BindingClass->IsChildOf(DelegateOwner) && !FObjectEditorUtils::IsVariableCategoryHiddenFromClass(Delegate, BindingClass);
}
示例7: SetBestBaseClass
// Looks at the Objects array and returns the best base class. Called by
// Finalize(); that is, when the list of selected objects is being finalized.
void FObjectPropertyNode::SetBestBaseClass()
{
BaseClass = NULL;
for( int32 x = 0 ; x < Objects.Num() ; ++x )
{
UObject* Obj = Objects[x].Get();
if( Obj )
{
UClass* ObjClass = Cast<UClass>(Obj);
if (ObjClass == NULL)
{
ObjClass = Obj->GetClass();
}
check( ObjClass );
// Initialize with the class of the first object we encounter.
if( BaseClass == NULL )
{
BaseClass = ObjClass;
}
// If we've encountered an object that's not a subclass of the current best baseclass,
// climb up a step in the class hierarchy.
while( !ObjClass->IsChildOf( BaseClass.Get() ) )
{
BaseClass = BaseClass->GetSuperClass();
}
}
}
}
示例8: FindNetServiceFunctionById
UFunction* FindNetServiceFunctionById(int16 RPCId)
{
UFunction** Function = RPCFunctionMap.Find(RPCId);
if (!Function)
{
for (TObjectIterator<UClass> ClassIt; ClassIt; ++ClassIt)
{
UClass* Class = *ClassIt;
if (Class->IsChildOf(AActor::StaticClass())
&& !(Class->HasAnyClassFlags(CLASS_Abstract | CLASS_Deprecated)))
{
for (TFieldIterator<UFunction> FuncIt(Class); FuncIt; ++FuncIt)
{
UFunction* CurFunc = *FuncIt;
if (CurFunc->RPCId > 0)
{
RPCFunctionMap.Add(CurFunc->RPCId, CurFunc);
}
}
}
}
Function = RPCFunctionMap.Find(RPCId);
}
return *Function;
}
示例9: RefreshAssetInRegistry
void SMaterialPalette::RefreshAssetInRegistry(const FAssetData& InAddedAssetData)
{
// Grab the asset class, it will be checked for being a material function.
UClass* Asset = FindObject<UClass>(ANY_PACKAGE, *InAddedAssetData.AssetClass.ToString());
if (Asset->IsChildOf(UMaterialFunction::StaticClass()))
{
RefreshActionsList(true);
}
}
示例10: if
void UK2Node_AddComponent::ValidateNodeDuringCompilation(FCompilerResultsLog& MessageLog) const
{
Super::ValidateNodeDuringCompilation(MessageLog);
UActorComponent* Template = GetTemplateFromNode();
if (Template)
{
UClass* TemplateClass = Template->GetClass();
if (!TemplateClass->IsChildOf(UActorComponent::StaticClass()) || TemplateClass->HasAnyClassFlags(CLASS_Abstract) || !TemplateClass->HasMetaData(FBlueprintMetadata::MD_BlueprintSpawnableComponent) )
{
FFormatNamedArguments Args;
Args.Add(TEXT("TemplateClass"), FText::FromString(TemplateClass->GetName()));
Args.Add(TEXT("NodeTitle"), GetNodeTitle(ENodeTitleType::FullTitle));
MessageLog.Error(*FText::Format(NSLOCTEXT("KismetCompiler", "InvalidComponentTemplate_Error", "Invalid class '{TemplateClass}' used as template by '{NodeTitle}' for @@"), Args).ToString(), this);
}
if (UChildActorComponent const* ChildActorComponent = Cast<UChildActorComponent const>(Template))
{
UBlueprint const* Blueprint = GetBlueprint();
UClass const* ChildActorClass = ChildActorComponent->GetChildActorClass();
if (ChildActorClass == Blueprint->GeneratedClass)
{
UEdGraph const* ParentGraph = GetGraph();
UEdGraphSchema_K2 const* K2Schema = GetDefault<UEdGraphSchema_K2>();
if (K2Schema->IsConstructionScript(ParentGraph))
{
FFormatNamedArguments Args;
Args.Add(TEXT("ChildActorClass"), FText::FromString(ChildActorClass->GetName()));
MessageLog.Error(*FText::Format(NSLOCTEXT("KismetCompiler", "AddSelfComponent_Error", "@@ cannot add a '{ChildActorClass}' component in the construction script (could cause infinite recursion)."), Args).ToString(), this);
}
}
else if (ChildActorClass != nullptr)
{
AActor const* ChildActor = Cast<AActor>(ChildActorClass->ClassDefaultObject);
check(ChildActor != nullptr);
USceneComponent* RootComponent = ChildActor->GetRootComponent();
if ((RootComponent != nullptr) && (RootComponent->Mobility == EComponentMobility::Static) && (ChildActorComponent->Mobility != EComponentMobility::Static))
{
FFormatNamedArguments Args;
Args.Add(TEXT("ChildActorClass"), FText::FromString(ChildActorClass->GetName()));
MessageLog.Error(*FText::Format(NSLOCTEXT("KismetCompiler", "AddStaticChildActorComponent_Error", "@@ cannot add a '{ChildActorClass}' component as it has static mobility, and the ChildActorComponent does not."), Args).ToString(), this);
}
}
}
}
else
{
FFormatNamedArguments Args;
Args.Add(TEXT("NodeTitle"), GetNodeTitle(ENodeTitleType::FullTitle));
MessageLog.Error(*FText::Format(NSLOCTEXT("KismetCompiler", "MissingComponentTemplate_Error", "Unknown template referenced by '{NodeTitle}' for @@"), Args).ToString(), this);
}
}
示例11: GetRenderingInfo
FThumbnailRenderingInfo* UThumbnailManager::GetRenderingInfo(UObject* Object)
{
// If something may have been GCed, empty the map so we don't crash
if (bMapNeedsUpdate == true)
{
RenderInfoMap.Empty();
bMapNeedsUpdate = false;
}
check(Object);
TArray<FThumbnailRenderingInfo>& ThumbnailTypes = RenderableThumbnailTypes;
// Get the class to check against.
UClass *ClassToCheck = ClassToCheck = Object->GetClass();
// Search for the cached entry and do the slower if not found
FThumbnailRenderingInfo* RenderInfo = RenderInfoMap.FindRef(ClassToCheck);
if (RenderInfo == nullptr)
{
// Loop through searching for the right thumbnail entry
for (int32 Index = ThumbnailTypes.Num() - 1; (Index >= 0) && (RenderInfo == nullptr); Index--)
{
RenderInfo = &ThumbnailTypes[Index];
// See if this thumbnail renderer will work for the specified class or
// if there is some data reason not to render the thumbnail
if ((ClassToCheck->IsChildOf(RenderInfo->ClassNeedingThumbnail) == false) || (RenderInfo->Renderer == nullptr))
{
RenderInfo = nullptr;
}
}
// Make sure to add it to the cache if it is missing
RenderInfoMap.Add(ClassToCheck, (RenderInfo != nullptr) ? RenderInfo : &NotSupported);
}
if ( RenderInfo && RenderInfo->Renderer )
{
if ( !RenderInfo->Renderer->CanVisualizeAsset(Object) )
{
// This is an asset with a thumbnail renderer, but it can't visualized (i.e it is something like a blueprint that doesn't contain any visible primitive components)
RenderInfo = nullptr;
}
}
// Check to see if this object is the "not supported" type or not
if (RenderInfo == &NotSupported)
{
RenderInfo = nullptr;
}
return RenderInfo;
}
示例12: ShouldDisplayThumbnail
bool SPropertyEditorAsset::ShouldDisplayThumbnail( const FArguments& InArgs )
{
// Decide whether we should display the thumbnail or not
bool bDisplayThumbnailByDefault = false;
if(PropertyEditor.IsValid())
{
UProperty* NodeProperty = PropertyEditor->GetPropertyNode()->GetProperty();
UClass* Class = GetObjectPropertyClass(NodeProperty);
bDisplayThumbnailByDefault |= Class->IsChildOf(UMaterialInterface::StaticClass()) ||
Class->IsChildOf(UTexture::StaticClass()) ||
Class->IsChildOf(UStaticMesh::StaticClass()) ||
Class->IsChildOf(UStaticMeshComponent::StaticClass()) ||
Class->IsChildOf(USkeletalMesh::StaticClass()) ||
Class->IsChildOf(USkeletalMeshComponent::StaticClass()) ||
Class->IsChildOf(UParticleSystem::StaticClass());
}
bool bDisplayThumbnail = ( bDisplayThumbnailByDefault || InArgs._DisplayThumbnail ) && InArgs._ThumbnailPool.IsValid();
if(PropertyEditor.IsValid())
{
// also check metadata for thumbnail & text display
if(InArgs._ThumbnailPool.IsValid())
{
const UProperty* ArrayParent = PropertyEditorHelpers::GetArrayParent( *PropertyEditor->GetPropertyNode() );
const UProperty* SetParent = PropertyEditorHelpers::GetSetParent( *PropertyEditor->GetPropertyNode() );
const UProperty* MapParent = PropertyEditorHelpers::GetMapParent( *PropertyEditor->GetPropertyNode() );
const UProperty* PropertyToCheck = PropertyEditor->GetProperty();
if( ArrayParent != NULL )
{
// If the property is a child of an array property, the parent will have the display thumbnail metadata
PropertyToCheck = ArrayParent;
}
else if ( SetParent != NULL )
{
PropertyToCheck = SetParent;
}
else if ( MapParent != NULL )
{
PropertyToCheck = MapParent;
}
FString DisplayThumbnailString = PropertyToCheck->GetMetaData(TEXT("DisplayThumbnail"));
if(DisplayThumbnailString.Len() > 0)
{
bDisplayThumbnail = DisplayThumbnailString == TEXT("true");
}
}
}
return bDisplayThumbnail;
}
示例13: RefreshNameSwaps
void FGameplayCueTranslationManager::RefreshNameSwaps()
{
AllNameSwaps.Reset();
TArray<UGameplayCueTranslator*> CDOList;
// Gather CDOs
for( TObjectIterator<UClass> It ; It ; ++It )
{
UClass* Class = *It;
if( !Class->HasAnyClassFlags(CLASS_Abstract | CLASS_Deprecated) )
{
if( Class->IsChildOf(UGameplayCueTranslator::StaticClass()) )
{
UGameplayCueTranslator* CDO = Class->GetDefaultObject<UGameplayCueTranslator>();
if (CDO->IsEnabled())
{
CDOList.Add(CDO);
}
}
}
}
// Sort and get translated names
CDOList.Sort([](const UGameplayCueTranslator& A, const UGameplayCueTranslator& B) { return (A.GetPriority() > B.GetPriority()); });
for (UGameplayCueTranslator* CDO : CDOList)
{
FNameSwapData& Data = AllNameSwaps[AllNameSwaps.AddDefaulted()];
CDO->GetTranslationNameSpawns(Data.NameSwaps);
if (Data.NameSwaps.Num() > 0)
{
Data.ClassCDO = CDO;
}
else
{
AllNameSwaps.Pop(false);
}
}
#if WITH_EDITOR
// Give UniqueID to each rule
int32 ID=1;
for (FNameSwapData& GroupData : AllNameSwaps)
{
for (FGameplayCueTranslationNameSwap& SwapData : GroupData.NameSwaps)
{
SwapData.EditorData.UniqueID = ID++;
}
}
#endif
}
示例14: GetToolkitToolTipText
FText FSimpleAssetEditor::GetToolkitToolTipText() const
{
const TArray<UObject*>& EditingObjs = GetEditingObjects();
check( EditingObjs.Num() > 0 );
FFormatNamedArguments Args;
Args.Add( TEXT("ToolkitName"), GetBaseToolkitName() );
if( EditingObjs.Num() == 1 )
{
const UObject* EditingObject = EditingObjs[ 0 ];
return FAssetEditorToolkit::GetToolTipTextForObject(EditingObject);
}
else
{
UClass* SharedBaseClass = NULL;
for( int32 x = 0; x < EditingObjs.Num(); ++x )
{
UObject* Obj = EditingObjs[ x ];
check( Obj );
UClass* ObjClass = Cast<UClass>(Obj);
if (ObjClass == nullptr)
{
ObjClass = Obj->GetClass();
}
check( ObjClass );
// Initialize with the class of the first object we encounter.
if( SharedBaseClass == nullptr )
{
SharedBaseClass = ObjClass;
}
// If we've encountered an object that's not a subclass of the current best baseclass,
// climb up a step in the class hierarchy.
while( !ObjClass->IsChildOf( SharedBaseClass ) )
{
SharedBaseClass = SharedBaseClass->GetSuperClass();
}
}
check(SharedBaseClass);
Args.Add( TEXT("NumberOfObjects"), EditingObjs.Num() );
Args.Add( TEXT("ClassName"), FText::FromString( SharedBaseClass->GetName() ) );
return FText::Format( LOCTEXT("ToolkitTitle_EditingMultipleToolTip", "{NumberOfObjects} {ClassName} - {ToolkitName}"), Args );
}
}
示例15: ScopedContextOverride
TOptional<ECurrentState> FAutoReimportManager::ProcessAdditions(const FTimeLimit& TimeLimit)
{
// Override the global feedback context while we do this to avoid popping up dialogs
TGuardValue<FFeedbackContext*> ScopedContextOverride(GWarn, FeedbackContextOverride.Get());
TGuardValue<bool> ScopedAssetChangesGuard(bGuardAssetChanges, true);
FeedbackContextOverride->GetContent()->SetMainText(GetProgressText());
TMap<FString, TArray<UFactory*>> Factories;
TArray<FString> FactoryExtensions;
FactoryExtensions.Reserve(16);
// Get the list of valid factories
for (TObjectIterator<UClass> It ; It ; ++It)
{
UClass* CurrentClass = (*It);
if (CurrentClass->IsChildOf(UFactory::StaticClass()) && !(CurrentClass->HasAnyClassFlags(CLASS_Abstract)))
{
UFactory* Factory = Cast<UFactory>(CurrentClass->GetDefaultObject());
if (Factory->bEditorImport && Factory->ImportPriority >= 0)
{
FactoryExtensions.Reset();
Factory->GetSupportedFileExtensions(FactoryExtensions);
for (const auto& Ext : FactoryExtensions)
{
auto& Array = Factories.FindOrAdd(Ext);
Array.Add(Factory);
}
}
}
}
for (auto& Pair : Factories)
{
Pair.Value.Sort([](const UFactory& A, const UFactory& B) { return A.ImportPriority > B.ImportPriority; });
}
const IAssetRegistry& Registry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry").Get();
for (auto& Monitor : DirectoryMonitors)
{
Monitor.ProcessAdditions(Registry, TimeLimit, PackagesToSave, Factories, *FeedbackContextOverride);
yield TOptional<ECurrentState>();
}
return ECurrentState::ProcessModifications;
}