InstancingPropertiesPane.qml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Copyright (C) 2024 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
  3. import QtQuick
  4. import QtQuick.Controls
  5. import QtQuick.Layouts
  6. import QtQuick3D
  7. import Qt.labs.platform
  8. Pane {
  9. id: root
  10. required property InstanceListEntry instanceEntry
  11. required property Model targetModel
  12. ColumnLayout {
  13. CheckBox {
  14. id: enableInstCheckBox
  15. text: qsTr("Enable Instancing")
  16. onCheckStateChanged: {
  17. targetModel.enableInstancing = checkState == Qt.Checked
  18. }
  19. }
  20. ColumnLayout {
  21. visible: targetModel.enableInstancing
  22. RowLayout {
  23. Label {
  24. text: qsTr("Color")
  25. Layout.fillWidth: true
  26. }
  27. Button {
  28. id: colorButton
  29. text: qsTr("Instancing Color")
  30. Layout.fillWidth: true
  31. background: Rectangle {
  32. radius: 10
  33. color: root.instanceEntry.color
  34. }
  35. onClicked: {
  36. colorDialog.open()
  37. }
  38. }
  39. ColorDialog {
  40. id: colorDialog
  41. currentColor: root.instanceEntry.color
  42. onAccepted: root.instanceEntry.color = color
  43. }
  44. }
  45. RowLayout {
  46. Label {
  47. text: qsTr("CustomData.x")
  48. Layout.fillWidth: true
  49. }
  50. TextField {
  51. id: customXInput
  52. Layout.fillWidth: true
  53. validator: DoubleValidator { locale: "C" }
  54. onEditingFinished: {
  55. if (acceptableInput)
  56. root.instanceEntry.customData.x = parseFloat(text)
  57. }
  58. }
  59. }
  60. RowLayout {
  61. Label {
  62. text: qsTr("CustomData.y")
  63. Layout.fillWidth: true
  64. }
  65. TextField {
  66. id: customYInput
  67. Layout.fillWidth: true
  68. validator: DoubleValidator { locale: "C" }
  69. onEditingFinished: {
  70. if (acceptableInput)
  71. root.instanceEntry.customData.y = parseFloat(text)
  72. }
  73. }
  74. }
  75. RowLayout {
  76. Label {
  77. text: qsTr("CustomData.z")
  78. Layout.fillWidth: true
  79. }
  80. TextField {
  81. id: customZInput
  82. Layout.fillWidth: true
  83. validator: DoubleValidator { locale: "C" }
  84. onEditingFinished: {
  85. if (acceptableInput)
  86. root.instanceEntry.customData.z = parseFloat(text)
  87. }
  88. }
  89. }
  90. RowLayout {
  91. Label {
  92. text: qsTr("CustomData.w")
  93. Layout.fillWidth: true
  94. }
  95. TextField {
  96. id: customWInput
  97. Layout.fillWidth: true
  98. validator: DoubleValidator { locale: "C" }
  99. onEditingFinished: {
  100. if (acceptableInput)
  101. root.instanceEntry.customData.w = parseFloat(text)
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }