コード例 #1
0
            private static int GetWidth(TableUi ui, ref int cursor)
            {
                var widthInPercent = ui.Sizes[cursor];

                cursor++;
                return(widthInPercent);
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            public override void Ui(TableUi 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);
                }
            }
コード例 #4
0
            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();
            }
コード例 #5
0
            public override void Ui(TableUi 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);
                }
            }
コード例 #6
0
 protected override void AdditionalLabelFields(TableUi ui)
 {
     NextColorRow(ui, "Labels color for selected", "Color for labels in Scene View, when they are selected", LabelColorSelected, newValue => LabelColorSelected = newValue);
 }
コード例 #7
0
 protected virtual void AdditionalLabelFields(TableUi ui)
 {
 }
コード例 #8
0
 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();
 }
コード例 #9
0
 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();
 }
コード例 #10
0
 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();
 }
コード例 #11
0
 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();
 }
コード例 #12
0
            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();
            }
コード例 #13
0
            public override void Ui(TableUi ui)
            {
                base.Ui(ui);

                NextColorRow(ui, "Handles Color", "Color of handles in Scene View", HandlesColor, newValue => HandlesColor = newValue);
            }