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(); }
void DoUnpack(TextureChannel singleChannel = TextureChannel.RGBA) { if (!PackerShadersExist) { return; } var channelTextures = new Dictionary <string, Texture2D>(); if (singleChannel == TextureChannel.RGBA) { channelTextures = PoiHelpers.UnpackTextureToChannels(unpackSource, unpackInvert, UnpackSize); } else { channelTextures[singleChannel.ToString().ToLower()] = unpackSource.GetChannelAsTexture(singleChannel, unpackInvert, UnpackSize); } string pingPath = null; pingPath = SaveTextures(channelTextures, pingPath); Debug.Log(LOG_PREFIX + "Finished unpacking texture at " + pingPath); PoiHelpers.PingAssetAtPath(pingPath); }
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(); }