コード例 #1
0
    public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height)
    {
        if (CanRender())
        {
            if (_viewPreviewGUI == null)
            {
                CreatePreviewGUIView();
            }

            if (_viewPreviewGUI != null && _viewPreviewGUI.Content != null)
            {
                if (NoesisSettings.Get().debugImporter)
                {
                    Debug.Log("↔ RenderStaticPreview " + assetPath);
                }

                RenderTexture rt = RenderPreview(_viewPreviewGUI, width, height);

                if (rt != null)
                {
                    RenderTexture prev = RenderTexture.active;
                    RenderTexture.active = rt;

                    Texture2D tex = new Texture2D(width, height);
                    tex.ReadPixels(new UnityEngine.Rect(0, 0, width, height), 0, 0);
                    tex.Apply(true);

                    RenderTexture.active = prev;
                    return(tex);
                }
            }
        }

        return(null);
    }
コード例 #2
0
    private bool CanRender()
    {
        NoesisXaml xaml = (NoesisXaml)target;

        return(xaml != null && xaml.CanLoad() && NoesisSettings.Get().previewEnabled&&
               !UnityEditorInternal.InternalEditorUtility.inBatchMode);
    }
コード例 #3
0
 private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
 {
     if (NoesisSettings.IsNoesisEnabled())
     {
         ImportAssets(importedAssets.Concat(movedAssets).ToArray(), null);
     }
 }
コード例 #4
0
 private static void Log(string message)
 {
     if (NoesisSettings.Get().debugImporter)
     {
         Debug.Log(message);
     }
 }
コード例 #5
0
    private static void Build()
    {
#if ENABLE_BUILD_LOG
        Debug.Log("Building...");
#endif

        EditorPrefs.DeleteKey(DelayedBuildKey);

#if !ENABLE_BUILD_LOG
        NoesisSettings.ClearLog();
#endif

        BuildToolKernel.BuildBegin();

        foreach (string platform in NoesisSettings.ActivePlatforms)
        {
            Build(platform);
        }

        UpdateNoesisGUIPaths();

#if ENABLE_BUILD_LOG
        Debug.Log("Building [done]");
#endif
    }
コード例 #6
0
ファイル: NoesisUnity.cs プロジェクト: CodingJinxx/polypoly
    public static void Init()
    {
        if (!_initialized)
        {
            _initialized = true;

            // Cache this because Unity is crashing internally if we access NoesisSettings from C++ callbacks
            _settings = NoesisSettings.Get();

            Noesis.GUI.Init();
            SetLicense(_settings.licenseName, _settings.licenseKey);

            RegisterLog();
            RegisterError();
            RegisterProviders();

            SetFontFallback();

            LoadApplicationResources();

            Noesis.GUI.SetSoftwareKeyboardCallback(SoftwareKeyboard);
            Noesis.GUI.SetCursorCallback(UpdateCursor);
            Noesis.GUI.SetOpenUrlCallback(OpenUrl);
            Noesis.GUI.SetPlayAudioCallback(PlayAudio);
        }
    }
コード例 #7
0
    void SetRenderSettings()
    {
        NoesisSettings settings = NoesisSettings.Get();

        bool linearRendering = QualitySettings.activeColorSpace == ColorSpace.Linear;

        int offscreenWidth  = (int)settings.offscreenTextureSize.x;
        int offscreenHeight = (int)settings.offscreenTextureSize.y;
        int sampleCount     = QualitySettings.antiAliasing;

        uint offscreenDefaultNumSurfaces = settings.offscreenInitSurfaces;
        uint offscreenMaxNumSurfaces     = settings.offscreenMaxSurfaces;
        uint glyphCacheMeshThreshold     = settings.glyphMeshThreshold;

        int glyphCacheTextureWidth  = 1024;
        int glyphCacheTextureHeight = 1024;

        switch (settings.glyphTextureSize)
        {
        case NoesisSettings.TextureSize._256x256:
        {
            glyphCacheTextureWidth  = 256;
            glyphCacheTextureHeight = 256;
            break;
        }

        case NoesisSettings.TextureSize._512x512:
        {
            glyphCacheTextureWidth  = 512;
            glyphCacheTextureHeight = 512;
            break;
        }

        case NoesisSettings.TextureSize._1024x1024:
        {
            glyphCacheTextureWidth  = 1024;
            glyphCacheTextureHeight = 1024;
            break;
        }

        case NoesisSettings.TextureSize._2048x2048:
        {
            glyphCacheTextureWidth  = 2048;
            glyphCacheTextureHeight = 2048;
            break;
        }

        case NoesisSettings.TextureSize._4096x4096:
        {
            glyphCacheTextureWidth  = 4096;
            glyphCacheTextureHeight = 4096;
            break;
        }
        }

        Noesis_RendererSettings(linearRendering, offscreenWidth, offscreenHeight, sampleCount,
                                offscreenDefaultNumSurfaces, offscreenMaxNumSurfaces, glyphCacheTextureWidth,
                                glyphCacheTextureHeight, glyphCacheMeshThreshold);
    }
