private void OnListAdd(MMReorderableList list) { SerializedProperty property = list.AddItem(); property.FindPropertyRelative("Active").boolValue = true; property.FindPropertyRelative("Frequency").floatValue = 1f; property.FindPropertyRelative("Amplitude").floatValue = 1f; property.FindPropertyRelative("Offset").floatValue = 0f; property.FindPropertyRelative("Phase").floatValue = 0f; }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { MMReorderableList list = GetList(property, attribute as MMReorderableAttributeAttribute); if (list != null) { list.DoList(EditorGUI.IndentedRect(position), label); } else { GUI.Label(position, "Array must extend from ReorderableArray", EditorStyles.label); } }
protected override void OnEnable() { base.OnEnable(); _globalMultiplier = serializedObject.FindProperty("GlobalMultiplier"); _clamp = serializedObject.FindProperty("Clamp"); _clamps = serializedObject.FindProperty("Clamps"); _bias = serializedObject.FindProperty("Bias"); _list = new MMReorderableList(serializedObject.FindProperty("SignalList")); _driverTime = serializedObject.FindProperty("DriverTime"); _animatedPreview = serializedObject.FindProperty("AnimatedPreview"); _list.elementNameProperty = "SignalList"; _list.elementDisplayType = MMReorderableList.ElementDisplayType.Expandable; _list.onAddCallback += OnListAdd; }
protected virtual void OnEnable() { _list = new MMReorderableList(serializedObject.FindProperty("States")); _list.elementNameProperty = "States"; _list.elementDisplayType = MMReorderableList.ElementDisplayType.Expandable; _brainActive = serializedObject.FindProperty("BrainActive"); _timeInThisState = serializedObject.FindProperty("TimeInThisState"); _target = serializedObject.FindProperty("Target"); _owner = serializedObject.FindProperty("Owner"); _actionsFrequency = serializedObject.FindProperty("ActionsFrequency"); _decisionFrequency = serializedObject.FindProperty("DecisionFrequency"); _randomizeFrequencies = serializedObject.FindProperty("RandomizeFrequencies"); _randomActionFrequency = serializedObject.FindProperty("RandomActionFrequency"); _randomDecisionFrequency = serializedObject.FindProperty("RandomDecisionFrequency"); }
public static MMReorderableList GetList(SerializedProperty property, MMReorderableAttributeAttribute attrib, int id) { if (property == null) { return(null); } MMReorderableList list = null; SerializedProperty array = property.FindPropertyRelative("array"); if (array != null && array.isArray) { if (!lists.TryGetValue(id, out list)) { if (attrib != null) { Texture icon = !string.IsNullOrEmpty(attrib.elementIconPath) ? AssetDatabase.GetCachedIcon(attrib.elementIconPath) : null; MMReorderableList.ElementDisplayType displayType = attrib.singleLine ? MMReorderableList.ElementDisplayType.SingleLine : MMReorderableList.ElementDisplayType.Auto; list = new MMReorderableList(array, attrib.add, attrib.remove, attrib.draggable, displayType, attrib.elementNameProperty, attrib.elementNameOverride, icon); } else { list = new MMReorderableList(array, true, true, true); } lists.Add(id, list); } else { list.List = array; } } return(list); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { MMReorderableList list = GetList(property, attribute as MMReorderableAttributeAttribute); return(list != null?list.GetHeight() : EditorGUIUtility.singleLineHeight); }
protected virtual void OnEnable() { _list = new MMReorderableList(serializedObject.FindProperty("Layers")); _list.elementNameProperty = "Layer"; _list.elementDisplayType = MMReorderableList.ElementDisplayType.Expandable; }