本文整理汇总了C++中UObject::IsA方法的典型用法代码示例。如果您正苦于以下问题:C++ UObject::IsA方法的具体用法?C++ UObject::IsA怎么用?C++ UObject::IsA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UObject
的用法示例。
在下文中一共展示了UObject::IsA方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecursiveObjectCollection
void FContentComparisonHelper::RecursiveObjectCollection(UObject* InStartObject, int32 InCurrDepth, int32 InMaxDepth, TMap<UObject*,bool>& OutCollectedReferences)
{
// Serialize object with reference collector.
TArray<UObject*> LocalCollectedReferences;
FReferenceFinder ObjectReferenceCollector( LocalCollectedReferences, NULL, false, true, true, true );
ObjectReferenceCollector.FindReferences( InStartObject );
if (InCurrDepth < InMaxDepth)
{
InCurrDepth++;
for (int32 ObjRefIdx = 0; ObjRefIdx < LocalCollectedReferences.Num(); ObjRefIdx++)
{
UObject* InnerObject = LocalCollectedReferences[ObjRefIdx];
if ((InnerObject != NULL) &&
(InnerObject->IsA(UFunction::StaticClass()) == false) &&
(InnerObject->IsA(UPackage::StaticClass()) == false)
)
{
OutCollectedReferences.Add(InnerObject, true);
RecursiveObjectCollection(InnerObject, InCurrDepth, InMaxDepth, OutCollectedReferences);
}
}
InCurrDepth--;
}
}
示例2: ProcessPackages
void UGatherTextFromAssetsCommandlet::ProcessPackages( const TArray< UPackage* >& PackagesToProcess )
{
for( int32 i = 0; i < PackagesToProcess.Num(); ++i )
{
UPackage* Package = PackagesToProcess[i];
TArray<UObject*> Objects;
GetObjectsWithOuter(Package, Objects);
for( int32 j = 0; j < Objects.Num(); ++j )
{
UObject* Object = Objects[j];
if ( Object->IsA( UBlueprint::StaticClass() ) )
{
UBlueprint* Blueprint = Cast<UBlueprint>( Object );
if( Blueprint->GeneratedClass != NULL )
{
ProcessObject( Blueprint->GeneratedClass->GetDefaultObject(), Package );
}
else
{
UE_LOG(LogGatherTextFromAssetsCommandlet, Warning, TEXT("%s - Invalid generated class!"), *Blueprint->GetFullName());
}
}
else if( Object->IsA( UDialogueWave::StaticClass() ) )
{
UDialogueWave* DialogueWave = Cast<UDialogueWave>( Object );
ProcessDialogueWave( DialogueWave );
}
ProcessObject( Object, Package );
}
}
}
示例3: RemoveOrphanedNodes
void UEnvironmentQueryGraph::RemoveOrphanedNodes()
{
UEnvQuery* QueryAsset = CastChecked<UEnvQuery>(GetOuter());
// Obtain a list of all nodes that should be in the asset
TSet<UObject*> AllNodes;
for (int32 Index = 0; Index < Nodes.Num(); ++Index)
{
UEnvironmentQueryGraphNode_Option* OptionNode = Cast<UEnvironmentQueryGraphNode_Option>(Nodes[Index]);
if (OptionNode)
{
UEnvQueryOption* OptionInstance = Cast<UEnvQueryOption>(OptionNode->NodeInstance);
if (OptionInstance)
{
AllNodes.Add(OptionInstance);
if (OptionInstance->Generator)
{
AllNodes.Add(OptionInstance->Generator);
}
}
for (int32 SubIdx = 0; SubIdx < OptionNode->Tests.Num(); SubIdx++)
{
if (OptionNode->Tests[SubIdx] && OptionNode->Tests[SubIdx]->NodeInstance)
{
AllNodes.Add(OptionNode->Tests[SubIdx]->NodeInstance);
}
}
}
}
// Obtain a list of all nodes actually in the asset and discard unused nodes
TArray<UObject*> AllInners;
const bool bIncludeNestedObjects = false;
GetObjectsWithOuter(QueryAsset, AllInners, bIncludeNestedObjects);
for (auto InnerIt = AllInners.CreateConstIterator(); InnerIt; ++InnerIt)
{
UObject* Node = *InnerIt;
const bool bEQSNode =
Node->IsA(UEnvQueryGenerator::StaticClass()) ||
Node->IsA(UEnvQueryTest::StaticClass()) ||
Node->IsA(UEnvQueryOption::StaticClass());
if (bEQSNode && !AllNodes.Contains(Node))
{
Node->SetFlags(RF_Transient);
Node->Rename(NULL, GetTransientPackage(), REN_DontCreateRedirectors | REN_NonTransactional | REN_ForceNoResetLoaders);
}
}
}
示例4: OnExecuteAction
FReply FEditorUtilityInstanceDetails::OnExecuteAction(TWeakObjectPtr<UFunction> WeakFunctionPtr)
{
if (UFunction* Function = WeakFunctionPtr.Get())
{
FScopedTransaction Transaction( NSLOCTEXT("UnrealEd", "BlutilityAction", "Blutility Action") );
FEditorScriptExecutionGuard ScriptGuard;
UClass* MinRequiredClass = Function->GetOuterUClass();
// Execute this function on any objects that support it
for (auto SelectedObjectIt = SelectedObjectsList.CreateConstIterator(); SelectedObjectIt; ++SelectedObjectIt)
{
UObject* Object = (*SelectedObjectIt).Get();
if ((Object != NULL) && (Object->IsA(MinRequiredClass)))
{
Object->ProcessEvent(Function, NULL);
if (UGlobalEditorUtilityBase* BlutilityInstance = Cast<UGlobalEditorUtilityBase>(Object))
{
BlutilityInstance->PostExecutionCleanup();
}
}
}
}
return FReply::Handled();
}
示例5: LoadAssetsFromPaths
int32 UObjectLibrary::LoadAssetsFromPaths(const TArray<FString>& Paths)
{
int32 Count = 0;
if (bIsFullyLoaded)
{
// We already ran this
return 0;
}
bIsFullyLoaded = true;
for (int PathIndex = 0; PathIndex < Paths.Num(); PathIndex++)
{
TArray<UObject*> LoadedObjects;
FString Path = Paths[PathIndex];
if (EngineUtils::FindOrLoadAssetsByPath(Path, LoadedObjects, bHasBlueprintClasses ? EngineUtils::ATL_Class : EngineUtils::ATL_Regular))
{
for (int32 i = 0; i < LoadedObjects.Num(); ++i)
{
UObject* Object = LoadedObjects[i];
if (Object == NULL || (ObjectBaseClass && !Object->IsA(ObjectBaseClass)))
{
// Incorrect type, skip
continue;
}
AddObject(Object);
Count++;
}
}
}
return Count;
}
示例6: CurrentObject
FArchiveGenerateReferenceGraph::FArchiveGenerateReferenceGraph( FReferenceGraph& OutGraph )
: CurrentObject(NULL),
ObjectGraph(OutGraph)
{
ArIsObjectReferenceCollector = true;
ArIgnoreOuterRef = true;
// Iterate over each object..
for( FObjectIterator It; It; ++It )
{
UObject* Object = *It;
// Skip transient and those about to be deleted
if( !Object->HasAnyFlags( RF_Transient | RF_PendingKill ) )
{
// only serialize non actors objects which have not been visited.
// actors are skipped because we have don't need them to show the reference tree
// @todo, may need to serialize them later for full reference graph.
if( !VisitedObjects.Find( Object ) && !Object->IsA( AActor::StaticClass() ) )
{
// Set the current object to the one we are about to serialize
CurrentObject = Object;
// This object has been visited. Any serializations after this should skip this object
VisitedObjects.Add( Object );
Object->Serialize( *this );
}
}
}
}
示例7: DeselectAll
void USelection::DeselectAll( UClass* InClass )
{
// Fast path for deselecting all UObjects with any flags
if ( InClass == UObject::StaticClass() )
{
InClass = nullptr;
}
bool bSelectionChanged = false;
TSet<FSelectedClassInfo> RemovedClasses;
// Remove from the end to minimize memmoves.
for ( int32 i = SelectedObjects.Num()-1 ; i >= 0 ; --i )
{
UObject* Object = GetSelectedObject(i);
if ( !Object )
{
// Remove NULLs from SelectedObjects array.
SelectedObjects.RemoveAt( i );
}
else if( !InClass || Object->IsA( InClass ) )
{
// if the object is of type InClass then all objects of that same type will be removed
RemovedClasses.Add(FSelectedClassInfo(Object->GetClass()));
GSelectedAnnotation.Clear(Object);
SelectedObjects.RemoveAt( i );
// Call this after the item has been removed from the selection set.
USelection::SelectObjectEvent.Broadcast( Object );
bSelectionChanged = true;
}
}
if( InClass == nullptr )
{
SelectedClasses.Empty();
}
else
{
// Remove the passed in class and all child classes that were removed
// from the list of currently selected classes
RemovedClasses.Add(InClass);
SelectedClasses = SelectedClasses.Difference(RemovedClasses);
}
if ( bSelectionChanged )
{
MarkBatchDirty();
if ( !IsBatchSelecting() )
{
USelection::SelectionChangedEvent.Broadcast(this);
}
}
}
示例8: GetTypedOuter
/**
* Traverses the outer chain searching for the next object of a certain type. (T must be derived from UObject)
*
* @param Target class to search for
* @return a pointer to the first object in this object's Outer chain which is of the correct type.
*/
UObject* UObjectBaseUtility::GetTypedOuter(UClass* Target) const
{
UObject* Result = NULL;
for ( UObject* NextOuter = GetOuter(); Result == NULL && NextOuter != NULL; NextOuter = NextOuter->GetOuter() )
{
if ( NextOuter->IsA(Target) )
{
Result = NextOuter;
}
}
return Result;
}
示例9: LoadAssetsFromAssetData
int32 UObjectLibrary::LoadAssetsFromAssetData()
{
int32 Count = 0;
if (bIsFullyLoaded)
{
// We already ran this
return 0;
}
bIsFullyLoaded = true;
for(int32 AssetIdx=0; AssetIdx<AssetDataList.Num(); AssetIdx++)
{
FAssetData& Data = AssetDataList[AssetIdx];
UObject *LoadedObject = NULL;
if (!bHasBlueprintClasses)
{
LoadedObject = Data.GetAsset();
checkSlow(!LoadedObject || !ObjectBaseClass || LoadedObject->IsA(ObjectBaseClass));
}
else
{
UPackage* Package = Data.GetPackage();
if (Package)
{
TArray<UObject*> ObjectsInPackage;
GetObjectsWithOuter(Package, ObjectsInPackage);
for (UObject* PotentialBPGC : ObjectsInPackage)
{
if (auto LoadedBPGC = Cast<UBlueprintGeneratedClass>(PotentialBPGC))
{
checkSlow(!ObjectBaseClass || LoadedBPGC->IsChildOf(ObjectBaseClass));
LoadedObject = LoadedBPGC;
break; //there is usually only one BGPC in a package
}
}
}
}
if (LoadedObject)
{
AddObject(LoadedObject);
Count++;
}
}
return Count;
}
示例10: ReplicateChangesToChildren
void ULiveEditorKismetLibrary::ReplicateChangesToChildren( FName PropertyName, UObject *Archetype )
{
if ( Archetype == NULL )
return;
//find our child instances from the LiveEditManage lookup cache
TArray< TWeakObjectPtr<UObject> > PiePartners;
FLiveEditorManager::Get().FindPiePartners( Archetype, PiePartners );
for(TArray< TWeakObjectPtr<UObject> >::TIterator It(PiePartners); It; ++It)
{
if ( !(*It).IsValid() )
continue;
UObject *Object = (*It).Get();
check( Object->IsA(Archetype->GetClass()) ); //little sanity check, but the object cache manages all this for us
nLiveEditorKismetLibrary::CopyPropertyFromArchetype( Object, Archetype, PropertyName );
}
void *ContainerPtr = Archetype;
int32 ArrayIndex = 0;
UProperty *Prop = nLiveEditorKismetLibrary::GetPropertyByName( Archetype, Archetype->GetClass(), PropertyName.ToString(), &ContainerPtr, ArrayIndex );
if ( Prop && Prop->IsA( UNumericProperty::StaticClass() ) )
{
check( ContainerPtr != NULL );
FString ClassName = Archetype->GetClass()->GetName();
FString ValueString;
void *Value = Prop->ContainerPtrToValuePtr<void>(ContainerPtr, ArrayIndex);
Prop->ExportTextItem(ValueString, Value, NULL, NULL, 0);
FLiveEditorManager::Get().BroadcastValueUpdate( ClassName, PropertyName.ToString(), ValueString );
}
/**
* Object iteration method should we want to dump the PIEObjectCache
* Downside is that it is perceptably slow (though still usable)
TArray<UObject*> ObjectsToChange;
const bool bIncludeDerivedClasses = true;
GetObjectsOfClass(Archetype->GetClass(), ObjectsToChange, bIncludeDerivedClasses);
for ( auto ObjIt = ObjectsToChange.CreateIterator(); ObjIt; ++ObjIt )
{
UObject *Object = *ObjIt;
UWorld *World = GEngine->GetWorldFromContextObject( Object, false );
if ( World == NULL || World->WorldType != EWorldType::PIE )
continue;
CopyPropertyFromArchetype( Object, Archetype, PropertyName );
}
*/
}
示例11: OnAddKeyTextEntry
void UMatineeTrackAnimControlHelper::OnAddKeyTextEntry(const FAssetData& AssetData, IMatineeBase* Matinee, UInterpTrack* Track)
{
if (EntryMenu.IsValid())
{
EntryMenu.Pin()->Dismiss();
}
UObject* SelectedObject = AssetData.GetAsset();
if (SelectedObject && SelectedObject->IsA(UAnimSequence::StaticClass()))
{
KeyframeAddAnimSequence = CastChecked<UAnimSequence>(AssetData.GetAsset());
Matinee->FinishAddKey(Track, true);
}
}
示例12: GetObjectDisplayName
FString SObjectNameEditableTextBox::GetObjectDisplayName(TWeakObjectPtr<UObject> Object)
{
FString Result;
if(Object.IsValid())
{
UObject* ObjectPtr = Object.Get();
if (ObjectPtr->IsA(AActor::StaticClass()))
{
Result = ((AActor*)ObjectPtr)->GetActorLabel();
}
else
{
Result = ObjectPtr->GetName();
}
}
return Result;
}
示例13: GetOuterGraph
UEdGraph* SGraphTitleBar::GetOuterGraph( UObject* Obj )
{
if( Obj )
{
UObject* OuterObj = Obj->GetOuter();
if( OuterObj )
{
if( OuterObj->IsA( UEdGraph::StaticClass()) )
{
return Cast<UEdGraph>(OuterObj);
}
else
{
return GetOuterGraph( OuterObj );
}
}
}
return NULL;
}
示例14: CanVariableBeDropped
bool FKismetVariableDragDropAction::CanVariableBeDropped(const UProperty* InVariableProperty, const UEdGraph& InGraph) const
{
bool bCanVariableBeDropped = false;
if (InVariableProperty)
{
UObject* Outer = InVariableProperty->GetOuter();
// Only allow variables to be placed within the same blueprint (otherwise the self context on the dropped node will be invalid)
bCanVariableBeDropped = IsFromBlueprint(FBlueprintEditorUtils::FindBlueprintForGraph(&InGraph));
// Local variables have some special conditions for being allowed to be placed
if (bCanVariableBeDropped && Outer->IsA(UFunction::StaticClass()))
{
// Check if the top level graph has the same name as the function, if they do not then the variable cannot be placed in the graph
if (FBlueprintEditorUtils::GetTopLevelGraph(&InGraph)->GetFName() != Outer->GetFName())
{
bCanVariableBeDropped = false;
}
}
}
return bCanVariableBeDropped;
}
示例15: OnPaste
void SPropertyMenuAssetPicker::OnPaste()
{
FString DestPath;
FPlatformMisc::ClipboardPaste(DestPath);
if(DestPath == TEXT("None"))
{
SetValue(NULL);
}
else
{
UObject* Object = LoadObject<UObject>(NULL, *DestPath);
bool PassesAllowedClassesFilter = true;
if(AllowedClasses.Num())
{
PassesAllowedClassesFilter = false;
for(int32 i = 0; i < AllowedClasses.Num(); ++i)
{
if( Object->IsA(AllowedClasses[i]) )
{
PassesAllowedClassesFilter = true;
break;
}
}
}
if( Object && PassesAllowedClassesFilter )
{
FAssetData ObjectAssetData(Object);
// Check against custom asset filter
if (!OnShouldFilterAsset.IsBound()
|| !OnShouldFilterAsset.Execute(ObjectAssetData))
{
SetValue(ObjectAssetData);
}
}
}
OnClose.ExecuteIfBound();
}