/// <summary> /// Remove an accessory from this avatar. /// </summary> /// <param name="apr">The Appearance of the accessory to remove.</param> public void RemoveAccessory(Appearance apr) { if (apr == null) { return; } if (Accessories.ContainsKey(apr)) { RemoveAppearance(Accessories[apr], true); Accessories.Remove(apr); } }
/// <summary> /// Adds an accessory to this avatar. /// </summary> /// <param name="apr">The Appearance instance of the accessory.</param> public void AddAccessory(Appearance apr) { if (Accessories.Count > 0) { if (Accessories.ContainsKey(apr)) { return; } var add = AddAppearance(apr, null); Accessories.Add(apr, add); } }
/// <summary> /// Adds an Appearance instance to this avatar. /// </summary> /// <param name="appearance">The Appearance instance to add.</param> /// <returns>An AvatarAppearanceInstance instance.</returns> protected AvatarAppearanceInstance AddAppearance(Appearance appearance, string texOverride) { var result = new AvatarAppearanceInstance(); result.Original = appearance; result.Bindings = new List <AvatarBindingInstance>(); int i = 0; int replaced = 0; var realBindings = appearance.Bindings.Select(bindingReference => bindingReference.RealBinding ?? FSO.Content.Content.Get().AvatarBindings?.Get(bindingReference.TypeID, bindingReference.FileID)).ToList(); if (Content.Content.Get().TS1) { foreach (var binding in realBindings) { if (binding == null) { continue; } var mesh = Content.Content.Get().AvatarMeshes.Get(binding.MeshName); if (texOverride != null && mesh.TextureName.ToLowerInvariant() == texOverride.ToLowerInvariant() .Replace("lgt", "") .Replace("med", "") .Replace("drk", "") || mesh.TextureName.ToLowerInvariant() == "x") { replaced = i; } i++; } if (texOverride != null) { realBindings[replaced] = realBindings[replaced].TS1Copy(); realBindings[replaced].TextureName = texOverride; } } foreach (var binding in realBindings) { if (binding == null) { continue; } result.Bindings.Add(AddBinding(binding)); } return(result); }
/// <summary> /// Adds an Appearance instance to this avatar. /// </summary> /// <param name="appearance">The Appearance instance to add.</param> /// <returns>An AvatarAppearanceInstance instance.</returns> protected AvatarAppearanceInstance AddAppearance(Appearance appearance) { var result = new AvatarAppearanceInstance(); result.Bindings = new List <AvatarBindingInstance>(); foreach (var bindingReference in appearance.Bindings) { var binding = FSO.Content.Content.Get().AvatarBindings.Get(bindingReference.TypeID, bindingReference.FileID); if (binding == null) { continue; } result.Bindings.Add(AddBinding(binding)); } return(result); }
/// <summary> /// Adds an Appearance instance to this avatar. /// </summary> /// <param name="appearance">The Appearance instance to add.</param> /// <returns>An AvatarAppearanceInstance instance.</returns> protected AvatarAppearanceInstance AddAppearance(Appearance appearance, string texOverride) { var result = new AvatarAppearanceInstance(); result.Bindings = new List <AvatarBindingInstance>(); foreach (var bindingReference in appearance.Bindings) { var binding = bindingReference.RealBinding ?? FSO.Content.Content.Get().AvatarBindings.Get(bindingReference.TypeID, bindingReference.FileID); if (binding == null) { continue; } if (texOverride != null) { binding = binding.TS1Copy(); binding.TextureName = texOverride; } result.Bindings.Add(AddBinding(binding)); } return(result); }
public BCF(Stream stream, bool cmx) { using (var io = (cmx) ? new BCFReadString(stream, true) : (BCFReadProxy)IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Skeletons = new Skeleton[io.ReadInt32()]; for (int i = 0; i < Skeletons.Length; i++) { Skeletons[i] = new Skeleton(); Skeletons[i].Read(io, true); } Appearances = new Appearance[io.ReadInt32()]; for (int i = 0; i < Appearances.Length; i++) { Appearances[i] = new Appearance(); Appearances[i].ReadBCF(io); } Animations = new Animation[io.ReadInt32()]; for (int i = 0; i < Animations.Length; i++) { Animations[i] = new Animation(); Animations[i].Read(io, true); } } }
public BCF(Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { Skeletons = new Skeleton[io.ReadInt32()]; for (int i = 0; i < Skeletons.Length; i++) { Skeletons[i] = new Skeleton(); Skeletons[i].Read(stream, true); } Appearances = new Appearance[io.ReadInt32()]; for (int i = 0; i < Appearances.Length; i++) { Appearances[i] = new Appearance(); Appearances[i].ReadBCF(stream); } Animations = new Animation[io.ReadInt32()]; for (int i = 0; i < Animations.Length; i++) { Animations[i] = new Animation(); Animations[i].Read(stream, true); } } }
/// <summary> /// Adds an Appearance instance to this avatar. /// </summary> /// <param name="appearance">The Appearance instance to add.</param> /// <returns>An AvatarAppearanceInstance instance.</returns> protected AvatarAppearanceInstance AddAppearance(Appearance appearance) { var result = new AvatarAppearanceInstance(); result.Bindings = new List<AvatarBindingInstance>(); foreach (var bindingReference in appearance.Bindings) { var binding = FSO.Content.Content.Get().AvatarBindings.Get(bindingReference.TypeID, bindingReference.FileID); if (binding == null) { continue; } result.Bindings.Add(AddBinding(binding)); } return result; }
/// <summary> /// Remove an accessory from this avatar. /// </summary> /// <param name="apr">The Appearance of the accessory to remove.</param> public void RemoveAccessory(Appearance apr) { if (Accessories.ContainsKey(apr)) { RemoveAppearance(Accessories[apr], true); Accessories.Remove(apr); } }
/// <summary> /// Adds an accessory to this avatar. /// </summary> /// <param name="apr">The Appearance instance of the accessory.</param> public void AddAccessory(Appearance apr) { if (Accessories.ContainsKey(apr)) { return; } var add = AddAppearance(apr); Accessories.Add(apr, add); }
/// <summary> /// Reloads the hand meshes. /// </summary> private void ReloadHandgroup() { if (m_LeftHandInstance != null) { base.RemoveAppearance(m_LeftHandInstance, true); } if (m_RightHandInstance != null) { base.RemoveAppearance(m_RightHandInstance, true); } if (m_Handgroup != null) { var HandgroupID = m_Handgroup.GetHandgroup(); if (HandgroupID.FileID == 0) { HandgroupID.FileID = (int)(158913789970 >> 32); } var Handgroup = FSO.Content.Content.Get().AvatarHandgroups.Get(HandgroupID.TypeID, HandgroupID.FileID); FSO.Common.Content.ContentID LeftID = null; FSO.Common.Content.ContentID RightID = null; FSO.Vitaboy.HandSet HSet = null; switch (m_Appearance) { case AppearanceType.Light: HSet = Handgroup.LightSkin; break; case AppearanceType.Medium: HSet = Handgroup.MediumSkin; break; case AppearanceType.Dark: HSet = Handgroup.DarkSkin; break; } switch (m_LeftHandGesture) { case SimHandGesture.Idle: LeftID = HSet.LeftHand.Idle.ID; break; case SimHandGesture.Fist: LeftID = HSet.LeftHand.Fist.ID; break; case SimHandGesture.Pointing: LeftID = HSet.LeftHand.Pointing.ID; break; } switch (m_RightHandGesture) { case SimHandGesture.Idle: RightID = HSet.RightHand.Idle.ID; break; case SimHandGesture.Fist: RightID = HSet.RightHand.Fist.ID; break; case SimHandGesture.Pointing: RightID = HSet.RightHand.Pointing.ID; break; } Appearance LeftApr = FSO.Content.Content.Get().AvatarAppearances.Get(LeftID); Appearance RightApr = FSO.Content.Content.Get().AvatarAppearances.Get(RightID); if (LeftApr != null) { m_LeftHandInstance = base.AddAppearance(LeftApr); } if (RightApr != null) { m_RightHandInstance = base.AddAppearance(RightApr); } } }