示例#1
0
        public override void OnInspectorGUI()
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }

            serializedObject.Update();

            EditorGUILayout.PropertyField(m_DataSource, s_Styles.dataSourceContent);
            HandleDataSourceField();
            EditorGUILayout.PropertyField(m_PlayOnAwake, s_Styles.playOnAwakeContent);
            EditorGUILayout.PropertyField(m_WaitForFirstFrame, s_Styles.waitForFirstFrameContent);
            EditorGUILayout.PropertyField(m_Looping, s_Styles.loopContent);
            EditorGUILayout.Slider(m_PlaybackSpeed, 0.0f, 10.0f, s_Styles.playbackSpeedContent);
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(m_RenderMode, s_Styles.renderModeContent);
            if (m_RenderMode.hasMultipleDifferentValues)
            {
                EditorGUILayout.HelpBox(s_Styles.selectUniformVideoRenderModeHelp, MessageType.Warning, false);
            }
            else
            {
                VideoRenderMode currentRenderMode = (VideoRenderMode)m_RenderMode.intValue;
                HandleTargetField(currentRenderMode);
            }
            HandleAudio();

            serializedObject.ApplyModifiedProperties();
        }
示例#2
0
 public override void OnInspectorGUI()
 {
     if (VideoPlayerEditor.s_Styles == null)
     {
         VideoPlayerEditor.s_Styles = new VideoPlayerEditor.Styles();
     }
     base.serializedObject.Update();
     EditorGUILayout.PropertyField(this.m_DataSource, VideoPlayerEditor.s_Styles.dataSourceContent, new GUILayoutOption[0]);
     this.HandleDataSourceField();
     EditorGUILayout.PropertyField(this.m_PlayOnAwake, VideoPlayerEditor.s_Styles.playOnAwakeContent, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_WaitForFirstFrame, VideoPlayerEditor.s_Styles.waitForFirstFrameContent, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_Looping, VideoPlayerEditor.s_Styles.loopContent, new GUILayoutOption[0]);
     EditorGUILayout.Slider(this.m_PlaybackSpeed, 0f, 10f, VideoPlayerEditor.s_Styles.playbackSpeedContent, new GUILayoutOption[0]);
     EditorGUILayout.Space();
     EditorGUILayout.PropertyField(this.m_RenderMode, VideoPlayerEditor.s_Styles.renderModeContent, new GUILayoutOption[0]);
     if (this.m_RenderMode.hasMultipleDifferentValues)
     {
         EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.selectUniformVideoRenderModeHelp, MessageType.Warning, false);
     }
     else
     {
         VideoRenderMode intValue = (VideoRenderMode)this.m_RenderMode.intValue;
         this.HandleTargetField(intValue);
     }
     this.HandleAudio();
     base.serializedObject.ApplyModifiedProperties();
 }
示例#3
0
 public void SetRenderMode(VideoRenderMode mode)
 {
     if (m_VideoPlayer == null)
     {
         Log.Debug("Video Player is Null !!!!!");
         return;
     }
     m_VideoPlayer.renderMode = mode;
 }