コード例 #8
0
    public void OnEnable()
    {
        if (_commands == null)
        {
            _commands = new UnityEngine.Rendering.CommandBuffer();
        }

        if (NoesisSettings.IsNoesisEnabled())
        {
            RegisterFont();
        }
    }
コード例 #9
0
    void OnGUI()
    {
        GUI.Label(new Rect(0, 0, Width, 60), "", _bannerStyle);

        GUILayout.BeginArea(new Rect(0, 0, Width, Height));
        GUILayout.BeginVertical();

        GUILayout.Space(4.0f);
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label(_banner);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.Space(18.0f);

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUI.skin.label.fontStyle = FontStyle.Bold;
        GUILayout.Label("Version " + _version, EditorStyles.boldLabel);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.Space(12.0f);
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical();
        if (GUILayout.Button("Release Notes", GUILayout.MinWidth(180)))
        {
            NoesisSettings.OpenReleaseNotes();
        }
        if (GUILayout.Button("Noesis Technologies", GUILayout.MinWidth(180)))
        {
            UnityEngine.Application.OpenURL("http://www.noesisengine.com");
        }
        GUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.Space(10.0f);
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("(c) 2015 Noesis Technologies S.L. All Rights Reserved", EditorStyles.miniLabel);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
コード例 #10
0
    public static void Init()
    {
        if (!_initialized)
        {
            _initialized = true;

            Noesis.GUI.Init();

            // Cache this because Unity is crashing internally if we access NoesisSettings from C++ callbacks
            _settings = NoesisSettings.Get();

            Noesis.GUI.SoftwareKeyboard = new UnitySoftwareKeyboard();
            RegisterProviders();
            RegisterLog();
            LoadApplicationResources();
        }
    }
コード例 #11
0
    public static NoesisSettings Get()
    {
        if (_settings == null)
        {
            _settings = Resources.Load <NoesisSettings>("NoesisSettings");

#if UNITY_EDITOR
            if (_settings == null)
            {
                _settings = (NoesisSettings)ScriptableObject.CreateInstance(typeof(NoesisSettings));
                Directory.CreateDirectory(Application.dataPath + "/NoesisGUI/Settings/Resources");
                UnityEditor.AssetDatabase.CreateAsset(_settings, "Assets/NoesisGUI/Settings/Resources/NoesisSettings.asset");
            }
#endif
        }

        return(_settings);
    }
コード例 #12
0
    private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        if (UnityEditorInternal.InternalEditorUtility.inBatchMode)
        {
            return;
        }

        if (NoesisSettings.Get().postprocessorEnabled)
        {
            List <string> assets = new List <string>();
            assets.AddRange(importedAssets);
            assets.AddRange(movedAssets);

            // Do fonts first because XAML depends on the generated .asset
            foreach (var asset in assets)
            {
                if (HasExtension(asset, ".ttf") || HasExtension(asset, ".otf"))
                {
                    ImportFont(asset);
                }
            }

            // First, create all .asset resources to allow dependencies between XAMLs
            foreach (var asset in importedAssets)
            {
                if (HasExtension(asset, ".xaml"))
                {
                    CreateXamlAsset(asset);
                }
            }

            // And now, fully import each XAML
            foreach (var asset in importedAssets)
            {
                if (HasExtension(asset, ".xaml"))
                {
                    ImportXaml(asset);
                }
            }

            AssetDatabase.SaveAssets();
        }
    }
コード例 #13
0
    private IEnumerator UpdateVersion()
    {
        GoogleAnalyticsHelper.LogEvent("Install", version_, 0);
        progress_ = 0.10f;

        state_ = "Upgrading project";
        yield return(null);

        Upgrade(localVersion_);
        progress_ = 0.20f;

        state_ = "Updating version";
        yield return(null);

        NoesisVersion.SetCached(version_);
        progress_ = 0.35f;

        state_ = "Creating default settings";
        yield return(null);

        NoesisSettings.Get();
        progress_ = 0.40f;

        state_ = "Extracting documentation...\n";
        yield return(null);

        ExtractDocumentation();
        progress_ = 0.60f;

        state_ = "Importing assets...\n";
        yield return(null);

        NoesisPostprocessor.ImportAllAssets();
        progress_ = 0.90f;

        state_ = "Opening Welcome Window...\n";
        yield return(null);

        EditorWindow.GetWindow(typeof(NoesisWelcome), true, "Welcome to NoesisGUI!");
        progress_ = 1.0f;

        Debug.Log("NoesisGUI v" + version_ + " successfully installed");
    }
コード例 #14
0
ファイル: NoesisPostprocessor.cs プロジェクト: inedi/Rover
    private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        if (NoesisSettings.IsNoesisEnabled())
        {
            EditorApplication.CallbackFunction d = null;

            // Delay the import process to have all texture assets ready
            d = () =>
            {
                EditorApplication.update -= d;

                string[] assets = importedAssets.Concat(movedAssets).ToArray();
                NoesisPostprocessor.ImportAssets(assets, (progress, asset) => EditorUtility.DisplayProgressBar("Import XAMLs", asset, progress));
                EditorUtility.ClearProgressBar();
            };

            EditorApplication.update += d;
        }
    }
コード例 #15
0
    public static SettingsProvider CreateNoesisSettingsProvider()
    {
        var provider = new SettingsProvider("Project/NoesisSettings", SettingsScope.Project)
        {
            label      = "NoesisGUI",
            guiHandler = (searchContext) =>
            {
                OnInspectorGUI(new SerializedObject(NoesisSettings.Get()));
            },

            keywords = new HashSet <string>(new[] { "License Name", "License Key", "Application Resources",
                                                    "Default Font", "Default Font Size", "Default Font Weight", "Default Font Stretch", "Default Font Style",
                                                    "Glyph Texture Size", "Offscreen Sample Count", "Offscreen Init Surfaces", "Offscreen Max Surfaces",
                                                    "Linear Rendering", "Preview Enabled", "Hot Reloading", "Debug Importer", "Log Verbosity",
                                                    "AppStarting", "Arrow", "ArrowCD", "Cross", "Hand", "Help", "IBeam", "No", "None", "Pen", "ScrollAll",
                                                    "ScrollE", "ScrollN", "ScrollNE", "ScrollNS", "ScrollNW", "ScrollS", "ScrollSE", "ScrollSW",
                                                    "ScrollW", "ScrollWE", "SizeAll", "SizeNESW", "SizeNS", "SizeNWSE", "SizeWE", "UpArrow", "Wait" })
        };

        return(provider);
    }
コード例 #16
0
    public void OnDisable()
    {
        if (_view != null)
        {
            _commands.Clear();
            NoesisRenderer.UnregisterView(_view, _commands);
            Graphics.ExecuteCommandBuffer(_commands);
        }

        if (_viewIcon != null)
        {
            _commands.Clear();
            NoesisRenderer.UnregisterView(_viewIcon, _commands);
            Graphics.ExecuteCommandBuffer(_commands);
        }

        if (NoesisSettings.IsNoesisEnabled())
        {
            UnregisterFont();
        }
    }
