bool FStructureEditorUtils::AddVariable(UBlueprint* Blueprint, FName StructName, const FEdGraphPinType& VarType)
{
	if (NULL != Blueprint)
	{
		const FScopedTransaction Transaction( LOCTEXT("AddVariable", "Add Variable") );
		Blueprint->Modify();

		FBPStructureDescription* StructureDesc = Blueprint->UserDefinedStructures.FindByPredicate(FFindByNameHelper(StructName));
		if (StructureDesc)
		{
			FString ErrorMessage;
			if (!CanHaveAMemberVariableOfType(StructureDesc->CompiledStruct, VarType, &ErrorMessage))
			{
				UE_LOG(LogBlueprint, Warning, TEXT("%s"), *ErrorMessage);
				return false;
			}

			const FName VarName = FMemberVariableNameHelper::Generate(StructureDesc->CompiledStruct, FString());
			check(NULL == StructureDesc->Fields.FindByPredicate(FFindByNameHelper(VarName)));
			const FString DisplayName = VarName.ToString();
			check(IsUniqueVariableDisplayName(Blueprint, StructName, DisplayName));

			FBPVariableDescription NewVar;
			NewVar.VarName = VarName;
			NewVar.FriendlyName = DisplayName;
			NewVar.VarType = VarType;
			NewVar.VarGuid = FGuid::NewGuid();
			StructureDesc->Fields.Add(NewVar);

			OnStructureChanged(*StructureDesc, Blueprint);
			return true;
		}
	}
	return false;
}
Exemplo n.º 2
0
 bool CopyFileToPublicStaging(const FString& SourceFile)
 {
     FString IpaFilename = FPaths::GetCleanFilename(SourceFile);
     return CopyFileToDevice(SourceFile, FString(TEXT("/PublicStaging/")) + IpaFilename, 1024*1024);
 }
bool LocalizationCommandletTasks::ReportLoadedAudioAssets(const TArray<ULocalizationTarget*>& Targets, const TOptional<FString>& CultureName)
{
	TSet<FString> LoadedDialogueWaveAssets;
	TSet<FString> LoadedSoundWaveAssets;

	for (const ULocalizationTarget* Target : Targets)
	{
		const FString RootAssetPath = Target->IsMemberOfEngineTargetSet() ? TEXT("/Engine") : TEXT("/Game");

		TArray<FString> CulturesToTest;
		{
			if (CultureName.IsSet())
			{
				CulturesToTest.Add(CultureName.GetValue());
			}
			else
			{
				CulturesToTest.Reserve(Target->Settings.SupportedCulturesStatistics.Num());
				for (const FCultureStatistics& CultureData : Target->Settings.SupportedCulturesStatistics)
				{
					CulturesToTest.Add(CultureData.CultureName);
				}
			}
		}

		TArray<FString> DialogueWavePathsToTest;
		TArray<FString> SoundWavePathsToTest;
		{
			const FString NativeCulture = Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex) ? Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName : FString();
			const bool bImportNativeAsSource = Target->Settings.ImportDialogueSettings.bImportNativeAsSource && !NativeCulture.IsEmpty();
			if (bImportNativeAsSource)
			{
				DialogueWavePathsToTest.Add(RootAssetPath);
				SoundWavePathsToTest.Add(RootAssetPath / Target->Settings.ImportDialogueSettings.ImportedDialogueFolder);
			}

			for (const FString& Culture : CulturesToTest)
			{
				if (bImportNativeAsSource && Culture == NativeCulture)
				{
					continue;
				}

				DialogueWavePathsToTest.Add(RootAssetPath / TEXT("L10N") / Culture);
				SoundWavePathsToTest.Add(RootAssetPath / TEXT("L10N") / Culture / Target->Settings.ImportDialogueSettings.ImportedDialogueFolder);
			}
		}

		ForEachObjectOfClass(UDialogueWave::StaticClass(), [&](UObject* InObject)
		{
			const FString ObjectPath = InObject->GetPathName();

			auto FindAssetPathPredicate = [&](const FString& InAssetPath) -> bool
			{
				return ObjectPath.StartsWith(InAssetPath, ESearchCase::IgnoreCase);
			};

			if (DialogueWavePathsToTest.ContainsByPredicate(FindAssetPathPredicate))
			{
				LoadedDialogueWaveAssets.Add(ObjectPath);
			}
		});

		ForEachObjectOfClass(USoundWave::StaticClass(), [&](UObject* InObject)
		{
			const FString ObjectPath = InObject->GetPathName();

			auto FindAssetPathPredicate = [&](const FString& InAssetPath) -> bool
			{
				return ObjectPath.StartsWith(InAssetPath, ESearchCase::IgnoreCase);
			};

			if (SoundWavePathsToTest.ContainsByPredicate(FindAssetPathPredicate))
			{
				LoadedSoundWaveAssets.Add(ObjectPath);
			}
		});
	}

	if (LoadedDialogueWaveAssets.Num() > 0 || LoadedSoundWaveAssets.Num() > 0)
	{
		FTextBuilder MsgBuilder;
		MsgBuilder.AppendLine(LOCTEXT("Warning_LoadedAudioAssetsMsg", "The following audio assets have been loaded by the editor and may cause the dialogue import to fail as their files will be read-only."));
		MsgBuilder.AppendLine(FText::GetEmpty());
		MsgBuilder.AppendLine(LOCTEXT("Warning_LoadedAudioAssetsMsg_Continue", "Do you want to continue?"));
				
		if (LoadedDialogueWaveAssets.Num() > 0)
		{
			MsgBuilder.AppendLine(FText::GetEmpty());
			MsgBuilder.AppendLine(LOCTEXT("Warning_LoadedAudioAssetsMsg_DialogueWaves", "Dialogue Waves:"));

			MsgBuilder.Indent();
			for (const FString& LoadedDialogueWaveAsset : LoadedDialogueWaveAssets)
			{
				MsgBuilder.AppendLine(LoadedDialogueWaveAsset);
			}
			MsgBuilder.Unindent();
		}

		if (LoadedSoundWaveAssets.Num() > 0)
		{
			MsgBuilder.AppendLine(FText::GetEmpty());
			MsgBuilder.AppendLine(LOCTEXT("Warning_LoadedAudioAssetsMsg_SoundWaves", "Sound Waves:"));

			MsgBuilder.Indent();
			for (const FString& LoadedSoundWaveAsset : LoadedSoundWaveAssets)
			{
				MsgBuilder.AppendLine(LoadedSoundWaveAsset);
			}
			MsgBuilder.Unindent();
		}

		const FText MsgTitle = LOCTEXT("Warning_LoadedAudioAssetsTitle", "Warning - Loaded Audio Assets");
		return FMessageDialog::Open(EAppMsgType::YesNo, MsgBuilder.ToText(), &MsgTitle) == EAppReturnType::Yes;
	}

	return true;
}
Exemplo n.º 4
0
UK2Node::ERedirectType UK2Node::DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const
{
	ERedirectType RedirectType = ERedirectType_None;

	// if the pin names do match
	if (FCString::Stricmp(*(NewPin->PinName), *(OldPin->PinName)) == 0)
	{
		// Make sure we're not dealing with a menu node
		UEdGraph* OuterGraph = GetGraph();
		if( OuterGraph && OuterGraph->Schema )
		{
			const UEdGraphSchema_K2* K2Schema = Cast<const UEdGraphSchema_K2>(GetSchema());
			if( !K2Schema || K2Schema->IsSelfPin(*NewPin) || K2Schema->ArePinTypesCompatible(OldPin->PinType, NewPin->PinType) )
			{
				RedirectType = ERedirectType_Name;
			}
			else
			{
				RedirectType = ERedirectType_None;
			}
		}
	}
	else
	{
		// try looking for a redirect if it's a K2 node
		if (UK2Node* Node = Cast<UK2Node>(NewPin->GetOwningNode()))
		{	
			if (OldPin->ParentPin == NULL)
			{
				// if you don't have matching pin, now check if there is any redirect param set
				TArray<FString> OldPinNames;
				GetRedirectPinNames(*OldPin, OldPinNames);

				FName NewPinName;
				RedirectType = ShouldRedirectParam(OldPinNames, /*out*/ NewPinName, Node);

				// make sure they match
				if ((RedirectType != ERedirectType_None) && FCString::Stricmp(*(NewPin->PinName), *(NewPinName.ToString())) != 0)
				{
					RedirectType = ERedirectType_None;
				}
			}
			else
			{
				struct FPropertyDetails
				{
					const UEdGraphPin* Pin;
					FString PropertyName;

					FPropertyDetails(const UEdGraphPin* InPin, const FString& InPropertyName)
						: Pin(InPin), PropertyName(InPropertyName)
					{
					}
				};

				TArray<FPropertyDetails> ParentHierarchy;
				const UEdGraphPin* CurPin = OldPin;
				do 
				{
					ParentHierarchy.Add(FPropertyDetails(CurPin, CurPin->PinName.RightChop(CurPin->ParentPin->PinName.Len() + 1)));
					CurPin = CurPin->ParentPin;
				} while (CurPin->ParentPin);

				// if you don't have matching pin, now check if there is any redirect param set
				TArray<FString> OldPinNames;
				GetRedirectPinNames(*CurPin, OldPinNames);

				FString NewPinNameStr;
				FName NewPinName;
				RedirectType = ShouldRedirectParam(OldPinNames, /*out*/ NewPinName, Node);

				NewPinNameStr = (RedirectType == ERedirectType_None ? CurPin->PinName : NewPinName.ToString());

				for (int32 ParentIndex = ParentHierarchy.Num() - 1; ParentIndex >= 0; --ParentIndex)
				{
					const UEdGraphPin* CurPin = ParentHierarchy[ParentIndex].Pin;
					const UEdGraphPin* ParentPin = CurPin->ParentPin;

					TMap<FName, FName>* StructRedirects = UStruct::TaggedPropertyRedirects.Find(ParentPin->PinType.PinSubCategoryObject->GetFName());
					if (StructRedirects)
					{
						FName* PropertyRedirect = StructRedirects->Find(FName(*ParentHierarchy[ParentIndex].PropertyName));
						if (PropertyRedirect)
						{
							NewPinNameStr += FString("_") + PropertyRedirect->ToString();
						}
						else
						{
							NewPinNameStr += FString("_") + ParentHierarchy[ParentIndex].PropertyName;
						}
					}
					else
					{
						NewPinNameStr += FString("_") + ParentHierarchy[ParentIndex].PropertyName;
					}
				}

				// make sure they match
				RedirectType = ((FCString::Stricmp(*(NewPin->PinName), *NewPinNameStr) != 0) ? ERedirectType_None : ERedirectType_Name);
			}
		}
	}

	return RedirectType;
}
FString FLiveEditorWizardBase::GetAdvanceButtonText() const
{
	return (IsOnLastStep())? FString( TEXT("Finish") ) : FString( TEXT("Next") );
}
Exemplo n.º 6
0
FString UpdateManager::HelloWorld() {
	UE_LOG(LogTemp, Log, TEXT("Hello, World"));
	return FString("Hello, I'm Happy!");
}
FString UBlackboardKeyType_NativeEnum::DescribeValue(const uint8* RawData) const
{
	return EnumType ? EnumType->GetEnumName(GetValue(RawData)) : FString("UNKNOWN!");
}
/**
 *	Create a search result from a server response
 *
 * @param ServerDetails Steam server details
 */
