private void Next3BoolRow(TableUi 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 virtual void Ui(TableUi 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); }
protected void NextColorRow(TableUi 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(TableUi 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(TableUi 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(TableUi 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(TableUi 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(); }