示例#1
0
        public override bool OnCanvasGUI(ImageSequencerCanvas canvas)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return(false);
            }

            Vector2 topRight;
            Vector2 bottomLeft;

            topRight   = canvas.CanvasToScreen(new Vector2(-canvas.currentFrame.texture.width / 2, canvas.currentFrame.texture.height / 2));
            bottomLeft = canvas.CanvasToScreen(new Vector2(canvas.currentFrame.texture.width / 2, -canvas.currentFrame.texture.height / 2));

            // Texts
            GUI.color = canvas.styles.green;
            for (int i = 0; i < FlipbookNumU; i++)
            {
                float cw = (topRight.x - bottomLeft.x) / FlipbookNumU;
                GUI.Label(new Rect(bottomLeft.x + i * cw, topRight.y - 16, cw, 16), (i + 1).ToString(), canvas.styles.miniLabelCenter);
            }

            for (int i = 0; i < FlipbookNumV; i++)
            {
                float ch = (bottomLeft.y - topRight.y) / FlipbookNumV;
                VFXToolboxGUIUtility.GUIRotatedLabel(new Rect(bottomLeft.x - 8, topRight.y + i * ch, 16, ch), (i + 1).ToString(), -90.0f, canvas.styles.miniLabelCenter);
            }

            GUI.color = Color.white;
            return(false);
        }
示例#2
0
        public override bool OnCanvasGUI(ImageSequencerCanvas canvas)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return(false);
            }

            Vector2 center = canvas.CanvasToScreen(Vector2.zero);

            Vector2 topRight;
            Vector2 bottomLeft;

            topRight   = canvas.CanvasToScreen(new Vector2(-canvas.currentFrame.texture.width / 2, canvas.currentFrame.texture.height / 2));
            bottomLeft = canvas.CanvasToScreen(new Vector2(canvas.currentFrame.texture.width / 2, -canvas.currentFrame.texture.height / 2));

            // Arrows
            Handles.color = canvas.styles.green;
            Handles.DrawLine(new Vector3(topRight.x, topRight.y - 16), new Vector3(bottomLeft.x, topRight.y - 16));
            Handles.DrawLine(new Vector3(bottomLeft.x - 16, topRight.y), new Vector3(bottomLeft.x - 16, bottomLeft.y));
            Handles.color = Color.white;

            // Texts
            GUI.color = Color.green;
            GUI.Label(new Rect(center.x - 32, topRight.y - 32, 64, 16), Width.ToString(), canvas.styles.miniLabelCenter);
            VFXToolboxGUIUtility.GUIRotatedLabel(new Rect(bottomLeft.x - 48, center.y - 8, 64, 16), Height.ToString(), -90.0f, canvas.styles.miniLabelCenter);
            GUI.color = Color.white;
            return(false);
        }
示例#3
0
        public override bool OnCanvasGUI(ImageSequencerCanvas canvas)
        {
            Vector2 pos = canvas.CanvasToScreen(Vector2.zero + (new Vector2(canvas.currentFrame.texture.width, canvas.currentFrame.texture.height) / 2));
            Rect    r   = new Rect(pos.x, pos.y - 16, 150, 16);

            GUI.Label(r, VFXToolboxGUIUtility.Get($"Rotation : {ObjectNames.NicifyVariableName(FrameRotateMode.ToString())}"));
            return(false);
        }
