private void ApplyAll(bool active) { // Try again next frame if (_selector.selectedCharacter?.skin == null) { MakeDirty("Skin not yet loaded."); return; } _character = _selector.selectedCharacter; _hair = _selector.selectedHairGroup; ApplyAutoWorldScale(active); ApplyCameraPosition(active); ApplyPossessorMeshVisibility(active); if (UpdateHandler(ref _skinHandler, active && _hideFaceJSON.val)) { ConfigureHandler("Skin", ref _skinHandler, _skinHandler.Configure(_character.skin)); } if (UpdateHandler(ref _hairHandler, active && _hideHairJSON.val)) { ConfigureHandler("Hair", ref _hairHandler, _hairHandler.Configure(_character, _hair)); } if (!_dirty) { _tryAgainAttempts = 0; } }
public void ClearHandlers() { foreach (var handler in _handlers) { handler.Dispose(); } _handlers.Clear(); _character = null; _hairHashSum = 0; _clothingHashSum = 0; _dirty = false; }
public int Configure(DAZCharacter character, DAZHairGroup hair) { if (hair.name == "NoHair") { return(HandlerConfigurationResult.CannotApply); } if (hair.name == "Sim2Hair" || hair.name == "Sim2HairMale") { return(ConfigureSimV2Hair(hair)); } else if (hair.name == "SimHairGroup" || hair.name == "SimHairGroup2") { return(ConfigureSimHair(hair)); } else { return(ConfigureSimpleHair(hair)); } }
private void ApplyAll(bool active) { // Try again next frame if (_selector.selectedCharacter?.skin == null) { MakeDirty("Skin not yet loaded."); return; } _character = _selector.selectedCharacter; _hair = _selector.hairItems.Where(h => h.active).ToArray(); ApplyAutoWorldScale(active); ApplyCameraPosition(active); ApplyPossessorMeshVisibility(active); if (UpdateHandler(ref _skinHandler, active && _hideFaceJSON.val)) { ConfigureHandler("Skin", ref _skinHandler, _skinHandler.Configure(_character.skin)); } if (_hairHandlers == null) { _hairHandlers = new List <HairHandler>(new HairHandler[_hair.Length]); } for (var i = 0; i < _hairHandlers.Count; i++) { var hairHandler = _hairHandlers[i]; if (UpdateHandler(ref hairHandler, active && _hideHairJSON.val)) { ConfigureHandler("Hair", ref hairHandler, hairHandler.Configure(_hair[i])); } _hairHandlers[i] = hairHandler; } if (!_dirty) { _tryAgainAttempts = 0; } }
public void RegisterHandlers() { _dirty = false; // ReSharper disable once Unity.NoNullPropagation if (ReferenceEquals(_selector.selectedCharacter?.skin, null)) { MakeDirty("skin", "is not yet loaded."); return; } _character = _selector.selectedCharacter; if (_character == null) { MakeDirty("character", "is not yet loaded."); return; } if (hideFaceJSON.val) { if (!RegisterHandler(new SkinHandler(_character.skin))) { return; } } _hairHashSum = _selector.hairItems.Where(h => h.active).Aggregate(0, (s, h) => s ^ h.GetHashCode()); if (hideHairJSON.val) { var hair = _selector.hairItems .Where(h => h != null) .Where(h => h.active) .Where(h => h.tagsArray == null || h.tagsArray.Length == 0 || Array.IndexOf(h.tagsArray, "head") > -1 || Array.IndexOf(h.tagsArray, "face") > -1) .Where(HairHandler.Supports) .ToArray(); foreach (var h in hair) { if (!RegisterHandler(new HairHandler(h))) { return; } } } if (hideClothingJSON.val) { _clothingHashSum = _selector.clothingItems.Where(h => h.active).Aggregate(0, (s, c) => s ^ c.GetHashCode()); var clothes = _selector.clothingItems .Where(c => c.active) .Where(c => c.tagsArray != null && c.tagsArray.Length > 0 ? Array.IndexOf(c.tagsArray, "head") > -1 : c.displayName.IndexOf("eye", StringComparison.OrdinalIgnoreCase) > -1) .ToArray(); foreach (var c in clothes) { if (!RegisterHandler(new ClothingHandler(c))) { return; } } } if (!_dirty) { _tryAgainAttempts = 0; } }
public void RegisterHandlers() { _dirty = false; // ReSharper disable once Unity.NoNullPropagation if (ReferenceEquals(_selector.selectedCharacter?.skin, null)) { MakeDirty("skin", "is not yet loaded."); return; } _character = _selector.selectedCharacter; if (_character == null) { MakeDirty("character", "is not yet loaded."); return; } if (hideFaceJSON.val) { if (!RegisterHandler(new SkinHandler(_character.skin))) { return; } } _hairHashSum = _selector.hairItems.Where(h => h.active).Aggregate(0, (s, h) => s ^ h.GetHashCode()); if (hideHairJSON.val) { var hair = _selector.hairItems .Where(h => h != null) .Where(h => h.active) .Where(IsHeadHair) .Where(HairHandler.Supports) .ToArray(); foreach (var h in hair) { if (!RegisterHandler(new HairHandler(h))) { return; } } } if (hideClothingJSON.val) { _clothingHashSum = _selector.clothingItems.Where(h => h.active).Aggregate(0, (s, c) => s ^ c.GetHashCode()); var clothes = _selector.clothingItems .Where(c => c.active) .Where(IsHeadClothing) .ToArray(); foreach (var c in clothes) { if (!RegisterHandler(new ClothingHandler(c))) { return; } } } if (!_dirty) { _tryAgainAttempts = 0; } }