コード例 #1
0
ファイル: PointerDebuggerWindow.cs プロジェクト: JVK-BHZ/MPD
        private void drawSelectedEvent(Rect rect)
        {
            if (selectedEvent.Id == -1)
            {
                GUI.Label(rect, "No event selected.", styles.EnterPlayModeText);
                return;
            }

            var transform = selectedEvent.IsOpen.Target;
            var path      = selectedEvent.IsOpen.TargetPath;

            GUI.Label(rect, string.Format("{0}\nPosition: {1}\nPrevious: {2}\nFlags: {3}, Buttons: {4}",
                                          getEventString(selectedEventId), selectedEvent.IsOpen.Position,
                                          selectedEvent.IsOpen.PreviousPosition, selectedEvent.IsOpen.Flags,
                                          PointerUtils.ButtonsToString(selectedEvent.IsOpen.Buttons)));
            rect.y     += 64;
            rect.height = 20;
            GUI.Label(rect, "Target: ");
            using (var scope = new EditorGUI.DisabledScope(true))
            {
                var fieldRect = new Rect(rect);
                fieldRect.x     += 50;
                fieldRect.width -= 50;
                EditorGUI.ObjectField(fieldRect, transform, typeof(Transform), true);
            }

            if (path != null)
            {
                rect.y     += 20;
                rect.height = 16;
                GUI.Label(rect, path, styles.SmallText);
            }
        }
コード例 #2
0
        /// <summary>
        /// Draws the default dragging Handle.
        /// </summary>
        public void DrawStandardElementHandle(Rect rect, int index, bool selected, bool focused, bool draggable)
        {
            if (Event.current.type == EventType.Repaint)
            {
                //keep the dragging handle in the 1 row
                rect.yMax = rect.yMin + Style.rowHeight;

                rect.width = Style.handleSpace;
                //prepare rect for the handle texture draw
                var xDiff = rect.width - Style.handleWidth;
                rect.xMin += xDiff / 2;
                rect.xMax  = rect.xMin;
                rect.xMax += xDiff / 2;

                var yDiff = rect.height - Style.handleHeight;
                rect.yMin += yDiff / 2;
                rect.yMax -= yDiff / 2;
#if UNITY_2019_3_OR_NEWER
                rect.y += Style.spacing;
#endif
                //disable (if needed) and draw the handle
                using (var scope = new EditorGUI.DisabledScope(!draggable))
                {
                    Style.dragHandleButton.Draw(rect, false, false, false, false);
                }
            }
        }
コード例 #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            _rampObj = target as KamakuraRampTexture;

            var widthProp = serializedObject.FindProperty("width");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.IntSlider(widthProp, 4, 128);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }

            EditorGUI.BeginChangeCheck();
            _list.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }

            if (NeedsUpdate(_rampObj))
            {
                _cachedTexture = UpdateTex(_rampObj);
            }

            using (var disableScope = new EditorGUI.DisabledScope(_cachedTexture == null))
            {
                if (GUILayout.Button("Export as PNG"))
                {
                    ExportToPNG(_cachedTexture);
                }
            }
        }
コード例 #4
0
 public void OnGUI()
 {
     if (m_EditableParametersForEachListItem == null || m_EditableParametersForEachListItem.Length == 0)
     {
         using (var scope = new EditorGUI.DisabledScope(true))
         {
             EditorGUI.indentLevel++;
             EditorGUILayout.LabelField($"No {itemName}s have been added.");
             EditorGUI.indentLevel--;
         }
     }
     else
     {
         for (var i = 0; i < m_EditableParametersForEachListItem.Length; i++)
         {
             var editableParams = m_EditableParametersForEachListItem[i];
             EditorGUILayout.BeginHorizontal();
             if (editableParams.hasUIToShow)
             {
                 editableParams.visible = EditorGUILayout.Foldout(editableParams.visible, editableParams.name, Styles.s_FoldoutStyle);
             }
             else
             {
                 GUILayout.Space(16);
                 EditorGUILayout.LabelField(editableParams.name, EditorStyles.boldLabel);
             }
             GUILayout.FlexibleSpace();
             using (var scope = new EditorGUI.DisabledScope(i == 0))
             {
                 if (GUILayout.Button(m_UpButton, Styles.s_UpDownButtonStyle))
                 {
                     SwapEntry(i, i - 1);
                 }
             }
             using (var scope = new EditorGUI.DisabledScope(i == m_EditableParametersForEachListItem.Length - 1))
             {
                 if (GUILayout.Button(m_DownButton, Styles.s_UpDownButtonStyle))
                 {
                     SwapEntry(i, i + 1);
                 }
             }
             if (GUILayout.Button(m_DeleteButton, EditorStyles.label))
             {
                 ArrayHelpers.EraseAt(ref m_ParametersForEachListItem, i);
                 ArrayHelpers.EraseAt(ref m_EditableParametersForEachListItem, i);
                 m_Apply();
                 GUIUtility.ExitGUI();
             }
             EditorGUILayout.EndHorizontal();
             if (editableParams.visible)
             {
                 EditorGUI.indentLevel++;
                 editableParams.OnGUI();
                 EditorGUI.indentLevel--;
             }
             GUIHelpers.DrawLineSeparator();
         }
     }
 }
コード例 #5
0
        void DrawPoolingOptions()
        {
            // Enabled
            EditorGUILayout.PropertyField(m_PoolingEnabledProp, Styles.PoolingEnabled);

            // Instance Count
            using (var disabledScope = new EditorGUI.DisabledScope(!m_PoolingEnabledProp.boolValue))
            {
                EditorGUILayout.PropertyField(m_InstanceCountProp, Styles.InstanceCount);
            }
        }
コード例 #6
0
 void OnGUI()
 {
     foreach (var item in GUIDCollector.Instance.allReference)
     {
         using (var scope1 = new EditorGUI.DisabledScope(true)) {
             using (var scope2 = new EditorGUILayout.HorizontalScope()) {
                 EditorGUILayout.ObjectField(item.Value, item.Value.GetType(), true);
                 EditorGUILayout.TextField(item.Key.ToString());
             }
         }
     }
 }
コード例 #7
0
    public override void OnInspectorGUI()
    {
        CreateHeaderSpace();

        var atomScript = target as AtomRandomizer;

        EditorGUIUtility.labelWidth = LABEL_WIDTH;

        atomScript.RandomizeBackground = EditorGUILayout.Toggle("Randomize Background", atomScript.RandomizeBackground);
        using (var randomBackground = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(atomScript.RandomizeBackground)))
        {
            if (!randomBackground.visible)
            {
                EditorGUI.indentLevel++;
                atomScript.BackgroundColor = EditorGUILayout.ColorField(atomScript.BackgroundColor);
                EditorGUI.indentLevel--;
            }
        }

        CreateHeaderSpace();
        atomScript.RandomizeForeground = EditorGUILayout.Toggle("Randomize Foreground", atomScript.RandomizeForeground);
        using (var randomForeground = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(atomScript.RandomizeForeground)))
        {
            if (!randomForeground.visible)
            {
                EditorGUI.indentLevel++;
                atomScript.ForegroundColor = EditorGUILayout.ColorField(atomScript.ForegroundColor);
                EditorGUI.indentLevel--;
            }
        }

        CreateHeaderSpace();
        CreateHeaderSpace("Atom Shader Fields");
        atomScript.RandomizeAtomFields = EditorGUILayout.Toggle("Randomize Atom Fields", atomScript.RandomizeAtomFields);

        using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(atomScript.RandomizeAtomFields)))
        {
            if (group.visible)
            {
                EditorGUI.indentLevel++;
                atomScript.StressTest = EditorGUILayout.Toggle("Stress Test", atomScript.StressTest);

                using (var stressTest = new EditorGUI.DisabledScope(atomScript.StressTest))
                {
                    atomScript.RandomFactor = EditorGUILayout.Slider(atomScript.RandomFactor, 0.1f, 1.0f);
                }

                EditorGUI.indentLevel--;
            }
        }

        CreateHeaderSpace();
    }
コード例 #8
0
            public void DrawFooter(RampUpgradeWizard wizard)
            {
                using (var footer = new GUILayout.AreaScope(new Rect(10f, wizard.position.height - 30f, wizard.position.width - 20f, 30f), "")){
                    using (var bottom = new EditorGUILayout.HorizontalScope())
                    {
                        // Back button
                        using (var dis = new EditorGUI.DisabledScope(string.IsNullOrEmpty(this.previousPage)))
                        {
                            if (GUILayout.Button("Back", GUILayout.ExpandWidth(false)))
                            {
                                wizard.GoPreviousPage();
                            }
                        }

                        // Space between Back and Cancel
                        GUILayout.FlexibleSpace();


                        // Cancel button
                        if (this.canncelable)
                        {
                            if (GUILayout.Button("Cancel", GUILayout.ExpandWidth(false)))
                            {
                                if (wizard.DisplayDialog("Do you want to abort the setup?"))
                                {
                                    wizard.GoCanncelPage();
                                }
                            }
                        }

                        // Next & Finish button
                        {
                            var label = this.isEndOfWizard ? "Finish" : "Next";

                            if (GUILayout.Button(label, GUILayout.ExpandWidth(false)))
                            {
                                if (this.confirmNext && wizard.DisplayDialog("You can not UNDO the operation.\nAre you sure you want to proceed?"))
                                {
                                    wizard.GoNextPage();
                                }
                                else if (!this.confirmNext)
                                {
                                    wizard.GoNextPage();
                                }
                            }
                        }
                    }
                }     // End of footer area
            }
コード例 #9
0
ファイル: PointerDebuggerWindow.cs プロジェクト: JVK-BHZ/MPD
        private void drawRefresh()
        {
            var rect = GUILayoutUtility.GetRect(0, styles.RefreshHeight, GUILayout.ExpandWidth(true));

            GUIUtils.ContractRect(ref rect, styles.Padding);

            var sourceRect = new Rect(rect);

            sourceRect.width = 50;
            GUI.Label(sourceRect, "  Source", styles.SmallText);
            sourceRect.x += sourceRect.width;
            using (var scope = new EditorGUI.ChangeCheckScope())
            {
                logType = (LogType)EditorGUI.EnumPopup(sourceRect, "", logType);
                if (scope.changed)
                {
                    updateLogType(logType);
                }
            }

            if (logType == LogType.File)
            {
                sourceRect.x     += sourceRect.width + 2;
                sourceRect.width  = 40;
                sourceRect.height = 15;
                if (GUI.Button(sourceRect, "Load", styles.SmallButton))
                {
                    loadLogFile();
                }
            }

            var refreshRect = new Rect(rect);

            refreshRect.x     = refreshRect.width - 50 - 60;
            refreshRect.width = 50;
            autoRefresh       = GUI.Toggle(refreshRect, autoRefresh, "     Auto", styles.FilterToggle);

            using (var scope = new EditorGUI.DisabledScope(autoRefresh))
            {
                rect.x      = rect.width - 60;
                rect.width  = 60;
                rect.height = 15;
                rect.y     -= 1;
                if (GUI.Button(rect, "Refresh", styles.SmallButton))
                {
                    updateEventList();
                }
            }
        }
コード例 #10
0
 public static bool ToggleButton(Rect rect, bool value, SnapSettings active, SnapSettings flag, GUIContent[] content, GUIStyle style)
 {
     if ((active & flag) != flag)
     {
         using (var disableScope = new EditorGUI.DisabledScope(true))
         {
             GUI.Toggle(rect, !ChiselEditorResources.isProSkin, content[0], style);
         }
     }
     else
     {
         value = GUI.Toggle(rect, value, value ? content[1] : content[0], style);
     }
     return(value);
 }
コード例 #11
0
 public override void ShowPlatformBuildOptions()
 {
     base.ShowPlatformBuildOptions();
     UserBuildSettings.copyPDBFiles = EditorGUILayout.Toggle(this.m_CopyPdbFiles, UserBuildSettings.copyPDBFiles, new GUILayoutOption[0]);
     EditorGUI.DisabledScope disabledScope = new EditorGUI.DisabledScope(EditorUserBuildSettings.installInBuildFolder);
     //((EditorGUI.DisabledScope) ref disabledScope).\u002Ector(EditorUserBuildSettings.installInBuildFolder);
     try
     {
         UserBuildSettings.createSolution = EditorGUILayout.Toggle(this.m_CreateSolutionText, UserBuildSettings.createSolution, new GUILayoutOption[0]);
     }
     finally
     {
         disabledScope.Dispose();
     }
 }
コード例 #12
0
 public static bool ToggleButton(bool value, SnapSettings active, SnapSettings flag, GUIContent content, GUIStyle style)
 {
     if ((active & flag) != flag)
     {
         using (var disableScope = new EditorGUI.DisabledScope(true))
         {
             GUILayout.Toggle(!ChiselEditorResources.isProSkin, content, style);
         }
     }
     else
     {
         value = GUILayout.Toggle(value, content, style);
     }
     return(value);
 }
