Skip to content

Commit ddac4c2

Browse files
committed
fixed always transparent background bug
1 parent 353185f commit ddac4c2

File tree

5 files changed

+81
-39
lines changed

5 files changed

+81
-39
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
</p>
4949

5050
<h2>Updates</h2>
51+
<b>2024-11-30: v1.4.0</b>
52+
<p>
53+
<ul>
54+
<li>Fixed background being transparent when the "Hide Skybox" toggle is unchecked</li>
55+
</ul>
56+
</p>
5157
<b>2024-09-24: v1.3.0</b>
5258
<p>
5359
<ul>
@@ -134,7 +140,6 @@
134140
<li>Fixed Version Check URL being incorrect</li>
135141
</ul>
136142
</p>
137-
138143
<b>2024-09-29: v1.0.0</b>
139144
<p>
140145
<ul>
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h1>Animation Toggle Generator</h1>
2+
<p>Create simple object toggles on your VRChat avatar with ease.
3+
<br><br>
4+
<i>Inspired by ArhianaDev</i>
5+
</p>
6+
7+
<h2>Download</h2>
8+
<p>Head to <a href="https://mintylabs.booth.pm/items/6130982">Booth</a> or <a href="https://github.com/Minty-Labs/Unity-Tools/releases">Releases</a> or <a href="https://jinxxy.com/MintLily/AnimationToggleGenerator">Jinxxy</a> to download.</p>
9+
10+
<h2>Features</h2>
11+
<ul>
12+
<li>Manually set menu toggle name, separate FXLayer, ExpressionsMenu, and ExpressionParameter files.</li>
13+
<li>Auto detection of Write Defaults</li>
14+
</ul>
15+
16+
<h2>Updates</h2>
17+
<b>2024-10-13: v1.0.1</b>
18+
<p>
19+
<ul>
20+
<li>Fixed Version Check URL being incorrect</li>
21+
</ul>
22+
</p>
23+
<b>2024-09-29: v1.0.0</b>
24+
<p>
25+
<ul>
26+
<li>Initial Release</li>
27+
</ul>
28+
</p>

Unity-Snapshot-Utility/Assets/Minty Labs/Snapshot Utility/Editor/SnapshotUtility.cs

+31-37
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using Debug = UnityEngine.Debug;
99

