protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var width  = m_SerializedObject.FindProperty("Width");
            var height = m_SerializedObject.FindProperty("Height");

            EditorGUI.BeginChangeCheck();

            using (new GUILayout.HorizontalScope())
            {
                int w = Mathf.Clamp(EditorGUILayout.IntField(VFXToolboxGUIUtility.Get("Width"), width.intValue), 1, 8192);

                if (GUILayout.Button("", EditorStyles.popup, GUILayout.Width(16)))
                {
                    GenericMenu menu = new GenericMenu();
                    for (int s = 8192; s >= 16; s /= 2)
                    {
                        menu.AddItem(VFXToolboxGUIUtility.Get(s.ToString()), false, MenuSetWidth, s);
                    }
                    menu.ShowAsContext();
                }

                if (w != width.intValue)
                {
                    width.intValue = w;
                }
            }

            using (new GUILayout.HorizontalScope())
            {
                int h = Mathf.Clamp(EditorGUILayout.IntField(VFXToolboxGUIUtility.Get("Height"), height.intValue), 1, 8192);

                if (GUILayout.Button("", EditorStyles.popup, GUILayout.Width(16)))
                {
                    GenericMenu menu = new GenericMenu();
                    for (int s = 8192; s >= 16; s /= 2)
                    {
                        menu.AddItem(VFXToolboxGUIUtility.Get(s.ToString()), false, MenuSetHeight, s);
                    }
                    menu.ShowAsContext();
                }
                if (h != height.intValue)
                {
                    height.intValue = h;
                }
            }

            if (Mathf.Log(height.intValue, 2) % 1.0f != 0 || Mathf.Log(width.intValue, 2) % 1.0f != 0)
            {
                EditorGUILayout.HelpBox("Warning: your resize resolution is not a power of two.", MessageType.Warning);
            }

            if (EditorGUI.EndChangeCheck())
            {
                UpdateOutputSize();
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
示例#2
0
        private void DrawInputFramesPanelContent()
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.Label(VFXToolboxGUIUtility.Get("Input Frames"), EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(VFXToolboxGUIUtility.Get("Clear"), GUILayout.Width(80)))
                {
                    Undo.RecordObject(m_CurrentAsset, "Clear All Input Frames");
                    // Remove frames and update hash
                    m_processorStack.RemoveAllInputFrames(m_CurrentAsset);
                    m_processorStack.SyncFramesToAsset(m_CurrentAsset);
                    m_InputFramesHashCode = GetInputTexturesHashCode();
                    // Update view
                    sidePanelViewMode        = SidePanelMode.InputFrames;
                    m_CurrentProcessor       = null;
                    m_LockedPreviewProcessor = null;
                    m_CurrentAsset.editSettings.lockedProcessor   = -1;
                    m_CurrentAsset.editSettings.selectedProcessor = -1;
                    m_PreviewCanvas.sequence = m_processorStack.inputSequence;
                    // Request an update
                    Invalidate();
                    RefreshCanvas();
                    return;
                }
            }

            m_InputFramesReorderableList.DoLayoutList();

            if (Event.current.type == EventType.keyDown && Event.current.keyCode == KeyCode.Delete && m_processorStack.inputSequence.length > 0)
            {
                RemoveInputFrame(m_InputFramesReorderableList);
                Event.current.Use();
            }
        }
示例#3
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var useCurve             = m_SerializedObject.FindProperty("useCurve");
            var outputSequenceLength = m_SerializedObject.FindProperty("outputSequenceLength");

            EditorGUI.BeginChangeCheck();

            int length    = outputSequenceLength.intValue;
            int newlength = EditorGUILayout.IntSlider(VFXToolboxGUIUtility.Get("Sequence Length"), length, 1, InputSequence.length);

            if (newlength != length)
            {
                outputSequenceLength.intValue = newlength;
            }

            EditorGUILayout.PropertyField(useCurve, VFXToolboxGUIUtility.Get("Use Retiming Curve"));

            if (settings.useCurve)
            {
                m_CurveDrawer.SetBounds(new Rect(0, 0, 1, InputSequence.length - 1));

                if (m_CurveDrawer.OnGUILayout())
                {
                    hasChanged = true;
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                hasChanged = true;
            }

            return(hasChanged);
        }
