private List<ShapeGroup> AllGroupsGUI(List<ShapeGroup> shapeGroups) { EditorGUILayout.LabelField ("Shape groups", EditorStyles.boldLabel); foreach (ShapeGroup shapeGroup in shapeGroups) { EditorGUILayout.BeginHorizontal (); string buttonLabel = shapeGroup.ID + ": "; if (shapeGroup.label == "") { buttonLabel += "(Untitled)"; } else { buttonLabel += shapeGroup.label; } bool buttonOn = false; if (selectedGroup == shapeGroup) { buttonOn = true; } if (GUILayout.Toggle (buttonOn, buttonLabel, "Button")) { if (selectedGroup != shapeGroup) { selectedGroup = shapeGroup; selectedKey = null; } } if (GUILayout.Button ("-", GUILayout.Width (20f), GUILayout.Height (15f))) { shapeGroups.Remove (shapeGroup); selectedGroup = null; selectedKey = null; break; } EditorGUILayout.EndHorizontal (); } if (GUILayout.Button ("Create new shape group")) { ShapeGroup newShapeGroup = new ShapeGroup (GetIDArray (shapeGroups)); shapeGroups.Add (newShapeGroup); selectedGroup = newShapeGroup; selectedKey = null; } return shapeGroups; }
private List <ShapeKey> AllKeysGUI(List <ShapeKey> shapeKeys) { EditorGUILayout.LabelField("Shape keys", EditorStyles.boldLabel); foreach (ShapeKey shapeKey in shapeKeys) { EditorGUILayout.BeginHorizontal(); string buttonLabel = shapeKey.ID + ": "; if (shapeKey.label == "") { buttonLabel += "(Untitled)"; } else { buttonLabel += shapeKey.label; } bool buttonOn = false; if (selectedKey == shapeKey) { buttonOn = true; } if (GUILayout.Toggle(buttonOn, buttonLabel, "Button")) { if (selectedKey != shapeKey) { selectedKey = shapeKey; } } if (GUILayout.Button("-", GUILayout.Width(20f), GUILayout.Height(15f))) { shapeKeys.Remove(shapeKey); selectedKey = null; break; } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Create new shape key")) { ShapeKey newShapeKey = new ShapeKey(GetIDArray(shapeKeys)); shapeKeys.Add(newShapeKey); selectedKey = newShapeKey; } return(shapeKeys); }
private List <ShapeGroup> AllGroupsGUI(List <ShapeGroup> shapeGroups) { EditorGUILayout.LabelField("Shape groups", EditorStyles.boldLabel); foreach (ShapeGroup shapeGroup in shapeGroups) { EditorGUILayout.BeginHorizontal(); string buttonLabel = shapeGroup.ID + ": "; if (shapeGroup.label == "") { buttonLabel += "(Untitled)"; } else { buttonLabel += shapeGroup.label; } bool buttonOn = (selectedGroup == shapeGroup); if (GUILayout.Toggle(buttonOn, buttonLabel, "Button")) { if (selectedGroup != shapeGroup) { selectedGroup = shapeGroup; selectedKey = null; } } if (GUILayout.Button("-", GUILayout.Width(20f), GUILayout.Height(15f))) { shapeGroups.Remove(shapeGroup); selectedGroup = null; selectedKey = null; break; } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Create new shape group")) { ShapeGroup newShapeGroup = new ShapeGroup(GetIDArray(shapeGroups)); shapeGroups.Add(newShapeGroup); selectedGroup = newShapeGroup; selectedKey = null; } return(shapeGroups); }
private ShapeKey KeyGUI(ShapeKey shapeKey, string[] blendShapeNames) { EditorGUILayout.LabelField("Shape key " + shapeKey.label, EditorStyles.boldLabel); shapeKey.label = EditorGUILayout.TextField("Key label:", shapeKey.label); if (blendShapeNames != null && blendShapeNames.Length > 0) { shapeKey.index = EditorGUILayout.Popup("Blendshape:", shapeKey.index, blendShapeNames); } else { shapeKey.index = EditorGUILayout.IntField("BlendShape index:", shapeKey.index); } return(shapeKey); }
private ShapeKey KeyGUI(ShapeKey shapeKey, string[] blendShapeNames) { EditorGUILayout.LabelField("Shape key " + shapeKey.label, EditorStyles.boldLabel); shapeKey.label = CustomGUILayout.TextField("Key label:", shapeKey.label, "", "An editor-friendly name of the blendshape"); if (blendShapeNames != null && blendShapeNames.Length > 0) { shapeKey.index = CustomGUILayout.Popup("Blendshape:", shapeKey.index, blendShapeNames, "", "The Blendshape that this relates to"); } else { shapeKey.index = CustomGUILayout.IntField("BlendShape index:", shapeKey.index, "", "The Blendshape that this relates to"); } return(shapeKey); }
private ShapeGroup GroupGUI(ShapeGroup shapeGroup, string[] blendShapeNames) { EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Shape group " + shapeGroup.label, EditorStyles.boldLabel); shapeGroup.label = EditorGUILayout.TextField("Group label:", shapeGroup.label); shapeGroup.shapeKeys = AllKeysGUI(shapeGroup.shapeKeys); if (selectedKey != null && shapeGroup.shapeKeys.Contains(selectedKey)) { selectedKey = KeyGUI(selectedKey, blendShapeNames); } EditorGUILayout.EndVertical(); return(shapeGroup); }
private ShapeKey KeyGUI(ShapeKey shapeKey) { EditorGUILayout.LabelField ("Shape key " + shapeKey.label, EditorStyles.boldLabel); shapeKey.label = EditorGUILayout.TextField ("Key label:", shapeKey.label); shapeKey.index = EditorGUILayout.IntField ("BlendShape index:", shapeKey.index); return shapeKey; }
private ShapeGroup GroupGUI(ShapeGroup shapeGroup) { EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Shape group " + shapeGroup.label, EditorStyles.boldLabel); shapeGroup.label = EditorGUILayout.TextField ("Group label:", shapeGroup.label); shapeGroup.shapeKeys = AllKeysGUI (shapeGroup.shapeKeys); if (selectedKey != null && shapeGroup.shapeKeys.Contains (selectedKey)) { selectedKey = KeyGUI (selectedKey); } EditorGUILayout.EndVertical (); return shapeGroup; }
public void SetActive(int _ID, float _value, float _changeTime, MoveMethod _moveMethod, AnimationCurve _timeCurve) { if (_changeTime < 0f) { return; } activeKey = null; foreach (ShapeKey shapeKey in shapeKeys) { if (shapeKey.ID == _ID) { activeKey = shapeKey; shapeKey.targetValue = _value; } else { shapeKey.targetValue = 0f; } } moveMethod = _moveMethod; timeCurve = _timeCurve; changeTime = _changeTime; startTime = Time.time; }
private ShapeKey KeyGUI(ShapeKey shapeKey, string[] blendShapeNames) { EditorGUILayout.LabelField ("Shape key " + shapeKey.label, EditorStyles.boldLabel); shapeKey.label = EditorGUILayout.TextField ("Key label:", shapeKey.label); if (blendShapeNames != null && blendShapeNames.Length > 0) { shapeKey.index = EditorGUILayout.Popup ("Blendshape:", shapeKey.index, blendShapeNames); } else { shapeKey.index = EditorGUILayout.IntField ("BlendShape index:", shapeKey.index); } return shapeKey; }