Example #1
0
        void DrawTextureSelector(string label, ref Texture2D tex, ref TextureChannel selectedChannel, ref bool invert)
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUILayout.BeginVertical();
                    {
                        var labelContent = new GUIContent(label);
                        var size         = EditorStyles.boldLabel.CalcSize(labelContent);

                        EditorGUILayout.LabelField(labelContent, EditorStyles.boldLabel, GUILayout.MaxWidth(size.x));

                        GUILayout.Space(15 * EditorGUIUtility.pixelsPerPoint);

                        GUILayout.FlexibleSpace();

                        invert = EditorGUILayout.ToggleLeft(INVERT_LABEL, invert, GUILayout.MaxWidth(InvertToggleWidth));
                    }
                    EditorGUILayout.EndVertical();

                    tex = EditorGUILayout.ObjectField(GUIContent.none, tex, typeof(Texture2D), true, GUILayout.ExpandHeight(true)) as Texture2D;
                }
                EditorGUILayout.EndHorizontal();

                if (showChannelPicker)
                {
                    EditorGUI.BeginDisabledGroup(!tex);
                    selectedChannel = PoiHelpers.DrawChannelSelector(selectedChannel, ChannelLabels);
                    EditorGUI.EndDisabledGroup();
                }
            }
            EditorGUILayout.EndVertical();
        }
Example #2
0
        void DrawTextureSelector(string label, ref Texture2D tex, ref TextureChannel selectedChannel)
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                tex = EditorGUILayout.ObjectField(label, tex, typeof(Texture2D), true, GUILayout.ExpandHeight(true)) as Texture2D;

                if (showChannelPicker)
                {
                    EditorGUI.BeginDisabledGroup(!tex);
                    selectedChannel = PoiHelpers.DrawChannelSelector(selectedChannel);
                    EditorGUI.EndDisabledGroup();
                }
            }
            EditorGUILayout.EndHorizontal();
        }