示例#4
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var fadeToColor = m_SerializedObject.FindProperty("FadeToColor");

            EditorGUI.BeginChangeCheck();

            Color c = EditorGUILayout.ColorField(VFXToolboxGUIUtility.Get("Fade To Color"), fadeToColor.colorValue);

            if (c != fadeToColor.colorValue)
            {
                fadeToColor.colorValue = c;
            }

            if (m_CurveDrawer.OnGUILayout())
            {
                hasChanged = true;
            }

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
示例#5
0
        private void DrawInputFramesPanelContent()
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.Label(VFXToolboxGUIUtility.Get("Input Frames"), EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();

                if (GUILayout.Button(VFXToolboxGUIUtility.Get("Actions"), EditorStyles.popup, GUILayout.Width(80), GUILayout.Height(20)))
                {
                    GenericMenu menu = new GenericMenu();
                    menu.AddItem(VFXToolboxGUIUtility.Get("Clear"), false, MenuClearInputFrames);
                    menu.AddItem(VFXToolboxGUIUtility.Get("Sort All"), false, MenuSortInputFrames);
                    menu.AddItem(VFXToolboxGUIUtility.Get("Reverse Oder"), false, MenuReverseInputFrames);
                    menu.ShowAsContext();
                }
            }
            GUILayout.Space(8);
            m_InputFramesReorderableList.DoLayoutList();

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Delete && m_processorStack.inputSequence.length > 0)
            {
                RemoveInputFrame(m_InputFramesReorderableList);
                Event.current.Use();
            }
        }
示例#6
0
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            if (m_CurveDrawer == null)
            {
                m_CurveDrawer = new CurveDrawer("Fade Curve", 0.0f, 1.0f, 0.0f, 1.0f, 140, false);
                m_CurveDrawer.AddCurve(serializedObject.FindProperty("FadeCurve"), new Color(0.75f, 0.5f, 1.0f), "Fade Curve");
                m_CurveDrawer.OnPostGUI = OnCurveFieldGUI;
            }
            var fadeToColor = serializedObject.FindProperty("FadeToColor");

            EditorGUI.BeginChangeCheck();

            Color c = EditorGUILayout.ColorField(VFXToolboxGUIUtility.Get("Fade To Color"), fadeToColor.colorValue);

            if (c != fadeToColor.colorValue)
            {
                fadeToColor.colorValue = c;
            }

            if (m_CurveDrawer.OnGUILayout())
            {
                changed = true;
            }

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                changed = true;
            }

            return(changed);
        }
示例#7
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            EditorGUI.BeginChangeCheck();
            Material mat = (Material)EditorGUILayout.ObjectField(VFXToolboxGUIUtility.Get("Material"), settings.material, typeof(Material), false);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(settings, "Custom Material Change");
                settings.material = mat;
                EditorUtility.SetDirty(settings);
                Invalidate();
                hasChanged = true;
            }

            if (settings.material != null)
            {
                Editor.CreateCachedEditor(settings.material, typeof(MaterialEditor), ref m_MaterialEditor);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.DrawHeader();
                EditorGUIUtility.labelWidth = 120;
                m_MaterialEditor.OnInspectorGUI();

                if (m_CachedShader != settings.material.shader)
                {
                    // Hack : we cache shader in order to track changes as DrawHeader does not consider shader change as a EditorGUI.changed
                    m_CachedShader = settings.material.shader;
                }
                if (EditorGUI.EndChangeCheck())
                {
                    Invalidate();
                    hasChanged = true;
                }
            }
            return(hasChanged);
        }
示例#8
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);
        }
示例#9
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("CropRotateProcesssor"));
            return(false);
        }
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            var bgColor = serializedObject.FindProperty("BackgroundColor");

            EditorGUI.BeginChangeCheck();

            using (new GUILayout.HorizontalScope())
            {
                EditorGUILayout.PropertyField(bgColor, VFXToolboxGUIUtility.Get("Background Color"));
                if (GUILayout.Button(VFXToolboxGUIUtility.Get("Grab"), GUILayout.Width(40)))
                {
                    if (inputSequenceLength > 0)
                    {
                        var texture = RequestInputTexture(0);

                        Color background;

                        if (texture is RenderTexture)
                        {
                            background = VFXToolboxUtility.ReadBack((RenderTexture)texture)[0];
                        }
                        else
                        {
                            Texture2D     inputFrame = (Texture2D)texture;
                            RenderTexture rt         = RenderTexture.GetTemporary(inputFrame.width, inputFrame.height, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
                            Graphics.Blit(inputFrame, rt);
                            background = VFXToolboxUtility.ReadBack(rt)[0];
                            RenderTexture.ReleaseTemporary(rt);
                        }

                        if (QualitySettings.activeColorSpace == ColorSpace.Linear)
                        {
                            background = background.gamma;
                        }

                        bgColor.colorValue = background;
                    }
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                UpdateOutputSize();
                Invalidate();
                changed = true;
            }
            GUILayout.Space(20);
            EditorGUILayout.HelpBox("Please select a color corresponding to the solid background of the flipbook to try to reconstruct the pixel's color. \n\nThis filter will only work if your flipbook was rendered on a solid color background. Try the Grab button to fetch the upper left pixel of the first frame, or use the color picker.", MessageType.Info);

            return(changed);
        }
示例#11
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var     fixFactors  = m_SerializedObject.FindProperty("FixFactors");
            var     fadeToColor = m_SerializedObject.FindProperty("FadeToColor");
            var     fadeToAlpha = m_SerializedObject.FindProperty("FadeToAlpha");
            var     exponent    = m_SerializedObject.FindProperty("Exponent");
            Vector4 value       = fixFactors.vector4Value;

            EditorGUI.BeginChangeCheck();

            float left   = EditorGUILayout.Slider(VFXToolboxGUIUtility.Get("Left"), value.x, 0.0f, 1.0f);
            float right  = EditorGUILayout.Slider(VFXToolboxGUIUtility.Get("Right"), value.y, 0.0f, 1.0f);
            float top    = EditorGUILayout.Slider(VFXToolboxGUIUtility.Get("Top"), value.z, 0.0f, 1.0f);
            float bottom = EditorGUILayout.Slider(VFXToolboxGUIUtility.Get("Bottom"), value.w, 0.0f, 1.0f);

            if (
                left != value.x ||
                right != value.y ||
                top != value.z ||
                bottom != value.w
                )
            {
                fixFactors.vector4Value = new Vector4(left, right, top, bottom);
            }


            Color c = EditorGUILayout.ColorField(new GUIContent("Fade to Color"), fadeToColor.colorValue, true, true, true, new ColorPickerHDRConfig(0.0f, 50.0f, 0.0f, 2.0f));

            if (c != fadeToColor.colorValue)
            {
                fadeToColor.colorValue = c;
            }

            float a = EditorGUILayout.Slider("Fade to Alpha", fadeToAlpha.floatValue, 0.0f, 1.0f);

            if (a != fadeToAlpha.floatValue)
            {
                fadeToAlpha.floatValue = a;
            }

            EditorGUILayout.PropertyField(exponent, VFXToolboxGUIUtility.Get("Exponent"));

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
示例#12
0
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            var     fixFactors  = serializedObject.FindProperty("FixFactors");
            var     fadeToColor = serializedObject.FindProperty("FadeToColor");
            var     fadeToAlpha = serializedObject.FindProperty("FadeToAlpha");
            var     exponent    = serializedObject.FindProperty("Exponent");
            Vector4 value       = fixFactors.vector4Value;

            EditorGUI.BeginChangeCheck();

            float left   = EditorGUILayout.Slider(VFXToolboxGUIUtility.Get("Left"), value.x, 0.0f, 1.0f);
            float right  = EditorGUILayout.Slider(VFXToolboxGUIUtility.Get("Right"), value.y, 0.0f, 1.0f);
            float top    = EditorGUILayout.Slider(VFXToolboxGUIUtility.Get("Top"), value.z, 0.0f, 1.0f);
            float bottom = EditorGUILayout.Slider(VFXToolboxGUIUtility.Get("Bottom"), value.w, 0.0f, 1.0f);

            if (
                left != value.x ||
                right != value.y ||
                top != value.z ||
                bottom != value.w
                )
            {
                fixFactors.vector4Value = new Vector4(left, right, top, bottom);
            }


            Color c = EditorGUILayout.ColorField(new GUIContent("Fade to Color"), fadeToColor.colorValue, true, true, true);

            if (c != fadeToColor.colorValue)
            {
                fadeToColor.colorValue = c;
            }

            float a = EditorGUILayout.Slider("Fade to Alpha", fadeToAlpha.floatValue, 0.0f, 1.0f);

            if (a != fadeToAlpha.floatValue)
            {
                fadeToAlpha.floatValue = a;
            }

            EditorGUILayout.PropertyField(exponent, VFXToolboxGUIUtility.Get("Exponent"));

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                changed = true;
            }

            return(changed);
        }