1010
public class SnapshotUtility : EditorWindow {
11-
private const string Version = "1.3.0";
11+
private const string Version = "1.4.0";
1212
private const string SaveFileVersion = "2";
1313
private const string LogPrefix = "[<color=#9fffe3>MintySnapshot Utility</color>] ";
1414
private static readonly string ProjectUserAgent = $"MintySnapshot Utility/{Version} Internal UnityWebRequest";
@@ -240,7 +240,7 @@ private void OnGUI() {
240240
_height = EditorGUILayout.IntField(LanguageModel.Height(_languageSelected), _height) * _resolutionMultiplier;
241241
}
242242

243-
if (_resolutionSelected is 2 or 3) {
243+
if (_resolutionSelected is 4 or 5) {
244244
EditorGUILayout.BeginHorizontal();
245245
_resolutionMultiplier = EditorGUILayout.IntSlider(label: LanguageModel.Multiplier(_languageSelected), _resolutionMultiplier, 1, 16);
246246
EditorGUILayout.EndHorizontal();
@@ -341,8 +341,8 @@ private void OnGUI() {
341341
EditorGUILayout.BeginHorizontal();
342342
if (GUILayout.Button(LanguageModel.OpenBoothPage(_languageSelected)))
343343
Application.OpenURL("https://mintylabs.booth.pm/items/4949097");
344-
if (GUILayout.Button(LanguageModel.OpenGumroadPage(_languageSelected)))
345-
Application.OpenURL("https://mintylabs.gumroad.com/l/ScreenshotUtility");
344+
// if (GUILayout.Button(LanguageModel.OpenGumroadPage(_languageSelected)))
345+
// Application.OpenURL("https://mintylabs.gumroad.com/l/ScreenshotUtility");
346346
if (GUILayout.Button(LanguageModel.OpenGitHubPage(_languageSelected)))
347347
Application.OpenURL("https://github.com/Minty-Labs/Unity-Tools/releases");
348348
}
@@ -368,6 +368,10 @@ private void OnGUI() {
368368
GUI.backgroundColor = new Color32(29, 155, 240, 255);
369369
if (GUILayout.Button("X (Twitter)"))
370370
Application.OpenURL("https://x.com/MintLiIy");
371+
372+
GUI.backgroundColor = new Color32(0, 133, 255, 255);
373+
if (GUILayout.Button("Bluesky"))
374+
Application.OpenURL("https://bsky.app/profile/lily.mintylabs.dev");
371375

372376
EditorGUILayout.EndHorizontal();
373377

@@ -376,11 +380,13 @@ private void OnGUI() {
376380
GUI.backgroundColor = new Color32(252, 77, 80, 255);
377381
if (GUILayout.Button("Booth"))
378382
Application.OpenURL("https://mintylabs.booth.pm/");
379-
383+
384+
GUI.enabled = false;
380385
GUI.backgroundColor = new Color32(255, 144, 232, 255);
381386
if (GUILayout.Button("Gumroad"))
382387
Application.OpenURL("https://mintylabs.gumroad.com/");
383388

389+
GUI.enabled = true;
384390
GUI.backgroundColor = new Color32(12, 14, 29, 255);
385391
if (GUILayout.Button("Jinxxy"))
386392
Application.OpenURL("https://jinxxy.com/MintLily");
@@ -430,44 +436,32 @@ private static byte[] CaptureSnapshot(bool isTransparent, int width, int height,
430436
EditorGUILayout.HelpBox(LanguageModel.NoCameraError(_languageSelected), MessageType.Error);
431437
return null;
432438
}
433-
434-
if (isTransparent) {
435-
var transRenderTex = new RenderTexture(width, height, (int)TextureFormat.ARGB32);
436-
var normalCamClearFlags = camera.clearFlags;
437-
var normalCamBgColor = camera.backgroundColor;
438-
camera.targetTexture = transRenderTex;
439-
camera.clearFlags = CameraClearFlags.Nothing;
440-
camera.backgroundColor = new Color(0, 0, 0, 0);
441-
camera.nearClipPlane = 0.01f;
442-
var transSnapshot = new Texture2D(width, height, TextureFormat.ARGB32, false);
443-
444-
camera.Render();
445-
RenderTexture.active = transRenderTex;
446-
transSnapshot.ReadPixels(new Rect(0, 0, width, height), 0, 0);
447-
448-
camera.backgroundColor = normalCamBgColor;
449-
camera.clearFlags = normalCamClearFlags;
450-
camera.targetTexture = null;
451-
RenderTexture.active = null;
452-
DestroyImmediate(transRenderTex);
453-
454-
return transSnapshot.EncodeToPNG();
455-
}
456-
457-
var normRenderTex = new RenderTexture(width, height, (int)TextureFormat.ARGB32);
458-
camera.targetTexture = normRenderTex;
439+
440+
var newRenderTex = new RenderTexture(width, height, (int)(isTransparent ? TextureFormat.ARGB32 : TextureFormat.RGB24));
441+
var currentHdrSetting = camera.allowHDR;
442+
var currentCamClearFlags = camera.clearFlags;
443+
var currentCamBgColor = camera.backgroundColor;
444+
445+
camera.targetTexture = newRenderTex;
446+
camera.backgroundColor = new Color(0, 0, 0, isTransparent ? 0 : 1);
459447
camera.nearClipPlane = 0.01f;
460-
var normSnapshot = new Texture2D(width, height, TextureFormat.ARGB32, false);
461-
448+
if (!currentHdrSetting)
449+
camera.allowHDR = true;
450+
451+
var snapshotTexture = new Texture2D(width, height, isTransparent ? TextureFormat.ARGB32 : TextureFormat.RGB24, false);
462452
camera.Render();
463-
RenderTexture.active = normRenderTex;
464-
normSnapshot.ReadPixels(new Rect(0, 0, width, height), 0, 0);
453+
RenderTexture.active = newRenderTex;
454+
snapshotTexture.ReadPixels(new Rect(0, 0, width, height), 0, 0);
465455

456+
// Reset camera settings
457+
camera.backgroundColor = currentCamBgColor;
458+
camera.clearFlags = currentCamClearFlags;
466459
camera.targetTexture = null;
467460
RenderTexture.active = null;
468-
DestroyImmediate(normRenderTex);
461+
camera.allowHDR = currentHdrSetting;
462+
DestroyImmediate(newRenderTex);
469463

470-
return normSnapshot.EncodeToPNG();
464+
return snapshotTexture.EncodeToPNG();
471465
}
472466

473467
private static string ScreenshotName(string width, string height) => $"{Application.productName}_snapshot_{width}x{height}_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.png";

Unity-Snapshot-Utility/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@
4848
</p>
4949

5050
<h1>Updates</h1>
51+
<b>2024-11-30: v1.4.0</b>
52+
<p>
53+
<ul>
54+
<li>Fixed background being transparent when the "Hide Skybox" toggle is unchecked</li>
55+
</ul>
56+
</p>
57+
<b>2024-09-24: v1.3.0</b>
58+
<p>
59+
<ul>
60+
<li>Added an option to use your Scene View as a camera</li>
61+
<li>Added resolution presets: 240p & 360p</li>
62+
<li>Small code/logic edits</li>
63+
<li>Updated About page layout & links</li>
64+
</ul>
65+
</p>
5166
<b>2024-03-02: v1.2.0</b>
5267
<p>
5368
<ul>
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.0
1+
1.4.0

0 commit comments

Comments
 (0)