Example #1
0
    /// <summary>
    /// Draw the Image preview.
    /// </summary>

    public override void OnPreviewGUI(Rect drawArea, GUIStyle background)
    {
        AVProWindowsMediaUGUIComponent rawImage = target as AVProWindowsMediaUGUIComponent;
        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;
    }
Example #2
0
    /// <summary>
    /// Info String drawn at the bottom of the Preview
    /// </summary>

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

        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);
    }
Example #3
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(m_Movie);
        EditorGUILayout.PropertyField(m_DefaultTexture);
        EditorGUILayout.PropertyField(m_NoDefaultDisplay);
        AppearanceControlsGUI();
        EditorGUILayout.PropertyField(m_UVRect, m_UVRectContent);

        EditorGUILayout.PropertyField(m_SetNativeSize);
        EditorGUILayout.PropertyField(m_KeepAspectRatio);

        SetShowNativeSize(false);
        NativeSizeButtonGUI();

        serializedObject.ApplyModifiedProperties();

        AVProWindowsMediaUGUIComponent component = target as AVProWindowsMediaUGUIComponent;

        if (component.m_movie != null)
        {
            if (component.m_movie.MovieInstance == null)
            {
                if (GUILayout.Button("Load"))
                {
                    component.m_movie.LoadMovie(true);
                }
            }
            else
            {
                EditorUtility.SetDirty(component.m_movie);
                if (GUILayout.Button("Unload"))
                {
                    component.m_movie.UnloadMovie();
                }
            }
        }
    }
Example #4
0
    public override bool RequiresConstantRepaint()
    {
        AVProWindowsMediaUGUIComponent rawImage = target as AVProWindowsMediaUGUIComponent;

        return(rawImage != null && rawImage.HasValidTexture());
    }
Example #5
0
    /// <summary>
    /// Allow the texture to be previewed.
    /// </summary>

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

        return(rawImage != null);
    }