- KeldorKatarn
- Posts: 193
- Joined:
Problems porting a WPF project to Noesis for Unity
I recently started Evaluating Noesis for my current company. We're a UX company and thinking about using Noesis for projects.
I am running into a couple of problems however. I'll post them as separate threads here, since the recent server crash apparently destroyed my earlier posts.
I was trying to port one of our WPF projects, or rather one of its screens, to Noesis.
We have a bunch of resource dictionaries merged in the App.aml and one viewmodel view combination in this example.
I'm running into several problems with missing APIs or APIs that apparently don't work like WPF and I also don't 100% understand the configuration work I need to do.
One issue I'm running into is declaring fonts, stream geometries and images as resources.
The stream geometry declaration looks like this:
And for some reason Noesis tells me that it cannot turn this string into a StreamGeometry. In WPF it works fine. Any idea what the issue is?
I'm also trying to declare a font family but I'm not sure i'm doing it right. I'm getting the same issue basically.
Am I referencing the file in the wrong way? Do I need to put the font file in a certain directory for Noesis to find it? In WPF this works, in noesis it doesn't.
In terms of geometry, every type seems to exist except for "Polygon". Why is that type missing and can I expect that to be added?
I am running into a couple of problems however. I'll post them as separate threads here, since the recent server crash apparently destroyed my earlier posts.
I was trying to port one of our WPF projects, or rather one of its screens, to Noesis.
We have a bunch of resource dictionaries merged in the App.aml and one viewmodel view combination in this example.
I'm running into several problems with missing APIs or APIs that apparently don't work like WPF and I also don't 100% understand the configuration work I need to do.
One issue I'm running into is declaring fonts, stream geometries and images as resources.
The stream geometry declaration looks like this:
Code: Select all
<StreamGeometry
x:Key="Icon.Comment">
F1M0,0z M33,10a3.27,3.27,0,0,0-3-3H10a3.28,3.28,0,0,0-3,3V26a3.28,3.28,0,0,0,3,3H28l5,5V10ZM28,24H12V21H28Zm0-4H12V17H28Zm0-4H12V13H28Z M40,40z
</StreamGeometry>
I'm also trying to declare a font family but I'm not sure i'm doing it right. I'm getting the same issue basically.
Code: Select all
<FontFamily x:Key="FontFamily.Standard">/Assets/NoesisGUI/HelloWorld/Resources/Fonts/Roboto-Regular.ttf</FontFamily>
In terms of geometry, every type seems to exist except for "Polygon". Why is that type missing and can I expect that to be added?
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
Hi, what kind of error are you getting with the StreamGeometry? I was able to load the following xaml without problems in XamlPlayer 2.1.0f1:
Regarding the fonts we support the following syntaxes for local fonts:
In the upcoming 2.2 version we will also support system installed fonts, that can be specified like this:
We didn't include Polygon because using a StreamGeometry you can get any shape you want, but please add a request in our bugtracker for Polygon class, if enough clients ask for it we could implement it.
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid.Resources>
<StreamGeometry
x:Key="Icon.Comment">
F1M0,0z M33,10a3.27,3.27,0,0,0-3-3H10a3.28,3.28,0,0,0-3,3V26a3.28,3.28,0,0,0,3,3H28l5,5V10ZM28,24H12V21H28Zm0-4H12V17H28Zm0-4H12V13H28Z M40,40z
</StreamGeometry>
</Grid.Resources>
<Path Data="{StaticResource Icon.Comment}" Fill="Lime"/>
</Grid>
Code: Select all
<FontFamily x:Key="FontFamily.Standard">/Assets/NoesisGUI/HelloWorld/Resources/Fonts/Roboto-Regular.ttf#Roboto</FontFamily>
Code: Select all
<FontFamily x:Key="FontFamily.Standard">/Assets/NoesisGUI/HelloWorld/Resources/Fonts/#Roboto</FontFamily>
Code: Select all
<FontFamily x:Key="FontFamily.Standard">Arial Narrow</FontFamily>
- KeldorKatarn
- Posts: 193
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
The problems are super hard to diagnose, which is yet another problem.
In Unity when I load a resource chain (i.e. resource dictionaries importing others in a chain to avoid loading resources multiple times), whenever there's a problem in one of the dictionary files,
I'm basically getting
"NoesisException: Assets/NoesisGUI/HelloWorld/MainWindow.xaml(1): Document contains no elements."
from Unity, which tells me absolutely nothing. But under some circumstances I cannot really reproduce it tells me that it cannot parse the string.
To be honest, the fact alone that errors in the creation of resource dictionaries throw such useless errors is already a major deterrent from using Noesis.
We need to be able to understand what Noesis is complaining about. Simply saying a file has no elements, which is clearly not the case, is not helpful at all.
In Unity when I load a resource chain (i.e. resource dictionaries importing others in a chain to avoid loading resources multiple times), whenever there's a problem in one of the dictionary files,
I'm basically getting
"NoesisException: Assets/NoesisGUI/HelloWorld/MainWindow.xaml(1): Document contains no elements."
from Unity, which tells me absolutely nothing. But under some circumstances I cannot really reproduce it tells me that it cannot parse the string.
To be honest, the fact alone that errors in the creation of resource dictionaries throw such useless errors is already a major deterrent from using Noesis.
We need to be able to understand what Noesis is complaining about. Simply saying a file has no elements, which is clearly not the case, is not helpful at all.
- KeldorKatarn
- Posts: 193
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
Got it to throw the error again by doing a re-import on the affected XAML
Code: Select all
NoesisException: Assets/NoesisGUI/HelloWorld/XamlResources/Basic/IconResources.xaml(27): Can't convert 'F1M0,0z M22.36,16.86A9.4,9.4,0,0,0,20.19,6.78,9.55,9.55,0,0,0,9.44,4.88l6.24,6.28-4.35,4.38L4.94,9.26A9.45,9.45,0,0,0,6.82,20.07a9.27,9.27,0,0,0,10,2.19l13.21,13.3a1.4,1.4,0,0,0,2,0l3.34-3.36a1.32,1.32,0,0,0,.14-2Z M40,40z' into a 'StreamGeometry' object.
Code: Select all
<StreamGeometry
x:Key="Icon.Comment">
F1M0,0z M33,10a3.27,3.27,0,0,0-3-3H10a3.28,3.28,0,0,0-3,3V26a3.28,3.28,0,0,0,3,3H28l5,5V10ZM28,24H12V21H28Zm0-4H12V17H28Zm0-4H12V13H28Z M40,40z
</StreamGeometry>
- KeldorKatarn
- Posts: 193
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
I also still can't get the font family loaded. no matter which of your variants I use, it can never load it.
Also on TextBlock the property IsHyphenationEnabled is missing.
Code: Select all
<Grid.Resources>
<FontFamily x:Key="FontFamily.Standard">D:\TestProjects\NoesisEvaluation\Unity\Assets\NoesisGUI\HelloWorld\Resources\Fonts\Roboto-Regular.ttf#Roboto</FontFamily>
</Grid.Resources>
Code: Select all
NoesisException: Assets/NoesisGUI/HelloWorld/Views/PowerUpView.xaml(15): Can't convert 'D:\TestProjects\NoesisEvaluation\Unity\Assets\NoesisGUI\HelloWorld\Resources\Fonts\Roboto-Regular.ttf#Roboto' into a 'FontFamily' object.
Rethrow as NoesisException
Noesis.Error.Check () (at Assets/NoesisGUI/Plugins/API/Core/NoesisError.cs:17)
Noesis.GUI.Noesis_LoadComponent_ (System.Runtime.InteropServices.HandleRef component, System.String xaml) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:282)
Noesis.GUI.LoadComponent (System.Object component, System.String xaml) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:135)
HelloWorld.Views.PowerUpView.InitializeComponent () (at Assets/NoesisGUI/HelloWorld/Views/PowerUpView.xaml.cs:29)
HelloWorld.Views.PowerUpView..ctor () (at Assets/NoesisGUI/HelloWorld/Views/PowerUpView.xaml.cs:22)
(wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure)
Noesis.Extend.CreateInstance (System.IntPtr nativeType, System.IntPtr cPtr) (at Assets/NoesisGUI/Plugins/API/Core/NoesisExtend.cs:3933)
Rethrow as NoesisException
Noesis.Error.Check () (at Assets/NoesisGUI/Plugins/API/Core/NoesisError.cs:17)
Noesis.GUI.Noesis_LoadXaml_ (System.String xaml) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:275)
Noesis.GUI.LoadXaml (System.String xaml) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:125)
NoesisXaml.Load () (at Assets/NoesisGUI/Plugins/NoesisXaml.cs:31)
NoesisPostprocessor+<ImportXaml>c__AnonStorey0.<>m__0 () (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:353)
UnityEngine.Debug:LogException(Exception, Object)
<ImportXaml>c__AnonStorey0:<>m__0() (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:359)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
The last geometry you posted is not being parsed correctly by our parser. I created ticket https://www.noesisengine.com/bugs/view.php?id=1359 to keep track of this problem.
Can you report the missing TextBlock.IsHyphenationEnabled property?
For the other problems it would help us a lot if you could create a ticket and attach the project so we can see what is happening. You can create a private ticket if you don't want to share it with anyone else.
Can you report the missing TextBlock.IsHyphenationEnabled property?
For the other problems it would help us a lot if you could create a ticket and attach the project so we can see what is happening. You can create a private ticket if you don't want to share it with anyone else.
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
Hi,
I've been investigating the problem with the font and found a couple of problems.
First, the FontFamilyConverter was not working with back slashes '\\' as path separator, you should use '/'.
And absolute paths with a drive letter are not supported in Unity, an absolute path would be considered to start at Assets/.
You should try to use:
I'm still trying to reproduce without luck the problem with nested dictionaries showing only a "Document contains no elements" error. Our intention is to provide better error messages to help users understand what is wrong so they can fix it, so if you can please provide a way to reproduce this problem we will be thankful.
I've been investigating the problem with the font and found a couple of problems.
First, the FontFamilyConverter was not working with back slashes '\\' as path separator, you should use '/'.
And absolute paths with a drive letter are not supported in Unity, an absolute path would be considered to start at Assets/.
You should try to use:
Code: Select all
<FontFamily x:Key="FontFamily.Standard">/Assets/NoesisGUI/HelloWorld/Resources/Fonts/Roboto-Regular.ttf#Roboto</FontFamily>
- SenlyCamile
- Posts: 20
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
Does the IsHyphenationEnabled property work now?The last geometry you posted is not being parsed correctly by our parser. I created ticket https://www.noesisengine.com/bugs/view.php?id=1359 to keep track of this problem.
Can you report the missing TextBlock. IsHyphenationEnabled property?
For the other problems it would help us a lot if you could create a ticket and attach the project so we can see what is happening. You can create a private ticket if you don't want to share it with anyone else.
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
No, we don't support that property yet, could you please report it in our bugtracker?
- SenlyCamile
- Posts: 20
- Joined:
Re: Problems porting a WPF project to Noesis for Unity
Done.No, we don't support that property yet, could you please report it in our bugtracker?
Who is online
Users browsing this forum: Bing [Bot], Semrush [Bot] and 64 guests