private void OnEnable() { EditorApplication.playModeStateChanged += OnPlayModeChanged; SpriteAuditorUtility.SetMemoryDataDirty(); SpriteAuditorUtility.SetResultViewDirty(); SpriteAuditorUtility.SetSizeCheckThreshold(spriteUsageSizeThreshold); }
private void DrawSettings() { EditorGUI.BeginDisabledGroup(isRecording); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("Settings", EditorStyles.toolbarDropDown); EditorGUILayout.Space(); recordOnPlay = EditorGUILayout.Toggle("Record on play", recordOnPlay); EditorGUI.BeginChangeCheck(); spriteUsageSizeThreshold = EditorGUILayout.Slider("Allowed Size Variation", spriteUsageSizeThreshold, 0, 2); if (EditorGUI.EndChangeCheck()) { SpriteAuditorUtility.SetSizeCheckThreshold(spriteUsageSizeThreshold); SpriteDatabase.SizeCheckThresholdChanged(); //TODO //SpriteDatabase.SetAllowedSizeVariation(spriteUsageSizeThreshold); } EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(!EditorPrefs.HasKey(ATLAS_AUDITOR_STORAGE_KEY)); if (GUILayout.Button("Clear Cache", EditorStyles.toolbarButton)) { ClearCache(); } if (GUILayout.Button("Pack Atlases", EditorStyles.toolbarButton)) { SpriteAtlasUtility.PackAllAtlases(EditorUserBuildSettings.activeBuildTarget); } if (GUILayout.Button("Refresh Atlases", EditorStyles.toolbarButton)) { AtlasCacheUtility.CacheKnowAtlases(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUI.EndDisabledGroup(); }
private void DrawSettings() { EditorGUI.BeginDisabledGroup(isRecording); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("Settings", EditorStyles.toolbarDropDown); EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); recordOnUpdate = EditorGUILayout.Toggle("Record Automatically", recordOnUpdate); if (EditorGUI.EndChangeCheck()) { spriteFinder.SetCaptureOnUpdate(recordOnUpdate); } if (recordOnUpdate) { EditorGUI.BeginChangeCheck(); frameInterval = EditorGUILayout.IntField("Frame Interval", frameInterval); if (EditorGUI.EndChangeCheck()) { spriteFinder.SetFrameInterval(frameInterval); } } else { bool guiWasEnabled = GUI.enabled; GUI.enabled = true; if (GUILayout.Button("Capture Frame")) { spriteFinder.CaptureFrame(); } GUI.enabled = guiWasEnabled; } EditorGUI.BeginChangeCheck(); spriteUsageSizeThreshold = EditorGUILayout.Slider("Allowed Size Variation", spriteUsageSizeThreshold, 0, 2); if (EditorGUI.EndChangeCheck()) { SpriteAuditorUtility.SetSizeCheckThreshold(spriteUsageSizeThreshold); SpriteDatabase.SizeCheckThresholdChanged(); } EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(!EditorPrefs.HasKey(ATLAS_AUDITOR_STORAGE_KEY)); if (GUILayout.Button("Clear Cache", EditorStyles.toolbarButton)) { ClearCache(); } if (GUILayout.Button("Pack Atlases", EditorStyles.toolbarButton)) { SpriteAtlasUtility.PackAllAtlases(EditorUserBuildSettings.activeBuildTarget); } if (GUILayout.Button("Refresh Atlases", EditorStyles.toolbarButton)) { AtlasCacheUtility.CacheKnowAtlases(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUI.EndDisabledGroup(); }