本文整理汇总了C++中UObject::GetOuter方法的典型用法代码示例。如果您正苦于以下问题:C++ UObject::GetOuter方法的具体用法?C++ UObject::GetOuter怎么用?C++ UObject::GetOuter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UObject
的用法示例。
在下文中一共展示了UObject::GetOuter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetWorld
UWorld* UUserWidget::GetWorld() const
{
if ( HasAllFlags(RF_ClassDefaultObject) )
{
// If we are a CDO, we must return nullptr instead of calling Outer->GetWorld() to fool UObject::ImplementsGetWorld.
return nullptr;
}
// Use the Player Context's world, if a specific player context is given, otherwise fall back to
// following the outer chain.
if ( PlayerContext.IsValid() )
{
if ( UWorld* World = PlayerContext.GetWorld() )
{
return World;
}
}
// Could be a GameInstance, could be World, could also be a WidgetTree, so we're just going to follow
// the outer chain to find the world we're in.
UObject* Outer = GetOuter();
while ( Outer )
{
UWorld* World = Outer->GetWorld();
if ( World )
{
return World;
}
Outer = Outer->GetOuter();
}
return nullptr;
}
示例2: InnerList
FExportObjectInnerContext::FExportObjectInnerContext(TArray<UObject*>& ObjsToIgnore)
{
// For each object . . .
for ( TObjectIterator<UObject> It ; It ; ++It )
{
UObject* InnerObj = *It;
if ( !InnerObj->IsPendingKill() )
{
if ( !ObjsToIgnore.Contains(InnerObj) )
{
UObject* OuterObj = InnerObj->GetOuter();
if ( OuterObj && !OuterObj->IsPendingKill() )
{
InnerList* Inners = ObjectToInnerMap.Find( OuterObj );
if ( Inners )
{
// Add object to existing inner list.
Inners->Add( InnerObj );
}
else
{
// Create a new inner list for the outer object.
InnerList& InnersForOuterObject = ObjectToInnerMap.Add( OuterObj, InnerList() );
InnersForOuterObject.Add( InnerObj );
}
}
}
}
}
}
示例3: PassesFilter
bool FFrontendFilter_InUseByLoadedLevels::PassesFilter(FAssetFilterType InItem) const
{
bool bObjectInUse = false;
if ( InItem.IsAssetLoaded() )
{
UObject* Asset = InItem.GetAsset();
const bool bUnreferenced = !Asset->HasAnyMarks( OBJECTMARK_TagExp );
const bool bIndirectlyReferencedObject = Asset->HasAnyMarks( OBJECTMARK_TagImp );
const bool bRejectObject =
Asset->GetOuter() == NULL || // Skip objects with null outers
Asset->HasAnyFlags( RF_Transient ) || // Skip transient objects (these shouldn't show up in the CB anyway)
Asset->IsPendingKill() || // Objects that will be garbage collected
bUnreferenced || // Unreferenced objects
bIndirectlyReferencedObject; // Indirectly referenced objects
if( !bRejectObject && Asset->HasAnyFlags( RF_Public ) )
{
// The object is in use
bObjectInUse = true;
}
}
return bObjectInUse;
}
示例4: GetPathName
/**
* Internal version of GetPathName() that eliminates unnecessary copies.
*/
void UObjectBaseUtility::GetPathName( const UObject* StopOuter, FString& ResultString ) const
{
if( this != StopOuter && this != NULL )
{
UObject* ObjOuter = GetOuter();
if (ObjOuter && ObjOuter != StopOuter )
{
ObjOuter->GetPathName( StopOuter, ResultString );
// SUBOBJECT_DELIMITER is used to indicate that this object's outer is not a UPackage
if (ObjOuter->GetClass() != UPackage::StaticClass()
&& ObjOuter->GetOuter()->GetClass() == UPackage::StaticClass())
{
ResultString += SUBOBJECT_DELIMITER;
}
else
{
ResultString += TEXT(".");
}
}
AppendName(ResultString);
}
else
{
ResultString += TEXT("None");
}
}
示例5: PostLoad
void UEdGraphPin::PostLoad()
{
Super::PostLoad();
static FName GameplayTagName = TEXT("GameplayTag");
static FName GameplayTagContainerName = TEXT("GameplayTagContainer");
static FName GameplayTagsPathName = TEXT("/Script/GameplayTags");
if (PinType.PinSubCategoryObject.IsValid())
{
UObject* PinSubCategoryObject = PinType.PinSubCategoryObject.Get();
if (PinSubCategoryObject->GetOuter()->GetFName() == GameplayTagsPathName)
{
if (PinSubCategoryObject->GetFName() == GameplayTagName)
{
// Pins of type FGameplayTag were storing "()" for empty arrays and then importing that into ArrayProperty and expecting an empty array.
// That it was working was a bug and has been fixed, so let's fixup pins. A pin that wants an array size of 1 will always fill the parenthesis
// so there is no worry about breaking those cases.
if (DefaultValue == TEXT("()"))
{
DefaultValue.Empty();
}
}
else if (PinSubCategoryObject->GetFName() == GameplayTagContainerName)
{
// Pins of type FGameplayTagContainer were storing "GameplayTags=()" for empty arrays, which equates to having a single item, default generated as detailed above for FGameplayTag.
// The solution is to replace occurances with an empty string, due to the item being a struct, we can't just empty the value and must replace only the section we need.
DefaultValue.ReplaceInline(TEXT("GameplayTags=()"), TEXT("GameplayTags="));
}
}
}
}
示例6: GetBlueprint
void UK2Node_MacroInstance::PostPasteNode()
{
const UBlueprint* InstanceOwner = GetBlueprint();
// Find the owner of the macro graph
const UEdGraph* MacroGraph = MacroGraphReference.GetGraph();
UObject* MacroOwner = MacroGraph->GetOuter();
UBlueprint* MacroOwnerBP = NULL;
while(MacroOwner)
{
MacroOwnerBP = Cast<UBlueprint>(MacroOwner);
if(MacroOwnerBP)
{
break;
}
MacroOwner = MacroOwner->GetOuter();
}
if((MacroOwnerBP != NULL)
&& (MacroOwnerBP->BlueprintType != BPTYPE_MacroLibrary)
&& (MacroOwnerBP != InstanceOwner))
{
// If this is a graph from another blueprint that is NOT a library, disallow the connection!
MacroGraphReference.SetGraph(NULL);
}
Super::PostPasteNode();
}
示例7: GenerateZConstructor
// Keep sync with FTypeSingletonCache::GenerateSingletonName
static FString GenerateZConstructor(UField* Item)
{
FString Result;
if (!ensure(Item))
{
return Result;
}
for (UObject* Outer = Item; Outer; Outer = Outer->GetOuter())
{
if (!Result.IsEmpty())
{
Result = TEXT("_") + Result;
}
if (Cast<UClass>(Outer) || Cast<UScriptStruct>(Outer))
{
FString OuterName = FEmitHelper::GetCppName(CastChecked<UField>(Outer), true);
Result = OuterName + Result;
// Structs can also have UPackage outer.
if (Cast<UClass>(Outer) || Cast<UPackage>(Outer->GetOuter()))
{
break;
}
}
else
{
Result = Outer->GetName() + Result;
}
}
// Can't use long package names in function names.
if (Result.StartsWith(TEXT("/Script/"), ESearchCase::CaseSensitive))
{
Result = FPackageName::GetShortName(Result);
}
const FString ClassString = Item->IsA<UClass>() ? TEXT("UClass") : TEXT("UScriptStruct");
return FString(TEXT("Z_Construct_")) + ClassString + TEXT("_") + Result + TEXT("()");
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:42,代码来源:BlueprintCompilerCppBackendValueHelper.cpp
示例8: GetOutermost
/**
* Walks up the list of outers until it finds the highest one.
*
* @return outermost non NULL Outer.
*/
UPackage* UObjectBaseUtility::GetOutermost() const
{
UObject* Top = (UObject*)this;
for (;;)
{
UObject* CurrentOuter = Top->GetOuter();
if (!CurrentOuter)
{
return CastChecked<UPackage>(Top);
}
Top = CurrentOuter;
}
}
示例9: FindBlackboardAsset
const UBlackboardData* FBlackboardSelectorDetails::FindBlackboardAsset(UObject* InObj)
{
for (UObject* TestOb = InObj; TestOb; TestOb = TestOb->GetOuter())
{
UBTNode* NodeOb = Cast<UBTNode>(TestOb);
if (NodeOb)
{
return NodeOb->GetBlackboardAsset();
}
}
return NULL;
}
示例10: RetrieveObjectInstances
void FObjectInstancingGraph::RetrieveObjectInstances( UObject* SearchOuter, TArray<UObject*>& out_Objects )
{
if ( HasDestinationRoot() && SearchOuter != NULL && (SearchOuter == DestinationRoot || SearchOuter->IsIn(DestinationRoot)) )
{
for ( TMap<UObject*,UObject*>::TIterator It(SourceToDestinationMap); It; ++It )
{
UObject* InstancedObject = It.Value();
if ( InstancedObject->GetOuter() == SearchOuter )
{
out_Objects.AddUnique(InstancedObject);
}
}
}
}
示例11: BuildPropertyChain
//------------------------------------------------------------------------------
static void LinkerPlaceholderObjectImpl::BuildPropertyChain(const UProperty* LeafProperty, TArray<const UProperty*>& ChainOut)
{
ChainOut.Empty();
ChainOut.Add(LeafProperty);
UClass* ClassOwner = LeafProperty->GetOwnerClass();
UObject* PropertyOuter = LeafProperty->GetOuter();
while ((PropertyOuter != nullptr) && (PropertyOuter != ClassOwner))
{
if (const UProperty* PropertyOwner = Cast<const UProperty>(PropertyOuter))
{
ChainOut.Add(PropertyOwner);
}
PropertyOuter = PropertyOuter->GetOuter();
}
}
示例12: GetOwner
AActor* UActorComponent::GetOwner() const
{
// walk up outer chain to find an Actor
UObject* Obj = GetOuter();
while(Obj != NULL)
{
AActor* Actor = Cast<AActor>(Obj);
if(Actor != NULL)
{
return Actor;
}
Obj = Obj->GetOuter();
}
return NULL;
}
示例13:
// Recover a corrupted blueprint
void FKismet2CompilerModule::RecoverCorruptedBlueprint(class UBlueprint* Blueprint)
{
UPackage* Package = Blueprint->GetOutermost();
// Get rid of any stale classes
for (FObjectIterator ObjIt; ObjIt; ++ObjIt)
{
UObject* TestObject = *ObjIt;
if (TestObject->GetOuter() == Package)
{
// This object is in the blueprint package; is it expected?
if (UClass* TestClass = Cast<UClass>(TestObject))
{
if ((TestClass != Blueprint->SkeletonGeneratedClass) && (TestClass != Blueprint->GeneratedClass))
{
// Unexpected UClass
FKismetCompilerUtilities::ConsignToOblivion(TestClass, false);
}
}
}
}
CollectGarbage( GARBAGE_COLLECTION_KEEPFLAGS );
}
示例14: DebuggingWorldRegistrationHelper
void UBlueprint::DebuggingWorldRegistrationHelper(UObject* ObjectProvidingWorld, UObject* ValueToRegister)
{
if (ObjectProvidingWorld != NULL)
{
// Fix up the registration with the world
UWorld* ObjWorld = NULL;
UObject* ObjOuter = ObjectProvidingWorld->GetOuter();
while (ObjOuter != NULL)
{
ObjWorld = Cast<UWorld>(ObjOuter);
if (ObjWorld != NULL)
{
break;
}
ObjOuter = ObjOuter->GetOuter();
}
if (ObjWorld != NULL)
{
ObjWorld->NotifyOfBlueprintDebuggingAssociation(this, ValueToRegister);
}
}
}
示例15: BuildSubobjectKey
inline UObject* BuildSubobjectKey(UObject* InObj, TArray<FName>& OutHierarchyNames)
{
auto UseOuter = [](const UObject* Obj)
{
if (Obj == nullptr)
{
return false;
}
const bool bIsCDO = Obj->HasAllFlags(RF_ClassDefaultObject);
const UObject* CDO = bIsCDO ? Obj : nullptr;
const bool bIsClassCDO = (CDO != nullptr) ? (CDO->GetClass()->ClassDefaultObject == CDO) : false;
if(!bIsClassCDO && CDO)
{
// Likely a trashed CDO, try to recover. Only known cause of this is
// ambiguous use of DSOs:
CDO = CDO->GetClass()->ClassDefaultObject;
}
const UActorComponent* AsComponent = Cast<UActorComponent>(Obj);
const bool bIsDSO = Obj->HasAnyFlags(RF_DefaultSubObject);
const bool bIsSCSComponent = AsComponent && AsComponent->IsCreatedByConstructionScript();
return (bIsCDO && bIsClassCDO) || bIsDSO || bIsSCSComponent;
};
UObject* Outermost = nullptr;
UObject* Iter = InObj;
while (UseOuter(Iter))
{
OutHierarchyNames.Add(Iter->GetFName());
Iter = Iter->GetOuter();
Outermost = Iter;
}
return Outermost;
}