Page 1 of 1
Documentation incorrect
Posted: 19 Oct 2017, 11:22
by elecman
This page here refers to the NoesisGUIPanel class, but that is not available anymore.
http://www.noesisengine.com/docs/Gui.Co ... orial.html
Also, at the page below the usage of MatrixTransform is incorrect.
transform = (MatrixTransform)rectangle.RenderTransform;
https://www.noesisengine.com/docs/Gui.C ... orial.html
Re: Documentation incorrect
Posted: 23 Oct 2017, 21:29
by jsantos
Thanks for the feedback. We are revamping all documentation for 2.1, the new code should be:
Grid grid = (Grid)GetComponent<NoesisView>().Content;
Texture2D texture = (Texture2D)Resources.Load("Noesis");
TextureSource source = new TextureSource(texture);
Image image = (Image)grid.FindName("image");
image.SetSource(source);
Sorry, what problem are you observing here? I just tested the code in that sample and it is working fine (after fixing the same problem as above with GetComponent).
Re: Documentation incorrect
Posted: 25 Oct 2017, 05:15
by elecman
The third line, cannot cast the matrix transform type:
NoesisView panel = GetComponent<NoesisView>();
Path rect = (Path)panel.Content.FindName("squaretest");
MatrixTransform pitchTransform = (MatrixTransform)rect.RenderTransform;
Transform2 pitchMatrix = pitchTransform.Matrix;
pitchMatrix.Translate(0, 10f);
pitchTransform.Matrix = pitchMatrix;
Also, may I suggest you do not use the var type in C# code? It makes it hard to figure out what types are used. Besides, UnityScript will be deprecated in the future anyway:
https://blogs.unity3d.com/2017/08/11/un ... he-sunset/
Re: Documentation incorrect
Posted: 26 Oct 2017, 18:48
by jsantos
The third line, cannot cast the matrix transform type:
NoesisView panel = GetComponent<NoesisView>();
Path rect = (Path)panel.Content.FindName("squaretest");
MatrixTransform pitchTransform = (MatrixTransform)rect.RenderTransform;
Transform2 pitchMatrix = pitchTransform.Matrix;
pitchMatrix.Translate(0, 10f);
pitchTransform.Matrix = pitchMatrix;
Sorry, I am not following here. The third line should compile, it is exactly the same code we have in our tutorial. Please, paste the exact error you are having.
Sure, I agree with you regarding var type. But how is that related to UnityScript?
Re: Documentation incorrect
Posted: 27 Oct 2017, 11:29
by elecman
About the var in C#, I was under the impression that this was not C# but UnityScript
The third line in the code snippet does compile but it throws the error at runtime. Try it.
Re: Documentation incorrect
Posted: 27 Oct 2017, 12:27
by jsantos
The third line in the code snippet does compile but it throws the error at runtime. Try it.
Yes, I tried the other day. The sample included in the tutorial works fine (with the changes commented above). What error are you getting?
Re: Documentation incorrect
Posted: 27 Oct 2017, 23:52
by elecman
The error is
InvalidCastException: Cannot cast from source type to destination type.
I will PM you a repo.
Re: Documentation incorrect
Posted: 28 Oct 2017, 14:52
by jsantos
Please, report in the tracker, it is easier that way for us.
Thanks!
Re: Documentation incorrect
Posted: 28 Oct 2017, 16:59
by elecman
Ok, done. Issue nr 0001171.
Re: Documentation incorrect
Posted: 30 Oct 2017, 19:09
by jsantos
From the tracker:
The error indicates that the transform stored in the element is not a MatrixTransform.
That is because the specified element "line15805" in the attached sample doesn't define a RenderTransform, and by default it returns an Identity Transform. In fact that transform is frozen, so you won't be able to modify it. So I suggest if you want to play with the RenderTransform of an element to explicitly set one.
For example, if you are going to translate only the element, you can set a TranslateTransform and modify its X and Y properties. If you need to rotate the element, then use a RotateTransform. But if you need complex transformations, set a MatrixTransform:
<Path x:Name="line15805" ....>
<Path.RenderTransform>
<MatrixTransform/>
</Path.RenderTransform>
</Path>