public void DoSetCombiner(AnimationClip leftAnim, AnimationClip rightAnim, String propertyPath, bool usePermutations, Action repaintCallback)
        {
            _combinerState.DoSetCombiner(_editorEffector.GetActivity(), leftAnim, rightAnim, propertyPath, usePermutations, repaintCallback, _editorEffector, _renderingCommands);

            _editorEffector.SwitchAdditionalEditorTo(AdditionalEditorsMode.CombineFaceExpressions);
            _editorEffector.SwitchTo(ActivityEditorMode.AdditionalEditors);
        }
        private void TryNowEditingAnActivity(GameObject active)
        {
            var selectedActivity = active.GetComponent <ComboGestureActivity>();

            if (selectedActivity != null && selectedActivity != _editorEffector.GetActivity())
            {
                WindowHandler.RetargetActivity(selectedActivity);
                Repaint();
            }
        }
Exemplo n.º 3
0
 public void Layout(Rect position)
 {
     if (_editorEffector.GetActivity().oneHandMode != ComboGestureActivity.CgeOneHandMode.Disabled)
     {
         LayoutOneHandEditor(position);
     }
     else if (_editorEffector.GetActivity().enablePermutations)
     {
         LayoutPermutationEditor(position);
     }
     else
     {
         LayoutActivityEditor(position);
     }
 }
Exemplo n.º 4
0
 public CgeActivityPreviewInternal(Action onClipRenderedFn,
                                   CgeEditorEffector editorEffector,
                                   CgeBlendTreeEffector blendTreeEffector,
                                   CgeMemoization memoization,
                                   int pictureWidth,
                                   int pictureHeight,
                                   EeRenderingCommands eeRenderingCommands)
 {
     _onClipRenderedFn          = onClipRenderedFn;
     _editorEffector            = editorEffector;
     _blendTreeEffector         = blendTreeEffector;
     _memoization               = memoization;
     _pictureWidth              = pictureWidth;
     _pictureHeight             = pictureHeight;
     _editorArbitraryAnimations = _editorEffector.GetActivity()?.editorArbitraryAnimations ?? new AnimationClip[] {};
     _eeRenderingCommands       = eeRenderingCommands;
 }
        public void Layout(Action repaintCallback, Rect position)
        {
            _common.BeginLayoutUsingWidth(position, CgeLayoutCommon.GuiSquareHeight * 2, 0, CgeLayoutCommon.GuiSquareWidth * 4);
            if (_editorEffector.IsFirstTimeSetup() || !_editorEffector.IsPreviewSetupValid())
            {
                if (_editorEffector.HasPreviewSetupWhichIsInvalid())
                {
                    EditorGUILayout.LabelField(CgeLocale.CGEE_IncompletePreviewSetup);
                }

                EditorGUILayout.PropertyField(_editorEffector.SpPreviewSetup(), new GUIContent(CgeLocale.CGEE_Preview_setup));
                GUILayout.Space(15);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(CgeLocale.CGEE_Automatically_setup_preview, GUILayout.Height(50), GUILayout.Width(300)))
                {
                    DoAutoSetupPreview();
                    if (_editorEffector.GetSetupResult() != EePreviewSetupWizard.SetupResult.NoAvatarFound)
                    {
                        _editorEffector.SwitchTo(ActivityEditorMode.SetFaceExpressions);
                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
            else
            {
                EditorGUILayout.PropertyField(_editorEffector.SpTransitionDuration(), new GUIContent(CgeLocale.CGEE_Transition_duration));
                EditorGUILayout.PropertyField(_editorEffector.SpPreviewSetup(), new GUIContent(CgeLocale.CGEE_Preview_setup));
                if (_editorEffector.GetSetupResult() != null)
                {
                    var setupResult = (EePreviewSetupWizard.SetupResult)_editorEffector.GetSetupResult();
                    switch (setupResult)
                    {
                    case EePreviewSetupWizard.SetupResult.ReusedExistsAndValidInScene:
                        EditorGUILayout.HelpBox(CgeLocale.CGEE_AutoSetupReused, MessageType.Info);
                        break;

                    case EePreviewSetupWizard.SetupResult.NoAvatarFound:
                        EditorGUILayout.HelpBox(CgeLocale.CGEE_AutoSetupNoActiveAvatarDescriptor, MessageType.Error);
                        break;

                    case EePreviewSetupWizard.SetupResult.CreatedNew:
                        EditorGUILayout.HelpBox(CgeLocale.CGEE_AutoSetupCreated, MessageType.Info);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                EditorGUI.BeginDisabledGroup(AnimationMode.InAnimationMode());
                if (GUILayout.Button(CgeLocale.CGEE_Generate_missing_previews))
                {
                    _activityPreviewQueryAggregator.GenerateMissingPreviews(repaintCallback);
                }

                if (GUILayout.Button(CgeLocale.CGEE_Regenerate_all_previews))
                {
                    _activityPreviewQueryAggregator.GenerateAll(repaintCallback);
                }
                if (_editorEffector.GetCurrentlyEditing() == CurrentlyEditing.Activity)
                {
                    EditorGUILayout.PropertyField(_editorEffector.SpEditorArbitraryAnimations(), new GUIContent(CgeLocale.CGEE_List_of_arbitrary_animations), true);
                }
                EditorGUI.EndDisabledGroup();

                EditorGUI.BeginDisabledGroup(!AnimationMode.InAnimationMode());
                EditorGUI.EndDisabledGroup();

                if (_editorEffector.GetCurrentlyEditing() == CurrentlyEditing.Activity)
                {
                    if (_editorEffector.GetActivity().editorArbitraryAnimations != null)
                    {
                        GUILayout.BeginArea(new Rect(0, CgeLayoutCommon.SingleLineHeight * 10, position.width, CgeLayoutCommon.GuiSquareHeight * 8));
                        var allClips = new HashSet <AnimationClip>(_editorEffector.GetActivity().editorArbitraryAnimations.Where(clip => clip != null)).ToList();
                        var mod      = (int)Math.Max(1, position.width / CgeLayoutCommon.GuiSquareWidth);
                        for (var element = 0; element < allClips.Count; element++)
                        {
                            GUILayout.BeginArea(CgeLayoutCommon.RectAt(element % mod, element / mod));
                            DrawArbitrary(allClips[element]);
                            GUILayout.EndArea();
                        }

                        GUILayout.EndArea();
                        GUILayout.Space((allClips.Count / mod) * CgeLayoutCommon.GuiSquareHeight + CgeLayoutCommon.GuiSquareHeight + CgeLayoutCommon.SingleLineHeight * 2);
                    }
                }
            }
            CgeLayoutCommon.EndLayout();
        }