private SimpleModPackEntries GetEntry(Mod mod, Modding modding) { if (mod.fullPath.Equals(string.Empty)) { return(null); } SimpleModPackEntries entry = new SimpleModPackEntries(); entry.Name = mod.name; entry.Category = mod.category; XivRace race = GetRace(mod.fullPath); entry.Race = race.GetDisplayName(); entry.Type = GetType(mod.fullPath); entry.Part = GetPart(mod.fullPath); entry.Num = GetNumber(mod.fullPath); entry.Map = GetMap(mod.fullPath); entry.Active = mod.enabled || mod.data.modOffset == mod.data.originalOffset; entry.ModEntry = mod; return(entry); }
/// <summary> /// Applies the deformer to a model /// </summary> /// <param name="model">The model being deformed</param> /// <param name="itemType">The item type of the model</param> /// <param name="currentRace">The current model race</param> /// <param name="targetRace">The target race to convert the model to</param> private void ApplyDeformers(TTModel model, string itemType, XivRace currentRace, XivRace targetRace) { try { // Current race is already parent node // Direct conversion // [ Current > (apply deform) > Target ] if (currentRace.IsDirectParentOf(targetRace)) { ModelModifiers.ApplyRacialDeform(model, targetRace); } // Target race is parent node of Current race // Convert to parent (invert deform) // [ Current > (apply inverse deform) > Target ] else if (targetRace.IsDirectParentOf(currentRace)) { ModelModifiers.ApplyRacialDeform(model, currentRace, true); } // Current race is not parent of Target Race and Current race has parent // Make a recursive call with the current races parent race // [ Current > (apply inverse deform) > Current.Parent > Recursive Call ] else if (currentRace.GetNode().Parent != null) { ModelModifiers.ApplyRacialDeform(model, currentRace, true); ApplyDeformers(model, itemType, currentRace.GetNode().Parent.Race, targetRace); } // Current race has no parent // Make a recursive call with the target races parent race // [ Target > (apply deform on Target.Parent) > Target.Parent > Recursive Call ] else { ModelModifiers.ApplyRacialDeform(model, targetRace.GetNode().Parent.Race); ApplyDeformers(model, itemType, targetRace.GetNode().Parent.Race, targetRace); } } catch (Exception ex) { // Show a warning that deforms are missing for the target race // This mostly happens with Face, Hair, Tails, Ears, and Female > Male deforms // The model is still added but no deforms are applied FlexibleMessageBox.Show(string.Format(UIMessages.MissingDeforms, targetRace.GetDisplayName(), itemType, ex.Message), UIMessages.MissingDeformsTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }