/// <summary> /// Enable simultaneous kinematics for the specified OCIChar /// </summary> public static void EnableFKIK(OCIChar ociChar) { //Store the original neck look pattern var origPtn = ociChar.neckLookCtrl.ptnNo; ociChar.oiCharInfo.enableIK = true; ociChar.ActiveIK(BoneGroup.Body, ociChar.oiCharInfo.activeIK[0], true); ociChar.ActiveIK(BoneGroup.RightLeg, ociChar.oiCharInfo.activeIK[1], true); ociChar.ActiveIK(BoneGroup.LeftLeg, ociChar.oiCharInfo.activeIK[2], true); ociChar.ActiveIK(BoneGroup.RightArm, ociChar.oiCharInfo.activeIK[3], true); ociChar.ActiveIK(BoneGroup.LeftArm, ociChar.oiCharInfo.activeIK[4], true); ociChar.ActiveKinematicMode(OICharInfo.KinematicMode.IK, true, true); ociChar.oiCharInfo.activeFK[3] = false; ociChar.fkCtrl.enabled = true; ociChar.oiCharInfo.enableFK = true; for (int j = 0; j < FKCtrl.parts.Length; j++) { ociChar.ActiveFK(FKCtrl.parts[j], ociChar.oiCharInfo.activeFK[j], true); } //Restore the original neck look pattern which will have been overwritten if (origPtn != ociChar.neckLookCtrl.ptnNo) { ociChar.ChangeLookNeckPtn(origPtn); } }
public void Apply(OCIChar _char) { _char.LoadAnime(this.group, this.category, this.no, this.normalizedTime); for (int index = 0; index < this.activeIK.Length; ++index) { _char.ActiveIK((OIBoneInfo.BoneGroup)(1 << index), this.activeIK[index], false); } _char.ActiveKinematicMode(OICharInfo.KinematicMode.IK, this.enableIK, true); foreach (KeyValuePair <int, ChangeAmount> keyValuePair in this.dicIK) { _char.oiCharInfo.ikTarget[keyValuePair.Key].changeAmount.Copy(keyValuePair.Value, true, true, true); } for (int index = 0; index < this.activeFK.Length; ++index) { _char.ActiveFK(FKCtrl.parts[index], this.activeFK[index], false); } _char.ActiveKinematicMode(OICharInfo.KinematicMode.FK, this.enableFK, true); foreach (KeyValuePair <int, ChangeAmount> keyValuePair in this.dicFK) { _char.oiCharInfo.bones[keyValuePair.Key].changeAmount.Copy(keyValuePair.Value, true, true, true); } for (int _category = 0; _category < this.expression.Length; ++_category) { _char.EnableExpressionCategory(_category, this.expression[_category]); } }
public static bool ApplyPrefix(OCIChar _char, PauseCtrl.FileInfo __instance) { _char.LoadAnime(__instance.group, __instance.category, __instance.no, __instance.normalizedTime); for (int i = 0; i < __instance.activeIK.Length; i++) { _char.ActiveIK((OIBoneInfo.BoneGroup)(1 << i), __instance.activeIK[i], false); } _char.ActiveKinematicMode(OICharInfo.KinematicMode.IK, __instance.enableIK, true); foreach (KeyValuePair <int, ChangeAmount> keyValuePair in __instance.dicIK) { _char.oiCharInfo.ikTarget[keyValuePair.Key].changeAmount.Copy(keyValuePair.Value, true, true, true); } for (int j = 0; j < __instance.activeFK.Length; j++) { _char.ActiveFK(FKCtrl.parts[j], __instance.activeFK[j], false); } _char.ActiveKinematicMode(OICharInfo.KinematicMode.FK, __instance.enableFK, true); foreach (KeyValuePair <int, ChangeAmount> keyValuePair2 in __instance.dicFK) { _char.oiCharInfo.bones.TryGetValue(keyValuePair2.Key, out OIBoneInfo value); value?.changeAmount.Copy(keyValuePair2.Value, true, true, true); } for (int k = 0; k < __instance.expression.Length; k++) { _char.EnableExpressionCategory(k, __instance.expression[k]); } return(false); }
/// <summary> /// Enable simultaneous kinematics for the specified OCIChar /// </summary> public static void EnableFKIK(OCIChar ociChar) { ociChar.oiCharInfo.enableIK = true; ociChar.ActiveIK(BoneGroup.Body, ociChar.oiCharInfo.activeIK[0], true); ociChar.ActiveIK(BoneGroup.RightLeg, ociChar.oiCharInfo.activeIK[1], true); ociChar.ActiveIK(BoneGroup.LeftLeg, ociChar.oiCharInfo.activeIK[2], true); ociChar.ActiveIK(BoneGroup.RightArm, ociChar.oiCharInfo.activeIK[3], true); ociChar.ActiveIK(BoneGroup.LeftArm, ociChar.oiCharInfo.activeIK[4], true); ociChar.ActiveKinematicMode(OICharInfo.KinematicMode.IK, true, true); ociChar.oiCharInfo.activeFK[3] = false; ociChar.fkCtrl.enabled = true; ociChar.oiCharInfo.enableFK = true; for (int j = 0; j < FKCtrl.parts.Length; j++) { ociChar.ActiveFK(FKCtrl.parts[j], ociChar.oiCharInfo.activeFK[j], true); } }
internal static bool Apply(PauseCtrl.FileInfo __instance, OCIChar _char) { //AI and KK pose files are apparently indistinguishable from each other //If the user is holding ctrl while loading the pose correct the right hand FK bool correctHand = false; if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { correctHand = true; } //326 is a bone that exists in HS but not KK, check that to see if this is a loaded HS pose bool HSPose = __instance.dicFK.Keys.Any(x => x == 326); #if KK //Honey Select poses always need the right hand corrected in KK if (HSPose) { correctHand = true; } #endif if (!HSPose && !correctHand) { return(true); } #region Vanilla Code _char.LoadAnime(__instance.group, __instance.category, __instance.no, __instance.normalizedTime); for (int i = 0; i < __instance.activeIK.Length; i++) { _char.ActiveIK((OIBoneInfo.BoneGroup)(1 << i), __instance.activeIK[i]); } _char.ActiveKinematicMode(OICharInfo.KinematicMode.IK, __instance.enableIK, _force: true); foreach (KeyValuePair <int, ChangeAmount> item in __instance.dicIK) { _char.oiCharInfo.ikTarget[item.Key].changeAmount.Copy(item.Value); } for (int j = 0; j < __instance.activeFK.Length; j++) { _char.ActiveFK(FKCtrl.parts[j], __instance.activeFK[j]); } _char.ActiveKinematicMode(OICharInfo.KinematicMode.FK, __instance.enableFK, _force: true); #endregion foreach (KeyValuePair <int, ChangeAmount> item2 in __instance.dicFK) { int key = item2.Key; if (HSPose) { //Breasts translated from HS to KK/AI if (key == 326) { key = 53; } if (key == 327) { key = 54; } if (key == 328) { key = 55; } if (key == 329) { key = 56; } if (key == 330) { key = 57; } if (key == 332) { key = 59; } if (key == 333) { key = 60; } if (key == 334) { key = 61; } if (key == 335) { key = 62; } if (key == 336) { key = 63; } } if (_char.oiCharInfo.bones.TryGetValue(key, out var oIBoneInfo)) { if (correctHand) { //Correct the right hand if (key == 22 || key == 25 || key == 28 || key == 31 || key == 34) { item2.Value.rot = new Vector3(-item2.Value.rot.x, 180 + item2.Value.rot.y, 180 - item2.Value.rot.z); } if (key == 23 || key == 26 || key == 29 || key == 32 || key == 35) { item2.Value.rot = new Vector3(item2.Value.rot.x, -item2.Value.rot.y, -item2.Value.rot.z); } if (key == 24 || key == 27 || key == 30 || key == 33 || key == 36) { item2.Value.rot = new Vector3(item2.Value.rot.x, -item2.Value.rot.y, -item2.Value.rot.z); } } oIBoneInfo.changeAmount.Copy(item2.Value); } } #region Vanilla Code for (int k = 0; k < __instance.expression.Length; k++) { _char.EnableExpressionCategory(k, __instance.expression[k]); } #endregion return(false); }