public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { // Hackjob way to get the target - needs to reference a serialized field in order to work. fc = (FloatCrusher)DrawerUtils.GetParent(property.FindPropertyRelative("_min")); int hash = fc.GetHashCode(); return(CalculateHeight(fc, hash)); }
public override void OnGUI(Rect r, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(r, label, property); haschanged = false; p = property; base.OnGUI(r, property, label); bool isWrappedInElementCrusher = DrawerUtils.GetParent(property) is ElementCrusher; bool disableRange = (label.tooltip != null && label.tooltip.Contains("DISABLE_RANGE")); gc_fc.text = label.text; gc_fc.tooltip = (disableRange) ? null : label.tooltip; holdindent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; int hash = fc.GetHashCode(); height = CalculateHeight(fc, hash); this.r = r; line = r.yMin; colortex = (fc.axis == Axis.X) ? SolidTextures.red2D : (fc.axis == Axis.Y) ? SolidTextures.green2D : (fc.axis == Axis.Z) ? SolidTextures.blue2D : SolidTextures.gray2D; if (!isWrappedInElementCrusher) { Rect outline = ir; outline.xMin--; outline.yMin--; outline.xMax++; outline.yMax++; SolidTextures.DrawTexture(outline, SolidTextures.lowcontrast2D); } SolidTextures.DrawTexture(ir, colortex); //SolidTextures.DrawTexture(new Rect(ir.xMin, line, ir.width, height), colortex); //SolidTextures.DrawTexture(new Rect(ir.xMin + 1, ir.yMin + 1, ir.width - 2, ir.height - 2), colortex); line++; line += SPACING; fc.expanded = DrawHeader(r, gc_fc, fc.expanded); line += PADDING + HEADR_HGHT; if (fc.Enabled && fc.expanded) { bool noSettings = (fc.BitsDeterminedBy == BitsDeterminedBy.HalfFloat || fc.BitsDeterminedBy == BitsDeterminedBy.Uncompressed || fc.BitsDeterminedBy == BitsDeterminedBy.Disabled); DrawCompressionMethod(); EditorGUI.BeginDisabledGroup(disableRange); if (!noSettings && !(fc.TRSType == TRSType.Normal)) { DrawCodecSettings(property); } EditorGUI.EndDisabledGroup(); if (!noSettings) { DrawAccurateCenter(); } if (!noSettings && fc.showBCL) { DrawBCL(); } if (!noSettings) { DrawActualValues(); } } if (haschanged) { EditorUtility.SetDirty(property.serializedObject.targetObject); } EditorGUI.indentLevel = holdindent; EditorGUI.EndProperty(); }