• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SaveOpenAssetEditors

void FAssetEditorManager::SaveOpenAssetEditors(bool bOnShutdown)
{
	if(!bSavingOnShutdown)
	{
		TArray<FString> OpenAssets;

		// Don't save a list of assets to restore if we are running under a debugger
		if(!FPlatformMisc::IsDebuggerPresent())
		{
			for (auto EditorPair : OpenedEditors)
			{
				IAssetEditorInstance* Editor = EditorPair.Key;
				if (Editor != NULL)
				{
					UObject* EditedObject = EditorPair.Value;
					if(EditedObject != NULL)
					{
						// only record assets that have a valid saved package
						UPackage* Package = EditedObject->GetOutermost();
						if(Package != NULL && Package->GetFileSize() != 0)
						{
							OpenAssets.Add(EditedObject->GetPathName());
						}
					}
				}
			}
		}

		GConfig->SetArray(TEXT("AssetEditorManager"), TEXT("OpenAssetsAtExit"), OpenAssets, GEditorPerProjectIni);
		GConfig->SetBool(TEXT("AssetEditorManager"), TEXT("CleanShutdown"), bOnShutdown, GEditorPerProjectIni);
		GConfig->Flush(false, GEditorPerProjectIni);
	}
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:33,代码来源:AssetEditorManager.cpp


示例2: Clear

void ObjectHash::Clear()
{
  bool any;
  do
  {
    any = false;
    unsigned skipped = 0;
    for ( OH_iterator itr = hash.begin(), itrend = hash.end(); itr != itrend; )
    {
      UObject* obj = ( *itr ).second.get();

      if ( obj->orphan() && obj->ref_counted_count() == 1 )
      {
        hash.erase( itr++ );
        any = true;
      }
      else
      {
        ++skipped;
        ++itr;
      }
    }
  } while ( any );
  if ( !hash.empty() )
  {
    INFO_PRINT << "Leftover objects in objecthash: " << hash.size() << "\n";

    // the hash will be cleared after main() exits, with other statics.
    // this usually causes assertion failures and crashes.
    // creating a copy of the internal hash will ensure no refcounts reach zero.
    INFO_PRINT << "Leaking a copy of the objecthash in order to avoid a crash.\n";
    new hs( hash );
  }
  //    hash.clear();
}
开发者ID:polserver,项目名称:polserver,代码行数:35,代码来源:objecthash.cpp


示例3: GetObjectName

FText SGraphPinObject::GetObjectName() const
{
	FText Value = FText::GetEmpty();
	
	if (GraphPinObj != NULL)
	{
		UObject* DefaultObject = GraphPinObj->DefaultObject;
		if (DefaultObject != NULL)
		{
			Value = FText::FromString(DefaultObject->GetName());
			int32 StringLen = Value.ToString().Len();

			//If string is too long, then truncate (eg. "abcdefgijklmnopq" is converted as "abcd...nopq")
			const int32 MaxAllowedLength = 16;
			if (StringLen > MaxAllowedLength)
			{
				//Take first 4 characters
				FString TruncatedStr(Value.ToString().Left(4));
				TruncatedStr += FString( TEXT("..."));
				
				//Take last 4 characters
				TruncatedStr += Value.ToString().Right(4);
				Value = FText::FromString(TruncatedStr);
			}
		}
	}
	return Value;
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:28,代码来源:SGraphPinObject.cpp


示例4: ObjectReferenceCollector

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--;
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:25,代码来源:EngineUtils.cpp


示例5: GetEnumForByteTrack

UEnum* GetEnumForByteTrack(TSharedPtr<ISequencer> Sequencer, const FGuid& OwnerObjectHandle, FName PropertyName, UMovieSceneByteTrack* ByteTrack)
{
	
	UObject* RuntimeObject = Sequencer->GetFocusedMovieSceneSequence()->FindObject(OwnerObjectHandle);
	TSet<UEnum*> PropertyEnums;

	if (RuntimeObject != nullptr)
	{
		UProperty* Property = RuntimeObject->GetClass()->FindPropertyByName(PropertyName);
		if (Property != nullptr)
		{
			UByteProperty* ByteProperty = Cast<UByteProperty>(Property);
			if (ByteProperty != nullptr && ByteProperty->Enum != nullptr)
			{
				PropertyEnums.Add(ByteProperty->Enum);
			}
		}
	}

	UEnum* TrackEnum;

	if (PropertyEnums.Num() == 1)
	{
		TrackEnum = PropertyEnums.Array()[0];
	}
	else
	{
		TrackEnum = nullptr;
	}

	return TrackEnum;
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:32,代码来源:BytePropertyTrackEditor.cpp


示例6: FindClass

	// Finds the class for the given stack state.
	UStruct* FindClass( const FReadState& State )
	{
		UStruct* Class = nullptr;

		if (State.Property != nullptr)
		{
			UProperty* ParentProperty = State.Property;
			UArrayProperty* ArrayProperty = Cast<UArrayProperty>(ParentProperty);

			if (ArrayProperty != nullptr)
			{
				ParentProperty = ArrayProperty->Inner;
			}

			UStructProperty* StructProperty = Cast<UStructProperty>(ParentProperty);
			UObjectPropertyBase* ObjectProperty = Cast<UObjectPropertyBase>(ParentProperty);

			if (StructProperty != nullptr)
			{
				Class = StructProperty->Struct;
			}
			else if (ObjectProperty != nullptr)
			{
				Class = ObjectProperty->PropertyClass;
			}
		}
		else
		{
			UObject* RootObject = static_cast<UObject*>(State.Data);
			Class = RootObject->GetClass();
		}

		return Class;
	}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:35,代码来源:StructDeserializer.cpp


示例7: 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;
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:35,代码来源:ObjectLibrary.cpp


示例8: GetOuter

/**
 * Internal version of GetPathName() that eliminates unnecessary copies.
 */
void UObjectBaseUtility::GetPathName( const UObject* StopOuter, FString& ResultString ) const
{
	if( this != StopOuter && this != NULL )
	{
		UObject* Outer = GetOuter();
		if ( Outer && Outer != StopOuter )
		{
			Outer->GetPathName( StopOuter, ResultString );

			// SUBOBJECT_DELIMITER is used to indicate that this object's outer is not a UPackage
			if (Outer->GetClass() != UPackage::StaticClass()
			&&	Outer->GetOuter()->GetClass() == UPackage::StaticClass())
			{
				ResultString += SUBOBJECT_DELIMITER;
			}
			else
			{
				ResultString += TEXT(".");
			}
		}
		AppendName(ResultString);
	}
	else
	{
		ResultString += TEXT("None");
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:30,代码来源:UObjectBaseUtility.cpp


示例9: 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 );
			}
		}
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:30,代码来源:DlgReferenceTree.cpp


示例10: UE_LOG

int32 UFixupNeedsLoadForEditorGameCommandlet::InitializeResaveParameters(const TArray<FString>& Tokens, TArray<FString>& MapPathNames)
{
	int32 Result = Super::InitializeResaveParameters(Tokens, MapPathNames);
	// We need ResaveClasses to be specified, otherwise we won't know what to update
	if (Result == 0 && !ResaveClasses.Num())
	{
		UE_LOG(LogContentCommandlet, Error, TEXT("FixupNeedsLoadForEditorGame commandlet requires at least one resave class name. Use -RESAVECLASS=ClassA,ClassB,ClassC to specify resave classes."));
		Result = 1;
	}
	else
	{
		for (FName& ClassName : ResaveClasses)
		{			
			if (!ResaveClassNeedsLoadForEditorGameValues.Contains(ClassName))
			{
				UClass* ResaveClass = FindObject<UClass>(ANY_PACKAGE, *ClassName.ToString());
				if (ResaveClass)
				{
					UObject* DefaultObject = ResaveClass->GetDefaultObject();
					ResaveClassNeedsLoadForEditorGameValues.Add(ClassName, DefaultObject->NeedsLoadForEditorGame());
				}
			}
			else if (Verbosity != UResavePackagesCommandlet::ONLY_ERRORS)
			{
				UE_LOG(LogContentCommandlet, Warning, TEXT("Resave Class \"%s\" could not be found. Make sure the class name is valid and that it's a native class."), *ClassName.ToString());
			}
		}
		if (ResaveClassNeedsLoadForEditorGameValues.Num() == 0)
		{
			UE_LOG(LogContentCommandlet, Error, TEXT("Got %d classes to resave but none of the exist."), ResaveClasses.Num());
			Result = 1;
		}
	}
	return Result;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:35,代码来源:FixupNeedsLoadForEditorGameCommandlet.cpp


示例11: UE_LOG

void FObjectReplicator::PostReceivedBunch()
{
	if ( GetObject() == NULL )
	{
		UE_LOG(LogNet, Verbose, TEXT("PostReceivedBunch: Object == NULL"));
		return;
	}

	// Call PostNetReceive
	const bool bIsServer = (OwningChannel->Connection->Driver->ServerConnection == NULL);
	if (!bIsServer && bHasReplicatedProperties)
	{
		PostNetReceive();
		bHasReplicatedProperties = false;
	}

	// Check if PostNetReceive() destroyed Object
	UObject *Object = GetObject();
	if (Object == NULL || Object->IsPendingKill())
	{
		return;
	}

	// Call RepNotifies
	CallRepNotifies(true);
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:26,代码来源:DataReplication.cpp


示例12: 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();
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:29,代码来源:K2Node_MacroInstance.cpp


示例13: 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();
			}
		}
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:34,代码来源:ObjectPropertyNode.cpp


示例14: 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:1vanK,项目名称:AHRUnrealEngine,代码行数:33,代码来源:ObjectMemoryAnalyzer.cpp


示例15: Outer1

TSharedPtr<FGraphNodeClassNode> FGraphNodeClassHelper::CreateClassDataNode(const class FAssetData& AssetData)
{
	TSharedPtr<FGraphNodeClassNode> Node;
	const FString* GeneratedClassname = AssetData.TagsAndValues.Find("GeneratedClass");
	const FString* ParentClassname = AssetData.TagsAndValues.Find("ParentClass");

	if (GeneratedClassname && ParentClassname)
	{
		FString AssetClassName = *GeneratedClassname;
		UObject* Outer1(NULL);
		ResolveName(Outer1, AssetClassName, false, false);

		FString AssetParentClassName = *ParentClassname;
		UObject* Outer2(NULL);
		ResolveName(Outer2, AssetParentClassName, false, false);

		Node = MakeShareable(new FGraphNodeClassNode);
		Node->ParentClassName = AssetParentClassName;

		UObject* AssetOb = AssetData.IsAssetLoaded() ? AssetData.GetAsset() : NULL;
		UBlueprint* AssetBP = Cast<UBlueprint>(AssetOb);
		UClass* AssetClass = AssetBP ? *AssetBP->GeneratedClass : AssetOb ? AssetOb->GetClass() : NULL;

		FGraphNodeClassData NewData(AssetData.AssetName.ToString(), AssetData.PackageName.ToString(), AssetClassName, AssetClass);
		Node->Data = NewData;
	}

	return Node;
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:29,代码来源:AIGraphTypes.cpp


示例16: cancel

void TargetCursor::handle_target_cursor( Mobile::Character* chr, PKTBI_6C* msg )
{
  if ( msg->selected_serial != 0 )   // targetted something
  {

    if ( chr->dead() )            // but is dead
    {
      if ( chr->client != NULL ) send_sysmessage( chr->client, "I am dead and cannot do that." );
      cancel( chr );
      return;
    }

    if ( ( chr->frozen() || chr->paralyzed() ) && !chr->setting_enabled( "freemove" ) )
    {
      if ( chr->client != NULL )
      {
        if ( chr->frozen() )
          private_say_above( chr, chr, "I am frozen and cannot do that." );
        else if ( chr->paralyzed() )
          private_say_above( chr, chr, "I am paralyzed and cannot do that." );
      }
      cancel( chr );
      return;
    }

    u32 selected_serial = cfBEu32( msg->selected_serial );
    UObject* obj = system_find_object( selected_serial );
    if ( obj != NULL && obj->script_isa( POLCLASS_MOBILE ) &&
         !obj->script_isa( POLCLASS_NPC ) )
    {
      Mobile::Character* targeted = find_character( selected_serial );
      // check for when char is not logged on
      if ( targeted != NULL )
      {
        if ( !chr->is_visible_to_me( targeted ) )
        {
          cancel( chr );
          return;
        }

        if ( msg->cursor_type == 1 )
        {
          if ( ( JusticeRegion::RunNoCombatCheck( chr->client ) == true )
               || ( JusticeRegion::RunNoCombatCheck( targeted->client ) == true ) )
          {
            send_sysmessage( chr->client, "Combat is not allowed in this area." );
            cancel( chr );
            return;
          }
        }
      }
    }
  }

  if ( msg->x != 0xffff || msg->selected_serial != 0 )
    on_target_cursor( chr, msg );
  else
    cancel( chr );
}
开发者ID:gtozzi,项目名称:polserver,代码行数:59,代码来源:target.cpp


示例17: system_find_multi

	Multi::UMulti* system_find_multi( u32 serial )
	{
	  UObject* obj = objecthash.Find( serial );
	  if ( obj != NULL && obj->ismulti() && !obj->orphan() )
		return static_cast<Multi::UMulti*>( obj );
	  else
		return NULL;
	}
开发者ID:vitorfdl,项目名称:polserver,代码行数:8,代码来源:fnsearch.cpp


示例18: system_find_mobile

	Mobile::Character* system_find_mobile( u32 serial /*, int sysfind_flags*/ )
	{
	  UObject* obj = objecthash.Find( serial );
	  if ( obj != NULL && obj->ismobile() && !obj->orphan() )
        return static_cast<Mobile::Character*>( obj );
	  else
		return NULL;
	}
开发者ID:vitorfdl,项目名称:polserver,代码行数:8,代码来源:fnsearch.cpp


示例19: system_find_object

	UObject* system_find_object( u32 serial )
	{
	  UObject* obj = objecthash.Find( serial );
	  if ( obj != NULL && !obj->orphan() )
		return obj;
	  else
		return NULL;
	}
开发者ID:vitorfdl,项目名称:polserver,代码行数:8,代码来源:fnsearch.cpp


示例20:

	Items::Item *system_find_item( u32 serial/*, int sysfind_flags */ )
	{
	  UObject* obj = objecthash.Find( serial );
	  if ( obj != NULL && obj->isitem() && !obj->orphan() )
        return static_cast<Items::Item*>( obj );
	  else
		return NULL;
	}
开发者ID:vitorfdl,项目名称:polserver,代码行数:8,代码来源:fnsearch.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UPackage类代码示例发布时间:2022-05-31
下一篇:
C++ UNavigationSystem类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap