private void CreateOrReplaceLipsyncOverrideView(AnimationClip emptyClip, List <ManifestBinding> manifestBindings) { if (_activityStageName != null) { SharedLayerUtils.CreateParamIfNotExists(_animatorController, _activityStageName, AnimatorControllerParameterType.Int); } if (Feature(FeatureToggles.ExposeIsLipsyncLimited)) { SharedLayerUtils.CreateParamIfNotExists(_animatorController, SharedLayerUtils.HaiGestureComboIsLipsyncLimitedParamName, AnimatorControllerParameterType.Int); } if (Feature(FeatureToggles.ExposeDisableLipsyncOverride)) { SharedLayerUtils.CreateParamIfNotExists(_animatorController, SharedLayerUtils.HaiGestureComboDisableLipsyncOverrideParamName, AnimatorControllerParameterType.Int); } SharedLayerUtils.CreateParamIfNotExists(_animatorController, "Viseme", AnimatorControllerParameterType.Int); SharedLayerUtils.CreateParamIfNotExists(_animatorController, "_Hai_GestureAnimLSWide", AnimatorControllerParameterType.Float); new LayerForLipsyncOverrideView(_analogBlinkingUpperThreshold, _logicalAvatarMask, _animatorGenerator, _avatarDescriptor, _limitedLipsync, _assetContainer, emptyClip, manifestBindings, _conflictPrevention.ShouldWriteDefaults).Create(); }
private static void CreateOrReplaceSmoothing(AvatarMask weightCorrectionAvatarMask, AnimatorGenerator animatorGenerator, AnimatorController animatorController, ConflictPrevention conflictPrevention) { SharedLayerUtils.CreateParamIfNotExists(animatorController, SharedLayerUtils.HaiGestureComboLeftWeightSmoothing, AnimatorControllerParameterType.Float); SharedLayerUtils.CreateParamIfNotExists(animatorController, SharedLayerUtils.HaiGestureComboRightWeightSmoothing, AnimatorControllerParameterType.Float); SharedLayerUtils.CreateParamIfNotExists(animatorController, SharedLayerUtils.HaiGestureComboSmoothingFactor, AnimatorControllerParameterType.Float); new LayerForAnalogFistSmoothing(animatorGenerator, weightCorrectionAvatarMask, conflictPrevention.ShouldWriteDefaults, animatorController).Create(); }
private void CreateOrReplaceExpressionsView(AnimationClip emptyClip, List <ManifestBinding> manifestBindings) { CreateExpressionsViewParameters(_animatorController, _activityStageName); SharedLayerUtils.CreateParamIfNotExists(_animatorController, "_Hai_GestureAnimBlink", AnimatorControllerParameterType.Float); SharedLayerUtils.CreateParamIfNotExists(_animatorController, "_Hai_GestureAnimLSWide", AnimatorControllerParameterType.Float); var avatarFallbacks = new CgeAvatarSnapshot(_avatarDescriptor, _compilerFallbackParamList).CaptureFallbacks(); new LayerForExpressionsView( _featuresToggles, _animatorGenerator, _expressionsAvatarMask, emptyClip, _activityStageName, _conflictPrevention, _assetContainer, _compilerConflictFxLayerMode, _compilerIgnoreParamList, avatarFallbacks, new List <CurveKey>(), _animatorController, _comboLayers, _useGestureWeightCorrection, _useSmoothing, manifestBindings, "" ).Create(); }
private static void CreateOrReplaceWeightCorrection(AvatarMask weightCorrectionAvatarMask, AnimatorGenerator animatorGenerator, AnimatorController animatorController, ConflictPrevention conflictPrevention) { SharedLayerUtils.CreateParamIfNotExists(animatorController, "GestureLeft", AnimatorControllerParameterType.Int); SharedLayerUtils.CreateParamIfNotExists(animatorController, "GestureRight", AnimatorControllerParameterType.Int); SharedLayerUtils.CreateParamIfNotExists(animatorController, "GestureLeftWeight", AnimatorControllerParameterType.Float); SharedLayerUtils.CreateParamIfNotExists(animatorController, "GestureRightWeight", AnimatorControllerParameterType.Float); SharedLayerUtils.CreateParamIfNotExists(animatorController, SharedLayerUtils.HaiGestureComboLeftWeightProxy, AnimatorControllerParameterType.Float); SharedLayerUtils.CreateParamIfNotExists(animatorController, SharedLayerUtils.HaiGestureComboRightWeightProxy, AnimatorControllerParameterType.Float); new LayerForWeightCorrection(animatorGenerator, weightCorrectionAvatarMask, conflictPrevention.ShouldWriteDefaults).Create(); }
public void Create() { EditorUtility.DisplayProgressBar("GestureCombo", "Clearing expressions layer", 0f); var machine = ReinitializeLayer(); var defaultState = machine.AddState("Default", SharedLayerUtils.GridPosition(-1, -1)); defaultState.motion = _emptyClip; defaultState.writeDefaultValues = _conflictPrevention.ShouldWriteDefaults; if (_activityStageName != null) { CreateTransitionWhenActivityIsOutOfBounds(machine, defaultState); } var activityManifests = _manifestBindings; EditorUtility.DisplayProgressBar("GestureCombo", "Generating animations", 0f); _assetContainer.RemoveAssetsStartingWith("zAutogeneratedExp" + _animInfix + "_", typeof(AnimationClip)); _assetContainer.RemoveAssetsStartingWith("zAutogeneratedPup" + _animInfix + "_", typeof(BlendTree)); activityManifests = new AnimationNeutralizer( activityManifests, _compilerConflictFxLayerMode, _compilerIgnoreParamList, _compilerFallbackParamList, _blinkBlendshapes, _assetContainer, _conflictPrevention.ShouldGenerateExhaustiveAnimations, _emptyClip, Feature(FeatureToggles.DoNotFixSingleKeyframes) ).NeutralizeManifestAnimations(); // The blend tree auto weight corrector assumes that all of the Manifests' blend trees have been autogenerated. // This remains true as long as the Animation Neutralizer is executed before this. activityManifests = new CgeBlendTreeAutoWeightCorrector(activityManifests, _useGestureWeightCorrection, _useSmoothing, _assetContainer) .MutateAndCorrectExistingBlendTrees(); foreach (var parameter in AllParametersUsedByManifests(activityManifests)) { SharedLayerUtils.CreateParamIfNotExists(_animatorController, parameter, AnimatorControllerParameterType.Float); } var combinator = new IntermediateCombinator(activityManifests); new GestureCExpressionCombiner( _animatorController, machine, combinator.IntermediateToTransition, _activityStageName, _conflictPrevention.ShouldWriteDefaults, _useGestureWeightCorrection, _useSmoothing ).Populate(); }
private static void CreateExpressionsViewParameters(AnimatorController animatorController, string activityStageName) { if (activityStageName != null) { SharedLayerUtils.CreateParamIfNotExists(animatorController, activityStageName, AnimatorControllerParameterType.Int); } SharedLayerUtils.CreateParamIfNotExists(animatorController, "GestureLeft", AnimatorControllerParameterType.Int); SharedLayerUtils.CreateParamIfNotExists(animatorController, "GestureRight", AnimatorControllerParameterType.Int); SharedLayerUtils.CreateParamIfNotExists(animatorController, "GestureLeftWeight", AnimatorControllerParameterType.Float); SharedLayerUtils.CreateParamIfNotExists(animatorController, "GestureRightWeight", AnimatorControllerParameterType.Float); }
private void CreateOrReplaceBooleansToVirtualActivityMenu() { foreach (var mapper in _comboLayers) { if (!string.IsNullOrEmpty(mapper.booleanParameterName)) { SharedLayerUtils.CreateParamIfNotExists(_animatorController, mapper.booleanParameterName, AnimatorControllerParameterType.Bool); } } new LayerForBooleansToVirtualActivity(_animatorGenerator, _logicalAvatarMask, _conflictPrevention.ShouldWriteDefaults, _comboLayers).Create(); }
private void CreateOrReplaceBlinkingOverrideView(AnimationClip emptyClip, List <ManifestBinding> manifestBindings) { if (_activityStageName != null) { SharedLayerUtils.CreateParamIfNotExists(_animatorController, _activityStageName, AnimatorControllerParameterType.Int); } SharedLayerUtils.CreateParamIfNotExists(_animatorController, "_Hai_GestureAnimBlink", AnimatorControllerParameterType.Float); new LayerForBlinkingOverrideView( _activityStageName, _comboLayers, _analogBlinkingUpperThreshold, _logicalAvatarMask, _animatorGenerator, emptyClip, manifestBindings, _conflictPrevention.ShouldWriteDefaults).Create(); }
public void DoOverwriteAnimatorGesturePlayableLayer() { _animatorGenerator = new AnimatorGenerator(_gesturePlayableLayerController, new StatefulEmptyClipProvider(new ClipGenerator(_customEmptyClip, EmptyClipPath, "ComboGesture"))); var emptyClip = GetOrCreateEmptyClip(); if (_activityStageName != null) { SharedLayerUtils.CreateParamIfNotExists(_gesturePlayableLayerController, _activityStageName, AnimatorControllerParameterType.Int); } if (!Feature(FeatureToggles.DoNotGenerateWeightCorrectionLayer)) { if (_useGestureWeightCorrection) { CreateOrReplaceWeightCorrection(_gesturePlayableLayerTechnicalAvatarMask, _animatorGenerator, _gesturePlayableLayerController, _conflictPreventionTempGestureLayer); if (_useSmoothing) { CreateOrReplaceSmoothing(_weightCorrectionAvatarMask, _animatorGenerator, _gesturePlayableLayerController, _conflictPreventionTempGestureLayer); } else { DeleteSmoothing(); } } else { DeleteWeightCorrection(); DeleteSmoothing(); } } var manifestBindings = CreateManifestBindings(emptyClip); CreateOrReplaceGesturePlayableLayerExpressionsView(emptyClip, manifestBindings); ReapAnimator(_gesturePlayableLayerController); AssetDatabase.Refresh(); EditorUtility.ClearProgressBar(); }
public void DoOverwriteAnimatorFxLayer() { _animatorGenerator = new AnimatorGenerator(_animatorController, new StatefulEmptyClipProvider(new ClipGenerator(_customEmptyClip, EmptyClipPath, "ComboGesture"))); var emptyClip = GetOrCreateEmptyClip(); if (_activityStageName != null) { SharedLayerUtils.CreateParamIfNotExists(_animatorController, _activityStageName, AnimatorControllerParameterType.Int); } DeleteDeprecatedControllerLayer(); if (_parameterGeneration == ParameterGeneration.VirtualActivity) { CreateOrReplaceBooleansToVirtualActivityMenu(); } else { DeleteBooleansToVirtualActivityMenu(); } if (!Feature(FeatureToggles.DoNotGenerateWeightCorrectionLayer)) { if (_useGestureWeightCorrection) { CreateOrReplaceWeightCorrection(_weightCorrectionAvatarMask, _animatorGenerator, _animatorController, _conflictPrevention); if (_useSmoothing) { CreateOrReplaceSmoothing(_weightCorrectionAvatarMask, _animatorGenerator, _animatorController, _conflictPrevention); } else { DeleteSmoothing(); } } else { DeleteWeightCorrection(); DeleteSmoothing(); } } var manifestBindings = CreateManifestBindings(emptyClip); CreateOrReplaceExpressionsView(emptyClip, manifestBindings); if (!Feature(FeatureToggles.DoNotGenerateBlinkingOverrideLayer)) { CreateOrReplaceBlinkingOverrideView(emptyClip, manifestBindings); } if (!Feature(FeatureToggles.DoNotGenerateLipsyncOverrideLayer)) { if (_integrateLimitedLipsync && _avatarDescriptor != null && _avatarDescriptor.VisemeSkinnedMesh != null) { CreateOrReplaceLipsyncOverrideView(emptyClip, manifestBindings); } else { DeleteLipsyncOverrideView(); } } ReapAnimator(_animatorController); AssetDatabase.Refresh(); EditorUtility.ClearProgressBar(); }