/************************************************************************************************************************/ /// <summary>Returns the number of vertical pixels the `property` will occupy when it is drawn.</summary> public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { using (DrawerContext.Get(property)) { InitializeMode(property); var height = EditorGUI.GetPropertyHeight(property, label, true); if (property.isExpanded) { if (property.propertyType != SerializedPropertyType.ManagedReference) { var mainProperty = GetMainProperty(property); if (mainProperty != null) { height -= EditorGUI.GetPropertyHeight(mainProperty) + AnimancerGUI.StandardSpacing; } } // The End Time from the Event Sequence is drawn out in the main transition so we need to add it. // But rather than figuring out which array element actually holds the end time, we just use the // Start Time field since it will have the same height. var startTime = property.FindPropertyRelative(NormalizedStartTimeFieldName); if (startTime != null) { height += EditorGUI.GetPropertyHeight(startTime) + AnimancerGUI.StandardSpacing; } } return(height); } }
/************************************************************************************************************************/ private void DoPropertyGUI(Rect area, SerializedProperty property, GUIContent label, bool isPreviewing) { using (DrawerContext.Get(property)) { if (Context.Transition == null) { EditorGUI.PrefixLabel(area, label); return; } EditorGUI.BeginChangeCheck(); var mainProperty = GetMainProperty(property); DoHeaderGUI(ref area, property, mainProperty, label, isPreviewing); DoChildPropertiesGUI(area, property, mainProperty); if (EditorGUI.EndChangeCheck() && isPreviewing) { TransitionPreviewWindow.PreviewNormalizedTime = TransitionPreviewWindow.PreviewNormalizedTime; } } }
/// <inheritdoc/> public override void OnGUI(Rect area, SerializedProperty property, GUIContent label) { _RootProperty = null; base.OnGUI(area, property, label); if (_RootProperty == null || !_RootProperty.isExpanded) { return; } using (DrawerContext.Get(_RootProperty)) { if (Context.Transition == null) { return; } _CurrentChildList = GatherDetails(_RootProperty); var indentLevel = EditorGUI.indentLevel; area.yMin = area.yMax - _CurrentChildList.GetHeight(); EditorGUI.indentLevel++; area = EditorGUI.IndentedRect(area); EditorGUI.indentLevel = 0; _CurrentChildList.DoList(area); EditorGUI.indentLevel = indentLevel; TryCollapseArrays(); } }
public Mouse(IDrawPad drawPad) { _drawPad = drawPad; _drawerContext = new DrawerContext(drawPad, new CommandWaitDrawerState()); }