public void RefreshTexture(string texType) { if (IsMaskKind(texType)) { RefreshAllTextures(true); return; } if (texType != null && !Util.InsideStudio()) { var i = Array.FindIndex(ChaControl.objClothes, x => x != null && x.name == texType); if (i >= 0) { ChaControl.ChangeCustomClothes(true, i, true, false, false, false, false); return; } i = Array.FindIndex(ChaControl.objParts, x => x != null && x.name == texType); if (i >= 0) { ChaControl.ChangeCustomClothes(false, i, true, false, false, false, false); return; } } // Fall back if the specific tex couldn't be refreshed RefreshAllTextures(); }
public void RefreshAllTextures() { #if KK if (KKAPI.Studio.StudioAPI.InsideStudio) { // Studio needs a more aggresive refresh to update the textures // Refresh needs to happen through OCIChar or dynamic bones get messed up Studio.Studio.Instance.dicInfo.Values.OfType <Studio.OCIChar>() .FirstOrDefault(x => x.charInfo == ChaControl) ?.SetCoordinateInfo(CurrentCoordinate.Value, true); } else #endif { for (var i = 0; i < ChaControl.cusClothesCmp.Length; i++) { ChaControl.ChangeCustomClothes(true, i, true, false, false, false, false); } for (var i = 0; i < ChaControl.cusClothesSubCmp.Length; i++) { ChaControl.ChangeCustomClothes(false, i, true, false, false, false, false); } } }
public void RefreshTexture(string texType) { if (texType != null && KoikatuAPI.GetCurrentGameMode() != GameMode.Studio) { var i = Array.FindIndex(ChaControl.objClothes, x => x != null && x.name == texType); if (i >= 0) { ChaControl.ChangeCustomClothes(i, true, false, false, false); return; } } // Fall back if the specific tex couldn't be refreshed RefreshAllTextures(); }
public void RefreshAllTextures() { // todo test if needed for main game as well // Studio needs a more aggresive refresh to update the textures if (StudioAPI.InsideStudio) { ChaControl.ChangeClothes(true); return; } for (var i = 0; i < ChaControl.cusClothesCmp.Length; i++) { ChaControl.ChangeCustomClothes(true, i, true, false, false, false, false); } for (var i = 0; i < ChaControl.cusClothesSubCmp.Length; i++) { ChaControl.ChangeCustomClothes(false, i, true, false, false, false, false); } }
public void RefreshTexture(string texType) { if (texType != null) { var i = Array.FindIndex(ChaControl.objClothes, x => x != null && x.name == texType); if (i >= 0) { ChaControl.ChangeCustomClothes(true, i, true, false, false, false, false); return; } i = Array.FindIndex(ChaControl.objParts, x => x != null && x.name == texType); if (i >= 0) { ChaControl.ChangeCustomClothes(false, i, true, false, false, false, false); return; } } RefreshAllTextures(); }
public void RefreshAllTextures(bool onlyMasks) { #if KK if (KKAPI.Studio.StudioAPI.InsideStudio) { // Studio needs a more aggresive refresh to update the textures // Refresh needs to happen through OCIChar or dynamic bones get messed up Studio.Studio.Instance.dicInfo.Values.OfType <Studio.OCIChar>() .FirstOrDefault(x => x.charInfo == ChaControl) ?.SetCoordinateInfo(CurrentCoordinate.Value, true); } else #endif { // Needed for body masks var forceNeededParts = new[] { ChaFileDefine.ClothesKind.top, ChaFileDefine.ClothesKind.bra }; foreach (var clothesKind in forceNeededParts) { ForceClothesReload(clothesKind); } if (onlyMasks) { return; } var allParts = Enum.GetValues(typeof(ChaFileDefine.ClothesKind)).Cast <ChaFileDefine.ClothesKind>(); foreach (var clothesKind in allParts.Except(forceNeededParts)) { ChaControl.ChangeCustomClothes(true, (int)clothesKind, true, false, false, false, false); } // Triggered by ForceClothesReload on top so not necessary //for (var i = 0; i < ChaControl.cusClothesSubCmp.Length; i++) // ChaControl.ChangeCustomClothes(false, i, true, false, false, false, false); } }
public void RefreshAllTextures(bool onlyMasks) { #if KK || KKS if (KKAPI.Studio.StudioAPI.InsideStudio) { // Studio needs a more aggresive refresh to update the textures // Refresh needs to happen through OCIChar or dynamic bones get messed up Studio.Studio.Instance.dicInfo.Values.OfType <Studio.OCIChar>() .FirstOrDefault(x => x.charInfo == ChaControl) ?.SetCoordinateInfo(CurrentCoordinate.Value, true); } else { // Needed for body masks var forceNeededParts = new[] { ChaFileDefine.ClothesKind.top, ChaFileDefine.ClothesKind.bra }; foreach (var clothesKind in forceNeededParts) { ForceClothesReload(clothesKind); } if (onlyMasks) { return; } var allParts = Enum.GetValues(typeof(ChaFileDefine.ClothesKind)).Cast <ChaFileDefine.ClothesKind>(); foreach (var clothesKind in allParts.Except(forceNeededParts)) { ChaControl.ChangeCustomClothes(true, (int)clothesKind, true, false, false, false, false); } // Triggered by ForceClothesReload on top so not necessary //for (var i = 0; i < ChaControl.cusClothesSubCmp.Length; i++) // ChaControl.ChangeCustomClothes(false, i, true, false, false, false, false); } #elif EC if (MakerAPI.InsideMaker && onlyMasks) { // Need to do the more aggresive version in maker to allow for clearing the mask without a character reload var forceNeededParts = new[] { ChaFileDefine.ClothesKind.top, ChaFileDefine.ClothesKind.bra }; foreach (var clothesKind in forceNeededParts) { ForceClothesReload(clothesKind); } } else { // Need to manually set the textures because calling ChangeClothesAsync (through ForceClothesReload) // to make the game do it results in a crash when editing nodes in a scene if (ChaControl.customMatBody) { Texture overlayTex = GetOverlayTex(MaskKind.BodyMask.ToString(), false)?.Texture; if (overlayTex != null) { ChaControl.customMatBody.SetTexture(ChaShader._AlphaMask, overlayTex); } } if (ChaControl.rendBra != null) { Texture overlayTex = GetOverlayTex(MaskKind.BraMask.ToString(), false)?.Texture; if (overlayTex != null) { if (ChaControl.rendBra[0]) { ChaControl.rendBra[0].material.SetTexture(ChaShader._AlphaMask, overlayTex); } if (ChaControl.rendBra[1]) { ChaControl.rendBra[1].material.SetTexture(ChaShader._AlphaMask, overlayTex); } } } if (ChaControl.rendInner != null) { Texture overlayTex = GetOverlayTex(MaskKind.InnerMask.ToString(), false)?.Texture; if (overlayTex != null) { if (ChaControl.rendInner[0]) { ChaControl.rendInner[0].material.SetTexture(ChaShader._AlphaMask, overlayTex); } if (ChaControl.rendInner[1]) { ChaControl.rendInner[1].material.SetTexture(ChaShader._AlphaMask, overlayTex); } } } } if (onlyMasks) { return; } var allParts = Enum.GetValues(typeof(ChaFileDefine.ClothesKind)).Cast <ChaFileDefine.ClothesKind>(); foreach (var clothesKind in allParts) { ChaControl.ChangeCustomClothes(true, (int)clothesKind, true, false, false, false, false); } for (var i = 0; i < ChaControl.cusClothesSubCmp.Length; i++) { ChaControl.ChangeCustomClothes(false, i, true, false, false, false, false); } #endif }