示例#13
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var flipbookNumU = m_SerializedObject.FindProperty("FlipbookNumU");
            var flipbookNumV = m_SerializedObject.FindProperty("FlipbookNumV");

            EditorGUI.BeginChangeCheck();

            int newU = Mathf.Clamp(EditorGUILayout.IntField(VFXToolboxGUIUtility.Get("Columns (U) : "), flipbookNumU.intValue), 1, InputSequence.width);
            int newV = Mathf.Clamp(EditorGUILayout.IntField(VFXToolboxGUIUtility.Get("Rows (V) : "), flipbookNumV.intValue), 1, InputSequence.height);

            if (newU != flipbookNumU.intValue || flipbookNumV.intValue != newV)
            {
                GUI.changed = true;
            }

            if (m_BypassSecurityCheck)
            {
                EditorGUILayout.HelpBox("Warning: you are currently bypassing frame count limits. Proceed with caution when entering values, as it can take a long time to process and stall your editor.", MessageType.Warning);
            }

            if (EditorGUI.EndChangeCheck())
            {
                Debug.Log("Updated");

                if (newU * newV <= 4096)
                {
                    flipbookNumU.intValue = newU;
                    flipbookNumV.intValue = newV;
                }
                else
                {
                    if (!m_BypassSecurityCheck && EditorUtility.DisplayDialog("VFX Toolbox", "CAUTION : You are going to generate a sequence of " + newU * newV + " frames. This could take a long time to process, stall your editor, and consume a large amount of memory. Are you SURE you want to Continue?", "I know what I am doing, proceed", "Cancel"))
                    {
                        m_BypassSecurityCheck = true;
                    }

                    if (m_BypassSecurityCheck)
                    {
                        flipbookNumU.intValue = newU;
                        flipbookNumV.intValue = newV;
                    }
                }

                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            if (m_CurveDrawer == null)
            {
                m_CurveDrawer = new CurveDrawer(null, 0.0f, 1.0f, 0.0f, 1.0f, 140, false);
                m_CurveDrawer.AddCurve(serializedObject.FindProperty("AlphaCurve"), new Color(1.0f, 0.55f, 0.1f), "Alpha Curve");
            }

            if (AlphaCurve == null)
            {
                DefaultCurve();
            }

            var brightness = serializedObject.FindProperty("Brightness");
            var contrast   = serializedObject.FindProperty("Contrast");
            var saturation = serializedObject.FindProperty("Saturation");
            var alphaCurve = serializedObject.FindProperty("AlphaCurve");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(brightness, VFXToolboxGUIUtility.Get("Brightness"));
            EditorGUILayout.PropertyField(contrast, VFXToolboxGUIUtility.Get("Contrast"));
            EditorGUILayout.PropertyField(saturation, VFXToolboxGUIUtility.Get("Saturation"));

            bool curveChanged = false;

            using (new GUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(VFXToolboxGUIUtility.Get("Alpha Curve"), GUILayout.Width(EditorGUIUtility.labelWidth));
                if (GUILayout.Button(VFXToolboxGUIUtility.Get("Reset")))
                {
                    alphaCurve.animationCurveValue = AnimationCurve.Linear(0, 0, 1, 1);
                    m_CurveDrawer.ClearSelection();
                    curveChanged = true;
                }
            }
            if (!curveChanged)
            {
                curveChanged = m_CurveDrawer.OnGUILayout();
            }

            if (EditorGUI.EndChangeCheck() || curveChanged)
            {
                Invalidate();
                changed = true;
            }

            return(changed);
        }
