Exemple #1
0
 internal void Create()
 {
     EditorUtility.DisplayProgressBar("GestureCombo", "Creating weight correction layer", 0f);
     InitializeMachineFor(
         _animatorGenerator.CreateOrRemakeLayerAtSameIndex(WeightCorrectionLeftLayerName, 1f, _weightCorrectionAvatarMask).ExposeMachine(),
         SharedLayerUtils.HaiGestureComboLeftWeightProxy,
         "GestureLeftWeight",
         "GestureLeft",
         LeftProxyClipPath
         );
     InitializeMachineFor(
         _animatorGenerator.CreateOrRemakeLayerAtSameIndex(WeightCorrectionRightLayerName, 1f, _weightCorrectionAvatarMask).ExposeMachine(),
         SharedLayerUtils.HaiGestureComboRightWeightProxy,
         "GestureRightWeight",
         "GestureRight",
         RightProxyClipPath
         );
 }
 internal void Create()
 {
     EditorUtility.DisplayProgressBar("GestureCombo", "Creating weight correction layer", 0f);
     InitializeMachineFor(
         _animatorGenerator.CreateOrRemakeLayerAtSameIndex(SmoothingLeftLayerName, 1f, _weightCorrectionAvatarMask),
         SharedLayerUtils.HaiGestureComboLeftWeightProxy,
         SharedLayerUtils.HaiGestureComboLeftWeightSmoothing,
         SmoothLeftZero,
         SmoothLeftOne
         );
     InitializeMachineFor(
         _animatorGenerator.CreateOrRemakeLayerAtSameIndex(SmoothingRightLayerName, 1f, _weightCorrectionAvatarMask),
         SharedLayerUtils.HaiGestureComboRightWeightProxy,
         SharedLayerUtils.HaiGestureComboRightWeightSmoothing,
         SmoothRightZero,
         SmoothRightOne
         );
 }
Exemple #3
0
 private Machinist ReinitializeLayerAsMachinist()
 {
     return(_animatorGenerator.CreateOrRemakeLayerAtSameIndex(VirtualActivityLayerName, 0f, _logicalAvatarMask));
 }
 private AnimatorStateMachine ReinitializeLayer()
 {
     return(_animatorGenerator.CreateOrRemakeLayerAtSameIndex(LipsyncLayerName, 1f, _logicalAvatarMask).ExposeMachine());
 }
 private AnimatorStateMachine ReinitializeLayer()
 {
     return(_animatorGenerator.CreateOrRemakeLayerAtSameIndex("Hai_GestureExp", 1f, _expressionsAvatarMask).ExposeMachine());
 }
Exemple #6
0
 private AnimatorStateMachine ReinitializeLayer()
 {
     return(_animatorGenerator.CreateOrRemakeLayerAtSameIndex("Hai_GestureBlinking", 0f, _logicalAvatarMask).ExposeMachine());
 }
        internal void CreateOrReplaceView()
        {
            var machinist = _animatorGenerator.CreateOrRemakeLayerAtSameIndex("Hai_J1I7T_View", 1f)
                            .WithEntryPosition(0, -3)
                            .WithExitPosition(0, -5);
            var init = machinist.NewState("Init", 1, -2)
                       .Drives(InitializedParameterist, false);
            var waiting = machinist.NewState("Waiting", 0, 0)
                          .Drives(InitializedParameterist, true);

            var assetContainer_Base = new AnimatorController();
            var assetContainer      = new AssetContainerist(assetContainer_Base)
                                      .GenerateAssetFileIn("", "GeneratedJ1I7T__", "");

            int     height      = 0;
            Statist previousOn  = init;
            Statist previousOff = null;

            foreach (var group in _manifest.Groups)
            {
                var groupParam    = new BoolParameterist(group.parameterName);
                var internalParam = new BoolParameterist("JHTIS_T_" + group.parameterName);
                var itemName      = group.parameterName;

                _animatorGenerator.CreateParamsAsNeeded(groupParam, internalParam);

                if (group.togglables.Count != 0)
                {
                    Dictionary <string, ToggleableInitialStateV2> subgroup = group.togglables
                                                                             .Where(togglable => togglable.item != null)
                                                                             .GroupBy(togglable => ResolveRelativePath(_manifest.Avatar.transform, togglable.item.transform))
                                                                             .ToDictionary(items => items.Key, items => items.First().initialState);

                    if (subgroup.Count != 0)
                    {
                        var clipForOn  = CreateClipToEnable(itemName, subgroup);
                        var clipForOff = CreateClipToDisable(itemName, subgroup);

                        var off = machinist.NewState($"{itemName} OFF", 2, height)
                                  .WithAnimation(clipForOff.Expose())
                                  .Drives(internalParam, false);
                        var on = machinist.NewState($"{itemName} ON", 3, height)
                                 .WithAnimation(clipForOn.Expose())
                                 .Drives(internalParam, true);

                        waiting.TransitionsTo(off).WithExitTimeTo(1f)
                        .When(groupParam).IsFalse()
                        .And(internalParam).IsTrue();
                        waiting.TransitionsTo(on).WithExitTimeTo(1f)
                        .When(groupParam).IsTrue()
                        .And(internalParam).IsFalse();

                        off.TransitionsTo(waiting).WithExitTimeTo(1f)
                        .When(InitializedParameterist).IsTrue();
                        on.TransitionsTo(waiting).WithExitTimeTo(1f)
                        .When(InitializedParameterist).IsTrue();

                        previousOn.TransitionsTo(off).WithExitTimeTo(1f)
                        .When(InitializedParameterist).IsFalse()
                        .And(groupParam).IsFalse();
                        previousOn.TransitionsTo(on).WithExitTimeTo(1f)
                        .When(InitializedParameterist).IsFalse()
                        .And(groupParam).IsTrue();

                        previousOff?.TransitionsTo(off).WithExitTimeTo(1f)
                        .When(InitializedParameterist).IsFalse()
                        .And(groupParam).IsFalse();
                        previousOff?.TransitionsTo(on).WithExitTimeTo(1f)
                        .When(InitializedParameterist).IsFalse()
                        .And(groupParam).IsTrue();

                        previousOff = off;
                        previousOn  = on;

                        assetContainer.Include(clipForOn);
                        assetContainer.Include(clipForOff);

                        height++;
                    }
                }
            }

            previousOn.AutomaticallyMovesTo(waiting);
            previousOff?.AutomaticallyMovesTo(waiting);

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }