GradientPicker.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. //********************************** Banshee Engine (www.banshee4d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Collections.Generic;
  5. using BansheeEngine;
  6. namespace BansheeEditor
  7. {
  8. /** @addtogroup Windows
  9. * @{
  10. */
  11. /// <summary>
  12. /// A color gradient editor window that allows the user to add or modify colors from a color gradient.
  13. /// </summary>
  14. public class GradientPicker : ModalWindow
  15. {
  16. private const int EDITOR_HORZ_PADDING = 10;
  17. private const int TEX_WIDTH = 256;
  18. private const int TEX_HEIGHT = 4;
  19. private ColorGradient gradient;
  20. private GradientKeyEditor editor;
  21. private GUITexture guiGradientTexture;
  22. private GUICanvas overlayCanvas;
  23. private GUIPanel editorPanel;
  24. private GUIButton guiOK;
  25. private GUIButton guiCancel;
  26. private Texture texture;
  27. private SpriteTexture spriteTexture;
  28. private Action<bool, ColorGradient> closedCallback;
  29. /// <summary>
  30. /// Shows the gradient picker window.
  31. /// </summary>
  32. /// <param name="closedCallback">Optional callback to trigger when the user finishes editing the gradient or
  33. /// cancels out of the dialog.</param>
  34. /// <returns>An instance of the gradient picker window.</returns>
  35. public static GradientPicker Show(Action<bool, ColorGradient> closedCallback = null)
  36. {
  37. GradientPicker picker = new GradientPicker(new ColorGradient(), closedCallback);
  38. return picker;
  39. }
  40. /// <summary>
  41. /// Shows the gradient picker window and sets the initial gradient to show.
  42. /// </summary>
  43. /// <param name="gradient">Gradient to initially display in the window.</param>
  44. /// <param name="closedCallback">Optional callback to trigger when the user finishes editing the gradient or
  45. /// cancels out of the dialog.</param>
  46. /// <returns>A. instance of the gradient picker window.</returns>
  47. public static GradientPicker Show(ColorGradient gradient, Action<bool, ColorGradient> closedCallback = null)
  48. {
  49. GradientPicker picker = new GradientPicker(gradient, closedCallback);
  50. return picker;
  51. }
  52. /// <summary>
  53. /// Constructs a new gradient picker window.
  54. /// </summary>
  55. /// <param name="gradient">Gradient to initially display in the window.</param>
  56. /// <param name="closedCallback">Optional callback to trigger when the user finishes editing the gradient or
  57. /// cancels out of the dialog.</param>
  58. protected GradientPicker(ColorGradient gradient, Action<bool, ColorGradient> closedCallback = null)
  59. : base(false)
  60. {
  61. Title = new LocEdString("Gradient Picker");
  62. Width = 270;
  63. Height = 135;
  64. this.gradient = gradient;
  65. this.closedCallback = closedCallback;
  66. }
  67. private void OnInitialize()
  68. {
  69. guiOK = new GUIButton(new LocEdString("OK"));
  70. guiCancel = new GUIButton(new LocEdString("Cancel"));
  71. guiOK.OnClick += OnOK;
  72. guiCancel.OnClick += OnCancel;
  73. GUILayout mainVertLayout = GUI.AddLayoutY();
  74. mainVertLayout.AddSpace(10);
  75. GUILayout editorHorzLayout = mainVertLayout.AddLayoutX();
  76. editorHorzLayout.AddSpace(EDITOR_HORZ_PADDING);
  77. GUIPanel gradientEditorPanel = editorHorzLayout.AddPanel();
  78. editorHorzLayout.AddSpace(EDITOR_HORZ_PADDING);
  79. mainVertLayout.AddSpace(15);
  80. GUILayout buttonHorzLayout = mainVertLayout.AddLayoutX();
  81. buttonHorzLayout.AddFlexibleSpace();
  82. buttonHorzLayout.AddElement(guiOK);
  83. buttonHorzLayout.AddSpace(10);
  84. buttonHorzLayout.AddElement(guiCancel);
  85. buttonHorzLayout.AddFlexibleSpace();
  86. mainVertLayout.AddFlexibleSpace();
  87. editorPanel = gradientEditorPanel.AddPanel(0);
  88. GUIPanel editorOverlay = gradientEditorPanel.AddPanel(-1);
  89. overlayCanvas = new GUICanvas();
  90. editorOverlay.AddElement(overlayCanvas);
  91. GUILayout editorVertLayout = editorPanel.AddLayoutY();
  92. GUILayout guiGradientLayout = editorVertLayout.AddLayoutX();
  93. guiGradientLayout.AddSpace(GradientKeyEditor.RECT_WIDTH / 2);
  94. texture = Texture.Create2D(TEX_WIDTH, TEX_HEIGHT);
  95. spriteTexture = new SpriteTexture(texture);
  96. guiGradientTexture = new GUITexture(spriteTexture, GUITextureScaleMode.ScaleToFit);
  97. guiGradientTexture.SetHeight(30);
  98. UpdateTexture();
  99. guiGradientLayout.AddElement(guiGradientTexture);
  100. guiGradientLayout.AddSpace(GradientKeyEditor.RECT_WIDTH / 2);
  101. editorVertLayout.AddSpace(10);
  102. editor = new GradientKeyEditor(editorVertLayout, gradient.GetKeys(), Width - EDITOR_HORZ_PADDING * 2, 20);
  103. editor.OnGradientModified += colorGradient =>
  104. {
  105. gradient = colorGradient;
  106. UpdateTexture();
  107. UpdateKeyLines();
  108. };
  109. editorVertLayout.AddFlexibleSpace();
  110. GUITexture containerBg = new GUITexture(null, EditorStylesInternal.ContainerBg);
  111. Rect2I containerBounds = editor.GetBounds(GUI);
  112. containerBounds.x -= 2;
  113. containerBounds.y -= 2;
  114. containerBounds.width += 4;
  115. containerBounds.height += 6;
  116. containerBg.Bounds = containerBounds;
  117. GUIPanel editorUnderlay = GUI.AddPanel(1);
  118. editorUnderlay.AddElement(containerBg);
  119. UpdateKeyLines();
  120. EditorInput.OnPointerPressed += OnPointerPressed;
  121. EditorInput.OnPointerDoubleClick += OnPointerDoubleClicked;
  122. EditorInput.OnPointerMoved += OnPointerMoved;
  123. EditorInput.OnPointerReleased += OnPointerReleased;
  124. EditorInput.OnButtonUp += OnButtonUp;
  125. }
  126. private void OnDestroy()
  127. {
  128. EditorInput.OnPointerPressed -= OnPointerPressed;
  129. EditorInput.OnPointerDoubleClick -= OnPointerDoubleClicked;
  130. EditorInput.OnPointerMoved -= OnPointerMoved;
  131. EditorInput.OnPointerReleased -= OnPointerReleased;
  132. EditorInput.OnButtonUp -= OnButtonUp;
  133. }
  134. /// <summary>
  135. /// Draws lines connecting the individual key color over the gradient itself.
  136. /// </summary>
  137. private void UpdateKeyLines()
  138. {
  139. overlayCanvas.Clear();
  140. ColorGradientKey[] keys = gradient.GetKeys();
  141. for (int i = 0; i < keys.Length; i++)
  142. {
  143. int pixel = editor.TimeToPixel(keys[i].time);
  144. overlayCanvas.DrawLine(new Vector2I(pixel, 0), new Vector2I(pixel, 40), Color.DarkGray);
  145. }
  146. }
  147. /// <summary>
  148. /// Updates the gradient texture.
  149. /// </summary>
  150. public void UpdateTexture()
  151. {
  152. const int width = 256;
  153. const int height = 4;
  154. Color[] colors = new Color[width * height];
  155. float halfPixel = 0.5f / width;
  156. for (int x = 0; x < width; x++)
  157. {
  158. Color color = gradient.Evaluate(x / (float)width + halfPixel);
  159. for (int y = 0; y < height; y++)
  160. colors[y * width + x] = color;
  161. }
  162. texture.SetPixels(colors);
  163. guiGradientTexture.SetTexture(spriteTexture);
  164. }
  165. /// <summary>
  166. /// Triggered when the user selects a gradient and closes the dialog.
  167. /// </summary>
  168. void OnOK()
  169. {
  170. closedCallback?.Invoke(true, gradient);
  171. Close();
  172. }
  173. /// <summary>
  174. /// Triggered when the user cancels gradient editing and closes the dialog.
  175. /// </summary>
  176. void OnCancel()
  177. {
  178. closedCallback?.Invoke(false, gradient);
  179. Close();
  180. }
  181. #region Input callbacks
  182. /// <summary>
  183. /// Triggered when the user presses a mouse button.
  184. /// </summary>
  185. /// <param name="ev">Information about the mouse press event.</param>
  186. private void OnPointerPressed(PointerEvent ev)
  187. {
  188. if (ev.IsUsed)
  189. return;
  190. editor.OnPointerPressed(ScreenToKeyEditorPos(ev.ScreenPos), ev.Button);
  191. }
  192. /// <summary>
  193. /// Triggered when the user double clicks the left mouse button.
  194. /// </summary>
  195. /// <param name="ev">Information about the mouse event.</param>
  196. private void OnPointerDoubleClicked(PointerEvent ev)
  197. {
  198. if (ev.IsUsed)
  199. return;
  200. Vector2I panelPos = ScreenToKeyEditorPos(ev.ScreenPos);
  201. Rect2I guiGradientBounds = guiGradientTexture.Bounds;
  202. if (guiGradientBounds.Contains(panelPos))
  203. {
  204. Vector2I canvasPos = panelPos - new Vector2I(guiGradientBounds.x, guiGradientBounds.y);
  205. float time = canvasPos.x / (float) Math.Max(guiGradientBounds.width - 1, 1);
  206. if (time >= 0.0f && time <= 1.0f)
  207. {
  208. List<ColorGradientKey> keys = new List<ColorGradientKey>(gradient.GetKeys());
  209. keys.Add(new ColorGradientKey(Color.Black, time));
  210. keys.Sort((lhs, rhs) => lhs.time.CompareTo(rhs.time));
  211. gradient = new ColorGradient(keys.ToArray());
  212. UpdateTexture();
  213. editor.Rebuild(keys);
  214. UpdateKeyLines();
  215. }
  216. }
  217. else
  218. editor.OnPointerDoubleClicked(panelPos, ev.Button);
  219. }
  220. /// <summary>
  221. /// Triggered when the user moves the mouse.
  222. /// </summary>
  223. /// <param name="ev">Information about the mouse move event.</param>
  224. private void OnPointerMoved(PointerEvent ev)
  225. {
  226. if (ev.IsUsed)
  227. return;
  228. editor.OnPointerMoved(ScreenToKeyEditorPos(ev.ScreenPos), ev.Button);
  229. }
  230. /// <summary>
  231. /// Triggered when the user releases a mouse button.
  232. /// </summary>
  233. /// <param name="ev">Information about the mouse release event.</param>
  234. private void OnPointerReleased(PointerEvent ev)
  235. {
  236. if (ev.IsUsed)
  237. return;
  238. editor.OnPointerReleased(ScreenToKeyEditorPos(ev.ScreenPos));
  239. }
  240. /// <summary>
  241. /// Triggered when the user releases a keyboard button.
  242. /// </summary>
  243. /// <param name="ev">Information about the keyboard release event.</param>
  244. private void OnButtonUp(ButtonEvent ev)
  245. {
  246. editor.OnButtonUp(ev);
  247. }
  248. /// <summary>
  249. /// Converts screen coordinates in coordinates relative to the panel containing the key editor control.
  250. /// </summary>
  251. /// <param name="screenPos">Coordinates in screen space.</param>
  252. /// <returns>Coordinates relative to the key editor control.</returns>
  253. private Vector2I ScreenToKeyEditorPos(Vector2I screenPos)
  254. {
  255. Vector2I windowPos = ScreenToWindowPos(screenPos);
  256. Rect2I elementBounds = GUIUtility.CalculateBounds(editorPanel, GUI);
  257. return windowPos - new Vector2I(elementBounds.x, elementBounds.y);
  258. }
  259. #endregion
  260. /// <summary>
  261. /// Handles drawing and editing of individual keys present on the color gradient.
  262. /// </summary>
  263. public class GradientKeyEditor
  264. {
  265. public const int RECT_WIDTH = 14;
  266. private static readonly Color SELECTED_COLOR = Color.BansheeOrange;
  267. private static readonly Color PLAIN_COLOR = Color.DarkGray;
  268. private const int DRAG_START_DISTANCE = 3;
  269. private GUICanvas canvas;
  270. private List<ColorGradientKey> keys = new List<ColorGradientKey>();
  271. private int width;
  272. private int height;
  273. private int selectedIdx = -1;
  274. private bool isMousePressedOverKey;
  275. private bool isDragInProgress;
  276. private Vector2I dragStart;
  277. /// <summary>
  278. /// Triggered whenever keyframe in a gradient is modified (added, removed or edited).
  279. /// </summary>
  280. public Action<ColorGradient> OnGradientModified;
  281. /// <summary>
  282. /// Constructs a new gradient key editor control.
  283. /// </summary>
  284. /// <param name="parent">GUI layout to attach the child GUI controls to.</param>
  285. /// <param name="keys">Set of keys to initially display on the editor.</param>
  286. /// <param name="width">Width of the editor in pixels.</param>
  287. /// <param name="height">Height of the editor in pixels.</param>
  288. public GradientKeyEditor(GUILayout parent, ColorGradientKey[] keys, int width, int height)
  289. {
  290. canvas = new GUICanvas();
  291. parent.AddElement(canvas);
  292. Rebuild(new List<ColorGradientKey>(keys), width, height);
  293. }
  294. /// <summary>
  295. /// Rebuilds the editor display using the provided color keys.
  296. /// </summary>
  297. /// <param name="keys">Set of keys to initially display on the editor.</param>
  298. public void Rebuild(List<ColorGradientKey> keys)
  299. {
  300. this.keys = keys;
  301. canvas.Clear();
  302. for (int i = 0; i < keys.Count; i++)
  303. DrawColor(keys[i].color, MathEx.Clamp01(keys[i].time), i == selectedIdx);
  304. }
  305. /// <summary>
  306. /// Returns the bounds of the GUI element relative to the provided panel.
  307. /// </summary>
  308. public Rect2I GetBounds(GUIPanel relativeTo)
  309. {
  310. return GUIUtility.CalculateBounds(canvas, relativeTo);
  311. }
  312. /// <summary>
  313. /// Rebuilds the editor display using the provided size and color keys.
  314. /// </summary>
  315. /// <param name="keys">Set of keys to initially display on the editor.</param>
  316. /// <param name="width">Width of the editor in pixels.</param>
  317. /// <param name="height">Height of the editor in pixels.</param>
  318. private void Rebuild(List<ColorGradientKey> keys, int width, int height)
  319. {
  320. this.width = width;
  321. this.height = height;
  322. canvas.SetWidth(width);
  323. canvas.SetHeight(height);
  324. Rebuild(keys);
  325. }
  326. /// <summary>
  327. /// Rebuilds the editor display using the currently set properties.
  328. /// </summary>
  329. private void Rebuild()
  330. {
  331. Rebuild(keys, width, height);
  332. }
  333. /// <summary>
  334. /// Attempts to find a color key rectangle at the specified location.
  335. /// </summary>
  336. /// <param name="pixelCoords">Pixel position to look at, relative to the canvas element.</param>
  337. /// <param name="keyIdx">Index of the color key, if any was found.</param>
  338. /// <returns>True if the key was found under the provided position, false otherwise.</returns>
  339. public bool FindKey(Vector2I pixelCoords, out int keyIdx)
  340. {
  341. keyIdx = -1;
  342. if (pixelCoords.y < 0 || pixelCoords.y >= height)
  343. return false;
  344. for (int i = 0; i < keys.Count; i++)
  345. {
  346. float t = MathEx.Clamp01(keys[i].time);
  347. int x = (int)(t * Math.Max(width - RECT_WIDTH, 0));
  348. if (pixelCoords.x >= x & pixelCoords.x < (x + RECT_WIDTH))
  349. {
  350. keyIdx = i;
  351. return true;
  352. }
  353. }
  354. return false;
  355. }
  356. /// <summary>
  357. /// Handles input. Should be called by the owning window whenever a pointer is pressed.
  358. /// </summary>
  359. /// <param name="panelPos">Position of the pointer relative to the panel parent to this element.</param>
  360. /// <param name="button">Pointer button involved in the event.</param>
  361. internal void OnPointerPressed(Vector2I panelPos, PointerButton button)
  362. {
  363. Rect2I canvasBounds = canvas.Bounds;
  364. Vector2I canvasPos = panelPos - new Vector2I(canvasBounds.x, canvasBounds.y);
  365. if (button == PointerButton.Left)
  366. {
  367. int keyIdx;
  368. if (FindKey(canvasPos, out keyIdx))
  369. {
  370. selectedIdx = keyIdx;
  371. isMousePressedOverKey = true;
  372. dragStart = canvasPos;
  373. }
  374. else
  375. selectedIdx = -1;
  376. Rebuild();
  377. }
  378. }
  379. /// <summary>
  380. /// Handles input. Should be called by the owning window whenever a pointer is double-clicked.
  381. /// </summary>
  382. /// <param name="panelPos">Position of the pointer relative to the panel parent to this element.</param>
  383. /// <param name="button">Pointer button involved in the event.</param>
  384. internal void OnPointerDoubleClicked(Vector2I panelPos, PointerButton button)
  385. {
  386. Rect2I canvasBounds = canvas.Bounds;
  387. if (!canvasBounds.Contains(panelPos))
  388. return;
  389. Vector2I canvasPos = panelPos - new Vector2I(canvasBounds.x, canvasBounds.y);
  390. int keyIdx;
  391. if (FindKey(canvasPos, out keyIdx))
  392. {
  393. ColorPicker.Show(keys[keyIdx].color,
  394. (b, color) =>
  395. {
  396. if (b)
  397. {
  398. ColorGradientKey key = keys[keyIdx];
  399. key.color = color;
  400. keys[keyIdx] = key;
  401. OnGradientModified?.Invoke(new ColorGradient(keys.ToArray()));
  402. Rebuild();
  403. }
  404. });
  405. }
  406. else
  407. {
  408. float time = PixelToTime(canvasPos.x);
  409. if (time >= 0.0f && time <= 1.0f)
  410. {
  411. keys.Add(new ColorGradientKey(Color.Black, time));
  412. keys.Sort((lhs, rhs) => lhs.time.CompareTo(rhs.time));
  413. OnGradientModified?.Invoke(new ColorGradient(keys.ToArray()));
  414. }
  415. Rebuild();
  416. }
  417. }
  418. /// <summary>
  419. /// Handles input. Should be called by the owning window whenever a pointer is moved.
  420. /// </summary>
  421. /// <param name="panelPos">Position of the pointer relative to the panel parent to this element.</param>
  422. /// <param name="button">Pointer button involved in the event.</param>
  423. internal void OnPointerMoved(Vector2I panelPos, PointerButton button)
  424. {
  425. if (button != PointerButton.Left)
  426. return;
  427. if (isMousePressedOverKey)
  428. {
  429. Rect2I canvasBounds = canvas.Bounds;
  430. Vector2I canvasPos = panelPos - new Vector2I(canvasBounds.x, canvasBounds.y);
  431. if (!isDragInProgress)
  432. {
  433. int distance = Vector2I.Distance(canvasPos, dragStart);
  434. if (distance >= DRAG_START_DISTANCE)
  435. isDragInProgress = true;
  436. }
  437. if (isDragInProgress)
  438. {
  439. float time = PixelToTime(canvasPos.x);
  440. if (time >= 0.0f && time <= 1.0f)
  441. {
  442. ColorGradientKey key = keys[selectedIdx];
  443. key.time = time;
  444. keys[selectedIdx] = key;
  445. OnGradientModified?.Invoke(new ColorGradient(keys.ToArray()));
  446. }
  447. Rebuild();
  448. }
  449. }
  450. }
  451. /// <summary>
  452. /// Handles input. Should be called by the owning window whenever a pointer is released.
  453. /// </summary>
  454. /// <param name="panelPos">Position of the pointer relative to the panel parent to this element.</param>
  455. internal void OnPointerReleased(Vector2I panelPos)
  456. {
  457. isDragInProgress = false;
  458. isMousePressedOverKey = false;
  459. }
  460. /// <summary>
  461. /// Handles input. Should be called by the owning window whenever a button is released.
  462. /// </summary>
  463. /// <param name="ev">Object containing button release event information.</param>
  464. internal void OnButtonUp(ButtonEvent ev)
  465. {
  466. if (ev.Button == ButtonCode.Delete && selectedIdx != -1 && !isMousePressedOverKey)
  467. {
  468. if (selectedIdx < keys.Count)
  469. {
  470. keys.RemoveAt(selectedIdx);
  471. OnGradientModified?.Invoke(new ColorGradient(keys.ToArray()));
  472. }
  473. selectedIdx = -1;
  474. Rebuild();
  475. }
  476. }
  477. /** Converts a pixel position over the editor (on x axis) to a time in range [0, 1]. */
  478. internal float PixelToTime(int x)
  479. {
  480. x -= RECT_WIDTH / 2;
  481. return x / (float) Math.Max(this.width - RECT_WIDTH, 0);
  482. }
  483. /** Converts a time in range [0, 1] to a pixel position over the editor (on x axis). */
  484. internal int TimeToPixel(float t)
  485. {
  486. return (int) Math.Min(t * Math.Max(width - RECT_WIDTH, 0), width - RECT_WIDTH - 1) + RECT_WIDTH / 2;
  487. }
  488. /// <summary>
  489. /// Draws a rectangle representing a single color key in the gradient.
  490. /// </summary>
  491. /// <param name="color">Color to display.</param>
  492. /// <param name="t">Time at which to draw the rectangle, in range [0, 1].</param>
  493. /// <param name="selected">True to draw the rectangle as selected, plain otherwise.</param>
  494. private void DrawColor(Color color, float t, bool selected)
  495. {
  496. int x = TimeToPixel(t);
  497. Vector2I a = new Vector2I(x + RECT_WIDTH / 2, 0);
  498. Vector2I b = new Vector2I(x + RECT_WIDTH / 2, height - 1);
  499. Vector2I c = new Vector2I(x - RECT_WIDTH / 2, 0);
  500. Vector2I d = new Vector2I(x - RECT_WIDTH / 2, height - 1);
  501. Vector2I[] linePoints = new Vector2I[] { a, b, d, c, a };
  502. Vector2I[] trianglePoints = new Vector2I[] { a, b, c, d };
  503. Color colorNoAlpha = color;
  504. colorNoAlpha.a = 1.0f;
  505. canvas.DrawTriangleStrip(trianglePoints, colorNoAlpha, 102);
  506. canvas.DrawPolyLine(linePoints, selected ? SELECTED_COLOR : PLAIN_COLOR, 100);
  507. Vector2I alphaA = new Vector2I(x - 1, height - 1);
  508. Vector2I alphaB = new Vector2I(x + RECT_WIDTH / 2, height / 2);
  509. Vector2I alphaC = new Vector2I(x + RECT_WIDTH / 2, height - 1);
  510. canvas.DrawTriangleList(new [] { alphaA, alphaB, alphaC }, Color.White * color.a, 101);
  511. }
  512. };
  513. }
  514. /** @} */
  515. }