public override void DrawSection() { repaint = false; using (new GUILayout.HorizontalScope()) { showSection = GUILayout.Toggle(showSection, "", EUIResourceManager.Instance.Skin.button, GUILayout.Height(30), GUILayout.Width(30)); GUILayout.Box(EUIResourceManager.Instance.GetContent("Transform Header"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.MaxWidth(256), GUILayout.MaxHeight(30)); } if (!showSection) { return; } // Position using (new HorizontalCenteredScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Global Position"), GUILayout.Width(BlockoutEditorSettings.TwoColumnWidth))) { var selection = Selection.gameObjects; Undo.RecordObjects(selection.ToList().Select(x => x.transform).ToArray(), "Reset To Global Position"); foreach (var sel in selection) { sel.transform.position = Vector3.zero; } } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Local Position"), GUILayout.Width(BlockoutEditorSettings.TwoColumnWidth))) { var sel = Selection.gameObjects; Undo.RecordObjects(sel.Select(x => x.transform).ToArray(), "Reset To Parent Position"); foreach (var s in sel) { s.transform.localPosition = Vector3.zero; } } } // Rotation using (new HorizontalCenteredScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Global Rotation"), GUILayout.Width(BlockoutEditorSettings.TwoColumnWidth))) { var sel = Selection.gameObjects; Undo.RecordObjects(sel.Select(x => x.transform).ToArray(), "Reset Global Rotation"); for (var i = 0; i < sel.Length; ++i) { sel[i].transform.rotation = Quaternion.identity; } } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Local Rotation"), GUILayout.Width(BlockoutEditorSettings.TwoColumnWidth))) { var sel = Selection.gameObjects; Undo.RecordObjects(sel.Select(x => x.transform).ToArray(), "Reset To Parent Rotation"); for (var i = 0; i < sel.Length; ++i) { sel[i].transform.localRotation = Quaternion.identity; } } } // Snap rotation using (new HorizontalCenteredScope()) { var originalColour = GUI.backgroundColor; var originalContentColour = GUI.contentColor; GUI.backgroundColor = new Color(1.0f, 0.467f, 0.465f); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("X 90"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Rotate(Vector3.right, -90); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("X 180"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Rotate(Vector3.right, 180); } GUI.backgroundColor = new Color(0.467f, 1.0f, 0.514f); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Y 90"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Rotate(Vector3.up, -90); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Y 180"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Rotate(Vector3.up, 180); } GUI.backgroundColor = new Color(0.467f, 0.67f, 1.0f); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Z 90"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Rotate(Vector3.forward, 90); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Z 180"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Rotate(Vector3.forward, 180); } GUI.backgroundColor = originalColour; GUI.contentColor = originalContentColour; } // Mirror Tools using (new HorizontalCenteredScope()) { var originalColour = GUI.backgroundColor; GUI.backgroundColor = m_backgroundRed; if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Mirror X"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth), GUILayout.Height(30))) { BlockoutStaticFunctions.Mirror(-Vector3.right); } GUI.backgroundColor = m_backgroundGreen; if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Mirror Y"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth), GUILayout.Height(30))) { BlockoutStaticFunctions.Mirror(-Vector3.up); } GUI.backgroundColor = m_backgroundBlue; if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Mirror Z"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth), GUILayout.Height(30))) { BlockoutStaticFunctions.Mirror(-Vector3.forward); } GUI.backgroundColor = originalColour; } }