private void Translate(int verticalOffset) { if (computer.hasMorph && !MorphWindow.editShapeMode) { return; } Rect barRect = new Rect(0f, verticalOffset, Screen.width, 35 * scale); if (barRect.Contains(Event.current.mousePosition)) { mouseHoversToolbar = true; } GUI.color = new Color(1f, 1f, 1f, 0.3f); GUI.Box(barRect, "", SplineEditorGUI.whiteBox); GUI.color = SplineEditorGUI.activeColor; DreamteckEditorGUI.Label(new Rect(110 * scale, verticalOffset + 5 * scale, 90 * scale, 25 * scale), "Grid snap", true); positionEditor.snap = GUI.Toggle(new Rect(200 * scale, verticalOffset + 10 * scale, 25 * scale, 25 * scale), positionEditor.snap, ""); if (positionEditor.snap) { DreamteckEditorGUI.Label(new Rect(220 * scale, verticalOffset + 5 * scale, 80 * scale, 30 * scale), "Grid size:", true); positionEditor.snapGridSize = SplineEditorGUI.FloatField(new Rect(300 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), positionEditor.snapGridSize); positionEditor.snapGridSize = SplineEditorGUI.FloatDrag(new Rect(220 * scale, verticalOffset + 5 * scale, 80 * scale, 25 * scale), positionEditor.snapGridSize); if (positionEditor.snapGridSize < 0.001f) { positionEditor.snapGridSize = 0.001f; } } EditSpaceMenu(verticalOffset); }
private void Mirror(int verticalOffset) { if (computer.hasMorph && !MorphWindow.editShapeMode) { return; } Rect barRect = new Rect(0f, verticalOffset, Screen.width, 35 * scale); if (barRect.Contains(Event.current.mousePosition)) { mouseHoversToolbar = true; } GUI.color = new Color(1f, 1f, 1f, 0.3f); GUI.Box(barRect, "", SplineEditorGUI.whiteBox); GUI.color = SplineEditorGUI.activeColor; if (SplineEditorGUI.Button(new Rect(5 * scale, verticalOffset + 5 * scale, 100 * scale, 25 * scale), "Cancel")) { ExitMirrorMode(); } if (SplineEditorGUI.Button(new Rect(115 * scale, verticalOffset + 5 * scale, 100 * scale, 25 * scale), "Save")) { SaveMirror(); } DreamteckEditorGUI.Label(new Rect(215 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), "Axis", true); int axis = (int)mirrorEditor.axis; bool hover = SplineEditorGUI.DropDown(new Rect(270 * scale, verticalOffset + 5 * scale, 60 * scale, 25 * scale), SplineEditorGUI.defaultButton, new string[] { "X", "Y", "Z" }, true, ref axis); mirrorEditor.axis = (SplinePointMirrorEditor.Axis)axis; if (hover) { mouseHoversToolbar = true; } DreamteckEditorGUI.Label(new Rect(315 * scale, verticalOffset + 5 * scale, 60 * scale, 25 * scale), "Flip", true); mirrorEditor.flip = GUI.Toggle(new Rect(380 * scale, verticalOffset + 10 * scale, 25 * scale, 25 * scale), mirrorEditor.flip, ""); DreamteckEditorGUI.Label(new Rect(390 * scale, verticalOffset + 5 * scale, 120 * scale, 25 * scale), "Weld Distance", true); mirrorEditor.weldDistance = SplineEditorGUI.FloatField(new Rect(525 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), mirrorEditor.weldDistance); mirrorEditor.weldDistance = SplineEditorGUI.FloatDrag(new Rect(390 * scale, verticalOffset + 5 * scale, 120 * scale, 25 * scale), mirrorEditor.weldDistance); if (mirrorEditor.weldDistance < 0f) { mirrorEditor.weldDistance = 0f; } DreamteckEditorGUI.Label(new Rect(570 * scale, verticalOffset + 5 * scale, 120 * scale, 25 * scale), "Center X:", true); mirrorEditor.center.x = SplineEditorGUI.FloatField(new Rect(700 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), mirrorEditor.center.x); DreamteckEditorGUI.Label(new Rect(720 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), "Y:", true); mirrorEditor.center.y = SplineEditorGUI.FloatField(new Rect(770 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), mirrorEditor.center.y); DreamteckEditorGUI.Label(new Rect(790 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), "Z:", true); mirrorEditor.center.z = SplineEditorGUI.FloatField(new Rect(840 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), mirrorEditor.center.z); }
private void CreateToolbar(int verticalOffset) { Rect barRect = new Rect(0f, verticalOffset, Screen.width, 35 * scale); if (barRect.Contains(Event.current.mousePosition)) { mouseHoversToolbar = true; } GUI.color = new Color(1f, 1f, 1f, 0.3f); GUI.Box(barRect, "", SplineEditorGUI.whiteBox); GUI.color = SplineEditorGUI.activeColor; DreamteckEditorGUI.Label(new Rect(5 * scale, verticalOffset + 5 * scale, 105 * scale, 25 * scale), "Place method:", true); bool hover = SplineEditorGUI.DropDown(new Rect(110 * scale, verticalOffset + 5 * scale, 130 * scale, 25 * scale), SplineEditorGUI.defaultButton, new string[] { "Camera Plane", "Insert", "Surface", "X Plane", "Y Plane", "Z Plane" }, true, ref createPointMode); if (hover) { mouseHoversToolbar = true; } DreamteckEditorGUI.Label(new Rect(220 * scale, verticalOffset + 5 * scale, 100 * scale, 25 * scale), "Normal:", true); hover = SplineEditorGUI.DropDown(new Rect(320 * scale, verticalOffset + 5 * scale, 160 * scale, 25 * scale), SplineEditorGUI.defaultButton, new string[] { "Auto", "Look at Camera", "Align with Camera", "Calculate", "Left", "Right", "Up", "Down", "Forward", "Back" }, true, ref createNormalMode); if (hover) { mouseHoversToolbar = true; } DreamteckEditorGUI.Label(new Rect(800 * scale, verticalOffset + 5 * scale, 90 * scale, 25 * scale), "Add Node", true); createNodeOnCreatePoint = GUI.Toggle(new Rect(890 * scale, verticalOffset + 10 * scale, 25 * scale, 25 * scale), createNodeOnCreatePoint, ""); bool showNormalField = false; if (createPointMode >= 3 && createPointMode <= 5) { DreamteckEditorGUI.Label(new Rect(500 * scale, verticalOffset + 5 * scale, 80 * scale, 30 * scale), "Grid offset:", true); showNormalField = true; } else if (createPointMode == 2) { DreamteckEditorGUI.Label(new Rect(480 * scale, verticalOffset + 5 * scale, 100 * scale, 30 * scale), "Normal offset:", true); showNormalField = true; if (SplineEditorGUI.Button(new Rect(925 * scale, verticalOffset * scale + 5, 95 * scale, 25 * scale), "LayerMask")) { LayermaskWindow maskWindow = EditorWindow.GetWindow <LayermaskWindow>(true); maskWindow.position = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 10, 10); maskWindow.Init(this, new Vector2(150, 30), new Vector2(150, 30)); } } else if (createPointMode == 0) { DreamteckEditorGUI.Label(new Rect(500 * scale, verticalOffset + 5 * scale, 80 * scale, 30 * scale), "Far plane:", true); showNormalField = true; } if (showNormalField) { createPointOffset = SplineEditorGUI.FloatField(new Rect(580 * scale, verticalOffset + 5 * scale, 50 * scale, 25 * scale), createPointOffset); createPointOffset = SplineEditorGUI.FloatDrag(new Rect(500 * scale, verticalOffset + 5 * scale, 80 * scale, 25 * scale), createPointOffset); if (createPointOffset < 0f && createPointMode < 3) { createPointOffset = 0f; } } minWidth = 790; if (createPointMode != 1) { DreamteckEditorGUI.Label(new Rect(625 * scale, verticalOffset + 5 * scale, 80 * scale, 30 * scale), "Append:", true); if (SplineEditorGUI.DropDown(new Rect(705 * scale, verticalOffset + 5 * scale, 100 * scale, 25 * scale), SplineEditorGUI.defaultButton, new string[] { "End", "Beginning" }, true, ref appendMode)) { mouseHoversToolbar = true; } minWidth = 1100; } }
private void Create(int verticalOffset) { Rect barRect = new Rect(0f, verticalOffset, Screen.width, 35 * scale); if (barRect.Contains(Event.current.mousePosition)) { mouseHovers = true; } GUI.color = new Color(1f, 1f, 1f, 0.3f); GUI.Box(barRect, "", SplineEditorGUI.whiteBox); GUI.color = SplineEditorGUI.activeColor; SplineEditorGUI.Label(new Rect(5 * scale, verticalOffset + 5 * scale, 105 * scale, 25 * scale), "Place method:", true); bool hover = SplineEditorGUI.DropDown(new Rect(115 * scale, verticalOffset + 5 * scale, 140 * scale, 25 * scale), SplineEditorGUI.defaultButton, new string[] { "Camera Plane", "Insert", "Surface", "Plane-X", "Plane-Y", "Plane-Z" }, true, ref editor.createPointMode); if (hover) { mouseHovers = true; } SplineEditorGUI.Label(new Rect(280 * scale, verticalOffset + 5 * scale, 135 * scale, 25 * scale), "Normal orientation:", true); hover = SplineEditorGUI.DropDown(new Rect(420 * scale, verticalOffset + 5 * scale, 160 * scale, 25 * scale), SplineEditorGUI.defaultButton, new string[] { "Auto", "Look at Camera", "Align with Camera", "Calculate", "Left", "Right", "Up", "Down", "Forward", "Back" }, true, ref editor.createNormalMode); if (hover) { mouseHovers = true; } SplineEditorGUI.Label(new Rect(575 * scale, verticalOffset + 5 * scale, 90 * scale, 25 * scale), "Add Node", true); editor.createNodeOnCreatePoint = GUI.Toggle(new Rect(670 * scale, verticalOffset + 10 * scale, 25 * scale, 25 * scale), editor.createNodeOnCreatePoint, ""); bool showNormalField = false; if (editor.createPointMode == 0) { SplineEditorGUI.Label(new Rect(700 * scale, verticalOffset + 5 * scale, 80 * scale, 30 * scale), "Far plane:", true); showNormalField = true; } if (editor.createPointMode == 2) { SplineEditorGUI.Label(new Rect(700 * scale, verticalOffset + 5 * scale, 100 * scale, 30 * scale), "Normal offset:", true); showNormalField = true; } if (editor.createPointMode >= 3 && editor.createPointMode <= 5) { SplineEditorGUI.Label(new Rect(700 * scale, verticalOffset + 5 * scale, 80 * scale, 30 * scale), "Grid offset:", true); showNormalField = true; } minWidth = 790; if (editor.createPointMode != 1) { SplineEditorGUI.Label(new Rect(850 * scale, verticalOffset + 5 * scale, 80 * scale, 30 * scale), "Append:", true); if (SplineEditorGUI.DropDown(new Rect(940 * scale, verticalOffset + 5 * scale, 120 * scale, 25 * scale), SplineEditorGUI.defaultButton, new string[] { "End", "Beginning" }, true, ref editor.appendMode)) { mouseHovers = true; } minWidth = 1100; } if (showNormalField) { editor.createPointOffset = SplineEditorGUI.FloatField(new Rect(790 * scale, verticalOffset + 5 * scale, 70 * scale, 25 * scale), editor.createPointOffset); editor.createPointOffset = SplineEditorGUI.FloatDrag(new Rect(700 * scale, verticalOffset + 5 * scale, 80 * scale, 25 * scale), editor.createPointOffset); if (editor.createPointOffset < 0f && editor.createPointMode < 3) { editor.createPointOffset = 0f; } } }