Skip to content

Commit 03adff5

Browse files
author
Sander van Rossen
committed
Merge remote-tracking branch 'origin/master'
2 parents 8475d47 + 67d7ead commit 03adff5

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

RealtimeCSG/Assets/Plugins/RealtimeCSG/API/Components/Runtime/CSGModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public sealed class CSGModel : CSGNode
4747
{
4848
public const float CurrentVersion = 1.1f;
4949

50-
public static ModelSettingsFlags DefaultSettings = ((ModelSettingsFlags)UnityEngine.Rendering.ShadowCastingMode.On) | ModelSettingsFlags.PreserveUVs;
50+
public static ModelSettingsFlags DefaultSettings = ((ModelSettingsFlags)UnityEngine.Rendering.ShadowCastingMode.On) | ModelSettingsFlags.PreserveUVs | ModelSettingsFlags.AutoUpdateRigidBody;
5151

5252
/// <value>The version number of this instance of a <see cref="CSGModel" /></value>
5353
[HideInInspector] public float Version = CurrentVersion;

RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/Data/Settings/CSGSettings.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,20 @@ static public bool DefaultPreserveUVs
274274
}
275275
}
276276
static public bool SnapNonCSGObjects = true;
277+
static public bool AutoRigidbody
278+
{
279+
get
280+
{
281+
return (CSGModel.DefaultSettings & ModelSettingsFlags.AutoUpdateRigidBody) == ModelSettingsFlags.AutoUpdateRigidBody;
282+
}
283+
set
284+
{
285+
if (value)
286+
CSGModel.DefaultSettings |= ModelSettingsFlags.AutoUpdateRigidBody;
287+
else
288+
CSGModel.DefaultSettings &= ~ModelSettingsFlags.AutoUpdateRigidBody;
289+
}
290+
}
277291

278292
static public Vector3 DefaultMoveOffset = Vector3.zero;
279293
static public Vector3 DefaultRotateOffset = Vector3.zero;
@@ -609,6 +623,7 @@ public static void Reload()
609623
HiddenSurfacesNotSelectable = EditorPrefs.GetBool("HiddenSurfacesNotSelectable", true);
610624
// HiddenSurfacesOrthoSelectable = EditorPrefs.GetBool("HiddenSurfacesOrthoSelectable", true);
611625
ShowTooltips = EditorPrefs.GetBool("ShowTooltips", true);
626+
AutoRigidbody = EditorPrefs.GetBool("AutoRigidbody", (CSGModel.DefaultSettings & ModelSettingsFlags.AutoUpdateRigidBody) == ModelSettingsFlags.AutoUpdateRigidBody);
612627
DefaultPreserveUVs = EditorPrefs.GetBool("DefaultPreserveUVs", (CSGModel.DefaultSettings & ModelSettingsFlags.PreserveUVs) == ModelSettingsFlags.PreserveUVs);
613628
SnapNonCSGObjects = EditorPrefs.GetBool("SnapNonCSGObjects", true);
614629

@@ -696,6 +711,7 @@ public static void Save()
696711
// EditorPrefs.SetBool("HiddenSurfacesOrthoSelectable", RealtimeCSG.CSGSettings.HiddenSurfacesOrthoSelectable);
697712

698713
EditorPrefs.SetBool("ShowTooltips", RealtimeCSG.CSGSettings.ShowTooltips);
714+
EditorPrefs.SetBool("AutoRigidbody", (CSGModel.DefaultSettings & ModelSettingsFlags.AutoUpdateRigidBody) == ModelSettingsFlags.AutoUpdateRigidBody);
699715
EditorPrefs.SetBool("DefaultPreserveUVs", (CSGModel.DefaultSettings & ModelSettingsFlags.PreserveUVs) == ModelSettingsFlags.PreserveUVs);
700716
EditorPrefs.SetBool("SnapNonCSGObjects", RealtimeCSG.CSGSettings.SnapNonCSGObjects);
701717

RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/PreferenceWindows/CSGOptions.PreferenceWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public static void PreferenceWindow()
1717
{
1818
CSGSettings.ShowTooltips = EditorGUILayout.ToggleLeft("Show Tool-Tips", CSGSettings.ShowTooltips);
1919
CSGSettings.SnapNonCSGObjects = EditorGUILayout.ToggleLeft("Snap Non-CSG Objects to the grid", CSGSettings.SnapNonCSGObjects);
20+
CSGSettings.AutoRigidbody = EditorGUILayout.ToggleLeft("Disable auto add rigidbodies", CSGSettings.AutoRigidbody);
2021
CSGSettings.DefaultPreserveUVs = EditorGUILayout.ToggleLeft("Preserve UVs (Default)", CSGSettings.DefaultPreserveUVs);
2122
EditorGUILayout.Space();
2223
CSGSettings.MaxCircleSides = EditorGUILayout.IntField("Max Circle Sides", CSGSettings.MaxCircleSides);

0 commit comments

Comments
 (0)