Ejemplo n.º 1
0
        private static bool Prefix(HEditGlobal __instance, ChaControl _chara, Motion.IK _ik, KinematicCtrl _kinematicCtrl)
        {
            if (_chara == null || _ik == null || _kinematicCtrl == null)
            {
                return(false);
            }

            for (int i = 0; i < 13; i++)
            {
                var area = _ik.areas[i];
                __instance.SetIKParent(_chara, _kinematicCtrl, area.parentCharaID, area.parentArea, i);
                __instance.SetIKPos(_kinematicCtrl.lstIKBone[i].changeAmount, area.amount);
            }
            return(false);
        }
Ejemplo n.º 2
0
        static void Postfix(HEditGlobal __instance, ChaControl _chara, Motion.IK _ik, KinematicCtrl _kinematicCtrl)
        {
            if (_chara == null || _ik == null || _kinematicCtrl == null)
            {
                return;
            }

            for (int i = 0; i < Hooks.NonHardcodedIKTargets.Length; i++)
            {
                int ikTargetIndex = (int)Hooks.NonHardcodedIKTargets[i];
                var area          = _ik.areas[ikTargetIndex];
                area.parentCharaID = -1;
                area.parentArea    = -1;
                __instance.SetIKParent(_chara, _kinematicCtrl, area.parentCharaID, area.parentArea, ikTargetIndex);
            }
        }
Ejemplo n.º 3
0
        static bool Prefix(MotionIKUI __instance, ChaControl _chara, Motion.IK _ik, FullBodyBipedIK _fullBodyIK, KinematicCtrl _kinematicCtrl, int _charaID)
        {
            if (_ik == null || _fullBodyIK == null || _kinematicCtrl == null)
            {
                return(false);
            }
            var hEditInstance = Singleton <HEditGlobal> .Instance;

            var nowPartCharaInfo = hEditInstance.nowPartCharaInfo;

            hEditInstance.nowPartCharaInfo = null;
            if (_ik.isUse)
            {
                _kinematicCtrl.Active(PoseInfo.ModeEN.IK, false);
            }

            var effectors = new IKEffector[] { _fullBodyIK.solver.bodyEffector,
                                               _fullBodyIK.solver.leftShoulderEffector, _fullBodyIK.solver.leftHandEffector,
                                               _fullBodyIK.solver.rightShoulderEffector, _fullBodyIK.solver.rightHandEffector,
                                               _fullBodyIK.solver.leftThighEffector, _fullBodyIK.solver.leftFootEffector,
                                               _fullBodyIK.solver.rightThighEffector, _fullBodyIK.solver.rightFootEffector };

            var chains = new FBIKChain[] { _fullBodyIK.solver.leftArmChain, _fullBodyIK.solver.rightArmChain,
                                           _fullBodyIK.solver.leftLegChain, _fullBodyIK.solver.rightLegChain };

            for (int i = 0; i < EffectorIndices.Length; i++)
            {
                var targetIndex = EffectorIndices[i];
                var effector    = effectors[i];
                var area        = _ik.areas[targetIndex];
                SetIKUse(__instance, targetIndex, effector, area.isUse, _kinematicCtrl, false);
                SetIKWeight(__instance, targetIndex, effector, area.isUse, area.weight, false);
                hEditInstance.SetIKParent(_chara, _kinematicCtrl, area.parentCharaID, area.parentArea, targetIndex);
                hEditInstance.SetIKPos(_kinematicCtrl.lstIKBone[targetIndex].changeAmount, area.amount);
            }

            for (int i = 0; i < ChainIndices.Length; i++)
            {
                var targetIndex = ChainIndices[i];
                var chain       = chains[i];
                var area        = _ik.areas[targetIndex];
                SetIKUse(__instance, targetIndex, chain, area.isUse, _kinematicCtrl, false);
                SetIKWeight(__instance, targetIndex, chain, area.isUse, area.weight, false);
                hEditInstance.SetIKParent(_chara, _kinematicCtrl, area.parentCharaID, area.parentArea, targetIndex);
                hEditInstance.SetIKPos(_kinematicCtrl.lstIKBone[targetIndex].changeAmount, area.amount);
            }

            if (!_ik.isUse)
            {
                _kinematicCtrl.Active(PoseInfo.ModeEN.None, false);
            }
            else if (__instance.CharaInfoData != null && __instance.CharaInfoData.useCharaID != _charaID)
            {
                hEditInstance.KinematicCtrlAllVisible(_kinematicCtrl, false);
            }
            hEditInstance.nowPartCharaInfo = nowPartCharaInfo;
            return(false);
        }
Ejemplo n.º 4
0
 private static void SetIKUse(MotionIKUI instance, int area, FBIKChain chain, bool isOn, KinematicCtrl kinematicCtrl, bool isSave)
 {
     SetIKUseChainMethod.Invoke(instance, new object[] { area, chain, isOn, kinematicCtrl, isSave });
 }
Ejemplo n.º 5
0
 private static void SetIKUse(MotionIKUI instance, int area, IKEffector effector, bool isOn, KinematicCtrl kinematicCtrl, bool isSave)
 {
     SetIKUseEffectorMethod.Invoke(instance, new object[] { area, effector, isOn, kinematicCtrl, isSave });
 }
Ejemplo n.º 6
0
        static void Postfix(HEditGlobal __instance, ChaControl _chara, Motion.IK _ik, KinematicCtrl _kinematicCtrl)
        {
            if (_chara == null || _ik == null || _kinematicCtrl == null)
            {
                return;
            }

            for (int i = 0; i < Hooks.NonHardcodedIKTargets.Length; i++)
            {
                int ikTargetIndex = (int)Hooks.NonHardcodedIKTargets[i];
                var area          = _ik.areas[ikTargetIndex];
                var bone          = _kinematicCtrl.lstIKBone[ikTargetIndex];
                // The IK targets not hardcoded to have IK parents don't have this method called for them
                __instance.SetIKParent(_chara, _kinematicCtrl, area.parentCharaID, area.parentArea, ikTargetIndex);
                // Then we need to call these to make sure everything is set up
                __instance.SetIKPos(bone.changeAmount, area.amount);
                bone.CalcTransform();
            }
        }