示例#15
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var tint = m_SerializedObject.FindProperty("BWFilterTint");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(tint, VFXToolboxGUIUtility.Get("Color Filter"));
            EditorGUILayout.HelpBox("Color Filter serves as a tint before applying the black and white desaturation, just like in black and white photography. This way you can filter color weighting.", MessageType.Info);

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            var colorSource = serializedObject.FindProperty("ColorSource");
            var gradient    = serializedObject.FindProperty("Gradient");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(colorSource, VFXToolboxGUIUtility.Get("Color Source"));
            EditorGUILayout.PropertyField(gradient, VFXToolboxGUIUtility.Get("Remap Gradient"));

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                changed = true;
            }

            return(changed);
        }
示例#17
0
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            var rotatemode = serializedObject.FindProperty("FrameRotateMode");

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.PropertyField(rotatemode, VFXToolboxGUIUtility.Get("Rotation Mode"));

            if (EditorGUI.EndChangeCheck())
            {
                UpdateOutputSize();
                Invalidate();
                changed = true;
            }

            return(changed);
        }
示例#18
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var rotatemode = m_SerializedObject.FindProperty("FrameRotateMode");

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.PropertyField(rotatemode, VFXToolboxGUIUtility.Get("Rotation Mode"));

            if (EditorGUI.EndChangeCheck())
            {
                UpdateOutputSize();
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
示例#19
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var colorSource = m_SerializedObject.FindProperty("ColorSource");
            var gradient    = m_SerializedObject.FindProperty("Gradient");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(colorSource, VFXToolboxGUIUtility.Get("Color Source"));
            EditorGUILayout.PropertyField(gradient, VFXToolboxGUIUtility.Get("Remap Gradient"));

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
示例#20
0
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            var removeAlpha = serializedObject.FindProperty("RemoveAlpha");
            var alphaValue  = serializedObject.FindProperty("AlphaValue");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(removeAlpha, VFXToolboxGUIUtility.Get("Remove Alpha"));
            EditorGUI.BeginDisabledGroup(!removeAlpha.boolValue);
            EditorGUILayout.PropertyField(alphaValue, VFXToolboxGUIUtility.Get("Alpha Value"));
            EditorGUI.EndDisabledGroup();

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                changed = true;
            }

            return(changed);
        }
示例#21
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var removeAlpha = m_SerializedObject.FindProperty("RemoveAlpha");
            var alphaValue  = m_SerializedObject.FindProperty("AlphaValue");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(removeAlpha, VFXToolboxGUIUtility.Get("Remove Alpha"));
            EditorGUI.BeginDisabledGroup(!removeAlpha.boolValue);
            EditorGUILayout.PropertyField(alphaValue, VFXToolboxGUIUtility.Get("Alpha Value"));
            EditorGUI.EndDisabledGroup();

            if (EditorGUI.EndChangeCheck())
            {
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            var decimateBy = serializedObject.FindProperty("DecimateBy");

            EditorGUI.BeginChangeCheck();

            int newDecimate = Mathf.Clamp(EditorGUILayout.IntField(VFXToolboxGUIUtility.Get("Decimate by"), (int)DecimateBy), 2, inputSequenceLength);

            if (newDecimate != decimateBy.intValue)
            {
                decimateBy.intValue = newDecimate;
            }

            if (EditorGUI.EndChangeCheck())
            {
                changed = true;
            }

            return(changed);
        }
示例#23
0
 private void ShowFrameratePopup()
 {
     if (GUILayout.Button(VFXToolboxGUIUtility.GetTextAndIcon("Speed", "SpeedScale"), EditorStyles.toolbarDropDown))
     {
         GenericMenu menu = new GenericMenu();
         menu.AddItem(VFXToolboxGUIUtility.Get("5 fps"), false, () => { m_PlayFramerate = 5; });
         menu.AddItem(VFXToolboxGUIUtility.Get("10 fps"), false, () => { m_PlayFramerate = 10; });
         menu.AddItem(VFXToolboxGUIUtility.Get("15 fps"), false, () => { m_PlayFramerate = 15; });
         menu.AddItem(VFXToolboxGUIUtility.Get("20 fps"), false, () => { m_PlayFramerate = 20; });
         menu.AddItem(VFXToolboxGUIUtility.Get("24 fps (Cine)"), false, () => { m_PlayFramerate = 24; });
         menu.AddItem(VFXToolboxGUIUtility.Get("25 fps (PAL)"), false, () => { m_PlayFramerate = 25; });
         menu.AddItem(VFXToolboxGUIUtility.Get("29.97 fps (NTSC)"), false, () => { m_PlayFramerate = 29.97f; });
         menu.AddItem(VFXToolboxGUIUtility.Get("30 fps"), false, () => { m_PlayFramerate = 30; });
         menu.AddItem(VFXToolboxGUIUtility.Get("50 fps"), false, () => { m_PlayFramerate = 50; });
         menu.AddItem(VFXToolboxGUIUtility.Get("60 fps"), false, () => { m_PlayFramerate = 60; });
         menu.ShowAsContext();
     }
     m_PlayFramerate = EditorGUILayout.FloatField(m_PlayFramerate, VFXToolboxStyles.toolbarTextField, GUILayout.Width(24));
     EditorGUILayout.LabelField(VFXToolboxGUIUtility.Get("fps"), GUILayout.Width(24));
 }
