Ejemplo n.º 1
0
        //[MenuItem("Window/Waveform Monitor")]
        public static void OpenWindow()
        {
            WaveformWindow window = EditorWindow.GetWindow <WaveformWindow>(false);

            window.autoRepaintOnSceneChange = true;
            //window.position = new Rect(100, 100, 400, 400);
            window.Show(true);
        }
        public override void OnInspectorGUI()
        {
            float now = Time.realtimeSinceStartup;

            if (now - mLastSplitScreenEventTime > FastWaveformUpdateInterval * 5)
            {
                WaveformWindow.SetDefaultUpdateInterval();
            }

            BeginInspector();
            CinemachineStoryboardMute.Enabled
                = EditorGUILayout.Toggle(
                      new GUIContent(
                          "Storyboard Global Mute",
                          "If checked, all storyboards are globally muted."),
                      CinemachineStoryboardMute.Enabled);

            Rect rect = EditorGUILayout.GetControlRect(true);

            EditorGUI.BeginChangeCheck();
            {
                float width = rect.width;
                rect.width = EditorGUIUtility.labelWidth + rect.height;
                EditorGUI.PropertyField(rect, FindProperty(x => x.m_ShowImage));

                rect.x += rect.width; rect.width = width - rect.width;
                EditorGUI.PropertyField(rect, FindProperty(x => x.m_Image), GUIContent.none);

                EditorGUILayout.PropertyField(FindProperty(x => x.m_Aspect));
                EditorGUILayout.PropertyField(FindProperty(x => x.m_Alpha));
                EditorGUILayout.PropertyField(FindProperty(x => x.m_Center));
                EditorGUILayout.PropertyField(FindProperty(x => x.m_Rotation));

                rect = EditorGUILayout.GetControlRect(true);
                EditorGUI.LabelField(rect, "Scale");
                rect.x     += EditorGUIUtility.labelWidth; rect.width -= EditorGUIUtility.labelWidth;
                rect.width /= 3;
                var        prop      = FindProperty(x => x.m_SyncScale);
                GUIContent syncLabel = new GUIContent("Sync", prop.tooltip);
                prop.boolValue = EditorGUI.ToggleLeft(rect, syncLabel, prop.boolValue);
                rect.x        += rect.width;
                if (prop.boolValue)
                {
                    prop = FindProperty(x => x.m_Scale);
                    float[] values = new float[1] {
                        prop.vector2Value.x
                    };
                    EditorGUI.MultiFloatField(rect, new GUIContent[1] {
                        new GUIContent("X")
                    }, values);
                    prop.vector2Value = new Vector2(values[0], values[0]);
                }
                else
                {
                    rect.width *= 2;
                    EditorGUI.PropertyField(rect, FindProperty(x => x.m_Scale), GUIContent.none);
                }
                EditorGUILayout.PropertyField(FindProperty(x => x.m_MuteCamera));
            }
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }

            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(FindProperty(x => x.m_SplitView));
            if (EditorGUI.EndChangeCheck())
            {
                mLastSplitScreenEventTime     = now;
                WaveformWindow.UpdateInterval = FastWaveformUpdateInterval;
                serializedObject.ApplyModifiedProperties();
            }
            rect = EditorGUILayout.GetControlRect(true);
            GUI.Label(new Rect(rect.x, rect.y, EditorGUIUtility.labelWidth, rect.height),
                      "Waveform Monitor");
            rect.width -= EditorGUIUtility.labelWidth; rect.width /= 2;
            rect.x     += EditorGUIUtility.labelWidth;
            if (GUI.Button(rect, "Open"))
            {
                WaveformWindow.OpenWindow();
            }
        }
 public void OnDisable()
 {
     WaveformWindow.SetDefaultUpdateInterval();
 }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            float now = Time.realtimeSinceStartup;

            if (now - mLastSplitScreenEventTime > FastWaveformUpdateInterval * 5)
            {
                WaveformWindow.SetDefaultUpdateInterval();
            }

            BeginInspector();
            CinemachineStoryboardMute.Enabled
                = EditorGUILayout.Toggle(
                      new GUIContent(
                          "Storyboard Global Mute",
                          "If checked, all storyboards are globally muted."),
                      CinemachineStoryboardMute.Enabled);

            Rect rect = EditorGUILayout.GetControlRect(true);

            EditorGUI.BeginChangeCheck();
            {
                float width = rect.width;
                rect.width = EditorGUIUtility.labelWidth + rect.height;
                EditorGUI.PropertyField(rect, FindProperty(x => x.m_ShowImage));

                rect.x += rect.width; rect.width = width - rect.width;
                EditorGUI.PropertyField(rect, FindProperty(x => x.m_Image), GUIContent.none);

                EditorGUILayout.PropertyField(FindProperty(x => x.m_Aspect));
                EditorGUILayout.PropertyField(FindProperty(x => x.m_Alpha));
                EditorGUILayout.PropertyField(FindProperty(x => x.m_Center));
                EditorGUILayout.PropertyField(FindProperty(x => x.m_Rotation));

                rect = EditorGUILayout.GetControlRect(true);
                EditorGUI.LabelField(rect, "Scale");
                rect.x     += EditorGUIUtility.labelWidth; rect.width -= EditorGUIUtility.labelWidth;
                rect.width /= 3;
                serializedObject.SetIsDifferentCacheDirty(); // prop.hasMultipleDifferentValues always results in false if the SO isn't refreshed here
                var        prop = FindProperty(x => x.m_SyncScale);
                var        syncHasDifferentValues = prop.hasMultipleDifferentValues;
                GUIContent syncLabel = new GUIContent("Sync", prop.tooltip);
                EditorGUI.showMixedValue = syncHasDifferentValues;
                prop.boolValue           = EditorGUI.ToggleLeft(rect, syncLabel, prop.boolValue);
                EditorGUI.showMixedValue = false;
                rect.x += rect.width;
                if (prop.boolValue || targets.Length > 1 && syncHasDifferentValues)
                {
                    prop = FindProperty(x => x.m_Scale);
                    float[] values = new float[1] {
                        prop.vector2Value.x
                    };
                    EditorGUI.showMixedValue = prop.hasMultipleDifferentValues;
                    EditorGUI.MultiFloatField(rect, new GUIContent[1] {
                        new GUIContent("X")
                    }, values);
                    EditorGUI.showMixedValue = false;
                    prop.vector2Value        = new Vector2(values[0], values[0]);
                }
                else
                {
                    rect.width *= 2;
                    prop        = FindProperty(x => x.m_Scale);
                    EditorGUI.showMixedValue = prop.hasMultipleDifferentValues;
                    EditorGUI.PropertyField(rect, prop, GUIContent.none);
                    EditorGUI.showMixedValue = false;
                }
                EditorGUILayout.PropertyField(FindProperty(x => x.m_MuteCamera));
            }
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }

            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(FindProperty(x => x.m_SplitView));
            if (EditorGUI.EndChangeCheck())
            {
                mLastSplitScreenEventTime     = now;
                WaveformWindow.UpdateInterval = FastWaveformUpdateInterval;
                serializedObject.ApplyModifiedProperties();
            }
            rect = EditorGUILayout.GetControlRect(true);
            GUI.Label(new Rect(rect.x, rect.y, EditorGUIUtility.labelWidth, rect.height),
                      "Waveform Monitor");
            rect.width -= EditorGUIUtility.labelWidth; rect.width /= 2;
            rect.x     += EditorGUIUtility.labelWidth;
            if (GUI.Button(rect, "Open"))
            {
                WaveformWindow.OpenWindow();
            }

            EditorGUILayout.Space();
            sAdvancedFoldout = EditorGUILayout.Foldout(sAdvancedFoldout, "Advanced");
            if (sAdvancedFoldout)
            {
                ++EditorGUI.indentLevel;

                EditorGUI.BeginChangeCheck();
                var renderModeProperty = FindProperty(x => x.m_RenderMode);
                EditorGUILayout.PropertyField(renderModeProperty);
                EditorGUILayout.PropertyField(FindProperty(x => x.m_SortingOrder));
                if (renderModeProperty.enumValueIndex == (int)RenderMode.ScreenSpaceCamera)
                {
                    EditorGUILayout.PropertyField(FindProperty(x => x.m_PlaneDistance));
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                --EditorGUI.indentLevel;
            }
        }