public SceneEditingEffects(SceneEditingModel model, SceneItemModel item) { _model = model; _item = item; ToggleHFlip = () => { var present = GetHflip(); if (present != null) { RemoveFilter(present); } else { AddFilter(new SceneItemFilter { Type = SceneItemFilterType.HFlip, Enabled = true }); } }; RemoveAll = () => { var present = GetHflip(); if (present != null) { _item.Model.Filters = new SceneItemFilters { Filters = new[] { present } } } ; else { _item.Model.Filters = null; } }; BasicSources = _typeDescriptors.Where(s => s.Category == FilterCategory.Basic).Select(s => new FilterSourceModel { Desc = s }).ToList(); QuickSources = _typeDescriptors.Where(s => s.Category == FilterCategory.Quick).Select(s => new FilterSourceModel { Desc = s }).ToList(); CreativeSources = _typeDescriptors.Where(s => s.Category == FilterCategory.Creative).Select(s => new FilterSourceModel { Desc = s }).ToList(); AllSources = BasicSources.Concat(QuickSources).Concat(CreativeSources).ToList(); AllSources.ForEach(s => s.InUse.OnChange = (o, n) => SourceChanged(s)); AddLut = (f, d) => _ = AddResource(f, d); UpdateContent(EditingUpdateType.Content); }
public void UpdateContent(EditingUpdateType updateType) { HFlip.SilentValue = GetHflip() != null; var filters = GetFiltersModel(); AllSources.ForEach(s => s.InUse.SilentValue = filters.Any(r => r.Type == s.Desc.Type)); ListHelper.UpdateCollectionNoId(filters.Where(s => s.Type != SceneItemFilterType.HFlip).ToList(), Filters, (s, t) => t.IsTheSame(s), s => CreateActive(s)); foreach (var s in Filters) { ApplyFilter(s, filters); } AnyActive.Value = Filters.Any(s => s.IsEnabled.Value); UpdateLuts(); }