示例#24
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var decimateBy = m_SerializedObject.FindProperty("DecimateBy");

            EditorGUI.BeginChangeCheck();

            int newDecimate = Mathf.Clamp(EditorGUILayout.IntField(VFXToolboxGUIUtility.Get("Decimate by"), (int)settings.DecimateBy), 2, InputSequence.length);

            if (newDecimate != decimateBy.intValue)
            {
                decimateBy.intValue = newDecimate;
            }

            if (EditorGUI.EndChangeCheck())
            {
                hasChanged = true;
            }

            return(hasChanged);
        }
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            if (m_CurveDrawer == null)
            {
                m_CurveDrawer = new CurveDrawer("Retime Curve", 0.0f, 1.0f, 0.0f, inputSequenceLength, 140, false);
                m_CurveDrawer.AddCurve(serializedObject.FindProperty("curve"), new Color(0.5f, 0.75f, 1.0f), "Retime Curve");
                m_CurveDrawer.OnPostGUI = OnCurveFieldGUI;
            }

            var useCurve             = serializedObject.FindProperty("useCurve");
            var outputSequenceLength = serializedObject.FindProperty("outputSequenceLength");

            EditorGUI.BeginChangeCheck();

            int length    = outputSequenceLength.intValue;
            int newlength = EditorGUILayout.IntSlider(VFXToolboxGUIUtility.Get("Sequence Length"), length, 1, inputSequenceLength);

            if (newlength != length)
            {
                outputSequenceLength.intValue = newlength;
            }

            EditorGUILayout.PropertyField(useCurve, VFXToolboxGUIUtility.Get("Use Retiming Curve"));

            if (useCurve.boolValue)
            {
                m_CurveDrawer.SetBounds(new Rect(0, 0, 1, inputSequenceLength - 1));

                if (m_CurveDrawer.OnGUILayout())
                {
                    changed = true;
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                changed = true;
            }

            return(changed);
        }
        public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject)
        {
            EditorGUI.BeginChangeCheck();
            Material mat = (Material)EditorGUILayout.ObjectField(VFXToolboxGUIUtility.Get("Material"), customMaterial, typeof(Material), false);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(this, "Custom Material Change");
                customMaterial = mat;
                EditorUtility.SetDirty(this);
                Invalidate();
                changed = true;
            }

            if (customMaterial != null)
            {
                Editor.CreateCachedEditor(customMaterial, typeof(MaterialEditor), ref m_MaterialEditor);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.DrawHeader();
                EditorGUIUtility.labelWidth = 120;
                m_MaterialEditor.OnInspectorGUI();

                if (m_CachedShader != customMaterial.shader)
                {
                    // Hack : we cache shader in order to track changes as DrawHeader does not consider shader change as a EditorGUI.changed
                    m_CachedShader = customMaterial.shader;
                    GUI.changed    = true;
                }

                if (EditorGUI.EndChangeCheck())
                {
                    Invalidate();
                    changed = true;
                }
            }
            return(changed);
        }
