示例#1
0
bool FAssetEditorManager::CloseAllAssetEditors()
{
	bool bAllEditorsClosed = true;
	for (TMultiMap<IAssetEditorInstance*, UObject*>::TIterator It(OpenedEditors); It; ++It)
	{
		IAssetEditorInstance* Editor = It.Key();
		if (Editor != NULL)
		{
			if ( !Editor->CloseWindow() )
			{
				bAllEditorsClosed = false;
			}
		}
	}

	return bAllEditorsClosed;
}
void FShaderPipelineType::Initialize()
{
	check(!bInitialized);

	TSet<FName> UsedNames;

	for (TLinkedList<FShaderPipelineType*>::TIterator It(FShaderPipelineType::GetTypeList()); It; It.Next())
	{
		const auto* PipelineType = *It;

		// Validate stages
		for (int32 Index = 0; Index < SF_NumFrequencies; ++Index)
		{
			check(!PipelineType->AllStages[Index] || PipelineType->AllStages[Index]->GetFrequency() == (EShaderFrequency)Index);
		}

		auto& Stages = PipelineType->GetStages();

		// #todo-rco: Do we allow mix/match of global/mesh/material stages?
		// Check all shaders are the same type, start from the top-most stage
		const FGlobalShaderType* GlobalType = Stages[0]->GetGlobalShaderType();
		const FMeshMaterialShaderType* MeshType = Stages[0]->GetMeshMaterialShaderType();
		const FMaterialShaderType* MateriallType = Stages[0]->GetMaterialShaderType();
		for (int32 Index = 1; Index < Stages.Num(); ++Index)
		{
			if (GlobalType)
			{
				checkf(Stages[Index]->GetGlobalShaderType(), TEXT("Invalid combination of Shader types on Pipeline %s"), PipelineType->Name);
			}
			else if (MeshType)
			{
				checkf(Stages[Index]->GetMeshMaterialShaderType(), TEXT("Invalid combination of Shader types on Pipeline %s"), PipelineType->Name);
			}
			else if (MateriallType)
			{
				checkf(Stages[Index]->GetMaterialShaderType(), TEXT("Invalid combination of Shader types on Pipeline %s"), PipelineType->Name);
			}
		}

		FName PipelineName = PipelineType->GetFName();
		checkf(!UsedNames.Contains(PipelineName), TEXT("Two Pipelines with the same name %s found!"), PipelineType->Name);
		UsedNames.Add(PipelineName);
	}

	bInitialized = true;
}
void FShaderType::GetOutdatedTypes(TArray<FShaderType*>& OutdatedShaderTypes, TArray<const FVertexFactoryType*>& OutdatedFactoryTypes)
{
	for(TLinkedList<FShaderType*>::TIterator It(GetTypeList()); It; It.Next())
	{
		FShaderType* Type = *It;
		Type->GetOutdatedCurrentType(OutdatedShaderTypes, OutdatedFactoryTypes);
	}

	for (int32 TypeIndex = 0; TypeIndex < OutdatedShaderTypes.Num(); TypeIndex++)
	{
		UE_LOG(LogShaders, Warning, TEXT("		Recompiling %s"), OutdatedShaderTypes[TypeIndex]->GetName());
	}
	for (int32 TypeIndex = 0; TypeIndex < OutdatedFactoryTypes.Num(); TypeIndex++)
	{
		UE_LOG(LogShaders, Warning, TEXT("		Recompiling %s"), OutdatedFactoryTypes[TypeIndex]->GetName());
	}
}
TArray<const FShaderPipelineType*> FShaderPipelineType::GetShaderPipelineTypesByFilename(const TCHAR* Filename)
{
	TArray<const FShaderPipelineType*> PipelineTypes;
	for (TLinkedList<FShaderPipelineType*>::TIterator It(FShaderPipelineType::GetTypeList()); It; It.Next())
	{
		auto* PipelineType = *It;
		for (auto* ShaderType : PipelineType->Stages)
		{
			if (FPlatformString::Strcmp(Filename, ShaderType->GetShaderFilename()) == 0)
			{
				PipelineTypes.AddUnique(PipelineType);
				break;
			}
		}
	}
	return PipelineTypes;
}
AActor* AGameModeBase::ChoosePlayerStart_Implementation(AController* Player)
{
	// Choose a player start
	APlayerStart* FoundPlayerStart = nullptr;
	UClass* PawnClass = GetDefaultPawnClassForController(Player);
	APawn* PawnToFit = PawnClass ? PawnClass->GetDefaultObject<APawn>() : nullptr;
	TArray<APlayerStart*> UnOccupiedStartPoints;
	TArray<APlayerStart*> OccupiedStartPoints;
	for (TActorIterator<APlayerStart> It(GetWorld()); It; ++It)
	{
		APlayerStart* PlayerStart = *It;

		if (PlayerStart->IsA<APlayerStartPIE>())
		{
			// Always prefer the first "Play from Here" PlayerStart, if we find one while in PIE mode
			FoundPlayerStart = PlayerStart;
			break;
		}
		else
		{
			FVector ActorLocation = PlayerStart->GetActorLocation();
			const FRotator ActorRotation = PlayerStart->GetActorRotation();
			if (!GetWorld()->EncroachingBlockingGeometry(PawnToFit, ActorLocation, ActorRotation))
			{
				UnOccupiedStartPoints.Add(PlayerStart);
			}
			else if (GetWorld()->FindTeleportSpot(PawnToFit, ActorLocation, ActorRotation))
			{
				OccupiedStartPoints.Add(PlayerStart);
			}
		}
	}
	if (FoundPlayerStart == nullptr)
	{
		if (UnOccupiedStartPoints.Num() > 0)
		{
			FoundPlayerStart = UnOccupiedStartPoints[FMath::RandRange(0, UnOccupiedStartPoints.Num() - 1)];
		}
		else if (OccupiedStartPoints.Num() > 0)
		{
			FoundPlayerStart = OccupiedStartPoints[FMath::RandRange(0, OccupiedStartPoints.Num() - 1)];
		}
	}
	return FoundPlayerStart;
}
示例#6
0
///////////////////////////////////////////////////////////////////////////////
// Descripcion:
// - Guarda los items almacenados en disco.
// Parametros:
// - hFile. Handle al fichero donde almacenar.
// - udOffset. Offset donde depositar la info.
// Devuelve:
// Notas:
// - No se usara un metodo que recorra previamente el vector de slots para
//   hallar el numero de items equipados por motivos de optimizacion.
///////////////////////////////////////////////////////////////////////////////
void 
CEquipmentSlots::Save(const FileDefs::FileHandle& hFile, 
					  dword& udOffset)
{
  // SOLO si parametros correctos
  ASSERT(hFile);
 
  // Se guarda el numero de slots de equipamiento con datos de forma temporal
  iCFileSystem* const pFileSys = SYSEngine::GetFileSystem();
  ASSERT(pFileSys); 
  word uwNumItems = 0;
  const dword udNumItemsOffset = udOffset;
  udOffset += pFileSys->Write(hFile, udOffset, (sbyte *)(&uwNumItems), sizeof(word));

  // Se itera por la lista de items guardandolos  
  iCWorld* const pWorld = SYSEngine::GetWorld();
  ASSERT(pWorld);  
  byte ubSlotIt = 0;
  EquipSlotsVectorIt It(m_EquipSlotsInfo.EquipSlots.begin());
  for (; It != m_EquipSlotsInfo.EquipSlots.end(); ++It, ++ubSlotIt) {
	// ¿Slot con informacion?
	if (*It) {
	  // Se guardan datos
	  // Identificador slot
	  const RulesDefs::eIDEquipmentSlot Slot = RulesDefs::eIDEquipmentSlot(ubSlotIt);
	  udOffset += pFileSys->Write(hFile, 
							      udOffset, 
							      (sbyte *)(&Slot), 
							      sizeof(RulesDefs::eIDEquipmentSlot));	  

	  // Datos del item equipado
	  CItem* const pItem = pWorld->GetItem(*It);
	  ASSERT(pItem);
	  pItem->Save(hFile, udOffset);

	  // Se incrementa contador
	  ++uwNumItems;
	}
  }

  // Se guarda el valor final del numero de slots de equipamiento con datos
  if (uwNumItems > 0) {
	pFileSys->Write(hFile, udNumItemsOffset, (sbyte *)(&uwNumItems), sizeof(word));
  }
}
示例#7
0
void UActorComponent::DetermineUCSModifiedProperties()
{
	UCSModifiedProperties.Empty();

	if (CreationMethod == EComponentCreationMethod::SimpleConstructionScript)
	{
		class FComponentPropertySkipper : public FArchive
		{
		public:
			FComponentPropertySkipper()
				: FArchive()
			{
				ArIsSaving = true;
			}

			virtual bool ShouldSkipProperty(const UProperty* InProperty) const override
			{
				return (    InProperty->HasAnyPropertyFlags(CPF_Transient | CPF_ContainsInstancedReference | CPF_InstancedReference)
						|| !InProperty->HasAnyPropertyFlags(CPF_Edit | CPF_Interp));
			}
		} PropertySkipper;

		UClass* ComponentClass = GetClass();
		UObject* ComponentArchetype = GetArchetype();

		for (TFieldIterator<UProperty> It(ComponentClass); It; ++It)
		{
			UProperty* Property = *It;
			if( Property->ShouldSerializeValue(PropertySkipper) )
			{
				for( int32 Idx=0; Idx<Property->ArrayDim; Idx++ )
				{
					uint8* DataPtr      = Property->ContainerPtrToValuePtr           <uint8>((uint8*)this, Idx);
					uint8* DefaultValue = Property->ContainerPtrToValuePtrForDefaults<uint8>(ComponentClass, (uint8*)ComponentArchetype, Idx);
					if (!Property->Identical( DataPtr, DefaultValue))
					{
						UCSModifiedProperties.Add(FSimpleMemberReference());
						FMemberReference::FillSimpleMemberReference<UProperty>(Property, UCSModifiedProperties.Last());
						break;
					}
				}
			}
		}
	}
}
示例#8
0
void UnMarkAllObjects(EObjectMark Marks)
{
	if (Marks == OBJECTMARK_ALLMARKS)
	{
		MarkAnnotation.RemoveAllAnnotations();
	}
	else
	{
		const TMap<const UObjectBase *, FObjectMark>& Map = MarkAnnotation.GetAnnotationMap();
		for (TMap<const UObjectBase *, FObjectMark>::TConstIterator It(Map); It; ++It)
		{
			if(It.Value().Marks & Marks)
			{
				MarkAnnotation.AddAnnotation((UObject*)It.Key(),FObjectMark(EObjectMark(It.Value().Marks & ~Marks)));
			}
		}
	}
}
示例#9
0
void FSessionManager::FindExpiredSessions( const FDateTime& Now )
{
	bool Dirty = false;

	for (TMap<FGuid, TSharedPtr<FSessionInfo> >::TIterator It(Sessions); It; ++It)
	{
		if (Now > It.Value()->GetLastUpdateTime() + FTimespan::FromSeconds(10.0))
		{
			It.RemoveCurrent();
			Dirty = true;
		}
	}

	if (Dirty)
	{
		SessionsUpdatedDelegate.Broadcast();
	}
}
///////////////////////////////////////////////////////////////////////////////
// Descripcion:
// - Metodo encargado de recorrer todos los items asociados a selectores para
//   enviarles la notificacion acerca de si el item esta o no visible.
// Parametros:
// - bVisible.
// Devuelve:
// Notas:
// - Este metodo sera utilizado como metodo de apoyo en las operaciones
//   de scroll.
///////////////////////////////////////////////////////////////////////////////
void 
CGUIWBaseItemSelector::SetItemsInSelectorsVisibles(const bool bVisible)
{
  // SOLO si instancia inicializada
  ASSERT(IsInitOk());

  // Procede a notificar la visibilidad de los items
  VisualizableItemListIt It(m_InterfazInfo.VisualizableItems.begin());
  for (; It != m_InterfazInfo.VisualizableItems.end(); ++It) {
	// ¿Tiene item asociado?
	if ((*It)->hItem) {
	  // Si, se manda la notificacion que proceda
	  CItem* const pItem = SYSEngine::GetWorld()->GetItem((*It)->hItem);
	  ASSERT(pItem);
	  pItem->VisibleInScreen(bVisible);
	}
  }
}
/** Gets the closest enemy to a world location that can be pursued */
AMagicBattleSoccerCharacter* AMagicBattleSoccerGameState::GetClosestOpponentToLocation(AMagicBattleSoccerCharacter* Player, FVector Location)
{
	const TArray<AMagicBattleSoccerCharacter*>& Opponents = GetOpponents(Cast<AMagicBattleSoccerPlayerState>(Player->PlayerState));
	AMagicBattleSoccerGameMode* GameMode = Cast<AMagicBattleSoccerGameMode>(GetWorld()->GetAuthGameMode());
	AMagicBattleSoccerCharacter* ClosestOpponent = nullptr;

	float ClosestOpponentDistance = 0.0f;
	for (TArray<AMagicBattleSoccerCharacter*>::TConstIterator It(Opponents.CreateConstIterator()); It; ++It)
	{
		float d = FVector::DistSquared((*It)->GetActorLocation(), Location);
		if (nullptr == ClosestOpponent || d < ClosestOpponentDistance && GameMode->CanBePursued(*It))
		{
			ClosestOpponent = *It;
			ClosestOpponentDistance = d;
		}
	}
	return ClosestOpponent;
}
示例#12
0
bool FDataTableExporterJSON::WriteRow(const void* InRowData)
{
	if (!DataTable->RowStruct)
	{
		return false;
	}

	for (TFieldIterator<UProperty> It(DataTable->RowStruct); It; ++It)
	{
		UProperty* BaseProp = *It;
		check(BaseProp);

		const void* Data = BaseProp->ContainerPtrToValuePtr<void>(InRowData, 0);
		WriteStructEntry(InRowData, BaseProp, Data);
	}

	return true;
}
示例#13
0
void FMessageRouter::HandleRemoveInterceptor( IMessageInterceptorRef Interceptor, FName MessageType )
{
	if (MessageType == NAME_All)
	{
		for (TMap<FName, TArray<IMessageInterceptorPtr> >::TIterator It(ActiveInterceptors); It; ++It)
		{
			TArray<IMessageInterceptorPtr>& Interceptors = It.Value();
			Interceptors.Remove(Interceptor);
		}
	}
	else
	{
		TArray<IMessageInterceptorPtr>& Interceptors = ActiveInterceptors.FindOrAdd(MessageType);
		Interceptors.Remove(Interceptor);
	}

	Tracer->TraceRemovedInterceptor(Interceptor, MessageType);
}
示例#14
0
///////////////////////////////////////////////////////////////////////////////
// Descripcion:
// - Elimina la alineacion de todas aquellas entidades que se hallen alineadas
//   en el map recibido.
// - Al eliminar alineacion, tambien se establecera orden nula.
// Parametros:
// - Map. Map de alineacion
// Devuelve:
// Notas:
///////////////////////////////////////////////////////////////////////////////
void 
CCombatSystem::RemoveAlingment(AlingmentMap& Map)
{
  // Procede a eliminar contenido de alineacion
  AlingmentMapIt It(Map.begin());
  while (It != Map.end()) {
	// Se desvincula modulo como observer de la criatura
	CCriature* const pCriature = m_pWorld->GetCriature(It->first);
	if (pCriature) {
	  pCriature->RemoveObserver(this);
	  pCriature->m_ActOrder = CCriature::AO_NONE;
	}

	// Se borra nodo en memoria y map
	delete It->second;
	It = Map.erase(It);
  }
}
void FJavascriptUMGViewportClient::Tick(float InDeltaTime)
{
	if (!GIntraFrameDebuggingGameThread)
	{
		// Begin Play
		if (!GameScene->GetWorld()->bBegunPlay)
		{
			for (FActorIterator It(GameScene->GetWorld()); It; ++It)
			{
				It->BeginPlay();
			}
			GameScene->GetWorld()->bBegunPlay = true;
		}

		// Tick
		GameScene->GetWorld()->Tick(LEVELTICK_All, InDeltaTime);
	}
}
void FUserDefinedStructureCompilerUtils::DefaultUserDefinedStructs(UObject* Object, FCompilerResultsLog& MessageLog)
{
	if (Object && FStructureEditorUtils::UserDefinedStructEnabled())
	{
		for (TFieldIterator<UProperty> It(Object->GetClass()); It; ++It)
		{
			if (const UProperty* Property = (*It))
			{
				uint8* Mem = Property->ContainerPtrToValuePtr<uint8>(Object);
				if (!FStructureEditorUtils::Fill_MakeStructureDefaultValue(Property, Mem))
				{
					MessageLog.Warning(*FString::Printf(*LOCTEXT("MakeStructureDefaultValue_Error", "MakeStructureDefaultValue parsing error. Object: %s, Property: %s").ToString(),
						*Object->GetName(), *Property->GetName()));
				}
			}
		}
	}
}
void FDynamicResourceMap::RemoveExpiredTextureResources()
{
	// We attempt to purge every 10Mb of accumulated textures.
	static const uint64 PurgeAfterAddingNewBytes = 1024 * 1024 * 10; // 10Mb

	if ( TextureMemorySincePurge >= PurgeAfterAddingNewBytes )
	{
		for ( TextureResourceMap::TIterator It(TextureMap); It; ++It )
		{
			if ( It.Key().IsStale() )
			{
				It.RemoveCurrent();
			}
		}

		TextureMemorySincePurge = 0;
	}
}
void FStreamableManager::OnPostGarbageCollect()
{
	// now lets make sure it actually worked
	for (TStreamableMap::TIterator It(StreamableItems); It; ++It)
	{
		FStreamable* Existing = It.Value();
		if (Existing->bAsyncUnloadRequestOutstanding && Existing->RelatedRequests.Num() == 0)
		{
			if (Existing->WeakTarget.Get())
			{
				// This is reasonable if someone else has made a hard reference to it
				UE_LOG(LogStreamableManager, Verbose, TEXT("Failed to unload %s."), *It.Key().ToString());
			}
			delete Existing;
			It.RemoveCurrent();
		}
	}
}
示例#19
0
void UUnrealEdEngine::OnPostGarbageCollect()
{
	// Refresh Editor browsers after GC in case objects where removed.  Note that if the user is currently
	// playing in a PIE level, we don't want to interrupt performance by refreshing the Generic Browser window.
	if( GIsEditor && !GIsPlayInEditorWorld )
	{
		FEditorDelegates::RefreshAllBrowsers.Broadcast();
	}

	// Clean up any GCed packages in the PackageToNotifyState
	for( TMap<TWeakObjectPtr<UPackage>,uint8>::TIterator It(PackageToNotifyState); It; ++It )
	{
		if( It.Key().IsValid() == false )
		{
			It.RemoveCurrent();
		}
	}
}
示例#20
0
bool FKeyHandleMap::operator==(const FKeyHandleMap& Other) const
{
	if (KeyHandlesToIndices.Num() != Other.KeyHandlesToIndices.Num())
	{
		return false;
	}

	for (TMap<FKeyHandle, int32>::TConstIterator It(KeyHandlesToIndices); It; ++It)
	{
		int32 const* OtherVal = Other.KeyHandlesToIndices.Find(It.Key());
		if (!OtherVal || *OtherVal != It.Value() )
		{
			return false;
		}
	}

	return true;
}
示例#21
0
void FVoiceEngineImpl::TickTalkers(float DeltaTime)
{
	// Remove users that are done talking.
	const double CurTime = FPlatformTime::Seconds();
	for (FRemoteTalkerData::TIterator It(RemoteTalkerBuffers); It; ++It)
	{
		FRemoteTalkerDataImpl& RemoteData = It.Value();
		double TimeSince = CurTime - RemoteData.LastSeen;
		if (TimeSince >= 1.0)
		{
			// Dump the whole talker
			if (RemoteData.AudioComponent)
			{
				RemoteData.AudioComponent->Stop();
			}
		}
	}
}
void test_ctor_throws()
{
#ifndef TEST_HAS_NO_EXCEPTIONS
    using It = forward_iterator<ThrowsCounted*>;
    const int N = 5;
    alignas(ThrowsCounted) char pool[sizeof(ThrowsCounted)*N] = {};
    ThrowsCounted* p = (ThrowsCounted*)pool;
    try {
        ThrowsCounted::throw_after = 4;
        std::uninitialized_value_construct_n(It(p), N);
        assert(false);
    } catch (...) {}
    assert(ThrowsCounted::count == 3);
    assert(ThrowsCounted::constructed == 4); // forth construction throws
    std::destroy(p, p+3);
    assert(ThrowsCounted::count == 0);
#endif
}
AActor* AGameModeBase::FindPlayerStart_Implementation(AController* Player, const FString& IncomingName)
{
	UWorld* World = GetWorld();

	// If incoming start is specified, then just use it
	if (!IncomingName.IsEmpty())
	{
		const FName IncomingPlayerStartTag = FName(*IncomingName);
		for (TActorIterator<APlayerStart> It(World); It; ++It)
		{
			APlayerStart* Start = *It;
			if (Start && Start->PlayerStartTag == IncomingPlayerStartTag)
			{
				return Start;
			}
		}
	}

	// Always pick StartSpot at start of match
	if (ShouldSpawnAtStartSpot(Player))
	{
		if (AActor* PlayerStartSpot = Player->StartSpot.Get())
		{
			return PlayerStartSpot;
		}
		else
		{
			UE_LOG(LogGameMode, Error, TEXT("Error - ShouldSpawnAtStartSpot returned true but the Player StartSpot was null."));
		}
	}

	AActor* BestStart = ChoosePlayerStart(Player);
	if (BestStart == nullptr)
	{
		// No player start found
		UE_LOG(LogGameMode, Log, TEXT("Warning - PATHS NOT DEFINED or NO PLAYERSTART with positive rating"));

		// This is a bit odd, but there was a complex chunk of code that in the end always resulted in this, so we may as well just 
		// short cut it down to this.  Basically we are saying spawn at 0,0,0 if we didn't find a proper player start
		BestStart = World->GetWorldSettings();
	}

	return BestStart;
}
void FMovieSceneSequenceInstance::UpdatePassSingle( EMovieSceneUpdateData& UpdateData, class IMovieScenePlayer& Player )
{
	if(MovieSceneSequence.IsValid())
	{
		// Refresh time range so that spawnables can be created if they fall within the playback range, or destroyed if not
		UMovieScene* MovieScene = MovieSceneSequence->GetMovieScene();
		TimeRange = MovieScene->GetPlaybackRange();

		TArray<TWeakObjectPtr<UObject>> NoObjects;

		// update each master track
		for( FMovieSceneInstanceMap::TIterator It( MasterTrackInstances ); It; ++It )
		{		
			if (It.Value()->HasUpdatePasses() & UpdateData.UpdatePass && It.Value() != CameraCutTrackInstance)
			{
				It.Value()->Update( UpdateData, NoObjects, Player, *this);
			}
		}

		// update tracks bound to objects
		TMap<FGuid, FMovieSceneObjectBindingInstance>::TIterator ObjectIt = ObjectBindingInstances.CreateIterator();
		for(; ObjectIt; ++ObjectIt )
		{
			FMovieSceneObjectBindingInstance& ObjectBindingInstance = ObjectIt.Value();
		
			for( FMovieSceneInstanceMap::TIterator It = ObjectBindingInstance.TrackInstances.CreateIterator(); It; ++It )
			{
				if (It.Value()->HasUpdatePasses() & UpdateData.UpdatePass && It.Value() != CameraCutTrackInstance)
				{
					It.Value()->Update( UpdateData, ObjectBindingInstance.RuntimeObjects, Player, *this );
				}
			}
		}

		// update camera cut track last to make sure spawnable cameras are there, and to override sub-shots
		if (CameraCutTrackInstance.IsValid())
		{
			if (CameraCutTrackInstance->HasUpdatePasses() & UpdateData.UpdatePass)
			{
				CameraCutTrackInstance->Update(UpdateData, NoObjects, Player, *this );
			}
		}
	}
}
示例#25
0
//////////////////////////////////////////////////////////////////////////
// processCreateResources
void CsCore::processCreateResources()
{
	BcScopedLock< BcMutex > Lock( ContainerLock_ );
	
	TResourceHandleListIterator It( CreateResources_.begin() );
	while( It != CreateResources_.end() )
	{
		CsResourceRef<> ResourceHandle = (*It);
		
		// Create resource.
		ResourceHandle->create();
		
		// Remove from list.
		It = CreateResources_.erase( It );
		
		// Put into loading list.
		LoadingResources_.push_back( ResourceHandle );
	}
}
/**
 * For the given text info, calculate the vertical offset that needs to be applied to the component
 * in order to vertically align it to the requested alignment.
 **/
