Skip to content

Update SettingsProvider API to 2019.1 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion com.unity.probuilder/Editor/EditorCore/AboutWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sealed class AboutWindow : EditorWindow
const float k_BannerWidth = 480f;
const float k_BannerHeight = 270f;

static Pref<SemVer> s_StoredVersionInfo = new Pref<SemVer>("about.identifier", new SemVer(), SettingsScopes.Project);
static Pref<SemVer> s_StoredVersionInfo = new Pref<SemVer>("about.identifier", new SemVer(), SettingsScope.Project);

const string k_AboutPrefFormat = "M.m.p-T.b";

Expand Down
6 changes: 3 additions & 3 deletions com.unity.probuilder/Editor/EditorCore/ConfigurableWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ string utilityWindowKey

protected static bool IsUtilityWindow<T>() where T : ConfigurableWindow
{
return ProBuilderSettings.Get<bool>(typeof(T).ToString() + "-isUtilityWindow", SettingsScopes.Project, false);
return ProBuilderSettings.Get<bool>(typeof(T).ToString() + "-isUtilityWindow", SettingsScope.Project, false);
}

public static new T GetWindow<T>(string title, bool focus = true) where T : ConfigurableWindow
Expand All @@ -23,7 +23,7 @@ protected static bool IsUtilityWindow<T>() where T : ConfigurableWindow

public virtual void AddItemsToMenu(GenericMenu menu)
{
bool floating = ProBuilderSettings.Get<bool>(utilityWindowKey, SettingsScopes.Project, false);
bool floating = ProBuilderSettings.Get<bool>(utilityWindowKey, SettingsScope.Project, false);
menu.AddItem(new GUIContent("Window/Open as Floating Window", ""), floating, () => SetIsUtilityWindow(true) );
menu.AddItem(new GUIContent("Window/Open as Dockable Window", ""), !floating, () => SetIsUtilityWindow(false) );
}
Expand All @@ -42,7 +42,7 @@ protected void DoContextMenu()

