Exemple #1
0
        private void DrawSelectedInstanceIdList()
        {
            if (!this.CanDrawSelectedInstanceIdList)
            {
                return;
            }

            using (var scrollView = new GUILayout.ScrollViewScope(this.scrollPosition))
            {
                using (var iconSize = new EditorGUIUtility.IconSizeScope(Vector2.one * 14))
                {
                    for (var i = 0; i < this.instanceIds.Count; i++)
                    {
                        this.DrawChangeSelectionButton(i);
                    }
                }

                this.scrollPosition = scrollView.scrollPosition;
            }
        }
Exemple #2
0
        void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect.height = EditorGUIUtility.singleLineHeight;
            rect.y     += 1;

            (Camera camera, UniversalRenderPipelineSerializedCamera serializedCamera)overlayCamera = m_SerializedCamera[index];
            Camera cam = overlayCamera.camera;

            if (cam != null)
            {
                bool typeError = false;
                var  type      = cam.gameObject.GetComponent <UniversalAdditionalCameraData>().renderType;
                if (type != CameraRenderType.Overlay)
                {
                    typeError = true;
                    if (!m_TypeErrorCameras.Contains(cam))
                    {
                        m_TypeErrorCameras.Add(cam);
                    }
                }
                else if (m_TypeErrorCameras.Contains(cam))
                {
                    m_TypeErrorCameras.Remove(cam);
                }

                bool outputWarning = false;
                if (IsStackCameraOutputDirty(cam, overlayCamera.serializedCamera))
                {
                    outputWarning = true;
                    if (!m_OutputWarningCameras.Contains(cam))
                    {
                        m_OutputWarningCameras.Add(cam);
                    }
                }
                else if (m_OutputWarningCameras.Contains(cam))
                {
                    m_OutputWarningCameras.Remove(cam);
                }

                GUIContent nameContent =
                    outputWarning ?
                    EditorGUIUtility.TrTextContent(cam.name, "Output properties do not match base camera", CoreEditorStyles.iconWarn) :
                    EditorGUIUtility.TrTextContent(cam.name);

                GUIContent typeContent =
                    typeError ?
                    EditorGUIUtility.TrTextContent(type.GetName(), "Not a supported type", CoreEditorStyles.iconFail) :
                    EditorGUIUtility.TrTextContent(type.GetName());

                EditorGUI.BeginProperty(rect, GUIContent.none, m_SerializedCamera.cameras.GetArrayElementAtIndex(index));
                var labelWidth = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth -= 20f;

                using (var iconSizeScope = new EditorGUIUtility.IconSizeScope(new Vector2(rect.height, rect.height)))
                {
                    EditorGUI.LabelField(rect, nameContent, typeContent);
                }

                // Printing if Post Processing is on or not.
                var isPostActive = cam.gameObject.GetComponent <UniversalAdditionalCameraData>().renderPostProcessing;
                if (isPostActive)
                {
                    Rect selectRect = new Rect(rect.width - 20, rect.y, 50, EditorGUIUtility.singleLineHeight);

                    EditorGUI.LabelField(selectRect, "PP");
                }
                EditorGUI.EndProperty();

                EditorGUIUtility.labelWidth = labelWidth;
            }
            else
            {
                camera.GetComponent <UniversalAdditionalCameraData>().UpdateCameraStack();

                // Need to clean out the errorCamera list here.
                m_TypeErrorCameras.Clear();
                m_OutputWarningCameras.Clear();
            }
        }