public void Layout(Rect position, Action repaintCallback)
        {
            EditorGUILayout.HelpBox(@"Limited Lipsync is a feature that will not work with the version of VRChat at the time this version of ComboGestureExpressions has been published.

At the time this version has been published, generating the layer will break your Lipsync blendshapes.", MessageType.Error);
            var helpBoxHeightReverse = 60;

            if (_lipsyncState.EditorLipsyncTool == 1)
            {
                _common.BeginLayoutUsing(position, CgeLayoutCommon.GuiSquareHeight * 8, helpBoxHeightReverse);
                LayoutLimitedLipsyncEditor(repaintCallback);
                CgeLayoutCommon.EndLayout();
            }
            else
            {
                GUILayout.Label("Select face expressions with a <b>wide open mouth</b>.", _common.LargeFont);
                GUILayout.BeginArea(new Rect(0, CgeLayoutCommon.SingleLineHeight * 3 + helpBoxHeightReverse, position.width, CgeLayoutCommon.GuiSquareHeight * 8));
                var allClips = new HashSet <AnimationClip>(_editorEffector.AllDistinctAnimations()).ToList();
                var mod      = Math.Max(3, Math.Min(8, (int)Math.Sqrt(allClips.Count)));
                for (var element = 0; element < allClips.Count; element++)
                {
                    GUILayout.BeginArea(CgeLayoutCommon.RectAt(element % mod, element / mod));
                    DrawLipsyncSwitch(allClips[element]);
                    GUILayout.EndArea();
                }
                GUILayout.EndArea();
                GUILayout.Box(
                    "",
                    GUIStyle.none,
                    GUILayout.Width(CgeLayoutCommon.GuiSquareHeight + CgeLayoutCommon.GuiSquareHeight * mod + CgeLayoutCommon.SingleLineHeight * 2),
                    GUILayout.Height(CgeLayoutCommon.GuiSquareHeight + CgeLayoutCommon.GuiSquareHeight * (allClips.Count / mod) + CgeLayoutCommon.SingleLineHeight * 2 + helpBoxHeightReverse)
                    );
            }
        }
Exemplo n.º 2
0
        public void Layout(Rect position)
        {
            var allClips = _editorEffector.AllDistinctAnimations();
            var mod      = Math.Max(3, Math.Min(8, (int)Math.Sqrt(allClips.Count)));

            var width  = CgeLayoutCommon.GuiSquareHeight + CgeLayoutCommon.GuiSquareHeight * mod + CgeLayoutCommon.SingleLineHeight * 2;
            var height = CgeLayoutCommon.GuiSquareHeight + CgeLayoutCommon.GuiSquareHeight * (allClips.Count / mod) + CgeLayoutCommon.SingleLineHeight * 2;

            _common.BeginLayoutUsingWidth(position, (int)height, 0, (int)width);
            GUILayout.Label(CgeLocale.CGEE_SelectFaceExpressionsWithBothEyesClosed, _common.LargeFont);
            GUILayout.BeginArea(new Rect(0, CgeLayoutCommon.SingleLineHeight * 3, position.width, CgeLayoutCommon.GuiSquareHeight * 8));
            for (var element = 0; element < allClips.Count; element++)
            {
                GUILayout.BeginArea(CgeLayoutCommon.RectAt(element % mod, element / mod));
                DrawBlinkingSwitch(allClips[element]);
                GUILayout.EndArea();
            }
            GUILayout.EndArea();
            GUILayout.Box(
                "",
                GUIStyle.none,
                GUILayout.Width(width),
                GUILayout.Height(height)
                );
            CgeLayoutCommon.EndLayout();
        }
Exemplo n.º 3
0
        private Dictionary <AnimationClip, Texture2D> GatherAnimations(ProcessMode processMode)
        {
            var enumerable = _editorArbitraryAnimations
                             .Union(_editorEffector.AllDistinctAnimations())
                             .Union(_blendTreeEffector.AllAnimationsOfSelected())
                             .Distinct()
                             .Where(clip => clip != null);

            if (processMode == ProcessMode.CalculateMissing)
            {
                enumerable = enumerable.Where(clip => !_memoization.Has(clip));
            }

            return(new HashSet <AnimationClip>(enumerable.ToList())
                   .ToDictionary(clip => clip, clip => CgeMemoryQuery.NewPreviewTexture2D(_pictureWidth, _pictureHeight)));
        }
Exemplo n.º 4
0
        private void CreateNewAnimation(string propertyPath)
        {
            var animations = _editorEffector.AllDistinctAnimations();
            var folder     = animations.Count > 0 ? AssetDatabase.GetAssetPath(animations[0]).Replace(Path.GetFileName(AssetDatabase.GetAssetPath(animations[0])), "") : "Assets/";

            var finalFilename = "CGE_NewAnimation__" + DateTime.Now.ToString("yyyy'-'MM'-'dd'_'HHmmss") + ".anim";

            var finalPath = folder + finalFilename;
            var clip      = new AnimationClip();

            AssetDatabase.CreateAsset(clip, finalPath);
            AssetDatabase.LoadAssetAtPath <AnimationClip>(finalPath);

            _editorEffector.SpProperty(propertyPath).objectReferenceValue = clip;
            _editorEffector.ApplyModifiedProperties();

            EeAnimationEditorWindow.Obtain().Show();
            EditorGUIUtility.PingObject(clip);
            Selection.SetActiveObjectWithContext(clip, null);
        }