当前位置: 首页>>代码示例>>C++>>正文


C++ UObject::IsDefaultSubobject方法代码示例

本文整理汇总了C++中UObject::IsDefaultSubobject方法的典型用法代码示例。如果您正苦于以下问题:C++ UObject::IsDefaultSubobject方法的具体用法?C++ UObject::IsDefaultSubobject怎么用?C++ UObject::IsDefaultSubobject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UObject的用法示例。


在下文中一共展示了UObject::IsDefaultSubobject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AnalyzeObjects

void FObjectMemoryAnalyzer::AnalyzeObjects( UClass* InBaseClass )
{
	if (InBaseClass == NULL)
	{
		InBaseClass = UObject::StaticClass();
	}

	uint32 ExclusionFlags = (AnalyzeFlags&EAnalyzeFlags::IncludeDefaultObjects)==0 ? (RF_ClassDefaultObject|RF_ArchetypeObject) : 0;
	// Determine root objects
	for( FObjectIterator It(InBaseClass, false, (EObjectFlags)ExclusionFlags); It; ++It )
	{
		UObject* Object	= *It;

		if (!(AnalyzeFlags&EAnalyzeFlags::IncludeDefaultObjects) && Object->IsDefaultSubobject()) { continue; };

		FObjectMemoryUsage& Annotation = MemUsageAnnotations.GetAnnotationRef(Object);

		if ( Object->HasAllFlags(RF_Standalone) )
		{
			Annotation.Flags |= FObjectMemoryUsage::EObjFlags::IsRoot;
		}
		ProcessSubObjRecursive(Object, Object);
	}

	// mark 'loose' objets as root objects as well
	for( FObjectIterator It(InBaseClass, false, (EObjectFlags)ExclusionFlags); It; ++It )
	{
		UObject* Object	= *It;

		if (!(AnalyzeFlags&EAnalyzeFlags::IncludeDefaultObjects) && Object->IsDefaultSubobject()) { continue; };
	
		FObjectMemoryUsage& Annotation = MemUsageAnnotations.GetAnnotationRef(Object);
			
		if (!Annotation.IsRoot() && !Annotation.IsReferencedByRoot() && !Annotation.IsReferencedByNonRoot())
		{
			Annotation.Flags |= FObjectMemoryUsage::EObjFlags::IsRoot;
		}
	}

	for( FObjectIterator It(InBaseClass, false, (EObjectFlags)ExclusionFlags); It; ++It )
	{
		UObject* Object	= *It;
		
		if (!(AnalyzeFlags&EAnalyzeFlags::IncludeDefaultObjects) && Object->IsDefaultSubobject()) { continue; };

		FObjectMemoryUsage& Annotation = MemUsageAnnotations.GetAnnotationRef(Object);
		
		SIZE_T InclusiveSize = CalculateSizeRecursive(Object);
		Annotation.InclusiveMemoryUsage = InclusiveSize;
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:51,代码来源:ObjectMemoryAnalyzer.cpp

示例2: GetResults

int32 FObjectMemoryAnalyzer::GetResults(TArray<FObjectMemoryUsage>& Results)
{
	if (BaseClass != NULL)
	{
		uint32 ExclusionFlags = (AnalyzeFlags&EAnalyzeFlags::IncludeDefaultObjects)==0 ? (RF_ClassDefaultObject|RF_ArchetypeObject) : 0;

		for( FObjectIterator It(BaseClass, false, (EObjectFlags)ExclusionFlags); It; ++It )
		{
			UObject* Object	= *It;
			if (!(AnalyzeFlags&EAnalyzeFlags::IncludeDefaultObjects) && Object->IsDefaultSubobject()) { continue; };
			FObjectMemoryUsage& Annotation = MemUsageAnnotations.GetAnnotationRef(Object);

			if (Annotation.IsRoot())
			{
				Annotation.Object = Object;
				Results.Add(Annotation);
			}
		}
	}

	if (ObjectList.Num() > 0)
	{
		for (int32 i=0; i < ObjectList.Num(); ++i)
		{
			FObjectMemoryUsage& Annotation = MemUsageAnnotations.GetAnnotationRef(ObjectList[i]);
			check(Annotation.IsRoot());

			Annotation.Object = ObjectList[i];
			Results.Add(Annotation);
		}
	}
	return Results.Num();
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:33,代码来源:ObjectMemoryAnalyzer.cpp

示例3: ExportTextItem

void UObjectPropertyBase::ExportTextItem( FString& ValueStr, const void* PropertyValue, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const
{
	UObject* Temp = GetObjectPropertyValue(PropertyValue);
	if( Temp != NULL )
	{
		if (PortFlags & PPF_DebugDump)
		{
			ValueStr += Temp->GetFullName();
		}
		else if (Parent && !Parent->HasAnyFlags(RF_ClassDefaultObject) && Temp->IsDefaultSubobject())
		{
			if ((PortFlags & PPF_Delimited) && (!Temp->GetFName().IsValidXName(INVALID_OBJECTNAME_CHARACTERS)))
			{
				ValueStr += FString::Printf(TEXT("\"%s\""), *Temp->GetName().ReplaceQuotesWithEscapedQuotes());
			}
			else
			{
				ValueStr += Temp->GetName();
			}
		}
		else
		{
			ValueStr += GetExportPath(Temp, Parent, ExportRootScope, PortFlags);
		}
	}
	else
	{
		ValueStr += TEXT("None");
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:30,代码来源:PropertyBaseObject.cpp

示例4: Identical

bool UObjectPropertyBase::Identical( const void* A, const void* B, uint32 PortFlags ) const
{
	UObject* ObjectA = A ? GetObjectPropertyValue(A) : NULL;
	UObject* ObjectB = B ? GetObjectPropertyValue(B) : NULL;
	if (!ObjectA && !ObjectB)
	{
		return true;
	}
	if (!ObjectA || !ObjectB)
	{
		return false;
	}
	// Compare actual pointers. We don't do this during PIE because we want to be sure to serialize everything. An example is the LevelScriptActor being serialized against its CDO,
	// which contains actor references. We want to serialize those references so they are fixed up.
	const bool bDuplicatingForPIE = (PortFlags&PPF_DuplicateForPIE) != 0;
	bool bResult = !bDuplicatingForPIE ? (ObjectA == ObjectB) : false;
	// always serialize the cross level references, because they could be NULL
	// @todo: okay, this is pretty hacky overall - we should have a PortFlag or something
	// that is set during SavePackage. Other times, we don't want to immediately return false
	// (instead of just this ExportDefProps case)
	// instance testing
	if (!bResult && ObjectA->GetClass() == ObjectB->GetClass())
	{
		bool bPerformDeepComparison = (PortFlags&PPF_DeepComparison) != 0;
		if ((PortFlags&PPF_DeepCompareInstances) && !bPerformDeepComparison)
		{
			bPerformDeepComparison = ObjectA->IsTemplate() != ObjectB->IsTemplate();
		}

		if (!bResult && bPerformDeepComparison)
		{
			// In order for deep comparison to be match they both need to have the same name and that name needs to be included in the instancing table for the class
			if (ObjectA->GetFName() == ObjectB->GetFName() && ObjectA->GetClass()->GetDefaultSubobjectByName(ObjectA->GetFName()))
			{
				checkSlow(ObjectA->IsDefaultSubobject() && ObjectB->IsDefaultSubobject() && ObjectA->GetClass()->GetDefaultSubobjectByName(ObjectA->GetFName()) == ObjectB->GetClass()->GetDefaultSubobjectByName(ObjectB->GetFName())); // equivalent
				bResult = AreInstancedObjectsIdentical(ObjectA,ObjectB,PortFlags);
			}
		}
	}
	return bResult;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:41,代码来源:PropertyBaseObject.cpp

示例5: ExportTextItem

void UObjectPropertyBase::ExportTextItem( FString& ValueStr, const void* PropertyValue, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const
{
	UObject* Temp = GetObjectPropertyValue(PropertyValue);

	if (0 != (PortFlags & PPF_ExportCpp))
	{
		FString::Printf(TEXT("%s%s*"), PropertyClass->GetPrefixCPP(), *PropertyClass->GetName());

		ValueStr += Temp
			? FString::Printf(TEXT("LoadObject<%s%s>(nullptr, TEXT(\"%s\"))")
				, PropertyClass->GetPrefixCPP()
				, *PropertyClass->GetName()
				, *(Temp->GetPathName().ReplaceCharWithEscapedChar()))
			: TEXT("nullptr");
		return;
	}

	if( Temp != NULL )
	{
		if (PortFlags & PPF_DebugDump)
		{
			ValueStr += Temp->GetFullName();
		}
		else if (Parent && !Parent->HasAnyFlags(RF_ClassDefaultObject) && Temp->IsDefaultSubobject())
		{
			if ((PortFlags & PPF_Delimited) && (!Temp->GetFName().IsValidXName(INVALID_OBJECTNAME_CHARACTERS)))
			{
				ValueStr += FString::Printf(TEXT("\"%s\""), *Temp->GetName().ReplaceQuotesWithEscapedQuotes());
			}
			else
			{
				ValueStr += Temp->GetName();
			}
		}
		else
		{
			ValueStr += GetExportPath(Temp, Parent, ExportRootScope, PortFlags);
		}
	}
	else
	{
		ValueStr += TEXT("None");
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:44,代码来源:PropertyBaseObject.cpp

示例6: ExportObjectInner

void UExporter::ExportObjectInner(const FExportObjectInnerContext* Context, UObject* Object, FOutputDevice& Ar, uint32 PortFlags, bool bSkipComponents)
{
	// indent all the text in here
	TextIndent += 3;

	FExportObjectInnerContext::InnerList ObjectInners;
	if ( Context )
	{
		const FExportObjectInnerContext::InnerList* Inners = Context->ObjectToInnerMap.Find( Object );
		if ( Inners )
		{
			ObjectInners = *Inners;
		}
	}
	else
	{
		for (TObjectIterator<UObject> It; It; ++It)
		{
			if ( It->GetOuter() == Object )
			{
				ObjectInners.Add( *It );
			}
		}
	}


	TArray<UObject*> Components;
	if (!bSkipComponents)
	{
		// first export the components
		Object->CollectDefaultSubobjects(Components, false);
	}

	if (!(PortFlags & PPF_SeparateDefine))
	{
		for ( int32 ObjIndex = 0 ; ObjIndex < ObjectInners.Num() ; ++ObjIndex )
		{
			// NOTE: We ignore inner objects that have been tagged for death
			UObject* Obj = ObjectInners[ObjIndex];
			if ( !Obj->IsPendingKill() && !Obj->IsDefaultSubobject() && !Obj->HasAnyFlags(RF_TextExportTransient) && FCString::Stricmp(*Obj->GetClass()->GetName(), TEXT("Model")) != 0)
			{
				// export the object
				UExporter::ExportToOutputDevice( Context, Obj, NULL, Ar, (PortFlags & PPF_Copy) ? TEXT("Copy") : TEXT("T3D"), TextIndent, PortFlags | PPF_SeparateDeclare, false, ExportRootScope );
			}
		}

		if (!bSkipComponents)
		{
			ExportComponentDefinitions(Context, Components, Ar, PortFlags | PPF_SeparateDeclare);
		}
	}

	if (!(PortFlags & PPF_SeparateDeclare))
	{
		for ( int32 ObjIndex = 0 ; ObjIndex < ObjectInners.Num() ; ++ObjIndex )
		{
			// NOTE: We ignore inner objects that have been tagged for death
			UObject* Obj = ObjectInners[ObjIndex];
			if ( !Obj->IsPendingKill() && !Obj->IsDefaultSubobject() && !Obj->HasAnyFlags(RF_TextExportTransient) && FCString::Stricmp(*Obj->GetClass()->GetName(), TEXT("Model")) != 0)
			{
				// export the object
				UExporter::ExportToOutputDevice( Context, Obj, NULL, Ar, (PortFlags & PPF_Copy) ? TEXT("Copy") : TEXT("T3D"), TextIndent, PortFlags | PPF_SeparateDefine, false, ExportRootScope );

				// don't reexport below in ExportProperties
				Obj->Mark(OBJECTMARK_TagImp);
			}
		}

		if (!bSkipComponents)
		{
			ExportComponentDefinitions(Context, Components, Ar, PortFlags | PPF_SeparateDefine);
		}

		// export the object's properties
		// Note: we use archetype as the object to diff properties against before they exported. When object is created, they should create from archetype
		// and using this system, it should recover all properties it needs to copy
		uint8 *CompareObject;
		if (Object->HasAnyFlags(RF_ClassDefaultObject))
		{
			CompareObject = (uint8*)Object;
		}
		else
		{
			CompareObject = (uint8*)Object->GetArchetype();
		}
		ExportProperties( Context, Ar, Object->GetClass(), (uint8*)Object, TextIndent, Object->GetClass(), CompareObject, Object, PortFlags, ExportRootScope );

		if (!bSkipComponents)
		{
			// Export anything extra for the components. Used for instanced foliage.
			// This is done after the actor properties so these are set when regenerating the extra data objects.
			ExportComponentExtra( Context, Components, Ar, PortFlags );
		}
	}

	// remove indent
	TextIndent -= 3;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:98,代码来源:UnrealExporter.cpp


注:本文中的UObject::IsDefaultSubobject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。