properties_gui.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. module INSPECTOR {
  2. /**
  3. * Function that add gui objects properties to the variable PROPERTIES
  4. */
  5. export function loadGUIProperties(){
  6. let PROPERTIES_GUI = {
  7. 'ValueAndUnit': {
  8. type: BABYLON.GUI.ValueAndUnit,
  9. properties: ['_value', 'unit'],
  10. format: (valueAndUnit: BABYLON.GUI.ValueAndUnit) =>
  11. { return valueAndUnit }
  12. },
  13. 'Control': {
  14. type: BABYLON.GUI.Control,
  15. properties: [
  16. '_alpha',
  17. '_fontFamily',
  18. '_color',
  19. '_scaleX',
  20. '_scaleY',
  21. '_rotation',
  22. '_currentMeasure',
  23. '_width',
  24. '_height',
  25. '_left',
  26. '_top',
  27. '_linkedMesh',
  28. 'isHitTestVisible',
  29. 'isPointerBlocker',
  30. ],
  31. format: (control: BABYLON.GUI.Control) => { return control.name }
  32. },
  33. 'Button': {
  34. type: BABYLON.GUI.Button,
  35. properties: [],
  36. format: (button: BABYLON.GUI.Button) => { return button.name }
  37. },
  38. 'ColorPicker': {
  39. type: BABYLON.GUI.ColorPicker,
  40. properties: ['_value'],
  41. format: (colorPicker: BABYLON.GUI.ColorPicker) => { return colorPicker.name }
  42. },
  43. 'Checkbox': {
  44. type: BABYLON.GUI.Checkbox,
  45. properties: ['_isChecked', '_background'],
  46. format: (checkbox: BABYLON.GUI.Checkbox) => { return checkbox.name }
  47. },
  48. 'Ellipse': {
  49. type: BABYLON.GUI.Ellipse,
  50. properties: ['_thickness'],
  51. format: (ellipse: BABYLON.GUI.Ellipse) => { return ellipse.name }
  52. },
  53. 'Image': {
  54. type: BABYLON.GUI.Image,
  55. properties: [
  56. '_imageWidth',
  57. '_imageHeight',
  58. '_loaded',
  59. '_source',
  60. ],
  61. format: (image: BABYLON.GUI.Image) => { return image.name }
  62. },
  63. 'Line': {
  64. type: BABYLON.GUI.Line,
  65. properties: ['_lineWidth',
  66. '_background',
  67. '_x1',
  68. '_y1',
  69. '_x2',
  70. '_y2',
  71. ],
  72. format: (line: BABYLON.GUI.Line) => { return line.name }
  73. },
  74. 'RadioButton': {
  75. type: BABYLON.GUI.RadioButton,
  76. properties: ['_isChecked', '_background'],
  77. format: (radioButton: BABYLON.GUI.RadioButton) => { return radioButton.name }
  78. },
  79. 'Rectangle': {
  80. type: BABYLON.GUI.Rectangle,
  81. properties: ['_thickness', '_cornerRadius'],
  82. format: (rectangle: BABYLON.GUI.Rectangle) => { return rectangle.name }
  83. },
  84. 'Slider': {
  85. type: BABYLON.GUI.Slider,
  86. properties: [
  87. '_minimum',
  88. '_maximum',
  89. '_value',
  90. '_background',
  91. '_borderColor',
  92. ],
  93. format: (slider: BABYLON.GUI.Slider) => { return slider.name }
  94. },
  95. 'StackPanel': {
  96. type: BABYLON.GUI.StackPanel,
  97. properties: ['_isVertical'],
  98. format: (stackPanel: BABYLON.GUI.StackPanel) => { return stackPanel.name }
  99. },
  100. 'TextBlock': {
  101. type: BABYLON.GUI.TextBlock,
  102. properties: ['_text', '_textWrapping'],
  103. format: (textBlock: BABYLON.GUI.TextBlock) => { return textBlock.name }
  104. },
  105. 'Container': {
  106. type: BABYLON.GUI.Container,
  107. properties: ['_background'],
  108. format: (container: BABYLON.GUI.Container) => { return container.name }
  109. },
  110. }
  111. for (let prop in PROPERTIES_GUI) {
  112. PROPERTIES[prop] = PROPERTIES_GUI[prop];
  113. }
  114. }
  115. }