public void ConfirmSpawn() { if (!Selection.activeGameObject && !showScrollPicker) { return; } showScrollPicker = false; if (originalMesh) { Selection.activeGameObject.GetComponent <MeshFilter>().sharedMesh = originalMesh; Selection.activeGameObject.GetComponent <Collider>().enabled = true; } else { Debug.LogError("BLOCKOUT :: INTERNAL :: No original mesh defined"); } GameObject go = PrefabUtility.InstantiatePrefab(targetPrefabSwap) as GameObject; go.transform.position = Selection.activeGameObject.transform.position; go.transform.rotation = targetPrefabSwap.transform.rotation; Selection.activeGameObject = go; GetFavorites(); BlockoutStaticFunctions.ApplyCurrentTheme(); }
void OnGUI() { using (var sv = new GUILayout.ScrollViewScope(scroll)) { scroll = sv.scrollPosition; using (new HorizontalCenteredScope()) { using (new GUILayout.VerticalScope(GUILayout.Width(390))) { if (BlockoutStaticFunctions.FindHeirachy(ref hierarchy)) { renderingSplash = false; DrawMainWindow(); } else { renderingSplash = true; splashScreen.DrawSection(); } } } } if (sections.Count(x => x.Repaint) > 0) { Repaint(); } }
public void CancelScrollPicker() { showScrollPicker = false; if (originalMesh) { Selection.activeGameObject.GetComponent <MeshFilter>().sharedMesh = originalMesh; } BlockoutStaticFunctions.ApplyCurrentTheme(); }
public void CancelQickpicker() { showQuickPicker = false; EditorHotkeysTracker.quickPicker = false; if (originalMesh && Selection.activeGameObject) { Selection.activeGameObject.GetComponent <MeshFilter>().sharedMesh = originalMesh; } BlockoutStaticFunctions.ApplyCurrentTheme(); }
public void ConfirmSwap() { if (showScrollPicker) { showScrollPicker = false; GameObject[] target; BlockoutStaticFunctions.ReplaceObject(new[] { Selection.activeGameObject }, targetPrefabSwap, out target); Selection.activeGameObject = target[0]; BlockoutStaticFunctions.ApplyCurrentTheme(); } }
void Update() { sections.ToList().ForEach(x => x.Update()); if (currentScene != SceneManager.GetActiveScene() && !renderingSplash) { BlockoutEditorSettings.CurrentSceneSetting = null; currentScene = SceneManager.GetActiveScene(); BlockoutStaticFunctions.TryLoadSceneDefinitions(); BlockoutStaticFunctions.FindHeirachy(ref hierarchy); } }
/// <summary> /// Creates a Blockout trigger in 10 units in front of the scene camera /// </summary> void CreateTrigger() { var target = Instantiate(m_triggerPrefab); Undo.RegisterCreatedObjectUndo(target, "Created Blockout Trigger"); target.transform.position = BlockoutStaticFunctions.GetSceneViewSpawnPosition(); target.transform.SetParent(blockoutHierarchy.triggers); target.name = m_triggerPrefab.name; Selection.activeGameObject = target; BlockoutStaticFunctions.SnapPositionSelection(); SceneView.lastActiveSceneView.FrameSelected(); }
void CreateWhiteScreenShot(int i) { CommentBoxSceneGUI.Disable(); var helpers = FindObjectsOfType <BlockoutHelper>().ToList(); helpers.ForEach(x => x.HideLockedState()); BlockoutStaticFunctions.ApplyNewMaterialSchemeWithoutUndo(screenshotWhiteMaterial, blockoutHierarchy.root.gameObject); CaptureScreenShot(i); BlockoutStaticFunctions.ApplyCurrentTheme(); helpers.ForEach(x => x.ShowLockedState()); }
/// <summary> /// Creates a tri planer asset in front of the camera. /// </summary> /// <param name="prefab">The target tri planar prefab</param> private void CreateTriPlanerAsset(GameObject prefab) { var target = Instantiate(prefab); Undo.RegisterCreatedObjectUndo(target, "Created Tri-Planer Asset"); target.transform.position = BlockoutStaticFunctions.GetSceneViewSpawnPosition(); target.name = prefab.name + " (Tri-Planar)"; Selection.activeGameObject = target; BlockoutStaticFunctions.SnapPositionSelection(); SceneView.lastActiveSceneView.FrameSelected(); Tools.current = Tool.Scale; BlockoutStaticFunctions.ApplyCurrentTheme(); }
/// Apply a new parent transform to the target gameobjects /// <param name="targets"> The gameobjects to reparent</param> /// <param name="blockoutSection"> The new section that it needs to find in the level above to parent to</param> private void ApplyParentTransformFromSection(GameObject[] targets, SectionID blockoutSection) { for (var i = 0; i < targets.Length; ++i) { var vl = targets[i].GetComponentsInParent <BlockoutSection>().Where(x => x.Section == SectionID.Root) .ToList(); var localRoot = vl.Count > 0 ? vl[0].gameObject : blockoutHierarchy.root.gameObject; BlockoutStaticFunctions.CreateBlockoutSubHeirachyWithRoot(localRoot.transform, localRoot.name + "_"); var targetTransform = localRoot.GetComponentsInChildren <BlockoutSection>() .Where(x => x.Section == blockoutSection) .ToList()[0].transform; targets[i].transform.SetParent(targetTransform); BlockoutStaticFunctions.TrimTargetBlockoutHierarchy(localRoot); } BlockoutStaticFunctions.ApplyCurrentTheme(); }
public override void Update() { // Auto snapping position if (BlockoutEditorSettings.AutoSnap && !EditorApplication.isPlaying && Selection.transforms.Length > 0 && Selection.transforms[0].position != prevPosition) { if ((Selection.transforms[0].position - prevPosition).magnitude > snapValue) { prevPosition = Selection.transforms[0].position; previousObjectMain = currentObjectMain; currentObjectMain = Selection.transforms[0].gameObject; } else if (previousObjectMain != null) { BlockoutStaticFunctions.SnapPositionSelection(); prevPosition = Selection.transforms[0].position; } } // Auto snapping scale if (BlockoutEditorSettings.AutoSnap && !EditorApplication.isPlaying && Selection.transforms.Length > 0 && Selection.transforms[0].lossyScale != prevScale) { if ((Selection.transforms[0].lossyScale - prevScale).magnitude > snapValue) { prevScale = Selection.transforms[0].lossyScale; previousObjectMain = currentObjectMain; currentObjectMain = Selection.transforms[0].gameObject; } else if (previousObjectMain != null) { BlockoutStaticFunctions.SnapScaleSelection(); prevScale = Selection.transforms[0].lossyScale; } } }
void OnInspectorUpdate() { if (previousGameObject != Selection.activeGameObject) { previousGameObject = Selection.activeGameObject; if (Selection.activeGameObject) { var bh = Selection.activeGameObject.GetComponent <BlockoutHelper>(); if (bh) { if (bh.ReapplyMaterialTheme) { BlockoutStaticFunctions.ApplyCurrentTheme(); } } } } if (sections.Count(x => x.Repaint) > 0) { Repaint(); } }
public void SpawnSelected(int idx) { EditorHotkeysTracker.quickPicker = false; if (Selection.activeGameObject) { if (quickerMode == 0) { GameObject[] target; BlockoutStaticFunctions .ReplaceObject(new[] { Selection.activeGameObject }, searchSuggested[idx] .prefab, out target); Selection.activeGameObject = target[0]; } else { var pos = BlockoutStaticFunctions.GetSceneViewSpawnPosition(); GameObject go = Instantiate(searchSuggested[idx].prefab, pos, searchSuggested[idx].prefab.transform.rotation); Undo.RegisterCreatedObjectUndo(go, "Spawn Asset From Quick Picker"); Selection.activeGameObject = go; } } else { if (idx <= searchSuggested.Length || idx > 0) { var pos = BlockoutStaticFunctions.GetSceneViewSpawnPosition(); GameObject go = Instantiate(searchSuggested[idx].prefab, pos, searchSuggested[idx].prefab.transform.rotation); Undo.RegisterCreatedObjectUndo(go, "Spawn Asset From Quick Picker"); Selection.activeGameObject = go; } } showQuickPicker = false; }
public override void DrawSection() { repaint = false; GUILayout.Space(10); using (new GUILayout.HorizontalScope()) { GUILayout.Box(EUIResourceManager.Instance.GetContent("Asset Header"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.MaxWidth(236), GUILayout.MaxHeight(30)); var blockHelpers = Selection.gameObjects.ToList().Where(x => x.GetComponent <BlockoutHelper>()).Select(x => x.GetComponent <BlockoutHelper>()).ToArray(); int locked = blockHelpers.Where(x => x.Locked).ToList().Count; if (locked > 0) { using (new VerticalCenteredScope(GUILayout.MaxHeight(30))) { using (new HorizontalCenteredScope()) { GUILayout.Label(String.Format("{0} object(s) locked!", locked), GUILayout.MaxWidth(120)); GUILayout.Label(EUIResourceManager.Instance.GetTexture("Lock_Closed"), GUILayout.Height(15), GUILayout.Width(15)); } } } else { GUILayout.Space(125); } } // Draw quick jump using (new HorizontalCenteredScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Block Quickjump"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.PingAssetInProjectWindow("Block_1x1x1", "Block_Slope_1x1x1"); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Walls Quickjump"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.PingAssetInProjectWindow("Wall_025x1x1", "Wall_025x3x1"); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Floors Quickjump"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.PingAssetInProjectWindow("Floor_1x-025x1", "Floor_Angle_3x - 025x3"); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Dynamic Quickjump"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.PingAssetInProjectWindow("Barrel", "Crate_1x1x1"); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Foliage Quickjump"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.PingAssetInProjectWindow("Bush_1", "Vines_Large"); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Particles Quickjump"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.PingAssetInProjectWindow("Fire_Ground_1x1", "Water_Drip_1"); } } // Draw grid textures using (new HorizontalCenteredScope()) { // Loop through all the loaded grid textures and display them in a button. // If its selected then apply that texture to every gameobject in the scene for (var i = 0; i < EUIResourceManager.Instance.GridTextures.Length; ++i) { if (i >= EUIResourceManager.Instance.GridIcons.Length) { continue; } if (GUILayout.Button(m_gridIconLabels[i], GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth))) { BlockoutEditorSettings.CurrentGirdTexture = i; BlockoutStaticFunctions.ApplyTextureIncChildren(EUIResourceManager.Instance.GridTextures[BlockoutEditorSettings.CurrentGirdTexture], blockoutHierarchy.root); } } } // Draw themes using (new HorizontalCenteredScope()) { for (var i = 0; i < EUIResourceManager.Instance.BlockoutThemes.Length; ++i) { if (GUILayout.Button(m_themeLabels[i], GUILayout.Width(BlockoutEditorSettings.SixColumnWidth), GUILayout.Height(BlockoutEditorSettings.SixColumnWidth / 2))) { BlockoutEditorSettings.CurrentMaterialTheme = i; BlockoutEditorSettings.CurrentPallet = PalletType.Preset; BlockoutStaticFunctions.ApplyCurrentTheme(); } } } // User color pallet using (new HorizontalCenteredScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Randomize Pallet"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { GenerateRandomTheme(); BlockoutEditorSettings.CurrentMaterialTheme = EUIResourceManager.Instance.BlockoutThemes.Length + 1; BlockoutStaticFunctions.ApplyTheme(EUIResourceManager.Instance.UserTheme); BlockoutEditorSettings.CurrentPallet = PalletType.User; } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Apply Pallet"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { BlockoutEditorSettings.CurrentMaterialTheme = EUIResourceManager.Instance.BlockoutThemes.Length + 1; BlockoutStaticFunctions.ApplyTheme(EUIResourceManager.Instance.UserTheme); BlockoutEditorSettings.CurrentPallet = PalletType.User; } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Edit Pallet"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { m_userPalletFoldout = !m_userPalletFoldout; } } // User color pickers if (m_userPalletFoldout) { using (new HorizontalCenteredScope()) { using (new GUILayout.VerticalScope(GUILayout.MaxWidth(375))) { if (!Application.isPlaying && Application.isEditor) { for (var i = 0; i < m_colorStrings.Length; ++i) { GUILayout.BeginHorizontal(); m_userThemeColors[i] = EditorGUILayout.ColorField(m_colorStrings[i], m_userThemeColors[i]); m_lockColors[i] = GUILayout.Toggle(m_lockColors[i], EUIResourceManager.Instance.GetContent("Lock Color"), EUIResourceManager.Instance.Skin.FindStyle("padlock"), GUILayout.Height(15), GUILayout.Width(15)); GUILayout.EndHorizontal(); } } else { GUILayout.Label("Feature not availble during play mode."); } GUILayout.Space(5); } } } // Replace Assets using (new HorizontalCenteredScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Select Asset"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { BlockoutStaticFunctions.SelectAsset(); } if (!Application.isPlaying && Application.isEditor) { m_targetReplacementAsset = EditorGUILayout.ObjectField(new GUIContent(""), m_targetReplacementAsset, typeof(GameObject), false, GUILayout.Width(124)) as GameObject; if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Replace Asset"), GUILayout.Width(124))) { BlockoutStaticFunctions.ReplaceObject(Selection.gameObjects, m_targetReplacementAsset); } } else { GUILayout.Label("Feature not availble during play mode."); } } using (new HorizontalCenteredScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Lock Asset"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { Selection.gameObjects.ToList().Where(x => x.GetComponent <BlockoutHelper>()).Select(x => x.GetComponent <BlockoutHelper>()).ToList().ForEach(x => x.SetLock(!x.Locked)); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Toggle Locked Asset"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { globalLocked = !globalLocked; var helpers = FindObjectsOfType <BlockoutHelper>().ToList(); helpers.ForEach(x => x.SetLock(globalLocked)); } var content = EUIResourceManager.Instance.GetContent("Toggle Lockd Visability"); content.text = lockedVisability ? "Show Locked (On)" : "Show Locked (Off)"; if (GUILayout.Button(content, GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { lockedVisability = !lockedVisability; var helpers = FindObjectsOfType <BlockoutHelper>().ToList(); helpers.ForEach(x => { if (lockedVisability) { x.ShowLockedState(); } else { x.HideLockedState(); } }); } } }
/// <summary> /// Generates a random theme. /// </summary> private void GenerateRandomTheme() { var userTheme = EUIResourceManager.Instance.UserTheme; var baseTheme = Random.Range(0, EUIResourceManager.Instance.BlockoutThemes.Length); var mats = EUIResourceManager.Instance.BlockoutThemes[baseTheme].GetSortedUniqueMaterials; var randomMat = Random.Range(0, mats.Length); var baseThemeColor = mats[randomMat].GetColor("_Color"); if (!m_lockColors[2]) { userTheme.DynamicMaterial.SetColor("_Color", baseThemeColor); } float h, s, v; Color.RGBToHSV(baseThemeColor, out h, out s, out v); var pallet = BlockoutStaticFunctions.GenerateColors_SaturationLuminance(mats.Length, h); var sortedPallet = pallet.OrderBy(x => BlockoutStaticFunctions.Luminance(x)).ToList(); for (var i = 0; i < sortedPallet.Count; ++i) { Color.RGBToHSV(sortedPallet[i], out h, out s, out v); s *= 0.5f; sortedPallet[i] = Color.HSVToRGB(h, s, v); } if (!m_lockColors[0]) { userTheme.FloorMaterial.SetColor("_Color", sortedPallet[0]); userTheme.TriFloor.SetColor("_Color", sortedPallet[0]); } if (!m_lockColors[1]) { userTheme.WallMaterial.SetColor("_Color", sortedPallet[1]); userTheme.TriWalls.SetColor("_Color", sortedPallet[1]); } if (!m_lockColors[4]) { userTheme.TrimMaterial.SetColor("_Color", sortedPallet[2]); userTheme.TriTrim.SetColor("_Color", sortedPallet[2]); } if (!m_lockColors[5]) { userTheme.FoliageMaterial.SetColor("_Color", sortedPallet[3]); } if (!m_lockColors[7]) { userTheme.TriggerMaterial.SetColor("_Color", sortedPallet[0]); userTheme.TriggerMaterial.SetColor("_Color_1", sortedPallet[0]); } if (!m_lockColors[5]) { Color.RGBToHSV(sortedPallet[1], out h, out s, out v); var leafMatOptions = BlockoutStaticFunctions.GenerateColors_Saturation(1, h, v); userTheme.LeavesMaterial.SetColor("_Color", leafMatOptions[0] * 0.5f); userTheme.LeavesMaterial.SetColor("_Color_1", leafMatOptions[0] * 0.5f); } m_userThemeColors[0] = userTheme.FloorMaterial.GetColor("_Color"); m_userThemeColors[1] = userTheme.WallMaterial.GetColor("_Color"); m_userThemeColors[2] = userTheme.DynamicMaterial.GetColor("_Color"); m_userThemeColors[3] = userTheme.TrimMaterial.GetColor("_Color"); m_userThemeColors[4] = userTheme.FoliageMaterial.GetColor("_Color"); m_userThemeColors[5] = userTheme.LeavesMaterial.GetColor("_Color_1"); m_userThemeColors[6] = userTheme.WaterMateral.GetColor("_Color_1"); m_userThemeColors[7] = userTheme.TriggerMaterial.GetColor("_Color_1"); }
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("Grid Snapping Header"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.MaxWidth(256), GUILayout.MaxHeight(30)); GUILayout.FlexibleSpace(); GUILayout.Box(EUIResourceManager.Instance.GetContent("Auto Snap"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.Width(60), GUILayout.Height(30)); BlockoutEditorSettings.AutoSnap = GUILayout.Toggle(BlockoutEditorSettings.AutoSnap, "", EUIResourceManager.Instance.Skin.button, GUILayout.Height(30), GUILayout.Width(30)); } if (!showSection) { return; } using (new HorizontalCenteredScope(GUILayout.MaxWidth(BlockoutEditorSettings.OneColumnWidth))) { GUILayout.Label(EUIResourceManager.Instance.GetContent("Snapping Label")); GUILayout.FlexibleSpace(); selectedSnapping = GUILayout.SelectionGrid(selectedSnapping, Options, Options.Length, EditorStyles.miniButton, GUILayout.Width(292)); } using (new HorizontalCenteredScope(GUILayout.MaxWidth(BlockoutEditorSettings.OneColumnWidth))) { if (!Application.isPlaying && Application.isEditor) { if (selectedSnapping < OptionValues.Length && selectedSnapping > 0) { snapValue = OptionValues[selectedSnapping]; } else { snapValue = EditorGUILayout.FloatField("Custom Snap", snapValue, GUILayout.Width(BlockoutEditorSettings.OneColumnWidth)); } } else { GUILayout.Label("Feature not availble during play mode."); } EditorPrefs.SetFloat("Blockout::Snap", snapValue); } using (new HorizontalCenteredScope()) { var originalColour = GUI.backgroundColor; GUI.backgroundColor = backgroundRed; if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Snap +X"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Snap(Vector3.right, BlockoutAxis.X); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Snap -X"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Snap(-Vector3.right, BlockoutAxis.X); } GUI.backgroundColor = backgroundGreen; if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Snap +Y"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Snap(Vector3.up, BlockoutAxis.Y); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Snap -Y"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Snap(-Vector3.up, BlockoutAxis.Y); } GUI.backgroundColor = backgroundBlue; if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Snap +Z"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Snap(Vector3.forward, BlockoutAxis.Z); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Snap -Z"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { BlockoutStaticFunctions.Snap(-Vector3.forward, BlockoutAxis.Z); } GUI.backgroundColor = originalColour; } }
void OnEnable() { hierarchy = new BlockoutHierarchy(); BlockoutStaticFunctions.FindHeirachy(ref hierarchy); EUIResourceManager rm = EUIResourceManager.Instance; splashScreen = new BlockoutEditorSplashSection(); splashScreen.InitSection("Splash Section", hierarchy); assetsSection = new BlockoutEditorAssetsSection(); assetsSection.InitSection("Blockout Assets", hierarchy); scalableObjectsSection = new BlockoutEditorScalableObjectsSection(); scalableObjectsSection.InitSection("Scalable Objects", hierarchy); transformSection = new BlockoutEditorTransformSection(); transformSection.InitSection("Transform Controls", hierarchy); othersSection = new BlockoutEditorOthersSection(); othersSection.InitSection("Others", hierarchy); cameraAnchorSection = new BlockoutEditorCameraAnchorSection(); cameraAnchorSection.InitSection("Camera Anchors", hierarchy); gridSnapping = new BlockoutGridSnapping(); gridSnapping.InitSection("Grid Snapping", hierarchy); hierarchyTools = new BlockoutEditorHierarchyToolsSection(); hierarchyTools.InitSection("Hierarchy Tools", hierarchy); commentsSection = new BlockoutEditorCommentsSection(); commentsSection.InitSection("Comments", hierarchy); suggestedSection = new BlockoutEditorSuggestedSection(); suggestedSection.InitSection("Suggesstions", hierarchy); titleContent = new GUIContent("Blockout", EUIResourceManager.Instance.GetTexture(EditorGUIUtility.isProSkin ? "Blockout_Icon_Light" : "Blockout_Icon_Dark")); sections = new BlockoutEditorSection[] { assetsSection, scalableObjectsSection, transformSection, gridSnapping, hierarchyTools, commentsSection, suggestedSection, cameraAnchorSection, othersSection }; BlockoutEditorSettings.CurrentSceneSetting = Resources.LoadAll <BlockoutSceneSettings>("") .First(x => x.sceneName == SceneManager.GetActiveScene().name); isVisible = true; BlockoutEditorHelper.Awake(this); EditorHotkeysTracker.Init(this); BlockoutStaticFunctions.UpdateAvailable(out newVersion); splashScreen.newVersion = newVersion; }
/// <summary> /// Reparents and gameobject within the bounds of target object. /// </summary> /// <param name="targetObject">The target object.</param> /// <param name="target">The target.</param> private void ReparentToBoundsContent(GameObject targetObject, Bounds target) { using (new UndoScope("Reparent Objects to comment")) { var allObjects = FindObjectsOfType <GameObject>().Select(x => x.transform).Where( x => { if (x.GetComponent < BlockoutSection >()) { return(false); } if (x.parent == null ) { return(false); } if (x.parent == targetObject) { return(false); } if (x .parent .GetComponent < BlockoutSection >()) { return(true); } return(false); } ).ToArray(); if (!targetObject.GetComponent <BlockoutSection>()) { targetObject.AddComponent <BlockoutSection>().Section = SectionID.Root; } BlockoutStaticFunctions.CreateBlockoutSubHeirachyWithRoot(targetObject.transform, targetObject.name + "_"); Undo.RecordObjects(allObjects, "Reparent Objects"); for (var i = 0; i < allObjects.Length; ++i) { Bounds colliderBounds; if (allObjects[i].GetComponent <Collider>()) { colliderBounds = allObjects[i].GetComponent <Collider>().bounds; } else if (allObjects[i].GetComponent <Renderer>()) { colliderBounds = allObjects[i].GetComponent <Renderer>().bounds; } else { continue; } if (target.Contains(colliderBounds.max) && target.Contains(colliderBounds.min)) { var section = allObjects[i].transform.parent.GetComponent <BlockoutSection>(); if (section) { BlockoutStaticFunctions.ReparentObjectToTargetRoot(allObjects[i].transform, targetObject.transform); } } } BlockoutStaticFunctions.TrimTargetBlockoutHierarchy(targetObject); } }
private static void OnScene(SceneView view) { var e = Event.current; if (!targetEditor) { targetEditor = EditorWindow.GetWindow <BlockoutEditorWindow>(); } if (e.control && e.alt && e.keyCode == KeyCode.B && e.type == EventType.KeyDown) { if (!BlockoutEditorWindow.isVisible) { BlockoutEditorWindow.Init(); e.Use(); } else { targetEditor.Close(); SceneView.currentDrawingSceneView.Focus(); e.Use(); } } if (!targetEditor) { return; } if (e != null && e.delta != Vector2.zero && e.type == EventType.ScrollWheel && scrollPicker) { SceneView.lastActiveSceneView.size = size; amount += e.delta.y; if (amount >= 5.0f && targetEditor.suggestedSection.shownItems.Count > 0) { int first = targetEditor.suggestedSection.shownItems[0]; targetEditor.suggestedSection.shownItems.RemoveAt(0); targetEditor.suggestedSection.shownItems.Add(first); amount -= 5f; } else if (amount <= -5f && targetEditor.suggestedSection.shownItems.Count > 0) { int last = targetEditor.suggestedSection .shownItems[targetEditor.suggestedSection.shownItems.Count - 1]; targetEditor.suggestedSection.shownItems .RemoveAt(targetEditor.suggestedSection.shownItems.Count - 1); targetEditor.suggestedSection.shownItems.Insert(0, last); amount += 5f; } e.Use(); SceneView.lastActiveSceneView.Repaint(); } else if (e != null && e.keyCode != KeyCode.None) { // Snapping Toggle if (e.alt && e.keyCode == KeyCode.S && e.type == EventType.KeyDown) { if (BlockoutEditorWindow.isVisible) { BlockoutEditorSettings.AutoSnap = !BlockoutEditorSettings.AutoSnap; targetEditor.Repaint(); SceneView.currentDrawingSceneView.Focus(); e.Use(); } } // Increase snap value else if (e.alt && e.control && e.keyCode == KeyCode.Z && e.type == EventType.KeyDown) { if (BlockoutEditorWindow.isVisible) { var window = targetEditor; window.gridSnapping.IncreaseSnapValue(); targetEditor.Repaint(); SceneView.currentDrawingSceneView.Focus(); e.Use(); } } // Decrease Snap Value else if (e.alt && e.control && e.keyCode == KeyCode.X && e.type == EventType.KeyDown) { if (BlockoutEditorWindow.isVisible) { var window = targetEditor; window.gridSnapping.DecreaseSnapValue(); targetEditor.Repaint(); SceneView.currentDrawingSceneView.Focus(); e.Use(); } } // Snap To Floor else if (e.keyCode == KeyCode.End && e.type == EventType.KeyDown) { var tempDoSnap = BlockoutEditorSettings.AutoSnap; if (tempDoSnap) { BlockoutEditorSettings.AutoSnap = !BlockoutEditorSettings.AutoSnap; } BlockoutStaticFunctions.Snap(Vector3.down, BlockoutAxis.Y, true); if (tempDoSnap) { BlockoutEditorSettings.AutoSnap = !BlockoutEditorSettings.AutoSnap; } e.Use(); } // Toggle Comments else if (e.alt && e.keyCode == KeyCode.C && e.type == EventType.KeyDown) { if (BlockoutEditorWindow.isVisible) { var window = targetEditor; window.commentsSection.showSection = !window.commentsSection.showSection; if (window.commentsSection.showSection) { window.commentsSection.showSceneInformation = true; } SceneView.currentDrawingSceneView.Focus(); e.Use(); } } // Initialise Quick Picker else if (e.keyCode == KeyCode.C && e.type == EventType.KeyDown && !scrollPicker) { if (Selection.activeGameObject) { scrollPicker = true; size = SceneView.lastActiveSceneView.size; Selection.activeGameObject.GetComponent <Collider>().enabled = false; targetEditor.suggestedSection.InitialiseScrollPicker(); } e.Use(); } else if (e.keyCode == KeyCode.Space && e.type == EventType.KeyDown) { if (!quickPicker && !scrollPicker) { quickPicker = true; targetEditor.suggestedSection.InitialiseQuickPicker(); e.Use(); } else if (scrollPicker) { scrollPicker = false; targetEditor.suggestedSection.ConfirmSpawn(); e.Use(); } } else if (e.keyCode == KeyCode.Escape && e.type == EventType.KeyDown && quickPicker) { quickPicker = false; targetEditor.suggestedSection.CancelQickpicker(); e.Use(); } else if (e.keyCode == KeyCode.C && e.type == EventType.KeyUp && scrollPicker) { scrollPicker = false; targetEditor.suggestedSection.ConfirmSwap(); e.Use(); } else if (e.keyCode == KeyCode.Space && e.type == EventType.KeyUp && scrollPicker && !quickPicker) { scrollPicker = false; targetEditor.suggestedSection.ConfirmSwap(); e.Use(); } else if (e.alt && e.keyCode == KeyCode.Space && e.type == EventType.KeyUp && scrollPicker) { scrollPicker = false; targetEditor.suggestedSection.ConfirmSpawn(); e.Use(); } // Select asset else if (e.keyCode == KeyCode.G && e.type == EventType.KeyDown) { BlockoutStaticFunctions.SelectAsset(); e.Use(); } // Lock selected else if (e.keyCode == KeyCode.L && e.type == EventType.KeyDown) { Selection.gameObjects.Where(x => x.GetComponent <BlockoutHelper>()) .Select(x => x.GetComponent <BlockoutHelper>()).ToList() .ForEach(x => x.SetLock(!x.Locked)); e.Use(); } if (quickPicker) { if (e.keyCode == KeyCode.LeftArrow && e.type == EventType.KeyDown) { targetEditor.suggestedSection.selected--; targetEditor.suggestedSection.scroll.y = (float)targetEditor.suggestedSection.selected / (float)targetEditor.suggestedSection.SuggestedItemCount; e.Use(); } else if (e.keyCode == KeyCode.RightArrow && e.type == EventType.KeyDown) { targetEditor.suggestedSection.selected++; targetEditor.suggestedSection.scroll.y = (float)targetEditor.suggestedSection.selected / (float)targetEditor.suggestedSection.SuggestedItemCount; e.Use(); } else if (e.keyCode == KeyCode.UpArrow && e.type == EventType.KeyDown) { targetEditor.suggestedSection.selected -= targetEditor.suggestedSection.maxPerRow; targetEditor.suggestedSection.scroll.y = (float)targetEditor.suggestedSection.selected / (float)targetEditor.suggestedSection.SuggestedItemCount; e.Use(); } else if (e.keyCode == KeyCode.DownArrow && e.type == EventType.KeyDown) { targetEditor.suggestedSection.selected += targetEditor.suggestedSection.maxPerRow; targetEditor.suggestedSection.scroll.y = (float)targetEditor.suggestedSection.selected / (float)targetEditor.suggestedSection.SuggestedItemCount; e.Use(); } else if ((e.keyCode == KeyCode.Space || e.keyCode == KeyCode.Return) && e.type == EventType.KeyDown) { targetEditor.suggestedSection.SpawnSelected(targetEditor.suggestedSection.selected); targetEditor.suggestedSection.scroll.y = (float)targetEditor.suggestedSection.selected / (float)targetEditor.suggestedSection.SuggestedItemCount; e.Use(); } else if (e.keyCode == KeyCode.Escape && e.type == EventType.KeyDown) { targetEditor.suggestedSection.CancelQickpicker(); e.Use(); } } } }
public override void DrawSection() { repaint = false; using (new HorizontalCenteredScope()) { GUILayout.Box(EUIResourceManager.Instance.GetContent("Blockout Logo"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.Width(BlockoutEditorSettings.OneColumnWidth), GUILayout.Height(120)); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Create Hierarchy"), GUILayout.Height(EditorGUIUtility.singleLineHeight * 6), GUILayout.Width(BlockoutEditorSettings.OneColumnWidth))) { if (!BlockoutStaticFunctions.FindHeirachy(ref blockoutHierarchy)) { if (EditorSceneManager.SaveOpenScenes()) { using (new UndoScope("Create Blockout Hierarchy")) { blockoutHierarchy.root = new GameObject("Blockout").transform; Undo.RegisterCreatedObjectUndo(blockoutHierarchy.root.gameObject, ""); blockoutHierarchy.root.gameObject.AddComponent <BlockoutCommentInGameGUI>(); blockoutHierarchy.root.gameObject.AddComponent <Notepad>(); var section = blockoutHierarchy.root.gameObject.AddComponent <BlockoutSection>(); section.Section = SectionID.Root; BlockoutStaticFunctions.CreateBlockoutSubHeirachyWithRoot(blockoutHierarchy.root); BlockoutStaticFunctions.FindHeirachy(ref blockoutHierarchy); BlockoutStaticFunctions.TryLoadSceneDefinitions(); } } else { EditorUtility.DisplayDialog("Blockout Editor Error", "You need to have a SAVED scene before using the Blockout system", "OK"); } } } GUILayout.Space(5); GUILayout.Label(EUIResourceManager.Instance.GetContent("Intro Label")); GUILayout.Space(5); if (newVersion != BlockoutEditorSettings.VERSION) { GUILayout.Space(5); using (new HorizontalCenteredScope()) { GUILayout.Label("New Version Available (" + newVersion + ")", EditorStyles.boldLabel, GUILayout.Height(EditorGUIUtility.singleLineHeight * 2)); } GUILayout.Space(5); } GUILayout.Label(EUIResourceManager.Instance.GetContent("Example Scenes"), GUILayout.Width(390), GUILayout.Height(EditorGUIUtility.singleLineHeight * 2)); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("All Assets"), GUILayout.Width(390), GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 8))) { EditorSceneManager.OpenScene("Assets/Blockout/Examples/All Assets.unity"); } using (new HorizontalCenteredScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("FPS Scene"), GUILayout.Width(193), GUILayout.Height(125))) { EditorSceneManager.OpenScene("Assets/Blockout/Examples/FPS.unity"); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Rollerball Scene"), GUILayout.Width(193), GUILayout.Height(125))) { EditorSceneManager.OpenScene("Assets/Blockout/Examples/Rollerball.unity"); } } GUILayout.Space(5); GUILayout.Label("Keyboard Shortcuts"); using (new GUILayout.HorizontalScope()) { if (Application.platform == RuntimePlatform.WindowsEditor) { GUILayout.Label("Ctrl + ALT + B", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Show The Blockout Window"); } else { GUILayout.Label("Cmd + ALT + B", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Show / Hide The Blockout Window"); } } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Alt + S", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Toggle Auto Grid Snapping"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Alt + C", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Toggle Comments"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Alt + Z", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Decrease Grid Snapping Value"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Alt + X", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Increase Grid Snapping Value"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("End", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Snap to ground (-Y)"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("L", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Toggle Locked Assets"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("G", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Jump To Selected Prefab In Project"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("C (Hold)", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("(Hold) Show Scroll Picker"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("(Release) Confirm Swap"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Space", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Scrollpicker: Spawn Selected Asset"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Quickpicker: Show / Select Item"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Arrow Keys", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Quickpicker: Change selection"); } GUILayout.Space(5); using (new GUILayout.HorizontalScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Open Documentation"), GUILayout.Width(193), GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 8))) { BlockoutStaticFunctions.OpenDocumentation(); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Open Tutorials"), GUILayout.Width(193), GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 8))) { BlockoutStaticFunctions.OpenTutorials(); } } GUILayout.Space(5); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Feedback"), GUILayout.Width(390), GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 8))) { BlockoutStaticFunctions.SubmitBugReport(); } GUILayout.Space(10); using (new HorizontalCenteredScope()) { GUILayout.Box(EUIResourceManager.Instance.GetContent("Radical Forge Logo"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.Width(150), GUILayout.Height(45)); } }
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("Hierarchy Header"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.MaxWidth(256), GUILayout.MaxHeight(30)); } if (!showSection) { return; } using (new HorizontalCenteredScope()) { GUILayout.Label("Name:"); GUILayout.Space(5); m_parentName = GUILayout.TextField(m_parentName, GUILayout.Width(BlockoutEditorSettings.TwoColumnWidth)); GUILayout.Space(18); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Create Parent"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { BlockoutStaticFunctions.CreateParentAndForceChild(m_parentName, blockoutHierarchy); } } using (new HorizontalCenteredScope()) { GUILayout.Label("Target: "); if (!Application.isPlaying && Application.isEditor) { m_targetHeirachyBaseObject = EditorGUILayout.ObjectField(m_targetHeirachyBaseObject, typeof(Transform), true) as Transform; if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Hierarchy Selected"), GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth))) { if (m_targetHeirachyBaseObject != null) { using (new UndoScope("Rehierarchy Selected Objects")) { Selection.transforms.ToList().ForEach(x => Undo.SetTransformParent(x, m_targetHeirachyBaseObject, "")); EditorGUIUtility.PingObject(m_targetHeirachyBaseObject); Selection.activeGameObject = m_targetHeirachyBaseObject.gameObject; } } else { Debug.LogError("BLOCKOUT :: Assign a target object to hierarchy to!"); } } } else { GUILayout.Label("Feature Not available during play mode"); } } GUILayout.Label("Reparent Selection"); using (new HorizontalCenteredScope()) { GUILayout.Space(4); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Parent Floor"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { ApplyParentTransformFromSection(Selection.gameObjects, SectionID.Floors); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Parent Walls"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { ApplyParentTransformFromSection(Selection.gameObjects, SectionID.Walls); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Parent Trim"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { ApplyParentTransformFromSection(Selection.gameObjects, SectionID.Trim); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Parent Dynamic"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { ApplyParentTransformFromSection(Selection.gameObjects, SectionID.Dynamic); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Parent Foliage"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { ApplyParentTransformFromSection(Selection.gameObjects, SectionID.Foliage); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Parent Particles"), GUILayout.Width(BlockoutEditorSettings.SixColumnWidth))) { ApplyParentTransformFromSection(Selection.gameObjects, SectionID.Particles); } } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Create Prefab"))) { AutoPrefabSelection.PrefabSelection(); } }
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; } }