示例#4
0
        public override bool OnCanvasGUI(ImageSequencerCanvas canvas)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return(false);
            }

            Vector2 center = canvas.CanvasToScreen(Vector2.zero);

            int width  = canvas.currentFrame.texture.width;
            int height = canvas.currentFrame.texture.height;

            // (left, right, top, bottom)
            float left   = FixFactors.x * width;
            float right  = FixFactors.y * width;
            float top    = FixFactors.z * height;
            float bottom = FixFactors.w * height;

            Vector2 topRight       = canvas.CanvasToScreen(new Vector2(-width / 2, height / 2));
            Vector2 bottomLeft     = canvas.CanvasToScreen(new Vector2(width / 2, -height / 2));
            Vector2 topRightCrop   = canvas.CanvasToScreen(new Vector2(-width / 2 + right, height / 2 - top));
            Vector2 bottomLeftCrop = canvas.CanvasToScreen(new Vector2(width / 2 - left, -height / 2 + bottom));

            // Arrows
            Handles.color = canvas.styles.green;
            Handles.DrawLine(new Vector3(center.x, topRight.y), new Vector3(center.x, topRightCrop.y));
            Handles.DrawLine(new Vector3(center.x, bottomLeft.y), new Vector3(center.x, bottomLeftCrop.y));
            Handles.DrawLine(new Vector3(topRight.x, center.y), new Vector3(topRightCrop.x, center.y));
            Handles.DrawLine(new Vector3(bottomLeft.x, center.y), new Vector3(bottomLeftCrop.x, center.y));

            // Limits
            Handles.color = canvas.styles.fadewhite;
            Handles.DrawLine(new Vector3(topRight.x, topRightCrop.y), new Vector3(bottomLeft.x, topRightCrop.y));
            Handles.DrawLine(new Vector3(topRight.x, bottomLeftCrop.y), new Vector3(bottomLeft.x, bottomLeftCrop.y));
            Handles.DrawLine(new Vector3(topRightCrop.x, topRight.y), new Vector3(topRightCrop.x, bottomLeft.y));
            Handles.DrawLine(new Vector3(bottomLeftCrop.x, topRight.y), new Vector3(bottomLeftCrop.x, bottomLeft.y));

            // Texts
            int labelwidth = 36;

            GUI.color = canvas.styles.green;
            GUI.Label(new Rect(center.x - labelwidth / 2, topRight.y - 20, labelwidth, 16), FixFactors.z.ToString(), canvas.styles.miniLabel);
            GUI.Label(new Rect(center.x - labelwidth / 2, bottomLeft.y + 4, labelwidth, 16), FixFactors.w.ToString(), canvas.styles.miniLabel);
            GUI.Label(new Rect(topRight.x + 4, center.y - 8, labelwidth, 16), FixFactors.y.ToString(), canvas.styles.miniLabel);
            GUI.Label(new Rect(bottomLeft.x - labelwidth - 4, center.y - 8, labelwidth, 16), FixFactors.x.ToString(), canvas.styles.miniLabelRight);

            Handles.color = Color.white;
            GUI.color     = Color.white;

            return(false);
        }
        public void InitializeGUI()
        {
            if(m_Splitter == null)
            {
                m_Splitter = new Splitter(360, DrawEditPanelGUI, DrawCanvasGUI, Splitter.SplitLockMode.LeftMinMax, new Vector2(320.0f, 480.0f));
            }

            if(m_PreviewCanvas == null)
            {
                m_PreviewCanvas = new ImageSequencerCanvas(new Rect(0, Styles.ToolbarHeight, position.width - m_Splitter.value, position.height - Styles.ToolbarHeight),this);
            }

            CheckGraphicsSettings();
        }
        public override bool OnCanvasGUI(ImageSequencerCanvas canvas)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return(false);
            }

            Vector2 center = canvas.CanvasToScreen(Vector2.zero);

            Vector2 topRight;
            Vector2 bottomLeft;

            topRight   = canvas.CanvasToScreen(new Vector2(-canvas.currentFrame.texture.width / 2 - Crop_Right, canvas.currentFrame.texture.height / 2 + Crop_Top));
            bottomLeft = canvas.CanvasToScreen(new Vector2(canvas.currentFrame.texture.width / 2 + Crop_Left, -canvas.currentFrame.texture.height / 2 - Crop_Bottom));

            Handles.DrawSolidRectangleWithOutline(new Rect(topRight, bottomLeft - topRight), Color.clear, canvas.styles.green);

            Vector2 topRightCrop;
            Vector2 bottomLeftCrop;

            topRightCrop   = canvas.CanvasToScreen(new Vector2(-canvas.currentFrame.texture.width / 2, canvas.currentFrame.texture.height / 2));
            bottomLeftCrop = canvas.CanvasToScreen(new Vector2(canvas.currentFrame.texture.width / 2, -canvas.currentFrame.texture.height / 2));

            Handles.DrawSolidRectangleWithOutline(new Rect(topRightCrop, bottomLeftCrop - topRightCrop), Color.clear, canvas.styles.red);

            // Arrows
            Handles.color = canvas.styles.white;
            Handles.DrawLine(new Vector3(center.x, topRight.y), new Vector3(center.x, topRightCrop.y));
            Handles.DrawLine(new Vector3(center.x, bottomLeft.y), new Vector3(center.x, bottomLeftCrop.y));
            Handles.DrawLine(new Vector3(topRight.x, center.y), new Vector3(topRightCrop.x, center.y));
            Handles.DrawLine(new Vector3(bottomLeft.x, center.y), new Vector3(bottomLeftCrop.x, center.y));
            Handles.color = Color.white;

            // Texts
            GUI.Label(new Rect(center.x, topRightCrop.y - 16, 64, 16), Crop_Top.ToString(), canvas.styles.miniLabel);
            GUI.Label(new Rect(center.x, bottomLeftCrop.y, 64, 16), Crop_Bottom.ToString(), canvas.styles.miniLabel);
            GUI.Label(new Rect(topRightCrop.x, center.y, 64, 16), Crop_Right.ToString(), canvas.styles.miniLabel);
            GUI.Label(new Rect(bottomLeftCrop.x - 64, center.y, 64, 16), Crop_Left.ToString(), canvas.styles.miniLabelRight);

            return(false);
        }
