Skip to content

Commit

Permalink
Fix issue where Makeup PosY would be locked to 13.04
Browse files Browse the repository at this point in the history
- Added Ctrl+O hotkey
- Updated dependencies
- Version bump
  • Loading branch information
Fusion86 committed Oct 23, 2021
1 parent 7eed2b1 commit b897385
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 44 deletions.
6 changes: 3 additions & 3 deletions src/MHWAppearanceEditor/Helpers/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public static Color ColorFromHex(string hex)

public static double Lerp(double min, double max, double value)
{
return min + value * (max - min);
return (1.0f - value) * min + max * value;
}

public static double InvLerp(double a, double b, double v)
public static double InvLerp(double min, double max, double value)
{
return (v - a) / (b - a);
return (value - min) / (max - min);
}

// I think this is called a linear conversion, though I'm not sure.
Expand Down
28 changes: 14 additions & 14 deletions src/MHWAppearanceEditor/MHWAppearanceEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net461;net5.0</TargetFrameworks>
<Version>1.5.1</Version>
<Version>1.5.2</Version>
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
Expand All @@ -18,26 +18,26 @@
<AvaloniaResource Include="Assets\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.5" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.5" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.5" />
<PackageReference Include="Avalonia.Direct2D1" Version="0.10.5" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.5" />
<PackageReference Include="Avalonia" Version="0.10.8" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.8" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.8" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.8" />
<PackageReference Include="Avalonia.Direct2D1" Version="0.10.8" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.8" />
<PackageReference Include="Gameloop.Vdf" Version="0.6.1" />
<PackageReference Include="Gameloop.Vdf.JsonConverter" Version="0.2.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.0" />
<PackageReference Include="reactiveui" Version="13.2.18" />
<PackageReference Include="ReactiveUI.Fody" Version="13.2.18" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
<PackageReference Include="reactiveui" Version="16.2.6" />
<PackageReference Include="ReactiveUI.Fody" Version="16.2.6" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.3" />
<PackageReference Include="Splat.Serilog" Version="11.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="Splat.Serilog" Version="13.1.30" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="ThemeEditor.Controls.ColorPicker" Version="0.10.0" />
<PackageReference Include="ThemeEditor.Controls.ColorPicker" Version="0.10.8" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Cirilla\src\Cirilla.Core\Cirilla.Core.csproj" />
Expand Down
46 changes: 23 additions & 23 deletions src/MHWAppearanceEditor/ViewModels/Tabs/SaveSlotViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,37 @@ public class SaveSlotViewModel : ViewModelBase, ITabItemViewModel
public double NoseHeight
{
get => Math.Round(Utility.Remap(sbyte.MinValue, sbyte.MaxValue, 0, 100, SaveSlot.CharacterAppearance.NoseHeight), 2);
set => SaveSlot.CharacterAppearance.NoseHeight = (sbyte)(Utility.Remap(0, 100, sbyte.MinValue, sbyte.MaxValue, value));
set => SaveSlot.CharacterAppearance.NoseHeight = (sbyte)Utility.Remap(0, 100, sbyte.MinValue, sbyte.MaxValue, value);
}

public double MouthHeight
{
get => Math.Round(Utility.Remap(sbyte.MinValue, sbyte.MaxValue, 0, 100, SaveSlot.CharacterAppearance.MouthHeight), 2);
set => SaveSlot.CharacterAppearance.MouthHeight = (sbyte)(Utility.Remap(0, 100, sbyte.MinValue, sbyte.MaxValue, value));
set => SaveSlot.CharacterAppearance.MouthHeight = (sbyte)Utility.Remap(0, 100, sbyte.MinValue, sbyte.MaxValue, value);
}

public double EyeWidth
{
get => Math.Round(Utility.Remap(sbyte.MinValue, sbyte.MaxValue, 0, 100, SaveSlot.CharacterAppearance.EyeWidth), 2);
set => SaveSlot.CharacterAppearance.EyeWidth = (sbyte)(Utility.Remap(0, 100, sbyte.MinValue, sbyte.MaxValue, value));
set => SaveSlot.CharacterAppearance.EyeWidth = (sbyte)Utility.Remap(0, 100, sbyte.MinValue, sbyte.MaxValue, value);
}

