Пример #1
0
        void DrawUnpackUI()
        {
            _scroll = EditorGUILayout.BeginScrollView(_scroll);
            {
                EditorGUI.BeginChangeCheck();
                {
                    DrawTextureSelector(PACKED_TEXTURE_LABEL, ref unpackSource, ref unpackChan, ref unpackInvert);
                }
                if (EditorGUI.EndChangeCheck() && unpackSizeAutoSelect)
                {
                    // Get biggest texture size from selections and make a selection in our sizes list
                    var tempSize = PoiHelpers.GetMaxSizeFromTextures(unpackSource);
                    if (tempSize != default)
                    {
                        UnpackSize = tempSize.ClosestPowerOfTwo(AUTO_SELECT_CEILING);
                    }
                }

                DrawShowChannelPicker(ref showChannelPicker);
            }
            EditorGUILayout.EndScrollView();

            EditorGUI.BeginDisabledGroup(!unpackSource);
            {
                UnpackSize = DrawTextureSizeSettings(UnpackSize, ref unpackedName, ref unpackSizeIsLinked, ref unpackSizeAutoSelect);

                if (GUILayout.Button("Unpack", PoiStyles.BigButton))
                {
                    DoUnpack(unpackChan);
                }
            }
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.Space();
        }
Пример #2
0
        void DrawPackUI()
        {
            _scroll = EditorGUILayout.BeginScrollView(_scroll);
            {
                EditorGUI.BeginChangeCheck();
                {
                    DrawTextureSelector(RED_TEXTURE_LABEL, ref packRed, ref redTexChan, ref redInvert);
                    DrawTextureSelector(GREEN_TEXTURE_LABEL, ref packGreen, ref greenTexChan, ref greenInvert);
                    DrawTextureSelector(BLUE_TEXTURE_LABEL, ref packBlue, ref blueTexChan, ref blueInvert);
                    DrawTextureSelector(ALPHA_TEXTURE_LABEL, ref packAlpha, ref alphaTexChan, ref alphaInvert);
                }
                if (EditorGUI.EndChangeCheck() && packSizeAutoSelect)
                {
                    // Get biggest texture size from selections and make a selection in our sizes list
                    var tempSize = PoiHelpers.GetMaxSizeFromTextures(packRed, packGreen, packBlue, packAlpha);
                    if (tempSize != default)
                    {
                        PackSize = tempSize.ClosestPowerOfTwo(AUTO_SELECT_CEILING);
                    }
                }
            }
            EditorGUILayout.EndScrollView();

            DrawShowChannelPicker(ref showChannelPicker);

            bool disabled = new bool[] { packRed, packGreen, packBlue, packAlpha }.Count(b => b) < 2;

            EditorGUI.BeginDisabledGroup(disabled);
            {
                PackSize = DrawTextureSizeSettings(PackSize, ref packedName, ref packSizeIsLinked, ref packSizeAutoSelect);

                if (GUILayout.Button("Pack", PoiStyles.BigButton))
                {
                    DoPack();
                }

                EditorGUILayout.Space();
            }
            EditorGUI.EndDisabledGroup();
        }