示例#7
0
            public Styles(ImageSequencerCanvas canvas)
            {
                m_Canvas = canvas;

                Color lightGray = new Color(0.8f, 0.8f, 0.8f, 1.0f);
                Color darkGray  = new Color(0.2f, 0.2f, 0.2f, 1.0f);

                m_ViewportMiniLabel = new GUIStyle(EditorStyles.miniLabel);
                m_ViewportMiniLabel.normal.textColor = lightGray;
                m_ViewportMiniLabelDark = new GUIStyle(EditorStyles.miniLabel);
                m_ViewportMiniLabelDark.normal.textColor = darkGray;

                m_ViewportMiniLabelRight               = new GUIStyle(m_ViewportMiniLabel);
                m_ViewportMiniLabelRight.alignment     = TextAnchor.MiddleRight;
                m_ViewportMiniLabelRightDark           = new GUIStyle(m_ViewportMiniLabelDark);
                m_ViewportMiniLabelRightDark.alignment = TextAnchor.MiddleRight;

                m_ViewportMiniLabelCenter               = new GUIStyle(m_ViewportMiniLabel);
                m_ViewportMiniLabelCenter.alignment     = TextAnchor.MiddleCenter;
                m_ViewportMiniLabelCenterDark           = new GUIStyle(m_ViewportMiniLabelDark);
                m_ViewportMiniLabelCenterDark.alignment = TextAnchor.MiddleCenter;

                m_ViewportLabel = new GUIStyle(EditorStyles.largeLabel);
                m_ViewportLabel.normal.textColor = lightGray;

                m_ViewportLabelDark = new GUIStyle(EditorStyles.largeLabel);
                m_ViewportLabelDark.normal.textColor = darkGray;

                m_ViewportLargeLabel                  = new GUIStyle(EditorStyles.largeLabel);
                m_ViewportLargeLabel.fontSize         = 24;
                m_ViewportLargeLabel.normal.textColor = lightGray;

                m_ViewportLargeLabelDark                  = new GUIStyle(EditorStyles.largeLabel);
                m_ViewportLargeLabelDark.fontSize         = 24;
                m_ViewportLargeLabelDark.normal.textColor = darkGray;

                m_BackgroundPanelColor     = new Color(0.02f, 0.02f, 0.02f, 0.85f);
                m_BackgroundPanelColorDark = new Color(0.5f, 0.5f, 0.5f, 0.5f);
            }
 public bool OnCanvasGUI(ImageSequencerCanvas canvas)
 {
     return(m_Processor.OnCanvasGUI(canvas));
 }
 /// <summary>
 /// Displays the Processor's Canvas Helpers as overlay.
 /// </summary>
 /// <param name="canvas">The Image Sequencer Canvas currently drawn</param>
 /// <returns>whether the canvas needs to redraw</returns>
 public virtual bool OnCanvasGUI(ImageSequencerCanvas canvas)
 {
     return(false);
 }