void FOnlineAsyncTaskSteamFindServerBase::ParseSearchResult(class gameserveritem_t* ServerDetails)
{
	TSharedRef<FInternetAddr> ServerAddr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();

	ServerAddr->SetIp(ServerDetails->m_NetAdr.GetIP());
	ServerAddr->SetPort(ServerDetails->m_NetAdr.GetConnectionPort());
	int32 ServerQueryPort = ServerDetails->m_NetAdr.GetQueryPort();

	UE_LOG_ONLINE(Warning, TEXT("Server response IP:%s"), *ServerAddr->ToString(false));
	if (ServerDetails->m_bHadSuccessfulResponse)
	{
		FString GameTags(UTF8_TO_TCHAR(ServerDetails->m_szGameTags));

		// Check for build compatibility
		int32 ServerBuildId = 0;
		int32 BuildUniqueId = GetBuildUniqueId();

		TArray<FString> TagArray;
		GameTags.ParseIntoArray(TagArray, TEXT(","), true);
		if (TagArray.Num() > 0 && TagArray[0].StartsWith(STEAMKEY_BUILDUNIQUEID))
		{
			ServerBuildId = FCString::Atoi(*TagArray[0].Mid(ARRAY_COUNT(STEAMKEY_BUILDUNIQUEID)));
		}

		if (ServerBuildId != 0 && ServerBuildId == BuildUniqueId)
		{
			// Create a new pending search result 
			FPendingSearchResultSteam* NewPendingSearch = new (PendingSearchResults) FPendingSearchResultSteam(this);
			NewPendingSearch->ServerId = FUniqueNetIdSteam(ServerDetails->m_steamID);
			NewPendingSearch->HostAddr = ServerAddr;

			// Fill search result members
			FOnlineSessionSearchResult* NewSearchResult = &NewPendingSearch->PendingSearchResult;
			NewSearchResult->PingInMs = FMath::Clamp(ServerDetails->m_nPing, 0, MAX_QUERY_PING);

			// Fill session members
			FOnlineSession* NewSession = &NewSearchResult->Session;

			//NewSession->OwningUserId = ;
			NewSession->OwningUserName = UTF8_TO_TCHAR(ServerDetails->GetName());

			NewSession->NumOpenPublicConnections = ServerDetails->m_nMaxPlayers - ServerDetails->m_nPlayers;
			NewSession->NumOpenPrivateConnections = 0;

			// Fill session settings members
			NewSession->SessionSettings.NumPublicConnections = ServerDetails->m_nMaxPlayers;
			NewSession->SessionSettings.NumPrivateConnections = 0;
			NewSession->SessionSettings.bAntiCheatProtected = ServerDetails->m_bSecure ? true : false;
			NewSession->SessionSettings.Set(SETTING_MAPNAME, FString(UTF8_TO_TCHAR(ServerDetails->m_szMap)), EOnlineDataAdvertisementType::ViaOnlineService);

			// Start a rules request for this new result
			NewPendingSearch->ServerQueryHandle = SteamMatchmakingServersPtr->ServerRules(ServerDetails->m_NetAdr.GetIP(), ServerQueryPort, NewPendingSearch);
			if (NewPendingSearch->ServerQueryHandle == HSERVERQUERY_INVALID)
			{
				// Remove the failed element
				PendingSearchResults.RemoveAtSwap(PendingSearchResults.Num() - 1);
			}
		}
		else
		{
			UE_LOG_ONLINE(Warning, TEXT("Removed incompatible build: ServerBuildUniqueId = 0x%08x, GetBuildUniqueId() = 0x%08x"),
				ServerBuildId, BuildUniqueId);
		}
	}
}
Exemplo n.º 9
0
FOculusInput::FOculusInput( const TSharedRef< FGenericApplicationMessageHandler >& InMessageHandler )
	: MessageHandler( InMessageHandler )
	, ControllerPairs()
	, TriggerThreshold(0.8f)
{
	// Initializes LibOVR. 
	ovrInitParams initParams;
	FMemory::Memset(initParams, 0);
	initParams.Flags = ovrInit_RequestVersion;
	initParams.RequestedMinorVersion = OVR_MINOR_VERSION;
#if !UE_BUILD_SHIPPING
//	initParams.LogCallback = OvrLogCallback;
#endif

	ovrResult initStatus = ovr_Initialize(&initParams);
	if (!OVR_SUCCESS(initStatus) && initStatus == ovrError_LibLoad)
	{
		// fatal errors: can't load library
 		UE_LOG(LogOcInput, Log, TEXT("Can't find Oculus library %s: is proper Runtime installed? Version: %s"),
 			TEXT(OVR_FILE_DESCRIPTION_STRING), TEXT(OVR_VERSION_STRING));
		return;
	}

	FOculusTouchControllerPair& ControllerPair = *new(ControllerPairs) FOculusTouchControllerPair();

	// @todo: Unreal controller index should be assigned to us by the engine to ensure we don't contest with other devices
	ControllerPair.UnrealControllerIndex = 0; //???? NextUnrealControllerIndex++;

	// Load the config, even if we failed to initialize a controller
	LoadConfig();

	IModularFeatures::Get().RegisterModularFeature( GetModularFeatureName(), this );
	GEngine->MotionControllerDevices.AddUnique(this);

	// Register the FKeys
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_Thumbstick, LOCTEXT("OculusTouch_Left_Thumbstick", "Oculus Touch (L) Thumbstick CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_FaceButton1, LOCTEXT("OculusTouch_Left_FaceButton1", "Oculus Touch (L) X Button CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_Trigger, LOCTEXT("OculusTouch_Left_Trigger", "Oculus Touch (L) Trigger CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_FaceButton2, LOCTEXT("OculusTouch_Left_FaceButton2", "Oculus Touch (L) Y Button CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_IndexPointing, LOCTEXT("OculusTouch_Left_IndexPointing", "Oculus Touch (L) Pointing CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_ThumbUp, LOCTEXT("OculusTouch_Left_ThumbUp", "Oculus Touch (L) Thumb Up CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));

	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_Thumbstick, LOCTEXT("OculusTouch_Right_Thumbstick", "Oculus Touch (R) Thumbstick CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_FaceButton1, LOCTEXT("OculusTouch_Right_FaceButton1", "Oculus Touch (R) A Button CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_Trigger, LOCTEXT("OculusTouch_Right_Trigger", "Oculus Touch (R) Trigger CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_FaceButton2, LOCTEXT("OculusTouch_Right_FaceButton2", "Oculus Touch (R) B Button CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_IndexPointing, LOCTEXT("OculusTouch_Right_IndexPointing", "Oculus Touch (R) Pointing CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
	EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_ThumbUp, LOCTEXT("OculusTouch_Right_ThumbUp", "Oculus Touch (R) Thumb Up CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));

	UE_LOG(LogOcInput, Log, TEXT("OculusInput is initialized. Init status %d. Runtime version: %s"), int(initStatus), *FString(ANSI_TO_TCHAR(ovr_GetVersionString())));
}
void FTODAssetPropertyDetails::CustomizeDetails(IDetailLayoutBuilder& DetailLayout)
{
	const IDetailsView& DetailView = DetailLayout.GetDetailsView();
	//first find asset we are going to edit.
	TWeakObjectPtr<UObject> InspectedObject;
	for (TWeakObjectPtr<UObject> inspObj : DetailView.GetSelectedObjects())
	{
		InspectedObject = inspObj;
		break;
	}

	UTODAsset* TODAsset = Cast<UTODAsset>(InspectedObject.Get());
	CurrentTODAsset = Cast<UTODAsset>(InspectedObject.Get());
	if (TODAsset)
	{
		for (TFieldIterator<UProperty> PropIt(TODAsset->GetClass()); PropIt; ++PropIt)
		{
			UProperty* prop = *PropIt;
			DetailLayout.HideProperty(prop->GetFName());
			//PropertyHandles.Add(DetailLayout.GetProperty(prop->GetFName()));
			UStructProperty* structProp = Cast<UStructProperty>(prop);
			if (structProp)
			{
				FRuntimeFloatCurve* floatCurve = structProp->ContainerPtrToValuePtr<FRuntimeFloatCurve>(TODAsset);
				if (floatCurve)
				{
					TSharedPtr<FTODFloatCurveProperty> tempFloatProp = MakeShareable(new FTODFloatCurveProperty());
					tempFloatProp->PropertyHandle = DetailLayout.GetProperty(prop->GetFName());
					tempFloatProp->TODAsset = TODAsset;
					tempFloatProp->CategoryName = tempFloatProp->PropertyHandle->GetMetaData(TEXT("Category"));
					FloatCurves.Add(tempFloatProp);
				}
			}

		}
	}
	IDetailCategoryBuilder& DetailCategoryBuilder = DetailLayout.EditCategory("Property Detail");
	FDetailWidgetRow& DetailRow = DetailCategoryBuilder.AddCustomRow(FString("Custom Row"));
	////now customize each property
	//FRuntimeFloatCurve* floatCurve;

	TSharedPtr<IPropertyHandle> hour = DetailLayout.GetProperty(TEXT("Hour"));
	DetailCategoryBuilder.AddProperty(hour);


	IDetailCategoryBuilder& SunCategoryBuilder = DetailLayout.EditCategory("Sun");
	IDetailCategoryBuilder& AFCategoryBuilder = DetailLayout.EditCategory("Atmospheric Fog");
	IDetailCategoryBuilder& HFCategoryBuilder = DetailLayout.EditCategory("Height Fog");
	IDetailCategoryBuilder& PPCategoryBuilder = DetailLayout.EditCategory("Post Process");
	IDetailCategoryBuilder& SkyLightCategoryBuilder = DetailLayout.EditCategory("SkyLight");
	IDetailCategoryBuilder& MoonCategoryBuilder = DetailLayout.EditCategory("Moon");
	for (TSharedPtr<FTODFloatCurveProperty> floatCurves : FloatCurves)
	{
		if (floatCurves->CategoryName == FString("Sun"))
			floatCurves->ConstructWidget(SunCategoryBuilder);

		if (floatCurves->CategoryName == FString("Atmospheric Fog"))
			floatCurves->ConstructWidget(AFCategoryBuilder);

		if (floatCurves->CategoryName == FString("Height Fog"))
			floatCurves->ConstructWidget(HFCategoryBuilder);

		if (floatCurves->CategoryName == FString("Post Process"))
			floatCurves->ConstructWidget(PPCategoryBuilder);

		if (floatCurves->CategoryName == FString("SkyLight"))
			floatCurves->ConstructWidget(SkyLightCategoryBuilder);

		if (floatCurves->CategoryName == FString("Moon"))
			floatCurves->ConstructWidget(MoonCategoryBuilder);
	}
}
Exemplo n.º 11
0
	virtual bool TestBasicStringExpression(const FTextFilterString& InValue, const ETextFilterTextComparisonMode InTextComparisonMode) const override
	{
		const TCHAR* Ptr = AssetFullPath.GetCharArray().GetData();
		if (Ptr)
		{
			// Test each piece of the path name, apart from the first
			bool bIsFirst = true;
			while (const TCHAR* Delimiter = FCString::Strchr(Ptr, '/'))
			{
				const int32 Length = Delimiter - Ptr;

				if (Length > 0)
				{
					if (bIsFirst)
					{
						bIsFirst = false;
					}
					else
					{
						if (TextFilterUtils::TestBasicStringExpression(FString(Length, Ptr), InValue, InTextComparisonMode))
						{
							return true;
						}
					}
				}

				Ptr += (Length + 1);
			}

			if (*Ptr != 0)
			{
				if (TextFilterUtils::TestBasicStringExpression(Ptr, InValue, InTextComparisonMode))
				{
					return true;
				}
			}
		}

		if (bIncludeClassName)
		{
			if (TextFilterUtils::TestBasicStringExpression(AssetPtr->AssetClass, InValue, InTextComparisonMode))
			{
				return true;
			}

			// Only test this if we're searching the class name too, as the exported text contains the type in the string
			if (TextFilterUtils::TestBasicStringExpression(AssetExportTextName, InValue, InTextComparisonMode))
			{
				return true;
			}
		}

		for (const FName& AssetCollectionName : AssetCollectionNames)
		{
			if (TextFilterUtils::TestBasicStringExpression(AssetCollectionName, InValue, InTextComparisonMode))
			{
				return true;
			}
		}

		return false;
	}
Exemplo n.º 12
0
//Rama's String From Binary Array
//This function requires #include <string>
FString CloudyWebAPIImpl::StringFromBinaryArray(const TArray<uint8>& BinaryArray)
{
    //Create a string from a byte array!
    std::string cstr(reinterpret_cast<const char*>(BinaryArray.GetData()), BinaryArray.Num());
    return FString(cstr.c_str());
}
void FDirectoryWatchRequestWindows::ProcessChange(uint32 Error, uint32 NumBytes)
{
	if (Error == ERROR_OPERATION_ABORTED || NumBytes == 0 ) 
	{
		// The operation was aborted, likely due to EndWatchRequest canceling it.
		// Mark the request for delete so it can be cleaned up next tick.
		bPendingDelete = true; 
		return; 
	}

	bool bValidNotification = (Error != ERROR_OPERATION_ABORTED && Error != ERROR_IO_INCOMPLETE && NumBytes > 0 );

	// Copy the change to the backbuffer so we can start a new read as soon as possible
	if ( bValidNotification )
	{		
		check(BackBuffer);
		FMemory::Memcpy(BackBuffer, Buffer, NumBytes);
	}

	// Start up another read
	const bool bSuccess = !!::ReadDirectoryChangesW(
		DirectoryHandle,
		Buffer,
		BufferLength,
		bWatchSubtree,
		NotifyFilter,
		NULL,
		&Overlapped,
		&FDirectoryWatchRequestWindows::ChangeNotification);

	if ( !bValidNotification )
	{
		UE_LOG(LogDirectoryWatcher, Warning, TEXT("A directory notification failed for '%s' because it was aborted or there was a buffer overflow."), *Directory);
		return;
	}

	// No need to process the change if we can not execute any delegates
	if ( !HasDelegates() )
	{
		return;
	}

	// Process the change
	uint8* InfoBase = BackBuffer;
	do
	{
		FILE_NOTIFY_INFORMATION* NotifyInfo = (FILE_NOTIFY_INFORMATION*)InfoBase;

		// Copy the WCHAR out of the NotifyInfo so we can put a NULL terminator on it and convert it to a FString
		const int32 Len = NotifyInfo->FileNameLength / sizeof(WCHAR);
		WCHAR* RawFilename = new WCHAR[Len + 1];
		FMemory::Memcpy(RawFilename, NotifyInfo->FileName, NotifyInfo->FileNameLength);
		RawFilename[Len] = 0;

		FFileChangeData::EFileChangeAction Action;
		switch(NotifyInfo->Action)
		{
			case FILE_ACTION_ADDED:
			case FILE_ACTION_RENAMED_NEW_NAME:
				Action = FFileChangeData::FCA_Added;
				break;

			case FILE_ACTION_REMOVED:
			case FILE_ACTION_RENAMED_OLD_NAME:
				Action = FFileChangeData::FCA_Removed;
				break;

			case FILE_ACTION_MODIFIED:
				Action = FFileChangeData::FCA_Modified;
				break;

			default:
				Action = FFileChangeData::FCA_Unknown;
				break;
		}

		// WCHAR to TCHAR conversion. In windows this is probably okay.
		const FString Filename = Directory / FString(RawFilename);
		new (FileChanges) FFileChangeData(Filename, Action);

		// Delete the scratch WCHAR*
		delete[] RawFilename;

		// If there is not another entry, break the loop
		if ( NotifyInfo->NextEntryOffset == 0 )
		{
			break;
		}

		// Adjust the offset and update the NotifyInfo pointer
		InfoBase += NotifyInfo->NextEntryOffset;
	}
	while(true);
}
Exemplo n.º 14
0
FString UKismetStringLibrary::Conv_ObjectToString(class UObject* InObj)
{
	return (InObj != NULL) ? InObj->GetName() : FString(TEXT("None"));
}
Exemplo n.º 15
0
int CSVParser::ReadPropertyDataCSV(const char* FileName, Utils::FHashMap<SongDetails>& OutputMap, bool FirstRowDiscarded, char elem_delim, char row_delim)
{
	int lineNumber = 0;
	std::string line, linetoken;
	std::ifstream ifile(FileName);
	if (!ifile) {	//file can't be opened
		return -1;
	}
	/* before going on I want to point out one thing:
	* I HATE std::getline
	* and obviously std::getline hates me.
	* It is important you remember that
	* if you touch std::getline code
	* std::getline will take its revenge on you. */
	if (FirstRowDiscarded)
	{
		if (!std::getline(ifile, line, row_delim))
			return 0;
	}
	while (std::getline(ifile, line, row_delim))
	{
#ifdef DEBUG_CSV_CONTENT
		UE_LOG(LogTemp, Log, TEXT("new line: \n%s\ntokenized as"), *FString(line.c_str()));
		//DEBUG(line.c_str())
#endif
		std::istringstream str_parser;
		bool found = false;
		str_parser.str(line);
		TArray<FString> SeparatedLine = TArray<FString>();
		FString ElementID;		//first column is Element ID.
		FString DimensionID = "";	//second column is Dimension ID
		std::getline(str_parser, linetoken, elem_delim);
		ElementID = Utils::CustomUnquote(FString(linetoken.c_str()));
		try {
			OutputMap.at(ElementID);
			found = true;
		}
		catch (std::out_of_range e) {
			found = false;
		}
		if (found) {	//if failed to load line, jump to next line
			FSongProperty property;
			std::getline(str_parser, linetoken, elem_delim);
			DimensionID = Utils::CustomUnquote(FString(linetoken.c_str()));

			while (std::getline(str_parser, linetoken, elem_delim)) {	//from third element to end of line
				SeparatedLine.Add(Utils::CustomUnquote(FString(linetoken.c_str())));	//append
#ifdef DEBUG_CSV_CONTENT
				UE_LOG(LogTemp, Log, TEXT("%s"), *Utils::CustomUnquote(FString(linetoken.c_str())));
				//DEBUG(linetoken.c_str())
#endif
			}
			property << SeparatedLine;
			if (DimensionID.Len() > 0)
			{
				OutputMap[ElementID].Properties[DimensionID] = property;
			}
			lineNumber++;
		}
#ifdef DEBUG_CSV_CONTENT
		UE_LOG(LogTemp, Log, TEXT(" . . . . . . ."));
#endif
	}
	ifile.close();
	return lineNumber;
}
Exemplo n.º 16
0
/** Create a tokenized message record from a message containing @@ indicating where each UObject* in the ArgPtr list goes and place it in the MessageLog. */
void FCompilerResultsLog::InternalLogMessage(const EMessageSeverity::Type& Severity, const TCHAR* Message, va_list ArgPtr)
{
	UEdGraphNode* OwnerNode = nullptr;

	// Create the tokenized message
	TSharedRef<FTokenizedMessage> Line = FTokenizedMessage::Create( Severity );
	Messages.Add(Line);

	const TCHAR* DelimiterStr = TEXT("@@");
	int32 DelimLength = FCString::Strlen(DelimiterStr);

	const TCHAR* Start = Message;
	if (Start && DelimLength)
	{
		while (const TCHAR* At = FCString::Strstr(Start, DelimiterStr))
		{
			// Found a delimiter, create a token from the preceding text
			Line->AddToken( FTextToken::Create( FText::FromString( FString(At - Start, Start) ) ) );
			Start += DelimLength + (At - Start);

			// And read the object and add another token for the object
			UObject* ObjectArgument = va_arg(ArgPtr, UObject*);

			FText ObjText;
			if (ObjectArgument)
			{
				// Remap object references to the source nodes
				ObjectArgument = FindSourceObject(ObjectArgument);

				if (ObjectArgument)
				{
					UEdGraphNode* Node = Cast<UEdGraphNode>(ObjectArgument);
					const UEdGraphPin* Pin = (Node? nullptr : Cast<UEdGraphPin>(ObjectArgument));

					//Get owner node reference, consider the first 
					if (OwnerNode == nullptr)
					{
						OwnerNode = (Pin ? Pin->GetOwningNodeUnchecked() : Node);
					}

					if (ObjectArgument->GetOutermost() == GetTransientPackage())
					{
						ObjText = LOCTEXT("Transient", "(transient)");					
					}
					else if (Node != NULL)
					{
						ObjText = Node->GetNodeTitle(ENodeTitleType::ListView);
					}
					else if (Pin != NULL)
					{
						ObjText = Pin->GetDisplayName();
					}
					else
					{
						ObjText = FText::FromString( ObjectArgument->GetName() );
					}
				}
				else
				{
					ObjText = LOCTEXT("None", "(none)");
				}

			}
			else
			{
				ObjText = LOCTEXT("None", "(none)");
			}
			
			Line->AddToken( FUObjectToken::Create( ObjectArgument, ObjText ) );
		}
		Line->AddToken( FTextToken::Create( FText::FromString( Start ) ) );
	}

	va_end(ArgPtr);

	// Register node error/warning.
	AnnotateNode(OwnerNode, Line);

	if( !bSilentMode && (!bLogInfoOnly || (Severity == EMessageSeverity::Info)) )
	{
		if(Severity == EMessageSeverity::CriticalError || Severity == EMessageSeverity::Error)
		{
			UE_LOG(LogBlueprint, Error, TEXT("[compiler] %s"), *Line->ToText().ToString());
		}
		else if(Severity == EMessageSeverity::Warning || Severity == EMessageSeverity::PerformanceWarning)
		{
			UE_LOG(LogBlueprint, Warning, TEXT("[compiler] %s"), *Line->ToText().ToString());
		}
		else
		{
			UE_LOG(LogBlueprint, Log, TEXT("[compiler] %s"), *Line->ToText().ToString());
		}
	}
}
Exemplo n.º 17
0
    /** Called in the idle loop, checks for conditions under which the helper should exit */
    void CheckExitConditions()
    {
        if (!InputFilename.Contains(TEXT("Only")))
        {
            UE_LOG(LogShaders, Log, TEXT("InputFilename did not contain 'Only', exiting after one job."));
            FPlatformMisc::RequestExit(false);
        }

#if PLATFORM_MAC || PLATFORM_LINUX
        if (!FPlatformMisc::IsDebuggerPresent() && ParentProcessId > 0)
        {
            // If the parent process is no longer running, exit
            if (!FPlatformProcess::IsApplicationRunning(ParentProcessId))
            {
                FString FilePath = FString(WorkingDirectory) + InputFilename;
                checkf(IFileManager::Get().FileSize(*FilePath) == INDEX_NONE, TEXT("Exiting due to the parent process no longer running and the input file is present!"));
                UE_LOG(LogShaders, Log, TEXT("Parent process no longer running, exiting"));
                FPlatformMisc::RequestExit(false);
            }
        }

        const double CurrentTime = FPlatformTime::Seconds();
        // If we have been idle for 20 seconds then exit
        if (CurrentTime - LastCompileTime > 20.0)
        {
            UE_LOG(LogShaders, Log, TEXT("No jobs found for 20 seconds, exiting"));
            FPlatformMisc::RequestExit(false);
        }
#else
        // Don't do these if the debugger is present
        //@todo - don't do these if Unreal is being debugged either
        if (!IsDebuggerPresent())
        {
            if (ParentProcessId > 0)
            {
                FString FilePath = FString(WorkingDirectory) + InputFilename;

                bool bParentStillRunning = true;
                HANDLE ParentProcessHandle = OpenProcess(SYNCHRONIZE, false, ParentProcessId);
                // If we couldn't open the process then it is no longer running, exit
                if (ParentProcessHandle == nullptr)
                {
                    checkf(IFileManager::Get().FileSize(*FilePath) == INDEX_NONE, TEXT("Exiting due to OpenProcess(ParentProcessId) failing and the input file is present!"));
                    UE_LOG(LogShaders, Log, TEXT("Couldn't OpenProcess, Parent process no longer running, exiting"));
                    FPlatformMisc::RequestExit(false);
                }
                else
                {
                    // If we did open the process, that doesn't mean it is still running
                    // The process object stays alive as long as there are handles to it
                    // We need to check if the process has signaled, which indicates that it has exited
                    uint32 WaitResult = WaitForSingleObject(ParentProcessHandle, 0);
                    if (WaitResult != WAIT_TIMEOUT)
                    {
                        checkf(IFileManager::Get().FileSize(*FilePath) == INDEX_NONE, TEXT("Exiting due to WaitForSingleObject(ParentProcessHandle) signaling and the input file is present!"));
                        UE_LOG(LogShaders, Log, TEXT("WaitForSingleObject signaled, Parent process no longer running, exiting"));
                        FPlatformMisc::RequestExit(false);
                    }
                    CloseHandle(ParentProcessHandle);
                }
            }

            const double CurrentTime = FPlatformTime::Seconds();
            // If we have been idle for 20 seconds then exit
            if (CurrentTime - LastCompileTime > 20.0)
            {
                UE_LOG(LogShaders, Log, TEXT("No jobs found for 20 seconds, exiting"));
                FPlatformMisc::RequestExit(false);
            }
        }
#endif
    }
Exemplo n.º 18
0
void AKUIInterface::Render( UCanvas* oCanvas )
{
	if ( !bShowHUD )
		return;

	if ( GEngine != NULL && GEngine->GameViewport != NULL )
	{	
		// Update the screen res.
		FVector2D v2ScreenResolution = FVector2D::ZeroVector;
		GEngine->GameViewport->GetViewportSize( v2ScreenResolution );

		if ( !this->v2ScreenResolution.Equals( v2ScreenResolution, 0.5f ) )
			OnScreenResolutionChange( this->v2ScreenResolution, v2ScreenResolution );

		this->v2ScreenResolution = v2ScreenResolution;

		if ( this->v2CursorLocation.X == KUI_INTERFACE_FIRST_CURSOR_UPDATE )
			this->v2CursorLocation = FVector2D( floor( this->v2ScreenResolution.X / 2.f ), floor( this->v2ScreenResolution.Y / 2.f ) );
	}
	
	if ( !IsTemplate() )
		OnRenderBP( Canvas );

#if KUI_INTERFACE_MOUSEOVER_DEBUG
	cmDebugMouseOver = NULL;
	v2DebugMouseOverLocation = FVector2D::ZeroVector;
	v2DebugMouseOverSize = FVector2D::ZeroVector;
#endif // KUI_INTERFACE_MOUSEOVER_DEBUG

	if ( IsVisible() )
	{
		for ( int32 i = 0; i < ctRootContainers.Num(); ++i )
		{
			if ( ctRootContainers[ i ] == NULL )
				continue;

			if ( i == EKUIInterfaceRoot::R_Cursor )
				continue;

#if KUI_INTERFACE_MOUSEOVER_DEBUG
			bDebugMouseOver = arDebugMouseOver[ i ];
#endif // KUI_INTERFACE_MOUSEOVER_DEBUG
			ctRootContainers[ i ]->Render( this, oCanvas, FVector2D::ZeroVector );
		}
	}

	if ( IsCursorVisible() )
	{
#if KUI_INTERFACE_MOUSEOVER_DEBUG
		bDebugMouseOver = arDebugMouseOver[ EKUIInterfaceRoot::R_Cursor ];
#endif // KUI_INTERFACE_MOUSEOVER_DEBUG
		ctRootContainers[ EKUIInterfaceRoot::R_Cursor ]->Render( this, oCanvas, v2CursorLocation );
	}

#if KUI_INTERFACE_MOUSEOVER_DEBUG
	bDebugMouseOver = false;

	if ( cmDebugMouseOver.IsValid() )
	{
		cmDebugMouseOverTestBox->SetLocationStruct( v2DebugMouseOverLocation + FVector2D( 1.f, 1.f ) );
		cmDebugMouseOverTestBox->SetSizeStruct( v2DebugMouseOverSize - FVector2D( 1.f, 1.f ) );
		cmDebugMouseOverTestBox->Render( this, oCanvas, FVector2D::ZeroVector, NULL );
	}

	if ( cmDebugMouseOver.Get() != cmDebugMouseOverLastTick.Get() )
	{
		KUILogUO( 
			"UI Mouse Over: %s: %s -> %s: %s (%f,%f) -> (%f,%f)", 
			*( cmDebugMouseOverLastTick.Get() ? ( cmDebugMouseOverLastTick.Get()->GetOuter() ? cmDebugMouseOverLastTick.Get()->GetOuter()->GetName() : "NULL" ) : "NULL" ),
			*( cmDebugMouseOverLastTick.Get() ? cmDebugMouseOverLastTick->GetName() : FString( "NULL" ) ), 
			*( cmDebugMouseOver.Get() ? ( cmDebugMouseOver.Get()->GetOuter() ? cmDebugMouseOver.Get()->GetOuter()->GetName() : "NULL" ) : "NULL" ),
			*( cmDebugMouseOver.Get() ? cmDebugMouseOver->GetName() : FString( "NULL" ) ), 
			ExpandV2( v2DebugMouseOverLocation ),
			ExpandV2( v2DebugMouseOverSize )
		);
	}

	cmDebugMouseOverLastTick = cmDebugMouseOver.Get();
#endif // KUI_INTERFACE_MOUSEOVER_DEBUG
}
void SCreateBlueprintFromActorDialog::Construct( const FArguments& InArgs, TSharedPtr< SWindow > InParentWindow, bool bInHarvest )
{
	USelection::SelectionChangedEvent.AddRaw(this, &SCreateBlueprintFromActorDialog::OnLevelSelectionChanged);

	bIsReportingError = false;
	PathForActorBlueprint = FString("/Game");
	FPathPickerConfig PathPickerConfig;
	PathPickerConfig.DefaultPath = PathForActorBlueprint;
	PathPickerConfig.OnPathSelected = FOnPathSelected::CreateRaw(this, &SCreateBlueprintFromActorDialog::OnSelectBlueprintPath);

	// Set up PathPickerConfig.
	FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked<FContentBrowserModule>("ContentBrowser");

	ParentWindow = InParentWindow;

	FString PackageName;
	ActorInstanceLabel.Empty();

	USelection* SelectedActors = GEditor->GetSelectedActors();
	for(FSelectionIterator Iter(*SelectedActors); Iter; ++Iter)
	{
		AActor* Actor = Cast<AActor>(*Iter);
		if(Actor)
		{
			ActorInstanceLabel += Actor->GetActorLabel();
			ActorInstanceLabel += TEXT( "_" );
		}
	}
	if( ActorInstanceLabel.IsEmpty() )
	{
		ActorInstanceLabel = LOCTEXT("BlueprintName_Default", "NewBlueprint").ToString();
	}
	else
	{
		ActorInstanceLabel += LOCTEXT("BlueprintName_Suffix", "Blueprint").ToString();
	}

	ActorInstanceLabel = PackageTools::SanitizePackageName(ActorInstanceLabel);

	FString AssetName = ActorInstanceLabel;
	FString BasePath = PathForActorBlueprint + TEXT("/") + AssetName;
	FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
	AssetToolsModule.Get().CreateUniqueAssetName(BasePath, TEXT(""), PackageName, AssetName);

	ChildSlot
		[
			SNew( SVerticalBox )
			+SVerticalBox::Slot()
			.FillHeight(1.0f)
			[
				ContentBrowserModule.Get().CreatePathPicker(PathPickerConfig)
			]
			+SVerticalBox::Slot()
			.AutoHeight()
			[
				SNew( SHorizontalBox )
				+SHorizontalBox::Slot()
				.Padding(0.0f, 0.0f, 4.0f, 0.0f)
				.AutoWidth()
				[
					SNew(STextBlock)
						.Text(LOCTEXT("BlueprintNameLabel", "Blueprint Name:"))
				]
				+SHorizontalBox::Slot()
				.FillWidth(1.0f)
				[
					SAssignNew(FileNameWidget, SEditableTextBox)
						.Text(FText::FromString(AssetName))
						.OnTextChanged(this, &SCreateBlueprintFromActorDialog::OnFilenameChanged)
				]
			]
			+SVerticalBox::Slot()
			.HAlign(HAlign_Right)
			.AutoHeight()
			[
				SNew( SHorizontalBox )
				+SHorizontalBox::Slot()
				.Padding( 0, 2, 6, 0 )
				.AutoWidth()
				[
					SNew(SButton)
					.VAlign( VAlign_Center )
					.HAlign( HAlign_Center )
					.OnClicked( this, &SCreateBlueprintFromActorDialog::OnCreateBlueprintFromActorClicked, bInHarvest)
					.IsEnabled( this, &SCreateBlueprintFromActorDialog::IsCreateBlueprintEnabled )
					[
						SNew( STextBlock )
							.Text( LOCTEXT("CreateBlueprintFromActorButton", "Create Blueprint") )
					]
				]
				+SHorizontalBox::Slot()
				.Padding( 0, 2, 0, 0 )
				.AutoWidth()
				[
					SNew(SButton)
					.VAlign( VAlign_Center )
					.HAlign( HAlign_Center )
					.ContentPadding( FMargin( 8, 2, 8, 2 ) )
					.OnClicked( this, &SCreateBlueprintFromActorDialog::OnCancelCreateBlueprintFromActor)
					[
						SNew( STextBlock )
							.Text( LOCTEXT("CancelBlueprintFromActorButton", "Cancel") )
					]
				]
			]
		];
}
void FEditorStyleSettingsDetails::RefreshAvailableCultures()
{
	AvailableCultures.Empty();

	IPlatformFile& PlatformFile = IPlatformFile::GetPlatformPhysical();
	TArray<FString> AllCultureNames;
	FInternationalization::GetCultureNames(AllCultureNames);
	const TArray<FString> LocalizationPaths = FPaths::GetEditorLocalizationPaths();
	for(const auto& LocalizationPath : LocalizationPaths)
	{
		/* Visitor class used to enumerate directories of culture */
		class FCultureEnumeratorVistor : public IPlatformFile::FDirectoryVisitor
		{
		public:
			FCultureEnumeratorVistor( const TArray<FString>& InAllCultureNames, TArray< TSharedPtr<FCulture> >& InAvailableCultures )
				: AllCultureNames(InAllCultureNames)
				, AvailableCultures(InAvailableCultures)
			{
			}

			virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory) OVERRIDE
			{
				if(bIsDirectory)
				{
					for( const auto& CultureName : AllCultureNames )
					{
						TSharedPtr<FCulture> Culture = FInternationalization::GetCulture(CultureName);
						if(Culture.IsValid() && !AvailableCultures.Contains(Culture))
						{
							// UE localization resource folders use "en-US" style while ICU uses "en_US" style so we replace underscores with dashes here.
							const FString UnrealCultureName = FString(TEXT("/")) + CultureName.Replace(TEXT("_"), TEXT("-"));
							if(FString(FilenameOrDirectory).EndsWith(UnrealCultureName))
							{
								AvailableCultures.Add(Culture);
							}
							else
							{
								// If the full name doesn't match, see if the base language is present
								const FString CultureLanguageName = FString(TEXT("/")) + Culture->GetTwoLetterISOLanguageName();
								if(FString(FilenameOrDirectory).EndsWith(CultureLanguageName))
								{
									AvailableCultures.Add(Culture);
								}
							}
						}
					}
				}

				return true;
			}

			/** Array of all culture names we can use */
			const TArray<FString>& AllCultureNames;

			/** Array of cultures that are available */
			TArray< TSharedPtr<FCulture> >& AvailableCultures;
		};

		FCultureEnumeratorVistor CultureEnumeratorVistor(AllCultureNames, AvailableCultures);
		PlatformFile.IterateDirectory(*LocalizationPath, CultureEnumeratorVistor);	
	}
FString UBlackboardKeyType_NativeEnum::DescribeArithmeticParam(int32 IntValue, float FloatValue) const
{
	return EnumType ? EnumType->GetEnumName(IntValue) : FString("UNKNOWN!");
}
Exemplo n.º 22
0
void FBehaviorTreeDebugger::SetNodeRuntimeDescription(const TArray<FString>& RuntimeDescriptions, class UBehaviorTreeGraphNode* Node, class UBTNode* NodeInstance)
{
	Node->DebuggerRuntimeDescription = RuntimeDescriptions.IsValidIndex(NodeInstance->GetExecutionIndex()) ?
		RuntimeDescriptions[NodeInstance->GetExecutionIndex()] : FString();
}
Exemplo n.º 23
0
TArray<FString> UCurveTable::CreateTableFromCSVString(const FString& InString, ERichCurveInterpMode InterpMode)
{
	// Array used to store problems about table creation
	TArray<FString> OutProblems;

	const FCsvParser Parser(InString);
	const FCsvParser::FRows& Rows = Parser.GetRows();

	// Must have at least 2 rows (x values + y values for at least one row)
	if(Rows.Num() <= 1)
	{
		OutProblems.Add(FString(TEXT("Too few rows.")));
		return OutProblems;
	}

	// Empty existing data
	EmptyTable();

	TArray<float> XValues;
	GetCurveValues(Rows[0], &XValues);

	// Iterate over rows
	for(int32 RowIdx = 1; RowIdx < Rows.Num(); RowIdx++)
	{
		const TArray<const TCHAR*>& Row = Rows[RowIdx];

		// Need at least 1 cells (row name)
		if(Row.Num() < 1)
		{
			OutProblems.Add(FString::Printf(TEXT("Row '%d' has too few cells."), RowIdx));
			continue;
		}

		// Get row name
		FName RowName = MakeValidName(Row[0]);

		// Check its not 'none'
		if(RowName == NAME_None)
		{
			OutProblems.Add(FString::Printf(TEXT("Row '%d' missing a name."), RowIdx));
			continue;
		}

		// Check its not a duplicate
		if(RowMap.Find(RowName) != NULL)
		{
			OutProblems.Add(FString::Printf(TEXT("Duplicate row name '%s'."), *RowName.ToString()));
			continue;
		}

		TArray<float> YValues;
		GetCurveValues(Row, &YValues);

		if(XValues.Num() != YValues.Num())
		{
			OutProblems.Add(FString::Printf(TEXT("Row '%s' does not have the right number of columns."), *RowName.ToString()));
			continue;
		}

		FRichCurve* NewCurve = new FRichCurve();
		// Now iterate over cells (skipping first cell, that was row name)
		for(int32 ColumnIdx = 0; ColumnIdx < XValues.Num(); ColumnIdx++)
		{
			FKeyHandle KeyHandle = NewCurve->AddKey(XValues[ColumnIdx], YValues[ColumnIdx]);
			NewCurve->SetKeyInterpMode(KeyHandle, InterpMode);
		}

		RowMap.Add(RowName, NewCurve);
	}

	Modify(true);
	return OutProblems;
}
const FString UInterpTrackAkAudioEvent::GetSlateHelperClassName() const
{
	return FString( TEXT("AudiokineticTools.InterpTrackAkAudioEventHelper") );
}
Exemplo n.º 25
0
FString UDemoNetDriver::LowLevelGetNetworkNumber()
{
	return FString( TEXT( "" ) );
}
int32 UInternationalizationExportCommandlet::Main( const FString& Params )
{
	TArray<FString> Tokens;
	TArray<FString> Switches;
	TMap<FString, FString> ParamVals;


	UCommandlet::ParseCommandLine(*Params, Tokens, Switches, ParamVals);
	
	const FString* ParamVal = ParamVals.Find(FString(TEXT("Config")));

	if ( ParamVal )
	{
		ConfigPath = *ParamVal;
	}
	else
	{
		UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("No config specified."));
		return -1;
	}

	//Set config section
	ParamVal = ParamVals.Find(FString(TEXT("Section")));
	

	if ( ParamVal )
	{
		SectionName = *ParamVal;
	}
	else
	{
		UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("No config section specified."));
		return -1;
	}


	FString SourcePath; // Source path to the root folder that manifest/archive files live in.
	if( !GetPathFromConfig( *SectionName, TEXT("SourcePath"), SourcePath, ConfigPath ) )
	{
		UE_LOG( LogInternationalizationExportCommandlet, Error, TEXT("No source path specified.") );
		return -1;
	}

	FString DestinationPath; // Destination path that we will write files to.
	if( !GetPathFromConfig( *SectionName, TEXT("DestinationPath"), DestinationPath, ConfigPath ) )
	{
		UE_LOG( LogInternationalizationExportCommandlet, Error, TEXT("No destination path specified.") );
		return -1;
	}

	FString Filename; // Name of the file to read or write from
	if (!GetStringFromConfig(*SectionName, TEXT("PortableObjectName"), Filename, ConfigPath))
	{
		UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("No portable object name specified."));
		return -1;
	}

	// Get cultures to generate.
	if( GetStringArrayFromConfig(*SectionName, TEXT("CulturesToGenerate"), CulturesToGenerate, ConfigPath) == 0 )
	{
		UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("No cultures specified for generation."));
		return -1;
	}


	bool bDoExport = false;
	bool bDoImport = false;

	GetBoolFromConfig( *SectionName, TEXT("bImportLoc"), bDoImport, ConfigPath );
	GetBoolFromConfig( *SectionName, TEXT("bExportLoc"), bDoExport, ConfigPath );
	
	if( !bDoImport && !bDoExport )
	{
		UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("Import/Export operation not detected.  Use bExportLoc or bImportLoc in config section."));
		return -1;
	}

	if( bDoImport )
	{
		if (!DoImport(SourcePath, DestinationPath, Filename))
		{
			UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("Failed to import localization files."));
			return -1;
		}
	}

	if( bDoExport )
	{
		if (!DoExport(SourcePath, DestinationPath, Filename))
		{
			UE_LOG(LogInternationalizationExportCommandlet, Error, TEXT("Failed to export localization files."));
			return -1;
		}
	}

	return 0;
}
FString URealSenseBlueprintLibrary::EDepthResolutionToString(EDepthResolution value) 
{
	switch (value) {
	case EDepthResolution::RES1:
		return FString("640 x 480 x 60 (F200)");
	case EDepthResolution::RES2:
		return FString("640 x 480 x 30 (F200)");
	case EDepthResolution::RES3:
		return FString("628 x 468 x 90 (R200)");
	case EDepthResolution::RES4:
		return FString("628 x 468 x 60 (R200)");
	case EDepthResolution::RES5:
		return FString("628 x 468 x 30 (R200)");
	case EDepthResolution::RES6:
		return FString("480 x 360 x 90 (R200)");
	case EDepthResolution::RES7:
		return FString("480 x 360 x 60 (R200)");
	case EDepthResolution::RES8:
		return FString("480 x 360 x 30 (R200)");
	case EDepthResolution::RES9:
		return FString("320 x 240 x 90 (R200)");
	case EDepthResolution::RES10:
		return FString("320 x 240 x 60 (R200)");
	case EDepthResolution::RES11:
		return FString("320 x 240 x 30 (R200)");
	default:
		return FString(" ");
	}
}
Exemplo n.º 28
0
void FEpicSurvey::OnReadFileComplete( bool bSuccess, const FString& DLName )
{
	if ( bSuccess )
	{
		if ( DLName == SurveyIndexCloudFile.DLName )
		{
			LoadSurveyIndexFile();
		}
		else
		{
			int32 FileHeaderIndex = INDEX_NONE;
			TArray< FCloudFileHeader > FileHeaders;
			TitleCloud->GetFileList( FileHeaders );

			for (int Index = 0; Index < FileHeaders.Num(); Index++)
			{
				if ( FileHeaders[ Index ].DLName == DLName )
				{
					FileHeaderIndex = Index;
					break;
				}
			}

			if ( FileHeaderIndex > INDEX_NONE )
			{
				const FCloudFileHeader FileHeader = FileHeaders[ FileHeaderIndex ];
				const FString FileExtension = FPaths::GetExtension( FileHeader.FileName );
				
				if ( FileExtension == TEXT("json") )
				{
					TArray< uint8 > FileContents;
					TitleCloud->GetFileContents( DLName, FileContents );

					FString SurveyJson;
					FFileHelper::BufferToString( SurveyJson, FileContents.GetData(), FileContents.Num() );

					TSharedPtr< FJsonObject > SurveyObject = NULL;
					TSharedRef< TJsonReader<> > Reader = TJsonReaderFactory<TCHAR>::Create( SurveyJson );
					if ( FJsonSerializer::Deserialize( Reader, SurveyObject ) )
					{
						TSharedPtr< FSurvey > NewSurvey = FSurvey::Create( SharedThis( this ), SurveyObject.ToSharedRef() );
						if ( NewSurvey.IsValid() )
						{
							switch( NewSurvey->GetSurveyType() )
							{
							case ESurveyType::Normal:
								{
									Surveys.Add( NewSurvey.ToSharedRef() );
									const bool IsActiveSurveyInProgress = ActiveSurvey.IsValid() ? GEditor->AccessGameAgnosticSettings().InProgressSurveys.Contains( ActiveSurvey->GetIdentifier() ) : false;

									if ( !IsActiveSurveyInProgress )
									{
										const bool HasBeenCompleted = GEditor->AccessGameAgnosticSettings().CompletedSurveys.Contains( NewSurvey->GetIdentifier() );

										if ( !HasBeenCompleted )
										{
											const bool IsInProgress = GEditor->AccessGameAgnosticSettings().InProgressSurveys.Contains( NewSurvey->GetIdentifier() );

											if ( NewSurvey->CanAutoPrompt() )
											{
												SetActiveSurvey( NewSurvey );
											}
											else if ( IsInProgress )
											{
												SetActiveSurvey( NewSurvey );
											}
										}
									}
								}
								break;
							case ESurveyType::Branch:
								BranchSurveys.Add( FileHeader.FileName, NewSurvey );
								break;
							}
						}
					}
					else
					{
						UE_LOG(LogEpicSurvey, Verbose, TEXT("Parsing JSON survey failed. Filename: %s Message: %s"), *FileHeader.FileName, *Reader->GetErrorMessage());
					}
				}
				else if ( FileExtension == TEXT("png") )
				{
					TArray< FOnBrushLoaded > MapResults;
					FilenameToLoadCallbacks.MultiFind( FileHeaders[ FileHeaderIndex ].FileName, MapResults );

					if ( MapResults.Num() > 0 )
					{
						TArray< uint8 > FileContents;
						TitleCloud->GetFileContents( DLName, FileContents );

						for (int Index = 0; Index < MapResults.Num(); Index++)
						{
							MapResults[ Index ].Execute( LoadRawDataAsBrush( *(FString(TEXT("EpicSurvey.")) + FileHeaders[ FileHeaderIndex ].FileName), FileContents ) );
						}

						FilenameToLoadCallbacks.Remove( FileHeaders[ FileHeaderIndex ].FileName );
					}
				}
			}
		}
	}
	else
	{
		InitializationState = EContentInitializationState::Failure;
	}
}
Exemplo n.º 29
0
void UGameEngine::Tick( float DeltaSeconds, bool bIdleMode )
{
	SCOPE_CYCLE_COUNTER(STAT_GameEngineTick);
	NETWORK_PROFILER(GNetworkProfiler.TrackFrameBegin());

	int32 LocalTickCycles=0;
	CLOCK_CYCLES(LocalTickCycles);
	
	// -----------------------------------------------------
	// Non-World related stuff
	// -----------------------------------------------------

	if( DeltaSeconds < 0.0f )
	{
#if (UE_BUILD_SHIPPING && WITH_EDITOR)
		// End users don't have access to the secure parts of UDN.  Regardless, they won't
		// need the warning because the game ships with AMD drivers that address the issue.
		UE_LOG(LogEngine, Fatal,TEXT("Negative delta time!"));
#else
		// Send developers to the support list thread.
		UE_LOG(LogEngine, Fatal,TEXT("Negative delta time! Please see https://udn.epicgames.com/lists/showpost.php?list=ue3bugs&id=4364"));
#endif
	}

	// Tick the module manager
	IHotReloadInterface* HotReload = IHotReloadInterface::GetPtr();
	if(HotReload != nullptr)
	{
		HotReload->Tick();
	}

	if (!IsRunningDedicatedServer() && !IsRunningCommandlet())
	{
		// Clean up the game viewports that have been closed.
		CleanupGameViewport();
	}

	// If all viewports closed, time to exit.
	if(GIsClient && GameViewport == NULL )
	{
		UE_LOG(LogEngine, Log,  TEXT("All Windows Closed") );
		FPlatformMisc::RequestExit( 0 );
		return;
	}

	if ( GameViewport != NULL )
	{
		// Decide whether to drop high detail because of frame rate.
		QUICK_SCOPE_CYCLE_COUNTER(STAT_UGameEngine_Tick_SetDropDetail);
		GameViewport->SetDropDetail(DeltaSeconds);
	}

	// Update subsystems.
	{
		// This assumes that UObject::StaticTick only calls ProcessAsyncLoading.
		StaticTick(DeltaSeconds, bAsyncLoadingUseFullTimeLimit, AsyncLoadingTimeLimit / 1000.f);
	}

	// -----------------------------------------------------
	// Begin ticking worlds
	// -----------------------------------------------------

	FName OriginalGWorldContext = NAME_None;
	for (int32 i=0; i < WorldList.Num(); ++i)
	{
		if (WorldList[i].World() == GWorld)
		{
			OriginalGWorldContext = WorldList[i].ContextHandle;
			break;
		}
	}

	for (int32 WorldIdx = 0; WorldIdx < WorldList.Num(); ++WorldIdx)
	{
		FWorldContext &Context = WorldList[WorldIdx];
		if (Context.World() == NULL)
		{
			continue;
		}

		GWorld = Context.World();

		// Tick all travel and Pending NetGames (Seamless, server, client)
		{
			QUICK_SCOPE_CYCLE_COUNTER(STAT_UGameEngine_Tick_TickWorldTravel);
			TickWorldTravel(Context, DeltaSeconds);
		}

		if (!IsRunningDedicatedServer() && !IsRunningCommandlet())
		{
			QUICK_SCOPE_CYCLE_COUNTER(STAT_UGameEngine_Tick_CheckCaptures);
			// Only update reflection captures in game once all 'always loaded' levels have been loaded
			// This won't work with actual level streaming though
			if (Context.World()->AreAlwaysLoadedLevelsLoaded())
			{
				// Update sky light first because it's considered direct lighting, sky diffuse will be visible in reflection capture indirect specular
				USkyLightComponent::UpdateSkyCaptureContents(Context.World());
				UReflectionCaptureComponent::UpdateReflectionCaptureContents(Context.World());
			}
		}

		if (!bIdleMode)
		{
			// Tick the world.
			GameCycles=0;
			CLOCK_CYCLES(GameCycles);
			Context.World()->Tick( LEVELTICK_All, DeltaSeconds );
			UNCLOCK_CYCLES(GameCycles);
		}

		// Issue cause event after first tick to provide a chance for the game to spawn the player and such.
		if( Context.World()->bWorldWasLoadedThisTick )
		{
			Context.World()->bWorldWasLoadedThisTick = false;
			
			const TCHAR* InitialExec = Context.LastURL.GetOption(TEXT("causeevent="),NULL);
			ULocalPlayer* GamePlayer = Context.OwningGameInstance ? Context.OwningGameInstance->GetFirstGamePlayer() : NULL;
			if( InitialExec && GamePlayer )
			{
				UE_LOG(LogEngine, Log, TEXT("Issuing initial cause event passed from URL: %s"), InitialExec);
				GamePlayer->Exec( GamePlayer->GetWorld(), *(FString("CAUSEEVENT ") + InitialExec), *GLog );
			}

			Context.World()->bTriggerPostLoadMap = true;
		}

		// Tick the viewports.
		if ( GameViewport != NULL && !bIdleMode )
		{
			SCOPE_CYCLE_COUNTER(STAT_GameViewportTick);
			GameViewport->Tick(DeltaSeconds);
		}
	
		UpdateTransitionType(Context.World());
	
		// fixme: this will only happen once due to the static bool, but still need to figure out how to handle this for multiple worlds
		if (FPlatformProperties::SupportsWindowedMode())
		{
			// Hide the splashscreen and show the game window
			static bool bFirstTime = true;
			if ( bFirstTime )
			{
				bFirstTime = false;
				FPlatformSplash::Hide();
				if ( GameViewportWindow.IsValid() )
				{
					GameViewportWindow.Pin()->ShowWindow();
					FSlateApplication::Get().RegisterGameViewport( GameViewportWidget.ToSharedRef() );
				}
			}
		}

		if (!bIdleMode && !IsRunningDedicatedServer() && !IsRunningCommandlet())
		{
			// Render everything.
			RedrawViewports();
		}

		// Block on async loading if requested.
		if (Context.World()->bRequestedBlockOnAsyncLoading)
		{
			BlockTillLevelStreamingCompleted(Context.World());
			Context.World()->bRequestedBlockOnAsyncLoading = false;
		}

		// streamingServer
		if( GIsServer == true )
		{
			SCOPE_CYCLE_COUNTER(STAT_UpdateLevelStreaming);
			Context.World()->UpdateLevelStreaming();
		}

		// Update Audio. This needs to occur after rendering as the rendering code updates the listener position.
		if (FAudioDevice* AudioDevice = Context.World()->GetAudioDevice())
		{
			AudioDevice->Update(!Context.World()->IsPaused());
		}

		if( GIsClient )
		{
			// IStreamingManager is updated outside of a world context. For now, assuming it needs to tick here, before possibly calling PostLoadMap. 
			// Will need to take another look when trying to support multiple worlds.

			// Update resource streaming after viewports have had a chance to update view information. Normal update.
			{
				QUICK_SCOPE_CYCLE_COUNTER(STAT_UGameEngine_Tick_IStreamingManager);
				IStreamingManager::Get().Tick( DeltaSeconds );
			}

			if ( Context.World()->bTriggerPostLoadMap )
			{
				Context.World()->bTriggerPostLoadMap = false;

				// Turns off the loading movie (if it was turned on by LoadMap) and other post-load cleanup.
				QUICK_SCOPE_CYCLE_COUNTER(STAT_UGameEngine_Tick_IStreamingManager);
				PostLoadMap();
			}
		}

		UNCLOCK_CYCLES(LocalTickCycles);
		TickCycles=LocalTickCycles;

		// See whether any map changes are pending and we requested them to be committed.
		QUICK_SCOPE_CYCLE_COUNTER(STAT_UGameEngine_Tick_ConditionalCommitMapChange);
		ConditionalCommitMapChange(Context);
	}

	// ----------------------------
	//	End per-world ticking
	// ----------------------------

	// Restore original GWorld*. This will go away one day.
	if (OriginalGWorldContext != NAME_None)
	{
		QUICK_SCOPE_CYCLE_COUNTER(STAT_UGameEngine_Tick_GetWorldContextFromHandleChecked);
		GWorld = GetWorldContextFromHandleChecked(OriginalGWorldContext).World();
	}

	// rendering thread commands
	{
		ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER(
			TickRenderingTimer,
			bool, bPauseRenderingRealtimeClock, GPauseRenderingRealtimeClock,
			float, DeltaTime, DeltaSeconds,
		{
			if(!bPauseRenderingRealtimeClock)
			{
				// Tick the GRenderingRealtimeClock, unless it's paused
				GRenderingRealtimeClock.Tick(DeltaTime);
			}

			GetRendererModule().TickRenderTargetPool();
		});
	}
bool FChunkManifestGenerator::GenerateStreamingInstallManifest(const FString& Platform)
{
    FString GameNameLower = FString(FApp::GetGameName()).ToLower();

    // empty out the current paklist directory
    FString TmpPackagingDir = GetTempPackagingDirectoryForPlatform(Platform);
    if (!IFileManager::Get().MakeDirectory(*TmpPackagingDir, true))
    {
        UE_LOG(LogChunkManifestGenerator, Error, TEXT("Failed to create directory: %s"), *TmpPackagingDir);
        return false;
    }

    // open a file for writing the list of pak file lists that we've generated
    FString PakChunkListFilename = TmpPackagingDir / TEXT("pakchunklist.txt");
    TAutoPtr<FArchive> PakChunkListFile(IFileManager::Get().CreateFileWriter(*PakChunkListFilename));

    if (!PakChunkListFile.IsValid())
    {
        UE_LOG(LogChunkManifestGenerator, Error, TEXT("Failed to open output pakchunklist file %s"), *PakChunkListFilename);
        return false;
    }

    FString PakChunkLayerInfoFilename = FString::Printf(TEXT("%s/pakchunklayers.txt"), *TmpPackagingDir);
    TAutoPtr<FArchive> ChunkLayerFile(IFileManager::Get().CreateFileWriter(*PakChunkLayerInfoFilename));

    // generate per-chunk pak list files
    for (int32 Index = 0; Index < FinalChunkManifests.Num(); ++Index)
    {
        // Is this chunk empty?
        if (!FinalChunkManifests[Index] || FinalChunkManifests[Index]->Num() == 0)
        {
            continue;
        }
        FString PakListFilename = FString::Printf(TEXT("%s/pakchunk%d.txt"), *TmpPackagingDir, Index);
        TAutoPtr<FArchive> PakListFile(IFileManager::Get().CreateFileWriter(*PakListFilename));

        if (!PakListFile.IsValid())
        {
            UE_LOG(LogChunkManifestGenerator, Error, TEXT("Failed to open output paklist file %s"), *PakListFilename);
            return false;
        }

        for (auto& Filename : *FinalChunkManifests[Index])
        {
            FString PakListLine = FPaths::ConvertRelativePathToFull(Filename.Value.Replace(TEXT("[Platform]"), *Platform));
            PakListLine.ReplaceInline(TEXT("/"), TEXT("\\"));
            PakListLine += TEXT("\r\n");
            PakListFile->Serialize(TCHAR_TO_ANSI(*PakListLine), PakListLine.Len());
        }

        PakListFile->Close();

        // add this pakfilelist to our master list of pakfilelists
        FString PakChunkListLine = FString::Printf(TEXT("pakchunk%d.txt\r\n"), Index);
        PakChunkListFile->Serialize(TCHAR_TO_ANSI(*PakChunkListLine), PakChunkListLine.Len());

        int32 TargetLayer = 0;
        FGameDelegates::Get().GetAssignLayerChunkDelegate().ExecuteIfBound(FinalChunkManifests[Index], Platform, Index, TargetLayer);

        FString LayerString = FString::Printf(TEXT("%d\r\n"), TargetLayer);

        ChunkLayerFile->Serialize(TCHAR_TO_ANSI(*LayerString), LayerString.Len());
    }

    ChunkLayerFile->Close();
    PakChunkListFile->Close();

    return true;
}