public static IManifest FromMoodSet(ComboGestureMoodSet moodSet, AnimationClip fallbackWhenAnyClipIsNull)
        {
            switch (moodSet)
            {
            case ComboGestureActivity activity:
                return(activity == null
                        ? ManifestFromActivity.FromNothing(fallbackWhenAnyClipIsNull) // TODO: It may be possible to create a specific manifest for that
                        : ManifestFromActivity.FromActivity(activity, fallbackWhenAnyClipIsNull));

            case ComboGesturePuppet puppet:
                return(ManifestFromPuppet.FromPuppet(puppet));

            case ComboGestureMassiveBlend massive:
                return(ManifestFromMassiveBlend.FromMassiveBlend(massive, fallbackWhenAnyClipIsNull));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public static IManifest FromMapper(GestureComboStageMapper mapper, AnimationClip fallbackWhenAnyClipIsNull)
        {
            switch (mapper.kind)
            {
            case GestureComboStageKind.Activity:
                return(mapper.activity == null
                        ? ManifestFromActivity.FromNothing(fallbackWhenAnyClipIsNull) // TODO: It may be possible to create a specific manifest for that
                        : ManifestFromActivity.FromActivity(mapper.activity, fallbackWhenAnyClipIsNull));

            case GestureComboStageKind.Puppet:
                return(ManifestFromPuppet.FromPuppet(mapper.puppet));

            case GestureComboStageKind.Massive:
                return(ManifestFromMassiveBlend.FromMassiveBlend(mapper.massiveBlend, fallbackWhenAnyClipIsNull));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 3
0
 public void DrawPreviewOrRefreshButton(Motion element, bool grayscale = false)
 {
     if (element is AnimationClip clip)
     {
         if (_memoryQuery.HasClip(clip))
         {
             GUILayout.Box(Texture(grayscale, clip), GUIStyle.none, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingButton();
         }
         else
         {
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             EditorGUI.BeginDisabledGroup(AnimationMode.InAnimationMode());
             var isPreviewSetupValid = _editorEffector.IsPreviewSetupValid();
             if (GUILayout.Button(isPreviewSetupValid ? CgeLocale.CGEE_GeneratePreview : CgeLocale.CGEE_SetupPreview, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
             {
                 if (isPreviewSetupValid)
                 {
                     _activityPreviewQueryAggregator.GenerateMissingPreviewsPrioritizing(_repaintCallback, clip);
                 }
                 else
                 {
                     if (_editorEffector.GetCurrentlyEditing() == CurrentlyEditing.Activity)
                     {
                         _editorEffector.SwitchTo(ActivityEditorMode.OtherOptions);
                     }
                     else
                     {
                         _editorEffector.SwitchTo(PuppetEditorMode.OtherOptions);
                     }
                 }
             }
             EditorGUI.EndDisabledGroup();
         }
     }
     else if (element is BlendTree tree)
     {
         var animations = ManifestFromPuppet.AllAnimationsOf(tree);
         if (animations.Count == 0)
         {
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingButton();
         }
         else if (_memoryQuery.HasClip(animations[0]))
         {
             GUILayout.BeginHorizontal();
             TexturedBox(grayscale, animations, 0);
             TexturedBox(grayscale, animations, 1);
             GUILayout.EndHorizontal();
             GUILayout.BeginHorizontal();
             TexturedBox(grayscale, animations, 2);
             TexturedBox(grayscale, animations, 3);
             GUILayout.EndHorizontal();
             InvisibleRankPreservingButton();
         }
         else
         {
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             InvisibleRankPreservingBox();
             EditorGUI.BeginDisabledGroup(AnimationMode.InAnimationMode());
             var isPreviewSetupValid = _editorEffector.IsPreviewSetupValid();
             if (GUILayout.Button(isPreviewSetupValid ? CgeLocale.CGEE_GeneratePreview : CgeLocale.CGEE_SetupPreview, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
             {
                 if (isPreviewSetupValid)
                 {
                     _activityPreviewQueryAggregator.GenerateMissingPreviewsPrioritizing(_repaintCallback, animations[0]);
                 }
                 else
                 {
                     _editorEffector.SwitchTo(ActivityEditorMode.OtherOptions);
                 }
             }
             EditorGUI.EndDisabledGroup();
         }
     }
     else
     {
         InvisibleRankPreservingBox();
         InvisibleRankPreservingBox();
         InvisibleRankPreservingBox();
         InvisibleRankPreservingBox();
         InvisibleRankPreservingButton();
     }
 }
 public List <AnimationClip> AllAnimationsOfSelected()
 {
     return(BlendTreeBeingEdited != null?ManifestFromPuppet.AllAnimationsOf(BlendTreeBeingEdited) : new List <AnimationClip>());
 }