コード例 #17
0
    public static NoesisSettings Get()
    {
        if (_settings == null)
        {
            // Theme loading tries to load Noesis library and this is a bad point to allow that
            _noesisEnabled = false;

            _settings = Resources.Load <NoesisSettings>("NoesisSettings");

#if UNITY_EDITOR
            if (_settings == null)
            {
                if (Directory.GetFiles(Application.dataPath, "NoesisSettings.asset", SearchOption.AllDirectories).Length != 0)
                {
                    // In rare situations (for example when upgrading the project to a new version of Unity),
                    // NoesisSettings exists but Unity doesn't load it because it is not registered yet.
                    // In this case, we return a default instance without caching it
                    return((NoesisSettings)ScriptableObject.CreateInstance(typeof(NoesisSettings)));
                }

                _settings = (NoesisSettings)ScriptableObject.CreateInstance(typeof(NoesisSettings));
                _settings.applicationResources = UnityEditor.AssetDatabase.LoadAssetAtPath <NoesisXaml>("Assets/NoesisGUI/Theme/NoesisTheme.DarkBlue.asset");
                _settings.defaultFont          = UnityEditor.AssetDatabase.LoadAssetAtPath <NoesisFont>("Assets/NoesisGUI/Theme/Fonts/PT Root UI_Regular.asset");

                Directory.CreateDirectory(Application.dataPath + "/Resources");
                UnityEditor.AssetDatabase.CreateAsset(_settings, "Assets/Resources/NoesisSettings.asset");
                UnityEditor.AssetDatabase.SaveAssets();
                Debug.Log("A new settings file was created in 'Assets/Resources/NoesisSettings.assets'. Please move it to a different 'Resources' folder if needed");
            }
            else
            {
                NoesisUnity.SetLicense(_settings.licenseName, _settings.licenseKey);
            }
#endif

            _noesisEnabled = true;
        }

        return(_settings);
    }
コード例 #18
0
    private void OnPostprocessTexture(Texture2D texture)
    {
        // Although our samples use the label 'Noesis' it seems to be ignored by Unity when the package is being imported
        if (AssetDatabase.GetLabels(assetImporter).Contains("Noesis") || assetPath.StartsWith("Assets/NoesisGUI/Samples"))
        {
            Color[] c = texture.GetPixels(0);

            // NoesisGUI needs premultipled alpha
            if (QualitySettings.activeColorSpace == ColorSpace.Linear)
            {
                for (int i = 0; i < c.Length; i++)
                {
                    c[i].r = Mathf.LinearToGammaSpace(Mathf.GammaToLinearSpace(c[i].r) * c[i].a);
                    c[i].g = Mathf.LinearToGammaSpace(Mathf.GammaToLinearSpace(c[i].g) * c[i].a);
                    c[i].b = Mathf.LinearToGammaSpace(Mathf.GammaToLinearSpace(c[i].b) * c[i].a);
                }
            }
            else
            {
                for (int i = 0; i < c.Length; i++)
                {
                    c[i].r = c[i].r * c[i].a;
                    c[i].g = c[i].g * c[i].a;
                    c[i].b = c[i].b * c[i].a;
                }
            }

            // Set new content and make the texture unreadable at runtime
            texture.SetPixels(c, 0);
            texture.Apply(true, true);
        }

        // Hot reloading of texture
        if (NoesisUnity.Initialized && NoesisSettings.Get().hotReloading)
        {
            ReloadTexture(assetPath, texture);
        }
    }
