public override void drawBottom(TextureEditGUI gui) { GUILayout.BeginVertical(GUI.skin.box); header(gui, _imText.headerName()); GUILayout.BeginHorizontal(); GUILayout.Label("Text", GUILayout.ExpandWidth(false)); GUILayout.Space(5); string oldText = _imText._text; GUI.SetNextControlName("TextField"); _imText._text = GUILayout.TextField(_imText._text, GUILayout.ExpandWidth(true)); _imText._text = System.Text.RegularExpressions.Regex.Replace(_imText._text, @"[\r\n]", ""); if (oldText != _imText._text) gui.setRemakePreview(); GUILayout.EndHorizontal(); GUILayout.Space(5); drawBottomMonoOverlay(gui); GUILayout.EndVertical(); }
protected override void drawBottomOverlayExtras1(TextureEditGUI gui) { _redSelector.draw(); GUILayout.Space(10f); _greenSelector.draw(); GUILayout.Space(10f); _blueSelector.draw(); GUILayout.Space(10f); if (_overlay._red != _redSelector.value()) { _overlay._red = _redSelector.value(); gui.setRemakePreview(); } if (_overlay._green != _greenSelector.value()) { _overlay._green = _greenSelector.value(); gui.setRemakePreview(); } if (_overlay._blue != _blueSelector.value()) { _overlay._blue = _blueSelector.value(); gui.setRemakePreview(); } }
public override void initialise(TextureEditGUI gui) { initialiseOverlay(gui); initialiseMonoOverlay(gui); if (_imBitmapMonoDecal._url == string.Empty) _imBitmapMonoDecal._url = BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals[_selectedDecal].url; BitmapDecalCache.Instance.getMonoDecalIndex(_imBitmapMonoDecal._url, out _selectedSheet, out _selectedDecal); }
public override void drawRight(TextureEditGUI gui) { if (BitmapDecalCache.Instance.monoSheets.Count == 0) return; Color contentColor = GUI.contentColor; GUI.backgroundColor = Global.BackgroundColor; _scrollPos = GUILayout.BeginScrollView(_scrollPos, GUI.skin.box, GUILayout.MinWidth(250), GUILayout.ExpandHeight(true)); GUILayout.Label("Decal Sheets"); GUILayout.Space(3); int oldSelectedSheet = _selectedSheet; for (int i = 0; i < BitmapDecalCache.Instance.monoSheets.Count; ++i) { if (i == _selectedSheet) GUI.contentColor = Global.SelectedColor; else GUI.contentColor = Global.NotSelectedColor; if (GUILayout.Button(BitmapDecalCache.Instance.monoSheets[i].displayName, GUILayout.ExpandWidth(true))) _selectedSheet = i; } if (_selectedSheet != oldSelectedSheet) { if (_textures != null) { for (int i = 0; i < _textures.Count; ++i) { UnityEngine.Object.Destroy(_textures[i]); } _textures = null; } if (_selectedDecal >= BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals.Count) _selectedDecal = 0; } GUILayout.Space(10); GUILayout.Label("Decals"); GUILayout.Space(3); if (_textures == null) { _textures = new List<Texture2D>(); for (int i = 0; i < BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals.Count; ++i) { Image image = new Image(BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals[i].image); image.recolor(Global.Black32, Global.White32, false, false); Texture2D texture = new Texture2D(image.width, image.height, TextureFormat.ARGB32, false); texture.SetPixels32(image.pixels); texture.Apply(); _textures.Add(texture); } } int oldSelectedDecal = _selectedDecal; int x = 0; GUILayout.BeginHorizontal(); for (int i = 0; i < _textures.Count; ++i) { if (i == _selectedDecal) { GUI.backgroundColor = Color.yellow; if (GUILayout.Button(_textures[i], GUILayout.Width(_textures[i].width + 4), GUILayout.Height(_textures[i].height + 4))) _selectedDecal = i; GUI.backgroundColor = Global.BackgroundColor; } else { if (GUILayout.Button(_textures[i], GUILayout.Width(_textures[i].width + 4), GUILayout.Height(_textures[i].height + 4))) _selectedDecal = i; } x += _textures[i].width + 5; if (i < (_textures.Count - 1)) { if (x > 0 && (x + _textures[i+1].width) > 200) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); x = 0; } } } GUILayout.EndHorizontal(); GUILayout.EndScrollView(); GUI.contentColor = contentColor; if (oldSelectedSheet != _selectedSheet || oldSelectedDecal != _selectedDecal) { _imBitmapMonoDecal._url = BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals[_selectedDecal].url; gui.setRemakePreview(); } }
public override void drawBottom(TextureEditGUI gui) { GUILayout.BeginVertical(GUI.skin.box); header(gui, "MONO DECAL"); GUILayout.Label("Url: " + _imBitmapMonoDecal._url, GUILayout.ExpandWidth(false)); GUILayout.Space(5); drawBottomMonoOverlay(gui); GUILayout.EndVertical(); }
public override void initialise(TextureEditGUI gui) { _multipleBaseTexture.setupImages(); }
public override void drawRight(TextureEditGUI gui) { _scrollPos = GUILayout.BeginScrollView(_scrollPos, GUI.skin.box, GUILayout.MinWidth(200), GUILayout.ExpandHeight(true)); int oldSelectedTexture = _multipleBaseTexture._selectedTexture; for (int i = 0; i < _multipleBaseTexture._mainTextInfo.Count; ++i) { GUILayout.BeginHorizontal(); if (i == _multipleBaseTexture._selectedTexture) GUI.contentColor = Global.SelectedColor; else GUI.contentColor = Global.NotSelectedColor; if (GUILayout.Button(_multipleBaseTexture._mainTextInfo[i].name, GUILayout.ExpandWidth(true))) { _multipleBaseTexture._selectedTexture = i; gui.setRemakePreview(); _multipleBaseTexture.setupImages(); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }
public override void drawBottom(TextureEditGUI gui) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); header(gui, "BASE TEXTURE (" + _multipleBaseTexture._method.ToString() + ")"); GUILayout.Label("Name: " + gui.kspTextureInfo().displayName); GUILayout.Space(3); GUILayout.Label("Shader: " + gui.kspTextureInfo().shader); GUILayout.Space(3); if (!(_multipleBaseTexture._selectedTexture >= 0 && _multipleBaseTexture._selectedTexture < _multipleBaseTexture._mainTextInfo.Count)) { GUILayout.Label("No valid texture selected"); GUILayout.EndVertical(); return; } TextureInfo mainTex = _multipleBaseTexture._mainTextInfo[_multipleBaseTexture._selectedTexture]; TextureInfo normalTex = null; if (_multipleBaseTexture._hasNormalMap) normalTex = _multipleBaseTexture._normalTextInfo[_multipleBaseTexture._selectedTexture]; GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Main Texture: " + mainTex.url); if (mainTex.texture.width > 430 || mainTex.texture.height > 270) { _scrollPosTex = GUILayout.BeginScrollView(_scrollPosTex, GUI.skin.box, GUILayout.MinWidth(450), GUILayout.MinHeight(290)); GUILayout.Box(mainTex.texture, GUI.skin.box, GUILayout.Width(mainTex.texture.width), GUILayout.Height(mainTex.texture.height)); GUILayout.EndScrollView(); } else GUILayout.Box(mainTex.texture, GUILayout.Width(mainTex.texture.width), GUILayout.Height(mainTex.texture.height)); GUILayout.EndVertical(); if (normalTex != null) { GUILayout.Space(5); GUILayout.BeginVertical(); GUILayout.Label("Normal Map: " + normalTex.url); if (normalTex.texture.width > 430 || normalTex.texture.height > 270) { _scrollPosNM = GUILayout.BeginScrollView(_scrollPosNM, GUI.skin.box, GUILayout.MinWidth(450), GUILayout.MinHeight(290)); GUILayout.Box(normalTex.texture, GUI.skin.box, GUILayout.Width(normalTex.texture.width), GUILayout.Height(normalTex.texture.height)); GUILayout.EndScrollView(); } else GUILayout.Box(normalTex.texture, GUILayout.Width(normalTex.texture.width), GUILayout.Height(normalTex.texture.height)); GUILayout.EndVertical(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
protected void drawBottomOverlay(TextureEditGUI gui) { GUILayout.BeginHorizontal(); positionSelector(gui, ref _overlay._position); GUILayout.Space(5); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); drawBottomOverlayExtras1(gui); _alphaSelector.draw(); GUILayout.Space(10f); rotationSelector(gui, ref _overlay._rotation, ref _overlay._mirror); GUILayout.Space(10f); blendMethodSelector(gui, ref _overlay._blendMethod); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (gui.kspTextureInfo().isSpecular || gui.kspTextureInfo().isTransparent) { _textureAlphaSelector.draw(); GUILayout.Space(10f); alphaOptionSelector(gui, ref _overlay._alphaOption); GUILayout.Space(10f); } if (gui.kspTextureInfo().hasNormalMap) { normalMapOptionSelector(gui, ref _overlay._normalOption); GUILayout.Space(10f); _normalScaleSelector.draw(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); if (_overlay._alpha != _alphaSelector.value()) { _overlay._alpha = _alphaSelector.value(); gui.setRemakePreview(); } if (_overlay._normalScale != _normalScaleSelector.value()) _overlay._normalScale = _normalScaleSelector.value(); if (_overlay._textureAlpha != _textureAlphaSelector.value()) _overlay._textureAlpha = _textureAlphaSelector.value(); }
protected void drawBottomMonoOverlay(TextureEditGUI gui) { drawBottomOverlay(gui); }
public override void drawRight(TextureEditGUI gui) { }
public override void drawBottom(TextureEditGUI gui) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); header(gui, "BASE TEXTURE (" + _singleBaseTexture._method.ToString() + ")"); GUILayout.Label("Name: " + gui.kspTextureInfo().displayName); GUILayout.Space(3); GUILayout.Label("Shader: " + gui.kspTextureInfo().shader); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Main Texture: " + _singleBaseTexture._main.url); if (_singleBaseTexture._main.texture.width > 430 || _singleBaseTexture._main.texture.height > 270) { _scrollPos = GUILayout.BeginScrollView(_scrollPos, GUI.skin.box, GUILayout.MinWidth(450), GUILayout.MinHeight(290)); GUILayout.Box(_singleBaseTexture._main.texture, GUI.skin.box, GUILayout.Width(_singleBaseTexture._main.texture.width), GUILayout.Height(_singleBaseTexture._main.texture.height)); GUILayout.EndScrollView(); } else GUILayout.Box(_singleBaseTexture._main.texture, GUILayout.Width(_singleBaseTexture._main.texture.width), GUILayout.Height(_singleBaseTexture._main.texture.height)); GUILayout.EndVertical(); if (_singleBaseTexture._hasNormalMap) { GUILayout.Space(5); GUILayout.BeginVertical(); GUILayout.Label("Normal Map: " + _singleBaseTexture._normalMap.url); if (_singleBaseTexture._normalMap.texture.width > 430 || _singleBaseTexture._normalMap.texture.height > 270) { _scrollPosNM = GUILayout.BeginScrollView(_scrollPosNM, GUI.skin.box, GUILayout.MinWidth(450), GUILayout.MinHeight(290)); GUILayout.Box(_singleBaseTexture._normalMap.texture, GUI.skin.box, GUILayout.Width(_singleBaseTexture._normalMap.texture.width), GUILayout.Height(_singleBaseTexture._normalMap.texture.height)); GUILayout.EndScrollView(); } else GUILayout.Box(_singleBaseTexture._normalMap.texture, GUILayout.Width(_singleBaseTexture._normalMap.texture.width), GUILayout.Height(_singleBaseTexture._normalMap.texture.height)); GUILayout.EndVertical(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public override void initialise(TextureEditGUI gui) { initialiseText(gui); _selectedFont = BitmapFontCache.Instance.getFontIndexByName(_imBitmapText._fontName); if (_selectedFont < 0) _selectedFont = 0; _fontSizeSelection = BitmapFontCache.Instance.getFontSizeIndex(_imBitmapText._fontName, _imBitmapText._fontSize); if (_fontSizeSelection < 0) _fontSizeSelection = 0; }
public override void drawRight(TextureEditGUI gui) { if (BitmapFontCache.Instance.fontInfo.Count == 0) return; bool newFontSelection = false; Color contentColor = GUI.contentColor; _fontScrollPos = GUILayout.BeginScrollView(_fontScrollPos, GUI.skin.box, GUILayout.MinWidth(200), GUILayout.ExpandHeight(true)); GUILayout.Label("Size"); if (_fontSizeGrid == null) { _fontSizeGrid = new string[BitmapFontCache.Instance.fontInfo[_selectedFont].sizes.Count]; for (int i = 0; i < _fontSizeGrid.Length; ++i) { _fontSizeGrid[i] = BitmapFontCache.Instance.fontInfo[_selectedFont].sizes[i].ToString(); } } int oldFontSizeSelection = _fontSizeSelection; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); _fontSizeSelection = GUILayout.SelectionGrid(_fontSizeSelection, _fontSizeGrid, 6); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (oldFontSizeSelection != _fontSizeSelection) newFontSelection = true; GUILayout.Space(3); GUILayout.Label("Font"); int oldSelectedFont = _selectedFont; for (int i = 0; i < BitmapFontCache.Instance.fontInfo.Count; ++i) { if (i == _selectedFont) GUI.contentColor = Global.SelectedColor; else GUI.contentColor = Global.NotSelectedColor; if (GUILayout.Button(BitmapFontCache.Instance.fontInfo[i].displayName, GUILayout.ExpandWidth(true))) { _selectedFont = i; _fontSizeGrid = null; int _lastFontSize = BitmapFontCache.Instance.fontInfo[oldSelectedFont].sizes[_fontSizeSelection]; _fontSizeSelection = BitmapFontCache.Instance.getFontSizeIndex(BitmapFontCache.Instance.fontInfo[_selectedFont].name, _lastFontSize); if (_fontSizeSelection < 0) _fontSizeSelection = 0; newFontSelection = true; } } GUILayout.EndScrollView(); GUI.contentColor = contentColor; if (newFontSelection) { gui.setRemakePreview(); _imBitmapText._fontName = BitmapFontCache.Instance.fontInfo[_selectedFont].name; _imBitmapText._fontSize = BitmapFontCache.Instance.fontInfo[_selectedFont].sizes[_fontSizeSelection]; } }
protected void initialiseOverlay(TextureEditGUI gui) { _alphaSelector = new ValueSelector<byte, ByteField>(_overlay._alpha, 0, 255, 1, "Alpha", Color.white); _textureAlphaSelector = new ValueSelector<byte, ByteField>(_overlay._textureAlpha, 0, 255, 1, "Texture Alpha", Color.white); _normalScaleSelector = new ValueSelector<float, FloatField>(_overlay._normalScale, 0, 5.0f, 0.1f, "Normal Scale", Color.white); if (gui.kspTextureInfo().isSpecular) _textureAlphaSelector.setLabel("Specularity"); else if (gui.kspTextureInfo().isTransparent) _textureAlphaSelector.setLabel("Transparency"); }
protected void initialiseMonoOverlay(TextureEditGUI gui) { initialiseOverlay(gui); _redSelector = new ValueSelector<byte, ByteField>(_overlay._red, 0, 255, 1, "Red", Color.red); _greenSelector = new ValueSelector<byte, ByteField>(_overlay._green, 0, 255, 1, "Green", Color.green); _blueSelector = new ValueSelector<byte, ByteField>(_overlay._blue, 0, 255, 1, "Blue", Color.blue); }
public void initialiseText(TextureEditGUI gui) { initialiseMonoOverlay(gui); }
protected virtual void drawBottomOverlayExtras1(TextureEditGUI gui) { }