SetCubemapShadowInfo() public method

public SetCubemapShadowInfo ( CubemapInfo newCubemapShadowInfo ) : void
newCubemapShadowInfo CubemapInfo
return void
示例#1
0
 // If there is a currently active selection drag and drop move that originate from a shadow cubemap this call will remove the reference
 // Public to be call by LookDevView
 // Must be call before any insertion or modification of HDRI list
 public void ResetShadowCubemap()
 {
     if (m_SelectedShadowCubemapOwnerInfo != null)
     {
         m_SelectedShadowCubemapOwnerInfo.SetCubemapShadowInfo(m_SelectedShadowCubemapOwnerInfo);
     }
 }
示例#2
0
            public override void OnGUI(Rect rect)
            {
                GUILayout.BeginVertical();
                {
                    GUILayout.Label(styles.sEnvironment, EditorStyles.miniLabel);
                    EditorGUI.BeginChangeCheck();
                    float angleOffset = EditorGUILayout.Slider(styles.sAngleOffset, m_CubemapInfo.angleOffset % 360.0f, -360.0f, 360.0f);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RecordObject(m_LookDevView.envLibrary, "Changed environment settings");
                        m_CubemapInfo.angleOffset      = angleOffset;
                        m_LookDevView.envLibrary.dirty = true;
                        m_LookDevView.Repaint();
                    }

                    if (GUILayout.Button(styles.sResetEnv, EditorStyles.toolbarButton))
                    {
                        Undo.RecordObject(m_LookDevView.envLibrary, "Changed environment settings");
                        m_CubemapInfo.ResetEnvInfos();
                        m_LookDevView.envLibrary.dirty = true;
                        m_LookDevView.Repaint();
                    }

                    using (new EditorGUI.DisabledScope(!m_LookDevView.config.enableShadowCubemap))
                    {
                        DrawSeparator();
                        GUILayout.Label(styles.sShadows, EditorStyles.miniLabel);

                        EditorGUI.BeginChangeCheck();
                        float shadowIntensity = EditorGUILayout.Slider(styles.sShadowIntensity, m_CubemapInfo.shadowInfo.shadowIntensity, 0.0f, 5.0f);
                        Color shadowColor     = EditorGUILayout.ColorField(styles.sShadowColor, m_CubemapInfo.shadowInfo.shadowColor);
                        if (EditorGUI.EndChangeCheck())
                        {
                            Undo.RecordObject(m_LookDevView.envLibrary, "Changed shadow settings");
                            m_CubemapInfo.shadowInfo.shadowIntensity = shadowIntensity;
                            m_CubemapInfo.shadowInfo.shadowColor     = shadowColor;
                            m_LookDevView.envLibrary.dirty           = true;
                            m_LookDevView.Repaint();
                        }

                        if (GUILayout.Button(styles.sBrightest, EditorStyles.toolbarButton))
                        {
                            Undo.RecordObject(m_LookDevView.envLibrary, "Changed shadow settings");
                            LookDevResources.UpdateShadowInfoWithBrightestSpot(m_CubemapInfo);
                            m_LookDevView.envLibrary.dirty = true;
                            m_LookDevView.Repaint();
                        }

                        if (GUILayout.Button(styles.sResetShadow, EditorStyles.toolbarButton))
                        {
                            Undo.RecordObject(m_LookDevView.envLibrary, "Changed shadow settings");
                            m_CubemapInfo.SetCubemapShadowInfo(m_CubemapInfo);
                            m_LookDevView.envLibrary.dirty = true;
                            m_LookDevView.Repaint();
                        }
                    }
                }
                GUILayout.EndVertical();
            }
        public void InsertHDRI(Cubemap cubemap, int insertionIndex)
        {
            Undo.RecordObject(this.m_LookDevView.envLibrary, "Insert HDRI");
            Undo.RecordObject(this.m_LookDevView.config, "Insert HDRI");
            Cubemap cubemap0 = null;
            Cubemap cubemap1 = null;

            if (cubemap == LookDevResources.m_DefaultHDRI)
            {
                cubemap0 = LookDevResources.m_DefaultHDRI;
                cubemap1 = LookDevResources.m_DefaultHDRI;
            }
            else
            {
                cubemap0 = this.m_HDRIList[this.m_LookDevView.config.lookDevContexts[0].currentHDRIIndex].cubemap;
                cubemap1 = this.m_HDRIList[this.m_LookDevView.config.lookDevContexts[1].currentHDRIIndex].cubemap;
            }
            int num = this.m_HDRIList.FindIndex((CubemapInfo x) => x.cubemap == cubemap);

            if (num == -1)
            {
                this.m_Dirty = true;
                CubemapInfo cubemapInfo = null;
                for (int i = 0; i < this.m_HDRIList.Count; i++)
                {
                    if (this.m_HDRIList[i].cubemapShadowInfo.cubemap == cubemap)
                    {
                        cubemapInfo = this.m_HDRIList[i].cubemapShadowInfo;
                        cubemapInfo.SetCubemapShadowInfo(cubemapInfo);
                        break;
                    }
                }
                if (cubemapInfo == null)
                {
                    cubemapInfo         = new CubemapInfo();
                    cubemapInfo.cubemap = cubemap;
                    cubemapInfo.ambientProbe.Clear();
                    cubemapInfo.alreadyComputed = false;
                    cubemapInfo.SetCubemapShadowInfo(cubemapInfo);
                }
                int count = this.m_HDRIList.Count;
                this.m_HDRIList.Insert((insertionIndex != -1) ? insertionIndex : count, cubemapInfo);
                if (cubemapInfo.cubemap != LookDevResources.m_DefaultHDRI)
                {
                    LookDevResources.UpdateShadowInfoWithBrightestSpot(cubemapInfo);
                }
            }
            if (num != insertionIndex && num != -1 && insertionIndex != -1)
            {
                CubemapInfo item = this.m_HDRIList[num];
                this.m_HDRIList.RemoveAt(num);
                this.m_HDRIList.Insert((num <= insertionIndex) ? (insertionIndex - 1) : insertionIndex, item);
            }
            this.m_LookDevView.config.lookDevContexts[0].UpdateProperty(LookDevProperty.HDRI, this.m_HDRIList.FindIndex((CubemapInfo x) => x.cubemap == cubemap0));
            this.m_LookDevView.config.lookDevContexts[1].UpdateProperty(LookDevProperty.HDRI, this.m_HDRIList.FindIndex((CubemapInfo x) => x.cubemap == cubemap1));
            this.m_LookDevView.Repaint();
        }
