void ExpressionPreviewInPlay(VRM10ObjectExpression expression, Vrm10RuntimeExpression runtime) { if (expression == null) { EditorGUILayout.HelpBox("no expression settings", MessageType.Warning); return; } EditorGUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); // 右よせ EditorGUILayout.BeginVertical(); { GUILayout.FlexibleSpace(); m_map.Clear(); foreach (var kv in runtime.GetWeights()) { var key = kv.Key; if (kv.Key.Preset != ExpressionPreset.custom) { var value = ExpressionPresetSlider(expression, kv.Key.Preset, kv.Value); m_map[key] = value; } } GUILayout.FlexibleSpace(); runtime.SetWeights(m_map); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); }
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); }
public ExpressionMerger(VRM10ObjectExpression expressions, Transform root) { m_clipMap = expressions.Clips.ToDictionary(x => expressions.CreateKey(x.Clip), x => x.Clip); m_valueMap = new Dictionary <ExpressionKey, float>(); m_morphTargetBindingMerger = new MorphTargetBindingMerger(m_clipMap, root); m_materialValueBindingMerger = new MaterialValueBindingMerger(m_clipMap, root); }
public ExpressionClipSelector(VRM10ObjectExpression avatar, string dir, SerializedObject serializedObject) { avatar.RemoveNullClip(); m_avatar = avatar; var prop = serializedObject.FindProperty("Clips"); m_clipList = new ReorderableExpressionList(serializedObject, prop, dir); m_clipList.Selected += (selected) => { var clips = avatar.Clips.ToArray(); SelectedIndex = Array.IndexOf(clips, selected); }; }
private DefaultExpressionValidator(VRM10ObjectExpression expressionAvatar) { _keys = expressionAvatar.Clips.Select(x => expressionAvatar.CreateKey(x.Clip)).ToArray(); _expressions = expressionAvatar.Clips.ToDictionary(x => expressionAvatar.CreateKey(x.Clip), x => x.Clip); }
public IExpressionValidator Create(VRM10ObjectExpression expressionAvatar) { return(new DefaultExpressionValidator(expressionAvatar)); }
private DefaultExpressionValidator(VRM10ObjectExpression expressionAvatar) { _keys = expressionAvatar.Clips.Select(ExpressionKey.CreateFromClip).ToArray(); _expressions = expressionAvatar.Clips.ToDictionary(ExpressionKey.CreateFromClip, x => x); }