public override BoneModifierData GetEffect(string bone, BoneController origin, CoordinateType coordinate)
        {
            // Ears...need extra help for some reason...
            bool hiddenBone = HiddenBones.Contains(bone);

            if (hiddenBone && bone.Equals(LEFT_EAR))
            {
                return(earHiddenBoneModifier);
            }
            else if (!hiddenBone && bone.Equals(LEFT_EAR) && ResetLeftEar)
            {
                origin.NeedsFullRefresh = true;
                ResetLeftEar            = false;
                return(null);
            }
            else if (hiddenBone && bone.Equals(RIGHT_EAR))
            {
                return(earHiddenBoneModifier);
            }
            else if (!hiddenBone && bone.Equals(RIGHT_EAR) && ResetRightEar)
            {
                origin.NeedsFullRefresh = true;
                ResetRightEar           = false;
                return(null);
            }
            else if (hiddenBone)
            {
                return(hiddenBoneModifier);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        public override BoneModifierData GetEffect(string bone, BoneController origin, CoordinateType coordinate)
        {
            var isPregnant = _controller.Data.IsPregnant;

            if (isPregnant)
            {
                if (_pregnancyFullValues.TryGetValue(bone, out var mod))
                {
                    var prEffect = GetPregnancyEffectPercent();
                    return(LerpModifier(mod, prEffect));
                }
            }

            if (isPregnant || _controller.IsInflated)
            {
                if (_bellyFullValues.TryGetValue(bone, out var mod))
                {
                    var prEffect  = GetPregnancyEffectPercent();
                    var infEffect = _controller.GetInflationEffectPercent() + prEffect / 2;

                    var bellySize = Mathf.Max(prEffect, infEffect);

                    return(LerpModifier(mod, bellySize));
                }
            }

            return(null);
        }
コード例 #3
0
        public override BoneModifierData GetEffect(string bone, BoneController origin, ChaFileDefine.CoordinateType coordinate)
        {
            switch (_controller.CurrentCrest)
            {
            case CrestType.vibrancy:
                if (_vibrancyBoneModifiers.TryGetValue(bone, out var kvp))
                {
                    var vibMod = kvp.Value;
                    if (_controller.Heroine != null)
                    {
                        // Effect increases the lewder the character is
                        var vibRatio = _controller.Heroine.lewdness / 120f + (int)_controller.Heroine.HExperience * 0.1f;
                        if (vibRatio != _previousVibRatio)
                        {
                            vibRatio          = Mathf.MoveTowards(_previousVibRatio, vibRatio, Time.deltaTime / 10);
                            _previousVibRatio = vibRatio;
                        }
                        vibMod.ScaleModifier = Vector3.Lerp(Vector3.one, kvp.Key, vibRatio);
                    }
                    else
                    {
                        // If outside of main game always set to max
                        vibMod.ScaleModifier = kvp.Key;
                    }
                    return(vibMod);
                }
                return(null);

            case CrestType.lactation:
                return(_lactationModifiers.TryGetValue(bone, out var lactMod) ? lactMod : null);

            default:
                return(null);
            }
        }
コード例 #4
0
        void Awake()
        {
            /*
             * if (cc != null)
             * {
             *  CreateNavMesh();
             *  cc.navMesh = navMesh;
             *  cc.Materials = Materials;
             * }
             */
            var anim = Node.GetComponent <Animator>() as Animator;

            bc      = anim.BoneController;
            physics = CoreEngine.pEngine;

            // bc.GetBone(4).SetTransform(Vector3.UnitX);
            //update++;
            //bc.GetBone(64).SetTransform(new Quaternion(0, 0, dec2rad(90)), new Vector3(0, 0, 0));
            // bc.UpdateSkeleton();
            // Console.WriteLine(bc.GetBone(65).TransformMatrix);
            //bc.GetBone(3).SetTransform(new Vector3(0, -0.5f, 0));

            /*
             * Console.WriteLine(bc.GetBone(67).World2BoneInitial);
             * Console.WriteLine(bc.GetBone(66).World2BoneInitial);
             * Console.WriteLine(bc.GetBone(66).InitialLocalTransform);
             */
        }
コード例 #5
0
 /// <summary>
 /// Skeleton constructor
 /// </summary>
 /// <param name="rSkeleton">Skeleton the motor is driving</param>
 public PoseMotor(BoneController rSkeleton)
     : base(rSkeleton)
 {
     FixedUpdateFPS       = 60f;
     IsFixedUpdateEnabled = false;
     IsEditorEnabled      = true;
 }
コード例 #6
0
 private void Awake()
 {
     MakerAPI.MakerFinishedLoading += (sender, args) =>
     {
         _ccv2 = FindObjectOfType <CameraControl_Ver2>();
         _boneControllerMgr = FindObjectOfType <BoneController>();
     };
 }
コード例 #7
0
        public override IEnumerable <string> GetAffectedBones(BoneController origin)
        {
            if (_controller.IsDuringPregnancy() || MakerAPI.InsideMaker || StudioAPI.InsideStudio)
            {
                return(_pregnancyFullValues.Keys);
            }

            return(Enumerable.Empty <string>());
        }
コード例 #8
0
        public override IEnumerable <string> GetAffectedBones(BoneController origin)
        {
            if (_controller.Data.IsPregnant || MakerAPI.InsideMaker || StudioAPI.InsideStudio || PregnancyGameController.InsideHScene)
            {
                return(_affectedBoneNames);
            }

            return(Enumerable.Empty <string>());
        }
コード例 #9
0
        public override BoneModifierData GetEffect(string bone, BoneController origin, ChaFileDefine.CoordinateType coordinate)
        {
            if (GetBulgeVisible() && bone == "cf_j_kokan")
            {
                _boneModifierData.ScaleModifier    = Vector3.Lerp(Vector3.one, _maxScale, _ctrl.BulgeSize);
                _boneModifierData.PositionModifier = Vector3.Lerp(Vector3.zero, _maxPosition, _ctrl.BulgeSize);
                return(_boneModifierData);
            }

            return(null);
        }
コード例 #10
0
 string regx;//匹配规则字符串
 void OnEnable()
 {
     skeletonRenderer   = serializedObject.FindProperty("skeletonRenderer");
     boneName           = serializedObject.FindProperty("boneName");
     followBoneRotation = serializedObject.FindProperty("followBoneRotation");
     followZPosition    = serializedObject.FindProperty("followZPosition");
     followPosition     = serializedObject.FindProperty("followPosition");
     mode      = serializedObject.FindProperty("mode");
     component = (BoneController)target;
     ForceReload();
 }
コード例 #11
0
ファイル: KKABMX_GUI.cs プロジェクト: arocarlisle/KKABMX
        private void OnMakerExiting(object sender, EventArgs e)
        {
            _updateActionList.Clear();
            _boneController = null;

            var reg = GetRegistration();

            reg.MaintainState           = false;
            reg.MaintainCoordinateState = false;

            Destroy(gameObject.GetComponent <KKABMX_AdvancedGUI>());
        }
コード例 #12
0
        public override IEnumerable <string> GetAffectedBones(BoneController origin)
        {
            switch (_controller.CurrentCrest)
            {
            case CrestType.vibrancy:
                return(_vibrancyBones);

            case CrestType.lactation:
                return(_lactationBones);

            default:
                return(Enumerable.Empty <string>());
            }
        }
コード例 #13
0
        /// <summary>
        /// Render out the skeleton using bones from this helper
        /// </summary>
        /// <param name="rSkeleton"></param>
        /// <param name="rColor"></param>
        public static void DrawSkeleton(BoneController rSkeleton, Color rBoneColor, Color rColliderColor)
        {
#if UNITY_EDITOR

            if (rSkeleton == null || rSkeleton.RootTransform == null) { return; }

            for (int i = 0; i < rSkeleton.Bones.Count; i++)
            {
                DrawBone(rSkeleton.Bones[i], rBoneColor);
                DrawBoneCollider(rSkeleton.Bones[i], rColliderColor);
            }

#endif
        }
コード例 #14
0
        /// <summary>
        /// Due to Unity's serialization limit on nested objects (7 levels),
        /// we have to store the bones in a flat list and then reconstruct
        /// our hierarchy after deserialization.
        ///
        /// Also, object references aren't actually kept after deserialization.
        /// Instead, we get a new instance of the BoneControllerBone (parent and children). So,
        /// we need to reset the local object based on the index that was stored.
        ///
        /// This function is called AFTER the skeleton has been deserialized
        ///
        ///
        /// </summary>
        /// <param name="rSkeleton"></param>
        public override void OnAfterSkeletonDeserialized(BoneController rSkeleton)
        {
            base.OnAfterSkeletonDeserialized(rSkeleton);

            if (_TargetTransform == null && _TargetTransformName.Length > 0)
            {
                Transform[] lObjects = Resources.FindObjectsOfTypeAll <Transform>();
                for (int i = 0; i < lObjects.Length; i++)
                {
                    if (lObjects[i].name == _TargetTransformName)
                    {
                        _TargetTransform = lObjects[i];
                    }
                }
            }
        }
コード例 #15
0
ファイル: Mdl.cs プロジェクト: bonomali/Ibasa
 ImmutableArray <BoneController> LoadBoneControllers(Ibasa.IO.BinaryReader reader, int count)
 {
     BoneController[] boneControllers = new BoneController[count];
     for (int i = 0; i < count; ++i)
     {
         boneControllers[i] = new BoneController(
             reader.ReadInt32(),
             (BoneControllerType)reader.ReadInt32(),
             reader.ReadSingle(),
             reader.ReadSingle(),
             reader.ReadInt32(),
             reader.ReadInt32());
         reader.Seek(8 * 4, SeekOrigin.Current); //skip 8 ints
     }
     return(new ImmutableArray <BoneController>(boneControllers));
 }
コード例 #16
0
        private void CreateFootToGroundMotor(BoneController rBoneController, bool rIsRightSide)
        {
            string lName = rIsRightSide ? RightFootMotorName : LeftFootMotorName;
            FootGround2BoneMotor lMotor = rBoneController.GetMotor <FootGround2BoneMotor>(lName);

            if (lMotor == null)
            {
                lMotor = new FootGround2BoneMotor(rBoneController)
                {
                    Name = lName
                };
            }
            lMotor.RotateFootOnMovement = true;
            lMotor.AllowLegExtension    = true;
            lMotor.AutoLoadBones(rIsRightSide ? "Humanoid Right" : "Humanoid Left");
        }
コード例 #17
0
        public void ChangeOutfit(bool reset = false)
        {
            if (!_initialized)
            {
                ChaControl chaCtrl = ChaCtrl;

                kkabmx = chaCtrl.GetComponent <BoneController>();
                kcox   = chaCtrl.GetComponent <KoiClothesOverlayController>();
                ksox   = chaCtrl.GetComponent <KoiSkinOverlayController>();

                _initialized = true;
            }

            _lastRedressLocation = CharaBase.mapNo;
            ChangeOutfit_Internal(reset);
        }
コード例 #18
0
        public void ConfigureComponents()
        {
            BoneController lBoneController = mMotionController.GetOrAddComponent <BoneController>();

            lBoneController.EditorBoneFilters = mBoneFilters;
            Animator lAnimator = mMotionController.GetComponent <Animator>();

            lBoneController.RootTransform = lAnimator.GetBoneTransform(HumanBodyBones.Hips);

            if (SetBoneJoints)
            {
                if (IsHumanoidRig)
                {
                    lBoneController.SetHumanoidBoneJoints(0);
                }
                else
                {
                    lBoneController.SetBoneJoints(0);
                }
            }

            if (CreateBoneColliders)
            {
                if (IsHumanoidRig)
                {
                    lBoneController.SetHumanoidBoneColliders(0);
                }
                else
                {
                    lBoneController.SetBoneColliders(0);
                }
            }

            if (UseFootIK)
            {
                CreateFootToGroundMotor(lBoneController, true);
                CreateFootToGroundMotor(lBoneController, false);
            }

            if (UseHandIK)
            {
                // Not using right hand IK for anything yet
                //CreateLimbReachMotor(lBoneController, true);
                CreateLimbReachMotor(lBoneController, false);
            }
        }
コード例 #19
0
        public override BoneModifierData GetEffect(string bone, BoneController origin, ChaFileDefine.CoordinateType coordinate)
        {
            if (_controller.IsDuringPregnancy())
            {
                if (_pregnancyFullValues.TryGetValue(bone, out var mod))
                {
                    var bellySize = _controller.GetBellySizePercent();
                    return(new BoneModifierData(
                               new Vector3(
                                   Mathf.Lerp(1f, mod.ScaleModifier.x, bellySize),
                                   Mathf.Lerp(1f, mod.ScaleModifier.y, bellySize),
                                   Mathf.Lerp(1f, mod.ScaleModifier.z, bellySize)),
                               Mathf.Lerp(1f, mod.LengthModifier, bellySize)));
                }
            }

            return(null);
        }
コード例 #20
0
        /// <summary>
        /// Due to Unity's serialization limit on nested objects (7 levels),
        /// we have to store the bones in a flat list and then reconstruct
        /// our hierarchy after deserialization.
        ///
        /// This function is called BEFORE the skeleton is serialized
        /// </summary>
        /// <param name="rSkeleton"></param>
        public void OnBeforeSkeletonSerialized(BoneController rSkeleton)
        {
            if (mSkeleton == null)
            {
                return;
            }
            if (mSkeleton != rSkeleton)
            {
                return;
            }

            // Grab the indexes of the bones
            SerializationBoneIndexes.Clear();
            for (int i = 0; i < mBones.Count; i++)
            {
                SerializationBoneIndexes.Add(mSkeleton.Bones.IndexOf(mBones[i]));
            }
        }
コード例 #21
0
        public override BoneModifierData GetEffect(string bone, BoneController origin,
                                                   ChaFileDefine.CoordinateType coordinate)
        {
            switch (bone)
            {
            case "cf_d_bnip01_L":
                return(_nipModifierL);

            case "cf_d_bnip01_R":
                return(_nipModifierR);

            case "cf_d_ana":
                return(_anaModifier);

            default:
                return(null);
            }
        }
コード例 #22
0
        /// <summary>
        /// Due to Unity's serialization limit on nested objects (7 levels),
        /// we have to store the bones in a flat list and then reconstruct
        /// our hierarchy after deserialization.
        ///
        /// Also, object references aren't actually kept after deserialization.
        /// Instead, we get a new instance of the BoneControllerBone (parent and children). So,
        /// we need to reset the local object based on the index that was stored.
        ///
        /// This function is called AFTER the skeleton has been deserialized
        ///
        ///
        /// </summary>
        /// <param name="rSkeleton"></param>
        public virtual void OnAfterSkeletonDeserialized(BoneController rSkeleton)
        {
            mSkeleton = rSkeleton;

            // Reload the bones based on the IDs that we serialized earlier.
            // We do this since the references aren't kept as expected. We can't
            // call the LoadBones() function because the test for mSkeleton == null
            // isn't allowed on the load thread.
            mBones.Clear();
            for (int i = 0; i < SerializationBoneIndexes.Count; i++)
            {
                if (SerializationBoneIndexes[i] >= 0)
                {
                    mBones.Add(mSkeleton.Bones[SerializationBoneIndexes[i]]);
                }
            }

            //Flag our bones as initialized and valid
            mIsValid = true;
        }
コード例 #23
0
        private void CreateLimbReachMotor(BoneController rBoneController, bool rIsRightSide)
        {
            string         lName  = rIsRightSide ? RightHandMotorName : LeftHandMotorName;
            LimbReachMotor lMotor = rBoneController.GetMotor <LimbReachMotor>(lName);

            if (lMotor == null)
            {
                lMotor = new LimbReachMotor(rBoneController)
                {
                    Name = lName
                };
            }

            // Left Hand IK on weapon
            if (!rIsRightSide)
            {
                lMotor.Bone2Extension = 0.075f;
            }
            lMotor.AutoLoadBones(rIsRightSide ? "Humanoid Right Arm" : "Humanoid Left Arm");
        }
コード例 #24
0
ファイル: KKABMX_GUI.cs プロジェクト: arocarlisle/KKABMX
        private void OnEarlyMakerFinishedLoading(object sender, RegisterCustomControlsEvent e)
        {
            _boneController = FindObjectOfType <BoneController>();
            if (_boneController == null)
            {
                Logger.Log(LogLevel.Error, "[KKABMX_GUI] Failed to find a BoneController or there are no bone modifiers");
                return;
            }

            _boneController.NewDataLoaded += (s, args) =>
            {
                foreach (var action in _updateActionList)
                {
                    action();
                }
            };

            gameObject.AddComponent <KKABMX_AdvancedGUI>().enabled = false;

            RegisterCustomControls(e);
        }
コード例 #25
0
ファイル: Mdl.cs プロジェクト: Frassle/Ibasa
 ImmutableArray<BoneController> LoadBoneControllers(Ibasa.IO.BinaryReader reader, int count)
 {
     BoneController[] boneControllers = new BoneController[count];
     for (int i = 0; i < count; ++i)
     {
         boneControllers[i] = new BoneController(
             reader.ReadInt32(),
             (BoneControllerType)reader.ReadInt32(),
             reader.ReadSingle(),
             reader.ReadSingle(),
             reader.ReadInt32(),
             reader.ReadInt32());
         reader.Seek(8 * 4, SeekOrigin.Current); //skip 8 ints
     }
     return new ImmutableArray<BoneController>(boneControllers);
 }
コード例 #26
0
 /// <summary>
 /// Skeleton constructor
 /// </summary>
 /// <param name="rSkeleton">Skeleton the motor is driving</param>
 public BindPoseMotor(BoneController rSkeleton)
     : base(rSkeleton)
 {
 }
コード例 #27
0
 public static void Disable()
 {
     _currentBoneController = null;
     _instance.enabled      = false;
 }
コード例 #28
0
 public static void Enable(BoneController controller)
 {
     _currentBoneController = controller;
     _instance.enabled      = controller != null;
     _currentCharacterName  = controller != null ? " - " + controller.ChaControl.fileParam.fullname : null;
 }
コード例 #29
0
 /// <summary>
 /// Skeleton constructor
 /// </summary>
 /// <param name="rSkeleton">Skeleton the motor is driving</param>
 public RotationMotor(BoneController rSkeleton)
     : base(rSkeleton)
 {
 }
コード例 #30
0
 /// <summary>
 /// Skeleton constructor
 /// </summary>
 /// <param name="rSkeleton">Skeleton the motor is driving</param>
 public ImpactMotor(BoneController rSkeleton)
     : base(rSkeleton)
 {
 }
コード例 #31
0
 void Start()
 {
     m_BoneController = GetComponentInParent <BoneController>();
 }