Browse Source

Add Dimension enable toggle to SamplerCardViewModel

pull/165/head
Ionite 1 year ago
parent
commit
d40072fd9e
No known key found for this signature in database
  1. 4
      StabilityMatrix.Avalonia/Models/Inference/SamplerCardModel.cs
  2. 13
      StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs
  3. 14
      StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs

4
StabilityMatrix.Avalonia/Models/Inference/SamplerCardModel.cs

@ -13,12 +13,10 @@ public class SamplerCardModel
public bool IsCfgScaleEnabled { get; init; } = true; public bool IsCfgScaleEnabled { get; init; } = true;
public double CfgScale { get; init; } public double CfgScale { get; init; }
public bool IsScaleSizeMode { get; init; } public bool IsDimensionsEnabled { get; init; }
public int Width { get; init; } public int Width { get; init; }
public int Height { get; init; } public int Height { get; init; }
public double Scale { get; init; }
public bool IsSamplerSelectionEnabled { get; init; } = true; public bool IsSamplerSelectionEnabled { get; init; } = true;
public string? SelectedSampler { get; init; } public string? SelectedSampler { get; init; }
} }

13
StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs

@ -83,7 +83,18 @@ public partial class InferenceTextToImageViewModel
ConfigCardViewModel = vmFactory.Get<StackCardViewModel>().WithCards(new ViewModelBase[] ConfigCardViewModel = vmFactory.Get<StackCardViewModel>().WithCards(new ViewModelBase[]
{ {
vmFactory.Get<SamplerCardViewModel>() vmFactory.Get<SamplerCardViewModel>(),
vmFactory.Get<StackExpanderViewModel>().WithCards(new ViewModelBase[]
{
vmFactory.Get<UpscalerCardViewModel>(),
vmFactory.Get<SamplerCardViewModel>(vm =>
{
vm.IsScaleSizeMode = true;
vm.IsCfgScaleEnabled = false;
vm.IsSamplerSelectionEnabled = false;
vm.IsDenoiseStrengthEnabled = true;
}),
})
}); });
} }

14
StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs

@ -20,16 +20,10 @@ public partial class SamplerCardViewModel : ViewModelBase, ILoadableState<Sample
[ObservableProperty] private bool isCfgScaleEnabled = true; [ObservableProperty] private bool isCfgScaleEnabled = true;
[ObservableProperty] private double cfgScale = 7; [ObservableProperty] private double cfgScale = 7;
// Switch between the 2 size modes [ObservableProperty] private bool isDimensionsEnabled;
[ObservableProperty] private bool isScaleSizeMode;
// Absolute size mode
[ObservableProperty] private int width = 512; [ObservableProperty] private int width = 512;
[ObservableProperty] private int height = 512; [ObservableProperty] private int height = 512;
// Scale size mode
[ObservableProperty] private double scale = 1;
[ObservableProperty] private bool isSamplerSelectionEnabled = true; [ObservableProperty] private bool isSamplerSelectionEnabled = true;
[ObservableProperty, Required] [ObservableProperty, Required]
@ -50,10 +44,9 @@ public partial class SamplerCardViewModel : ViewModelBase, ILoadableState<Sample
DenoiseStrength = state.DenoiseStrength; DenoiseStrength = state.DenoiseStrength;
IsCfgScaleEnabled = state.IsCfgScaleEnabled; IsCfgScaleEnabled = state.IsCfgScaleEnabled;
CfgScale = state.CfgScale; CfgScale = state.CfgScale;
IsScaleSizeMode = state.IsScaleSizeMode; IsDimensionsEnabled = state.IsDimensionsEnabled;
Width = state.Width; Width = state.Width;
Height = state.Height; Height = state.Height;
Scale = state.Scale;
IsSamplerSelectionEnabled = state.IsSamplerSelectionEnabled; IsSamplerSelectionEnabled = state.IsSamplerSelectionEnabled;
SelectedSampler = state.SelectedSampler is null ? null SelectedSampler = state.SelectedSampler is null ? null
: new ComfySampler(state.SelectedSampler); : new ComfySampler(state.SelectedSampler);
@ -69,10 +62,9 @@ public partial class SamplerCardViewModel : ViewModelBase, ILoadableState<Sample
DenoiseStrength = DenoiseStrength, DenoiseStrength = DenoiseStrength,
IsCfgScaleEnabled = IsCfgScaleEnabled, IsCfgScaleEnabled = IsCfgScaleEnabled,
CfgScale = CfgScale, CfgScale = CfgScale,
IsScaleSizeMode = IsScaleSizeMode, IsDimensionsEnabled = IsDimensionsEnabled,
Width = Width, Width = Width,
Height = Height, Height = Height,
Scale = Scale,
IsSamplerSelectionEnabled = IsSamplerSelectionEnabled, IsSamplerSelectionEnabled = IsSamplerSelectionEnabled,
SelectedSampler = SelectedSampler?.Name SelectedSampler = SelectedSampler?.Name
}; };

Loading…
Cancel
Save