コード例 #13
0
        public override void OnInspectorGUI()
        {
            var so = this.serializedObject;

            so.Update();

            EditorGUI.BeginChangeCheck();
            try
            {
                var stream = so.targetObject as UsdStream;

                AddSimpleProperty(serializedObject.FindProperty(() => stream.m_time), "Time", "");

                m_ShowImportSettings = EditorGUILayout.Foldout(m_ShowImportSettings, "Import Settings");
                if (m_ShowImportSettings)
                {
                    using (var enabled = new EditorGUI.DisabledScope(true))
                    {
                        AddEnumProperty(so.FindProperty(() => stream.m_path.m_root), "Root", "", stream.m_path.m_root.GetType());
                        AddSimpleProperty(so.FindProperty(() => stream.m_path.m_leaf), "SubPath", "");
                    }

                    AddEnumProperty(serializedObject.FindProperty(() => stream.m_importSettings.interpolation), "Interpolation", "", stream.m_importSettings.interpolation.GetType());
                    AddEnumProperty(serializedObject.FindProperty(() => stream.m_importSettings.normalCalculation), "Compute normals", "", stream.m_importSettings.normalCalculation.GetType());
                    AddEnumProperty(serializedObject.FindProperty(() => stream.m_importSettings.tangentCalculation), "Compute tangents", "", stream.m_importSettings.tangentCalculation.GetType());
                    AddSimpleProperty(serializedObject.FindProperty(() => stream.m_importSettings.scale), "Scale", "");
                    AddByteBoolProperty(serializedObject.FindProperty(() => stream.m_importSettings.swapHandedness.v), "Swap handedness", "");
                    AddByteBoolProperty(serializedObject.FindProperty(() => stream.m_importSettings.swapFaces.v), "Swap faces", "");
                    AddEnumProperty(serializedObject.FindProperty(() => stream.m_timeUnit.m_type), "Time unit", "", stream.m_timeUnit.type.GetType());
                }

                m_ShowAdvOptions = EditorGUILayout.Foldout(m_ShowAdvOptions, new GUIContent("Advanced options"));
                if (m_ShowAdvOptions)
                {
                    AddSimpleProperty(serializedObject.FindProperty(() => stream.m_forceSingleThread), "Single threaded", "");
                    AddSimpleProperty(serializedObject.FindProperty(() => stream.m_detailedLog), "Detailed log", "");
                    AddSimpleProperty(serializedObject.FindProperty(() => stream.m_directVBUpdate), "Direct VB update", "");
                    AddSimpleProperty(serializedObject.FindProperty(() => stream.m_deferredUpdate), "Defered udpate", "");
                }
            }
            finally
            {
                so.ApplyModifiedProperties();
                EditorGUI.EndChangeCheck();
            }
            AddButtons();
        }
コード例 #14
0
ファイル: PointerDebuggerWindow.cs プロジェクト: JVK-BHZ/MPD
        private void drawFilters(Rect rect)
        {
            //GUI.Toggle(rect, true, "     Test", styles.FilterToggle);

            GUI.Label(rect, "Show pointer events:");

            rect.y      += 20;
            rect.height -= 20;
            var scrollRect = new Rect(rect);

            scrollRect.height *= 2;
            scrollRect.width  -= 40;
            //scrollRect.x = 0;
            //scrollRect.y = 0;

            //using (var scope = new GUI.ScrollViewScope(rect, filterScroll, scrollRect))
            //{
            scrollRect.height = 14;
            var names = Enum.GetNames(typeof(PointerEvent));

            using (var changeScope = new EditorGUI.ChangeCheckScope())
            {
                for (var i = 1; i < names.Length; i++)
                {
                    var evt = (PointerEvent)i;
                    filterState.SetEventValue(evt,
                                              GUI.Toggle(scrollRect, filterState.IsEventEnabled(evt), "     " + names[i], styles.FilterToggle));
                    scrollRect.y += scrollRect.height;
                }
                if (changeScope.changed)
                {
                    filterState.Save();
                }
            }
            //    filterScroll = scope.scrollPosition;
            //}

            scrollRect.y     += 4;
            scrollRect.height = 20;
            using (var scope = new EditorGUI.DisabledScope(pointerList.SelectedId == -1))
            {
                if (GUI.Button(scrollRect, "Apply filter"))
                {
                    updateEventList();
                }
            }
        }
コード例 #15
0
        public static void SelectDeselectAll <T>(this T[] array, Func <T, bool> predicate, Action <T[], bool> action)
        {
            using (var horizontalScope = new EditorGUILayout.HorizontalScope())
            {
                using (new EditorGUI.DisabledScope(array.All(predicate)))
                    if (GUILayout.Button(SelectAll))
                    {
                        action(array, true);
                    }

                using (var disabledScope = new EditorGUI.DisabledScope(!array.Any(predicate)))
                    if (GUILayout.Button(DeselectAll))
                    {
                        action(array, false);
                    }
            }
        }
コード例 #16
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            PopulateProperties(property);
            EditorGUI.BeginProperty(position, label, property);

            m_spatialize.DrawProperty(ref position);
            using (var disabled = new EditorGUI.DisabledScope(!m_spatialize.boolValue))
            {
                m_blendSpace.DrawProperty(ref position);
                m_dopplerLevel.DrawProperty(ref position);
                m_range.DrawProperty(ref position);
                m_rolloffMode.DrawProperty(ref position);
            }
            using (var disabled =
                       new EditorGUI.DisabledScope(!m_spatialize.boolValue || m_rolloffMode.enumValueIndex != (int)AudioRolloffMode.Custom))
            {
                m_customRolloffCurve.DrawProperty(ref position);
            }

            EditorGUI.EndProperty();
        }
コード例 #17
0
ファイル: PagedList.cs プロジェクト: KinensaiJP/130app
        private void drawFooter(Rect parentRect)
        {
            parentRect.y      += 5;
            parentRect.height -= 5;

            var rect = new Rect(parentRect.x, parentRect.y, styles.FooterButtonWidth, styles.FooterButtonHeight);

            if (GUI.Button(rect, styles.TextPrev))
            {
                setPage(page - 1);
            }

            rect.x    += rect.width + styles.FooterButtonSpace;
            rect.width = styles.GetIntFieldSize(page);
            var newPage = EditorGUI.DelayedIntField(rect, page);

            if (page != newPage)
            {
                setPage(newPage);
            }

            rect.x    += rect.width + styles.FooterButtonSpace;
            rect.width = 16;
            GUI.Label(rect, "of");

            rect.x    += rect.width + styles.FooterButtonSpace;
            rect.width = styles.GetIntFieldSize(page);

            using (var scope = new EditorGUI.DisabledScope(true))
            {
                EditorGUI.IntField(rect, PagesTotal);
            }

            rect.x    += rect.width + styles.FooterButtonSpace;
            rect.width = styles.FooterButtonWidth;
            if (GUI.Button(rect, styles.TextNext))
            {
                setPage(page + 1);
            }
        }
