Ejemplo n.º 1
0
        public ExpressionKey(ExpressionPreset preset, string customName = null)
        {
            Preset = preset;

            if (Preset != ExpressionPreset.custom)
            {
                if (PresetNameDictionary.ContainsKey((Preset)))
                {
                    _id = Name = PresetNameDictionary[Preset];
                }
                else
                {
                    PresetNameDictionary.Add(Preset, Preset.ToString());
                    _id = Name = PresetNameDictionary[Preset];
                }
            }
            else
            {
                if (string.IsNullOrEmpty(customName))
                {
                    throw new ArgumentException("name is required for ExpressionPreset.Custom");
                }

                _id  = $"{UnknownPresetPrefix}{customName}";
                Name = customName;
            }
        }
Ejemplo n.º 2
0
 float ExpressionPresetSlider(VRM10ObjectExpression expression, ExpressionPreset preset, float value)
 {
     EditorGUILayout.BeginHorizontal(Style);
     EditorGUILayout.LabelField(preset.ToString());
     value = EditorGUILayout.Slider(value, 0, 1.0f);
     EditorGUILayout.EndHorizontal();
     return(value);
 }
Ejemplo n.º 3
0
        static VRM10Expression CreateAndSaveExpression(ExpressionPreset preset, string dir)
        {
            var clip = ScriptableObject.CreateInstance <VRM10Expression>();

            clip.name = preset.ToString();
            var path      = System.IO.Path.Combine(dir, $"{preset}.asset");
            var unityPath = UnityPath.FromFullpath(path);

            unityPath.CreateAsset(clip);
            var loaded = unityPath.LoadAsset <VRM10Expression>();

            return(loaded);
        }
Ejemplo n.º 4
0
 public override string ToString()
 {
     return(Preset.ToString());
 }