예제 #1
0
 protected void ReloadShaders()
 {
     _shaderAssetLoader.Reload();
     SetupShaderList();
     _shaderManager.RefreshCameraManager();
     _shaderManager.ClearAllMaterials();
     SetupActiveShaderStackList();
     SEUtilities.UpdateScrollIndicator(customListTableData.tableView, scrollIndicator);
 }
예제 #2
0
        protected void SetupShaderList()
        {
            customListTableData.data.Clear();
            if (_spriteCache != null)
            {
                _spriteCache.Clear();
            }
            else
            {
                _spriteCache = new Dictionary <Texture2D, Sprite>();
            }

            _selection = -1;
            shadersCleared?.Invoke();

            List <ShaderEffectData> sfxList = _shaderAssetLoader.ShaderEffectList;

            foreach (ShaderEffectData sfx in sfxList)
            {
                Sprite icon = SEUtilities.GetDefaultShaderIcon();

                if (sfx.PreviewImage != null && _spriteCache.TryGetValue(sfx.PreviewImage, out Sprite image))
                {
                    icon = image;
                }
                else if (sfx.PreviewImage != null)
                {
                    icon = Sprite.Create(sfx.PreviewImage, new Rect(0.0f, 0.0f, sfx.PreviewImage.width, sfx.PreviewImage.height), new Vector2(0.5f, 0.5f), 100.0f);
                    _spriteCache.Add(sfx.PreviewImage, icon);
                }

                CustomListTableData.CustomCellInfo customCellInfo = new CustomListTableData.CustomCellInfo(sfx.Name, sfx.Author, icon);
                customListTableData.data.Add(customCellInfo);
            }

            customListTableData.tableView.ReloadData();
            SEUtilities.UpdateScrollIndicator(customListTableData.tableView, scrollIndicator, true);
        }