/// <summary>
            /// Apply adjustments to breast dynamic bones
            /// </summary>
            private void UpdateBreastDB(DynamicBone_Ver02 dynamicBone)
            {
                if (!BreastDBComments.Contains(dynamicBone.Comment))
                {
                    return;
                }

                //Expand the collision radius for the breast dynamic bones
                foreach (var pat in dynamicBone.Patterns)
                {
#if KK
                    pat.Params[0].CollisionRadius = BreastCollidersEnabled ? 0.08f * BreastCollisionRadiusMultiplier : 0;
                    pat.Params[1].CollisionRadius = BreastCollidersEnabled ? 0.06f * BreastCollisionRadiusMultiplier : 0;
#elif AI
                    pat.Params[2].CollisionRadius = BreastCollidersEnabled ? 0.8f * BreastCollisionRadiusMultiplier : 0;
                    pat.Params[3].CollisionRadius = BreastCollidersEnabled ? 0.6f * BreastCollisionRadiusMultiplier : 0;
#else
                    throw new System.NotImplementedException();
#endif
                }

                dynamicBone.GetType().GetMethod("InitNodeParticle", AccessTools.all).Invoke(dynamicBone, null);
                dynamicBone.GetType().GetMethod("SetupParticles", AccessTools.all).Invoke(dynamicBone, null);
                dynamicBone.InitLocalPosition();
                if ((bool)dynamicBone.GetType().GetMethod("IsRefTransform", AccessTools.all).Invoke(dynamicBone, null))
                {
                    dynamicBone.setPtn(0, true);
                }
                dynamicBone.GetType().GetMethod("InitTransforms", AccessTools.all).Invoke(dynamicBone, null);
            }
            /// <summary>
            /// Apply adjustments to breast dynamic bones
            /// </summary>
            private void UpdateBreastDB(DynamicBone_Ver02 dynamicBone)
            {
                if (!BreastDBComments.Contains(dynamicBone.Comment))
                {
                    return;
                }

                //Expand the collision radius for the breast dynamic bones
                for (var index = 0; index < dynamicBone.Patterns.Count; index++)
                {
                    var pat = dynamicBone.Patterns[index];
#if KK || KKS
                    pat.Params[0].CollisionRadius = BreastCollidersEnabled ? 0.10f * BreastSize : 0;
                    pat.Params[1].CollisionRadius = BreastCollidersEnabled ? 0.08f * BreastSize : 0;
#elif AI || HS2
                    pat.Params[2].CollisionRadius = BreastCollidersEnabled ? 1.0f * BreastSize : 0;
                    pat.Params[3].CollisionRadius = BreastCollidersEnabled ? 0.8f * BreastSize : 0;
#endif
                }

                dynamicBone.GetType().GetMethod("InitNodeParticle", AccessTools.all).Invoke(dynamicBone, null);
                dynamicBone.GetType().GetMethod("SetupParticles", AccessTools.all).Invoke(dynamicBone, null);
                dynamicBone.InitLocalPosition();
                if ((bool)dynamicBone.GetType().GetMethod("IsRefTransform", AccessTools.all).Invoke(dynamicBone, null))
                {
                    dynamicBone.setPtn(0, true);
                }
                dynamicBone.GetType().GetMethod("InitTransforms", AccessTools.all).Invoke(dynamicBone, null);
            }
