public void OnEnable()
        {
            Instance = (TextureArrayCreatorAsset)target;

            m_so                 = serializedObject;
            m_selectedSize       = m_so.FindProperty("m_selectedSize");
            m_lockRatio          = m_so.FindProperty("m_lockRatio");
            m_sizeX              = m_so.FindProperty("m_sizeX");
            m_sizeY              = m_so.FindProperty("m_sizeY");
            m_tex3DMode          = m_so.FindProperty("m_tex3DMode");
            m_linearMode         = m_so.FindProperty("m_linearMode");
            m_mipMaps            = m_so.FindProperty("m_mipMaps");
            m_wrapMode           = m_so.FindProperty("m_wrapMode");
            m_filterMode         = m_so.FindProperty("m_filterMode");
            m_anisoLevel         = m_so.FindProperty("m_anisoLevel");
            m_selectedFormatEnum = m_so.FindProperty("m_selectedFormatEnum");
            m_quality            = m_so.FindProperty("m_quality");
            m_folderPath         = m_so.FindProperty("m_folderPath");
            m_fileName           = m_so.FindProperty("m_fileName");
            m_filenameChanged    = m_so.FindProperty("m_filenameChanged");
            m_allTextures        = m_so.FindProperty("m_allTextures");

            if (m_listTextures == null)
            {
                m_listTextures = new ReorderableList(m_so, m_allTextures, true, true, true, true);
                m_listTextures.elementHeight = 16;

                m_listTextures.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    m_allTextures.GetArrayElementAtIndex(index).objectReferenceValue = (Texture2D)EditorGUI.ObjectField(rect, "Texture " + index, m_allTextures.GetArrayElementAtIndex(index).objectReferenceValue, typeof(Texture2D), false);
                };

                m_listTextures.drawHeaderCallback = ( Rect rect ) =>
                {
                    m_previewSize = EditorGUI.IntSlider(rect, "Texture List", m_previewSize, 16, 64);
                    if ((float)m_previewSize != m_listTextures.elementHeight)
                    {
                        m_listTextures.elementHeight = m_previewSize;
                    }
                };

                m_listTextures.onAddCallback = (list) =>
                {
                    m_allTextures.InsertArrayElementAtIndex(m_allTextures.arraySize);
                    m_allTextures.GetArrayElementAtIndex(m_allTextures.arraySize - 1).objectReferenceValue = null;
                };

                m_listTextures.onRemoveCallback = (list) =>
                {
                    m_allTextures.GetArrayElementAtIndex(list.index).objectReferenceValue = null;
                    m_allTextures.DeleteArrayElementAtIndex(list.index);
                };
            }

            m_dragAndDropTool = new DragAndDropTool();
            m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped;
        }
예제 #2
0
        private void OnDestroy()
        {
            m_dragAndDropTool.Destroy();
            m_dragAndDropTool = null;

            if (m_allTextures != null)
            {
                m_allTextures.Clear();
                m_allTextures = null;
            }
        }
예제 #3
0
        private void OnEnable()
        {
            m_draggableArea   = new Rect(0, 0, 1, 1);
            m_dragAndDropTool = new DragAndDropTool();
            m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped;

            if (m_contentStyle == null)
            {
                m_contentStyle        = new GUIStyle(GUIStyle.none);
                m_contentStyle.margin = new RectOffset(6, 4, 5, 5);
            }

            m_pathButtonStyle = null;

            if (m_allTextures == null)
            {
                m_allTextures = new List <Texture2D>();
            }

            if (m_listTextures == null)
            {
                m_listTextures = new ReorderableList(m_allTextures, typeof(Texture2D), true, true, true, true);
                m_listTextures.elementHeight = 16;

                m_listTextures.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    m_allTextures[index] = (Texture2D)EditorGUI.ObjectField(rect, "Texture " + index, m_allTextures[index], typeof(Texture2D), false);
                };

                m_listTextures.drawHeaderCallback = ( Rect rect ) =>
                {
                    m_previewSize = EditorGUI.IntSlider(rect, "Texture List", m_previewSize, 16, 64);
                    if ((float)m_previewSize != m_listTextures.elementHeight)
                    {
                        m_listTextures.elementHeight = m_previewSize;
                    }
                };
                m_listTextures.onAddCallback = (list) =>
                {
                    m_allTextures.Add(null);
                };

                m_listTextures.onRemoveCallback = (list) =>
                {
                    m_allTextures.RemoveAt(list.index);
                };
            }
        }
예제 #4
0
        private void OnEnable()
        {
            m_draggableArea   = new Rect(0, 0, 1, 1);
            m_dragAndDropTool = new DragAndDropTool();
            m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped;

            if (m_contentStyle == null)
            {
                m_contentStyle        = new GUIStyle(GUIStyle.none);
                m_contentStyle.margin = new RectOffset(6, 4, 5, 5);
            }

            m_pathButtonStyle = null;

            //GetInitialInfo();
        }
예제 #5
0
        private void OnDestroy()
        {
            if (m_dummyMaterial != null)
            {
                GameObject.DestroyImmediate(m_dummyMaterial);
                m_dummyMaterial = null;
            }

            m_dragAndDropTool.Destroy();
            m_dragAndDropTool = null;

            m_tooltips.Clear();
            m_tooltips = null;

            m_contentStyle    = null;
            m_pathButtonStyle = null;
            m_currentShader   = null;
        }
 private void OnDestroy()
 {
     m_dragAndDropTool.Destroy();
     m_dragAndDropTool = null;
 }