private void loadConfig(ConfigNode node) { if (Global.Debug3) Utils.Log("loadConfig start"); _ok = false; _transformNames = null; _transforms = null; kspTextureInfo = null; if (_gui != null) Destroy(_gui); _gui = null; _boundingBox = null; _transformsOption = TransformOption.USE_ALL; if (_baseTexture != null) _baseTexture.cleanUp(); _baseTexture = null; if (_imageModifiers != null) _imageModifiers.cleanUp(); _imageModifiers = null; if (node.HasNode("ASP_BOUNDINGBOX")) { if (_boundingBox == null) _boundingBox = new BoundingBox(); ConfigNode n = node.GetNode("ASP_BOUNDINGBOX"); _boundingBox.load(n); } if (node.HasValue("transformsOption")) _transformsOption = (TransformOption)ConfigNode.ParseEnum(typeof(TransformOption), node.GetValue("transformsOption")); if (node.HasNode("ASP_BASETEXTURE")) { ConfigNode n = node.GetNode("ASP_BASETEXTURE"); _baseTexture = IM.BaseTexture.CreateBaseTexture(n); _baseTexture.load(n); } if (node.HasNode("ASP_IMAGEMODIFIERS")) { _imageModifiers = new ImageModifiers(); ConfigNode n = node.GetNode("ASP_IMAGEMODIFIERS"); _imageModifiers.load(n); } if (label != string.Empty) Events["editTextureEvent"].guiName = label; }
public void editTextureEvent() { if (_ok == false) { // something has gone wrong in OnStart Utils.LogError("Incorrect start up, not displaying gui"); ScreenMessages.PostScreenMessage("Error unable to start text writer gui", 5, ScreenMessageStyle.UPPER_CENTER); return; } TextureEditGUI[] gs = gameObject.GetComponents<TextureEditGUI>() as TextureEditGUI[]; _gui = null; foreach (TextureEditGUI gui in gs) { if (gui.textureEdit() == this) { _gui = gui; break; } } if (_gui == null) { _gui = gameObject.AddComponent<TextureEditGUI>(); _gui.initialise(this, gs.Length); _usedPaint = false; } }
public void rotationSelector(TextureEditGUI gui, ref Rotation rotation, ref bool mirror) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true)); GUILayout.Label("Direction"); int selection = (int) rotation; int oldSelection = selection; selection = GUILayout.SelectionGrid(selection, _rotationGrid, 2); bool oldMirror = mirror; mirror = GUILayout.Toggle(mirror, "Mirror"); if (oldMirror != mirror) gui.setRemakePreview(); if (oldSelection != selection) { rotation = (Rotation)selection; gui.setRemakePreview(); } GUILayout.EndVertical(); }
public void finalisePainting() { if (_usedPaint == true && _startState != StartState.Editor) { if (_painter != null) { _painter.usePaint(); _painter = null; } _usedPaint = false; } _gui = null; }
public void normalMapOptionSelector(TextureEditGUI gui, ref NormalOption normalOption) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true)); GUILayout.Label("Normal Option"); int selection = (int)normalOption; int oldSelection = selection; selection = GUILayout.SelectionGrid(selection, _normalOptionGrid, 2); if (oldSelection != selection) { normalOption = (NormalOption)selection; gui.setRemakePreview(); } GUILayout.EndVertical(); }
public void positionSelector(TextureEditGUI gui, ref IntVector2 position) { bool repeatOK = false; bool buttonPressed = false; int button = 0; int delta = 1; if ((Time.time - Global.LastRepeat) > Global.AutoRepeatGap) repeatOK = true; if (gui.speedSelection < 0 || gui.speedSelection > 1) gui.speedSelection = 0; if (gui.speedSelection == 1) { button = 4; delta = 10; } GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(120)); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Position"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.RepeatButton(_posButtons[button], GUILayout.Width(25), GUILayout.Height(25))) { buttonPressed = true; Global.LastButtonPress = Time.time; if (repeatOK) position.y += delta; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.RepeatButton(_posButtons[button + 2], GUILayout.Width(25), GUILayout.Height(25))) { buttonPressed = true; Global.LastButtonPress = Time.time; if (repeatOK) position.x -= delta; } GUILayout.Space(5); if (GUILayout.Button("O", GUILayout.Width(25), GUILayout.Height(25))) { position = gui.centrePosition(); gui.setRemakePreview(); } GUILayout.Space(5); if (GUILayout.RepeatButton(_posButtons[button + 3], GUILayout.Width(25), GUILayout.Height(25))) { buttonPressed = true; Global.LastButtonPress = Time.time; if (repeatOK) position.x += delta; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.RepeatButton(_posButtons[button + 1], GUILayout.Width(25), GUILayout.Height(25))) { buttonPressed = true; Global.LastButtonPress = Time.time; if (repeatOK) position.y -= delta; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); gui.speedSelection = GUILayout.SelectionGrid(gui.speedSelection, _speedGrid, 2); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); if (buttonPressed && repeatOK) { Global.LastRepeat = Global.LastButtonPress; gui.setRemakePreview(); Global.AutoRepeatGap = Global.AutoRepeatGap * 0.8f; if (Global.AutoRepeatGap < 0.04f) Global.AutoRepeatGap = 0.04f; } }
public void header(TextureEditGUI gui, string text) { GUILayout.BeginHorizontal(gui.largeHeader); GUILayout.Space(20); GUILayout.Label(text, gui.largeHeader, GUILayout.ExpandWidth(true)); GUILayout.EndHorizontal(); }
public abstract void initialise(TextureEditGUI gui);
public abstract void drawRight(TextureEditGUI gui);
public abstract void drawBottom(TextureEditGUI gui);
public void colorSelector(TextureEditGUI gui, ref ValueSelector<byte, ByteField> redSelector, ref ValueSelector<byte, ByteField> greenSelector, ref ValueSelector<byte, ByteField> blueSelector, ref ValueSelector<byte, ByteField> alphaSelector) { if (redSelector.draw()) gui.setRemakePreview(); GUILayout.Space(10f); if (greenSelector.draw()) gui.setRemakePreview(); GUILayout.Space(10f); if (blueSelector.draw()) gui.setRemakePreview(); GUILayout.Space(10f); if (alphaSelector.draw()) gui.setRemakePreview(); }
public void blendMethodSelector(TextureEditGUI gui, ref BlendMethod blendMethod) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true)); GUILayout.Label("Blend Method"); int selection = (int)blendMethod; int oldSelection = selection; selection = GUILayout.SelectionGrid(selection, _blendMethodGrid, 2); if (oldSelection != selection) { blendMethod = (BlendMethod)selection; gui.setRemakePreview(); } GUILayout.EndVertical(); }
public void alphaOptionSelector(TextureEditGUI gui, ref AlphaOption alphaOption) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true)); GUILayout.Label("Alpha Option"); int selection = (int) alphaOption; int oldSelection = selection; selection = GUILayout.SelectionGrid(selection, _alphaOptionGrid, 1); if (oldSelection != selection) { alphaOption = (AlphaOption) selection; gui.setRemakePreview(); } GUILayout.EndVertical(); }