示例#4
0
        private void HandleTargetField(VideoRenderMode currentRenderMode)
        {
            m_ShowRenderTexture.target = currentRenderMode == VideoRenderMode.RenderTexture;
            if (EditorGUILayout.BeginFadeGroup(m_ShowRenderTexture.faded))
            {
                EditorGUILayout.PropertyField(m_TargetTexture, s_Styles.textureContent);
            }
            EditorGUILayout.EndFadeGroup();

            m_ShowTargetCamera.target = (currentRenderMode == VideoRenderMode.CameraFarPlane) ||
                                        (currentRenderMode == VideoRenderMode.CameraNearPlane);
            if (EditorGUILayout.BeginFadeGroup(m_ShowTargetCamera.faded))
            {
                EditorGUILayout.PropertyField(m_TargetCamera, s_Styles.cameraContent);
                EditorGUILayout.Slider(m_TargetCameraAlpha, 0.0f, 1.0f, s_Styles.alphaContent);
                // If VR is enabled in PlayerSettings on ANY platform, show the 3D layout option
                foreach (BuildPlatform cur in BuildPlatforms.instance.buildPlatforms)
                {
                    if (UnityEditorInternal.VR.VREditor.GetVREnabledOnTargetGroup(cur.targetGroup))
                    {
                        EditorGUILayout.PropertyField(m_TargetCamera3DLayout, s_Styles.camera3DLayout);
                        break;
                    }
                }
            }
            EditorGUILayout.EndFadeGroup();

            m_ShowRenderer.target = currentRenderMode == VideoRenderMode.MaterialOverride;
            if (EditorGUILayout.BeginFadeGroup(m_ShowRenderer.faded))
            {
                bool hasMultipleSelection = targets.Count() > 1;
                if (hasMultipleSelection)
                {
                    EditorGUILayout.PropertyField(m_TargetMaterialRenderer, s_Styles.materialRendererContent);
                }
                else
                {
                    Rect       rect  = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight);
                    GUIContent label = EditorGUI.BeginProperty(
                        rect, s_Styles.materialRendererContent, m_TargetMaterialRenderer);
                    EditorGUI.BeginChangeCheck();
                    var newRenderer = EditorGUI.ObjectField(
                        rect, label, GetTargetRenderer((VideoPlayer)target), typeof(Renderer), true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_TargetMaterialRenderer.objectReferenceValue = newRenderer;
                    }
                    EditorGUI.EndProperty();
                }

                int curHash = GetMaterialPropertyPopupHash(targets);
                if (m_MaterialPropertyPopupContentHash != curHash)
                {
                    m_MaterialPropertyPopupContent = BuildPopupEntries(
                        targets, GetMaterialPropertyNames, out m_MaterialPropertyPopupSelection,
                        out m_MaterialPropertyPopupInvalidSelections);
                }
                HandlePopup(s_Styles.materialPropertyContent, m_TargetMaterialProperty, m_MaterialPropertyPopupContent, m_MaterialPropertyPopupSelection);
                if (m_MaterialPropertyPopupInvalidSelections > 0 || m_MaterialPropertyPopupContent.Length == 0)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(EditorGUIUtility.labelWidth);
                    if (m_MaterialPropertyPopupContent.Length == 0)
                    {
                        if (!hasMultipleSelection)
                        {
                            EditorGUILayout.HelpBox(s_Styles.rendererMaterialsHaveNoTexPropsHelp, MessageType.Warning);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox(s_Styles.someRendererMaterialsHaveNoTexPropsHelp, MessageType.Warning);
                        }
                    }
                    else if (!hasMultipleSelection)
                    {
                        EditorGUILayout.HelpBox(s_Styles.invalidTexPropSelectionHelp, MessageType.Warning);
                    }
                    else if (m_MaterialPropertyPopupInvalidSelections == 1)
                    {
                        EditorGUILayout.HelpBox(s_Styles.oneInvalidTexPropSelectionHelp, MessageType.Warning);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox(
                            string.Format(s_Styles.someInvalidTexPropSelectionsHelp, m_MaterialPropertyPopupInvalidSelections),
                            MessageType.Warning);
                    }
                    GUILayout.EndHorizontal();
                }
                else
                {
                    DisplayMultiMaterialInformation(m_MaterialPropertyPopupContentHash != curHash);
                }

                m_MaterialPropertyPopupContentHash = curHash;
            }
            EditorGUILayout.EndFadeGroup();

            m_ShowAspectRatio.target =
                currentRenderMode != VideoRenderMode.MaterialOverride &&
                currentRenderMode != VideoRenderMode.APIOnly;
            if (EditorGUILayout.BeginFadeGroup(m_ShowAspectRatio.faded))
            {
                EditorGUILayout.PropertyField(m_AspectRatio, s_Styles.aspectRatioLabel);
            }
            EditorGUILayout.EndFadeGroup();
        }