コード例 #19
0
    private static void UpdateCursor(View view, Noesis.Cursor cursor)
    {
        NoesisSettings settings = NoesisSettings.Get();

        switch (cursor)
        {
        case Noesis.Cursor.AppStarting:
            UnityEngine.Cursor.SetCursor(settings.AppStarting.Texture, settings.AppStarting.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.Arrow:
            UnityEngine.Cursor.SetCursor(settings.Arrow.Texture, settings.Arrow.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ArrowCD:
            UnityEngine.Cursor.SetCursor(settings.ArrowCD.Texture, settings.ArrowCD.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.Cross:
            UnityEngine.Cursor.SetCursor(settings.Cross.Texture, settings.Cross.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.Hand:
            UnityEngine.Cursor.SetCursor(settings.Hand.Texture, settings.Hand.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.Help:
            UnityEngine.Cursor.SetCursor(settings.Help.Texture, settings.Help.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.IBeam:
            UnityEngine.Cursor.SetCursor(settings.IBeam.Texture, settings.IBeam.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.No:
            UnityEngine.Cursor.SetCursor(settings.No.Texture, settings.No.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.None:
            UnityEngine.Cursor.SetCursor(settings.None.Texture, settings.None.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.Pen:
            UnityEngine.Cursor.SetCursor(settings.Pen.Texture, settings.Pen.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollAll:
            UnityEngine.Cursor.SetCursor(settings.ScrollAll.Texture, settings.ScrollAll.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollE:
            UnityEngine.Cursor.SetCursor(settings.ScrollE.Texture, settings.ScrollE.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollN:
            UnityEngine.Cursor.SetCursor(settings.ScrollN.Texture, settings.ScrollN.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollNE:
            UnityEngine.Cursor.SetCursor(settings.ScrollNE.Texture, settings.ScrollNE.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollNS:
            UnityEngine.Cursor.SetCursor(settings.ScrollNS.Texture, settings.ScrollNS.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollNW:
            UnityEngine.Cursor.SetCursor(settings.ScrollNW.Texture, settings.ScrollNW.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollS:
            UnityEngine.Cursor.SetCursor(settings.ScrollS.Texture, settings.ScrollS.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollSE:
            UnityEngine.Cursor.SetCursor(settings.ScrollSE.Texture, settings.ScrollSE.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollSW:
            UnityEngine.Cursor.SetCursor(settings.ScrollSW.Texture, settings.ScrollSW.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollW:
            UnityEngine.Cursor.SetCursor(settings.ScrollW.Texture, settings.ScrollW.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.ScrollWE:
            UnityEngine.Cursor.SetCursor(settings.ScrollWE.Texture, settings.ScrollWE.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.SizeAll:
            UnityEngine.Cursor.SetCursor(settings.SizeAll.Texture, settings.SizeAll.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.SizeNESW:
            UnityEngine.Cursor.SetCursor(settings.SizeNESW.Texture, settings.SizeNESW.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.SizeNS:
            UnityEngine.Cursor.SetCursor(settings.SizeNS.Texture, settings.SizeNS.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.SizeNWSE:
            UnityEngine.Cursor.SetCursor(settings.SizeNWSE.Texture, settings.SizeNWSE.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.SizeWE:
            UnityEngine.Cursor.SetCursor(settings.SizeWE.Texture, settings.SizeWE.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.UpArrow:
            UnityEngine.Cursor.SetCursor(settings.UpArrow.Texture, settings.UpArrow.HotSpot, CursorMode.Auto);
            break;

        case Noesis.Cursor.Wait:
            UnityEngine.Cursor.SetCursor(settings.Wait.Texture, settings.Wait.HotSpot, CursorMode.Auto);
            break;
        }
    }
コード例 #20
0
    private bool CanRender()
    {
        NoesisXaml xaml = (NoesisXaml)target;

        return(NoesisSettings.IsNoesisEnabled() && xaml != null && xaml.CanLoad() && NoesisSettings.Get().previewEnabled);
    }
コード例 #21
0
ファイル: NoesisUpdater.cs プロジェクト: CodingJinxx/polypoly
    private static void CheckVersion()
    {
        EditorApplication.update -= CheckVersion;

        if (!UnityEditorInternal.InternalEditorUtility.inBatchMode)
        {
            string localVersion = NoesisVersion.GetCached();
            string version      = NoesisVersion.Get();

            // Remove the file that indicates Noesis package is being installed
            AssetDatabase.DeleteAsset("Assets/NoesisGUI/Plugins/Editor/installing");

            // Detect if /Library is being recreated
            string noesisFile             = Path.Combine(Application.dataPath, "../Library/noesis");
            bool   libraryFolderRecreated = !File.Exists(noesisFile);
            if (libraryFolderRecreated)
            {
                File.Create(noesisFile).Dispose();
            }

            if (localVersion != version && version != "0.0.0")
            {
                if (NoesisVersion.RestartNeeded())
                {
                    Debug.LogWarning("Please restart Unity to reload NoesisGUI native plugin! " +
                                     "If error persists remove 'Assets/NoesisGUI/Plugins' and reimport again.");
                    return;
                }

                string title;

                if (localVersion != "")
                {
                    title = "Upgrading NoesisGUI " + localVersion + " -> " + version;
                }
                else
                {
                    title = "Installing NoesisGUI " + version;
                }

                EditorUtility.DisplayProgressBar(title, "", 0.0f);
                GoogleAnalyticsHelper.LogEvent("Install", version, 0);

                EditorUtility.DisplayProgressBar(title, "Upgrading project", 0.10f);
                Upgrade(localVersion);

                EditorUtility.DisplayProgressBar(title, "Updating version", 0.20f);
                NoesisVersion.SetCached(version);

                EditorUtility.DisplayProgressBar(title, "Creating default settings", 0.35f);
                NoesisSettings.Get();

                EditorUtility.DisplayProgressBar(title, "Extracting documentation...", 0.40f);
                ExtractTar("NoesisGUI/Doc.tar", "/../NoesisDoc", "/../NoesisDoc");

                EditorUtility.DisplayProgressBar(title, "Extracting blend samples...", 0.55f);
                ExtractTar("NoesisGUI/Samples/Samples-blend.tar", "/..", "/../Blend");

                NoesisPostprocessor.ImportAllAssets((progress, asset) =>
                {
                    EditorUtility.DisplayProgressBar(title, asset, 0.60f + progress * 0.40f);
                });

                EditorApplication.update += ShowWelcomeWindow;
                EditorUtility.ClearProgressBar();

                Debug.Log("NoesisGUI v" + version + " successfully installed");
            }
            else if (libraryFolderRecreated)
            {
                NoesisPostprocessor.ImportAllAssets();
            }
        }
    }
コード例 #22
0
ファイル: NoesisXaml.cs プロジェクト: CodingJinxx/polypoly
 public bool CanLoad()
 {
     return(NoesisSettings.IsNoesisEnabled() && !string.IsNullOrEmpty(source) && content != null);
 }
コード例 #23
0
    private static void ImportAssets(string[] assets, bool reload, UpdateProgress d)
    {
        int numFonts  = assets.Count(asset => asset.StartsWith("Assets/") && IsFont(asset));
        int numXamls  = assets.Count(asset => asset.StartsWith("Assets/") && IsXaml(asset));
        int numAssets = numFonts + numXamls;

        if (numAssets > 0)
        {
            Log("→ Import assets (XAMLs: " + numXamls + " Fonts: " + numFonts + ")");

            float delta    = 1.0f / numAssets;
            float progress = 0.0f;

            if (numXamls > 0)
            {
                NoesisUnity.Init();

                // Theme
                NoesisXaml theme = NoesisSettings.Get().applicationResources;
                if (theme != null)
                {
                    Log("Scanning for theme changes...");

                    bool changed;
                    ImportXaml(theme.source, false, false, out changed);

                    if (changed)
                    {
                        Log("↔ Reload ApplicationResources");
                        NoesisUnity.LoadApplicationResources();
                    }
                }
            }

            foreach (var asset in assets)
            {
                // Make sure read-only folders from Package Manager are not processed
                if (asset.StartsWith("Assets/"))
                {
                    try
                    {
                        if (IsFont(asset))
                        {
                            ImportFont(asset, true, reload);
                        }
                        else if (IsXaml(asset))
                        {
                            ImportXaml(asset, true, reload);
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.LogException(e);
                    }

                    if (d != null && (IsFont(asset) || IsXaml(asset)))
                    {
                        d(progress, asset);
                        progress += delta;
                    }
                }
            }

            Log("← Import assets");
        }
    }
コード例 #24
0
 static void OpenSettings()
 {
     Selection.activeObject = NoesisSettings.Get();
 }
コード例 #25
0
    void SetRenderSettings()
    {
        NoesisSettings settings = NoesisSettings.Get();

        bool linearRendering = false;

        switch (settings.linearRendering)
        {
        case NoesisSettings.LinearRendering._SamesAsUnity:
        {
            linearRendering = QualitySettings.activeColorSpace == ColorSpace.Linear;
            break;
        }

        case NoesisSettings.LinearRendering._Enabled:
        {
            linearRendering = true;
            break;
        }

        case NoesisSettings.LinearRendering._Disabled:
        {
            linearRendering = false;
            break;
        }
        }

        int sampleCount = 1;

        switch (settings.offscreenSampleCount)
        {
        case NoesisSettings.OffscreenSampleCount._SameAsUnity:
        {
            sampleCount = QualitySettings.antiAliasing;
            break;
        }

        case NoesisSettings.OffscreenSampleCount._1x:
        {
            sampleCount = 1;
            break;
        }

        case NoesisSettings.OffscreenSampleCount._2x:
        {
            sampleCount = 2;
            break;
        }

        case NoesisSettings.OffscreenSampleCount._4x:
        {
            sampleCount = 4;
            break;
        }

        case NoesisSettings.OffscreenSampleCount._8x:
        {
            sampleCount = 8;
            break;
        }
        }

        uint offscreenDefaultNumSurfaces = settings.offscreenInitSurfaces;
        uint offscreenMaxNumSurfaces     = settings.offscreenMaxSurfaces;
        uint glyphCacheMeshThreshold     = settings.glyphMeshThreshold;

        int glyphCacheTextureWidth  = 1024;
        int glyphCacheTextureHeight = 1024;

        switch (settings.glyphTextureSize)
        {
        case NoesisSettings.TextureSize._256x256:
        {
            glyphCacheTextureWidth  = 256;
            glyphCacheTextureHeight = 256;
            break;
        }

        case NoesisSettings.TextureSize._512x512:
        {
            glyphCacheTextureWidth  = 512;
            glyphCacheTextureHeight = 512;
            break;
        }

        case NoesisSettings.TextureSize._1024x1024:
        {
            glyphCacheTextureWidth  = 1024;
            glyphCacheTextureHeight = 1024;
            break;
        }

        case NoesisSettings.TextureSize._2048x2048:
        {
            glyphCacheTextureWidth  = 2048;
            glyphCacheTextureHeight = 2048;
            break;
        }

        case NoesisSettings.TextureSize._4096x4096:
        {
            glyphCacheTextureWidth  = 4096;
            glyphCacheTextureHeight = 4096;
            break;
        }
        }

        int colorGlyphCacheTextureWidth  = 0;
        int colorGlyphCacheTextureHeight = 0;

        switch (settings.colorGlyphTextureSize)
        {
        case NoesisSettings.ColorTextureSize._Auto:
        {
            colorGlyphCacheTextureWidth  = 0;
            colorGlyphCacheTextureHeight = 0;
            break;
        }

        case NoesisSettings.ColorTextureSize._256x256:
        {
            colorGlyphCacheTextureWidth  = 256;
            colorGlyphCacheTextureHeight = 256;
            break;
        }

        case NoesisSettings.ColorTextureSize._512x512:
        {
            colorGlyphCacheTextureWidth  = 512;
            colorGlyphCacheTextureHeight = 512;
            break;
        }

        case NoesisSettings.ColorTextureSize._1024x1024:
        {
            colorGlyphCacheTextureWidth  = 1024;
            colorGlyphCacheTextureHeight = 1024;
            break;
        }

        case NoesisSettings.ColorTextureSize._2048x2048:
        {
            colorGlyphCacheTextureWidth  = 2048;
            colorGlyphCacheTextureHeight = 2048;
            break;
        }

        case NoesisSettings.ColorTextureSize._4096x4096:
        {
            colorGlyphCacheTextureWidth  = 4096;
            colorGlyphCacheTextureHeight = 4096;
            break;
        }
        }

        Noesis_RendererSettings(linearRendering, sampleCount, offscreenDefaultNumSurfaces,
                                offscreenMaxNumSurfaces, glyphCacheTextureWidth, glyphCacheTextureHeight,
                                colorGlyphCacheTextureWidth, colorGlyphCacheTextureHeight, glyphCacheMeshThreshold);
    }
コード例 #26
0
 private bool CanRender()
 {
     return(NoesisSettings.IsNoesisEnabled() && NoesisSettings.Get().previewEnabled&& _faces.Count > 0);
 }