public double EyeHeight
{
get => Math.Round(Utility.Remap(sbyte.MinValue, sbyte.MaxValue, 0, 100, SaveSlot.CharacterAppearance.EyeHeight), 2);
set => SaveSlot.CharacterAppearance.EyeHeight = (sbyte)(Utility.Remap(0, 100, sbyte.MinValue, sbyte.MaxValue, value));
set => SaveSlot.CharacterAppearance.EyeHeight = (sbyte)Utility.Remap(0, 100, sbyte.MinValue, sbyte.MaxValue, value);
}

public double Age
{
get => Math.Round(Utility.Remap(byte.MinValue, byte.MaxValue, 0, 100, SaveSlot.CharacterAppearance.Age), 2);
set => SaveSlot.CharacterAppearance.Age = (byte)(Utility.Remap(0, 100, byte.MinValue, byte.MaxValue, value));
set => SaveSlot.CharacterAppearance.Age = (byte)Utility.Remap(0, 100, byte.MinValue, byte.MaxValue, value);
}

public double Wrinkles
{
get => Math.Round(Utility.Remap(byte.MinValue, byte.MaxValue, 0, 100, SaveSlot.CharacterAppearance.Wrinkles), 2);
set => SaveSlot.CharacterAppearance.Wrinkles = (byte)(Utility.Remap(0, 100, byte.MinValue, byte.MaxValue, value));
set => SaveSlot.CharacterAppearance.Wrinkles = (byte)Utility.Remap(0, 100, byte.MinValue, byte.MaxValue, value);
}

public byte SkinColorX { get => SaveSlot.CharacterAppearance.SkinColorX; set => SaveSlot.CharacterAppearance.SkinColorX = value; }
Expand All @@ -75,13 +75,13 @@ public double Wrinkles
public double Makeup1PosX
{
get => Math.Round(Utility.Remap(0.2, -0.2, 0, 100, SaveSlot.CharacterAppearance.Makeup1PosX), 2);
set => SaveSlot.CharacterAppearance.Makeup1PosX = (float)(Utility.Remap(0, 100, 0.2, -0.2, value));
set => SaveSlot.CharacterAppearance.Makeup1PosX = (float)Utility.Remap(0, 100, 0.2, -0.2, value);
}

public double Makeup1PosY
{
get => Math.Round(Utility.Remap(-0.06, 0.4, 0, 100, SaveSlot.CharacterAppearance.Makeup1PosY), 2);
set => SaveSlot.CharacterAppearance.Makeup1PosY = (byte)(Utility.Remap(0, 100, -0.06, 0.4, value));
set => SaveSlot.CharacterAppearance.Makeup1PosY = (float)Utility.Remap(0, 100, -0.06, 0.4, value);
}

public double Makeup1SizeX
Expand All @@ -99,31 +99,31 @@ public double Makeup1SizeY
public double Makeup1Glossy
{
get => Math.Round(Utility.Remap(1, 0, 0, 100, SaveSlot.CharacterAppearance.Makeup1Glossy), 2);
set => SaveSlot.CharacterAppearance.Makeup1Glossy = (float)(Utility.Remap(0, 100, 1, 0, value));
set => SaveSlot.CharacterAppearance.Makeup1Glossy = (float)Utility.Remap(0, 100, 1, 0, value);
}

public double Makeup1Metallic
{
get => Math.Round(Utility.Remap(0, 1, 0, 100, SaveSlot.CharacterAppearance.Makeup1Metallic), 2);
set => SaveSlot.CharacterAppearance.Makeup1Metallic = (float)(Utility.Remap(0, 100, 0, 1, value));
set => SaveSlot.CharacterAppearance.Makeup1Metallic = (float)Utility.Remap(0, 100, 0, 1, value);
}

