Beispiel #1
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);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
        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);
        }
Beispiel #6
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);
        }