Skip to content

Commit

Permalink
close #116; UIEffectCapturedImage: change parameter name `keepCanvasS…
Browse files Browse the repository at this point in the history
…ize` to `fitToScreen`
  • Loading branch information
mob-sakai committed Aug 14, 2018
1 parent 7fe79bb commit 362f881
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void OnEnable()
_spReductionRate = serializedObject.FindProperty("m_ReductionRate");
_spFilterMode = serializedObject.FindProperty("m_FilterMode");
_spIterations = serializedObject.FindProperty("m_BlurIterations");
_spKeepSizeToRootCanvas = serializedObject.FindProperty("m_KeepCanvasSize");
_spKeepSizeToRootCanvas = serializedObject.FindProperty("m_FitToScreen");
_spTargetTexture = serializedObject.FindProperty("m_TargetTexture");
_spBlurMode = serializedObject.FindProperty("m_BlurMode");
_spCaptureOnEnable = serializedObject.FindProperty("m_CaptureOnEnable");
Expand All @@ -55,6 +55,7 @@ protected override void OnEnable()
/// </summary>
public override void OnInspectorGUI()
{
var graphic = (target as UIEffectCapturedImage);
serializedObject.Update();

//================
Expand All @@ -78,6 +79,7 @@ public override void OnInspectorGUI()
EditorGUILayout.LabelField("Advanced Option", EditorStyles.boldLabel);

EditorGUILayout.PropertyField(_spCaptureOnEnable);// CaptureOnEnable.
EditorGUILayout.PropertyField(_spKeepSizeToRootCanvas);// Keep Graphic Size To RootCanvas.

EditorGUI.BeginChangeCheck();
QualityMode quality = qualityMode;
Expand All @@ -95,7 +97,6 @@ public override void OnInspectorGUI()
{
EditorGUILayout.PropertyField(_spIterations);// Iterations.
}
EditorGUILayout.PropertyField(_spKeepSizeToRootCanvas);// Keep Graphic Size To RootCanvas.
DrawDesamplingRate(_spReductionRate);// Reduction rate.

EditorGUILayout.Space();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public enum DesamplingRate
[SerializeField] Material m_EffectMaterial;
[FormerlySerializedAs("m_Iterations")]
[SerializeField][Range(1, 8)] int m_BlurIterations = 1;
[SerializeField] bool m_KeepCanvasSize = true;
[FormerlySerializedAs("m_KeepCanvasSize")]
[SerializeField] bool m_FitToScreen = true;
[SerializeField] RenderTexture m_TargetTexture;
[SerializeField] bool m_CaptureOnEnable = false;

Expand Down Expand Up @@ -124,9 +125,15 @@ public enum DesamplingRate
public int blurIterations { get { return m_BlurIterations; } set { m_BlurIterations = value; } }

/// <summary>
/// Fits graphic size to the root canvas.
/// Fits graphic size to screen.
/// </summary>
public bool keepCanvasSize { get { return m_KeepCanvasSize; } set { m_KeepCanvasSize = value; } }
[System.Obsolete("Use fitToScreen instead (UnityUpgradable) -> fitToScreen")]
public bool keepCanvasSize { get { return m_FitToScreen; } set { m_FitToScreen = value; } }

/// <summary>
/// Fits graphic size to screen.
/// </summary>
public bool fitToScreen { get { return m_FitToScreen; } set { m_FitToScreen = value; } }

/// <summary>
/// Target RenderTexture to capture.
Expand Down Expand Up @@ -187,7 +194,7 @@ public void GetDesamplingSize(DesamplingRate rate, out int w, out int h)
public void Capture()
{
var rootCanvas = canvas.rootCanvas;
if (m_KeepCanvasSize)
if (m_FitToScreen)
{
var rootTransform = rootCanvas.transform as RectTransform;
var size = rootTransform.rect.size;
Expand Down

0 comments on commit 362f881

Please sign in to comment.