Beispiel #1
0
        //Draw GUI
        public void OnGUI()
        {
            // Show message if in play mode
            if (EditorApplication.isPlaying)
            {
                GUILayout.Space(10);
                EditorGUILayout.LabelField(Content.PlaymodeError);
                return;
            }
            _mainScrollviewPosition = EditorGUILayout.BeginScrollView(_mainScrollviewPosition);
            GUILayout.Space(10);
            EditorGUI.BeginChangeCheck();
            _avatar = (VRCAvatarDescriptor)EditorGUILayout.ObjectField(Content.Avatar, _avatar, typeof(VRCAvatarDescriptor), true);

            if (EditorGUI.EndChangeCheck())
            {
                _showLayers = _avatar != null;
                if (_avatar != null)
                {
                    _avatar.customExpressions = true;
                    if (_avatar.expressionParameters == null)
                    {
                        GenerateNewExpressionParametersAsset();
                    }
                    if (_avatar.expressionsMenu == null)
                    {
                        GenerateNewExpressionMenuAsset();
                    }

                    UsedParameterSlots = _avatar.expressionParameters.CalcTotalCost();

                    _layers = new LayerOptions[_avatar.baseAnimationLayers.Length];
                    for (int i = 0; i < _avatar.baseAnimationLayers.Length; i++)
                    {
                        _layers[i] = new LayerOptions(this, _avatar.baseAnimationLayers[i], i);
                    }
                }
            }

            if (_showLayers)
            {
                if (_layers == null)
                {
                    RebuildLayers();
                }
                foreach (var l in _layers)
                {
                    GUILayout.Space(10);
                    l.DrawLayerOptions();
                }
            }

            EditorGUILayout.EndScrollView();
        }
Beispiel #2
0
 // Rebuild layer objects
 private void RebuildLayers()
 {
     _showLayers = _avatar != null;
     if (_avatar != null)
     {
         _layers = new LayerOptions[_avatar.baseAnimationLayers.Length];
         for (int i = 0; i < _avatar.baseAnimationLayers.Length; i++)
         {
             _layers[i] = new LayerOptions(this, _avatar.baseAnimationLayers[i], i);
         }
     }
 }
        //Draw GUI
        public void OnGUI()
        {
            // Show message if in play mode
            if (EditorApplication.isPlaying)
            {
                GUILayout.Space(10);
                EditorGUILayout.LabelField(Content.PlaymodeError);
                return;
            }
            GUILayout.Space(10);
            EditorGUI.BeginChangeCheck();
            _avatar = (VRCAvatarDescriptor)EditorGUILayout.ObjectField(Content.Avatar, _avatar, typeof(VRCAvatarDescriptor), true);

            if (EditorGUI.EndChangeCheck())
            {
                _showLayers = _avatar != null;
                if (_avatar != null)
                {
                    _avatar.customExpressions = true;
                    if (_avatar.expressionParameters == null)
                    {
                        GenerateNewExpressionParametersAsset();
                    }
                    if (_avatar.expressionsMenu == null)
                    {
                        GenerateNewExpressionMenuAsset();
                    }

                    HasFreeParameterSlots = _avatar.expressionParameters.parameters.Count(x => string.IsNullOrEmpty(x.name)) > 0;

                    _layers = new LayerOptions[_avatar.baseAnimationLayers.Length];
                    for (int i = 0; i < _avatar.baseAnimationLayers.Length; i++)
                    {
                        _layers[i] = new LayerOptions(this, _avatar.baseAnimationLayers[i], i);
                    }
                }
            }

            if (_showLayers)
            {
                if (_layers == null)
                {
                    RebuildLayers();
                }
                foreach (var l in _layers)
                {
                    GUILayout.Space(10);
                    l.DrawLayerOptions();
                }
            }
        }