示例#10
0
        public override bool OnCanvasGUI(ImageSequencerCanvas canvas)
        {
            int inLength  = inputSequenceLength;
            int outLength = sequenceLength;
            int syncFrame = this.syncFrame;

            int   outCurIDX = canvas.currentFrameIndex;
            float outCurT   = (float)outCurIDX / outLength;
            int   inSeqAIDX = (syncFrame - outLength) + outCurIDX;
            int   inSeqBIDX = syncFrame + outCurIDX;

            AnimationCurve mixCurve = curve;
            float          mix      = mixCurve.Evaluate(outCurT);

            Color topTrackColor    = canvas.styles.yellow;
            Color bottomTrackColor = canvas.styles.cyan;

            Vector2 top = canvas.CanvasToScreen(new Vector2(-canvas.currentFrame.texture.width, canvas.currentFrame.texture.height) / 2);

            Rect rect = new Rect((int)top.x + 24, (int)top.y + 8, 260, 280);

            EditorGUI.DrawRect(new RectOffset(8, 8, 8, 8).Add(rect), canvas.styles.backgroundPanelColor);
            GUILayout.BeginArea(rect);
            GUI.color = topTrackColor;
            GUILayout.Label("Mix Chunk A (Input Range : " + (syncFrame - outLength + 1).ToString() + "-" + syncFrame.ToString() + ")", canvas.styles.label);
            using (new GUILayout.HorizontalScope())
            {
                Rect imgARect = GUILayoutUtility.GetRect(100, 100);
                imgARect.width  = 100;
                imgARect.height = 100;

                GUI.color = Color.white;
#if !UNITY_2018_2_OR_NEWER
                GL.sRGBWrite = (QualitySettings.activeColorSpace == ColorSpace.Linear);
#endif
                GUI.DrawTexture(imgARect, RequestInputTexture(inSeqAIDX));
#if !UNITY_2018_2_OR_NEWER
                GL.sRGBWrite = false;
#endif
                GUI.color = canvas.styles.white;
                Handles.DrawSolidRectangleWithOutline(imgARect, Color.clear, topTrackColor);


                using (new GUILayout.VerticalScope())
                {
                    GUI.color = topTrackColor;
                    GUILayout.Label("Frame #" + (inSeqAIDX + 1).ToString(), canvas.styles.miniLabel);
                    GUILayout.Label("Mixed at : " + (int)(mix * 100) + "%", canvas.styles.miniLabel);
                }
            }

            GUILayout.Space(16);
            GUI.color = bottomTrackColor;
            GUILayout.Label("Mix Chunk B (Input Range : " + (syncFrame + 1).ToString() + "-" + (syncFrame + outLength).ToString() + ")", canvas.styles.label);
            using (new GUILayout.HorizontalScope())
            {
                Rect imgBRect = GUILayoutUtility.GetRect(100, 100);
                imgBRect.width  = 100;
                imgBRect.height = 100;

                GUI.color = Color.white;
#if !UNITY_2018_2_OR_NEWER
                GL.sRGBWrite = (QualitySettings.activeColorSpace == ColorSpace.Linear);
#endif
                GUI.DrawTexture(imgBRect, RequestInputTexture(inSeqBIDX));
#if !UNITY_2018_2_OR_NEWER
                GL.sRGBWrite = false;
#endif

                GUI.color = canvas.styles.white;
                Handles.DrawSolidRectangleWithOutline(imgBRect, Color.clear, bottomTrackColor);

                using (new GUILayout.VerticalScope())
                {
                    GUI.color = bottomTrackColor;
                    GUILayout.Label("Frame #" + (inSeqBIDX + 1).ToString(), canvas.styles.miniLabel);
                    GUILayout.Label("Mixed at : " + (int)((1.0f - mix) * 100) + "%", canvas.styles.miniLabel);
                }
            }
            GUI.color = Color.white;
            GUILayout.EndArea();

            return(false);
        }