Page 1 of 1

Absolute URI's and Unreal Engine

Posted: 21 Feb 2020, 04:53
by BDV
Hello.

I am currently in the process of integrating the library into my project, using Unreal Engine 4, and currently running into an issue that seems to have stalled me. The basic idea is that I am trying to keep the Noesis assets (XAML) in their relative directories while maybe referencing a global resource dictionary.

Example:
Let's say I have:
[Content] -
-- [UI]
----[Fonts]
----[HUD]
------UIDefaultHUD (XAML)

And I want to reference a font family that lives in 'UI/Fonts/' then I'd use an absolute path which Noesis documentation says it relies on the root of the game content folder. However, when putting this into practice it fails. It may work in VS Blend but it will fail on UE. I've tried creating a resource dictionary on the root of [Content] that would reference the font for certain styles that require it but also fails.

I am not sure where I am going wrong with this. Would love any suggestions.

Re: Absolute URI's and Unreal Engine

Posted: 22 Feb 2020, 13:17
by hcpizzi
Hi BDV, welcome to our forums.

I just did a quick test, and it worked for me. I used this xaml:
<UserControl
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Rectangle Grid.Column="0">
            <Rectangle.Fill>
                <ImageBrush ImageSource="Rel/Rel.png"/>
            </Rectangle.Fill>
        </Rectangle>
        <Rectangle Grid.Column="1">
            <Rectangle.Fill>
                <ImageBrush ImageSource="/Abs/Abs.png"/>
            </Rectangle.Fill>
        </Rectangle>
    </Grid>
</UserControl>
My directory layout was as follows:
[Content]
-[Abs]
--Abs.png
-[UI]
--MainWindow.xaml
--[Rel]
---Rel.png

Perhaps you could share a small project with us that shows the problem you're having? Also, take a look at the Output Log window. It should display a warning if an asset isn't found, and may help shed some light on this issue.

Re: Absolute URI's and Unreal Engine

Posted: 22 Feb 2020, 18:13
by BDV
Thanks for the response. I tried again and it seems to be loading my other dictionaries and textures but it seems to fail with the font. I will keep trying but it seems to fail when I'm setting a font, whether or not I use the relative naming, and the output log says it is being loaded/created.

I have tried the following:
<Style x:Key="HUDFontStyle" TargetType="{x:Type TextBlock}">
	<Setter Property="FontFamily" Value="/Fonts/#WeblySleek UI Semilight"/>
        <Setter Property="FontSize" Value="25"/>
        <Setter Property="Foreground" Value="{StaticResource Brush.Primary}"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
</Style>
For the 'FontFamily' it fails to detect/load the font. However, when I give it the path to the font as such:
"/Fonts/weblysleekuisl.ttf" then it fails to actually use the font in specified TextBlocks. The other elements in the style are applied but even when setting the 'FontFamily' property on an object will still refuse to use the font.

Re: Absolute URI's and Unreal Engine

Posted: 23 Feb 2020, 13:46
by hcpizzi
Hello again.

You were right, it was failing to find fonts with absolute URIs. I've just pushed a fix to GitHub.

Please, give it a try and let us know if everything works correctly now.

Re: Absolute URI's and Unreal Engine

Posted: 23 Feb 2020, 21:58
by BDV
Hello. Thank you for the update and fix. I've given it a try again and it works but I may have came across a new bug that's repeated a couple times. I will post here once I have full reproduction steps.

Still cannot load the font I desire even after slightly renaming and attempting to give it a full path to the font type. I am using "Orbitron" but it says it cannot be found but it can find the font provided in the Samples (WeblySleek_UI_Semilight).

Re: Absolute URI's and Unreal Engine

Posted: 23 Feb 2020, 22:34
by hcpizzi
Sure. If you manage to reproduce it you could share a repro project with us. You can create a private ticket in our bugtracker if you prefer.

Re: Absolute URI's and Unreal Engine

Posted: 24 Feb 2020, 12:04
by hcpizzi
I just downloaded the font in the four weights available in th github repo, and tested it with this XAML, and everything seems to work now.
<UserControl
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0">
            <TextBlock Text="Light" FontFamily="Rel/#Orbitron"  FontSize="36" FontWeight="Light" />
            <TextBlock Text="Medium" FontFamily="Rel/#Orbitron"  FontSize="36" FontWeight="Medium" />
            <TextBlock Text="Bold" FontFamily="Rel/#Orbitron"  FontSize="36" FontWeight="Bold" />
            <TextBlock Text="Black" FontFamily="Rel/#Orbitron"  FontSize="36" FontWeight="Black" />
        </StackPanel>
        <StackPanel Grid.Column="1">
            <TextBlock Text="Light" FontFamily="/Abs/#Orbitron"  FontSize="36" FontWeight="Light" />
            <TextBlock Text="Medium" FontFamily="/Abs/#Orbitron"  FontSize="36" FontWeight="Medium" />
            <TextBlock Text="Bold" FontFamily="/Abs/#Orbitron"  FontSize="36" FontWeight="Bold" />
            <TextBlock Text="Black" FontFamily="/Abs/#Orbitron"  FontSize="36" FontWeight="Black" />
        </StackPanel>
    </Grid>
</UserControl>
This doesn't mean there are no bugs, though. So if you find a way to reproduce your issue, let us know.