コード例 #1
0
            //TODO methods for screwing with the reducer dnas? Better if we can use fancy properties with indexers

            public void ApplyDNA(UMAData umaData, UMASkeleton skeleton, UMADnaBase activeDNA, float masterWeight = 1f)
            {
                _liveShapeWeight = _startingShapeWeight;

                //dna weight superceeds startingWeight if it exists
                if (_modifyingDNA.UsedDNANames.Count > 0)
                {
                    _liveShapeWeight = _modifyingDNA.Evaluate(activeDNA);
                }
                _liveShapeWeight = _liveShapeWeight * masterWeight;

                //In Unity 2018.3+ blendshapes can have negative values too, so in that case allow the value to go to -1
#if !UNITY_2018_3_OR_NEWER
                _liveShapeWeight = Mathf.Clamp(_liveShapeWeight, 0f, 1f);
#endif
                umaData.SetBlendShape(_blendshapeToApply, _liveShapeWeight);
            }
コード例 #2
0
 public float GetEvaluatedDNA(UMADnaBase umaDNA)
 {
     if (_modifyingDNA.Count > 0)
     {
         return(_modifyingDNA.Evaluate(umaDNA));
     }
     return(1f);               //if there is no modifying dna assume the overall scale is fully applied
 }
コード例 #3
0
            public void ApplyDNA(UMAData umaData, UMASkeleton skeleton, UMADnaBase activeDNA, float masterWeight = 1f)
            {
                if (_poseToApply == null)
                {
                    if (Debug.isDebugBuild)
                    {
                        Debug.LogWarning(umaData.gameObject.name + " had an invalid or empty pose set in its BonePoseDNAConverters in its DNAConverterController");
                    }
                    return;
                }
                _livePoseWeight = _startingPoseWeight;

                //dna weight superceeds startingWeight if it exists
                if (_modifyingDNA.UsedDNANames.Count > 0)
                {
                    _livePoseWeight = _modifyingDNA.Evaluate(activeDNA);
                }
                _livePoseWeight = _livePoseWeight * masterWeight;
                _livePoseWeight = Mathf.Clamp(_livePoseWeight, 0f, 1f);

                _poseToApply.ApplyPose(skeleton, _livePoseWeight);
            }