示例#5
0
 private void HandleTargetField(VideoRenderMode currentRenderMode)
 {
     this.m_ShowRenderTexture.target = (currentRenderMode == VideoRenderMode.RenderTexture);
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowRenderTexture.faded))
     {
         EditorGUILayout.PropertyField(this.m_TargetTexture, VideoPlayerEditor.s_Styles.textureContent, new GUILayoutOption[0]);
     }
     EditorGUILayout.EndFadeGroup();
     this.m_ShowTargetCamera.target = (currentRenderMode == VideoRenderMode.CameraFarPlane || currentRenderMode == VideoRenderMode.CameraNearPlane);
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowTargetCamera.faded))
     {
         EditorGUILayout.PropertyField(this.m_TargetCamera, VideoPlayerEditor.s_Styles.cameraContent, new GUILayoutOption[0]);
         EditorGUILayout.Slider(this.m_TargetCameraAlpha, 0f, 1f, VideoPlayerEditor.s_Styles.alphaContent, new GUILayoutOption[0]);
     }
     EditorGUILayout.EndFadeGroup();
     this.m_ShowRenderer.target = (currentRenderMode == VideoRenderMode.MaterialOverride);
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowRenderer.faded))
     {
         bool flag = base.targets.Count <UnityEngine.Object>() > 1;
         if (flag)
         {
             EditorGUILayout.PropertyField(this.m_TargetMaterialRenderer, VideoPlayerEditor.s_Styles.materialRendererContent, new GUILayoutOption[0]);
         }
         else
         {
             Rect       controlRect = EditorGUILayout.GetControlRect(true, 16f, new GUILayoutOption[0]);
             GUIContent label       = EditorGUI.BeginProperty(controlRect, VideoPlayerEditor.s_Styles.materialRendererContent, this.m_TargetMaterialRenderer);
             EditorGUI.BeginChangeCheck();
             UnityEngine.Object objectReferenceValue = EditorGUI.ObjectField(controlRect, label, VideoPlayerEditor.GetTargetRenderer((VideoPlayer)base.target), typeof(Renderer), true);
             if (EditorGUI.EndChangeCheck())
             {
                 this.m_TargetMaterialRenderer.objectReferenceValue = objectReferenceValue;
             }
             EditorGUI.EndProperty();
         }
         int materialPropertyPopupHash = VideoPlayerEditor.GetMaterialPropertyPopupHash(base.targets);
         if (this.m_MaterialPropertyPopupContentHash != materialPropertyPopupHash)
         {
             UnityEngine.Object[] arg_1CE_0 = base.targets;
             if (VideoPlayerEditor.< > f__mg$cache1 == null)
             {
                 VideoPlayerEditor.< > f__mg$cache1 = new VideoPlayerEditor.EntryGenerator(VideoPlayerEditor.GetMaterialPropertyNames);
             }
             this.m_MaterialPropertyPopupContent = VideoPlayerEditor.BuildPopupEntries(arg_1CE_0, VideoPlayerEditor.< > f__mg$cache1, out this.m_MaterialPropertyPopupSelection, out this.m_MaterialPropertyPopupInvalidSelections);
         }
         VideoPlayerEditor.HandlePopup(VideoPlayerEditor.s_Styles.materialPropertyContent, this.m_TargetMaterialProperty, this.m_MaterialPropertyPopupContent, this.m_MaterialPropertyPopupSelection);
         if (this.m_MaterialPropertyPopupInvalidSelections > 0 || this.m_MaterialPropertyPopupContent.Length == 0)
         {
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUILayout.Space(EditorGUIUtility.labelWidth);
             if (this.m_MaterialPropertyPopupContent.Length == 0)
             {
                 if (!flag)
                 {
                     EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.rendererMaterialsHaveNoTexPropsHelp, MessageType.Warning);
                 }
                 else
                 {
                     EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.someRendererMaterialsHaveNoTexPropsHelp, MessageType.Warning);
                 }
             }
             else if (!flag)
             {
                 EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.invalidTexPropSelectionHelp, MessageType.Warning);
             }
             else if (this.m_MaterialPropertyPopupInvalidSelections == 1)
             {
                 EditorGUILayout.HelpBox(VideoPlayerEditor.s_Styles.oneInvalidTexPropSelectionHelp, MessageType.Warning);
             }
             else
             {
                 EditorGUILayout.HelpBox(string.Format(VideoPlayerEditor.s_Styles.someInvalidTexPropSelectionsHelp, this.m_MaterialPropertyPopupInvalidSelections), MessageType.Warning);
             }
             GUILayout.EndHorizontal();
         }
         else
         {
             this.DisplayMultiMaterialInformation(this.m_MaterialPropertyPopupContentHash != materialPropertyPopupHash);
         }
         this.m_MaterialPropertyPopupContentHash = materialPropertyPopupHash;
     }
     EditorGUILayout.EndFadeGroup();
     this.m_ShowAspectRatio.target = (currentRenderMode != VideoRenderMode.MaterialOverride && currentRenderMode != VideoRenderMode.APIOnly);
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowAspectRatio.faded))
     {
         EditorGUILayout.PropertyField(this.m_AspectRatio, VideoPlayerEditor.s_Styles.aspectRatioLabel, new GUILayoutOption[0]);
     }
     EditorGUILayout.EndFadeGroup();
 }