Skip to content

Commit

Permalink
persist existing ViewModel while changing clothing palettes / shades (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gmriggs committed May 26, 2021
1 parent a847b37 commit da34dfe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions ACViewer/ModelViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ public void LoadModel(uint id, ClothingTable clothingBase, uint palTemplate, flo

Setup = new SetupInstance(id, objDesc, customPaletteColors);

InitObject(id);
if (ViewObject == null || ViewObject.PhysicsObj.PartArray.Setup._dat.Id != id)
{
InitObject(id);

Render.Camera.InitModel(Setup.Setup.BoundingBox);
Render.Camera.InitModel(Setup.Setup.BoundingBox);
}

ModelType = ModelType.Setup;

Expand Down
4 changes: 3 additions & 1 deletion ACViewer/View/ClothingTableList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void OnClickClothingBase(ClothingTable clothing, uint fileID)
private void SetupIDs_OnClick(object sender, SelectionChangedEventArgs e)
{
if (CurrentClothingItem == null) return;

LoadModelWithClothingBase();
}

Expand Down Expand Up @@ -118,6 +119,7 @@ private void PaletteTemplates_OnClick(object sender, SelectionChangedEventArgs e

LoadModelWithClothingBase();
}

/// <summary>
/// Helper function to reset the Shades slider
/// </summary>
Expand Down Expand Up @@ -149,7 +151,7 @@ public void LoadModelWithClothingBase()
var selectedPalTemp = PaletteTemplates.SelectedItem as ListBoxItem;
uint palTemplate = (uint)selectedPalTemp.DataContext;

ModelViewer.LoadModel(setupId, CurrentClothingItem, palTemplate, shade) ;
ModelViewer.LoadModel(setupId, CurrentClothingItem, palTemplate, shade);
}

private void Shades_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
Expand Down

0 comments on commit da34dfe

Please sign in to comment.