public void AddFiles(ClothData.Sex targetSex) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.CheckFileExists = true; openFileDialog.Filter = "Clothes geometry (*.ydd)|*.ydd"; openFileDialog.FilterIndex = 1; openFileDialog.DefaultExt = "ydd"; openFileDialog.Multiselect = true; openFileDialog.Title = "Adding " + ((targetSex == ClothData.Sex.Male) ? "male" : "female") + " clothes"; if (openFileDialog.ShowDialog() == true) { foreach (string filename in openFileDialog.FileNames) { string baseFileName = Path.GetFileName(filename); ClothNameResolver cData = new ClothNameResolver(baseFileName); if (!cData.isVariation) { ClothData nextCloth = new ClothData(filename, cData.clothType, cData.drawableType, cData.bindedNumber, cData.postfix, targetSex); nextCloth.SearchForFPModel(); nextCloth.SearchForTextures(); MainWindow.clothes.Add(nextCloth); StatusController.SetStatus(nextCloth.ToString() + " added (FP model found: " + (nextCloth.fpModelPath != "" ? "Yes": "No") + ", Textures: " + (nextCloth.textures.Count) + "). Total: " + MainWindow.clothes.Count); } else { StatusController.SetStatus("Item " + baseFileName + " can't be added. Looks like it's variant of another item"); } } } }
private void RemoveUnderCursor_Click(object sender, RoutedEventArgs e) { if (selectedCloth != null) { clothes.Remove(selectedCloth); selectedCloth = null; editGroupBox.Visibility = Visibility.Hidden; } }
private static void GetClothPostfixes(ClothData clothData, out string ytdPostfix, out string yddPostfix) { yddPostfix = clothData.MainPath.EndsWith("_u.ydd") ? "u" : "r"; ytdPostfix = clothData.MainPath.EndsWith("_u.ydd") ? "uni" : "whi"; if (clothData.DrawableType == ClothNameResolver.DrawableTypes.Shoes || clothData.DrawableType == ClothNameResolver.DrawableTypes.Legs) { yddPostfix = "r"; ytdPostfix = "uni"; } }
private void RemoveUnderCursor_Click(object sender, RoutedEventArgs e) { if (selectedCloth != null) { var _clothes = clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); clothes.Clear(); foreach (var cloth in _clothes.Where(cloth => cloth != selectedCloth)) { clothes.Add(cloth); } selectedCloth = null; editGroupBox.Visibility = Visibility.Collapsed; } }
private void ClothesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count <= 0) { return; } _selectedCloth = (ClothData)e.AddedItems[0]; if (_selectedCloth == null) { return; } clothEditWindow.Visibility = Visibility.Collapsed; pedPropEditWindow.Visibility = Visibility.Collapsed; editGroupBox.Visibility = Visibility.Visible; if (_selectedCloth.IsComponent()) { clothEditWindow.Visibility = Visibility.Visible; drawableName.Text = _selectedCloth.Name; texturesList.ItemsSource = _selectedCloth.Textures; firstPersonModelPath.Text = _selectedCloth.FirstPersonModelPath != "" ? _selectedCloth.FirstPersonModelPath : "Not selected..."; unkFlag1Check.IsChecked = _selectedCloth.PedComponentFlags.unkFlag1; unkFlag2Check.IsChecked = _selectedCloth.PedComponentFlags.unkFlag2; unkFlag3Check.IsChecked = _selectedCloth.PedComponentFlags.unkFlag3; unkFlag4Check.IsChecked = _selectedCloth.PedComponentFlags.unkFlag4; isHighHeelsCheck.IsChecked = _selectedCloth.PedComponentFlags.isHighHeels; } else { pedPropEditWindow.Visibility = Visibility.Visible; drawableName.Text = _selectedCloth.Name; pedPropName.Text = _selectedCloth.Name; pedPropTexturesList.ItemsSource = _selectedCloth.Textures; pedPropFlag1.IsChecked = _selectedCloth.PedPropFlags.unkFlag1; pedPropFlag2.IsChecked = _selectedCloth.PedPropFlags.unkFlag2; pedPropFlag3.IsChecked = _selectedCloth.PedPropFlags.unkFlag3; pedPropFlag4.IsChecked = _selectedCloth.PedPropFlags.unkFlag4; pedPropFlag5.IsChecked = _selectedCloth.PedPropFlags.unkFlag5; } }
private void ClothesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { hasChanged = true; selectedCloth = (ClothData)e.AddedItems[0]; if (selectedCloth != null) { clothEditWindow.Visibility = Visibility.Collapsed; pedPropEditWindow.Visibility = Visibility.Collapsed; if (selectedCloth.IsComponent()) { clothEditWindow.Visibility = Visibility.Visible; drawableName.Text = selectedCloth.Name; texturesList.ItemsSource = selectedCloth.textures; fpModelPath.Text = selectedCloth.fpModelPath != "" ? selectedCloth.fpModelPath : "Not selected..."; unkFlag1Check.IsChecked = selectedCloth.componentFlags.unkFlag1; unkFlag2Check.IsChecked = selectedCloth.componentFlags.unkFlag2; unkFlag3Check.IsChecked = selectedCloth.componentFlags.unkFlag3; unkFlag4Check.IsChecked = selectedCloth.componentFlags.unkFlag4; isHighHeelsCheck.IsChecked = selectedCloth.componentFlags.isHighHeels; } else { pedPropEditWindow.Visibility = Visibility.Visible; drawableName.Text = selectedCloth.Name; pedPropName.Text = selectedCloth.Name; pedPropTexturesList.ItemsSource = selectedCloth.textures; pedPropFlag1.IsChecked = selectedCloth.pedPropFlags.unkFlag1; pedPropFlag2.IsChecked = selectedCloth.pedPropFlags.unkFlag2; pedPropFlag3.IsChecked = selectedCloth.pedPropFlags.unkFlag3; pedPropFlag4.IsChecked = selectedCloth.pedPropFlags.unkFlag4; pedPropFlag5.IsChecked = selectedCloth.pedPropFlags.unkFlag5; } } } }
private void RemoveUnderCursor_Click(object sender, RoutedEventArgs e) { if (_selectedCloth == null) { return; } var clothes = Clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); Clothes.Clear(); foreach (var cloth in clothes.Where(c => c != _selectedCloth)) { Clothes.Add(cloth); } _selectedCloth = null; editGroupBox.Visibility = Visibility.Collapsed; }
public void SetFPModel(ClothData cloth) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.CheckFileExists = true; openFileDialog.Filter = "Clothes drawable (*.ydd)|*.ydd"; openFileDialog.FilterIndex = 1; openFileDialog.DefaultExt = "ydd"; openFileDialog.Multiselect = false; if (openFileDialog.ShowDialog() == true) { foreach (string filename in openFileDialog.FileNames) { if (filename.EndsWith(".ydd")) { cloth.SetFPModel(filename); } } } }
public void AddTexture(ClothData cloth) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.CheckFileExists = true; openFileDialog.Filter = "Clothes texture (*.ytd)|*.ytd"; openFileDialog.FilterIndex = 1; openFileDialog.DefaultExt = "ytd"; openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog() == true) { foreach (string filename in openFileDialog.FileNames) { if (filename.EndsWith(".ytd")) { cloth.AddTexture(filename); } } } }
public void AddTexture(ClothData cloth) { OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, Filter = "Clothes texture (*.ytd)|*.ytd", FilterIndex = 1, DefaultExt = "ytd", Multiselect = true }; if (openFileDialog.ShowDialog() != true) { return; } foreach (string filename in openFileDialog.FileNames.Where(f => f.EndsWith(".ytd"))) { cloth.AddTexture(filename); } }
public void SetFirstPersonModel(ClothData cloth) { OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, Filter = "Clothes drawable (*.ydd)|*.ydd", FilterIndex = 1, DefaultExt = "ydd", Multiselect = false }; if (openFileDialog.ShowDialog() != true) { return; } foreach (string filename in openFileDialog.FileNames.Where(f => f.EndsWith(".ydd"))) { cloth.SetFirstPersonModel(filename); } }
private void RemoveUnderCursor_Click(object sender, RoutedEventArgs e) { if (_selectedCloth == null) { return; } var removedClothName = _selectedCloth.Name; var clothes = Clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); Clothes.Clear(); foreach (var cloth in clothes.Where(c => c != _selectedCloth)) { Clothes.Add(cloth); } _selectedCloth = null; editGroupBox.Visibility = Visibility.Collapsed; clothEditWindow.Visibility = Visibility.Collapsed; pedPropEditWindow.Visibility = Visibility.Collapsed; StatusController.SetStatus($"Removed '{removedClothName}'. Total clothes: " + Clothes.Count); }
public void AddTexture(ClothData cloth) { var openFileDialog = new OpenFileDialog { CheckFileExists = true, Filter = "Clothes texture (*.ytd)|*.ytd", FilterIndex = 1, DefaultExt = "ytd", Multiselect = true }; if (openFileDialog.ShowDialog() != true) { return; } foreach (var filename in openFileDialog.FileNames) { if (!filename.EndsWith(".ytd")) { continue; } cloth.AddTexture(filename); } }
private static MCComponentInfo GenerateYmtPedComponentItem(ClothData clothData, ref MUnk_3538495220[] componentTextureBindings) { byte componentTypeId = clothData.GetComponentTypeId(); if (componentTextureBindings[componentTypeId] == null) { componentTextureBindings[componentTypeId] = new MUnk_3538495220(); } byte nextPropMask = 17; switch (componentTypeId) { case 2: case 7: nextPropMask = 11; break; case 5: case 8: nextPropMask = 65; break; case 9: nextPropMask = 1; break; case 10: nextPropMask = 5; break; case 11: nextPropMask = 1; break; default: break; } MUnk_1535046754 textureDescription = new MUnk_1535046754 { PropMask = nextPropMask, Unk_2806194106 = (byte)(clothData.FirstPersonModelPath != "" ? 1 : 0), ClothData = { Unk_2828247905 = 0 } }; byte texId = (byte)(clothData.MainPath.EndsWith("_u.ydd") ? 0 : 1); foreach (string texPath in clothData.Textures) { MUnk_1036962405 texInfo = new MUnk_1036962405 { Distribution = 255, TexId = texId }; textureDescription.ATexData.Add(texInfo); } componentTextureBindings[componentTypeId].Unk_1756136273.Add(textureDescription); byte componentTextureLocalId = (byte)(componentTextureBindings[componentTypeId].Unk_1756136273.Count - 1); return(new MCComponentInfo { Unk_802196719 = 0, Unk_4233133352 = 0, Unk_128864925 = { b0 = (byte)(clothData.PedComponentFlags.unkFlag1 ? 1 : 0), b1 = (byte)(clothData.PedComponentFlags.unkFlag2 ? 1 : 0), b2 = (byte)(clothData.PedComponentFlags.unkFlag3 ? 1 : 0), b3 = (byte)(clothData.PedComponentFlags.unkFlag4 ? 1 : 0), b4 = (byte)(clothData.PedComponentFlags.isHighHeels ? 1 : 0) }, Flags = 0, Inclusions = 0, Exclusions = 0, Unk_1613922652 = 0, Unk_2114993291 = 0, Unk_3509540765 = componentTypeId, Unk_4196345791 = componentTextureLocalId }); }
private static MUnk_94549140 GenerateYmtPedPropItem(YmtPedDefinitionFile ymt, Unk_2834549053 anchor, ClothData clothData) { var item = new MUnk_94549140(ymt.Unk_376833625.PropInfo) { AnchorId = (byte)anchor }; for (int i = 0; i < clothData.Textures.Count; i++) { var texture = new MUnk_254518642 { TexId = (byte)i }; item.TexData.Add(texture); } // Get or create linked anchor var aanchor = ymt.Unk_376833625.PropInfo.AAnchors.Find(e => e.Anchor == anchor); if (aanchor == null) { aanchor = new MCAnchorProps(ymt.Unk_376833625.PropInfo) { Anchor = anchor, PropsMap = { [item] = (byte)item.TexData.Count } }; ymt.Unk_376833625.PropInfo.AAnchors.Add(aanchor); } else { aanchor.PropsMap[item] = (byte)item.TexData.Count; } return(item); }
public void AddFiles(ClothData.Sex targetSex) { OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, Filter = "Clothes geometry (*.ydd)|*.ydd", FilterIndex = 1, DefaultExt = "ydd", Multiselect = true, Title = "Adding " + (targetSex == ClothData.Sex.Male ? "male" : "female") + " clothes" }; if (openFileDialog.ShowDialog() != true) { return; } foreach (string filename in openFileDialog.FileNames) { string baseFileName = Path.GetFileName(filename); ClothNameResolver cData = new ClothNameResolver(baseFileName); if (!cData.IsVariation) { ClothData nextCloth = new ClothData(filename, cData.ClothType, cData.DrawableType, cData.BindedNumber, cData.Postfix, targetSex); if (cData.ClothType == ClothNameResolver.ClothTypes.Component) { nextCloth.SearchForFirstPersonModel(); nextCloth.SearchForTextures(); var clothes = MainWindow.Clothes.ToList(); clothes.Add(nextCloth); clothes = clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); MainWindow.Clothes.Clear(); foreach (var cloth in clothes) { MainWindow.Clothes.Add(cloth); } StatusController.SetStatus(nextCloth + " added (FP model found: " + (nextCloth.FirstPersonModelPath != "" ? "Yes" : "No") + ", Textures: " + nextCloth.Textures.Count + "). Total: " + MainWindow.Clothes.Count); } else { nextCloth.SearchForTextures(); var clothes = MainWindow.Clothes.ToList(); clothes.Add(nextCloth); clothes = clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); MainWindow.Clothes.Clear(); foreach (var cloth in clothes) { MainWindow.Clothes.Add(cloth); } StatusController.SetStatus(nextCloth + " added, Textures: " + nextCloth.Textures.Count + "). Total: " + MainWindow.Clothes.Count); } } else { StatusController.SetStatus("Item " + baseFileName + " can't be added. Looks like it's variant of another item"); } } }