Exemplo n.º 3
0
        public bool CopyTo(DynamicBone_Ver02 target)
        {
            FieldInfo fieldInfo = target.GetType().GetField("Particles", BindingFlags.Instance | BindingFlags.NonPublic);
            List <DynamicBone_Ver02.Particle> dstParticles = fieldInfo.GetValue(target) as List <DynamicBone_Ver02.Particle>;

            if (parameters == null || particles == null)
            {
                return(false);
            }

            if (parameters.Count() != target.Patterns[0].Params.Count() ||
                particlesPtn.Count() != target.Patterns[0].ParticlePtns.Count() ||
                particles.Count() != dstParticles.Count())
            {
                return(false);
            }

            target.setGravity(0, gravity);

            for (int i = 0; i < parameters.Count(); i++)
            {
                target.Patterns[0].Params[i].IsRotationCalc = parameters[i].IsRotationCalc;
                target.Patterns[0].Params[i].Damping        = parameters[i].Damping;
                target.Patterns[0].Params[i].Elasticity     = parameters[i].Elasticity;
                target.Patterns[0].Params[i].Stiffness      = parameters[i].Stiffness;
                target.Patterns[0].Params[i].Inert          = parameters[i].Inert;
            }

            for (int i = 0; i < particlesPtn.Count(); i++)
            {
                target.Patterns[0].ParticlePtns[i].IsRotationCalc = particlesPtn[i].IsRotationCalc;
                target.Patterns[0].ParticlePtns[i].Damping        = particlesPtn[i].Damping;
                target.Patterns[0].ParticlePtns[i].Elasticity     = particlesPtn[i].Elasticity;
                target.Patterns[0].ParticlePtns[i].Stiffness      = particlesPtn[i].Stiffness;
                target.Patterns[0].ParticlePtns[i].Inert          = particlesPtn[i].Inert;
            }

            for (int i = 0; i < particles.Count(); i++)
            {
                dstParticles[i].IsRotationCalc = particles[i].IsRotationCalc;
                dstParticles[i].Damping        = particles[i].Damping;
                dstParticles[i].Elasticity     = particles[i].Elasticity;
                dstParticles[i].Stiffness      = particles[i].Stiffness;
                dstParticles[i].Inert          = particles[i].Inert;
            }

            return(true);
        }
Exemplo n.º 4
0
        public void CopyParamFrom(DynamicBone_Ver02 target)
        {
            gravity.Set(target.Gravity.x, target.Gravity.y, target.Gravity.z);
            parameters = new ParamBone[target.Patterns[0].Params.Count()];
            for (int i = 0; i < parameters.Count(); i++)
            {
                parameters[i] = new ParamBone("");
                parameters[i].IsRotationCalc = target.Patterns[0].Params[i].IsRotationCalc;
                parameters[i].Damping        = target.Patterns[0].Params[i].Damping;
                parameters[i].Elasticity     = target.Patterns[0].Params[i].Elasticity;
                parameters[i].Stiffness      = target.Patterns[0].Params[i].Stiffness;
                parameters[i].Inert          = target.Patterns[0].Params[i].Inert;
            }
            particlesPtn = new ParamBone[target.Patterns[0].ParticlePtns.Count()];
            for (int i = 0; i < particlesPtn.Count(); i++)
            {
                particlesPtn[i] = new ParamBone("");
                particlesPtn[i].IsRotationCalc = target.Patterns[0].ParticlePtns[i].IsRotationCalc;
                particlesPtn[i].Damping        = target.Patterns[0].ParticlePtns[i].Damping;
                particlesPtn[i].Elasticity     = target.Patterns[0].ParticlePtns[i].Elasticity;
                particlesPtn[i].Stiffness      = target.Patterns[0].ParticlePtns[i].Stiffness;
                particlesPtn[i].Inert          = target.Patterns[0].ParticlePtns[i].Inert;
            }

            FieldInfo fieldInfo = target.GetType().GetField("Particles", BindingFlags.Instance | BindingFlags.NonPublic);
            List <DynamicBone_Ver02.Particle> srcParticles = fieldInfo.GetValue(target) as List <DynamicBone_Ver02.Particle>;

            particles = new ParamBone[srcParticles.Count()];
            for (int i = 0; i < particles.Count(); i++)
            {
                particles[i] = new ParamBone("");
                particles[i].IsRotationCalc = srcParticles[i].IsRotationCalc;
                particles[i].Damping        = srcParticles[i].Damping;
                particles[i].Elasticity     = srcParticles[i].Elasticity;
                particles[i].Stiffness      = srcParticles[i].Stiffness;
                particles[i].Inert          = srcParticles[i].Inert;
            }
        }
        public static List <DynamicBone_Ver02.Particle> GetCharacterParticles(DynamicBone_Ver02 target)
        {
            FieldInfo particlesInfo = target.GetType().GetField("Particles", BindingFlags.Instance | BindingFlags.NonPublic);

            return(particlesInfo.GetValue(target) as List <DynamicBone_Ver02.Particle>);
        }