tedd
Topic Author
Posts: 2
Joined: 27 Jun 2017, 23:50

Losing Xaml references both in Cameras NoesisView and Tools->NoesisGUI->Settings

28 Aug 2018, 23:06

Hi

Just wanted to report a few issues that happens all the time.

Whenever pulling code from other developers (via Git):
1. Camera NoesisView-script loses reference to XAML.
2. Tools->NoesisGUI->Settings... loses reference to Application Resources
3. Preloaded Xamls list is emptied.
These errors seems to also come from compile problems during opening of Unity in some rare cases. When compile error is fixed references are lost. Though not sure of the exact conditions.

Other things:
1. When starting project it often claims Xaml-files are blank.
2. When starting project it sometimes doesn't reload the change, even when modifying the file repeatedly.

Views folder is linked into Asset folder through NTFS Junction (shared folder with WPF-project). Not sure if that has anything to do with it. Should not mess up references on Git pull and should be more consistent if it prevented change detection.

To bypass the reload/Xaml is blank-error we use this custom made script to refresh xaml views in Unity Editor:
using UnityEngine;
using UnityEditor;
using System.IO;

public class ReloadXamlViews : MonoBehaviour
{

    [MenuItem("Tools/Reload Xaml Views")]
    static void ReloadXamlViewsAction()
    {
        // Modify
        ScanDir(Path.Combine(Application.dataPath, "Views"));
        // Reload
        AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
        // Modify back
        ScanDir(Path.Combine(Application.dataPath, "Views"));
    }

    private static void ScanDir(string dir)
    {
        foreach (var subdir in Directory.GetDirectories(dir))
        {
            ScanDir(subdir);
        }

        foreach (var file in Directory.GetFiles(dir, "*.xaml"))
        {
            using (var stream = File.Open(file, FileMode.Open, FileAccess.ReadWrite))
            {
                stream.Seek(-1, SeekOrigin.End);

                if (stream.ReadByte() == 32)
                {
                    // Last character of file is space, decrease file size by 1
                    stream.SetLength(stream.Length - 1);
                }
                else
                {
                    // Last character is not space, add space to end
                    stream.Seek(0, SeekOrigin.End);
                    stream.WriteByte(32);
                }
            }
        }

    }
}
 
User avatar
jsantos
Site Admin
Posts: 2703
Joined: 20 Jan 2012, 17:18
Contact:

Re: Losing Xaml references both in Cameras NoesisView and Tools->NoesisGUI->Settings

28 Aug 2018, 23:54

Thanks for your feedback. May I ask what version of NoesisGUI are you using?

Who is online

Users browsing this forum: Google [Bot] and 1 guest