コード例 #1
0
    /// <summary>
    /// Draw the Image preview.
    /// </summary>

    public override void OnPreviewGUI(Rect drawArea, GUIStyle background)
    {
        AVProQuickTimeUGUIComponent rawImage = target as AVProQuickTimeUGUIComponent;
        Texture tex = rawImage.mainTexture;

        if (tex == null)
        {
            return;
        }

        // Create the texture rectangle that is centered inside rect.
        Rect outerRect = drawArea;

        Matrix4x4 m = GUI.matrix;

        // Flip the image vertically
        if (rawImage.HasValidTexture())
        {
            if (rawImage.m_movie.MovieInstance.RequiresFlipY)
            {
                GUIUtility.ScaleAroundPivot(new Vector2(1f, -1f), new Vector2(0, outerRect.y + (outerRect.height / 2)));
            }
        }

        EditorGUI.DrawTextureTransparent(outerRect, tex, ScaleMode.ScaleToFit);        //, outer.width / outer.height);
        //SpriteDrawUtility.DrawSprite(tex, rect, outer, rawImage.uvRect, rawImage.canvasRenderer.GetColor());

        GUI.matrix = m;
    }
コード例 #2
0
    /// <summary>
    /// Info String drawn at the bottom of the Preview
    /// </summary>

    public override string GetInfoString()
    {
        AVProQuickTimeUGUIComponent rawImage = target as AVProQuickTimeUGUIComponent;

        string text = string.Empty;

        if (rawImage.HasValidTexture())
        {
            text += string.Format("Video Size: {0}x{1}\n",
                                  Mathf.RoundToInt(Mathf.Abs(rawImage.mainTexture.width)),
                                  Mathf.RoundToInt(Mathf.Abs(rawImage.mainTexture.height)));
        }

        // Image size Text
        text += string.Format("Display Size: {0}x{1}",
                              Mathf.RoundToInt(Mathf.Abs(rawImage.rectTransform.rect.width)),
                              Mathf.RoundToInt(Mathf.Abs(rawImage.rectTransform.rect.height)));

        return(text);
    }
コード例 #3
0
    public override bool RequiresConstantRepaint()
    {
        AVProQuickTimeUGUIComponent rawImage = target as AVProQuickTimeUGUIComponent;

        return(rawImage != null && rawImage.HasValidTexture());
    }
コード例 #4
0
    /// <summary>
    /// Allow the texture to be previewed.
    /// </summary>

    public override bool HasPreviewGUI()
    {
        AVProQuickTimeUGUIComponent rawImage = target as AVProQuickTimeUGUIComponent;

        return(rawImage != null);
    }