protected override void OnGUI() { _hoverPointIndex = GetPointAt(Event.current.mousePosition); DrawUI(); Width = _panelWidth + _panelMarginLeftRight * 2; Height = _panelHeight + _panelMarginTop + 90; _panelRect.Set(_panelMarginLeftRight, _panelMarginTop, _panelWidth, _panelHeight); EditorGUI.DrawRect(_panelRect, _panelColor); NodeUtils.DrawVerticalLine( new Vector2(_panelMarginLeftRight - 2, _panelHeight + _panelMarginTop), new Vector2(_panelMarginLeftRight - 2, _panelMarginTop), UnityEngine.Color.yellow, "out", "-1", "1"); NodeUtils.DrawHorizontalLine( new Vector2(_panelMarginLeftRight, _panelHeight + _panelMarginTop), new Vector2(_panelMarginLeftRight + _panelWidth, _panelHeight + _panelMarginTop), UnityEngine.Color.cyan, "in", "-1", "1"); DrawCoordinateSytem(); DrawLine(); for (int i = 0; i < _points.Count; i++) { DrawPoint(i); } HandleMouseEvents(); }
protected override void OnGUI() { if (!_textures[0].DoneInitialUpdate) { StartTextureJob(); } NodeUtils.DrawVerticalLine(new Vector2(TextureLeft - 2, CalcTextureHeight() + TextureTop), new Vector2(TextureLeft - 2, TextureTop), Config.ArrowY, "y", "-1", "1"); NodeUtils.DrawHorizontalLine(new Vector2(TextureLeft, CalcTextureHeight() + TextureTop), new Vector2(TextureLeft + CalcTextureWidth(), CalcTextureHeight() + TextureTop), Config.ArrowX, "x", "0", CalcTextureWidth() + ""); DrawTextures(); _tmpRect.Set(100, Height - 40, 50, 20); _showLine = GUI.Toggle(_tmpRect, _showLine, "line"); if (_showLine) { Handles.DrawLine(new Vector2(TextureLeft, TextureTop + CalcTextureHeight() / 2f), new Vector2(TextureLeft + CalcTextureWidth(), TextureTop + CalcTextureHeight() / 2f)); } }
protected override void OnGUI() { if (!_initializedSize) { ChangeTextureSize(_sizeModifcator * SizeStep); } if (!_textures[0].DoneInitialUpdate && _inputSocketNumber.IsConnected()) { StartJob(_textures[0]); } if (!_textures[1].DoneInitialUpdate && _inputSocketNumber.IsConnected()) { StartJob(_textures[1]); } float yOffset = CalcTextureHeight() + TextureTop + 25; if (!IsUpdatingTexture() && _textures[0] != null) { _tmpRect.Set(0, 0, 18, 20); if (GUI.Button(_tmpRect, "+")) { ChangeTextureSize(+SizeStep); _sizeModifcator++; } _tmpRect.Set(17, 0, 18, 20); if (CalcTextureWidth() > 100 && GUI.Button(_tmpRect, "-")) { ChangeTextureSize(-SizeStep); _sizeModifcator--; } _tmpRect.Set(34, 0, 27, 20); if (Width > 100 && GUI.Button(_tmpRect, "left")) { _textureOffsetX -= 50; Update(); } _tmpRect.Set(59, 0, 36, 20); if (Width > 100 && GUI.Button(_tmpRect, "right")) { _textureOffsetX += 50; Update(); } _tmpRect.Set(94, 0, 24, 20); if (Width > 100 && GUI.Button(_tmpRect, "up")) { _textureOffsetZ += 50; Update(); } _tmpRect.Set(117, 0, 38, 20); if (Width > 100 && GUI.Button(_tmpRect, "down")) { _textureOffsetZ -= 50; Update(); } float h = _textures[0].Height; float w = _textures[0].Width; if (!_inputSocketNumber.IsConnected() && _inputSocketVec.IsConnected()) { h = _textures[1].Height; } if (!_inputSocketNumber.IsConnected() && _inputSocketVec.IsConnected()) { w = _textures[1].Width; } NodeUtils.DrawVerticalLine( new Vector2(TextureLeft - 2, CalcTextureHeight() + TextureTop), new Vector2(TextureLeft - 2, TextureTop), Config.ArrowZ, "z", _textureOffsetZ + "", h + _textureOffsetZ + ""); NodeUtils.DrawHorizontalLine( new Vector2(TextureLeft, CalcTextureHeight() + TextureTop), new Vector2(CalcTextureWidth() + TextureLeft, CalcTextureHeight() + TextureTop), Config.ArrowX, "x", _textureOffsetX + "", w + _textureOffsetX + ""); } DrawTextures(); GUI.skin.label.alignment = TextAnchor.MiddleLeft; if (_textures[0] != null && !float.IsNaN(_textures[0].LowestValue)) { _tmpRect.Set(3, yOffset, 160, 20); string minMax = "y min " + Math.Round(_textures[0].LowestValue, 4); if (!float.IsNaN(_textures[0].HighestValue)) { minMax += " max " + Math.Round(_textures[0].HighestValue, 4); } GUI.Label(_tmpRect, minMax); _tmpRect.Set(3, yOffset + 20, 160, 20); GUI.Label(_tmpRect, "load heightmap " + _textures[0].ElapsedMillis / 1000f + " s"); } _tmpRect.Set(3, yOffset + 40, 100, 20); if (_lastVectors != null) { GUI.Label(_tmpRect, "vector count " + _lastVectors.Count); } else { GUI.Label(_tmpRect, "no vectors"); } GUI.skin.label.alignment = TextAnchor.MiddleCenter; }