-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add preference to hide waveforms on timeline to resolve performance i…
…ssues.
- Loading branch information
Showing
3 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using UnityEditor; | ||
|
||
namespace uLipSync | ||
{ | ||
|
||
internal class EditorPrefsStr | ||
{ | ||
public const string DisplayWaveformOnTimeline = "uLipSync-Timeline-DisplayWaveform"; | ||
} | ||
|
||
public static class Preference | ||
{ | ||
public static bool displayWaveformOnTimeline | ||
{ | ||
get => EditorPrefs.GetBool(EditorPrefsStr.DisplayWaveformOnTimeline, true); | ||
set => EditorPrefs.SetBool(EditorPrefsStr.DisplayWaveformOnTimeline, value); | ||
} | ||
} | ||
|
||
public class PreferenceProvider : SettingsProvider | ||
{ | ||
const string PreferencePath = "Preferences/uLipSync"; | ||
const int LabelWidth = 200; | ||
|
||
PreferenceProvider(string path, SettingsScope scopes) : base(path, scopes) | ||
{ | ||
} | ||
|
||
public override void OnGUI(string searchContext) | ||
{ | ||
EditorGUILayout.Separator(); | ||
|
||
var defaultLabelWidth = EditorGUIUtility.labelWidth; | ||
EditorGUIUtility.labelWidth = LabelWidth; | ||
|
||
++EditorGUI.indentLevel; | ||
|
||
{ | ||
bool current = Preference.displayWaveformOnTimeline; | ||
bool result = EditorGUILayout.Toggle("Display Waveform On Timeline", current); | ||
if (current != result) | ||
{ | ||
Preference.displayWaveformOnTimeline = result; | ||
} | ||
} | ||
|
||
--EditorGUI.indentLevel; | ||
|
||
EditorGUIUtility.labelWidth = defaultLabelWidth; | ||
} | ||
|
||
[SettingsProvider] | ||
public static SettingsProvider CreateSettingProvider() | ||
{ | ||
return new PreferenceProvider(PreferencePath, SettingsScope.User); | ||
} | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters