diff --git a/.gitignore b/.gitignore index db1f37a..cf32c39 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ [Bb]uild/ [Bb]uilds/ Assets/AssetStoreTools* +UserSettings* # Visual Studio cache directory .vs/ diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/InternalCSGModelManager.DefaultModel.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/InternalCSGModelManager.DefaultModel.cs index 8624b28..9ab789c 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/InternalCSGModelManager.DefaultModel.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/InternalCSGModelManager.DefaultModel.cs @@ -88,14 +88,12 @@ static void InitializeDefaultCSGModel(Scene currentScene, CSGSceneState sceneSta bool inPrefabMode = false; Transform prefabRootTransform = null; #if UNITY_2018_3_OR_NEWER - -#if UNITY_2021_2_OR_NEWER - var currentPrefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); -#else + #if !UNITY_2021_2_OR_NEWER var currentPrefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); -#endif - - if (currentPrefabStage != null) + #else + var currentPrefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); + #endif +if (currentPrefabStage != null) { var prefabRoot = currentPrefabStage.prefabContentsRoot; prefabRootTransform = prefabRoot.transform; diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/SceneViewEventHandler.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/SceneViewEventHandler.cs index 4337f26..1c5319d 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/SceneViewEventHandler.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/SceneViewEventHandler.cs @@ -9,87 +9,97 @@ using UnityEngine.SceneManagement; using RealtimeCSG.Helpers; + namespace RealtimeCSG { - internal sealed class SceneViewEventHandler - { - static bool mousePressed; + internal sealed class SceneViewEventHandler + { + static bool mousePressed; static int prevFocusControl; - internal static void OnScene(SceneView sceneView) - { - CSGSettings.RegisterSceneView(sceneView); - if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG) - return; - - if (EditorApplication.isPlayingOrWillChangePlaymode) - return; - UpdateLoop.UpdateOnSceneChange(); - - if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG) - ColorSettings.isInitialized = false; - else - if (!ColorSettings.isInitialized) - { - if (Event.current.type == EventType.Repaint) - { - ColorSettings.Update(); - } - } - - if (!UpdateLoop.IsActive()) - UpdateLoop.ResetUpdateRoutine(); - - if (Event.current.type == EventType.MouseDown || - Event.current.type == EventType.MouseDrag) { mousePressed = true; } - else if (Event.current.type == EventType.MouseUp || - Event.current.type == EventType.MouseMove) { mousePressed = false; } - - SceneDragToolManager.OnHandleDragAndDrop(sceneView); - RectangleSelectionManager.Update(sceneView); - EditModeManager.InitSceneGUI(sceneView); - - if (Event.current.type == EventType.Repaint) - MeshInstanceManager.UpdateHelperSurfaces(); - - if (Event.current.type == EventType.Repaint) - { - SceneToolRenderer.OnPaint(sceneView); - } else - //if (fallbackGUI) - { - SceneViewBottomBarGUI.ShowGUI(sceneView); + internal static void OnScene( SceneView sceneView ) + { + CSGSettings.RegisterSceneView( sceneView ); + + if( !RealtimeCSG.CSGSettings.EnableRealtimeCSG ) + return; + + if( EditorApplication.isPlayingOrWillChangePlaymode ) + return; + + UpdateLoop.UpdateOnSceneChange(); + + if( !RealtimeCSG.CSGSettings.EnableRealtimeCSG ) + ColorSettings.isInitialized = false; + else if( !ColorSettings.isInitialized ) + { + if( Event.current.type == EventType.Repaint ) + { + ColorSettings.Update(); + } + } + + if( !UpdateLoop.IsActive() ) + UpdateLoop.ResetUpdateRoutine(); + + if( Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag ) + { + mousePressed = true; + } + else if( Event.current.type == EventType.MouseUp || Event.current.type == EventType.MouseMove ) + { + mousePressed = false; + } + + SceneDragToolManager.OnHandleDragAndDrop( sceneView ); + RectangleSelectionManager.Update( sceneView ); + EditModeManager.InitSceneGUI( sceneView ); + + if( Event.current.type == EventType.Repaint ) + MeshInstanceManager.UpdateHelperSurfaces(); + + if( Event.current.type == EventType.Repaint ) + { + SceneToolRenderer.OnPaint( sceneView ); + } + else + //if (fallbackGUI) + { + SceneViewBottomBarGUI.ShowGUI( sceneView ); SceneViewInfoGUI.DrawInfoGUI( sceneView ); - } - - EditModeManager.OnSceneGUI(sceneView); - - //if (fallbackGUI) - { - TooltipUtility.InitToolTip(sceneView); - if (Event.current.type == EventType.Repaint) - { - SceneViewBottomBarGUI.ShowGUI(sceneView); - SceneViewInfoGUI.DrawInfoGUI( sceneView ); - } - if (!mousePressed) - { - Handles.BeginGUI(); - TooltipUtility.DrawToolTip(getLastRect: false); - Handles.EndGUI(); - } - } - - if (Event.current.type == EventType.Layout) + } + + EditModeManager.OnSceneGUI( sceneView ); + + //if (fallbackGUI) + { + TooltipUtility.InitToolTip( sceneView ); + + if( Event.current.type == EventType.Repaint ) + { + SceneViewBottomBarGUI.ShowGUI( sceneView, false ); + SceneViewInfoGUI.DrawInfoGUI( sceneView ); + } + + if( !mousePressed ) + { + Handles.BeginGUI(); + TooltipUtility.DrawToolTip( getLastRect: false ); + Handles.EndGUI(); + } + } + + if( Event.current.type == EventType.Layout ) { var currentFocusControl = CSGHandles.FocusControl; - if (prevFocusControl != currentFocusControl) + + if( prevFocusControl != currentFocusControl ) { prevFocusControl = currentFocusControl; HandleUtility.Repaint(); } } - } - } + } + } } diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/UpdateLoop.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/UpdateLoop.cs index 5e053ee..3203150 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/UpdateLoop.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Control/Managers/UpdateLoop.cs @@ -11,52 +11,52 @@ namespace RealtimeCSG { - [InitializeOnLoad] - internal sealed class UpdateLoop - { - [MenuItem("Edit/Realtime-CSG/Turn Realtime-CSG on or off %F3", false, 30)] - static void ToggleRealtimeCSG() - { - RealtimeCSG.CSGSettings.SetRealtimeCSGEnabled(!RealtimeCSG.CSGSettings.EnableRealtimeCSG); - } - - public static bool IsActive() { return (editor != null && editor.initialized); } - - - static UpdateLoop editor = null; - static UpdateLoop() - { - if (editor != null) - { - editor.Shutdown(); - editor = null; - } - editor = new UpdateLoop(); - editor.Initialize(); - } - - bool initialized = false; - bool had_first_update = false; - - void Initialize() - { - if (initialized) - return; + [InitializeOnLoad] + internal sealed class UpdateLoop + { + [MenuItem("Edit/Realtime-CSG/Turn Realtime-CSG on or off %F3", false, 30)] + static void ToggleRealtimeCSG() + { + RealtimeCSG.CSGSettings.SetRealtimeCSGEnabled(!RealtimeCSG.CSGSettings.EnableRealtimeCSG); + } + + public static bool IsActive() { return (editor != null && editor.initialized); } + + + static UpdateLoop editor = null; + static UpdateLoop() + { + if (editor != null) + { + editor.Shutdown(); + editor = null; + } + editor = new UpdateLoop(); + editor.Initialize(); + } - CSGKeysPreferenceWindow.ReadKeys(); + bool initialized = false; + bool had_first_update = false; - initialized = true; + void Initialize() + { + if (initialized) + return; - CSGSceneManagerRedirector.Interface = new CSGSceneManagerInstance(); + CSGKeysPreferenceWindow.ReadKeys(); - Selection.selectionChanged -= OnSelectionChanged; - Selection.selectionChanged += OnSelectionChanged; + initialized = true; + + CSGSceneManagerRedirector.Interface = new CSGSceneManagerInstance(); + + Selection.selectionChanged -= OnSelectionChanged; + Selection.selectionChanged += OnSelectionChanged; - EditorApplication.update -= OnFirstUpdate; - EditorApplication.update += OnFirstUpdate; + EditorApplication.update -= OnFirstUpdate; + EditorApplication.update += OnFirstUpdate; #if UNITY_2018_1_OR_NEWER - EditorApplication.hierarchyChanged -= OnHierarchyWindowChanged; + EditorApplication.hierarchyChanged -= OnHierarchyWindowChanged; EditorApplication.hierarchyChanged += OnHierarchyWindowChanged; #else @@ -64,20 +64,19 @@ void Initialize() EditorApplication.hierarchyWindowChanged += OnHierarchyWindowChanged; #endif -#if UNITY_2018_3_OR_NEWER - #if UNITY_2021_2_OR_NEWER +#if UNITY_2021_2_OR_NEWER // SceneManagement.PrefabStage was moved out of experimental in 2021.2 UnityEditor.SceneManagement.PrefabStage.prefabSaving += OnPrefabSaving; - #else - UnityEditor.Experimental.SceneManagement.PrefabStage.prefabSaving += OnPrefabSaving; +#else + #if UNITY_2018_3_OR_NEWER // SceneManagement.PrefabStage was introduced in 2018.3 with nested prefabs + UnityEditor.Experimental.SceneManagement.PrefabStage.prefabSaving += OnPrefabSaving; #endif - #endif - EditorApplication.hierarchyWindowItemOnGUI -= HierarchyWindowItemGUI.OnHierarchyWindowItemOnGUI; - EditorApplication.hierarchyWindowItemOnGUI += HierarchyWindowItemGUI.OnHierarchyWindowItemOnGUI; - - UnityCompilerDefineManager.UpdateUnityDefines(); - } + EditorApplication.hierarchyWindowItemOnGUI -= HierarchyWindowItemGUI.OnHierarchyWindowItemOnGUI; + EditorApplication.hierarchyWindowItemOnGUI += HierarchyWindowItemGUI.OnHierarchyWindowItemOnGUI; + + UnityCompilerDefineManager.UpdateUnityDefines(); + } #if UNITY_2018_3_OR_NEWER private void OnPrefabSaving(GameObject obj) @@ -88,142 +87,142 @@ private void OnPrefabSaving(GameObject obj) void Shutdown(bool finalizing = false) - { - if (editor != this) - return; + { + if (editor != this) + return; - editor = null; - CSGSceneManagerRedirector.Interface = null; - if (!initialized) - return; + editor = null; + CSGSceneManagerRedirector.Interface = null; + if (!initialized) + return; - EditorApplication.update -= OnFirstUpdate; + EditorApplication.update -= OnFirstUpdate; #if UNITY_2018_1_OR_NEWER - EditorApplication.hierarchyChanged -= OnHierarchyWindowChanged; + EditorApplication.hierarchyChanged -= OnHierarchyWindowChanged; #else EditorApplication.hierarchyWindowChanged -= OnHierarchyWindowChanged; #endif - EditorApplication.hierarchyWindowItemOnGUI -= HierarchyWindowItemGUI.OnHierarchyWindowItemOnGUI; + EditorApplication.hierarchyWindowItemOnGUI -= HierarchyWindowItemGUI.OnHierarchyWindowItemOnGUI; #if UNITY_2019_1_OR_NEWER - SceneView.duringSceneGui -= SceneViewEventHandler.OnScene; + SceneView.duringSceneGui -= SceneViewEventHandler.OnScene; #else SceneView.onSceneGUIDelegate -= SceneViewEventHandler.OnScene; #endif - Undo.undoRedoPerformed -= UndoRedoPerformed; + Undo.undoRedoPerformed -= UndoRedoPerformed; - initialized = false; + initialized = false; - // make sure the C++ side of things knows to clear the method pointers - // so that we don't accidentally use them while closing unity - NativeMethodBindings.ClearUnityMethods(); - NativeMethodBindings.ClearExternalMethods(); + // make sure the C++ side of things knows to clear the method pointers + // so that we don't accidentally use them while closing unity + NativeMethodBindings.ClearUnityMethods(); + NativeMethodBindings.ClearExternalMethods(); - if (!finalizing) - SceneToolRenderer.Cleanup(); - } + if (!finalizing) + SceneToolRenderer.Cleanup(); + } - static Scene currentScene; - internal static void UpdateOnSceneChange() - { - if (EditorApplication.isPlayingOrWillChangePlaymode) - return; - - var activeScene = SceneManager.GetActiveScene(); - if (currentScene != activeScene) - { - if (editor == null) - ResetUpdateRoutine(); - - editor.OnSceneUnloaded(); - currentScene = activeScene; - InternalCSGModelManager.InitOnNewScene(); - } - } - - void OnSceneUnloaded() - { - if (EditorApplication.isPlayingOrWillChangePlaymode) - return; - - if (this.initialized) - this.Shutdown(); - - MeshInstanceManager.Shutdown(); - InternalCSGModelManager.Shutdown(); - - editor = new UpdateLoop(); - editor.Initialize(); - } + static Scene currentScene; + internal static void UpdateOnSceneChange() + { + if (EditorApplication.isPlayingOrWillChangePlaymode) + return; - public static void EnsureFirstUpdate() - { - if (editor == null) - return; - if (!editor.had_first_update) - editor.OnFirstUpdate(); - } - - void OnHierarchyWindowChanged() - { - if (EditorApplication.isPlayingOrWillChangePlaymode) - return; - - SceneDragToolManager.UpdateDragAndDrop(); - InternalCSGModelManager.UpdateHierarchy(); - } - - void UndoRedoPerformed() - { - InternalCSGModelManager.UndoRedoPerformed(); - } - - // Delegate for generic updates - void OnFirstUpdate() - { - had_first_update = true; - EditorApplication.update -= OnFirstUpdate; - RealtimeCSG.CSGSettings.Reload(); - - // register unity methods in the c++ code so that some unity functions - // (such as debug.log) can be called from within the c++ code. - NativeMethodBindings.RegisterUnityMethods(); - - // register dll methods so we can use them - NativeMethodBindings.RegisterExternalMethods(); - - RunOnce(); - //CreateSceneChangeDetector(); - } + var activeScene = SceneManager.GetActiveScene(); + if (currentScene != activeScene) + { + if (editor == null) + ResetUpdateRoutine(); - void RunOnce() - { - if (EditorApplication.isPlayingOrWillChangePlaymode) - { - // when you start playing the game in the editor, it'll call - // RunOnce before playing the game, but not after. - // so we need to wait until the game has stopped, after which we'll - // run first update again. - EditorApplication.update -= OnWaitUntillStoppedPlaying; - EditorApplication.update += OnWaitUntillStoppedPlaying; - return; - } + editor.OnSceneUnloaded(); + currentScene = activeScene; + InternalCSGModelManager.InitOnNewScene(); + } + } + + void OnSceneUnloaded() + { + if (EditorApplication.isPlayingOrWillChangePlaymode) + return; + + if (this.initialized) + this.Shutdown(); + + MeshInstanceManager.Shutdown(); + InternalCSGModelManager.Shutdown(); + + editor = new UpdateLoop(); + editor.Initialize(); + } + + public static void EnsureFirstUpdate() + { + if (editor == null) + return; + if (!editor.had_first_update) + editor.OnFirstUpdate(); + } + + void OnHierarchyWindowChanged() + { + if (EditorApplication.isPlayingOrWillChangePlaymode) + return; + + SceneDragToolManager.UpdateDragAndDrop(); + InternalCSGModelManager.UpdateHierarchy(); + } + + void UndoRedoPerformed() + { + InternalCSGModelManager.UndoRedoPerformed(); + } + + // Delegate for generic updates + void OnFirstUpdate() + { + had_first_update = true; + EditorApplication.update -= OnFirstUpdate; + RealtimeCSG.CSGSettings.Reload(); + + // register unity methods in the c++ code so that some unity functions + // (such as debug.log) can be called from within the c++ code. + NativeMethodBindings.RegisterUnityMethods(); + + // register dll methods so we can use them + NativeMethodBindings.RegisterExternalMethods(); + + RunOnce(); + //CreateSceneChangeDetector(); + } + + void RunOnce() + { + if (EditorApplication.isPlayingOrWillChangePlaymode) + { + // when you start playing the game in the editor, it'll call + // RunOnce before playing the game, but not after. + // so we need to wait until the game has stopped, after which we'll + // run first update again. + EditorApplication.update -= OnWaitUntillStoppedPlaying; + EditorApplication.update += OnWaitUntillStoppedPlaying; + return; + } #if UNITY_2019_1_OR_NEWER - SceneView.duringSceneGui -= SceneViewEventHandler.OnScene; - SceneView.duringSceneGui += SceneViewEventHandler.OnScene; + SceneView.duringSceneGui -= SceneViewEventHandler.OnScene; + SceneView.duringSceneGui += SceneViewEventHandler.OnScene; #else SceneView.onSceneGUIDelegate -= SceneViewEventHandler.OnScene; SceneView.onSceneGUIDelegate += SceneViewEventHandler.OnScene; #endif - Undo.undoRedoPerformed -= UndoRedoPerformed; - Undo.undoRedoPerformed += UndoRedoPerformed; - - // InternalCSGModelManager.UpdateHierarchy(); - - // but .. why? - /* + Undo.undoRedoPerformed -= UndoRedoPerformed; + Undo.undoRedoPerformed += UndoRedoPerformed; + +// InternalCSGModelManager.UpdateHierarchy(); + + // but .. why? + /* var scene = SceneManager.GetActiveScene(); var allGeneratedMeshes = SceneQueryUtility.GetAllComponentsInScene(scene); for (int i = 0; i < allGeneratedMeshes.Count; i++) @@ -233,71 +232,71 @@ void RunOnce() } */ - // we use a co-routine for updates because EditorApplication.update - // works at a ridiculous rate and the co-routine is only fired in the - // editor when something has happened. - ResetUpdateRoutine(); - } + // we use a co-routine for updates because EditorApplication.update + // works at a ridiculous rate and the co-routine is only fired in the + // editor when something has happened. + ResetUpdateRoutine(); + } - void OnWaitUntillStoppedPlaying() - { - if (!EditorApplication.isPlaying) - { - EditorApplication.update -= OnWaitUntillStoppedPlaying; + void OnWaitUntillStoppedPlaying() + { + if (!EditorApplication.isPlaying) + { + EditorApplication.update -= OnWaitUntillStoppedPlaying; - EditorApplication.update -= OnFirstUpdate; - EditorApplication.update += OnFirstUpdate; - } - } + EditorApplication.update -= OnFirstUpdate; + EditorApplication.update += OnFirstUpdate; + } + } + + static void RunEditorUpdate() + { + if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG) + return; + + if (EditorApplication.isPlayingOrWillChangePlaymode) + return; + + UpdateLoop.UpdateOnSceneChange(); + + try + { + if (!ColorSettings.isInitialized) + ColorSettings.Update(); + InternalCSGModelManager.CheckForChanges(forceHierarchyUpdate: false); + TooltipUtility.CleanCache(); + } + catch (Exception ex) + { + Debug.LogException(ex); + } + } - static void RunEditorUpdate() - { - if (!RealtimeCSG.CSGSettings.EnableRealtimeCSG) - return; - - if (EditorApplication.isPlayingOrWillChangePlaymode) - return; - - UpdateLoop.UpdateOnSceneChange(); - - try - { - if (!ColorSettings.isInitialized) - ColorSettings.Update(); - InternalCSGModelManager.CheckForChanges(forceHierarchyUpdate: false); - TooltipUtility.CleanCache(); - } - catch (Exception ex) - { - Debug.LogException(ex); - } - } + public static void ResetUpdateRoutine() + { + if (EditorApplication.isPlayingOrWillChangePlaymode) + return; - public static void ResetUpdateRoutine() - { - if (EditorApplication.isPlayingOrWillChangePlaymode) - return; - - if (editor != null && - !editor.initialized) - { - editor = null; - } - if (editor == null) - { - editor = new UpdateLoop(); - editor.Initialize(); - } - - EditorApplication.update -= RunEditorUpdate; - EditorApplication.update += RunEditorUpdate; - InternalCSGModelManager.skipCheckForChanges = false; - } + if (editor != null && + !editor.initialized) + { + editor = null; + } + if (editor == null) + { + editor = new UpdateLoop(); + editor.Initialize(); + } + EditorApplication.update -= RunEditorUpdate; + EditorApplication.update += RunEditorUpdate; + InternalCSGModelManager.skipCheckForChanges = false; + } - static void OnSelectionChanged() - { - EditModeManager.UpdateSelection(); - } - } + + static void OnSelectionChanged() + { + EditModeManager.UpdateSelection(); + } + } } \ No newline at end of file diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Utility/PrefabUtility.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Utility/PrefabUtility.cs index a26264e..4484efd 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Utility/PrefabUtility.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Utility/PrefabUtility.cs @@ -8,13 +8,13 @@ namespace RealtimeCSG { public sealed class CSGPrefabUtility { - public static UnityEngine.Object GetCorrespondingObjectFromSource(UnityEngine.Object source) - { -#if UNITY_2018_2_OR_NEWER - return PrefabUtility.GetCorrespondingObjectFromSource(source); -#else + public static UnityEngine.Object GetCorrespondingObjectFromSource(UnityEngine.Object source) + { + #if UNITY_2018_2_OR_NEWER + return PrefabUtility.GetCorrespondingObjectFromSource(source); + #else return PrefabUtility.GetPrefabParent(source); -#endif + #endif } public static bool IsPrefab(CSGModel model) @@ -31,18 +31,18 @@ public static bool IsPrefab(CSGModel model) public static bool AreInPrefabMode() { -#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR + #if UNITY_2018_3_OR_NEWER && UNITY_EDITOR var mainStage = StageUtility.GetMainStageHandle(); var currentStageHandle = StageUtility.GetCurrentStageHandle(); if (mainStage != currentStageHandle) return true; -#endif + #endif return false; } public static bool IsEditedInPrefabMode(CSGModel model) { -#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR + #if UNITY_2018_3_OR_NEWER && UNITY_EDITOR if (!model) return false; @@ -52,139 +52,139 @@ public static bool IsEditedInPrefabMode(CSGModel model) var currentStageHandle = StageUtility.GetCurrentStageHandle(); if (currentStageHandle.Contains(model.gameObject)) return true; -#endif + #endif return false; } public static CSGNode[] GetNodesInPrefabMode() { -#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR + #if UNITY_2018_3_OR_NEWER && UNITY_EDITOR var mainStage = StageUtility.GetMainStageHandle(); var currentStageHandle = StageUtility.GetCurrentStageHandle(); if (mainStage != currentStageHandle) return currentStageHandle.FindComponentsOfType(); -#endif + #endif return null; } public static bool IsPrefabAssetOrInstance(GameObject gameObject) - { -#if UNITY_2018_3_OR_NEWER - var prefabAssetType = PrefabUtility.GetPrefabAssetType(gameObject); - var prefabInstanceType = PrefabUtility.GetPrefabInstanceStatus(gameObject); - if (prefabAssetType == PrefabAssetType.NotAPrefab && - prefabInstanceType == PrefabInstanceStatus.NotAPrefab) - return false; - return true; -#else + { + #if UNITY_2018_3_OR_NEWER + var prefabAssetType = PrefabUtility.GetPrefabAssetType(gameObject); + var prefabInstanceType = PrefabUtility.GetPrefabInstanceStatus(gameObject); + if (prefabAssetType == PrefabAssetType.NotAPrefab && + prefabInstanceType == PrefabInstanceStatus.NotAPrefab) + return false; + return true; + #else var prefabType = PrefabUtility.GetPrefabType(gameObject); if (prefabType == PrefabType.None) return false; return true; -#endif - } - - public static bool IsPrefabAsset(GameObject gameObject) - { -#if UNITY_2018_3_OR_NEWER - var prefabInstanceType = PrefabUtility.GetPrefabInstanceStatus(gameObject); - if (prefabInstanceType != PrefabInstanceStatus.NotAPrefab) - return false; - - var prefabType = PrefabUtility.GetPrefabAssetType(gameObject); - return prefabType != PrefabAssetType.NotAPrefab && - prefabType != PrefabAssetType.Model; -#else + #endif + } + + public static bool IsPrefabAsset(GameObject gameObject) + { + #if UNITY_2018_3_OR_NEWER + var prefabInstanceType = PrefabUtility.GetPrefabInstanceStatus(gameObject); + if (prefabInstanceType != PrefabInstanceStatus.NotAPrefab) + return false; + + var prefabType = PrefabUtility.GetPrefabAssetType(gameObject); + return prefabType != PrefabAssetType.NotAPrefab && + prefabType != PrefabAssetType.Model; + #else var prefabType = PrefabUtility.GetPrefabType(gameObject); if (prefabType == PrefabType.None) return false; return (prefabType == PrefabType.Prefab || prefabType == PrefabType.ModelPrefab); -#endif - } - - public static bool IsPrefabInstance(GameObject gameObject) - { -#if UNITY_2018_3_OR_NEWER + #endif + } + + public static bool IsPrefabInstance(GameObject gameObject) + { + #if UNITY_2018_3_OR_NEWER if (!PrefabUtility.IsPartOfAnyPrefab(gameObject)) return false; var prefabType = PrefabUtility.GetPrefabInstanceStatus(gameObject); - return prefabType != PrefabInstanceStatus.NotAPrefab; -#else + return prefabType != PrefabInstanceStatus.NotAPrefab; + #else var prefabType = PrefabUtility.GetPrefabType(gameObject); if (prefabType == PrefabType.None) return false; return (prefabType != PrefabType.Prefab && prefabType != PrefabType.ModelPrefab); -#endif - } + #endif + } public static GameObject GetPrefabAsset(GameObject gameObject) { -#if UNITY_2018_3_OR_NEWER + #if UNITY_2018_3_OR_NEWER if (AreInPrefabMode()) { -#if UNITY_2021_2_OR_NEWER - var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); -#else + #if !UNITY_2021_2_OR_NEWER var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); -#endif + #else + var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); + #endif if (prefabStage.IsPartOfPrefabContents(gameObject)) -#if UNITY_2020_1_OR_NEWER + #if UNITY_2020_1_OR_NEWER return (GameObject)AssetDatabase.LoadMainAssetAtPath(prefabStage.assetPath); -#else + #else return (GameObject)AssetDatabase.LoadMainAssetAtPath(prefabStage.prefabAssetPath); -#endif + #endif } -#endif + #endif if (!IsPrefabInstance(gameObject)) return null; -#if UNITY_2018_3_OR_NEWER + #if UNITY_2018_3_OR_NEWER return (GameObject)AssetDatabase.LoadMainAssetAtPath(PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(gameObject)); -#else + #else return (GameObject)PrefabUtility.GetPrefabParent(gameObject); -#endif + #endif } public static GameObject GetOutermostPrefabInstanceRoot(GameObject gameObject) - { - if (!IsPrefabInstance(gameObject)) - return null; -#if UNITY_2018_3_OR_NEWER - return PrefabUtility.GetOutermostPrefabInstanceRoot(gameObject); -#else + { + if (!IsPrefabInstance(gameObject)) + return null; + #if UNITY_2018_3_OR_NEWER + return PrefabUtility.GetOutermostPrefabInstanceRoot(gameObject); + #else return PrefabUtility.FindPrefabRoot(gameObject); -#endif - } - - public static GameObject Instantiate(GameObject originalGameObject, bool copy = false) - { -#if UNITY_2018_3_OR_NEWER - var prefabInstanceType = PrefabUtility.GetPrefabInstanceStatus(originalGameObject); - if (prefabInstanceType != PrefabInstanceStatus.NotAPrefab && !copy) - { - var corrObj = GetCorrespondingObjectFromSource(originalGameObject); - var obj = PrefabUtility.InstantiatePrefab(corrObj); - var result = obj as GameObject; - return result; - } - - var prefabAssetType = PrefabUtility.GetPrefabAssetType(originalGameObject); - if (prefabAssetType != PrefabAssetType.NotAPrefab && !copy) - { - var obj = PrefabUtility.InstantiatePrefab(originalGameObject); - var result = obj as GameObject; - return result; - } - - var inst = UnityEngine.Object.Instantiate(originalGameObject); - return inst; -#else + #endif + } + + public static GameObject Instantiate(GameObject originalGameObject, bool copy = false) + { + #if UNITY_2018_3_OR_NEWER + var prefabInstanceType = PrefabUtility.GetPrefabInstanceStatus(originalGameObject); + if (prefabInstanceType != PrefabInstanceStatus.NotAPrefab && !copy) + { + var corrObj = GetCorrespondingObjectFromSource(originalGameObject); + var obj = PrefabUtility.InstantiatePrefab(corrObj); + var result = obj as GameObject; + return result; + } + + var prefabAssetType = PrefabUtility.GetPrefabAssetType(originalGameObject); + if (prefabAssetType != PrefabAssetType.NotAPrefab && !copy) + { + var obj = PrefabUtility.InstantiatePrefab(originalGameObject); + var result = obj as GameObject; + return result; + } + + var inst = UnityEngine.Object.Instantiate(originalGameObject); + return inst; + #else var prefabType = PrefabUtility.GetPrefabType(originalGameObject); if (prefabType == PrefabType.None || copy) return UnityEngine.Object.Instantiate(originalGameObject); @@ -196,8 +196,8 @@ public static GameObject Instantiate(GameObject originalGameObject, bool copy = else // PrefabInstance return PrefabUtility.InstantiatePrefab(GetCorrespondingObjectFromSource(originalGameObject)) as GameObject; -#endif - } + #endif + } internal static bool IsPartOfAsset(Mesh sharedMesh) { diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeManager.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeManager.cs index ff8d011..50be54c 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeManager.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeManager.cs @@ -517,7 +517,7 @@ public static void OnSceneGUI(SceneView sceneView) if (RealtimeCSG.CSGSettings.EnableRealtimeCSG) { // handle the tool - var sceneSize = sceneView.position.size; + var sceneSize = sceneView.position.size; var sceneRect = new Rect(0, 0, sceneSize.x, sceneSize.y - ((CSG_GUIStyleUtility.BottomToolBarHeight + 4) + 17)); // This helps prevent weird issues with overlapping sceneviews + avoid some performance issues with multiple sceneviews open diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeSelection.GUI.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeSelection.GUI.cs index e945c75..4be2382 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeSelection.GUI.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeSelection.GUI.cs @@ -51,7 +51,7 @@ static void HandleSceneGUI(int id) if (!SceneDragToolManager.IsDraggingObjectInScene) OnEditModeSelectionSceneGUI(); - var viewRect = new Rect(4, 0, sceneView.position.width, sceneView.position.height - (CSG_GUIStyleUtility.BottomToolBarHeight + 4)); + var viewRect = new Rect(4, 0, sceneView.rootVisualElement.contentRect.width, sceneView.rootVisualElement.contentRect.height - (CSG_GUIStyleUtility.BottomToolBarHeight + 4)); GUILayout.BeginArea(viewRect); if (EditModeManager.ActiveTool != null) diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeToolWindow.Editor.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeToolWindow.Editor.cs index 8103908..cb89f53 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeToolWindow.Editor.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeToolWindow.Editor.cs @@ -9,11 +9,12 @@ public class EditModeToolWindowEditor : Editor public Bounds OnGetFrameBounds() { return RealtimeCSG.BoundsUtilities.OnGetFrameBounds(RealtimeCSG.EditModeManager.FilteredSelection); } public override void OnInspectorGUI() { - if (EditorApplication.isPlayingOrWillChangePlaymode) - { - Selection.activeObject = null; - return; - } + if( EditorApplication.isPlayingOrWillChangePlaymode ) + { + Selection.activeObject = null; + + return; + } RealtimeCSG.EditModeSelectionGUI.OnInspectorGUI(this, this.targets); } } \ No newline at end of file diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Cylinder.GUI.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Cylinder.GUI.cs index 1d2ceb1..312a397 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Cylinder.GUI.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Cylinder.GUI.cs @@ -1,250 +1,274 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; +using UnityEditor; using UnityEngine; -using UnityEngine.SceneManagement; + namespace RealtimeCSG { - internal sealed partial class GeneratorCylinderGUI - { - static bool SettingsToggle(bool value, GUIContent content, GUILayoutOption sceneWidth, bool isSceneGUI) - { - if (isSceneGUI) - return EditorGUILayout.ToggleLeft(content, value, sceneWidth); - else - return EditorGUILayout.Toggle(content, value); - } - - static float SettingsSlider(float value, float minValue, float maxValue, GUIContent content, bool isSceneGUI) - { - if (isSceneGUI) - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - GUILayout.Label(content, width65); - var result = EditorGUILayout.Slider(value, minValue, maxValue, width120); - GUILayout.EndHorizontal(); - return result; - } else - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - GUILayout.Label(content, width65); - var result = EditorGUILayout.Slider(value, minValue, maxValue); - GUILayout.EndHorizontal(); - return result; - } - } - - static int IntSettingsSlider(int value, int minValue, int maxValue, GUIContent content, bool isSceneGUI) - { - if (isSceneGUI) - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - GUILayout.Label(content, width65); - var result = EditorGUILayout.IntSlider(value, minValue, maxValue, width120); - GUILayout.EndHorizontal(); - return result; - } else - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - GUILayout.Label(content, width65); - var result = EditorGUILayout.IntSlider(value, minValue, maxValue); - GUILayout.EndHorizontal(); - return result; - } - } - - static void CylinderSettingsGUI(GeneratorCylinder generator, bool isSceneGUI) - { - if (isSceneGUI) - GUILayout.BeginHorizontal(GUILayout.MinWidth(0)); - { - if (isSceneGUI) - GUILayout.BeginVertical(width110); - { - generator.CircleSmoothShading = SettingsToggle(generator.CircleSmoothShading, SmoothShadingContent, width110, isSceneGUI); - TooltipUtility.SetToolTip(SmoothShadingTooltip); - generator.CircleDistanceToSide = SettingsToggle(generator.CircleDistanceToSide, AlignToSideContent, width110, isSceneGUI); - TooltipUtility.SetToolTip(AlignToSideTooltip); - } - if (isSceneGUI) - { - GUILayout.EndVertical(); - GUILayout.BeginVertical(width80); - } - { - generator.CircleSingleSurfaceEnds = !SettingsToggle(!generator.CircleSingleSurfaceEnds, RadialCapsContent, width80, isSceneGUI); - TooltipUtility.SetToolTip(RadialCapsTooltip); - generator.CircleRecenter = SettingsToggle(generator.CircleRecenter, FitShapeContent, width80, isSceneGUI); - TooltipUtility.SetToolTip(FitShapeTooltip); - } - if (isSceneGUI) - GUILayout.EndVertical(); - } - if (isSceneGUI) - GUILayout.EndHorizontal(); - } - - static void OnGUIContents(GeneratorCylinder generator, bool isSceneGUI) - { - //GUILayout.BeginVertical(GUIStyleUtility.ContentEmpty); - //{ - //bool enabled = generator.HaveBrushes; - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - { - /* - EditorGUI.BeginDisabledGroup(!enabled); - { - if (isSceneGUI) - GUILayout.BeginVertical(GUI.skin.box, width100); - else - GUILayout.BeginVertical(GUIStyle.none); - { - bool mixedValues = !enabled; - CSGOperationType operation = generator.CurrentCSGOperationType; - EditorGUI.BeginChangeCheck(); - operation = CSG_EditorGUIUtility.ChooseOperation(operation, mixedValues); - if (EditorGUI.EndChangeCheck()) - { - generator.CurrentCSGOperationType = operation; - } - } - GUILayout.EndVertical(); - } - EditorGUI.EndDisabledGroup(); - */ - if (isSceneGUI) - CylinderSettingsGUI(generator, isSceneGUI); - } - GUILayout.EndHorizontal(); - - GUILayout.Space(5); - - GUILayout.BeginVertical(CSG_GUIStyleUtility.ContentEmpty); - { - var distanceUnit = RealtimeCSG.CSGSettings.DistanceUnit; - var nextUnit = Units.CycleToNextUnit(distanceUnit); - var unitText = Units.GetUnitGUIContent(distanceUnit); - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - { - GUILayout.Label(HeightContent, width65); - if (isSceneGUI) - TooltipUtility.SetToolTip(HeightTooltip); - var height = generator.HaveHeight ? generator.Height : GeometryUtility.CleanLength(generator.DefaultHeight); - EditorGUI.BeginChangeCheck(); - { - if (!isSceneGUI) - height = Units.DistanceUnitToUnity(distanceUnit, EditorGUILayout.DoubleField(Units.UnityToDistanceUnit(distanceUnit, height))); - else - height = Units.DistanceUnitToUnity(distanceUnit, EditorGUILayout.DoubleField(Units.UnityToDistanceUnit(distanceUnit, height), width65)); - } - if (EditorGUI.EndChangeCheck()) - { - if (generator.HaveHeight) - generator.Height = height; - else - generator.DefaultHeight = height; - } - if (GUILayout.Button(unitText, EditorStyles.miniLabel, width20)) - { - distanceUnit = nextUnit; - RealtimeCSG.CSGSettings.DistanceUnit = distanceUnit; - RealtimeCSG.CSGSettings.UpdateSnapSettings(); - RealtimeCSG.CSGSettings.Save(); - CSG_EditorGUIUtility.RepaintAll(); - } - } - //if (!isSceneGUI) - { - GUILayout.EndHorizontal(); - TooltipUtility.SetToolTip(HeightTooltip); - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - } - //else - //{ - // GUILayout.Space(12); - //} - { - EditorGUI.BeginDisabledGroup(!generator.CanCommit); - { - GUILayout.Label(RadiusContent, width65); - if (isSceneGUI) - TooltipUtility.SetToolTip(RadiusTooltip); - var radius = generator.RadiusA; - EditorGUI.BeginChangeCheck(); - { - if (!isSceneGUI) - radius = Units.DistanceUnitToUnity(distanceUnit, EditorGUILayout.DoubleField(Units.UnityToDistanceUnit(distanceUnit, radius))); - else - radius = Units.DistanceUnitToUnity(distanceUnit, EditorGUILayout.DoubleField(Units.UnityToDistanceUnit(distanceUnit, radius), width65)); - } - if (EditorGUI.EndChangeCheck()) - { - generator.RadiusA = radius; - } - if (GUILayout.Button(unitText, EditorStyles.miniLabel, width20)) - { - distanceUnit = nextUnit; - RealtimeCSG.CSGSettings.DistanceUnit = distanceUnit; - RealtimeCSG.CSGSettings.UpdateSnapSettings(); - RealtimeCSG.CSGSettings.Save(); - CSG_EditorGUIUtility.RepaintAll(); - } - } - EditorGUI.EndDisabledGroup(); - } - GUILayout.EndHorizontal(); - if (!isSceneGUI) - TooltipUtility.SetToolTip(RadiusTooltip); - } - GUILayout.EndVertical(); - - { - generator.CircleSides = IntSettingsSlider(generator.CircleSides, 3, RealtimeCSG.CSGSettings.MaxCircleSides, SidesContent, isSceneGUI); - TooltipUtility.SetToolTip(SidesTooltip); - } - { - generator.CircleOffset = SettingsSlider(generator.CircleOffset, 0, 360, OffsetContent, isSceneGUI); - TooltipUtility.SetToolTip(OffsetTooltip); - } - - - - if (!isSceneGUI) - { - GUILayout.Space(5); - - CylinderSettingsGUI(generator, isSceneGUI); - - //GUILayout.Space(10); - } /*else - { - GUILayout.Space(10); - }*/ - /* - EditorGUI.BeginDisabledGroup(!generator.CanCommit); - { - GUILayout.BeginHorizontal(GUIStyleUtility.ContentEmpty); - { - if (GUILayout.Button(CommitContent)) { generator.DoCommit(); } - TooltipUtility.SetToolTip(CommitTooltip); - if (GUILayout.Button(CancelContent)) { generator.DoCancel(); } - TooltipUtility.SetToolTip(CancelTooltip); - } - GUILayout.EndHorizontal(); - } - EditorGUI.EndDisabledGroup(); - */ - //} - //GUILayout.EndVertical(); - } - - public static bool OnShowGUI(GeneratorCylinder generator, bool isSceneGUI) - { - CSG_GUIStyleUtility.InitStyles(); - OnGUIContents(generator, isSceneGUI); - return true; - } - } + internal sealed partial class GeneratorCylinderGUI + { + static bool SettingsToggle( bool value, GUIContent content, GUILayoutOption sceneWidth, bool isSceneGUI ) + { + if( isSceneGUI ) + return EditorGUILayout.ToggleLeft( content, value, sceneWidth ); + else + return EditorGUILayout.Toggle( content, value ); + } + + static float FloatSettingsControl( float value, float minValue, float maxValue, GUIContent content, bool isSceneGUI ) + { + if( isSceneGUI ) + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + GUILayout.Label( content, width65 ); + GUI.enabled = false; + + value = EditorGUILayout.FloatField( Mathf.Clamp( value, minValue, maxValue ) ); + + GUI.enabled = true; + + if( GUILayout.Button( "-", "buttonleft", width25 ) ) + value--; + + if( GUILayout.Button( "+", "buttonright", width25 ) ) + value++; + + GUILayout.EndHorizontal(); + + return value; + } + else + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + GUILayout.Label( content, width65 ); + + GUI.enabled = false; + + value = EditorGUILayout.FloatField( Mathf.Clamp( value, minValue, maxValue ) ); + + GUI.enabled = true; + + if( GUILayout.Button( "-", "buttonleft", width25 ) ) + value--; + + if( GUILayout.Button( "+", "buttonright", width25 ) ) + value++; + + GUILayout.EndHorizontal(); + + return value; + } + } + + static int IntSettingsControl( int value, int minValue, int maxValue, GUIContent content, bool isSceneGUI ) + { + if( isSceneGUI ) + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + GUILayout.Label( content, width65 ); + + GUI.enabled = false; + + value = EditorGUILayout.IntField( Mathf.Clamp( value, minValue, maxValue ) ); + + GUI.enabled = true; + + if( GUILayout.Button( "-", "buttonleft", width25 ) ) + value--; + + if( GUILayout.Button( "+", "buttonright", width25 ) ) + value++; + + GUILayout.EndHorizontal(); + + return value; + } + else + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + GUILayout.Label( content, width65 ); + + GUI.enabled = false; + + value = EditorGUILayout.IntField( Mathf.Clamp( value, minValue, maxValue ) ); + + GUI.enabled = true; + + if( GUILayout.Button( "-", "buttonleft", width25 ) ) + value--; + + if( GUILayout.Button( "+", "buttonright", width25 ) ) + value++; + + GUILayout.EndHorizontal(); + + return value; + } + } + + static void CylinderSettingsGUI( GeneratorCylinder generator, bool isSceneGUI ) + { + if( isSceneGUI ) + GUILayout.BeginHorizontal( GUILayout.MinWidth( 0 ) ); + + if( isSceneGUI ) + GUILayout.BeginVertical( width110 ); + + generator.CircleSmoothShading = SettingsToggle( generator.CircleSmoothShading, SmoothShadingContent, width110, isSceneGUI ); + TooltipUtility.SetToolTip( SmoothShadingTooltip ); + generator.CircleDistanceToSide = SettingsToggle( generator.CircleDistanceToSide, AlignToSideContent, width110, isSceneGUI ); + TooltipUtility.SetToolTip( AlignToSideTooltip ); + + if( isSceneGUI ) + { + GUILayout.EndVertical(); + GUILayout.BeginVertical( width80 ); + } + + generator.CircleSingleSurfaceEnds = !SettingsToggle( !generator.CircleSingleSurfaceEnds, RadialCapsContent, width80, isSceneGUI ); + TooltipUtility.SetToolTip( RadialCapsTooltip ); + generator.CircleRecenter = SettingsToggle( generator.CircleRecenter, FitShapeContent, width80, isSceneGUI ); + TooltipUtility.SetToolTip( FitShapeTooltip ); + + if( isSceneGUI ) + GUILayout.EndVertical(); + + if( isSceneGUI ) + GUILayout.EndHorizontal(); + } + + static void OnGUIContents( GeneratorCylinder generator, bool isSceneGUI ) + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + { + if( isSceneGUI ) + CylinderSettingsGUI( generator, isSceneGUI ); + } + GUILayout.EndHorizontal(); + + GUILayout.Space( 5 ); + + GUILayout.BeginVertical( CSG_GUIStyleUtility.ContentEmpty ); + { + var distanceUnit = RealtimeCSG.CSGSettings.DistanceUnit; + var nextUnit = Units.CycleToNextUnit( distanceUnit ); + var unitText = Units.GetUnitGUIContent( distanceUnit ); + + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + { + GUILayout.Label( HeightContent, width65 ); + + if( isSceneGUI ) + TooltipUtility.SetToolTip( HeightTooltip ); + + var height = generator.HaveHeight ? generator.Height : GeometryUtility.CleanLength( generator.DefaultHeight ); + EditorGUI.BeginChangeCheck(); + { + if( !isSceneGUI ) + height = Units.DistanceUnitToUnity( distanceUnit, EditorGUILayout.DoubleField( Units.UnityToDistanceUnit( distanceUnit, height ) ) ); + else + height = Units.DistanceUnitToUnity( distanceUnit, EditorGUILayout.DoubleField( Units.UnityToDistanceUnit( distanceUnit, height ), width65 ) ); + } + + if( EditorGUI.EndChangeCheck() ) + { + if( generator.HaveHeight ) + generator.Height = height; + else + generator.DefaultHeight = height; + } + + if( GUILayout.Button( unitText, EditorStyles.miniLabel, width25 ) ) + { + distanceUnit = nextUnit; + RealtimeCSG.CSGSettings.DistanceUnit = distanceUnit; + RealtimeCSG.CSGSettings.UpdateSnapSettings(); + RealtimeCSG.CSGSettings.Save(); + CSG_EditorGUIUtility.RepaintAll(); + } + } + GUILayout.EndHorizontal(); + + TooltipUtility.SetToolTip( HeightTooltip ); + + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + { + EditorGUI.BeginDisabledGroup( !generator.CanCommit ); + { + GUILayout.Label( RadiusContent, width65 ); + + if( isSceneGUI ) + TooltipUtility.SetToolTip( RadiusTooltip ); + + var radius = generator.RadiusA; + EditorGUI.BeginChangeCheck(); + { + if( !isSceneGUI ) + radius = Units.DistanceUnitToUnity( distanceUnit, EditorGUILayout.DoubleField( Units.UnityToDistanceUnit( distanceUnit, radius ) ) ); + else + radius = Units.DistanceUnitToUnity( distanceUnit, EditorGUILayout.DoubleField( Units.UnityToDistanceUnit( distanceUnit, radius ), width65 ) ); + } + + if( EditorGUI.EndChangeCheck() ) + { + generator.RadiusA = radius; + } + + if( GUILayout.Button( unitText, EditorStyles.miniLabel, width25 ) ) + { + distanceUnit = nextUnit; + RealtimeCSG.CSGSettings.DistanceUnit = distanceUnit; + RealtimeCSG.CSGSettings.UpdateSnapSettings(); + RealtimeCSG.CSGSettings.Save(); + CSG_EditorGUIUtility.RepaintAll(); + } + } + EditorGUI.EndDisabledGroup(); + } + GUILayout.EndHorizontal(); + + if( !isSceneGUI ) + TooltipUtility.SetToolTip( RadiusTooltip ); + } + + GUILayout.EndVertical(); + { + generator.CircleSides = IntSettingsControl + ( + generator.CircleSides, + 3, + RealtimeCSG.CSGSettings.MaxCircleSides, + SidesContent, + isSceneGUI + ); + + TooltipUtility.SetToolTip( SidesTooltip ); + } + generator.CircleOffset = FloatSettingsControl + ( + generator.CircleOffset, + 0, + 360, + OffsetContent, + isSceneGUI + ); + + TooltipUtility.SetToolTip( OffsetTooltip ); + + + if( !isSceneGUI ) + { + GUILayout.Space( 5 ); + + CylinderSettingsGUI( generator, isSceneGUI ); + } + } + + public static bool OnShowGUI( GeneratorCylinder generator, bool isSceneGUI ) + { + CSG_GUIStyleUtility.InitStyles(); + OnGUIContents( generator, isSceneGUI ); + + return true; + } + } } diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Cylinder.GUIContents.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Cylinder.GUIContents.cs index 3e167dc..0907def 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Cylinder.GUIContents.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Cylinder.GUIContents.cs @@ -1,35 +1,30 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; -using UnityEngine.SceneManagement; +using UnityEngine; + namespace RealtimeCSG { - internal sealed partial class GeneratorCylinderGUI - { - private static readonly GUIContent SmoothShadingContent = new GUIContent("Smooth shading"); - private static readonly ToolTip SmoothShadingTooltip = new ToolTip("Smooth shading", "Toggle if you want the sides of the cylinder have smooth lighting or have a faceted look."); - private static readonly GUIContent RadialCapsContent = new GUIContent("Radial caps"); - private static readonly ToolTip RadialCapsTooltip = new ToolTip("Radial caps", "Toggle if you want the top and bottom of the cylinder be a single polygon, or have a triangle per side."); - private static readonly GUIContent AlignToSideContent = new GUIContent("Start mid side"); - private static readonly ToolTip AlignToSideTooltip = new ToolTip("Start in the middle of a side", "Toggle if you want the cylinder to begin in the center of a side, or at a point."); - private static readonly GUIContent FitShapeContent = new GUIContent("Fit shape"); - private static readonly ToolTip FitShapeTooltip = new ToolTip("Fit shape", "Toggle if you want the cylinder to be fitted to the square that encapsulates the full circle that's defined by its radius. This makes the shapes more predictable when they have only a few sides, but it may change its shape slightly."); - private static readonly GUIContent OffsetContent = new GUIContent("Angle"); - private static readonly ToolTip OffsetTooltip = new ToolTip("Offset angle", "Set the offset angle at which the cylinder starts."); - private static readonly GUIContent SidesContent = new GUIContent("Sides"); - private static readonly ToolTip SidesTooltip = new ToolTip("Number of sides", "Set the number of sides the cylinder has when generated."); - private static readonly GUIContent HeightContent = new GUIContent("Height"); - private static readonly ToolTip HeightTooltip = new ToolTip("Height", "Set the height of the cylinder."); - private static readonly GUIContent RadiusContent = new GUIContent("Radius"); - private static readonly ToolTip RadiusTooltip = new ToolTip("Radius", "Set the radius of the cylinder. The radius is half of the width of a cylinder."); - - private static readonly GUILayoutOption width20 = GUILayout.Width(25); - private static readonly GUILayoutOption width65 = GUILayout.Width(65); - private static readonly GUILayoutOption width80 = GUILayout.Width(80); - private static readonly GUILayoutOption width110 = GUILayout.Width(110); - private static readonly GUILayoutOption width120 = GUILayout.Width(120); - } + internal sealed partial class GeneratorCylinderGUI + { + private static readonly GUIContent SmoothShadingContent = new GUIContent( "Smooth shading" ); + private static readonly ToolTip SmoothShadingTooltip = new ToolTip( "Smooth shading", "Toggle if you want the sides of the cylinder have smooth lighting or have a faceted look." ); + private static readonly GUIContent RadialCapsContent = new GUIContent( "Radial caps" ); + private static readonly ToolTip RadialCapsTooltip = new ToolTip( "Radial caps", "Toggle if you want the top and bottom of the cylinder be a single polygon, or have a triangle per side." ); + private static readonly GUIContent AlignToSideContent = new GUIContent( "Start mid side" ); + private static readonly ToolTip AlignToSideTooltip = new ToolTip( "Start in the middle of a side", "Toggle if you want the cylinder to begin in the center of a side, or at a point." ); + private static readonly GUIContent FitShapeContent = new GUIContent( "Fit shape" ); + private static readonly ToolTip FitShapeTooltip = new ToolTip( "Fit shape", "Toggle if you want the cylinder to be fitted to the square that encapsulates the full circle that's defined by its radius. This makes the shapes more predictable when they have only a few sides, but it may change its shape slightly." ); + private static readonly GUIContent OffsetContent = new GUIContent( "Angle" ); + private static readonly ToolTip OffsetTooltip = new ToolTip( "Offset angle", "Set the offset angle at which the cylinder starts." ); + private static readonly GUIContent SidesContent = new GUIContent( "Sides" ); + private static readonly ToolTip SidesTooltip = new ToolTip( "Number of sides", "Set the number of sides the cylinder has when generated." ); + private static readonly GUIContent HeightContent = new GUIContent( "Height" ); + private static readonly ToolTip HeightTooltip = new ToolTip( "Height", "Set the height of the cylinder." ); + private static readonly GUIContent RadiusContent = new GUIContent( "Radius" ); + private static readonly ToolTip RadiusTooltip = new ToolTip( "Radius", "Set the radius of the cylinder. The radius is half of the width of a cylinder." ); + + private static readonly GUILayoutOption width25 = GUILayout.Width( 25 ); + private static readonly GUILayoutOption width65 = GUILayout.Width( 65 ); + private static readonly GUILayoutOption width80 = GUILayout.Width( 80 ); + private static readonly GUILayoutOption width110 = GUILayout.Width( 110 ); + } } diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Sphere.GUI.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Sphere.GUI.cs index 3072cb6..4c4c406 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Sphere.GUI.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Sphere.GUI.cs @@ -1,192 +1,221 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; +using UnityEditor; using UnityEngine; -using UnityEngine.SceneManagement; + namespace RealtimeCSG { - internal sealed partial class GeneratorSphereGUI - { - static bool SettingsToggle(bool value, GUIContent content, bool isSceneGUI) - { - if (isSceneGUI) - return EditorGUILayout.ToggleLeft(content, value, width120); - else - return EditorGUILayout.Toggle(content, value); - } - - static float SettingsSlider(float value, float minValue, float maxValue, GUIContent content, bool isSceneGUI) - { - if (isSceneGUI) - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - GUILayout.Label(content, width65); - var result = EditorGUILayout.Slider(value, minValue, maxValue, width120); - GUILayout.EndHorizontal(); - return result; - } else - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - GUILayout.Label(content, width65); - var result = EditorGUILayout.Slider(value, minValue, maxValue); - GUILayout.EndHorizontal(); - return result; - } - } - - static int IntSettingsSlider(int value, int minValue, int maxValue, GUIContent content, bool isSceneGUI) - { - if (isSceneGUI) - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - GUILayout.Label(content, width65); - var result = EditorGUILayout.IntSlider(value, minValue, maxValue, width120); - GUILayout.EndHorizontal(); - return result; - } else - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - GUILayout.Label(content, width65); - var result = EditorGUILayout.IntSlider(value, minValue, maxValue); - GUILayout.EndHorizontal(); - return result; - } - } - - static void SphereSettingsGUI(GeneratorSphere generator, bool isSceneGUI) - { - GUILayout.BeginVertical(CSG_GUIStyleUtility.ContentEmpty); - { - generator.SphereSmoothShading = SettingsToggle(generator.SphereSmoothShading, SmoothShadingContent, isSceneGUI); - TooltipUtility.SetToolTip(SmoothShadingTooltip); - generator.IsHemiSphere = SettingsToggle(generator.IsHemiSphere, HemiSphereContent, isSceneGUI); - TooltipUtility.SetToolTip(HemiSphereTooltip); - } - GUILayout.EndVertical(); - } - - static void OnGUIContents(GeneratorSphere generator, bool isSceneGUI) - { - var distanceUnit = RealtimeCSG.CSGSettings.DistanceUnit; - var nextUnit = Units.CycleToNextUnit(distanceUnit); - var unitText = Units.GetUnitGUIContent(distanceUnit); - //GUILayout.BeginVertical(GUIStyleUtility.ContentEmpty); - //{ - //bool enabled = generator.HaveBrushes; - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - { - /* - EditorGUI.BeginDisabledGroup(!enabled); - { - if (isSceneGUI) - GUILayout.BeginVertical(GUI.skin.box, width100); - else - GUILayout.BeginVertical(GUIStyle.none); - { - bool mixedValues = !enabled; - CSGOperationType operation = generator.CurrentCSGOperationType; - EditorGUI.BeginChangeCheck(); - operation = CSG_EditorGUIUtility.ChooseOperation(operation, mixedValues); - if (EditorGUI.EndChangeCheck()) - { - generator.CurrentCSGOperationType = operation; - } - } - GUILayout.EndVertical(); - } - EditorGUI.EndDisabledGroup(); - */ - if (isSceneGUI) - SphereSettingsGUI(generator, isSceneGUI); - } - GUILayout.EndHorizontal(); - - GUILayout.Space(5); - - GUILayout.BeginVertical(CSG_GUIStyleUtility.ContentEmpty); - { - GUILayout.BeginHorizontal(CSG_GUIStyleUtility.ContentEmpty); - { - EditorGUI.BeginDisabledGroup(!generator.CanCommit); - { - GUILayout.Label(RadiusContent, width65); - if (isSceneGUI) - TooltipUtility.SetToolTip(RadiusTooltip); - var radius = generator.SphereRadius; - EditorGUI.BeginChangeCheck(); - { - if (!isSceneGUI) - radius = Units.DistanceUnitToUnity(distanceUnit, EditorGUILayout.DoubleField(Units.UnityToDistanceUnit(distanceUnit, radius))); - else - radius = Units.DistanceUnitToUnity(distanceUnit, EditorGUILayout.DoubleField(Units.UnityToDistanceUnit(distanceUnit, radius), width65)); - } - if (EditorGUI.EndChangeCheck()) - { - generator.SphereRadius = radius; - } - if (GUILayout.Button(unitText, EditorStyles.miniLabel, width25)) - { - distanceUnit = nextUnit; - RealtimeCSG.CSGSettings.DistanceUnit = distanceUnit; - RealtimeCSG.CSGSettings.UpdateSnapSettings(); - RealtimeCSG.CSGSettings.Save(); - CSG_EditorGUIUtility.RepaintAll(); - } - } - EditorGUI.EndDisabledGroup(); - } - GUILayout.EndHorizontal(); - if (!isSceneGUI) - TooltipUtility.SetToolTip(RadiusTooltip); - - { - generator.SphereSplits = IntSettingsSlider(generator.SphereSplits, 1, RealtimeCSG.CSGSettings.MaxSphereSplits, SplitsContent, isSceneGUI); - TooltipUtility.SetToolTip(SplitsTooltip); - } - { - generator.SphereOffset = SettingsSlider(generator.SphereOffset, 0, 360, OffsetContent, isSceneGUI); - TooltipUtility.SetToolTip(OffsetTooltip); - } - - } - GUILayout.EndVertical(); - - if (!isSceneGUI) - { - GUILayout.Space(5); - - SphereSettingsGUI(generator, isSceneGUI); - - //GUILayout.Space(10); - }/* else - { - GUILayout.Space(10); - }*/ - /* - EditorGUI.BeginDisabledGroup(!generator.CanCommit); - { - GUILayout.BeginHorizontal(GUIStyleUtility.ContentEmpty); - { - if (GUILayout.Button(CommitContent)) { generator.DoCommit(); } - TooltipUtility.SetToolTip(CommitTooltip); - if (GUILayout.Button(CancelContent)) { generator.DoCancel(); } - TooltipUtility.SetToolTip(CancelTooltip); - } - GUILayout.EndHorizontal(); - } - EditorGUI.EndDisabledGroup(); - */ - //} - //GUILayout.EndVertical(); - } - - public static bool OnShowGUI(GeneratorSphere generator, bool isSceneGUI) - { - CSG_GUIStyleUtility.InitStyles(); - OnGUIContents(generator, isSceneGUI); - return true; - } - } + internal sealed partial class GeneratorSphereGUI + { + static bool SettingsToggle( bool value, GUIContent content, bool isSceneGUI ) + { + if( isSceneGUI ) + return EditorGUILayout.ToggleLeft( content, value, width120 ); + else + return EditorGUILayout.Toggle( content, value ); + } + + + static float FloatSettingsControl( float value, float minValue, float maxValue, GUIContent content, bool isSceneGUI ) + { + if( isSceneGUI ) + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + GUILayout.Label( content, width65 ); + GUI.enabled = false; + + value = EditorGUILayout.FloatField( Mathf.Clamp( value, minValue, maxValue ) ); + + GUI.enabled = true; + + if( GUILayout.Button( "-", "buttonleft", width25 ) ) + value--; + + if( GUILayout.Button( "+", "buttonright", width25 ) ) + value++; + + GUILayout.EndHorizontal(); + + return value; + } + else + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + GUILayout.Label( content, width65 ); + + GUI.enabled = false; + + value = EditorGUILayout.FloatField( Mathf.Clamp( value, minValue, maxValue ) ); + + GUI.enabled = true; + + if( GUILayout.Button( "-", "buttonleft", width25 ) ) + value--; + + if( GUILayout.Button( "+", "buttonright", width25 ) ) + value++; + + GUILayout.EndHorizontal(); + + return value; + } + } + + static int IntSettingsControl( int value, int minValue, int maxValue, GUIContent content, bool isSceneGUI ) + { + if( isSceneGUI ) + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + GUILayout.Label( content, width65 ); + + GUI.enabled = false; + + value = EditorGUILayout.IntField( Mathf.Clamp( value, minValue, maxValue ) ); + + GUI.enabled = true; + + if( GUILayout.Button( "-", "buttonleft", width25 ) ) + value--; + + if( GUILayout.Button( "+", "buttonright", width25 ) ) + value++; + + GUILayout.EndHorizontal(); + + return value; + } + else + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + GUILayout.Label( content, width65 ); + + GUI.enabled = false; + + value = EditorGUILayout.IntField( Mathf.Clamp( value, minValue, maxValue ) ); + + GUI.enabled = true; + + if( GUILayout.Button( "-", "buttonleft", width25 ) ) + value--; + + if( GUILayout.Button( "+", "buttonright", width25 ) ) + value++; + + GUILayout.EndHorizontal(); + + return value; + } + } + + static void SphereSettingsGUI( GeneratorSphere generator, bool isSceneGUI ) + { + GUILayout.BeginVertical( CSG_GUIStyleUtility.ContentEmpty ); + { + generator.SphereSmoothShading = SettingsToggle( generator.SphereSmoothShading, SmoothShadingContent, isSceneGUI ); + TooltipUtility.SetToolTip( SmoothShadingTooltip ); + generator.IsHemiSphere = SettingsToggle( generator.IsHemiSphere, HemiSphereContent, isSceneGUI ); + TooltipUtility.SetToolTip( HemiSphereTooltip ); + } + GUILayout.EndVertical(); + } + + static void OnGUIContents( GeneratorSphere generator, bool isSceneGUI ) + { + var distanceUnit = RealtimeCSG.CSGSettings.DistanceUnit; + var nextUnit = Units.CycleToNextUnit( distanceUnit ); + var unitText = Units.GetUnitGUIContent( distanceUnit ); + + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + { + if( isSceneGUI ) + SphereSettingsGUI( generator, isSceneGUI ); + } + GUILayout.EndHorizontal(); + + GUILayout.Space( 5 ); + + GUILayout.BeginVertical( CSG_GUIStyleUtility.ContentEmpty ); + { + GUILayout.BeginHorizontal( CSG_GUIStyleUtility.ContentEmpty ); + { + EditorGUI.BeginDisabledGroup( !generator.CanCommit ); + { + GUILayout.Label( RadiusContent, width65 ); + + if( isSceneGUI ) + TooltipUtility.SetToolTip( RadiusTooltip ); + + var radius = generator.SphereRadius; + EditorGUI.BeginChangeCheck(); + { + if( !isSceneGUI ) + radius = Units.DistanceUnitToUnity( distanceUnit, EditorGUILayout.DoubleField( Units.UnityToDistanceUnit( distanceUnit, radius ) ) ); + else + radius = Units.DistanceUnitToUnity( distanceUnit, EditorGUILayout.DoubleField( Units.UnityToDistanceUnit( distanceUnit, radius ), width65 ) ); + } + + if( EditorGUI.EndChangeCheck() ) + { + generator.SphereRadius = radius; + } + + if( GUILayout.Button( unitText, EditorStyles.miniLabel, width25 ) ) + { + distanceUnit = nextUnit; + RealtimeCSG.CSGSettings.DistanceUnit = distanceUnit; + RealtimeCSG.CSGSettings.UpdateSnapSettings(); + RealtimeCSG.CSGSettings.Save(); + CSG_EditorGUIUtility.RepaintAll(); + } + } + EditorGUI.EndDisabledGroup(); + } + + GUILayout.EndHorizontal(); + + if( !isSceneGUI ) + TooltipUtility.SetToolTip( RadiusTooltip ); + + + generator.SphereSplits = IntSettingsControl + ( + generator.SphereSplits, + 1, + RealtimeCSG.CSGSettings.MaxSphereSplits, + SplitsContent, + isSceneGUI + ); + + TooltipUtility.SetToolTip( SplitsTooltip ); + + generator.SphereOffset = FloatSettingsControl + ( + generator.SphereOffset, + 0, + 360, + OffsetContent, + isSceneGUI + ); + + TooltipUtility.SetToolTip( OffsetTooltip ); + + } + + GUILayout.EndVertical(); + + if( !isSceneGUI ) + { + GUILayout.Space( 5 ); + + SphereSettingsGUI( generator, isSceneGUI ); + } + } + + public static bool OnShowGUI( GeneratorSphere generator, bool isSceneGUI ) + { + CSG_GUIStyleUtility.InitStyles(); + OnGUIContents( generator, isSceneGUI ); + + return true; + } + } } diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Sphere.GUIContents.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Sphere.GUIContents.cs index e45fbf0..aecc7a8 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Sphere.GUIContents.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModes/Generators/Generator.Sphere.GUIContents.cs @@ -1,27 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; -using UnityEngine.SceneManagement; +using UnityEngine; + namespace RealtimeCSG { - internal sealed partial class GeneratorSphereGUI - { - private static readonly GUIContent SmoothShadingContent = new GUIContent("Smooth shading"); - private static readonly ToolTip SmoothShadingTooltip = new ToolTip("Smooth shading", "Toggle if you want the sides of the sphere have smooth lighting or have a faceted look."); - private static readonly GUIContent HemiSphereContent = new GUIContent("Hemisphere"); - private static readonly ToolTip HemiSphereTooltip = new ToolTip("Hemisphere", "When toggled, create a hemisphere instead of a sphere."); - private static readonly GUIContent OffsetContent = new GUIContent("Offset"); - private static readonly ToolTip OffsetTooltip = new ToolTip("Offset angle", "Set the offset angle at which the cylinder starts."); - private static readonly GUIContent SplitsContent = new GUIContent("Splits"); - private static readonly ToolTip SplitsTooltip = new ToolTip("Number of splits", "Set the number of times the sides of the spherical cube to be split."); - private static readonly GUIContent RadiusContent = new GUIContent("Radius"); - private static readonly ToolTip RadiusTooltip = new ToolTip("Radius", "Set the radius of the cylinder. The radius is half of the width of a cylinder."); - - private static readonly GUILayoutOption width25 = GUILayout.Width(25); - private static readonly GUILayoutOption width65 = GUILayout.Width(65); - private static readonly GUILayoutOption width120 = GUILayout.Width(120); - } + internal sealed partial class GeneratorSphereGUI + { + private static readonly GUIContent SmoothShadingContent = new GUIContent( "Smooth shading" ); + private static readonly ToolTip SmoothShadingTooltip = new ToolTip( "Smooth shading", "Toggle if you want the sides of the sphere have smooth lighting or have a faceted look." ); + private static readonly GUIContent HemiSphereContent = new GUIContent( "Hemisphere" ); + private static readonly ToolTip HemiSphereTooltip = new ToolTip( "Hemisphere", "When toggled, create a hemisphere instead of a sphere." ); + private static readonly GUIContent OffsetContent = new GUIContent( "Offset" ); + private static readonly ToolTip OffsetTooltip = new ToolTip( "Offset angle", "Set the offset angle at which the cylinder starts." ); + private static readonly GUIContent SplitsContent = new GUIContent( "Splits" ); + private static readonly ToolTip SplitsTooltip = new ToolTip( "Number of splits", "Set the number of times the sides of the spherical cube to be split." ); + private static readonly GUIContent RadiusContent = new GUIContent( "Radius" ); + private static readonly ToolTip RadiusTooltip = new ToolTip( "Radius", "Set the radius of the cylinder. The radius is half of the width of a cylinder." ); + + private static readonly GUILayoutOption width25 = GUILayout.Width( 25 ); + private static readonly GUILayoutOption width65 = GUILayout.Width( 65 ); + private static readonly GUILayoutOption width120 = GUILayout.Width( 120 ); + } } diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewBottomBarGUI/SceneViewBottomBar.GUI.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewBottomBarGUI/SceneViewBottomBar.GUI.cs index dd5550f..f242f94 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewBottomBarGUI/SceneViewBottomBar.GUI.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewBottomBarGUI/SceneViewBottomBar.GUI.cs @@ -19,18 +19,13 @@ public static void ShowGUI(SceneView sceneView, bool haveOffset = true) CSG_GUIStyleUtility.InitStyles(); if (sceneView != null) { - float height = sceneView.position.height;//Screen.height; - float width = sceneView.position.width;//Screen.width; - Rect bottomBarRect; + float height = sceneView.rootVisualElement.contentRect.height; //Screen.height; + float width = sceneView.rootVisualElement.contentRect.width; //Screen.width; + Rect bottomBarRect; if (haveOffset) { -#if UNITY_2021_2_OR_NEWER - bottomBarRect = new Rect(0, height - (CSG_GUIStyleUtility.BottomToolBarHeight + 27), - width, CSG_GUIStyleUtility.BottomToolBarHeight); -#else bottomBarRect = new Rect(0, height - (CSG_GUIStyleUtility.BottomToolBarHeight + 18), width, CSG_GUIStyleUtility.BottomToolBarHeight); -#endif } else bottomBarRect = new Rect(0, height - (CSG_GUIStyleUtility.BottomToolBarHeight + 1), width, CSG_GUIStyleUtility.BottomToolBarHeight); @@ -87,7 +82,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize) var updateSurfaces = false; bool wireframeModified = false; - var viewWidth = sceneView.position.width; + var viewWidth = sceneView.rootVisualElement.contentRect.width; float layoutHeight = barSize.height; float layoutX = 6.0f; diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewInfoGUI/SceneViewInfo.GUI.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewInfoGUI/SceneViewInfo.GUI.cs index 6e05dda..e954108 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewInfoGUI/SceneViewInfo.GUI.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewInfoGUI/SceneViewInfo.GUI.cs @@ -1,7 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * -RealtimeCSG.SceneViewInfo.GUI.cs - -License: +License: MIT (TLDR: https://tldrlegal.com/license/mit-license) Author: Daniel Cornelius Description: diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewInfoGUI/SceneViewInfo.GUIContents.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewInfoGUI/SceneViewInfo.GUIContents.cs index 35fc30c..c10b03a 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewInfoGUI/SceneViewInfo.GUIContents.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewInfoGUI/SceneViewInfo.GUIContents.cs @@ -1,26 +1,27 @@ /* * * * * * * * * * * * * * * * * * * * * * -RealtimeCSG.SceneViewInfo.GUIContents.cs - -License: +License: MIT (TLDR: https://tldrlegal.com/license/mit-license) Author: Daniel Cornelius Description: Handles styles for SceneViewInfoGUI * * * * * * * * * * * * * * * * * * * * * */ + using UnityEditor; using UnityEngine; + namespace RealtimeCSG { internal sealed partial class SceneViewInfoGUI { - private static Rect infoGUIRect = new Rect(); - private static Color infoGUITextColor = new Color32( 160, 160, 160, 255 ); - private static GUIStyle infoGUIStyle = null; - private static GUIStyle infoGUIBGStyle = null; - private static float infoGUILabelHeight = 34; - private static Texture2D m_InfoGUIBGTex = null; + private static readonly Color infoGUITextColor = new Color32( 160, 160, 160, 255 ); + + private static Rect infoGUIRect; + private static GUIStyle infoGUIStyle; + private static GUIStyle infoGUIBGStyle; + private const float infoGUILabelHeight = 34; + private static Texture2D m_InfoGUIBGTex; private static Texture2D InfoGUIBGTex { @@ -35,23 +36,29 @@ private static Texture2D InfoGUIBGTex private static void InitStyles( SceneView sceneView ) { - infoGUIRect.x = sceneView.position.width - 116; - infoGUIRect.y = sceneView.position.height - 74; + infoGUIRect.x = sceneView.rootVisualElement.contentRect.width - 116; + infoGUIRect.y = sceneView.rootVisualElement.contentRect.height - 74; infoGUIRect.width = 110; infoGUIRect.height = infoGUILabelHeight; infoGUIStyle = new GUIStyle( "MiniLabel" ) { alignment = TextAnchor.UpperLeft, - normal = new GUIStyleState() { textColor = infoGUITextColor }, - margin = new RectOffset( 0, 0, 0, 0 ), - padding = new RectOffset( 0, 0, 0, 0 ), + normal = new GUIStyleState() + { + textColor = infoGUITextColor + }, + margin = new RectOffset( 0, 0, 0, 0 ), + padding = new RectOffset( 0, 0, 0, 0 ), fontSize = 11 }; infoGUIBGStyle = new GUIStyle( "box" ) { - normal = new GUIStyleState() { background = InfoGUIBGTex } + normal = new GUIStyleState() + { + background = InfoGUIBGTex + } }; } } diff --git a/RealtimeCSG/Packages/manifest.json b/RealtimeCSG/Packages/manifest.json new file mode 100644 index 0000000..34e00ef --- /dev/null +++ b/RealtimeCSG/Packages/manifest.json @@ -0,0 +1,39 @@ +{ + "dependencies": { + "com.unity.ide.rider": "3.0.9", + "com.unity.test-framework": "1.1.29", + "com.unity.timeline": "1.6.3", + "com.unity.ugui": "1.0.0", + "com.unity.modules.ai": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.cloth": "1.0.0", + "com.unity.modules.director": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.physics2d": "1.0.0", + "com.unity.modules.screencapture": "1.0.0", + "com.unity.modules.terrain": "1.0.0", + "com.unity.modules.terrainphysics": "1.0.0", + "com.unity.modules.tilemap": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.umbra": "1.0.0", + "com.unity.modules.unityanalytics": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.unitywebrequesttexture": "1.0.0", + "com.unity.modules.unitywebrequestwww": "1.0.0", + "com.unity.modules.vehicles": "1.0.0", + "com.unity.modules.video": "1.0.0", + "com.unity.modules.vr": "1.0.0", + "com.unity.modules.wind": "1.0.0", + "com.unity.modules.xr": "1.0.0" + } +} diff --git a/RealtimeCSG/Packages/packages-lock.json b/RealtimeCSG/Packages/packages-lock.json new file mode 100644 index 0000000..429ef36 --- /dev/null +++ b/RealtimeCSG/Packages/packages-lock.json @@ -0,0 +1,306 @@ +{ + "dependencies": { + "com.unity.ext.nunit": { + "version": "1.0.6", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ide.rider": { + "version": "3.0.9", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.6" + }, + "url": "https://packages.unity.com" + }, + "com.unity.test-framework": { + "version": "1.1.29", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.6", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.timeline": { + "version": "1.6.3", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.director": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ugui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0" + } + }, + "com.unity.modules.ai": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.androidjni": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.animation": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.assetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.audio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.cloth": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.director": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.animation": "1.0.0" + } + }, + "com.unity.modules.imageconversion": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.imgui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.jsonserialize": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.particlesystem": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics2d": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.screencapture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.subsystems": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.terrain": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.terrainphysics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.terrain": "1.0.0" + } + }, + "com.unity.modules.tilemap": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics2d": "1.0.0" + } + }, + "com.unity.modules.ui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.uielements": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.uielementsnative": "1.0.0" + } + }, + "com.unity.modules.uielementsnative": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.umbra": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unityanalytics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.unitywebrequest": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unitywebrequestassetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestaudio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.audio": "1.0.0" + } + }, + "com.unity.modules.unitywebrequesttexture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestwww": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.vehicles": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.video": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.vr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.xr": "1.0.0" + } + }, + "com.unity.modules.wind": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.xr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.subsystems": "1.0.0" + } + } + } +} diff --git a/RealtimeCSG/ProjectSettings/MemorySettings.asset b/RealtimeCSG/ProjectSettings/MemorySettings.asset new file mode 100644 index 0000000..5b5face --- /dev/null +++ b/RealtimeCSG/ProjectSettings/MemorySettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!387306366 &1 +MemorySettings: + m_ObjectHideFlags: 0 + m_EditorMemorySettings: + m_MainAllocatorBlockSize: -1 + m_ThreadAllocatorBlockSize: -1 + m_MainGfxBlockSize: -1 + m_ThreadGfxBlockSize: -1 + m_CacheBlockSize: -1 + m_TypetreeBlockSize: -1 + m_ProfilerBlockSize: -1 + m_ProfilerEditorBlockSize: -1 + m_BucketAllocatorGranularity: -1 + m_BucketAllocatorBucketsCount: -1 + m_BucketAllocatorBlockSize: -1 + m_BucketAllocatorBlockCount: -1 + m_ProfilerBucketAllocatorGranularity: -1 + m_ProfilerBucketAllocatorBucketsCount: -1 + m_ProfilerBucketAllocatorBlockSize: -1 + m_ProfilerBucketAllocatorBlockCount: -1 + m_TempAllocatorSizeMain: -1 + m_JobTempAllocatorBlockSize: -1 + m_BackgroundJobTempAllocatorBlockSize: -1 + m_JobTempAllocatorReducedBlockSize: -1 + m_TempAllocatorSizeGIBakingWorker: -1 + m_TempAllocatorSizeNavMeshWorker: -1 + m_TempAllocatorSizeAudioWorker: -1 + m_TempAllocatorSizeCloudWorker: -1 + m_TempAllocatorSizeGfx: -1 + m_TempAllocatorSizeJobWorker: -1 + m_TempAllocatorSizeBackgroundWorker: -1 + m_TempAllocatorSizePreloadManager: -1 + m_PlatformMemorySettings: {} diff --git a/RealtimeCSG/ProjectSettings/PackageManagerSettings.asset b/RealtimeCSG/ProjectSettings/PackageManagerSettings.asset new file mode 100644 index 0000000..b3df787 --- /dev/null +++ b/RealtimeCSG/ProjectSettings/PackageManagerSettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_EnablePreReleasePackages: 1 + m_EnablePackageDependencies: 1 + m_AdvancedSettingsExpanded: 1 + m_ScopedRegistriesSettingsExpanded: 1 + m_SeeAllPackageVersions: 0 + oneTimeWarningShown: 1 + m_Registries: + - m_Id: main + m_Name: + m_Url: https://packages.unity.com + m_Scopes: [] + m_IsDefault: 1 + m_Capabilities: 7 + m_UserSelectedRegistryName: + m_UserAddingNewScopedRegistry: 0 + m_RegistryInfoDraft: + m_Modified: 0 + m_ErrorMessage: + m_UserModificationsInstanceId: -836 + m_OriginalInstanceId: -838 + m_LoadAssets: 0 diff --git a/RealtimeCSG/ProjectSettings/PresetManager.asset b/RealtimeCSG/ProjectSettings/PresetManager.asset new file mode 100644 index 0000000..67a94da --- /dev/null +++ b/RealtimeCSG/ProjectSettings/PresetManager.asset @@ -0,0 +1,7 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1386491679 &1 +PresetManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_DefaultPresets: {} diff --git a/RealtimeCSG/ProjectSettings/ProjectSettings.asset b/RealtimeCSG/ProjectSettings/ProjectSettings.asset index d6d2b55..85ca196 100644 Binary files a/RealtimeCSG/ProjectSettings/ProjectSettings.asset and b/RealtimeCSG/ProjectSettings/ProjectSettings.asset differ diff --git a/RealtimeCSG/ProjectSettings/ProjectVersion.txt b/RealtimeCSG/ProjectSettings/ProjectVersion.txt deleted file mode 100644 index 09b2eac..0000000 --- a/RealtimeCSG/ProjectSettings/ProjectVersion.txt +++ /dev/null @@ -1 +0,0 @@ -m_EditorVersion: 5.6.4f1 diff --git a/RealtimeCSG/ProjectSettings/VFXManager.asset b/RealtimeCSG/ProjectSettings/VFXManager.asset new file mode 100644 index 0000000..82b46d9 --- /dev/null +++ b/RealtimeCSG/ProjectSettings/VFXManager.asset @@ -0,0 +1,15 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!937362698 &1 +VFXManager: + m_ObjectHideFlags: 0 + m_IndirectShader: {fileID: 0} + m_CopyBufferShader: {fileID: 0} + m_SortShader: {fileID: 0} + m_StripUpdateShader: {fileID: 0} + m_RenderPipeSettingsPath: + m_FixedTimeStep: 0.016666668 + m_MaxDeltaTime: 0.05 + m_CompiledVersion: 0 + m_RuntimeVersion: 0 + m_RuntimeResources: {fileID: 0} diff --git a/RealtimeCSG/ProjectSettings/boot.config b/RealtimeCSG/ProjectSettings/boot.config new file mode 100644 index 0000000..e69de29