private static int GetWidth(BGTableView ui, ref int cursor) { var widthInPercent = ui.Sizes[cursor]; cursor++; return(widthInPercent); }
public virtual void Ui(BGTableView ui) { ui.NextColumn(rect => EditorGUI.LabelField(rect, title), 100, true); ui.NextRow(); // show in point menu NextBoolRow(ui, "Show in Points Menu", "Show in Points Menu (Points Tab)", ShowInPointsMenu, newValue => ShowInPointsMenu = newValue); }
public override void Ui(BGTableView ui) { base.Ui(ui); NextBoolRow(ui, "Show spheres", "Show spheres at points positions in Scene View", ShowSpheres, b => ShowSpheres = b); if (ShowSpheres) { NextSliderRow(ui, " Sphere radius", "Sphere radius in Scene View", SpheresRadius, .01f, 1, f => SpheresRadius = f); NextColorRow(ui, " Sphere color", "Sphere color in Scene View", SpheresColor, f => SpheresColor = f); } }
private void Next3BoolRow(BGTableView ui, string label, string tooltip, string xLabel, string yLabel, string zLabel, bool xValue, bool yValue, bool zValue, Action <bool> xSetter, Action <bool> ySetter, Action <bool> zSetter) { ui.NextColumn(label, tooltip); const int widthInPercent = (100 - LabelWidth) / 3; ui.NextColumn(xLabel, rect => BGEditorUtility.ToggleField(rect, xValue, xSetter), widthInPercent, ui.CenteredLabelStyle); ui.NextColumn(yLabel, rect => BGEditorUtility.ToggleField(rect, yValue, ySetter), widthInPercent, ui.CenteredLabelStyle); ui.NextColumn(zLabel, rect => BGEditorUtility.ToggleField(rect, zValue, zSetter), widthInPercent, ui.CenteredLabelStyle); ui.NextRow(); }
public override void Ui(BGTableView ui) { base.Ui(ui); NextBoolRow(ui, "Show Handles", "Show handles in Scene View", ShowHandles, newValue => ShowHandles = newValue); if (ShowHandles) { NextEnumRow(ui, " Handles Types", "Type for the handle", HandlesType, newValue => HandlesType = (BGCurveSettings.HandlesTypeEnum)newValue); if (HandlesType == BGCurveSettings.HandlesTypeEnum.Configurable) { NextSliderRow(ui, " Handles Axis Size", "Size of the Axis handles in Scene View", HandlesSettings.AxisScale, .5f, 1.5f, newValue => HandlesSettings.AxisScale = newValue); NextSliderRow(ui, " Handles Plane Size", "Size of the Plane handles in Scene View", HandlesSettings.PlanesScale, .5f, 1.5f, newValue => HandlesSettings.PlanesScale = newValue); NextSliderRow(ui, " Handles Alpha", "Alpha color of handles in Scene View", HandlesSettings.Alpha, .5f, 1f, newValue => HandlesSettings.Alpha = newValue); Next3BoolRow(ui, " Remove Axis", "Remove Axis handles", "X", "Y", "Z", HandlesSettings.RemoveX, HandlesSettings.RemoveY, HandlesSettings.RemoveZ, newValue => HandlesSettings.RemoveX = newValue, newValue => HandlesSettings.RemoveY = newValue, newValue => HandlesSettings.RemoveZ = newValue ); Next3BoolRow(ui, " Remove Planes", "Remove Planes handles", "XZ", "XY", "YZ", HandlesSettings.RemoveXZ, HandlesSettings.RemoveXY, HandlesSettings.RemoveYZ, newValue => HandlesSettings.RemoveXZ = newValue, newValue => HandlesSettings.RemoveXY = newValue, newValue => HandlesSettings.RemoveYZ = newValue ); } } NextBoolRow(ui, "Show Labels", "Show labels in Scene View", ShowLabels, newValue => ShowLabels = newValue); if (ShowLabels) { NextBoolRow(ui, " Show Positions", "Show vector positions in Scene View", ShowPositions, newValue => ShowPositions = newValue); NextColorRow(ui, " Labels color", "Color for labels in Scene View", LabelColor, newValue => LabelColor = newValue); AdditionalLabelFields(ui); } }
public override void Ui(BGTableView ui) { base.Ui(ui); NextColorRow(ui, "Handles Color", "Color of handles in Scene View", HandlesColor, newValue => HandlesColor = newValue); }
protected override void AdditionalLabelFields(BGTableView ui) { NextColorRow(ui, "Labels color for selected", "Color for labels in Scene View, when they are selected", LabelColorSelected, newValue => LabelColorSelected = newValue); }
protected virtual void AdditionalLabelFields(BGTableView ui) { }
protected void NextColorRow(BGTableView ui, string label, string tooltip, Color color, Action <Color> func) { ui.NextColumn(label, tooltip); ui.NextColumn(rect => BGEditorUtility.ColorField(rect, color, func)); ui.NextRow(); }
protected void NextSliderRow(BGTableView ui, string label, string tooltip, float value, float from, float to, Action <float> valueSetter) { ui.NextColumn(label, tooltip); ui.NextColumn(rect => BGEditorUtility.SliderField(rect, value, @from, to, valueSetter)); ui.NextRow(); }
protected void NextEnumRow(BGTableView ui, string label, string tooltip, Enum value, Action <Enum> valueSetter) { ui.NextColumn(label, tooltip); ui.NextColumn(rect => BGEditorUtility.PopupField(rect, value, valueSetter)); ui.NextRow(); }
protected void NextBoolRow(BGTableView ui, string label, string tooltip, bool value, Action <bool> valueSetter) { ui.NextColumn(label, tooltip); ui.NextColumn(rect => BGEditorUtility.ToggleField(rect, value, valueSetter)); ui.NextRow(); }
public void Ui(BGTableView ui) { var cursor = 0; // ========================== First row //number ui.NextColumn("" + index, "Field's index", GetWidth(ui, ref cursor)); //name ui.NextColumn(rect => { BGEditorUtility.TextField(rect, field.FieldName, s => { if (NameHasError(field.Curve, s)) { return; } Change(() => field.FieldName = s); }, true); }, GetWidth(ui, ref cursor)); //type ui.NextColumn(field.Type.ToString(), "Field's Type", GetWidth(ui, ref cursor)); //show in Points menu ui.NextColumn(rect => BGEditorUtility.BoolField(rect, BGPrivateField.GetShowInPointsMenu(field), b => Change(() => BGPrivateField.SetShowInPointsMenu(field, b))), GetWidth(ui, ref cursor)); //delete icon ui.NextColumn(rect => { if (!GUI.Button(rect, deleteIcon) || !BGEditorUtility.Confirm("Delete", "Are you sure you want to delete '" + field.FieldName + "' field?", "Delete")) { return; } BGPrivateField.Invoke(field.Curve, BGCurve.MethodDeleteField, field, (Action <BGCurvePointField>)Undo.DestroyObjectImmediate); GUIUtility.ExitGUI(); }, GetWidth(ui, ref cursor)); //\r\n ui.NextRow(); // ========================== Second row //does not support if (!SupportHandles(field.Type)) { return; } ui.NextColumn(" Handles", "Field's index", 25); //handles type ui.NextColumn( rect => BGEditorUtility.PopupField(rect, (HandlesType)BGPrivateField.GetHandlesType(field), Type2Handles[field.Type], b => Change(() => BGPrivateField.SetHandlesType(field, (int)((HandlesType)b)))), 30); //Handles color ui.NextColumn(rect => BGEditorUtility.ColorField(rect, BGPrivateField.GetHandlesColor(field), b => Change(() => BGPrivateField.SetHandlesColor(field, b))), 30); //show handles in Scene View ui.NextColumn(rect => BGEditorUtility.BoolField(rect, BGPrivateField.GetShowHandles(field), b => Change(() => BGPrivateField.SetShowHandles(field, b))), 5); //empty column under delete button ui.NextColumn(rect => EditorGUI.LabelField(rect, ""), 10); //\r\n ui.NextRow(); }