public LayerForExpressionsView(FeatureToggles featuresToggles,
                                AnimatorGenerator animatorGenerator,
                                AvatarMask expressionsAvatarMask,
                                AnimationClip emptyClip,
                                string activityStageName,
                                ConflictPrevention conflictPrevention,
                                AssetContainer assetContainer,
                                ConflictFxLayerMode compilerConflictFxLayerMode,
                                AnimationClip compilerIgnoreParamList,
                                AnimationClip compilerFallbackParamList,
                                List <CurveKey> blinkBlendshapes,
                                AnimatorController animatorController,
                                List <GestureComboStageMapper> comboLayers,
                                bool useGestureWeightCorrection,
                                bool useSmoothing,
                                List <ManifestBinding> manifestBindings,
                                string animInfix)
 {
     _featuresToggles             = featuresToggles;
     _animatorGenerator           = animatorGenerator;
     _expressionsAvatarMask       = expressionsAvatarMask;
     _emptyClip                   = emptyClip;
     _activityStageName           = activityStageName;
     _conflictPrevention          = conflictPrevention;
     _assetContainer              = assetContainer;
     _compilerConflictFxLayerMode = compilerConflictFxLayerMode;
     _compilerIgnoreParamList     = compilerIgnoreParamList;
     _compilerFallbackParamList   = compilerFallbackParamList;
     _blinkBlendshapes            = blinkBlendshapes;
     _animatorController          = animatorController;
     _comboLayers                 = comboLayers;
     _useGestureWeightCorrection  = useGestureWeightCorrection;
     _useSmoothing                = useSmoothing;
     _manifestBindings            = manifestBindings;
     _animInfix                   = animInfix;
 }
Example #2
0
 public CgeBlendTreeAutoWeightCorrector(List <ManifestBinding> activityManifests, bool useGestureWeightCorrection, bool useSmoothing, AssetContainer assetContainer)
 {
     _activityManifests          = activityManifests;
     _useGestureWeightCorrection = useGestureWeightCorrection;
     _useSmoothing   = useSmoothing;
     _assetContainer = assetContainer;
 }
        private Dictionary <QualifiedAnimation, AnimationClip> CreateAssetContainerWithNeutralizedAnimations(AssetContainer container, HashSet <QualifiedAnimation> allQualifiedAnimations, HashSet <CurveKey> allApplicableCurveKeys)
        {
            var shouldGenerateAnimatedAnimatorParameters = _compilerConflictFxLayerMode != ConflictFxLayerMode.KeepOnlyTransformsAndMuscles && _compilerConflictFxLayerMode != ConflictFxLayerMode.KeepOnlyTransforms;

            var technicalCommonEmptyClip = Object.Instantiate(_emptyClip);

            technicalCommonEmptyClip.name = "zAutogeneratedExp_EmptyTechnical_DO_NOT_EDIT";
            container.AddAnimation(technicalCommonEmptyClip);

            var remapping = new Dictionary <QualifiedAnimation, AnimationClip>();

            foreach (var qualifiedAnimation in allQualifiedAnimations)
            {
                var neutralizedAnimation = CopyAndNeutralize(qualifiedAnimation.Clip, allApplicableCurveKeys, _useExhaustiveAnimations);

                var neutralizedAnimationHasNothingInIt = AnimationUtility.GetCurveBindings(neutralizedAnimation).Length == 0;
                if (shouldGenerateAnimatedAnimatorParameters)
                {
                    if (neutralizedAnimationHasNothingInIt)
                    {
                        Keyframe[] keyframes = { new Keyframe(0, 0), new Keyframe(1 / 60f, 0) };
                        var        curve     = new AnimationCurve(keyframes);
                        neutralizedAnimation.SetCurve("_ignored", typeof(GameObject), "m_IsActive", curve);
                    }

                    MutateCurvesForAnimatedAnimatorParameters(neutralizedAnimation, qualifiedAnimation);
                    container.AddAnimation(neutralizedAnimation);
                }
                else if (neutralizedAnimationHasNothingInIt)
                {
                    // This will help the optimization phase later, as, this avoids creating a complex animator equality comparator for most cases
                    neutralizedAnimation = technicalCommonEmptyClip;
                }
                else
                {
                    container.AddAnimation(neutralizedAnimation);
                }

                remapping.Add(qualifiedAnimation, neutralizedAnimation);
            }

            return(remapping);
        }