Skip to content

Commit

Permalink
ClothData dropdown is now fully implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
grzybeek committed Jan 31, 2022
1 parent d4cf8f4 commit 30e8e51
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion YMTEditor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="3" Orientation="Horizontal">
<TextBlock ToolTip="Don't edit clothData if you don't know what are you doing!" Text="clothData: "></TextBlock>
<ComboBox SelectedIndex="0" Width="60">
<ComboBox Name="ClothCombo" DropDownClosed="ClothCombo_DropDownClosed" SelectedIndex="{Binding drawableHasCloth}" SelectedValuePath="Content" Tag="{Binding RelativeSource={RelativeSource AncestorType={x:Type Expander}, AncestorLevel=1}, Path=Header.Text, Mode=TwoWay}" Width="60">
<ComboBoxItem Content="False" />
<ComboBoxItem Content="True" />
</ComboBox>
Expand Down
19 changes: 19 additions & 0 deletions YMTEditor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,25 @@ private void RenderFlagsCombo_DropDownClosed(object sender, EventArgs e)
}
}

private void ClothCombo_DropDownClosed(object sender, EventArgs e)
{
ComboBox cmb = (ComboBox)sender;
if (cmb.SelectedItem != null)
{
string btn = Convert.ToString(cmb.DataContext);
string[] btn_parts = btn.Split((char)32);
int index = Convert.ToInt32(btn_parts[0]); //index 000, 001, 002 etc

string compName = (string)(sender as FrameworkElement).Tag; //name jbib, lowr, hand etc
int enumNumber = (int)(YMTTypes.ComponentNumbers)Enum.Parse(typeof(YMTTypes.ComponentNumbers), compName.ToLower());
int _index = Convert.ToInt32(Components.Where(z => z.compId == enumNumber).First().compIndex);

bool val = Convert.ToBoolean(cmb.SelectedValue.ToString()); //selected option from combobox

ComponentDrawable comp = Components.ElementAt(_index).compList.Where(c => c.drawableIndex == index).First(); //get component
comp.drawableHasCloth = val;
}
}

private void ClearEverything()
{
Expand Down

0 comments on commit 30e8e51

Please sign in to comment.