Ejemplo n.º 1
1
void ReattachComponents(const TArray<FString>& Args)
{
	if(Args.Num() != 1)
	{
		UE_LOG(LogConsoleResponse, Warning, TEXT("Reattach.Components: missing class name parameter"));
		return;
	}

	UE_LOG(LogConsoleResponse, Display, TEXT("Reattach.Components:"));

	UClass* Class=NULL;
	if( ParseObject<UClass>( *Args[0], TEXT("CLASS="), Class, ANY_PACKAGE ) &&
		Class->IsChildOf(UActorComponent::StaticClass()) )
	{
		for( FObjectIterator It(Class); It; ++It )
		{
			UActorComponent* ActorComponent = Cast<UActorComponent>(*It);
			if( ActorComponent )
			{
				UE_LOG(LogConsoleResponse, Display, TEXT("   Component: %s"), 
					*ActorComponent->GetName());

				FComponentReregisterContext Reregister(ActorComponent);
			}
		}
		UE_LOG(LogConsoleResponse, Display, TEXT(""));
	}
	else
	{
		UE_LOG(LogConsoleResponse, Warning, TEXT("Reattach.Components: No objects with the class name '%s' found"), *Args[0]);
	}

}
Ejemplo n.º 2
0
bool UGameEngine::HandleReattachComponentsCommand( const TCHAR* Cmd, FOutputDevice& Ar )
{
	UClass* Class=NULL;
	if( ParseObject<UClass>( Cmd, TEXT("CLASS="), Class, ANY_PACKAGE ) &&
		Class->IsChildOf(UActorComponent::StaticClass()) )
	{
		for( FObjectIterator It(Class); It; ++It )
		{
			UActorComponent* ActorComponent = Cast<UActorComponent>(*It);
			if( ActorComponent )
			{
				FComponentReregisterContext Reregister(ActorComponent);
			}
		}
	}
	return true;
}