diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/API/Components/Runtime/CSGModel.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/API/Components/Runtime/CSGModel.cs index 187178b..aebc135 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/API/Components/Runtime/CSGModel.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/API/Components/Runtime/CSGModel.cs @@ -47,7 +47,7 @@ public sealed class CSGModel : CSGNode { public const float CurrentVersion = 1.1f; - public static ModelSettingsFlags DefaultSettings = ((ModelSettingsFlags)UnityEngine.Rendering.ShadowCastingMode.On) | ModelSettingsFlags.PreserveUVs; + public static ModelSettingsFlags DefaultSettings = ((ModelSettingsFlags)UnityEngine.Rendering.ShadowCastingMode.On) | ModelSettingsFlags.PreserveUVs | ModelSettingsFlags.AutoUpdateRigidBody; /// The version number of this instance of a [HideInInspector] public float Version = CurrentVersion; diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Data/Settings/CSGSettings.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Data/Settings/CSGSettings.cs index 860650e..0af09f3 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Data/Settings/CSGSettings.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Data/Settings/CSGSettings.cs @@ -274,6 +274,20 @@ static public bool DefaultPreserveUVs } } static public bool SnapNonCSGObjects = true; + static public bool AutoRigidbody + { + get + { + return (CSGModel.DefaultSettings & ModelSettingsFlags.AutoUpdateRigidBody) == ModelSettingsFlags.AutoUpdateRigidBody; + } + set + { + if (value) + CSGModel.DefaultSettings |= ModelSettingsFlags.AutoUpdateRigidBody; + else + CSGModel.DefaultSettings &= ~ModelSettingsFlags.AutoUpdateRigidBody; + } + } static public Vector3 DefaultMoveOffset = Vector3.zero; static public Vector3 DefaultRotateOffset = Vector3.zero; @@ -609,6 +623,7 @@ public static void Reload() HiddenSurfacesNotSelectable = EditorPrefs.GetBool("HiddenSurfacesNotSelectable", true); // HiddenSurfacesOrthoSelectable = EditorPrefs.GetBool("HiddenSurfacesOrthoSelectable", true); ShowTooltips = EditorPrefs.GetBool("ShowTooltips", true); + AutoRigidbody = EditorPrefs.GetBool("AutoRigidbody", (CSGModel.DefaultSettings & ModelSettingsFlags.AutoUpdateRigidBody) == ModelSettingsFlags.AutoUpdateRigidBody); DefaultPreserveUVs = EditorPrefs.GetBool("DefaultPreserveUVs", (CSGModel.DefaultSettings & ModelSettingsFlags.PreserveUVs) == ModelSettingsFlags.PreserveUVs); SnapNonCSGObjects = EditorPrefs.GetBool("SnapNonCSGObjects", true); @@ -696,6 +711,7 @@ public static void Save() // EditorPrefs.SetBool("HiddenSurfacesOrthoSelectable", RealtimeCSG.CSGSettings.HiddenSurfacesOrthoSelectable); EditorPrefs.SetBool("ShowTooltips", RealtimeCSG.CSGSettings.ShowTooltips); + EditorPrefs.SetBool("AutoRigidbody", (CSGModel.DefaultSettings & ModelSettingsFlags.AutoUpdateRigidBody) == ModelSettingsFlags.AutoUpdateRigidBody); EditorPrefs.SetBool("DefaultPreserveUVs", (CSGModel.DefaultSettings & ModelSettingsFlags.PreserveUVs) == ModelSettingsFlags.PreserveUVs); EditorPrefs.SetBool("SnapNonCSGObjects", RealtimeCSG.CSGSettings.SnapNonCSGObjects); diff --git a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/PreferenceWindows/CSGOptions.PreferenceWindow.cs b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/PreferenceWindows/CSGOptions.PreferenceWindow.cs index de0f617..fd08ebb 100644 --- a/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/PreferenceWindows/CSGOptions.PreferenceWindow.cs +++ b/RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/PreferenceWindows/CSGOptions.PreferenceWindow.cs @@ -17,6 +17,7 @@ public static void PreferenceWindow() { CSGSettings.ShowTooltips = EditorGUILayout.ToggleLeft("Show Tool-Tips", CSGSettings.ShowTooltips); CSGSettings.SnapNonCSGObjects = EditorGUILayout.ToggleLeft("Snap Non-CSG Objects to the grid", CSGSettings.SnapNonCSGObjects); + CSGSettings.AutoRigidbody = EditorGUILayout.ToggleLeft("Disable auto add rigidbodies", CSGSettings.AutoRigidbody); CSGSettings.DefaultPreserveUVs = EditorGUILayout.ToggleLeft("Preserve UVs (Default)", CSGSettings.DefaultPreserveUVs); EditorGUILayout.Space(); CSGSettings.MaxCircleSides = EditorGUILayout.IntField("Max Circle Sides", CSGSettings.MaxCircleSides);