示例#4
0
        // If insertionIndex is -1 it mean we insert at the end of the list
        public void InsertHDRI(Cubemap cubemap, int insertionIndex)
        {
            Undo.RecordObject(m_LookDevView.envLibrary, "Insert HDRI");
            Undo.RecordObject(m_LookDevView.config, "Insert HDRI");

            // Handle cubemap index remapping for both context. Simply do it brute force in all cases.
            // Save the cubemap info before any modification to m_HDRIList.
            // Also if we are inserting m_DefaultHDRI, it mean we have an empty m_HDRIList
            Cubemap cubemap0 = null;
            Cubemap cubemap1 = null;

            if (cubemap == LookDevResources.m_DefaultHDRI)
            {
                cubemap0 = LookDevResources.m_DefaultHDRI;
                cubemap1 = LookDevResources.m_DefaultHDRI;
            }
            else
            {
                cubemap0 = m_HDRIList[m_LookDevView.config.lookDevContexts[0].currentHDRIIndex].cubemap;
                cubemap1 = m_HDRIList[m_LookDevView.config.lookDevContexts[1].currentHDRIIndex].cubemap;
            }

            // Check if the cubemap already exist
            int iIndex = m_HDRIList.FindIndex(x => x.cubemap == cubemap);

            // Create cubemap if it doesn't exist
            if (iIndex == -1)
            {
                m_Dirty = true;

                CubemapInfo newInfo = null;

                // Check if the cubemap exist but as a shadow cubemap only
                // in this case we don't recreate the CubemapInfo, but we still insert it as a new one.
                for (int i = 0; i < m_HDRIList.Count; ++i)
                {
                    if (m_HDRIList[i].cubemapShadowInfo.cubemap == cubemap)
                    {
                        newInfo = m_HDRIList[i].cubemapShadowInfo;
                        // Prevent recursion with shadow cubemap info
                        newInfo.SetCubemapShadowInfo(newInfo);
                        break;
                    }
                }

                if (newInfo == null)
                {
                    newInfo         = new CubemapInfo();
                    newInfo.cubemap = cubemap;
                    newInfo.ambientProbe.Clear();
                    newInfo.alreadyComputed = false;
                    newInfo.SetCubemapShadowInfo(newInfo); // By default we use the same cubemap for the version without sun.
                }

                int newCubemapIndex = m_HDRIList.Count;
                // Add the cubemap to the specified location or last if no location provide
                m_HDRIList.Insert(insertionIndex == -1 ? newCubemapIndex : insertionIndex, newInfo);

                // When inserting the default HDRI the first time, the lookdev env is not yet ready.
                // But as we default the latlong light position of ShadowInfo to brightest location of default HDRI this is not a problem to not call the function.
                if (newInfo.cubemap != LookDevResources.m_DefaultHDRI)
                {
                    LookDevResources.UpdateShadowInfoWithBrightestSpot(newInfo);
                }
            }

            // If we haven't inserted at end of the list, if it is not a new cubemap and if we do not insert at the same place, we need to shift current cubemap position in the list
            if (iIndex != insertionIndex && iIndex != -1 && insertionIndex != -1)
            {
                // Get cubemap info before modifying m_LookDevSetup.m_HDRIList;
                CubemapInfo infos = m_HDRIList[iIndex];

                m_HDRIList.RemoveAt(iIndex);
                // If we insert after the removed cubemap we need to increase the index
                m_HDRIList.Insert(iIndex > insertionIndex ? insertionIndex : insertionIndex - 1, infos);
            }

            m_LookDevView.config.lookDevContexts[0].UpdateProperty(LookDevProperty.HDRI, m_HDRIList.FindIndex(x => x.cubemap == cubemap0));
            m_LookDevView.config.lookDevContexts[1].UpdateProperty(LookDevProperty.HDRI, m_HDRIList.FindIndex(x => x.cubemap == cubemap1));

            m_LookDevView.Repaint();
        }