示例#27
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            var brightness = m_SerializedObject.FindProperty("Brightness");
            var contrast   = m_SerializedObject.FindProperty("Contrast");
            var saturation = m_SerializedObject.FindProperty("Saturation");
            var alphaCurve = m_SerializedObject.FindProperty("AlphaCurve");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(brightness, VFXToolboxGUIUtility.Get("Brightness"));
            EditorGUILayout.PropertyField(contrast, VFXToolboxGUIUtility.Get("Contrast"));
            EditorGUILayout.PropertyField(saturation, VFXToolboxGUIUtility.Get("Saturation"));

            bool curveChanged = false;

            using (new GUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(VFXToolboxGUIUtility.Get("Alpha Curve"), GUILayout.Width(EditorGUIUtility.labelWidth));
                if (GUILayout.Button(VFXToolboxGUIUtility.Get("Reset")))
                {
                    alphaCurve.animationCurveValue = AnimationCurve.Linear(0, 0, 1, 1);
                    m_CurveDrawer.ClearSelection();
                    curveChanged = true;
                }
            }
            if (!curveChanged)
            {
                curveChanged = m_CurveDrawer.OnGUILayout();
            }

            if (EditorGUI.EndChangeCheck() || curveChanged)
            {
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
示例#28
0
        protected override bool DrawSidePanelContent(bool hasChanged)
        {
            int sourceWidth  = InputSequence.width;
            int sourceHeight = InputSequence.height;

            var crop_top    = m_SerializedObject.FindProperty("Crop_Top");
            var crop_bottom = m_SerializedObject.FindProperty("Crop_Bottom");
            var crop_left   = m_SerializedObject.FindProperty("Crop_Left");
            var crop_right  = m_SerializedObject.FindProperty("Crop_Right");
            var threshold   = m_SerializedObject.FindProperty("AutoCropThreshold");

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.IntSlider(crop_top, 0, (sourceHeight / 2) - 1, VFXToolboxGUIUtility.Get("Top"));
            EditorGUILayout.IntSlider(crop_bottom, 0, (sourceHeight / 2) - 1, VFXToolboxGUIUtility.Get("Bottom"));
            EditorGUILayout.IntSlider(crop_left, 0, (sourceWidth / 2) - 1, VFXToolboxGUIUtility.Get("Left"));
            EditorGUILayout.IntSlider(crop_right, 0, (sourceWidth / 2) - 1, VFXToolboxGUIUtility.Get("Right"));

            GUILayout.Space(20);
            GUILayout.Label(VFXToolboxGUIUtility.Get("Automatic Crop Values"), EditorStyles.boldLabel);
            EditorGUI.indentLevel += 2;
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.Slider(threshold, 0.0f, 1.0f, VFXToolboxGUIUtility.Get("Alpha Threshold"));
                if (GUILayout.Button(VFXToolboxGUIUtility.Get("Find")))
                {
                    FindProperValues(threshold.floatValue, ref crop_top, ref crop_bottom, ref crop_left, ref crop_right);
                    GUI.changed = true;
                }
            }
            EditorGUI.indentLevel -= 2;

            GUILayout.Space(20);

            Rect preview_rect;

            using (new GUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();
                preview_rect = GUILayoutUtility.GetRect(200, 200);
                GUILayout.FlexibleSpace();
            }

            EditorGUI.DrawRect(preview_rect, new Color(0, 0, 0, 0.1f));

            GUI.BeginClip(preview_rect);

            GUI.Label(new Rect(0, 0, 200, 16), "Preview");

            int top    = 40;
            int left   = 40;
            int right  = 160;
            int bottom = 160;

            Handles.color = Color.green;
            Handles.DrawLine(new Vector3(left, top), new Vector3(left, bottom));
            Handles.DrawLine(new Vector3(left, bottom), new Vector3(right, bottom));
            Handles.DrawLine(new Vector3(right, bottom), new Vector3(right, top));
            Handles.DrawLine(new Vector3(right, top), new Vector3(left, top));

            top    = (int)(40 + 120 * (float)crop_top.intValue / sourceHeight);
            bottom = (int)(160 - 120 * (float)crop_bottom.intValue / sourceHeight);
            left   = (int)(40 + 120 * (float)crop_left.intValue / sourceWidth);
            right  = (int)(160 - 120 * (float)crop_right.intValue / sourceWidth);

            Handles.color = Color.red;

            Handles.DrawLine(new Vector3(left, top), new Vector3(left, bottom));
            Handles.DrawLine(new Vector3(left, bottom), new Vector3(right, bottom));
            Handles.DrawLine(new Vector3(right, bottom), new Vector3(right, top));
            Handles.DrawLine(new Vector3(right, top), new Vector3(left, top));

            GUI.EndClip();

            if (EditorGUI.EndChangeCheck())
            {
                UpdateOutputSize();
                Invalidate();
                hasChanged = true;
            }

            return(hasChanged);
        }