コード例 #18
0
ファイル: IconManager.cs プロジェクト: Algoryx/AGXUnity
        public static bool ToolButton(Rect rect,
                                      GUIContent content,
                                      InspectorGUISkin.ButtonType buttonType,
                                      bool active,
                                      bool enabled)
        {
            var disabledScope = new EditorGUI.DisabledScope(!enabled);
            var buttonContent = content.image != null?ToolButtonTooltip(content) : content;

            var pressed = UnityEngine.GUI.Button(rect,
                                                 buttonContent,
                                                 InspectorEditor.Skin.GetButton(active, buttonType));

            if (buttonContent == s_tooltipContent && content.image != null)
            {
                using (IconManager.ForegroundColorBlock(active, enabled))
                    UnityEngine.GUI.DrawTexture(IconManager.GetIconRect(rect), content.image);
            }

            disabledScope.Dispose();

            return(pressed);
        }
    public override void OnInspectorGUI()
    {
        _movie = (this.target) as AVProWindowsMediaMovie;

        EditorGUILayout.Separator();
        GUILayout.Label("File Location", EditorStyles.boldLabel);
        //DrawDefaultInspector();

        _movie._useStreamingAssetsPath = EditorGUILayout.Toggle("Use StreamingAssets", _movie._useStreamingAssetsPath);
        _movie._folder   = EditorGUILayout.TextField("Folder", _movie._folder);
        _movie._filename = EditorGUILayout.TextField("Filename", _movie._filename);

        GUILayout.BeginHorizontal();
        GUI.enabled = System.IO.File.Exists(_movie.GetFilePath());

#if UNITY_EDITOR_WIN
        if (GUILayout.Button("Show"))
        {
            ShowInExplorer(_movie.GetFilePath());
        }
#endif
        GUI.enabled &= _movie._useStreamingAssetsPath;

        if (GUILayout.Button("Select"))
        {
            string projectRoot = System.IO.Path.GetFullPath(System.IO.Path.Combine(Application.dataPath, ".."));
            projectRoot = projectRoot.Replace('\\', '/');

            string path = _movie.GetFilePath();
            path = path.Remove(0, projectRoot.Length + 1);

            Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(path);
        }
        GUILayout.EndHorizontal();
        GUI.enabled = true;

        GUI.color = Color.green;
        if (GUILayout.Button("BROWSE"))
        {
            Browse(Application.streamingAssetsPath, ref _movie._filename, ref _movie._folder, ref _movie._useStreamingAssetsPath);
        }
        GUI.color = Color.white;

        if (string.IsNullOrEmpty(_movie.GetFilePath()))
        {
            if (_movie._loadOnStart)
            {
                GUI.color = Color.red;
                GUILayout.TextArea("Error: No file specfied");
                GUI.color = Color.white;
            }
            else
            {
                GUI.color = Color.yellow;
                GUILayout.TextArea("Warning: No file specfied");
                GUI.color = Color.white;
            }
        }
        else if (!System.IO.File.Exists(_movie.GetFilePath()))
        {
            GUI.color = Color.red;
            GUILayout.TextArea("Error: File not found");
            GUI.color = Color.white;
        }
        else
        {
            if (!_movie._useStreamingAssetsPath)
            {
                GUI.color = Color.yellow;
                GUILayout.TextArea("Warning: Files not in StreamingAssets will require manual copying for builds");
                GUI.color = Color.white;
            }
        }
        if (System.IO.Path.IsPathRooted(_movie._folder))
        {
            GUI.color = Color.yellow;
            GUILayout.TextArea("Warning: Absolute path is not ideal.  Better to use files relative to the project root");
            GUI.color = Color.white;
        }

        GUILayout.Space(10f);

        EditorGUILayout.Separator();
        GUILayout.Label("Load Options", EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Colour Format");
        _movie._colourFormat = (AVProWindowsMediaMovie.ColourFormat)EditorGUILayout.EnumPopup(_movie._colourFormat);
        EditorGUILayout.EndHorizontal();
        _movie._useDisplaySync = EditorGUILayout.Toggle("Use Display Sync", _movie._useDisplaySync);

        if (_movie._useDisplaySync)
        {
            if (
#if UNITY_5
                PlayerSettings.d3d11FullscreenMode != D3D11FullscreenMode.ExclusiveMode ||
#endif
                PlayerSettings.d3d9FullscreenMode != D3D9FullscreenMode.ExclusiveMode)
            {
                GUI.color = Color.cyan;
                GUILayout.TextArea("Perf: For display sync fullscreen mode should be set to EXCLUSIVE in Player Settings");
                GUI.color = Color.white;
            }
            if (QualitySettings.vSyncCount != 1 && QualitySettings.vSyncCount != 2)
            {
                GUI.color = Color.cyan;
                GUILayout.TextArea("Perf: For display sync vsync must be set to 1 or 2 in Quality Settings");
                GUI.color = Color.white;
            }
        }

        _movie._allowAudio = EditorGUILayout.Toggle("Allow Audio", _movie._allowAudio);
        GUI.enabled        = _movie._allowAudio;
        {
            _movie._useAudioDelay = EditorGUILayout.Toggle("Use Audio Delay", _movie._useAudioDelay);
            _movie._useAudioMixer = EditorGUILayout.Toggle("Use Audio Mixer", _movie._useAudioMixer);
        }
        GUI.enabled = true;

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Texture Filter");
        _movie._textureFilterMode = (FilterMode)EditorGUILayout.EnumPopup(_movie._textureFilterMode);
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Texture Wrap");
        _movie._textureWrapMode = (TextureWrapMode)EditorGUILayout.EnumPopup(_movie._textureWrapMode);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Start Options", EditorStyles.boldLabel);
        _movie._loadOnStart = EditorGUILayout.Toggle("Load On Start", _movie._loadOnStart);
        GUI.enabled         = _movie._loadOnStart;
        if (!_movie._loadOnStart)
        {
            _movie._playOnStart = false;
        }
        _movie._playOnStart = EditorGUILayout.Toggle("Play On Start", _movie._playOnStart);
        GUI.enabled         = true;
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Performance", EditorStyles.boldLabel);
        _movie._ignoreFlips = EditorGUILayout.Toggle("Ignore Flips", _movie._ignoreFlips);
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        EditorGUILayout.Separator();
        GUILayout.Label("Playback", EditorStyles.boldLabel);

        _movie._loop = EditorGUILayout.Toggle("Loop", _movie._loop);
        //_movie._editorPreview = EditorGUILayout.Toggle("Editor Preview", _movie._editorPreview);

        GUI.enabled = _movie._allowAudio;
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Audio Volume");
            _movie._volume = EditorGUILayout.Slider(_movie._volume, 0.0f, 1.0f);
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Audio Balance");
            _movie._audioBalance = EditorGUILayout.Slider(_movie._audioBalance, -1.0f, 1.0f);
            EditorGUILayout.EndHorizontal();
        }
        GUI.enabled = true;

        GUILayout.Space(8.0f);

        SerializedProperty tps = serializedObject.FindProperty("_clips");
        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(tps, new GUIContent("Clips"), true);
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }

        GUILayout.Space(8.0f);

        if (!Application.isPlaying)
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Load"))
            {
                if (AVProWindowsMediaManager.Instance != null)
                {
                    _movie.LoadMovie(_movie._playOnStart);
                }
            }

#if UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3
            using (var scope = new EditorGUI.DisabledScope(_movie.MovieInstance == null))
#else
            EditorGUI.BeginDisabledGroup(_movie.MovieInstance == null);
#endif
            {
                if (GUILayout.Button("Unload"))
                {
                    _movie.UnloadMovie();
                }
            }
#if UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3
#else
            EditorGUI.EndDisabledGroup();