示例#5
0
        private void HandleMouseInput()
        {
            List <CubemapInfo> hdriList = this.m_LookDevView.envLibrary.hdriList;
            Vector2            vector   = new Vector2(Event.current.mousePosition.x, Event.current.mousePosition.y + this.m_ScrollPosition.y);
            Event     current           = Event.current;
            EventType typeForControl    = current.GetTypeForControl(this.m_LookDevView.hotControl);

            switch (typeForControl)
            {
            case EventType.MouseUp:
                if (this.m_SelectedCubemap != null)
                {
                    Rect gUIRect = this.m_GUIRect;
                    gUIRect.yMax += 16f;
                    if (gUIRect.Contains(Event.current.mousePosition))
                    {
                        int num = this.IsPositionInInsertionArea(vector);
                        if (num != -1)
                        {
                            this.ResetShadowCubemap();
                            this.m_LookDevView.envLibrary.InsertHDRI(this.m_SelectedCubemap, num);
                        }
                        else
                        {
                            int num2 = this.IsPositionInThumbnailArea(vector);
                            if (num2 != -1 && this.m_LookDevView.config.enableShadowCubemap)
                            {
                                Undo.RecordObject(this.m_LookDevView.envLibrary, "Update shadow cubemap");
                                CubemapInfo cubemapInfo = this.m_LookDevView.envLibrary.hdriList[num2];
                                if (cubemapInfo != this.m_SelectedCubemapInfo)
                                {
                                    cubemapInfo.SetCubemapShadowInfo(this.m_SelectedCubemapInfo);
                                }
                                this.m_LookDevView.envLibrary.dirty = true;
                            }
                        }
                        this.CancelSelection();
                    }
                }
                this.m_LookDevView.Repaint();
                if (this.m_SelectedCubeMapOffsetIndex != -1)
                {
                    if (Mathf.Abs(hdriList[this.m_SelectedCubeMapOffsetIndex].angleOffset) <= 10f)
                    {
                        Undo.RecordObject(this.m_LookDevView.envLibrary, "");
                        hdriList[this.m_SelectedCubeMapOffsetIndex].angleOffset = 0f;
                        this.m_LookDevView.envLibrary.dirty = true;
                    }
                }
                this.m_SelectedCubemapInfo            = null;
                this.m_SelectedShadowCubemapOwnerInfo = null;
                this.m_SelectedLightIconIndex         = -1;
                this.m_SelectedShadowInfo             = null;
                this.m_SelectedCubeMapOffsetIndex     = -1;
                this.m_HoveringCubeMapIndex           = -1;
                this.m_SelectedCubeMapOffsetValue     = 0f;
                GUIUtility.hotControl = 0;
                return;

            case EventType.MouseMove:
            case EventType.KeyUp:
            case EventType.ScrollWheel:
            case EventType.Layout:
IL_95:
                if (typeForControl != EventType.DragExited)
                {
                    return;
                }
                return;

            case EventType.MouseDrag:
                if (this.m_SelectedCubeMapOffsetIndex != -1)
                {
                    Undo.RecordObject(this.m_LookDevView.envLibrary, "");
                    CubemapInfo cubemapInfo2 = hdriList[this.m_SelectedCubeMapOffsetIndex];
                    cubemapInfo2.angleOffset            = this.ComputeAngleOffsetFromMouseCoord(vector) + this.m_SelectedCubeMapOffsetValue;
                    this.m_LookDevView.envLibrary.dirty = true;
                    Event.current.Use();
                }
                if (this.m_SelectedCubemapInfo != null)
                {
                    if (this.IsPositionInInsertionArea(vector) == -1)
                    {
                        this.m_HoveringCubeMapIndex = this.IsPositionInThumbnailArea(vector);
                    }
                    else
                    {
                        this.m_HoveringCubeMapIndex = -1;
                    }
                }
                this.m_LookDevView.Repaint();
                return;

            case EventType.KeyDown:
                if (Event.current.keyCode == KeyCode.Escape)
                {
                    this.CancelSelection();
                    this.m_LookDevView.Repaint();
                }
                return;

            case EventType.Repaint:
                if (this.m_SelectedCubeMapOffsetIndex != -1)
                {
                    EditorGUIUtility.AddCursorRect(this.m_displayRect, MouseCursor.SlideArrow);
                }
                return;

            case EventType.DragUpdated:
            {
                bool flag = false;
                UnityEngine.Object[] objectReferences = DragAndDrop.objectReferences;
                for (int i = 0; i < objectReferences.Length; i++)
                {
                    UnityEngine.Object @object = objectReferences[i];
                    Cubemap            exists  = @object as Cubemap;
                    if (exists)
                    {
                        flag = true;
                    }
                }
                DragAndDrop.visualMode = ((!flag) ? DragAndDropVisualMode.Rejected : DragAndDropVisualMode.Link);
                if (flag)
                {
                    this.m_DragBeingPerformed = true;
                }
                current.Use();
                return;
            }

            case EventType.DragPerform:
            {
                int insertionIndex = this.IsPositionInInsertionArea(vector);
                UnityEngine.Object[] objectReferences2 = DragAndDrop.objectReferences;
                for (int j = 0; j < objectReferences2.Length; j++)
                {
                    UnityEngine.Object object2 = objectReferences2[j];
                    Cubemap            cubemap = object2 as Cubemap;
                    if (cubemap)
                    {
                        this.m_LookDevView.envLibrary.InsertHDRI(cubemap, insertionIndex);
                    }
                }
                DragAndDrop.AcceptDrag();
                this.m_DragBeingPerformed = false;
                current.Use();
                return;
            }
            }
            goto IL_95;
        }
        private void HandleMouseInput()
        {
            List <CubemapInfo> hdriList = this.m_LookDevView.envLibrary.hdriList;
            Vector2            pos      = new Vector2(Event.current.mousePosition.x, Event.current.mousePosition.y + this.m_ScrollPosition.y);
            Event     current           = Event.current;
            EventType typeForControl    = current.GetTypeForControl(this.m_LookDevView.hotControl);

            switch (typeForControl)
            {
            case EventType.MouseUp:
                if (this.m_SelectedCubemap != null)
                {
                    Rect gUIRect = this.m_GUIRect;
                    gUIRect.yMax += 16f;
                    if (!gUIRect.Contains(Event.current.mousePosition))
                    {
                        break;
                    }
                    int insertionIndex = this.IsPositionInInsertionArea(pos);
                    if (insertionIndex == -1)
                    {
                        int num2 = this.IsPositionInThumbnailArea(pos);
                        if ((num2 != -1) && this.m_LookDevView.config.enableShadowCubemap)
                        {
                            Undo.RecordObject(this.m_LookDevView.envLibrary, "Update shadow cubemap");
                            CubemapInfo info2 = this.m_LookDevView.envLibrary.hdriList[num2];
                            if (info2 != this.m_SelectedCubemapInfo)
                            {
                                info2.SetCubemapShadowInfo(this.m_SelectedCubemapInfo);
                            }
                            this.m_LookDevView.envLibrary.dirty = true;
                        }
                    }
                    else
                    {
                        this.ResetShadowCubemap();
                        this.m_LookDevView.envLibrary.InsertHDRI(this.m_SelectedCubemap, insertionIndex);
                    }
                    this.CancelSelection();
                }
                break;

            case EventType.MouseDrag:
                if (this.m_SelectedCubeMapOffsetIndex != -1)
                {
                    Undo.RecordObject(this.m_LookDevView.envLibrary, "");
                    CubemapInfo info = hdriList[this.m_SelectedCubeMapOffsetIndex];
                    info.angleOffset = this.ComputeAngleOffsetFromMouseCoord(pos) + this.m_SelectedCubeMapOffsetValue;
                    this.m_LookDevView.envLibrary.dirty = true;
                    Event.current.Use();
                }
                if (this.m_SelectedCubemapInfo != null)
                {
                    if (this.IsPositionInInsertionArea(pos) == -1)
                    {
                        this.m_HoveringCubeMapIndex = this.IsPositionInThumbnailArea(pos);
                    }
                    else
                    {
                        this.m_HoveringCubeMapIndex = -1;
                    }
                }
                this.m_LookDevView.Repaint();
                return;

            case EventType.KeyDown:
                if (Event.current.keyCode == KeyCode.Escape)
                {
                    this.CancelSelection();
                    this.m_LookDevView.Repaint();
                }
                return;

            case EventType.Repaint:
                if (this.m_SelectedCubeMapOffsetIndex != -1)
                {
                    EditorGUIUtility.AddCursorRect(this.m_displayRect, MouseCursor.SlideArrow);
                }
                return;

            case EventType.DragUpdated:
            {
                bool flag = false;
                foreach (UnityEngine.Object obj3 in DragAndDrop.objectReferences)
                {
                    Cubemap cubemap2 = obj3 as Cubemap;
                    if (cubemap2 != null)
                    {
                        flag = true;
                    }
                }
                DragAndDrop.visualMode = !flag ? DragAndDropVisualMode.Rejected : DragAndDropVisualMode.Link;
                if (flag)
                {
                    this.m_DragBeingPerformed = true;
                }
                current.Use();
                return;
            }

            case EventType.DragPerform:
            {
                int num3 = this.IsPositionInInsertionArea(pos);
                foreach (UnityEngine.Object obj2 in DragAndDrop.objectReferences)
                {
                    Cubemap cubemap = obj2 as Cubemap;
                    if (cubemap != null)
                    {
                        this.m_LookDevView.envLibrary.InsertHDRI(cubemap, num3);
                    }
                }
                DragAndDrop.AcceptDrag();
                this.m_DragBeingPerformed = false;
                current.Use();
                return;
            }

            default:
                if (typeForControl == EventType.DragExited)
                {
                }
                return;
            }
            this.m_LookDevView.Repaint();
            if ((this.m_SelectedCubeMapOffsetIndex != -1) && (Mathf.Abs(hdriList[this.m_SelectedCubeMapOffsetIndex].angleOffset) <= 10f))
            {
                Undo.RecordObject(this.m_LookDevView.envLibrary, "");
                hdriList[this.m_SelectedCubeMapOffsetIndex].angleOffset = 0f;
                this.m_LookDevView.envLibrary.dirty = true;
            }
            this.m_SelectedCubemapInfo            = null;
            this.m_SelectedShadowCubemapOwnerInfo = null;
            this.m_SelectedLightIconIndex         = -1;
            this.m_SelectedShadowInfo             = null;
            this.m_SelectedCubeMapOffsetIndex     = -1;
            this.m_HoveringCubeMapIndex           = -1;
            this.m_SelectedCubeMapOffsetValue     = 0f;
            GUIUtility.hotControl = 0;
        }
