public void SelectGUI() { if (m_avatar != null && m_avatar.Clips != null) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Select BlendShapeClip", EditorStyles.boldLabel); var array = m_avatar.Clips .Select(x => x != null ? BlendShapeKey.CreateFrom(x).ToString() : "null" ).ToArray(); SelectedIndex = GUILayout.SelectionGrid(SelectedIndex, array, 4); } if (GUILayout.Button("Add BlendShapeClip")) { var dir = Path.GetDirectoryName(AssetDatabase.GetAssetPath(m_avatar)); var path = EditorUtility.SaveFilePanel( "Create BlendShapeClip", dir, string.Format("BlendShapeClip#{0}.asset", m_avatar.Clips.Count), "asset"); if (!string.IsNullOrEmpty(path)) { var clip = BlendShapeAvatar.CreateBlendShapeClip(path.ToUnityRelativePath()); //clip.Prefab = AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GetAssetPath(target)); m_avatar.Clips.Add(clip); } } }
void Restore() { var assetPath = UnityPath.FromAsset(this); if (assetPath.IsNull) { return; } foreach (var x in assetPath.Parent.ChildFiles) { var clip = UnityEditor.AssetDatabase.LoadAssetAtPath <BlendShapeClip>(x.Value); if (clip == null) { continue; } if (!Clips.Contains(clip)) { Clips.Add(clip); } Debug.LogFormat("{0}", clip.name); } Clips = Clips.OrderBy(x => BlendShapeKey.CreateFrom(x)).ToList(); }
public BlendShapeMerger(IEnumerable <BlendShapeClip> clips, Transform root) { m_clipMap = clips.ToDictionary(x => BlendShapeKey.CreateFrom(x), x => x); m_valueMap = new Dictionary <BlendShapeKey, float>(); m_blendShapeBindingMerger = new BlendShapeBindingMerger(m_clipMap, root); m_materialValueBindingMerger = new MaterialValueBindingMerger(m_clipMap, root); }
public void DuplicateWarn() { var key = BlendShapeKey.CreateFrom(Selected); if (m_avatar.Clips.Where(x => key.Match(x)).Count() > 1) { EditorGUILayout.HelpBox("duplicate clip: " + key, MessageType.Error); } }
void OnEnable() { m_target = (VRMBlendShapeProxy)target; if (m_target.BlendShapeAvatar != null && m_target.BlendShapeAvatar.Clips != null) { m_blendShapeKeyWeights = m_target.BlendShapeAvatar.Clips.ToDictionary(x => BlendShapeKey.CreateFrom(x), x => 0.0f); m_sliders = m_target.BlendShapeAvatar.Clips .Where(x => x != null) .Select(x => new BlendShapeSlider(m_blendShapeKeyWeights, BlendShapeKey.CreateFrom(x))) .ToList() ; } }
public override string GetInfoString() { return(BlendShapeKey.CreateFrom((BlendShapeClip)target).ToString()); }