#endif

            EditorGUILayout.EndHorizontal();
        }

        AVProWindowsMedia media = _movie.MovieInstance;
        if (media != null)
        {
            GUI.enabled           = (_movie != null && _movie.MovieInstance != null);
            _movie._editorPreview = EditorGUILayout.Foldout(_movie._editorPreview, "Video Preview");
            GUI.enabled           = true;

            if (_movie._editorPreview && _movie.MovieInstance != null)
            {
                {
                    Texture texture = _movie.OutputTexture;
                    if (texture == null)
                    {
                        texture = EditorGUIUtility.whiteTexture;
                    }

                    float ratio = (float)texture.width / (float)texture.height;


                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    Rect textureRect = GUILayoutUtility.GetRect(Screen.width / 2, Screen.width / 2, (Screen.width / 2) / ratio, (Screen.width / 2) / ratio);
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    _showAlpha = GUILayout.Toggle(_showAlpha, "Show Alpha Channel");
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    Matrix4x4 prevMatrix = GUI.matrix;
                    if (_movie.MovieInstance.RequiresFlipY)
                    {
                        GUIUtility.ScaleAroundPivot(new Vector2(1f, -1f), new Vector2(0, textureRect.y + (textureRect.height / 2)));
                    }

                    if (!_showAlpha)
                    {
                        GUI.DrawTexture(textureRect, texture, ScaleMode.ScaleToFit);
                    }
                    else
                    {
                        EditorGUI.DrawTextureAlpha(textureRect, texture, ScaleMode.ScaleToFit);
                    }

                    GUI.matrix = prevMatrix;

                    GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Select Texture", GUILayout.ExpandWidth(false)))
                    {
                        Selection.activeObject = texture;
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(string.Format("{0}x{1} @ {2}fps {3} secs", media.Width, media.Height, media.FrameRate.ToString("F2"), media.DurationSeconds.ToString("F2")));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (media.FramesTotal > 30)
                    {
                        GUILayout.Label("Displaying at " + media.DisplayFPS.ToString("F1") + " fps");
                    }
                    else
                    {
                        GUILayout.Label("Displaying at ... fps");
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                }

                if (_movie.enabled)
                {
                    GUILayout.Space(8.0f);

                    EditorGUILayout.LabelField("Frame:");
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("<", GUILayout.ExpandWidth(false)))
                    {
                        media.PositionFrames--;
                    }
                    uint currentFrame = media.PositionFrames;
                    if (currentFrame != uint.MaxValue)
                    {
                        int newFrame = EditorGUILayout.IntSlider((int)currentFrame, 0, (int)media.LastFrame);
                        if (newFrame != currentFrame)
                        {
                            media.PositionFrames = (uint)newFrame;
                        }
                    }
                    if (GUILayout.Button(">", GUILayout.ExpandWidth(false)))
                    {
                        media.PositionFrames++;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (_movie.NumClips > 0)
                    {
                        EditorGUILayout.Separator();
                        EditorGUILayout.LabelField("Clips", EditorStyles.boldLabel);
                        for (int i = 0; i < _movie.NumClips; i++)
                        {
                            GUILayout.BeginHorizontal();
                            string clipName = _movie.GetClipName(i);
                            GUILayout.Label(clipName);
                            if (GUILayout.Button("Loop"))
                            {
                                _movie.PlayClip(clipName, true, false);
                            }
                            GUILayout.EndHorizontal();
                        }
                        if (GUILayout.Button("Reset Clip"))
                        {
                            _movie.ResetClip();
                        }
                        EditorGUILayout.Separator();
                    }

                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("Rewind"))
                    {
                        _movie.MovieInstance.Rewind();
                    }

                    if (!media.IsPlaying)
                    {
                        if (GUILayout.Button("Play"))
                        {
                            _movie.Play();
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("Pause"))
                        {
                            _movie.Pause();
                        }
                    }
                    EditorGUILayout.EndHorizontal();

#if !AVPROWINDOWSMEDIA_UNITYFEATURE_EDITORAUTOREFRESH
                    this.Repaint();
#endif
                }
            }
        }
        if (GUI.changed)
        {
            EditorUtility.SetDirty(_movie);
        }

        // If the app isn't running but the media is we may need to manually update it
        if (!Application.isPlaying && _movie.MovieInstance != null)
        {
            _movie.Update();
            AVProWindowsMediaManager.Instance.Update();
            EditorUtility.SetDirty(_movie);
        }
    }
コード例 #20
0
        public override void OnGUI(string searchContext)
        {
            if (m_Settings == null)
            {
                InitializeWithCurrentSettings();
            }

            if (m_AvailableInputSettingsAssets.Length == 0)
            {
                EditorGUILayout.HelpBox(
                    "Settings for the new input system are stored in an asset. Click the button below to create a settings asset you can edit.",
                    MessageType.Info);
                if (GUILayout.Button("Create settings asset", GUILayout.Height(30)))
                {
                    CreateNewSettingsAsset("Assets/InputSystem.inputsettings.asset");
                }
                GUILayout.Space(20);
            }

            using (var disabled = new EditorGUI.DisabledScope(m_AvailableInputSettingsAssets.Length == 0))
            {
                EditorGUILayout.HelpBox(
                    "Please note that the new input system is still under development and not all features are fully functional or stable yet.\n\n"
                    + "For more information, visit https://github.com/Unity-Technologies/InputSystem or https://forum.unity.com/forums/new-input-system.103/.",
                    MessageType.Warning);

                EditorGUILayout.Space();
                EditorGUILayout.Separator();
                EditorGUILayout.Space();

                Debug.Assert(m_Settings != null);

                EditorGUI.BeginChangeCheck();

                EditorGUILayout.PropertyField(m_UpdateMode);
                var updateMode = (InputSettings.UpdateMode)m_UpdateMode.intValue;
                if (updateMode == InputSettings.UpdateMode.ProcessEventsInBothFixedAndDynamicUpdate)
                {
                    // Choosing action update mode only makes sense if we have an ambiguous situation, i.e.
                    // when we have both dynamic and fixed updates in the picture.
                    ////TODO: enable when action update mode is properly sorted
                    //EditorGUILayout.PropertyField(m_ActionUpdateMode);
                }

                ////TODO: enable when backported
                //EditorGUILayout.PropertyField(m_TimesliceEvents);

                EditorGUILayout.PropertyField(m_FilterNoiseOnCurrent);
                EditorGUILayout.PropertyField(m_CompensateForScreenOrientation);

                EditorGUILayout.Space();
                EditorGUILayout.Separator();
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(m_DefaultDeadzoneMin);
                EditorGUILayout.PropertyField(m_DefaultDeadzoneMax);
                EditorGUILayout.PropertyField(m_DefaultButtonPressPoint);
                EditorGUILayout.PropertyField(m_DefaultTapTime);
                EditorGUILayout.PropertyField(m_DefaultSlowTapTime);
                EditorGUILayout.PropertyField(m_DefaultHoldTime);

                EditorGUILayout.Space();
                EditorGUILayout.Separator();
                EditorGUILayout.Space();

                EditorGUILayout.HelpBox("Leave 'Supported Devices' empty if you want the input system to support all input devices it can recognize. If, however, "
                                        + "you are only interested in a certain set of devices, adding them here will narrow the scope of what's presented in the editor "
                                        + "and avoid picking up input from devices not relevant to the project.", MessageType.None);

                m_SupportedDevices.DoLayoutList();

                if (EditorGUI.EndChangeCheck())
                {
                    Apply();
                }
            }
        }
