/// <inheritdoc /> public override bool Draw(Rect position) { if (Event.current.type == EventType.Layout) { OnLayoutEvent(position); } else if (splitterRect.height < 1f) { GetDrawPositions(position); Inspector.RefreshView(); } DrawGUI.DrawLine(splitterRect, inspector.Preferences.theme.ComponentSeparatorLine); GenerateControlId(); if (Event.current.type == EventType.Repaint) { GUI.Button(buttonRect, "Add Component", "AC Button"); } DrawGUI.LayoutSpace(Height); return(false); }
/// <inheritdoc /> public override bool Draw(Rect position) { if (Event.current.type == EventType.Layout) { OnLayoutEvent(position); } DrawGUI.DrawLine(splitterRect, inspector.Preferences.theme.ComponentSeparatorLine); //needed for button GenerateControlId(); bool selected = Selected; var colorWas = GUI.color; if (selected) { GUI.color = InspectorUtility.Preferences.theme.ButtonSelected; } GUI.Button(buttonRect, "Add Component", "AC Button"); GUI.color = colorWas; DrawGUI.LayoutSpace(Height); return(false); }
/// <inheritdoc/> public override bool DrawPrefix(Rect position) { bool textColorAltered = false; if (Event.current.type == EventType.Repaint) { var lineRect = position; lineRect.height = 1f; var theme = Inspector.Preferences.theme; DrawGUI.DrawLine(lineRect, theme.ComponentSeparatorLine); #if SAFE_MODE if (prefixLabelDrawer == null) { #if DEV_MODE Debug.LogWarning(GetType().Name + ".DrawPrefix - prefixLabelDrawer of " + this + " under parent " + (parent == null ? "null" : parent.ToString()) + " was null!"); #endif return(false); } #endif if (mouseoveredIconIndex == -1) { if (Selected) { textColorAltered = true; SetLabelGUIStyleColor(theme.PrefixSelectedText); } else if (Mouseovered) { if (InspectorUtility.Preferences.mouseoverEffects.unityObjectHeaderTint) { textColorAltered = true; SetLabelGUIStyleColor(theme.PrefixMouseoveredText); } } } } var drawPos = position; drawPos.x += 3f; drawPos.width -= 3f; drawPos.y += 3f; drawPos.height -= 3f; if (lastPassedFilterTestType != FilterTestType.None) { prefixLabelDrawer.Draw(drawPos, Inspector.State.filter, label.text, lastPassedFilterTestType); } else { prefixLabelDrawer.Draw(drawPos); } if (textColorAltered) { SetLabelGUIStyleColor(labelIdleColor); } DrawGUI.LayoutSpace(position.height); if (Event.current.type == EventType.Repaint) { DrawComponentIcons(position); } return(false); }
/// <inheritdoc /> public override bool Draw(Rect position) { for (int n = targets.Length - 1; n >= 0; n--) { if (targets[n] == null) { #if DEV_MODE Debug.LogWarning(this + ".Draw() - target was null, rebuilding"); #endif inspector.RebuildDrawersIfTargetsChanged(); return(false); } } if (DebugMode) { if (Event.current.type == EventType.Layout) { UpdateHeight(); } return(base.Draw(position)); } bool dirty = false; if (Event.current.type == EventType.Layout) { OnLayoutEvent(position); } var guiColorWas = GUI.color; if (DrawGreyedOut) { var color = GUI.color; color.a = 0.5f; GUI.color = color; } if (!HeadlessMode && DrawPrefix(labelLastDrawPosition)) { dirty = true; if (DebugMode) { ExitGUIUtility.ExitGUI(); } } float unfoldedness = Unfoldedness; if (unfoldedness > 0f) { var pos = position; pos.y += HeaderHeight; pos.height = Height - HeaderHeight; HandlePrefixColumnResizing(); pos.height = DrawGUI.SingleLineHeight; #if UNITY_EDITOR var serializedObject = MemberHierarchy.SerializedObject; serializedObject.Update(); #endif if (unfoldedness >= 1f) { DrawFoldableContent(pos); } else { #if DEV_MODE && PI_ASSERTATIONS var assertColor = GUI.color; #endif using (new MemberScaler(bodyLastDrawPosition.min, unfoldedness)) { DrawFoldableContent(pos); } #if DEV_MODE && PI_ASSERTATIONS Debug.Assert(GUI.color == assertColor, ToString() + " - After DrawFoldableContent"); #endif } #if UNITY_EDITOR serializedObject.ApplyModifiedProperties(); #endif } GUI.color = guiColorWas; if (!DataIsValid) { var pos = position; pos.y += Height - 57f; pos.height = 50f; DrawGUI.Active.HelpBox(pos, "Due to floating-point precision limitations, it is recommended to bring the world coordinates of the GameObject within a smaller range.", MessageType.Warning); pos.y += pos.height; } DrawGUI.LayoutSpace(Height); return(dirty); }