public AnimPartChange(ACE.DatLoader.Entity.AnimationPartChange animChange) { _animChange = animChange; }
public void LoadModel(uint id, ClothingTable clothingBase, uint palTemplate, float shade) { TextureCache.Init(); // can be either a gfxobj or setup id // if gfxobj, create a simple setup GfxObjMode = false; // create the objDesc, describing the "Changed" items to the base setup. // We won't bother loading the palette stuff, we'll just create that dictionary directly FileTypes.ObjDesc objDesc = new FileTypes.ObjDesc(); var cbe = clothingBase.ClothingBaseEffects[id].CloObjectEffects; foreach (var objEffect in cbe) { ACE.DatLoader.Entity.AnimationPartChange apChange = new ACE.DatLoader.Entity.AnimationPartChange(); apChange.PartID = objEffect.ModelId; apChange.PartIndex = (byte)objEffect.Index; objDesc.AnimPartChanges.Add(apChange.PartIndex, apChange); foreach (var texEffect in objEffect.CloTextureEffects) { ACE.DatLoader.Entity.TextureMapChange tmChange = new ACE.DatLoader.Entity.TextureMapChange(); tmChange.PartIndex = apChange.PartIndex; tmChange.OldTexture = texEffect.OldTexture; tmChange.NewTexture = texEffect.NewTexture; if (!objDesc.TextureChanges.TryGetValue(tmChange.PartIndex, out var tmChanges)) { tmChanges = new List <ACE.DatLoader.Entity.TextureMapChange>(); objDesc.TextureChanges.Add(tmChange.PartIndex, tmChanges); } tmChanges.Add(tmChange); } } // To hold our Custom Palette (palette swaps) Dictionary <int, uint> customPaletteColors = new Dictionary <int, uint>(); // Load all the custom palette colors... var subPalEffect = clothingBase.ClothingSubPalEffects[palTemplate]; foreach (var subPals in subPalEffect.CloSubPalettes) { var palSet = DatManager.PortalDat.ReadFromDat <PaletteSet>(subPals.PaletteSet); uint palId = palSet.GetPaletteID(shade); // Load our palette dictated by the shade in the palset var palette = DatManager.PortalDat.ReadFromDat <Palette>(palId); foreach (var range in subPals.Ranges) { int offset = (int)(range.Offset); int numColors = (int)(range.NumColors); // add the appropriate colors to our custom palette for (int i = 0; i < numColors; i++) { customPaletteColors.Add(i + offset, palette.Colors[i + offset]); } } } Setup = new SetupInstance(id, objDesc, customPaletteColors); if (ViewObject == null || ViewObject.PhysicsObj.PartArray.Setup._dat.Id != id) { InitObject(id); Render.Camera.InitModel(Setup.Setup.BoundingBox); } else { ViewObject.PhysicsObj.destroy_particle_manager(); } ModelType = ModelType.Setup; MainWindow.Status.WriteLine($"Loading {id:X8} with ClothingBase {clothingBase.Id:X8}, PaletteTemplate {palTemplate}, and Shade {shade}"); }