コード例 #21
0
        void OnGUI()
        {
            EditorGUIUtility.labelWidth = 100;
            using (var ds = new EditorGUI.DisabledScope(PackageUtils.isBusy))
            {
                using (var ccs = new EditorGUI.ChangeCheckScope())
                    using (new EditorGUILayout.HorizontalScope())
                    {
                        GUI.SetNextControlName("Repogitory URL");
                        _url = EditorGUILayout.TextField("Repogitory URL", _url);

                        if (!_focused)
                        {
                            EditorGUI.FocusTextInControl("Repogitory URL");
                            _focused = true;
                        }

                        if (ccs.changed)
                        {
                            _repoUrl   = PackageUtils.GetRepoUrl(_url);
                            _version   = "-- Select Version --";
                            _packageId = "";
                            GitUtils.GetRefs(_url, _refs, () => { EditorApplication.delayCall += Repaint; });
                        }

                        if (!PackageUtils.isBusy && !string.IsNullOrEmpty(_url) && _refs.Count == 0)
                        {
                            GUILayout.Label(_errorUrl, GUILayout.Width(20));
                        }
                    }

                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.PrefixLabel("Version");
                    using (new EditorGUI.DisabledScope(_refs.Count == 0))
                    {
                        if (GUILayout.Button(_version, EditorStyles.popup))
                        {
                            PopupVersions(ver =>
                            {
                                _version   = _refs.Contains(ver) ? ver : "HEAD";
                                _packageId = "";
                                GitUtils.GetPackageJson(_url, _version, name =>
                                {
                                    _packageId = string.IsNullOrEmpty(name)
                                                                                ? null
                                                                                : name + "@" + _repoUrl + "#" + _version;
                                    EditorApplication.delayCall += Repaint;
                                });
                            });
                        }
                    }
                    using (new EditorGUI.DisabledScope(string.IsNullOrEmpty(_packageId)))
                    {
                        if (GUILayout.Button(new GUIContent("Add", "Add a package '" + _packageId + "' to the project."), EditorStyles.miniButton, GUILayout.Width(60)))
                        {
                            PackageUtils.AddPackage(_packageId, req =>
                            {
                                if (req.Status == StatusCode.Success)
                                {
                                    Close();
                                }
                            });
                        }
                    }
                    if (_packageId == null)
                    {
                        GUILayout.Label(_errorBranch, GUILayout.Width(20));
                    }
                }
            }
        }
コード例 #22
0
 public DisabledScopeCompat(bool disabled)
 {
     m_target = new EditorGUI.DisabledScope(disabled);
 }
コード例 #23
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        if (atlasProperty != null)
        {
            using (EditorGUILayout.HorizontalScope horizontalScope = new EditorGUILayout.HorizontalScope()) {
                if (GUILayout.Button("Atlas", "DropDown", GUILayout.Width(EditorGUIUtility.labelWidth - 10)) == true)
                {
                    AtlasSelector.Show(null, OnDoubleClickAtlas, atlasProperty.objectReferenceValue as UGUIAtlas);
                }
                //绘制图集属性
                UGUIAtlas selectedAtlas = EditorGUILayout.ObjectField(atlasProperty.objectReferenceValue, typeof(UGUIAtlas), true) as UGUIAtlas;
                if (selectedAtlas != atlasProperty.objectReferenceValue)
                {
                    atlasProperty.objectReferenceValue  = selectedAtlas;
                    spriteProperty.objectReferenceValue = null;
                    serializedObject.ApplyModifiedProperties();
                }
            }


            using (EditorGUILayout.HorizontalScope horizontalScope = new EditorGUILayout.HorizontalScope()) {
                var atlas = atlasProperty.objectReferenceValue as UGUIAtlas;
                if (atlas != null)
                {
                    if (GUILayout.Button("Sprite", "DropDown", GUILayout.Width(EditorGUIUtility.labelWidth - 10)) == true)
                    {
                        AtlasSpriteSelector.Show(atlas, OnClickSprite, OnDoubleClickSprite, spriteProperty.objectReferenceValue as Sprite);
                    }
                }
                else
                {
                    GUILayout.Label("Sprite", GUILayout.Width(EditorGUIUtility.labelWidth - 10));
                }

                using (EditorGUI.DisabledScope disableGroup = new EditorGUI.DisabledScope(atlas != null)) {
                    using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) {
                        EditorGUILayout.PropertyField(spriteProperty, new GUIContent(""));

                        if (changeCheckScope.changed == true)
                        {
                            var newSprite = spriteProperty.objectReferenceValue as Sprite;
                            if (newSprite)
                            {
                                Image.Type oldType = (Image.Type)typeProperty.enumValueIndex;
                                if (newSprite.border.SqrMagnitude() > 0)
                                {
                                    typeProperty.enumValueIndex = (int)Image.Type.Sliced;
                                }
                                else if (oldType == Image.Type.Sliced)
                                {
                                    typeProperty.enumValueIndex = (int)Image.Type.Simple;
                                }
                            }
                        }
                        serializedObject.ApplyModifiedProperties();
                    }
                }
            }

            AppearanceControlsGUI();
            RaycastControlsGUI();

            showType.target = spriteProperty.objectReferenceValue != null;
            if (EditorGUILayout.BeginFadeGroup(showType.faded))
            {
                TypeGUI();
            }
            EditorGUILayout.EndFadeGroup();

            SetShowNativeSize(true, true);
            if (EditorGUILayout.BeginFadeGroup(m_ShowNativeSize.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(preserveAspectProperty);
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();

            NativeSizeButtonGUI();
            serializedObject.ApplyModifiedProperties();
        }
    }
コード例 #24
0
 public SettingsDisableScope(bool enable)
 {
     scope = new EditorGUI.DisabledScope(!enable);
 }