public double Makeup1Luminescent
{
get => Math.Round(Utility.Remap(0, 1, 0, 100, SaveSlot.CharacterAppearance.Makeup1Luminescent), 2);
set => SaveSlot.CharacterAppearance.Makeup1Luminescent = (float)(Utility.Remap(0, 100, 0, 1, value));
set => SaveSlot.CharacterAppearance.Makeup1Luminescent = (float)Utility.Remap(0, 100, 0, 1, value);
}

public double Makeup2PosX
{
get => Math.Round(Utility.Remap(0.2, -0.2, 0, 100, SaveSlot.CharacterAppearance.Makeup2PosX), 2);
set => SaveSlot.CharacterAppearance.Makeup2PosX = (float)(Utility.Remap(0, 100, 0.2, -0.2, value));
set => SaveSlot.CharacterAppearance.Makeup2PosX = (float)Utility.Remap(0, 100, 0.2, -0.2, value);
}

public double Makeup2PosY
{
get => Math.Round(Utility.Remap(-0.06, 0.4, 0, 100, SaveSlot.CharacterAppearance.Makeup2PosY), 2);
set => SaveSlot.CharacterAppearance.Makeup2PosY = (byte)(Utility.Remap(0, 100, -0.06, 0.4, value));
set => SaveSlot.CharacterAppearance.Makeup2PosY = (float)Utility.Remap(0, 100, -0.06, 0.4, value);
}

public double Makeup2SizeX
Expand All @@ -141,31 +141,31 @@ public double Makeup2SizeY
public double Makeup2Glossy
{
get => Math.Round(Utility.Remap(1, 0, 0, 100, SaveSlot.CharacterAppearance.Makeup2Glossy), 2);
set => SaveSlot.CharacterAppearance.Makeup2Glossy = (float)(Utility.Remap(0, 100, 1, 0, value));
set => SaveSlot.CharacterAppearance.Makeup2Glossy = (float)Utility.Remap(0, 100, 1, 0, value);
}

public double Makeup2Metallic
{
get => Math.Round(Utility.Remap(0, 1, 0, 100, SaveSlot.CharacterAppearance.Makeup2Metallic), 2);
set => SaveSlot.CharacterAppearance.Makeup2Metallic = (float)(Utility.Remap(0, 100, 0, 1, value));
set => SaveSlot.CharacterAppearance.Makeup2Metallic = (float)Utility.Remap(0, 100, 0, 1, value);
}

public double Makeup2Luminescent
{
get => Math.Round(Utility.Remap(0, 1, 0, 100, SaveSlot.CharacterAppearance.Makeup2Luminescent), 2);
set => SaveSlot.CharacterAppearance.Makeup2Luminescent = (float)(Utility.Remap(0, 100, 0, 1, value));
set => SaveSlot.CharacterAppearance.Makeup2Luminescent = (float)Utility.Remap(0, 100, 0, 1, value);
}

public double Makeup3PosX
{
get => Math.Round(Utility.Remap(0.2, -0.2, 0, 100, SaveSlot.CharacterAppearance.Makeup3PosX), 2);
set => SaveSlot.CharacterAppearance.Makeup3PosX = (float)(Utility.Remap(0, 100, 0.2, -0.2, value));
set => SaveSlot.CharacterAppearance.Makeup3PosX = (float)Utility.Remap(0, 100, 0.2, -0.2, value);
}

public double Makeup3PosY
{
get => Math.Round(Utility.Remap(-0.06, 0.4, 0, 100, SaveSlot.CharacterAppearance.Makeup3PosY), 2);
set => SaveSlot.CharacterAppearance.Makeup3PosY = (byte)(Utility.Remap(0, 100, -0.06, 0.4, value));
set => SaveSlot.CharacterAppearance.Makeup3PosY = (float)Utility.Remap(0, 100, -0.06, 0.4, value);
}