void SetIsUtilityWindow(bool isUtilityWindow)
{
ProBuilderSettings.Set<bool>(utilityWindowKey, isUtilityWindow, SettingsScopes.Project);
ProBuilderSettings.Set<bool>(utilityWindowKey, isUtilityWindow, SettingsScope.Project);
var title = titleContent;
Close();
var res = GetWindow(GetType(), isUtilityWindow);
Expand Down
24 changes: 12 additions & 12 deletions com.unity.probuilder/Editor/EditorCore/EditorMeshHandles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ class EditorMeshHandles : IDisposable, IHasPreferences
static readonly Color k_WireframeDefault = new Color(94.0f / 255.0f, 119.0f / 255.0f, 155.0f / 255.0f, 1f);

[UserSetting]
static Pref<bool> s_UseUnityColors = new Pref<bool>("graphics.handlesUseUnityColors", true, SettingsScopes.User);
static Pref<bool> s_UseUnityColors = new Pref<bool>("graphics.handlesUseUnityColors", true, SettingsScope.User);
[UserSetting]
static Pref<bool> s_DitherFaceHandle = new Pref<bool>("graphics.ditherFaceHandles", true, SettingsScopes.User);
static Pref<bool> s_DitherFaceHandle = new Pref<bool>("graphics.ditherFaceHandles", true, SettingsScope.User);
[UserSetting]
static Pref<Color> s_SelectedFaceColorPref = new Pref<Color>("graphics.userSelectedFaceColor", new Color(0f, 210f / 255f, 239f / 255f, 1f), SettingsScopes.User);
static Pref<Color> s_SelectedFaceColorPref = new Pref<Color>("graphics.userSelectedFaceColor", new Color(0f, 210f / 255f, 239f / 255f, 1f), SettingsScope.User);
[UserSetting]
static Pref<Color> s_WireframeColorPref = new Pref<Color>("graphics.userWireframeColor", new Color(125f / 255f, 155f / 255f, 185f / 255f, 1f), SettingsScopes.User);
static Pref<Color> s_WireframeColorPref = new Pref<Color>("graphics.userWireframeColor", new Color(125f / 255f, 155f / 255f, 185f / 255f, 1f), SettingsScope.User);
[UserSetting]
static Pref<Color> s_UnselectedEdgeColorPref = new Pref<Color>("graphics.userUnselectedEdgeColor", new Color(44f / 255f, 44f / 255f, 44f / 255f, 1f), SettingsScopes.User);
static Pref<Color> s_UnselectedEdgeColorPref = new Pref<Color>("graphics.userUnselectedEdgeColor", new Color(44f / 255f, 44f / 255f, 44f / 255f, 1f), SettingsScope.User);
[UserSetting]
static Pref<Color> s_SelectedEdgeColorPref = new Pref<Color>("graphics.userSelectedEdgeColor", new Color(0f, 210f / 255f, 239f / 255f, 1f), SettingsScopes.User);
static Pref<Color> s_SelectedEdgeColorPref = new Pref<Color>("graphics.userSelectedEdgeColor", new Color(0f, 210f / 255f, 239f / 255f, 1f), SettingsScope.User);
[UserSetting]
static Pref<Color> s_UnselectedVertexColorPref = new Pref<Color>("graphics.userUnselectedVertexColor", new Color(44f / 255f, 44f / 255f, 44f / 255f, 1f), SettingsScopes.User);
static Pref<Color> s_UnselectedVertexColorPref = new Pref<Color>("graphics.userUnselectedVertexColor", new Color(44f / 255f, 44f / 255f, 44f / 255f, 1f), SettingsScope.User);
[UserSetting]
static Pref<Color> s_SelectedVertexColorPref = new Pref<Color>("graphics.userSelectedVertexColor", new Color(0f, 210f / 255f, 239f / 255f, 1f), SettingsScopes.User);
static Pref<Color> s_SelectedVertexColorPref = new Pref<Color>("graphics.userSelectedVertexColor", new Color(0f, 210f / 255f, 239f / 255f, 1f), SettingsScope.User);
[UserSetting]
static Pref<Color> s_PreselectionColorPref = new Pref<Color>("graphics.userPreselectionColor", new Color(179f / 255f, 246f / 255f, 255f / 255f, 1f), SettingsScopes.User);
static Pref<Color> s_PreselectionColorPref = new Pref<Color>("graphics.userPreselectionColor", new Color(179f / 255f, 246f / 255f, 255f / 255f, 1f), SettingsScope.User);

[UserSetting]
static Pref<float> s_WireframeLineSize = new Pref<float>("graphics.wireframeLineSize", .5f, SettingsScopes.User);
static Pref<float> s_WireframeLineSize = new Pref<float>("graphics.wireframeLineSize", .5f, SettingsScope.User);
[UserSetting]
static Pref<float> s_EdgeLineSize = new Pref<float>("graphics.edgeLineSize", 1f, SettingsScopes.User);
static Pref<float> s_EdgeLineSize = new Pref<float>("graphics.edgeLineSize", 1f, SettingsScope.User);
[UserSetting]
static Pref<float> s_VertexPointSize = new Pref<float>("graphics.vertexPointSize", 3f, SettingsScopes.User);
static Pref<float> s_VertexPointSize = new Pref<float>("graphics.vertexPointSize", 3f, SettingsScope.User);

[UserSettingBlock("Graphics")]
static void HandleColorPreferences(string searchContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class EditorMeshUtility
static string k_MeshCacheDirectory = "Assets/ProBuilder Data/ProBuilderMeshCache";

[UserSetting("Mesh Editing", "Auto Resize Colliders", "Automatically resize colliders with mesh bounds as you edit.")]
static Pref<bool> s_AutoResizeCollisions = new Pref<bool>("editor.autoRecalculateCollisions", false, SettingsScopes.Project);
static Pref<bool> s_AutoResizeCollisions = new Pref<bool>("editor.autoRecalculateCollisions", false, SettingsScope.Project);

/// <value>
/// This callback is raised after a ProBuilderMesh has been successfully optimized.
Expand Down
4 changes: 2 additions & 2 deletions com.unity.probuilder/Editor/EditorCore/EditorToolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ sealed class EditorToolbar : ScriptableObject
{
EditorToolbar() { }

Pref<Vector2> m_Scroll = new Pref<Vector2>("editor.scrollPosition", Vector2.zero, SettingsScopes.User);
Pref<Vector2> m_Scroll = new Pref<Vector2>("editor.scrollPosition", Vector2.zero, SettingsScope.User);
public EditorWindow window;

bool isFloating { get { return ProBuilderEditor.instance != null && ProBuilderEditor.instance.isFloatingWindow; } }
bool isIconMode = true;

[UserSetting("Toolbar", "Shift Key Tooltips", "Tooltips will only show when the Shift key is held")]
internal static Pref<bool> s_ShiftOnlyTooltips = new Pref<bool>("editor.shiftOnlyTooltips", false, SettingsScopes.User);
internal static Pref<bool> s_ShiftOnlyTooltips = new Pref<bool>("editor.shiftOnlyTooltips", false, SettingsScope.User);

SimpleTuple<string, double> tooltipTimer = new SimpleTuple<string, double>("", 0.0);
// the element currently being hovered
Expand Down
4 changes: 2 additions & 2 deletions com.unity.probuilder/Editor/EditorCore/EditorUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ internal enum PivotLocation
static Pref<ColliderType> s_ColliderType = new Pref<ColliderType>("mesh.newShapeColliderType", ColliderType.MeshCollider);

[UserSetting]
static Pref<bool> s_ExperimentalFeatures = new Pref<bool>("experimental.featuresEnabled", false, SettingsScopes.User);
static Pref<bool> s_ExperimentalFeatures = new Pref<bool>("experimental.featuresEnabled", false, SettingsScope.User);

[UserSetting]
static Pref<bool> s_MeshesAreAssets = new Pref<bool>("experimental.meshesAreAssets", false, SettingsScopes.Project);
static Pref<bool> s_MeshesAreAssets = new Pref<bool>("experimental.meshesAreAssets", false, SettingsScope.Project);

internal static bool meshesAreAssets
{
Expand Down
4 changes: 2 additions & 2 deletions com.unity.probuilder/Editor/EditorCore/Lightmapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ static class Lightmapping
static Pref<bool> s_AutoUnwrapLightmapUV = new Pref<bool>("lightmapping.autoUnwrapLightmapUV", true);

[UserSetting("General", "Show Missing Lightmap UVs Warning", "Enable or disable a warning log if lightmaps are baked while ProBuilder shapes are missing a valid UV2 channel.")]
static Pref<bool> s_ShowMissingLightmapUVWarning = new Pref<bool>("lightmapping.showMissingLightmapWarning", true, SettingsScopes.User);
static Pref<bool> s_ShowMissingLightmapUVWarning = new Pref<bool>("lightmapping.showMissingLightmapWarning", true, SettingsScope.User);

[UserSetting]
internal static Pref<UnwrapParameters> s_UnwrapParameters = new Pref<UnwrapParameters>("lightmapping.defaultLightmapUnwrapParameters", new UnwrapParameters());

static Pref<UL.GIWorkflowMode> s_GiWorkflowMode = new Pref<UL.GIWorkflowMode>("lightmapping.giWorkflowMode", UL.GIWorkflowMode.Iterative, SettingsScopes.User);
static Pref<UL.GIWorkflowMode> s_GiWorkflowMode = new Pref<UL.GIWorkflowMode>("lightmapping.giWorkflowMode", UL.GIWorkflowMode.Iterative, SettingsScope.User);

static class Styles
{
Expand Down
4 changes: 2 additions & 2 deletions com.unity.probuilder/Editor/EditorCore/Pref.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ namespace UnityEditor.ProBuilder
{
public class Pref<T> : UserSetting<T>
{
public Pref(string key, T value, SettingsScopes scope = SettingsScopes.Project)
public Pref(string key, T value, SettingsScope scope = SettingsScope.Project)
: base(ProBuilderSettings.instance, key, value, scope)
{}

public Pref(Settings settings, string key, T value, SettingsScopes scope = SettingsScopes.Project)
public Pref(Settings settings, string key, T value, SettingsScope scope = SettingsScope.Project)
: base(settings, key, value, scope) { }
}
}
Loading