Updated version number
added unused gif quality setting (does not affect file size as expected)
This commit is contained in:
@@ -39,11 +39,11 @@ public class Screenshot : MonoBehaviour
|
||||
recording = true;
|
||||
UmaViewerUI.Instance.GifButton.interactable = false;
|
||||
UmaViewerUI.Instance.GifSlider.value = 0;
|
||||
StartCoroutine(RecordGif(int.Parse(UmaViewerUI.Instance.GifWidth.text), int.Parse(UmaViewerUI.Instance.GifHeight.text), UmaViewerUI.Instance.GifTransparent.isOn));
|
||||
StartCoroutine(RecordGif(int.Parse(UmaViewerUI.Instance.GifWidth.text), int.Parse(UmaViewerUI.Instance.GifHeight.text), UmaViewerUI.Instance.GifTransparent.isOn, (int)UmaViewerUI.Instance.GifQuality.value));
|
||||
}
|
||||
|
||||
|
||||
private IEnumerator RecordGif(int width, int height, bool transparent)
|
||||
private IEnumerator RecordGif(int width, int height, bool transparent, int quality)
|
||||
{
|
||||
var ppLayer = Camera.main.GetComponent<PostProcessLayer>();
|
||||
bool oldPpState = ppLayer.enabled;
|
||||
@@ -56,7 +56,7 @@ public class Screenshot : MonoBehaviour
|
||||
int frame = 0;
|
||||
var animeClip = uma.OverrideController["clip_2"];
|
||||
var clipFrameCount = Mathf.RoundToInt(animeClip.length * animeClip.frameRate);
|
||||
StartCoroutine(CaptureToGIFCustom.Instance.Encode(animeClip.frameRate));
|
||||
StartCoroutine(CaptureToGIFCustom.Instance.Encode(animeClip.frameRate, quality));
|
||||
|
||||
animator.speed = 0;
|
||||
animator.Play(0, -1, 0);
|
||||
|
||||
@@ -58,6 +58,8 @@ public class UmaViewerUI : MonoBehaviour
|
||||
public TMP_InputField GifWidth;
|
||||
public TMP_InputField GifHeight;
|
||||
public Toggle GifTransparent;
|
||||
public Slider GifQuality;
|
||||
public TextMeshProUGUI GifQualityLabel;
|
||||
|
||||
public Slider GifSlider;
|
||||
public Button GifButton;
|
||||
@@ -328,6 +330,11 @@ public class UmaViewerUI : MonoBehaviour
|
||||
isHeadFix = value;
|
||||
}
|
||||
|
||||
public void UpdateGifQualityLabel(float value)
|
||||
{
|
||||
GifQualityLabel.text = $"Quality: {(int)value} (default: 10)";
|
||||
}
|
||||
|
||||
void ListLiveSounds(int songid)
|
||||
{
|
||||
for (int i = LiveCharaSoundList.content.childCount - 1; i >= 0; i--)
|
||||
|
||||
@@ -23,13 +23,13 @@ namespace uGIF
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public IEnumerator Encode (float fps)
|
||||
public IEnumerator Encode (float fps, int quality)
|
||||
{
|
||||
bytes = null;
|
||||
stop = false;
|
||||
UmaViewerUI.Instance.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Recording...";
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
yield return _Encode(fps);
|
||||
yield return _Encode(fps, quality);
|
||||
UmaViewerUI.Instance.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Saving gif...";
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
yield return WaitForBytes();
|
||||
@@ -47,12 +47,13 @@ namespace uGIF
|
||||
UmaViewerUI.Instance.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Record GIF";
|
||||
}
|
||||
|
||||
public IEnumerator _Encode (float fps)
|
||||
public IEnumerator _Encode (float fps, int quality)
|
||||
{
|
||||
var ge = new GIFEncoder ();
|
||||
ge.useGlobalColorTable = true;
|
||||
ge.repeat = 0;
|
||||
ge.FPS = fps;
|
||||
ge.quality = quality;
|
||||
ge.transparent = new Color32 (0, 0, 0, 0);
|
||||
ge.dispose = 2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user