public double Makeup3SizeX
Expand All @@ -183,19 +183,19 @@ public double Makeup3SizeY
public double Makeup3Glossy
{
get => Math.Round(Utility.Remap(1, 0, 0, 100, SaveSlot.CharacterAppearance.Makeup3Glossy), 2);
set => SaveSlot.CharacterAppearance.Makeup3Glossy = (float)(Utility.Remap(0, 100, 1, 0, value));
set => SaveSlot.CharacterAppearance.Makeup3Glossy = (float)Utility.Remap(0, 100, 1, 0, value);
}

public double Makeup3Metallic
{
get => Math.Round(Utility.Remap(0, 1, 0, 100, SaveSlot.CharacterAppearance.Makeup3Metallic), 2);
set => SaveSlot.CharacterAppearance.Makeup3Metallic = (float)(Utility.Remap(0, 100, 0, 1, value));
set => SaveSlot.CharacterAppearance.Makeup3Metallic = (float)Utility.Remap(0, 100, 0, 1, value);
}

public double Makeup3Luminescent
{
get => Math.Round(Utility.Remap(0, 1, 0, 100, SaveSlot.CharacterAppearance.Makeup3Luminescent), 2);
set => SaveSlot.CharacterAppearance.Makeup3Luminescent = (float)(Utility.Remap(0, 100, 0, 1, value));
set => SaveSlot.CharacterAppearance.Makeup3Luminescent = (float)Utility.Remap(0, 100, 0, 1, value);
}

public SDColor HairColor { get => SaveSlot.CharacterAppearance.HairColor; set => SaveSlot.CharacterAppearance.HairColor = value; }
Expand All @@ -220,13 +220,13 @@ public double Makeup3Luminescent
public double PalicoFurLength
{
get => Math.Round(Utility.Remap(0.1, 0.7, 0, 100, SaveSlot.PalicoAppearance.FurLength), 2);
set => SaveSlot.PalicoAppearance.FurLength = (float)(Utility.Remap(0, 100, 0.1, 0.7, value));
set => SaveSlot.PalicoAppearance.FurLength = (float)Utility.Remap(0, 100, 0.1, 0.7, value);
}

public double PalicoFurThickness
{
get => Math.Round(Utility.Remap(7, 3, 0, 100, SaveSlot.PalicoAppearance.FurThickness), 2);
set => SaveSlot.PalicoAppearance.FurThickness = (float)(Utility.Remap(0, 100, 7, 3, value));
set => SaveSlot.PalicoAppearance.FurThickness = (float)Utility.Remap(0, 100, 7, 3, value);
}

public PalicoVoiceType PalicoVoiceType { get => SaveSlot.PalicoAppearance.VoiceType; set => SaveSlot.PalicoAppearance.VoiceType = value; }
Expand Down
17 changes: 13 additions & 4 deletions src/MHWAppearanceEditor/Views/SaveDataView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,23 @@
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<DockPanel>
<Grid DockPanel.Dock="Top" ColumnDefinitions="42,42,*,42,42">
<Button Grid.Column="0" Height="42" Padding="9" Classes="Lookless" Command="{Binding OpenNewCommand}"
<Button Grid.Column="0"
Height="42"
Padding="9"
Classes="Lookless"
Command="{Binding OpenNewCommand}"
HotKey="Ctrl+O"
ToolTip.Tip="Open new SaveData file (closes currently opened file without saving)">
<!-- Adding a HotKey to this button crashes the application?? -->
<DrawingPresenter Drawing="{DynamicResource IconNewFolder}" Classes="Lookless"/>
</Button>

<Button Grid.Column="1" Height="42" Padding="11" Classes="Lookless" Command="{Binding SaveCommand}"
ToolTip.Tip="Save changes (opens 'Save as' dialog)" HotKey="Ctrl+S">
<Button Grid.Column="1"
Height="42"
Padding="11"
Classes="Lookless"
Command="{Binding SaveCommand}"
HotKey="Ctrl+S"
ToolTip.Tip="Save changes (opens 'Save as' dialog)">
<DrawingPresenter Drawing="{DynamicResource IconSave}"/>
</Button>

Expand Down

0 comments on commit b897385

Please sign in to comment.