void UJavascriptGraphTextPropertyEditableTextBox::HandleOnTextCommitted(const FText& InText)
{
	FName TableId = NAME_None;
	FString Key;
	FTextInspector::GetTableIdAndKey(InText, TableId, Key);
	MyTextProperty.TableId = TableId;
	MyTextProperty.Namespace = FTextInspector::GetNamespace(InText).Get(FString());
	MyTextProperty.Key = FTextInspector::GetKey(InText).Get(FString());
	MyTextProperty.Value = InText.ToString();

	OnTextCommitted.Broadcast(MyTextProperty);
}
void UMaterialExpressionSpriteTextureSampler::GetCaption(TArray<FString>& OutCaptions) const
{
    OutCaptions.Add(TEXT("Paper2D Sprite"));

    if (!SlotDisplayName.IsEmpty())
    {
        OutCaptions.Add(SlotDisplayName.ToString());
    }

    if (bSampleAdditionalTextures)
    {
        FNumberFormattingOptions NoCommas;
        NoCommas.UseGrouping = false;
        const FText SlotDesc = FText::Format(LOCTEXT("SpriteSamplerTitle_AdditionalSlot", "Additional Texture #{0}"), FText::AsNumber(AdditionalSlotIndex, &NoCommas));
        OutCaptions.Add(SlotDesc.ToString());
    }
    else
    {
        OutCaptions.Add(LOCTEXT("SpriteSamplerTitle_BasicSlot", "Source Texture").ToString());
    }
}
static void ProjectChanged(const FText& NewText, ETextCommit::Type CommitType, FGuid TargetGuid)
{
	FOneSkyLocalizationTargetSetting* Settings = FOneSkyLocalizationServiceModule::Get().AccessSettings().GetSettingsForTarget(TargetGuid, true);
	int32 NewProjectId = INDEX_NONE;	// Default to -1
	FString StringId = NewText.ToString();
	// Don't allow this to be set to a non-numeric value.
	if (StringId.IsNumeric())
	{
		NewProjectId = FCString::Atoi(*StringId);
	}
	FOneSkyLocalizationServiceModule::Get().AccessSettings().SetSettingsForTarget(TargetGuid, NewProjectId, Settings->OneSkyFileName);
}
void SSessionLauncherDeployRepositorySettings::OnTextCommitted( const FText& InText, ETextCommit::Type CommitInfo)
{
	if (CommitInfo == ETextCommit::OnEnter)
	{
		ILauncherProfilePtr SelectedProfile = Model->GetSelectedProfile();

		if(SelectedProfile.IsValid())
		{
			SelectedProfile->SetPackageDirectory(InText.ToString());
		}
	}
}
void FSpriteEditorViewportClient::DrawBoundsAsText(FViewport& InViewport, FSceneView& View, FCanvas& Canvas, int32& YPos)
{
	FNumberFormattingOptions NoDigitGroupingFormat;
	NoDigitGroupingFormat.UseGrouping = false;

	UPaperSprite* Sprite = GetSpriteBeingEdited();
	FBoxSphereBounds Bounds = Sprite->GetRenderBounds();

	const FText DisplaySizeText = FText::Format(LOCTEXT("BoundsSize", "Approx. Size: {0}x{1}x{2}"),
		FText::AsNumber((int32)(Bounds.BoxExtent.X * 2.0f), &NoDigitGroupingFormat),
		FText::AsNumber((int32)(Bounds.BoxExtent.Y * 2.0f), &NoDigitGroupingFormat),
		FText::AsNumber((int32)(Bounds.BoxExtent.Z * 2.0f), &NoDigitGroupingFormat));

	Canvas.DrawShadowedString(
		6,
		YPos,
		*DisplaySizeText.ToString(),
		GEngine->GetSmallFont(),
		FLinearColor::White);
	YPos += 18;
}
void FSlateDrawElement::MakeText( FSlateWindowElementList& ElementList, uint32 InLayer, const FPaintGeometry& PaintGeometry, const FText& InText, const FSlateFontInfo& InFontInfo, const FSlateRect& InClippingRect,ESlateDrawEffect::Type InDrawEffects, const FLinearColor& InTint )
{
	FSlateDrawElement& DrawElt = ElementList.AddUninitialized();
	DrawElt.ElementType = ET_Text;
	DrawElt.Position = PaintGeometry.DrawPosition;
	DrawElt.Size = PaintGeometry.DrawSize;
	DrawElt.ClippingRect = InClippingRect;
	DrawElt.DataPayload.SetTextPayloadProperties( InText.ToString(), InFontInfo, InTint );
	DrawElt.Layer = InLayer;
	DrawElt.DrawEffects = InDrawEffects;
	DrawElt.Scale = PaintGeometry.DrawScale;
}
Example #7
0
FText UEdGraphPin::GetDisplayName() const
{
	FText DisplayName = FText::GetEmpty();
	auto Schema = GetSchema();
	if (Schema)
	{
		DisplayName = Schema->GetPinDisplayName(this);
	}
	else
	{
		DisplayName = (!PinFriendlyName.IsEmpty()) ? PinFriendlyName : FText::FromString(PinName);

		bool bShowNodesAndPinsUnlocalized = false;
		GConfig->GetBool( TEXT("Internationalization"), TEXT("ShowNodesAndPinsUnlocalized"), bShowNodesAndPinsUnlocalized, GEditorSettingsIni );
		if (bShowNodesAndPinsUnlocalized)
		{
			return FText::FromString(DisplayName.BuildSourceString());
		}
	}
	return DisplayName;
}
bool FProjectManager::LoadProjectFile( const FString& InProjectFile )
{
	// Try to load the descriptor
	FText FailureReason;
	TSharedPtr<FProjectDescriptor> Descriptor = MakeShareable(new FProjectDescriptor());
	if(Descriptor->Load(InProjectFile, FailureReason))
	{
		// Create the project
		CurrentProject = Descriptor;
		return true;
	}
	
#if PLATFORM_IOS
    FString UpdatedMessage = FString::Printf(TEXT("%s\n%s"), *FailureReason.ToString(), TEXT("For troubleshooting, please go to https://docs.unrealengine.com/latest/INT/Platforms/iOS/GettingStarted/index.html"));
    FailureReason = FText::FromString(UpdatedMessage);
#endif
	UE_LOG(LogProjectManager, Error, TEXT("%s"), *FailureReason.ToString());
	FMessageDialog::Open(EAppMsgType::Ok, FailureReason);
    
	return false;
}
void UMovieSceneNameableTrack::SetDisplayName(const FText& NewDisplayName)
{
	if (NewDisplayName.EqualTo(DisplayName))
	{
		return;
	}

	SetFlags(RF_Transactional);
	Modify();

	DisplayName = NewDisplayName;
}
void FWebBrowserHandler::OnLoadError(CefRefPtr<CefBrowser> Browser,
	CefRefPtr<CefFrame> Frame,
	CefLoadHandler::ErrorCode InErrorCode,
	const CefString& ErrorText,
	const CefString& FailedUrl)
{
	// Don't display an error for downloaded files.
	if (InErrorCode == ERR_ABORTED)
		return;

	// Display a load error message.
	FFormatNamedArguments Args;
	Args.Add(TEXT("FailedUrl"), FText::FromString(FailedUrl.c_str()));
	Args.Add(TEXT("ErrorText"), FText::FromString(ErrorText.c_str()));
	Args.Add(TEXT("ErrorCode"), FText::AsNumber(InErrorCode));
	FText ErrorMsg = FText::Format(LOCTEXT("WebBrowserLoadError", "Failed to load URL {FailedUrl} with error {ErrorText} ({ErrorCode})."), Args);
	FString ErrorHTML = TEXT("<html><body bgcolor=\"white\"><h2>")
						+ ErrorMsg.ToString()
						+ TEXT("</h2></body></html>");
	Frame->LoadString(*ErrorHTML, FailedUrl);
}
Example #11
0
void UpdateSuggestionHelper(const FText & CategoryLabel, const TArray<FSearchEntry> & Elements, TArray<TSharedPtr< FSearchEntry > > & OutSuggestions)
{
	if (Elements.Num())
	{
		OutSuggestions.Add(MakeShareable(FSearchEntry::MakeCategoryEntry(CategoryLabel.ToString())));
	}

	for (uint32 i = 0; i < (uint32)Elements.Num(); ++i)
	{
		OutSuggestions.Add(MakeShareable(new FSearchEntry(Elements[i])));
	}
}
void FAssetTypeActions_CurveTable::ExecuteExportAsCSV(TArray< TWeakObjectPtr<UObject> > Objects)
{
	IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();

	void* ParentWindowWindowHandle = nullptr;

	IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame"));
	const TSharedPtr<SWindow>& MainFrameParentWindow = MainFrameModule.GetParentWindow();
	if ( MainFrameParentWindow.IsValid() && MainFrameParentWindow->GetNativeWindow().IsValid() )
	{
		ParentWindowWindowHandle = MainFrameParentWindow->GetNativeWindow()->GetOSWindowHandle();
	}

	for (auto ObjIt = Objects.CreateConstIterator(); ObjIt; ++ObjIt)
	{
		auto CurTable = Cast<UCurveTable>((*ObjIt).Get());
		if (CurTable)
		{
			const FText Title = FText::Format(LOCTEXT("CurveTable_ExportCSVDialogTitle", "Export '{0}' as CSV..."), FText::FromString(*CurTable->GetName()));
			const FString CurrentFilename = (CurTable->ImportPath.IsEmpty()) ? TEXT("") : FReimportManager::ResolveImportFilename(CurTable->ImportPath, CurTable);
			const FString FileTypes = TEXT("Curve Table CSV (*.csv)|*.csv");

			TArray<FString> OutFilenames;
			DesktopPlatform->SaveFileDialog(
				ParentWindowWindowHandle,
				Title.ToString(),
				(CurrentFilename.IsEmpty()) ? TEXT("") : FPaths::GetPath(CurrentFilename),
				(CurrentFilename.IsEmpty()) ? TEXT("") : FPaths::GetBaseFilename(CurrentFilename) + TEXT(".csv"),
				FileTypes,
				EFileDialogFlags::None,
				OutFilenames
				);

			if (OutFilenames.Num() > 0)
			{
				FFileHelper::SaveStringToFile(CurTable->GetTableAsCSV(), *OutFilenames[0]);
			}
		}
	}
}
bool UTextProperty::Identical_Implementation(const FText& ValueA, const FText& ValueB, uint32 PortFlags)
{
	if (ValueA.IsCultureInvariant() != ValueB.IsCultureInvariant() || ValueA.IsTransient() != ValueB.IsTransient())
	{
		//A culture variant text is never equal to a culture invariant text
		//A transient text is never equal to a non-transient text
		return false;
	}

	if (ValueA.IsCultureInvariant() == ValueB.IsCultureInvariant() || ValueA.IsTransient() == ValueB.IsTransient())
	{
		//Culture invariant text don't have a namespace/key so we compare the source string
		//Transient text don't have a namespace/key or source so we compare the display string
		return FTextInspector::GetDisplayString(ValueA) == FTextInspector::GetDisplayString(ValueB);
	}

	if (GIsEditor)
	{
		return FTextInspector::GetSourceString(ValueA)->Compare(*FTextInspector::GetSourceString(ValueB), ESearchCase::CaseSensitive) == 0;
	}
	else
	{
		return	FTextInspector::GetNamespace(ValueA) == FTextInspector::GetNamespace(ValueB) &&
			FTextInspector::GetKey(ValueA) == FTextInspector::GetKey(ValueB);
	}
}
Example #14
0
void UMaterialGraphSchema::GetCommentAction(FGraphActionMenuBuilder& ActionMenuBuilder, const UEdGraph* CurrentGraph) const
{
	if (!ActionMenuBuilder.FromPin)
	{
		const bool bIsManyNodesSelected = CurrentGraph ? (FMaterialEditorUtilities::GetNumberOfSelectedNodes(CurrentGraph) > 0) : false;
		const FText CommentDesc = LOCTEXT("CommentDesc", "New Comment");
		const FText MultiCommentDesc = LOCTEXT("MultiCommentDesc", "Create Comment from Selection");
		const FText CommentToolTip = LOCTEXT("CommentToolTip", "Creates a comment.");
		const FText MenuDescription = bIsManyNodesSelected ? MultiCommentDesc : CommentDesc;
		TSharedPtr<FMaterialGraphSchemaAction_NewComment> NewAction(new FMaterialGraphSchemaAction_NewComment(TEXT(""), MenuDescription, CommentToolTip.ToString(), 0));
		ActionMenuBuilder.AddAction( NewAction );
	}
}
void FAxisMappingsNodeBuilder::OnAxisMappingNameCommitted(const FText& InName, ETextCommit::Type CommitInfo, const FMappingSet MappingSet)
{
	const FScopedTransaction Transaction(LOCTEXT("RenameAxisMapping_Transaction", "Rename Axis Mapping"));

	FName NewName = FName(*InName.ToString());

	TSharedPtr<IPropertyHandleArray> AxisMappingsArrayHandle = AxisMappingsPropertyHandle->AsArray();

	for (int32 Index = 0; Index < MappingSet.Mappings.Num(); ++Index)
	{
		MappingSet.Mappings[Index]->GetChildHandle(GET_MEMBER_NAME_CHECKED(FInputAxisKeyMapping, AxisName))->SetValue(NewName);
	}
}
Example #16
0
FText UK2Node::GetToolTipHeading() const
{
	FText Heading = FText::GetEmpty();
	if (UBreakpoint* ExistingBreakpoint = FKismetDebugUtilities::FindBreakpointForNode(GetBlueprint(), this))
	{
		if (ExistingBreakpoint->IsEnabled())
		{
			Heading = LOCTEXT("EnabledBreakpoint", "Active Breakpoint");
			FText ActiveBreakpointToolTipText = GetActiveBreakpointToolTipText();
			if (!ActiveBreakpointToolTipText.IsEmpty())
			{
				Heading = FText::Format(FText::FromString("{0} - {1}"), Heading, ActiveBreakpointToolTipText);
			}
		}
		else 
		{
			Heading = LOCTEXT("DisabledBreakpoint", "Disabled Breakpoint");
		}
	}

	return Heading;
}
void FUICommandInfo::MakeCommandInfo( const TSharedRef<class FBindingContext>& InContext, TSharedPtr< FUICommandInfo >& OutCommand, const FName InCommandName, const FText& InCommandLabel, const FText& InCommandDesc, const FSlateIcon& InIcon, const EUserInterfaceActionType::Type InUserInterfaceType, const FInputChord& InDefaultChord )
{
	ensureMsgf( !InCommandLabel.IsEmpty(), TEXT("Command labels cannot be empty") );

	OutCommand = MakeShareable( new FUICommandInfo( InContext->GetContextName() ) );
	OutCommand->CommandName = InCommandName;
	OutCommand->Label = InCommandLabel;
	OutCommand->Description = InCommandDesc;
	OutCommand->Icon = InIcon;
	OutCommand->UserInterfaceType = InUserInterfaceType;
	OutCommand->DefaultChord = InDefaultChord;
	FInputBindingManager::Get().CreateInputCommand( InContext, OutCommand.ToSharedRef() );
}
void UK2Node_LiveEditObject::SetPinToolTip(UEdGraphPin& MutatablePin, const FText& PinDescription) const
{
	MutatablePin.PinToolTip = UEdGraphSchema_K2::TypeToText(MutatablePin.PinType).ToString();

	UEdGraphSchema_K2 const* const K2Schema = Cast<const UEdGraphSchema_K2>(GetSchema());
	if (K2Schema != nullptr)
	{
		MutatablePin.PinToolTip += TEXT(" ");
		MutatablePin.PinToolTip += K2Schema->GetPinDisplayName(&MutatablePin).ToString();
	}

	MutatablePin.PinToolTip += FString(TEXT("\n")) + PinDescription.ToString();
}
FText FWidgetTemplateBlueprintClass::GetCategory() const
{
	if ( WidgetClass.Get() )
	{
		UUserWidget* DefaultUserWidget = WidgetClass->GetDefaultObject<UUserWidget>();
		return DefaultUserWidget->GetPaletteCategory();
	}
	else
	{
		//If the blueprint is unloaded we need to extract it from the asset metadata.
		FText FoundPaletteCategoryText = WidgetAssetData.GetTagValueRef<FText>(GET_MEMBER_NAME_CHECKED(UWidgetBlueprint, PaletteCategory));
		if (!FoundPaletteCategoryText.IsEmpty())
		{
			return FoundPaletteCategoryText;
		}
		else
		{
			auto DefaultUserWidget = UUserWidget::StaticClass()->GetDefaultObject<UUserWidget>();
			return DefaultUserWidget->GetPaletteCategory();
		}
	}
}
Example #20
0
FText UEnvQueryTest::DescribeBoolTestParams(const FString& ConditionDesc) const
{
	FText FilterDesc;
	if (IsFiltering() && FilterType == EEnvTestFilterType::Match)
	{
		FilterDesc = BoolValue.IsDynamic() ?
			FText::Format(FText::FromString("{0} {1}: {2}"), LOCTEXT("FilterRequire", "require"), FText::FromString(ConditionDesc), FText::FromString(BoolValue.ToString())) :
			FText::Format(FText::FromString("{0} {1}{2}"), LOCTEXT("FilterRequire", "require"), BoolValue.DefaultValue ? FText::GetEmpty() : LOCTEXT("NotWithSpace", "not "), FText::FromString(ConditionDesc));
	}

	FNumberFormattingOptions NumberFormattingOptions;
	NumberFormattingOptions.MaximumFractionalDigits = 2;

	FText ScoreDesc;
	if (!IsScoring())
	{
		ScoreDesc = LOCTEXT("DontScore", "don't score");
	}
	else if (ScoringEquation == EEnvTestScoreEquation::Constant)
	{
		FText FactorDesc = ScoringFactor.IsDynamic() ?
			FText::FromString(ScoringFactor.ToString()) :
			FText::Format(FText::FromString("x{0}"), FText::AsNumber(FMath::Abs(ScoringFactor.DefaultValue), &NumberFormattingOptions));

		ScoreDesc = FText::Format(FText::FromString("{0} [{1}]"), LOCTEXT("ScoreConstant", "constant score"), FactorDesc);
	}
	else if (ScoringFactor.IsDynamic())
	{
		ScoreDesc = FText::Format(FText::FromString("{0}: {1}"), LOCTEXT("ScoreFactor", "score factor"), FText::FromString(ScoringFactor.ToString()));
	}
	else
	{
		FText ScoreSignDesc = (ScoringFactor.DefaultValue > 0) ? FText::GetEmpty() : LOCTEXT("NotWithSpace", "not ");
		FText ScoreValueDesc = FText::AsNumber(FMath::Abs(ScoringFactor.DefaultValue), &NumberFormattingOptions);
		ScoreDesc = FText::Format(FText::FromString("{0} {1}{2} [x{3}]"), LOCTEXT("ScorePrefer", "prefer"), ScoreSignDesc, FText::FromString(ConditionDesc), ScoreValueDesc);
	}

	return FilterDesc.IsEmpty() ? ScoreDesc : FText::Format(FText::FromString("{0}, {1}"), FilterDesc, ScoreDesc);
}
void AssignStringToProperty(const FString& InString, const UProperty* InProp, uint8* InData, const int32 InIndex, const int32 InPortFlags, FStringOutputDevice& OutImportError)
{
	auto DoImportText = [&](const FString& InStringToImport)
	{
		InProp->ImportText(*InStringToImport, InProp->ContainerPtrToValuePtr<uint8>(InData, InIndex), InPortFlags, nullptr, &OutImportError);
	};

	bool bNeedsImport = true;

	const UByteProperty* EnumProp = Cast<const UByteProperty>(InProp);
	if(EnumProp && EnumProp->Enum)
	{
		// Enum properties may use the friendly name in their import data, however the UPropertyByte::ImportText function will only accept the internal enum entry name
		// Detect if we're using a friendly name for an entry, and if so, try and map it to the correct internal name before performing the import
		const int32 EnumIndex = EnumProp->Enum->FindEnumIndex(*InString);
		if(EnumIndex == INDEX_NONE)
		{
			// Couldn't find a match for the name we were given, try and find a match using the friendly names
			for(int32 EnumEntryIndex = 0; EnumEntryIndex < EnumProp->Enum->NumEnums(); ++EnumEntryIndex)
			{
				const FText FriendlyEnumEntryName = EnumProp->Enum->GetEnumText(EnumEntryIndex);
				if(FriendlyEnumEntryName.ToString() == InString)
				{
					// Get the corresponding internal name and warn the user that we're using this fallback
					FString StringToImport = EnumProp->Enum->GetEnumName(EnumEntryIndex);
					UE_LOG(LogDataTable, Warning, TEXT("Could not a find matching enum entry for '%s', but did find a matching display name. Will import using the enum entry corresponding to that display name ('%s')"), *InString, *StringToImport);
					DoImportText(StringToImport);
					bNeedsImport = false;
					break;
				}
			}
		}
	}

	if(bNeedsImport)
	{
		DoImportText(InString);
	}
}
Example #22
0
void UK2Node_Variable::ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const
{
	Super::ValidateNodeDuringCompilation(MessageLog);

	UProperty* VariableProperty = GetPropertyForVariable();

	// Local variables do not exist until much later in the compilation than this function can provide
	if (VariableProperty == NULL && !VariableReference.IsLocalScope())
	{
		if (!VariableReference.IsDeprecated())
		{
			FString OwnerName;

			UBlueprint* Blueprint = GetBlueprint();
			if (Blueprint != nullptr)
			{
				OwnerName = Blueprint->GetName();
				if (UClass* VarOwnerClass = VariableReference.GetMemberParentClass(Blueprint->GeneratedClass))
				{
					OwnerName = VarOwnerClass->GetName();
				}
			}
			FString const VarName = VariableReference.GetMemberName().ToString();

			FText const WarningFormat = LOCTEXT("VariableNotFound", "Could not find a variable named \"%s\" in '%s'.\nMake sure '%s' has been compiled for @@");
			MessageLog.Warning(*FString::Printf(*WarningFormat.ToString(), *VarName, *OwnerName, *OwnerName), this);
		}
		else
		{
			MessageLog.Warning(*FString::Printf(*LOCTEXT("VariableDeprecated", "Variable '%s' for @@ was deprecated.  Please update it.").ToString(), *VariableReference.GetMemberName().ToString()), this);
		}
	}

	if (VariableProperty && (VariableProperty->ArrayDim > 1))
	{
		MessageLog.Warning(*LOCTEXT("StaticArray_Warning", "@@ - the native property is a static array, which is not supported by blueprints").ToString(), this);
	}
}
//------------------------------------------------------------------------------
FText FEditorCategoryUtilsImpl::GetTooltipForCategory(FString const& CategoryDisplayName, FString const& DocLink, FString const& DocExcerpt)
{
	FText Tooltip;

	TSharedRef<IDocumentation> Documentation = IDocumentation::Get();
	if (Documentation->PageExists(DocLink))
	{
		TSharedRef<IDocumentationPage> DocPage = Documentation->GetPage(DocLink, NULL);
	
		const FString TooltipExcerptSuffix(TEXT("__Tooltip"));

		FExcerpt Excerpt;
		if (DocPage->GetExcerpt(DocExcerpt + TooltipExcerptSuffix, Excerpt))
		{
			static const FString TooltipVarKey(TEXT("Tooltip"));
			if (FString* TooltipValue = Excerpt.Variables.Find(TooltipVarKey))
			{
				Tooltip = FText::FromString(TooltipValue->Replace(TEXT("\\n"),TEXT("\n")));
			}
		}
	}

	if (Tooltip.IsEmpty())
	{
		FString CategoryTooltip;

		if (CategoryDisplayName.Split(TEXT("|"), nullptr, &CategoryTooltip, ESearchCase::CaseSensitive, ESearchDir::FromEnd))
		{
			Tooltip = FText::FromString(CategoryTooltip);
		}
		else
		{
			Tooltip = FText::FromString(CategoryDisplayName);
		}
	}

	return Tooltip;
}
Example #24
0
void FWebBrowserHandler::OnLoadError(CefRefPtr<CefBrowser> Browser,
	CefRefPtr<CefFrame> Frame,
	CefLoadHandler::ErrorCode InErrorCode,
	const CefString& ErrorText,
	const CefString& FailedUrl)
{
	// Don't display an error for downloaded files.
	if (InErrorCode == ERR_ABORTED)
	{
		return;
	}

	// notify browser window
	if (Frame->IsMain())
	{
		TSharedPtr<FWebBrowserWindow> BrowserWindow = BrowserWindowPtr.Pin();

		if (BrowserWindow.IsValid())
		{
			BrowserWindow->NotifyDocumentError();
		}
	}

	// Display a load error message.
	if (ShowErrorMessage)
	{
		FFormatNamedArguments Args;
		{
			Args.Add(TEXT("FailedUrl"), FText::FromString(FailedUrl.ToWString().c_str()));
			Args.Add(TEXT("ErrorText"), FText::FromString(ErrorText.ToWString().c_str()));
			Args.Add(TEXT("ErrorCode"), FText::AsNumber(InErrorCode));
		}
		FText ErrorMsg = FText::Format(LOCTEXT("WebBrowserLoadError", "Failed to load URL {FailedUrl} with error {ErrorText} ({ErrorCode})."), Args);
		FString ErrorHTML = TEXT("<html><body bgcolor=\"white\"><h2>") + ErrorMsg.ToString() + TEXT("</h2></body></html>");

		Frame->LoadString(*ErrorHTML, FailedUrl);
	}
}
static bool DeserializeResponseToStruct(void* OutStruct, UStruct& TypeInfo, FHttpResponsePtr HttpResponse)
{
	bool bResult = false;
	FString ResponseStr = HttpResponse->GetContentAsString();
	FText ErrorText;

	if (HttpResponse.IsValid())
	{
		if (EHttpResponseCodes::IsOk(HttpResponse->GetResponseCode()))
		{

			// Write string to FMemoryWriter to force unicode
			TArray<uint8> InBytes;
			FMemoryWriter Writer(InBytes);
			Writer.ArForceUnicode = true;
			Writer << ResponseStr;

			FMemoryReader Reader(InBytes);
			// FMemoryWriter writes size of string at beginning, need to ignore this or json parsing errors occur
			Reader.Seek(4); 

			FJsonStructDeserializerBackend Backend(Reader);

			bResult = FStructDeserializer::Deserialize(OutStruct, TypeInfo, Backend);
		}
		else
		{
			ErrorText = FText::Format(LOCTEXT("InvalidResponse", "Invalid response. code={0} error={1}"), FText::FromString(FString::FromInt(HttpResponse->GetResponseCode())), FText::FromString(ResponseStr));
		}
	}

	if (!bResult)
	{
		UE_LOG(LogLocalizationService, Warning, TEXT("%s"), *(ErrorText.ToString()));
	}

	return bResult;
}
Example #26
0
void FSlateStyleSet::Log(ISlateStyle::EStyleMessageSeverity Severity, const FText& Message) const
{
	if ( Severity == ISlateStyle::Error )
	{
		UE_LOG(LogSlateStyle, Error, TEXT("%s"), *Message.ToString());
	}
	else if ( Severity == ISlateStyle::PerformanceWarning )
	{
		UE_LOG(LogSlateStyle, Warning, TEXT("%s"), *Message.ToString());
	}
	else if ( Severity == ISlateStyle::Warning )
	{
		UE_LOG(LogSlateStyle, Warning, TEXT("%s"), *Message.ToString());
	}
	else if ( Severity == ISlateStyle::Info )
	{
		UE_LOG(LogSlateStyle, Log, TEXT("%s"), *Message.ToString());
	}
	else
	{
		UE_LOG(LogSlateStyle, Fatal, TEXT("%s"), *Message.ToString());
	}
}
void UK2Node_LatentAbilityCall::ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const
{
	Super::ValidateNodeDuringCompilation(MessageLog);

	UFunction* DelegateSignatureFunction = NULL;
	for (TFieldIterator<UProperty> PropertyIt(ProxyClass); PropertyIt; ++PropertyIt)
	{
		if (UMulticastDelegateProperty* Property = Cast<UMulticastDelegateProperty>(*PropertyIt))
		{
			if (Property->GetBoolMetaData(FK2Node_LatentAbilityCallHelper_RequiresConnection))
			{
				if (UEdGraphPin* DelegateExecPin = FindPin(Property->GetName()))
				{
					if (DelegateExecPin->LinkedTo.Num() < 1)
					{
						const FText MessageText = FText::Format(LOCTEXT("NoConnectionToRequiredExecPin", "@@ - Unhandled event.  You need something connected to the '{0}' pin"), FText::FromName(Property->GetFName()));
						MessageLog.Warning(*MessageText.ToString(), this);
					}
				}
			}
		}
	}
}
Example #28
0
bool FNiagaraCompiler::CheckOutputs(FName OpName, TArray<TNiagaraExprPtr>& Outputs)
{
	//check the types of the input expressions.
	const FNiagaraOpInfo* OpInfo = FNiagaraOpInfo::GetOpInfo(OpName);
	check(OpInfo);
	int32 NumOutputs = Outputs.Num();
	bool bError = false;
	check(OpInfo->Outputs.Num() == NumOutputs);
	for (int32 i = 0; i < NumOutputs; ++i)
	{
		check(Outputs[i].IsValid());
		if (OpInfo->Outputs[i].DataType != Outputs[i]->Result.Type)
		{
			bError = true;
			FText ErrorText = FText::Format(LOCTEXT("Expression {0} has incorrect inputs!\nExpected: {1} - Actual: {2}", ""),
				FText::FromString(OpName.ToString()),
				FText::AsNumber((int32)OpInfo->Outputs[i].DataType),
				FText::AsNumber((int32)((TNiagaraExprPtr)Outputs[i])->Result.Type.GetValue()));
			MessageLog.Error(*ErrorText.ToString());
		}
	}
	return bError;
}
Example #29
0
FAssetNameToken::FAssetNameToken(const FString& InAssetName, const FText& InMessage)
	: AssetName(InAssetName)
{
	if ( !InMessage.IsEmpty() )
	{
		CachedText = InMessage;
	}
	else
	{
		CachedText = FText::FromString( AssetName );
	}

	MessageTokenActivated = FOnMessageTokenActivated::CreateStatic(&FAssetNameToken::FindAsset, AssetName);
}
void FEnumEditorUtils::EnsureAllDisplayNamesExist(UUserDefinedEnum* Enum)
{
	if (Enum)
	{
		const int32 EnumeratorsToEnsure = (Enum->NumEnums() > 0) ? (Enum->NumEnums() - 1) : 0;
		Enum->DisplayNames.Empty(EnumeratorsToEnsure);
		for	(int32 Index = 0; Index < EnumeratorsToEnsure; Index++)
		{
			FText DisplayNameMetaData = Enum->GetEnumText(Index);
			if (DisplayNameMetaData.IsEmpty())
			{
				const FString EnumName = Enum->GetEnumName(Index);
				DisplayNameMetaData = FText::FromString(EnumName);
				for(int32 AddIndex = 0; !IsEnumeratorDisplayNameValid(Enum, DisplayNameMetaData.ToString()); ++AddIndex)
				{
					DisplayNameMetaData = FText::FromString(FString::Printf(TEXT("%s%d"), *EnumName, AddIndex));
				}
				Enum->SetMetaData(FEnumEditorUtilsHelper::DisplayName(), *DisplayNameMetaData.ToString(), Index);
			}
			Enum->DisplayNames.Add(DisplayNameMetaData);
		}
	}
}