public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label) { s_guiRect.SetRect(position); EditorGUIX.PropertyField(s_guiRect, property[nameof(FlightGroupDefinition.name)]); EditorGUIX.PropertyField(s_guiRect, property[nameof(FlightGroupDefinition.goals)]); }
public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label) { position = EditorGUI.IndentedRect(position); GUIRect guiRect = new GUIRect(position); string goalName = property.Type.Name.Replace("Goal", ""); goalName = $"[{ObjectNames.NicifyVariableName(goalName)}]"; GUIContent content = EditorGUIX.TempLabel(goalName); Rect rect = guiRect.GetFieldRect(); rect.width *= 0.25f; EditorGUIX.Foldout(rect, property, content); rect.x += rect.width; rect.width = rect.width * 3f; EditorGUIX.PropertyField(rect, property[NameField], GUIContent.none); if (property.IsExpanded) { EditorGUIX.DrawProperties(guiRect, property, SkipList); ReorderableListGUI.ListFieldAbsolute(EditorGUI.IndentedRect(guiRect.GetRect()), adapter); } }
public override void OnGUI() { var positionId = EditorGUIUtility.GetControlID(kCenterGizmoHash, FocusType.Passive); var radiusId = EditorGUIUtility.GetControlID(kRadiusGizmoHash, FocusType.Passive); var position = GetValue(kExposureGizmoPosition); var radius = GetValue(kExposureGizmoRadius); var cameraPosition = GetValue(kCameraPosition); var zoom = GetValue(kZoom); var actualPosition = position * zoom + cameraPosition; var actualRadius = radius * zoom; Handles.color = Handles.xAxisColor; actualPosition = EditorGUIX.PositionHandle2D(positionId, actualPosition, Styles.kPositionSize); Handles.color = Handles.yAxisColor; actualRadius = EditorGUIX.RadiusHandle2D(radiusId, actualPosition, actualRadius); var newPosition = (actualPosition - cameraPosition) / zoom; var newRadius = actualRadius / zoom; if ((position - newPosition).sqrMagnitude > Styles.kPositionThreshold || Mathf.Abs(newRadius - radius) > Styles.kRadiusThreshold) { SetValue(kExposureGizmoPosition, newPosition); SetValue(kExposureGizmoRadius, newRadius); ExecuteCommand(kCmdProcessFromColorCorrection); } }
private void DrawExpanded(ReflectedProperty property, ResponseCurve curve) { DrawHeaderBox(property, false, curve); property["curve"].Value = EditorGUIX.ResponseCurveField(guiRect.GetFieldRect(7), curve); guiRect.GetFieldRect(); EditorGUIX.DrawProperties(guiRect.GetRect(), property, new[] { "curve" }); }
public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label) { guiRect.SetRect(position); EditorGUIX.PropertyField(guiRect, property[nameof(AIBehavior.name)]); EditorGUIX.PropertyField(guiRect, property[nameof(AIBehavior.considerations)]); EditorGUIX.PropertyField(guiRect, property[nameof(AIBehavior.actions)]); }
public override void OnGUI() { var controlId = GUIUtility.GetControlID(s_DropZoneHash, FocusType.Passive); var rect = GUILayoutUtility.GetRect(0, float.MaxValue, 0, float.MaxValue, GUIStyle.none, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); // On layout event, the rect returned is a dummy (0, 0, 1, 1) and the request is stored // On repaint event, the rect has the coorect value // But, GUILayout.BeginArea register the size on the layout event only // So we need to give to GUILayout.BeginArea the rect calculated from the previous repaint event if (Event.current.type == EventType.Repaint) { m_Rect = rect; } if (m_Rect.x == 0 && m_Rect.y == 0 && m_Rect.width == 0 && m_Rect.height == 0) { Repaint(); } GUILayout.BeginArea(m_Rect); base.OnGUI(); GUILayout.EndArea(); if (EditorGUIX.DropZone(controlId, m_Rect, DropCheck) && Dropped != null) { Dropped(new DropEventArgs(DragAndDrop.objectReferences, DragAndDrop.paths)); } }
/// <summary> /// Displays a button for setting all axes of motion on an array of targets. /// </summary> /// <param name="preference">Preference storing the motion type value.</param> /// <param name="label">Label for the control.</param> /// <param name="targets">An array of configurable joints.</param> /// <param name="applyMethod">Method to invoke if preference value is to be applied to all targets.</param> private void DisplayMultiJointMotionButton( EditorPreference <ConfigurableJointMotion, JointEditor> preference, GUIContent label, System.Action <ConfigurableJoint, ConfigurableJointMotion> applyMethod ) { Rect controlPosition, buttonPosition; EditorGUIX.GetRectsForControlWithInlineButton( EditorGUILayout.GetControlRect(), out controlPosition, out buttonPosition, 40f, 80f ); preference.CurrentValue = (ConfigurableJointMotion)EditorGUIX.DisplayField <System.Enum>( controlPosition, label, preference.CurrentValue, EditorGUI.EnumPopup ); if (EditorGUIX.DisplayButton(buttonPosition, "Set All")) { Undo.RecordObjects(m_CachedTargets, string.Format("Set All {0} Motion", label.text)); foreach (ConfigurableJoint j in m_CachedTargets) { if (j == null) { continue; } applyMethod(j, preference.CurrentValue); } EditorUtilityX.SetDirty(m_CachedTargets); } }
/// <summary> /// Displays a font property field. /// </summary> /// <param name="position">Position.</param> /// <param name="fontProperty">Font property.</param> /// <param name="inheritingFrom">Style sheet from which the font is potentially inheriting.</param> public static void DisplayFontProperty( Rect position, SerializedProperty fontProperty, HyperTextStyles inheritingFrom ) { ValidationStatus status = ValidationStatus.None; s_ReusableLabel.text = fontProperty.displayName; s_ReusableLabel.tooltip = string.Empty; if (fontProperty.objectReferenceValue == null) { if (inheritingFrom != null && inheritingFrom.CascadedFont != null) { s_ReusableLabel.tooltip = string.Format( "Inheriting Font {0} from {1}.", inheritingFrom.CascadedFont.name, inheritingFrom.name ); } else { s_ReusableLabel.tooltip = "Font cannot be null."; status = ValidationStatus.Error; } } else if (!(fontProperty.objectReferenceValue as Font).dynamic) { s_ReusableLabel.tooltip = "Font size and style settings are only supported for dynamic fonts. " + "Only colors and offsets will be applied."; status = ValidationStatus.Warning; } else if (inheritingFrom != null && inheritingFrom.CascadedFont != null) { s_ReusableLabel.tooltip = string.Format( "Overriding Font {0} inherited from {1}.", inheritingFrom.CascadedFont.name, inheritingFrom.name ); status = ValidationStatus.Warning; } if ( string.IsNullOrEmpty(s_ReusableLabel.tooltip) && inheritingFrom != null && inheritingFrom.CascadedFont != null ) { s_ReusableLabel.tooltip = string.Format( "Assign a value to override Font {0} inherited from {1}", inheritingFrom.CascadedFont.name, inheritingFrom.name ); } switch (status) { case ValidationStatus.None: EditorGUI.PropertyField(position, fontProperty, s_ReusableLabel); break; default: EditorGUIX.DisplayPropertyFieldWithStatus( position, fontProperty, status, s_ReusableLabel, false, s_ReusableLabel.tooltip ); break; } }
/// <summary> /// Displays the handle preferences. They will be displayed in the preference menu and the top of the inspector. /// </summary> new protected static void DisplayHandlePreferences() { EditorGUIX.DisplayHandlePropertyEditor( "Vision", s_VisionHandleTogglePreference, s_VisionHandleColorPreference ); EditorGUIX.DisplayHandlePropertyEditor <AwarenessEditor>( "Hearing", s_HearingHandleTogglePreference, s_HearingHandleColorPreference ); }
public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label) { GUIRect guiRect = new GUIRect(); guiRect.SetRect(position); EditorGUIX.PropertyField(guiRect.GetFieldRect(), property[NameField]); EditorGUIX.PropertyField(guiRect.GetFieldRect(), property[ShipCategoryField]); }
/// <summary> /// Raises the GUI event. /// </summary> /// <param name="position">Position.</param> /// <param name="property">Property.</param> /// <param name="label">Label.</param> public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { Initialize(property); SerializedProperty inputText = property.FindPropertyRelative("m_InputText"); SerializedProperty styles = property.FindPropertyRelative("m_Styles"); SerializedProperty supportRichText = property.FindPropertyRelative("m_IsRichTextDesired"); Rect entirePosition = position; position.height = (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 2f; EditorGUI.PropertyField(position, inputText); position.x = entirePosition.x; position.width = entirePosition.width; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; position.height = EditorGUIUtility.singleLineHeight; EditorGUIX.DisplayScriptableObjectPropertyFieldWithButton <HyperTextStyles>(position, styles); position.y += position.height + EditorGUIUtility.standardVerticalSpacing; HyperTextEditor.DisplayOverridableProperty( position, property.FindPropertyRelative("m_ReferenceFontSize"), property.FindPropertyRelative("m_ShouldOverrideStylesFontSize"), styles ); position.x = entirePosition.x; position.width = entirePosition.width; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; EditorGUIX.DisplayPropertyFieldWithStatus( position, supportRichText, ValidationStatus.Info, new GUIContent("Output Rich Text"), true, "Disable if the destination does not support rendering rich text." ); position.y += position.height + EditorGUIUtility.standardVerticalSpacing; ++EditorGUI.indentLevel; EditorGUIX.DisplayPropertyFieldWithStatus( position, property.FindPropertyRelative("m_IsDynamicFontDesired"), supportRichText.boolValue ? ValidationStatus.Info : ValidationStatus.Warning, new GUIContent("<size> Tags"), true, string.Format( "Disable if the destination uses a non-dynamic font.{0}", supportRichText.boolValue ? "" : "\n\nYou must enable rich text to output <size> tags." ) ); --EditorGUI.indentLevel; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; position.height = m_LinkCollections[property.propertyPath].GetHeight(); m_LinkCollections[property.propertyPath].DoList(position); position.y += position.height; position.height = m_TagCollections[property.propertyPath].GetHeight(); m_TagCollections[property.propertyPath].DoList(position); position.y += position.height; position.height = m_QuadCollections[property.propertyPath].GetHeight(); m_QuadCollections[property.propertyPath].DoList(position); }
public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label) { guiRect.SetRect(position); EditorGUIX.Foldout(guiRect.GetFieldRect(), property); if (property.IsExpanded) { ReorderableListGUI.ListFieldAbsolute(guiRect.GetRect(), adapter); } }
public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label) { guiRect.SetRect(position); EditorGUIX.Foldout(guiRect.GetFieldRect(), property); if (property.IsExpanded) { listControl.Draw(guiRect.GetRect(), adapter); } }
public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label) { guiRect.SetRect(position); float oldLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 100; EditorGUIX.PropertyField(guiRect.GetFieldRect(), property[NameField]); EditorGUIUtility.labelWidth = oldLabelWidth; EditorGUIX.PropertyField(guiRect, property[GoalsField]); }
/// <summary> /// Displays a property field with an optional override property checkbox and status icon as needed. /// </summary> /// <param name="position">Position.</param> /// <param name="property">Property.</param> /// <param name="overrideProperty"> /// Property specifying whether the other property is overriding an inherited one. Object reference properties /// are assumed to override if they have a value assigned. /// </param> /// <param name="displayCheckbox">If set to <see langword="true"/> display checkbox/tooltip as needed.</param> /// <param name="inheritTooltip">Predicate fragment of the tooltip when property is inheriting.</param> /// <param name="overrideTooltip">Predicate fragment of the tooltip when property is overridden.</param> public static void DisplayOverridableProperty( Rect position, SerializedProperty property, SerializedProperty overrideProperty, bool displayCheckbox, string inheritTooltip, string overrideTooltip ) { if (displayCheckbox) { ValidationStatus status = ValidationStatus.None; if (property.propertyType == SerializedPropertyType.ObjectReference) { status = property.objectReferenceValue == null ? ValidationStatus.None : ValidationStatus.Warning; } else { status = overrideProperty.hasMultipleDifferentValues || overrideProperty.boolValue ? ValidationStatus.Warning : ValidationStatus.None; } s_ReusableLabel.text = property.displayName; s_ReusableLabel.tooltip = string.Format( property.serializedObject.isEditingMultipleObjects ? "{0} {1} on at least one selected object." : "{0} {1}.", property.displayName, status == ValidationStatus.Warning ? overrideTooltip : inheritTooltip ); if (status != ValidationStatus.None) { Rect iconPosition = position; iconPosition.x += position.width - EditorGUIUtility.singleLineHeight; iconPosition.width = iconPosition.height = EditorGUIUtility.singleLineHeight; if (property.propertyType != SerializedPropertyType.Generic) { position.width -= iconPosition.width; } EditorGUIX.DisplayValidationStatusIcon(iconPosition, status, s_ReusableLabel.tooltip); } if (property.propertyType == SerializedPropertyType.ObjectReference) { EditorGUI.PropertyField(position, property, s_ReusableLabel); } else { EditorGUIX.DisplayPropertyWithToggle(position, s_ReusableLabel, overrideProperty, property); } } else { EditorGUI.PropertyField(position, property); } }
/// <summary> /// Displays the linear limit handle property editor. /// </summary> public static void DisplayLinearLimitHandlePropertyEditor() { EditorGUI.BeginChangeCheck(); { s_LinearLimitHandlePreference.CurrentValue = EditorGUIX.DisplayOnOffToggle("Linear Limit Handle", s_LinearLimitHandlePreference.CurrentValue); } if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } }
public override float GetPropertyHeight(ReflectedProperty property) { float height = 0f; height += EditorGUIX.GetChildHeights(property[NameField]); height += EditorGUIX.GetChildHeights(property[ShipTypeField]); height += EditorGUIX.GetChildHeights(property[SceneEntityIdField]); height += EditorGUIX.GetChildHeights(property[GoalsField]); height += EditorGUIX.GetChildHeights(property[BehaviorSetField]); height += EditorGUIX.GetChildHeights(property[StandaloneBehaviorsField]); return(height); }
/// <summary> /// Raises the draw custom style entry event. /// </summary> /// <param name="position">Position of the entry.</param> /// <param name="list">List to which the entry belongs.</param> /// <param name="index">Index of the entry being drawn.</param> /// <param name="guiContentsTable">Table of GUI contents used by the element being drawn.</param> /// <param name="inheritedStyles">Table of inherited styles of the element's type.</param> /// <param name="getStyles">Method to get styles of the element's type from a HyperTextStyles.</param> /// <param name="setStyles">Method to set styles of the element's type on a HyperTextStyles.</param> /// <typeparam name="T">A custom style type.</typeparam> private void OnDrawCustomStyleEntry <T>( Rect position, ReorderableList list, int index, Dictionary <int, CustomStyleGUIContent> guiContentsTable, Dictionary <T, HyperTextStyles> inheritedStyles, StylesGetter <T> getStyles, StylesSetter <T> setStyles ) where T : IIdentifiable <string> { index = Mathf.Clamp(index, 0, list.serializedProperty.arraySize); if (!guiContentsTable.ContainsKey(index)) { return; } SerializedProperty element = // NOTE: undoing list increase can cause GetArrayElementAtIndex() to fail list.serializedProperty.FindPropertyRelative(string.Format("Array.data[{0}]", index)); if (element == null) { return; } if (position.height < (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 2f) { EditorGUI.LabelField(position, guiContentsTable[index].Label); } else { EditorGUI.PropertyField(position, element, guiContentsTable[index].Label); if (guiContentsTable[index].Status == ValidationStatus.Warning) { Rect buttonPosition = position; buttonPosition.height = EditorGUIUtility.singleLineHeight; buttonPosition.y += buttonPosition.height + EditorGUIUtility.standardVerticalSpacing; buttonPosition.width = EditorGUIUtility.labelWidth; if (EditorGUIX.DisplayButton(buttonPosition, "Paste Inherited")) { string identifier = element.GetValue <T>().Identifier; T inheritedStyle = inheritedStyles.Keys.Where(s => s.Identifier == identifier).FirstOrDefault(); Undo.RecordObjects(this.targets, "Paste HyperText Style"); foreach (HyperTextStyles styleSheet in this.targets) { List <T> styles = new List <T>(); getStyles(styleSheet, styles); styles[index] = inheritedStyle; setStyles(styleSheet, styles); } } } } DisplayStyleIdentifierValidationIcon(position, guiContentsTable[index]); }
/// <summary> /// Raises the inspector GUI event. /// </summary> public override void OnInspectorGUI() { this.serializedObject.Update(); EditorGUILayout.PropertyField(m_ScriptProperty); EditorGUILayout.PropertyField(m_NameProperty); EditorGUI.BeginChangeCheck(); { m_InheritedStyles.DoLayoutList(); } if (EditorGUI.EndChangeCheck()) { UpdateCustomStyleGUIContents(); } Rect position = EditorGUILayout.GetControlRect(); HyperTextEditor.DisplayFontProperty(position, m_FontProperty, m_ParentStyle); position = EditorGUILayout.GetControlRect(); DisplayOverridableProperty(position, m_FontSizeProperty, m_FontSizeOverrideProperty); position = EditorGUILayout.GetControlRect(); DisplayOverridableProperty(position, m_LineSpacingProperty, m_LineSpacingOverrideProperty); position = EditorGUILayout.GetControlRect(); DisplayOverridableProperty(position, m_DefaultFontStyleProperty, m_DefaultFontStyleOverrideProperty); position = EditorGUILayout.GetControlRect(); DisplayOverridableProperty(position, m_DefaultTextColorProperty, m_DefaultTextColorOverrideProperty); DisplayOverridableProperty( EditorGUILayout.GetControlRect(true, HyperTextLinkStyleDrawer.PropertyHeight), m_DefaultLinkStyleProperty, m_DefaultLinkStyleOverrideProperty ); position = EditorGUILayout.GetControlRect(true, EditorGUI.GetPropertyHeight(m_LinkHitboxPaddingProperty)); DisplayOverridableProperty(position, m_LinkHitboxPaddingProperty, m_LinkHitboxPaddingOverrideProperty); EditorGUILayout.LabelField("Custom Styles"); ++EditorGUI.indentLevel; CustomStyleTab oldTab = s_CustomStyleTabPreference.CurrentValue; EditorGUI.BeginChangeCheck(); { s_CustomStyleTabPreference.CurrentValue = (CustomStyleTab)EditorGUIX.DisplayTabGroup( (int)s_CustomStyleTabPreference.CurrentValue, s_CustomStyleTabLabels, m_CustomStyleTabContents ); } if (EditorGUI.EndChangeCheck() && oldTab != s_CustomStyleTabPreference.CurrentValue) { UpdateCustomStyleGUIContents(); } --EditorGUI.indentLevel; this.serializedObject.ApplyModifiedProperties(); }
/// <summary> /// Displays the bug report button. /// </summary> /// <param name='featureLabel'>Feature label.</param> private static void DisplayBugReportButton(GUIContent featureLabel) { if (EditorGUIX.DisplayButton(string.Format("Report a Problem with {0}", featureLabel.text))) { OpenUrl( string.Format( "mailto:{0}?subject={1} Bug Report&body=1) What happened?\n\n2) How often does it happen?\n\n" + "3) How can I reproduce it using the example you attached?", s_BugReportEmailAddress, featureLabel.text ), "Error Creating Bug Report", "Please ensure an application is associated with email links." ); } }
/// <summary> /// Raises the display locale override element event. /// </summary> /// <param name="rect">Rect.</param> /// <param name="index">Index.</param> /// <param name="isActive">If set to <see langword="true"/> is active.</param> /// <param name="isFocused">If set to <see langword="true"/> is focused.</param> private void OnDisplayLocaleOverrideElement(Rect rect, int index, bool isActive, bool isFocused) { if (index >= m_LocaleOverrideEntryStatuses.Count) { return; } EditorGUIX.DisplayLabelFieldWithStatus( rect, m_LocaleOverrides.serializedProperty.GetArrayElementAtIndex(index).FindPropertyRelative("m_Identifier").stringValue, null, m_LocaleOverrideEntryStatuses[index], Color.white, s_LocalizedTextElementTooltips[m_LocaleOverrideEntryStatuses[index]] ); }
public override void OnGUI(Rect position, ReflectedProperty property, GUIContent label = null) { guiRect.SetRect(position); Initialize(property); int index = -1; int newIndex; if (property.Value != null) { index = Array.IndexOf(subclasses, property.Type); } if (index != -1) { Rect rect = guiRect.GetFieldRect(); float width = EditorGUIUtility.labelWidth; Rect r1 = new Rect(rect) { width = width }; Rect r2 = new Rect(rect) { x = rect.x + width, width = rect.width - width }; property.IsExpanded = EditorGUI.Foldout(r1, property.IsExpanded, property.Label); newIndex = EditorGUI.Popup(r2, index + 1, subclassNames) - 1; } else { newIndex = EditorGUI.Popup(guiRect.GetFieldRect(), property.Label, index + 1, subclassNames) - 1; } if (index != newIndex) { property.SetValueAndCopyCompatibleProperties( newIndex == -1 ? null : EditorReflector.MakeInstance(subclasses[newIndex]) ); property.IsExpanded = newIndex != -1; } if (property.IsExpanded && newIndex != -1) { EditorGUI.indentLevel += 2; EditorGUIX.DrawProperties(guiRect.GetRect(), property); EditorGUI.indentLevel -= 2; } }
/// <summary> /// Displays the preferences for a feature. /// </summary> /// <param name="featureLabel">Feature label.</param> private void DisplayPreferences(GUIContent featureLabel) { m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition); { foreach (MethodInfo method in s_MenuItems[featureLabel.text]) { EditorGUILayout.LabelField( method.DeclaringType.IsGenericType ? string.Format( "{0} ({1})", method.DeclaringType.Name.ToWords().Range(0, -2), ", ".Join(from t in method.DeclaringType.GetGenericArguments() select t.Name.ToWords()) ) : method.DeclaringType.Name.ToWords(), EditorStyles.boldLabel ); EditorGUIX.DisplayHorizontalLine(); EditorGUI.indentLevel += 1; method.Invoke(null, null); EditorGUI.indentLevel -= 1; } } EditorGUILayout.EndScrollView(); // bug report button DisplayBugReportButton(featureLabel); // forum link button if ( s_SupportForumUrls.ContainsKey(featureLabel.text) && !string.IsNullOrEmpty(s_SupportForumUrls[featureLabel.text]) && EditorGUIX.DisplayButton(string.Format("Get Help with {0}", featureLabel.text)) ) { OpenUrl(s_SupportForumUrls[featureLabel.text]); } // asset store page if ( s_AssetStoreUrls.ContainsKey(featureLabel.text) && !string.IsNullOrEmpty(s_AssetStoreUrls[featureLabel.text]) && EditorGUIX.DisplayButton(string.Format("Review {0} on the Unity Asset Store", featureLabel.text)) ) { OpenUrl(s_AssetStoreUrls[featureLabel.text]); } // products page if (EditorGUIX.DisplayButton("More Products by Candlelight Interactive")) { OpenUrl(s_PublisherPage); } }
/// <summary> /// Displays the handle preferences. They will be displayed in the preference menu and the top of the inspector. /// </summary> new protected static void DisplayHandlePreferences() { EditorGUI.BeginChangeCheck(); { s_OverrideBuiltinEditors.CurrentValue = EditorGUIX.DisplayOnOffToggle( "Override Builtin Joint Editors", s_OverrideBuiltinEditors.CurrentValue ); } if (EditorGUI.EndChangeCheck()) { UnityFeatureDefineSymbols.SetSymbolForAllBuildTargets( s_OverrideBuiltinEditorSymbol, g => s_OverrideBuiltinEditors.CurrentValue ); } DisplaySceneGUIHandlePreferences(); }
/// <summary> /// Raises the preference menu GUI event. /// </summary> private static void OnPreferenceMenuGUI() { EditorGUIX.DisplayHandlePropertyEditor <HyperTextEditor>( "Hitboxes", s_HitboxTogglePreference, s_HitboxColorPreference ); EditorGUI.BeginChangeCheck(); { s_DebugSceneModePreference.CurrentValue = (DebugSceneMode)EditorGUILayout.EnumPopup( "Debug Scene Mode", s_DebugSceneModePreference.CurrentValue ); } if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } }
/// <summary> /// Raises the draw inherited style entry event. /// </summary> /// <param name="position">Position.</param> /// <param name="index">Index.</param> /// <param name="isActive">If set to <see langword="true"/> is active.</param> /// <param name="isFocused">If set to <see langword="true"/> is focused.</param> private void OnDrawInheritedStyleEntry(Rect position, int index, bool isActive, bool isFocused) { position.height = EditorGUIUtility.singleLineHeight; s_ReusableLabel.text = string.Format("Style {0}{1}", index, index == m_InheritedStyles.count - 1 ? " (Parent)" : ""); EditorGUI.BeginChangeCheck(); { EditorGUIX.DisplayScriptableObjectPropertyFieldWithButton <HyperTextStyles>( position, m_InheritedStyles.serializedProperty.GetArrayElementAtIndex(index), s_ReusableLabel ); } if (EditorGUI.EndChangeCheck()) { UpdateCustomStyleGUIContents(); } }
/// <summary> /// Raises the GUI event. /// </summary> /// <param name="position">Position.</param> /// <param name="property">Property.</param> /// <param name="label">Label.</param> public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { Initialize(property); SerializedProperty inputText = property.FindPropertyRelative("m_InputText"); SerializedProperty styles = property.FindPropertyRelative("m_Styles"); SerializedProperty supportRichText = property.FindPropertyRelative("m_IsRichTextDesired"); Rect entirePosition = position; position.height = (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 2f; EditorGUI.PropertyField(position, inputText); position.x = entirePosition.x; position.width = entirePosition.width; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; position.height = EditorGUIUtility.singleLineHeight; EditorGUIX.DisplayScriptableObjectPropertyFieldWithButton <HyperTextStyles>(position, styles); position.y += position.height + EditorGUIUtility.standardVerticalSpacing; HyperTextEditor.DisplayOverridableProperty( position, property.FindPropertyRelative("m_ReferenceFontSize"), property.FindPropertyRelative("m_ShouldOverrideStylesFontSize"), styles ); position.x = entirePosition.x; position.width = entirePosition.width; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(position, supportRichText, s_RichTextLabel); position.y += position.height + EditorGUIUtility.standardVerticalSpacing; ++EditorGUI.indentLevel; EditorGUI.BeginDisabledGroup(!supportRichText.boolValue); { EditorGUI.PropertyField( position, property.FindPropertyRelative("m_IsDynamicFontDesired"), s_DynamicFontLabel ); } EditorGUI.EndDisabledGroup(); --EditorGUI.indentLevel; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; position.height = m_LinkCollections[property.propertyPath].GetHeight(); m_LinkCollections[property.propertyPath].DoList(position); position.y += position.height; position.height = m_TagCollections[property.propertyPath].GetHeight(); m_TagCollections[property.propertyPath].DoList(position); position.y += position.height; position.height = m_QuadCollections[property.propertyPath].GetHeight(); m_QuadCollections[property.propertyPath].DoList(position); }
/// <summary> /// Displays a validation icon next to a style's label in the inspector. /// </summary> /// <param name="elementDrawPosition">Element draw position.</param> /// <param name="info">Validation info.</param> private static void DisplayStyleIdentifierValidationIcon(Rect elementDrawPosition, CustomStyleGUIContent info) { if ( elementDrawPosition.height < (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 2f ) { elementDrawPosition.x += elementDrawPosition.width - EditorGUIUtility.singleLineHeight; } else { elementDrawPosition.x += EditorGUIUtility.labelWidth - EditorGUIUtility.singleLineHeight - EditorGUIX.StandardHorizontalSpacing; } elementDrawPosition.height = elementDrawPosition.width = EditorGUIUtility.singleLineHeight; info.Status = info.Status == ValidationStatus.Okay ? ValidationStatus.None : info.Status; EditorGUIX.DisplayValidationStatusIcon(elementDrawPosition, info.Status, info.StatusTooltip); }
public static void DisplayPreferenceGUI() { GUILayout.BeginArea(new Rect(134f, 39f, 352f, 352f)); // the rect in the preference window is bizarre... { #if IS_CANDLELIGHT_SCENE_GUI_AVAILABLE EditorGUIX.DisplaySceneGUIToggle(); #endif EditorGUILayout.BeginVertical(TabAreaStyle, GUILayout.ExpandWidth(false)); { Instance.m_CurrentTab = EditorGUIX.DisplayTabGroup( Instance.m_CurrentTab, s_FeatureGroupLabels, s_TabPages, 4 ); } EditorGUILayout.EndVertical(); } GUILayout.EndArea(); }
/// <summary> /// Displays the scene GUI handle toggles. This group appears at the top of the scene GUI overlay. /// </summary> protected override void DisplaySceneGUIHandleToggles() { base.DisplaySceneGUIHandleToggles(); if (this.ImplementsLinearLimits) { AreLinearLimitHandlesEnabled = EditorGUIX.DisplayOnOffToggle("Linear Limit Handle", AreLinearLimitHandlesEnabled); } if (this.ImplementsAngularLimits) { AreAngularLimitHandlesEnabled = EditorGUIX.DisplayOnOffToggle( "Angular Limit Handle", AreAngularLimitHandlesEnabled ); AreAxisHandlesEnabled = EditorGUIX.DisplayOnOffToggle("Axis Handle", AreAxisHandlesEnabled); } if (this.ImplementsAnchor) { AreAnchorHandlesEnabled = EditorGUIX.DisplayOnOffToggle("Anchor Handle", AreAnchorHandlesEnabled); } }