float CalculateVerticalAlignmentOffset(
	const TCHAR* Text,
	class UFont* Font,
	float XScale, 
	float YScale, 
	float HorizSpacingAdjust,
	EVerticalTextAligment VerticalAlignment)
{
	check(Text);

	if(!Font)
	{
		return 0;
	}

	float FirstLineHeight = -1; // Only kept around for legacy positioning support
	float StartY = 0;

	FTextIterator It(Text);

	while (It.NextLine())
	{
		FVector2D LineSize = ComputeTextSize(It, Font, XScale, YScale, HorizSpacingAdjust);

		if (FirstLineHeight < 0)
		{
			FirstLineHeight = LineSize.Y;
		}

		int32 Ch;

		// Iterate to end of line
		while (It.NextCharacterInLine(Ch))
		{
		}

		// Move Y position down to next line. If the current line is empty, move by max char height in font
		StartY += LineSize.Y > 0 ? LineSize.Y : Font->GetMaxCharHeight();
	}

	// Calculate a vertical translation to create the correct vertical alignment
	return -ComputeVerticalAlignmentOffset(StartY, VerticalAlignment, FirstLineHeight);
}
示例#27
0
///////////////////////////////////////////////////////////////////////////////
// Descripcion:
// - Actual sobre todos los items que esten en el contenedor
// Parametros:
// - bPause. Flag de pausa
// Devuelve:
// Notas:
///////////////////////////////////////////////////////////////////////////////
void 
CEquipmentSlots::SetPause(const bool bPause)
{
  // SOLO si instancia inicializada
  ASSERT(IsInitOk());

  // Recorre lista de items
  iCWorld* const pWorld = SYSEngine::GetWorld();
  EquipSlotsVectorIt It(m_EquipSlotsInfo.EquipSlots.begin());
  for (; It != m_EquipSlotsInfo.EquipSlots.end(); ++It) {
	// ¿Hay item equipado?
	if (*It) {
	  // Si, se actua
	  CItem* const pItem = pWorld->GetItem(*It);
	  ASSERT(pItem);
	  pItem->SetPause(bPause);	
	}
  }
}
示例#28
0
void FLauncherProfileManager::LoadDeviceGroups( )
{
	if (GConfig != nullptr)
	{
		FConfigSection* LoadedDeviceGroups = GConfig->GetSectionPrivate(TEXT("Launcher.DeviceGroups"), false, true, GEngineIni);

		if (LoadedDeviceGroups != nullptr)
		{
			// parse the configuration file entries into device groups
			for (FConfigSection::TIterator It(*LoadedDeviceGroups); It; ++It)
			{
				if (It.Key() == TEXT("DeviceGroup"))
				{
					DeviceGroups.Add(ParseDeviceGroup(*It.Value()));
				}
			}
		}
	}
}
示例#29
0
class ULiveEditorBlueprint *FLiveEditorManager::FindActiveBlueprint( const FString &Name )
{
	FString CheckName = Name.Left( Name.Find( TEXT("."), ESearchCase::IgnoreCase, ESearchDir::FromEnd ) );
	for ( TArray< FActiveBlueprintRecord >::TIterator It(ActiveBlueprints); It; It++ )
	{
		ULiveEditorBlueprint *BP = (*It).Blueprint.Get();
		if ( !BP )
			continue;

		FString CheckPathName = BP->GetArchetype()->GetPathName();
		CheckPathName = CheckPathName.Left( CheckPathName.Find( TEXT("."), ESearchCase::IgnoreCase, ESearchDir::FromEnd ) );

		UE_LOG( LiveEditorManagerLog, Log, TEXT("%s | %s"), *CheckPathName, *CheckName );
		if ( CheckPathName == CheckName )
			return BP;
	}

	return NULL;
}
bool UK2Node_MakeStruct::CanBeMade(const UScriptStruct* Struct, bool bIncludeEditOnly, bool bMustHaveValidProperties )
{
	if (Struct && !Struct->HasMetaData(TEXT("HasNativeMake")))
	{
		if (!bMustHaveValidProperties && UEdGraphSchema_K2::IsAllowableBlueprintVariableType(Struct))
		{
			return true;
		}

		for (TFieldIterator<UProperty> It(Struct); It; ++It)
		{
			if (CanBeExposed(*It, bIncludeEditOnly))
			{
				return true;
			}
		}
	}
	return false;
}