public void Draw()
        {
            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

            EditorGUILayout.BeginHorizontal();

            _fold = EditorGUI.Foldout(GetFoldRect(), _fold, "Input");

            GUIStyle gearStyle = new GUIStyle("Icon.Options");

            GUILayout.FlexibleSpace();
            if (GUILayout.Button(gearStyle.normal.background, new GUIStyle("IconButton")))
            {
                GenericMenu menu = new GenericMenu();
                menu.AddItem(new GUIContent("Remove"), false, data =>
                {
                    TextureItem item = data as TextureItem;
                    item.ToDelete    = true;
                }, this);

                menu.ShowAsContext();
            }

            using (new EditorGUI.IndentLevelScope(1))
            {
                EditorGUILayout.EndHorizontal();
                if (_fold)
                {
                    GUILayout.BeginHorizontal(TexturePackerStyles.Heading);

                    GUILayout.BeginVertical(TexturePackerStyles.Heading);

                    GUILayout.Label("Channels Selection:");

                    string [] channels = new string [] { "Red", "Green", "Blue", "Alpha" };

                    for (int i = 0; i < 4; ++i)
                    {
                        GUILayout.BeginHorizontal();

                        TextureChannel texChannel = (TextureChannel)i;

                        TextureChannelInput channelInput = input.GetChannelInput(texChannel);

                        channelInput.enabled = GUILayout.Toggle(channelInput.enabled, new GUIContent(" " + channels [i]), GUILayout.Width(60));

                        GUILayout.Label(">");

                        channelInput.output = (TextureChannel)EditorGUILayout.Popup((int)channelInput.output, channels, GUILayout.Width(80));

                        input.SetChannelInput(texChannel, channelInput);

                        GUILayout.EndHorizontal();
                    }

                    GUILayout.EndVertical();

                    input.texture = EditorGUILayout.ObjectField(input.texture, typeof(Texture2D), false, GUILayout.Width(90), GUILayout.Height(80)) as Texture2D;

                    GUILayout.EndHorizontal();
                }
            }
        }
Пример #2
0
 public void SetChannelInput(TextureChannel channel, TextureChannelInput channelInput)
 {
     _inputs[channel] = channelInput;
 }