Example #1
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);
        }
        private bool HandleDropData()
        {
            if(m_CurrentAsset == null)
                return false;

            if(sidePanelViewMode == SidePanelMode.InputFrames && DragAndDrop.paths.Length > 0)
            {
                DragAndDrop.visualMode = DragAndDropVisualMode.Link;
                if( Event.current.type == EventType.DragExited)
                {
                    List<string> texturePaths = new List<string>();
                    foreach(string path in DragAndDrop.paths)
                    {
                        if (VFXToolboxUtility.IsDirectory(path))
                            texturePaths.AddRange(VFXToolboxUtility.GetAllTexturesInPath(path));
                        else
                        {
                            VFXToolboxGUIUtility.DisplayProgressBar("Image Sequencer", "Discovering Assets...", 0.5f);
                            Texture2D t = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
                            if(t != null)
                                texturePaths.Add(path);
                        }
                    }
                    AddInputFrame(m_InputFramesReorderableList, texturePaths);
                    VFXToolboxGUIUtility.ClearProgressBar();
                    return true;
                }
            }
            return false;
        }
Example #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);
        }
Example #4
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();
            }
        }
        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();
            }
        }
        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);
        }
Example #7
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 < settings.FlipbookNumU; i++)
            {
                float cw = (topRight.x - bottomLeft.x) / settings.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 < settings.FlipbookNumV; i++)
            {
                float ch = (bottomLeft.y - topRight.y) / settings.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);
        }
Example #8
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);
        }
Example #9
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);
        }
 public void LoadFramesFromAsset(ImageSequence asset)
 {
     inputSequence.frames.Clear();
     if (asset.inputFrameGUIDs != null && asset.inputFrameGUIDs.Count > 0)
     {
         int count = asset.inputFrameGUIDs.Count;
         int i     = 1;
         foreach (string guid in asset.inputFrameGUIDs)
         {
             VFXToolboxGUIUtility.DisplayProgressBar("Image Sequencer", "Loading Textures (" + i + "/" + count + ")", (float)i / count, 0.1f);
             string    path = AssetDatabase.GUIDToAssetPath(guid);
             Texture2D t    = AssetDatabase.LoadAssetAtPath <Texture2D>(path);
             if (t != null)
             {
                 inputSequence.frames.Add(new ProcessingFrame(t));
             }
             else
             {
                 inputSequence.frames.Add(ProcessingFrame.Missing);
             }
             i++;
         }
         VFXToolboxGUIUtility.ClearProgressBar();
     }
 }
Example #11
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);
        }
Example #12
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);
        }
Example #13
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);
        }
        private void DrawTabbedPanelSelector()
        {
            SidePanelMode prevMode = m_SidePanelViewMode;
            bool hasInputFrames = m_ProcessingNodeStack.inputSequence.frames.Count > 0;
            SidePanelMode newMode = (SidePanelMode)VFXToolboxGUIUtility.TabbedButtonsGUILayout(
                    (int)prevMode,
                    new string[] { "Input Frames", "Processors", "Export"},
                    new bool [] { true, hasInputFrames, hasInputFrames}
                );

            if(prevMode != newMode)
            {
                m_SidePanelViewMode = newMode;

                switch(m_SidePanelViewMode)
                {
                    case SidePanelMode.InputFrames:

                        m_PreviewCanvas.sequence = m_ProcessingNodeStack.inputSequence;

                        break;

                    case SidePanelMode.Processors:

                        if (m_LockedPreviewProcessor != null)
                            m_PreviewCanvas.sequence = m_LockedPreviewProcessor.OutputSequence;
                        else
                        {
                            if(m_CurrentProcessingNode != null)
                                m_PreviewCanvas.sequence = m_CurrentProcessingNode.OutputSequence;
                            else
                            {
                                if (m_ProcessingNodeStack.nodes.Count > 0)
                                    m_PreviewCanvas.sequence = m_ProcessingNodeStack.nodes[m_ProcessingNodeStack.nodes.Count - 1].OutputSequence;
                                else
                                    m_PreviewCanvas.sequence = m_ProcessingNodeStack.inputSequence;
                            }
                        }

                        break;

                    case SidePanelMode.Export:

                        m_PreviewCanvas.sequence = m_ProcessingNodeStack.outputSequence;

                        break;
                }

                m_PreviewCanvas.InvalidateRenderTarget();
                m_PreviewCanvas.UpdateCanvasSequence();
                m_PreviewCanvas.Invalidate(true);
            }

        }
Example #15
0
        private void FindProperValues(float threshold, ref SerializedProperty top, ref SerializedProperty bottom, ref SerializedProperty left, ref SerializedProperty right)
        {
            int width  = InputSequence.width;
            int height = InputSequence.height;

            int minX = width;
            int maxX = 0;
            int minY = height;
            int maxY = 0;

            Color[]       colors;
            RenderTexture tempRT = RenderTexture.GetTemporary(width, height, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);

            for (int i = 0; i < InputSequence.frames.Count; i++)
            {
                ProcessingFrame f = InputSequence.frames[i];

                VFXToolboxGUIUtility.DisplayProgressBar("Crop processor", "Evaluating closest bound (Frame #" + i + " on " + InputSequence.frames.Count + "...)", (float)i / InputSequence.frames.Count);
                if (InputSequence.processor != null)
                {
                    f.Process();
                    colors = VFXToolboxUtility.ReadBack(f.texture as RenderTexture);
                }
                else
                {
                    Graphics.Blit(f.texture, tempRT);
                    colors = VFXToolboxUtility.ReadBack(tempRT);
                }

                // Check frame
                for (int j = 0; j < colors.Length; j++)
                {
                    int x = j % width;
                    int y = j / width;
                    if (colors[j].a >= threshold)
                    {
                        minX = Mathf.Min(minX, x);
                        maxX = Mathf.Max(maxX, x);
                        minY = Mathf.Min(minY, y);
                        maxY = Mathf.Max(maxY, y);
                    }
                }
            }
            VFXToolboxGUIUtility.ClearProgressBar();

            bottom.intValue = minY;
            top.intValue    = height - maxY - 1;
            left.intValue   = minX;
            right.intValue  = width - maxX - 1;

            RenderTexture.ReleaseTemporary(tempRT);
        }
        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);
        }
Example #17
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);
        }
Example #18
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);
        }
Example #19
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);
        }
Example #21
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);
        }
Example #22
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);
        }
        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);
        }
        protected bool DrawSidePanelHeader()
        {
            bool bHasChanged     = false;
            bool previousEnabled = Enabled;

            Enabled = VFXToolboxGUIUtility.ToggleableHeader(Enabled, false, GetName());

            if (previousEnabled != Enabled)
            {
                SerializedObject o = new SerializedObject(m_ProcessorInfo);
                o.FindProperty("Enabled").boolValue = Enabled;
                o.ApplyModifiedProperties();
                m_ProcessingNodeStack.Invalidate(this);
                bHasChanged = true;
            }
            return(bHasChanged);
        }
        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);
        }
Example #26
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);
        }
Example #27
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);
        }
Example #28
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);
        }
Example #29
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);
        }
Example #30
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));
 }