コード例 #25
0
        void OnGUI()
        {
            EditorGUILayout.LabelField("Tutorial:", EditorStyles.boldLabel);
            m_Tutorial = (Tutorial)EditorGUILayout.ObjectField(m_Tutorial, typeof(Tutorial), false);

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            m_IncludeAllScripts = EditorGUILayout.ToggleLeft("Include all scripts", m_IncludeAllScripts);
            m_IncludeAllShaders = EditorGUILayout.ToggleLeft("Include all shaders", m_IncludeAllShaders);

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Additional folders to include:", EditorStyles.boldLabel);
            if (GUILayout.Button("add", GUILayout.Width(80)))
            {
                var path = EditorUtility.OpenFolderPanel("Select additional folders to include", "Assets", "");
                if (!string.IsNullOrEmpty(path))
                {
                    path = Path.GetFullPath(path);
                    m_AdditionalDirectories.Add(path);
                }
            }
            EditorGUILayout.EndHorizontal();

            foreach (var path in m_AdditionalDirectories)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(MakePathRelative(path));
                if (GUILayout.Button("remove", GUILayout.Width(80)))
                {
                    m_AdditionalDirectories.Remove(path);
                    GUIUtility.ExitGUI();
                    return;
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            m_AutoOpen = EditorGUILayout.ToggleLeft("Open project with exported package when done", m_AutoOpen);

            using (var disabledScope = new EditorGUI.DisabledScope(m_Tutorial == null || TutorialExporter.exportInProgress))
            {
                var buttonText = "Export package";
                if (m_Tutorial == null)
                {
                    buttonText += " (No tutorial selected)";
                }
                else if (TutorialExporter.exportInProgress)
                {
                    buttonText += " (Export in progress)";
                }

                if (GUILayout.Button(buttonText))
                {
                    ExportTutorial();
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            var forceDisableMask = EditorPrefs.GetBool("Unity.Tutorials.Core.Editor.forceDisableMask", false);

            EditorGUI.BeginChangeCheck();
            forceDisableMask = EditorGUILayout.ToggleLeft("Force Disable Masking in this machine", forceDisableMask);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool("Unity.Tutorials.Core.Editor.forceDisableMask", forceDisableMask);
            }
        }
コード例 #26
0
	public override void OnInspectorGUI()
	{
		_movie = (this.target) as AVProWindowsMediaMovie;

		EditorGUILayout.Separator();
		GUILayout.Label("File Location", EditorStyles.boldLabel);
		//DrawDefaultInspector();

		_movie._useStreamingAssetsPath = EditorGUILayout.Toggle("Use StreamingAssets", _movie._useStreamingAssetsPath);
		_movie._folder = EditorGUILayout.TextField("Folder", _movie._folder);
		_movie._filename = EditorGUILayout.TextField("Filename", _movie._filename);

		GUILayout.BeginHorizontal();
		GUI.enabled = System.IO.File.Exists(_movie.GetFilePath());
		
#if UNITY_EDITOR_WIN
		if (GUILayout.Button("Show"))
		{
			ShowInExplorer(_movie.GetFilePath());
		}
#endif
		GUI.enabled &= _movie._useStreamingAssetsPath;

		if (GUILayout.Button("Select"))
		{
			string projectRoot = System.IO.Path.GetFullPath(System.IO.Path.Combine(Application.dataPath, ".."));
			projectRoot = projectRoot.Replace('\\', '/');

			string path = _movie.GetFilePath();
			path = path.Remove(0, projectRoot.Length + 1);
					
			Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(path);
		}
		GUILayout.EndHorizontal();
		GUI.enabled = true;

		GUI.color = Color.green;
		if (GUILayout.Button("BROWSE"))
		{
			Browse(Application.streamingAssetsPath, ref _movie._filename, ref _movie._folder, ref _movie._useStreamingAssetsPath);
		}
		GUI.color = Color.white;

		if (string.IsNullOrEmpty(_movie.GetFilePath()))
		{
			if (_movie._loadOnStart)
			{
				GUI.color = Color.red;
				GUILayout.TextArea("Error: No file specfied");
				GUI.color = Color.white;
			}
			else
			{
				GUI.color = Color.yellow;
				GUILayout.TextArea("Warning: No file specfied");
				GUI.color = Color.white;
			}
		}
		else if (!System.IO.File.Exists(_movie.GetFilePath()))
		{
			GUI.color = Color.red;
			GUILayout.TextArea("Error: File not found");
			GUI.color = Color.white;
		}
		else
		{
			if (!_movie._useStreamingAssetsPath)
			{
				GUI.color = Color.yellow;
				GUILayout.TextArea("Warning: Files not in StreamingAssets will require manual copying for builds");
				GUI.color = Color.white;
			}
		}
		if (System.IO.Path.IsPathRooted(_movie._folder))
		{
			GUI.color = Color.yellow;
			GUILayout.TextArea("Warning: Absolute path is not ideal.  Better to use files relative to the project root");
			GUI.color = Color.white;
		}

		GUILayout.Space(10f);

		EditorGUILayout.Separator();
		GUILayout.Label("Load Options", EditorStyles.boldLabel);
		
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("Colour Format");
		_movie._colourFormat = (AVProWindowsMediaMovie.ColourFormat)EditorGUILayout.EnumPopup(_movie._colourFormat);
		EditorGUILayout.EndHorizontal();
		_movie._useDisplaySync = EditorGUILayout.Toggle("Use Display Sync", _movie._useDisplaySync);

		if (_movie._useDisplaySync)
		{
			if (
#if UNITY_5
				PlayerSettings.d3d11FullscreenMode != D3D11FullscreenMode.ExclusiveMode || 
#endif
				PlayerSettings.d3d9FullscreenMode != D3D9FullscreenMode.ExclusiveMode)
			{
				GUI.color = Color.cyan;
				GUILayout.TextArea("Perf: For display sync fullscreen mode should be set to EXCLUSIVE in Player Settings");
				GUI.color = Color.white;
			}
			if (QualitySettings.vSyncCount != 1 && QualitySettings.vSyncCount != 2)
			{
				GUI.color = Color.cyan;
				GUILayout.TextArea("Perf: For display sync vsync must be set to 1 or 2 in Quality Settings");
				GUI.color = Color.white;
			}
		}

		_movie._allowAudio = EditorGUILayout.Toggle("Allow Audio", _movie._allowAudio);
		GUI.enabled = _movie._allowAudio;
		{
			_movie._useAudioDelay = EditorGUILayout.Toggle("Use Audio Delay", _movie._useAudioDelay);
			_movie._useAudioMixer = EditorGUILayout.Toggle("Use Audio Mixer", _movie._useAudioMixer);
		}
		GUI.enabled = true;

		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("Texture Filter");
		_movie._textureFilterMode = (FilterMode)EditorGUILayout.EnumPopup(_movie._textureFilterMode);
		EditorGUILayout.EndHorizontal();
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("Texture Wrap");
		_movie._textureWrapMode = (TextureWrapMode)EditorGUILayout.EnumPopup(_movie._textureWrapMode);
		EditorGUILayout.EndHorizontal();

		EditorGUILayout.Separator();
		EditorGUILayout.Separator();
		EditorGUILayout.LabelField("Start Options", EditorStyles.boldLabel);
		_movie._loadOnStart = EditorGUILayout.Toggle("Load On Start", _movie._loadOnStart);
		GUI.enabled = _movie._loadOnStart;
		if (!_movie._loadOnStart)
			_movie._playOnStart = false;
		_movie._playOnStart = EditorGUILayout.Toggle("Play On Start", _movie._playOnStart);
		GUI.enabled = true;
		EditorGUILayout.Separator();
		EditorGUILayout.Separator();

		EditorGUILayout.Separator();
		EditorGUILayout.Separator();
		EditorGUILayout.LabelField("Performance", EditorStyles.boldLabel);
		_movie._ignoreFlips = EditorGUILayout.Toggle("Ignore Flips", _movie._ignoreFlips);
		EditorGUILayout.Separator();
		EditorGUILayout.Separator();

		EditorGUILayout.Separator();
		GUILayout.Label("Playback", EditorStyles.boldLabel);

		_movie._loop = EditorGUILayout.Toggle("Loop", _movie._loop);
		//_movie._editorPreview = EditorGUILayout.Toggle("Editor Preview", _movie._editorPreview);		

		GUI.enabled = _movie._allowAudio;
		{
			EditorGUILayout.BeginHorizontal();
			EditorGUILayout.PrefixLabel("Audio Volume");
			_movie._volume = EditorGUILayout.Slider(_movie._volume, 0.0f, 1.0f);
			EditorGUILayout.EndHorizontal();

			
			EditorGUILayout.BeginHorizontal();
			EditorGUILayout.PrefixLabel("Audio Balance");
			_movie._audioBalance = EditorGUILayout.Slider(_movie._audioBalance, -1.0f, 1.0f);
			EditorGUILayout.EndHorizontal();
		}
		GUI.enabled = true;
		
		GUILayout.Space(8.0f);

        SerializedProperty tps = serializedObject.FindProperty("_clips");
        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(tps, new GUIContent("Clips"), true);
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }

        GUILayout.Space(8.0f);

		if (!Application.isPlaying)
		{
			EditorGUILayout.BeginHorizontal();
			if (GUILayout.Button("Load"))
			{
				if (AVProWindowsMediaManager.Instance != null)
				{
					_movie.LoadMovie(_movie._playOnStart);
				}
			}

#if UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3
			using (var scope = new EditorGUI.DisabledScope(_movie.MovieInstance == null))
#else
			EditorGUI.BeginDisabledGroup(_movie.MovieInstance == null);
#endif
			{
				if (GUILayout.Button("Unload"))
				{
					_movie.UnloadMovie();
				}
			}
#if UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3
#else
			EditorGUI.EndDisabledGroup();
#endif

			EditorGUILayout.EndHorizontal();
		}

		AVProWindowsMedia media = _movie.MovieInstance;
		if (media != null)
		{
			GUI.enabled = (_movie != null && _movie.MovieInstance != null);
            _movie._editorPreview = EditorGUILayout.Foldout(_movie._editorPreview, "Video Preview");
			GUI.enabled = true;

            if (_movie._editorPreview && _movie.MovieInstance != null)
			{
				{
					Texture texture = _movie.OutputTexture;
					if (texture == null)
						texture = EditorGUIUtility.whiteTexture;

					float ratio = (float)texture.width / (float)texture.height;


					GUILayout.BeginHorizontal();
					GUILayout.FlexibleSpace();
					Rect textureRect = GUILayoutUtility.GetRect(Screen.width/2, Screen.width/2, (Screen.width / 2) / ratio, (Screen.width / 2) / ratio);
					GUILayout.FlexibleSpace();
					GUILayout.EndHorizontal();

					GUILayout.BeginHorizontal();
					GUILayout.FlexibleSpace();
					_showAlpha = GUILayout.Toggle(_showAlpha, "Show Alpha Channel");
					GUILayout.FlexibleSpace();
					GUILayout.EndHorizontal();
					 
					Matrix4x4 prevMatrix = GUI.matrix;
					if (_movie.MovieInstance.RequiresFlipY)
					{
						GUIUtility.ScaleAroundPivot(new Vector2(1f, -1f), new Vector2(0, textureRect.y + (textureRect.height / 2)));
					}

					if (!_showAlpha)
						GUI.DrawTexture(textureRect, texture, ScaleMode.ScaleToFit);
					else
						EditorGUI.DrawTextureAlpha(textureRect, texture, ScaleMode.ScaleToFit);

					GUI.matrix = prevMatrix;
				
					GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
					GUILayout.FlexibleSpace();
					if (GUILayout.Button("Select Texture", GUILayout.ExpandWidth(false)))
					{
						Selection.activeObject = texture;
					}
					GUILayout.FlexibleSpace();
					GUILayout.EndHorizontal();

					GUILayout.BeginHorizontal();
					GUILayout.FlexibleSpace();
					GUILayout.Label(string.Format("{0}x{1} @ {2}fps {3} secs", media.Width, media.Height, media.FrameRate.ToString("F2"), media.DurationSeconds.ToString("F2")));		
					GUILayout.FlexibleSpace();
					GUILayout.EndHorizontal();

					GUILayout.BeginHorizontal();
					GUILayout.FlexibleSpace();
					if (media.FramesTotal > 30)
					{
						GUILayout.Label("Displaying at " + media.DisplayFPS.ToString("F1") + " fps");
					}
					else
					{
						GUILayout.Label("Displaying at ... fps");	
					}
					GUILayout.FlexibleSpace();
					GUILayout.EndHorizontal();
				}

				if (_movie.enabled)
				{
					GUILayout.Space(8.0f);

					EditorGUILayout.LabelField("Frame:");
					EditorGUILayout.BeginHorizontal();
					if (GUILayout.Button("<", GUILayout.ExpandWidth(false)))
					{
						media.PositionFrames--;
					}
					uint currentFrame = media.PositionFrames;
					if (currentFrame != uint.MaxValue)
					{
						int newFrame = EditorGUILayout.IntSlider((int)currentFrame, 0, (int)media.LastFrame);
						if (newFrame != currentFrame)
						{
							media.PositionFrames = (uint)newFrame;
						}
					}
					if (GUILayout.Button(">", GUILayout.ExpandWidth(false)))
					{
						media.PositionFrames++;
					}
					EditorGUILayout.EndHorizontal();

                    if (_movie.NumClips > 0)
                    {
                        EditorGUILayout.Separator();
                        EditorGUILayout.LabelField("Clips", EditorStyles.boldLabel);
                        for (int i = 0; i < _movie.NumClips; i++)
                        {
                            GUILayout.BeginHorizontal();
                            string clipName = _movie.GetClipName(i);
                            GUILayout.Label(clipName);
                            if (GUILayout.Button("Loop"))
                            {
                                _movie.PlayClip(clipName, true, false);
                            }
                            GUILayout.EndHorizontal();
                        }
                        if (GUILayout.Button("Reset Clip"))
                            _movie.ResetClip();
                        EditorGUILayout.Separator();
                    }

					EditorGUILayout.BeginHorizontal();
					if (GUILayout.Button("Rewind"))
					{
						_movie.MovieInstance.Rewind();
					}

					if (!media.IsPlaying)
					{
						if (GUILayout.Button("Play"))
						{
							_movie.Play();
						}						
					}
					else
					{
						if (GUILayout.Button("Pause"))
						{
							_movie.Pause();
						}
					}
					EditorGUILayout.EndHorizontal();

#if !AVPROWINDOWSMEDIA_UNITYFEATURE_EDITORAUTOREFRESH
					this.Repaint();
#endif
				}
			}
        }
		if (GUI.changed)
		{
			EditorUtility.SetDirty(_movie);
		}

        // If the app isn't running but the media is we may need to manually update it
        if (!Application.isPlaying && _movie.MovieInstance != null)
        {
            _movie.Update();
            AVProWindowsMediaManager.Instance.Update();
            EditorUtility.SetDirty(_movie);
        }
	}