示例#7
0
        private void HandleMouseInput()
        {
            List <CubemapInfo> cubemapList = m_LookDevView.envLibrary.hdriList;

            Vector2 scrollFixedPosition = new Vector2(Event.current.mousePosition.x, Event.current.mousePosition.y + m_ScrollPosition.y);

            Event evt = Event.current;

            switch (evt.GetTypeForControl(m_LookDevView.hotControl))
            {
            // Update overlay position for next repaint event
            case EventType.MouseDrag:
            {
                if (m_SelectedCubeMapOffsetIndex != -1)
                {
                    Undo.RecordObject(m_LookDevView.envLibrary, "");
                    CubemapInfo info = cubemapList[m_SelectedCubeMapOffsetIndex];
                    info.angleOffset = ComputeAngleOffsetFromMouseCoord(scrollFixedPosition) + m_SelectedCubeMapOffsetValue;
                    m_LookDevView.envLibrary.dirty = true;
                    Event.current.Use();
                }

                if (m_SelectedCubemapInfo != null)
                {
                    if (IsPositionInInsertionArea(scrollFixedPosition) == -1)
                    {
                        m_HoveringCubeMapIndex = IsPositionInThumbnailArea(scrollFixedPosition);
                    }
                    else
                    {
                        m_HoveringCubeMapIndex = -1;
                    }
                }

                m_LookDevView.Repaint();
                break;
            }

            // Handles environment drop
            case EventType.MouseUp:
            {
                if (m_SelectedCubemap != null)
                {
                    // The rect needs to include an extra slot when moving to last position
                    Rect extendedGUIRect = m_GUIRect;
                    extendedGUIRect.yMax += EditorGUI.kSingleLineHeight;

                    if (extendedGUIRect.Contains(Event.current.mousePosition))
                    {
                        int insertionRectIndex = IsPositionInInsertionArea(scrollFixedPosition);
                        if (insertionRectIndex != -1)
                        {
                            // Must be called before we do any modification to HDRI list
                            ResetShadowCubemap();

                            m_LookDevView.envLibrary.InsertHDRI(m_SelectedCubemap, insertionRectIndex);
                        }
                        else
                        {
                            int thumbnailRectIndex = IsPositionInThumbnailArea(scrollFixedPosition);
                            if (thumbnailRectIndex != -1 && m_LookDevView.config.enableShadowCubemap)
                            {
                                Undo.RecordObject(m_LookDevView.envLibrary, "Update shadow cubemap");
                                CubemapInfo cubemapInfo = m_LookDevView.envLibrary.hdriList[thumbnailRectIndex];

                                // We don't want the user to drop a cubemap on itself and reset the shadows (it would happen all the time by mistake)
                                if (cubemapInfo != m_SelectedCubemapInfo)
                                {
                                    cubemapInfo.SetCubemapShadowInfo(m_SelectedCubemapInfo);
                                }
                                m_LookDevView.envLibrary.dirty = true;
                            }
                        }
                        CancelSelection();
                    }
                }

                m_LookDevView.Repaint();

                if (m_SelectedCubeMapOffsetIndex != -1)
                {
                    // Fall back to zero when near the center
                    if (Mathf.Abs(cubemapList[m_SelectedCubeMapOffsetIndex].angleOffset) <= 10.0f)
                    {
                        Undo.RecordObject(m_LookDevView.envLibrary, "");
                        cubemapList[m_SelectedCubeMapOffsetIndex].angleOffset = 0.0f;
                        m_LookDevView.envLibrary.dirty = true;
                    }
                }
                m_SelectedCubemapInfo            = null;
                m_SelectedShadowCubemapOwnerInfo = null;
                m_SelectedLightIconIndex         = -1;
                m_SelectedShadowInfo             = null;
                m_SelectedCubeMapOffsetIndex     = -1;
                m_HoveringCubeMapIndex           = -1;
                m_SelectedCubeMapOffsetValue     = 0.0f;

                GUIUtility.hotControl = 0;

                break;
            }

            // Escape closes the window
            case EventType.KeyDown:
            {
                if (Event.current.keyCode == KeyCode.Escape)
                {
                    CancelSelection();
                    m_LookDevView.Repaint();
                }
                break;
            }

            case EventType.DragPerform:
            {
                int insertionIndex = IsPositionInInsertionArea(scrollFixedPosition);

                foreach (UnityEngine.Object o in DragAndDrop.objectReferences)
                {
                    Cubemap cubemap = o as Cubemap;
                    if (cubemap)
                    {
                        // When insertion outside the list the index is -1 which mean in InsertHDRI that it will be add at the end
                        m_LookDevView.envLibrary.InsertHDRI(cubemap, insertionIndex);
                    }
                }

                DragAndDrop.AcceptDrag();
                m_DragBeingPerformed = false;
                evt.Use();
                break;
            }

            case EventType.DragUpdated:
            {
                bool hasCubemap = false;
                foreach (UnityEngine.Object o in DragAndDrop.objectReferences)
                {
                    Cubemap cubemap = o as Cubemap;
                    if (cubemap)
                    {
                        hasCubemap = true;
                    }
                }
                DragAndDrop.visualMode = hasCubemap ? DragAndDropVisualMode.Link : DragAndDropVisualMode.Rejected;
                if (hasCubemap)
                {
                    m_DragBeingPerformed = true;
                }
                evt.Use();
            }
            break;

            case EventType.DragExited:
                break;

            case EventType.Repaint:

                if (m_SelectedCubeMapOffsetIndex != -1)
                {
                    EditorGUIUtility.AddCursorRect(m_displayRect, MouseCursor.SlideArrow);
                }
                break;
            }
        }