示例#29
0
 private void DoHeaderLayout(string headerText)
 {
     GUILayout.Label(GUIContent.none, s_Styles.separator);
     GUILayout.Label(VFXToolboxGUIUtility.Get(headerText), EditorStyles.boldLabel);
 }
示例#30
0
            public override void OnGUI(Rect rect)
            {
                if (s_Styles == null)
                {
                    s_Styles = new Styles();
                }

                using (new GUILayout.AreaScope(rect))
                {
                    bool needRepaint = false;

                    using (new GUILayout.VerticalScope())
                    {
                        EditorGUI.BeginChangeCheck();
                        DoHeaderLayout("Viewport Options");
                        m_Window.previewCanvas.showGrid      = GUILayout.Toggle(m_Window.previewCanvas.showGrid, VFXToolboxGUIUtility.Get("Grid Outline"), s_Styles.menuItem);
                        m_Window.previewCanvas.showExtraInfo = GUILayout.Toggle(m_Window.previewCanvas.showExtraInfo, VFXToolboxGUIUtility.Get("Frame Processor Overlays"), s_Styles.menuItem);
                        m_Window.previewCanvas.filter        = GUILayout.Toggle(m_Window.previewCanvas.filter, VFXToolboxGUIUtility.Get("Texture Filtering"), s_Styles.menuItem);

                        DoHeaderLayout("Center View");
                        if (GUILayout.Button(VFXToolboxGUIUtility.Get("Fit to Window"), s_Styles.menuItem))
                        {
                            m_Window.previewCanvas.Recenter(true);
                            needRepaint = true;
                        }

                        if (GUILayout.Button(VFXToolboxGUIUtility.Get("Reset Zoom"), s_Styles.menuItem))
                        {
                            m_Window.previewCanvas.Recenter(false);
                            needRepaint = true;
                        }

                        DoHeaderLayout("Background Options");

                        if (GUILayout.Button(VFXToolboxGUIUtility.Get("Reset Brightness"), s_Styles.menuItem))
                        {
                            m_Window.previewCanvas.ResetBrightness();
                            needRepaint = true;
                        }

                        DoHeaderLayout("Processing Options");
                        m_Window.m_AutoCook = GUILayout.Toggle(m_Window.m_AutoCook, VFXToolboxGUIUtility.Get("AutoCook"), s_Styles.menuItem);

                        DoHeaderLayout("Find in Project...");

                        if (GUILayout.Button(VFXToolboxGUIUtility.Get("This Image Sequence"), s_Styles.menuItem))
                        {
                            m_Window.PingCurrentAsset();
                        }

                        if (m_Window.m_CurrentAsset.exportSettings.fileName != "")
                        {
                            if (GUILayout.Button(VFXToolboxGUIUtility.Get("Exported Texture"), s_Styles.menuItem))
                            {
                                PingOutputTexture(m_Window.m_CurrentAsset.exportSettings.fileName);
                            }
                        }
                        else
                        {
                            using (new EditorGUI.DisabledScope(true))
                            {
                                GUILayout.Button(VFXToolboxGUIUtility.Get("Exported Texture"), s_Styles.menuItem);
                            }
                        }

                        DoHeaderLayout("Help and Feedback");
                        if (GUILayout.Button(VFXToolboxGUIUtility.Get("GitHub Repository"), s_Styles.menuItem))
                        {
                            Application.OpenURL("https://github.com/Unity-Technologies/VFXToolbox");
                        }

                        if (EditorGUI.EndChangeCheck())
                        {
                            needRepaint = true;
                        }
                    }

                    if (needRepaint)
                    {
                        m_Window.Repaint();
                    }
                }

                if (Event.current.type == EventType.MouseMove)
                {
                    Event.current.Use();
                }

                if (Event.current.type != EventType.KeyDown || Event.current.keyCode != KeyCode.Escape)
                {
                    return;
                }
                this.editorWindow.Close();
                GUIUtility.ExitGUI();
            }