ModelSection.qml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. // Copyright (C) 2021 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
  3. import QtQuick 2.15
  4. import QtQuick.Layouts 1.15
  5. import HelperWidgets 2.0
  6. import StudioTheme 1.0 as StudioTheme
  7. Column {
  8. width: parent.width
  9. Section {
  10. caption: qsTr("Model")
  11. width: parent.width
  12. SectionLayout {
  13. PropertyLabel {
  14. text: qsTr("Source")
  15. tooltip: qsTr("Sets the location of the mesh file containing the geometry of this model.")
  16. }
  17. SecondColumnLayout {
  18. UrlChooser {
  19. id: sourceUrlChooser
  20. backendValue: backendValues.source
  21. filter: "*.mesh"
  22. defaultItems: ["#Rectangle" ,"#Sphere" ,"#Cube" ,"#Cone" ,"#Cylinder"]
  23. }
  24. ExpandingSpacer {}
  25. }
  26. PropertyLabel {
  27. text: qsTr("Geometry")
  28. tooltip: qsTr("Sets a custom geometry for the model")
  29. }
  30. SecondColumnLayout {
  31. ItemFilterComboBox {
  32. id: geometryComboBox
  33. typeFilter: "QtQuick3D.Geometry"
  34. backendValue: backendValues.geometry
  35. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  36. + StudioTheme.Values.actionIndicatorWidth
  37. Connections {
  38. target: geometryComboBox.backendValue
  39. function onExpressionChanged() {
  40. if (geometryComboBox.backendValue.expression !== "" &&
  41. sourceUrlChooser.backendValue.expression !== "")
  42. sourceUrlChooser.backendValue.resetValue()
  43. }
  44. }
  45. }
  46. ExpandingSpacer {}
  47. }
  48. PropertyLabel {
  49. text: qsTr("Materials")
  50. Layout.alignment: Qt.AlignTop
  51. Layout.topMargin: 5
  52. }
  53. SecondColumnLayout {
  54. EditableListView {
  55. backendValue: backendValues.materials
  56. model: backendValues.materials.expressionAsList
  57. Layout.fillWidth: true
  58. typeFilter: "QtQuick3D.Material"
  59. textRole: "idAndName"
  60. onAdd: function(value) { backendValues.materials.idListAdd(value) }
  61. onRemove: function(idx) { backendValues.materials.idListRemove(idx) }
  62. onReplace: function (idx, value) { backendValues.materials.idListReplace(idx, value) }
  63. extraButtonIcon: StudioTheme.Constants.material_medium
  64. extraButtonToolTip: qsTr("Edit material")
  65. onExtraButtonClicked: (idx) => { backendValues.materials.openMaterialEditor(idx) }
  66. }
  67. ExpandingSpacer {}
  68. }
  69. PropertyLabel {
  70. text: qsTr("Casts Shadows")
  71. tooltip: qsTr("Enables the geometry of this model to be rendered to the shadow maps.")
  72. }
  73. SecondColumnLayout {
  74. CheckBox {
  75. text: backendValues.castsShadows.valueToString
  76. backendValue: backendValues.castsShadows
  77. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  78. + StudioTheme.Values.actionIndicatorWidth
  79. }
  80. ExpandingSpacer {}
  81. }
  82. PropertyLabel {
  83. text: qsTr("Receives Shadows")
  84. tooltip: qsTr("Enables the geometry of this model to receive shadows.")
  85. }
  86. SecondColumnLayout {
  87. CheckBox {
  88. text: backendValues.receivesShadows.valueToString
  89. backendValue: backendValues.receivesShadows
  90. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  91. + StudioTheme.Values.actionIndicatorWidth
  92. }
  93. ExpandingSpacer {}
  94. }
  95. PropertyLabel {
  96. text: qsTr("Casts Reflections")
  97. tooltip: qsTr("Enables reflection probes to reflect this model.")
  98. }
  99. SecondColumnLayout {
  100. CheckBox {
  101. text: backendValues.castsReflections.valueToString
  102. backendValue: backendValues.castsReflections
  103. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  104. + StudioTheme.Values.actionIndicatorWidth
  105. }
  106. ExpandingSpacer {}
  107. }
  108. PropertyLabel {
  109. text: qsTr("Receives Reflections")
  110. tooltip: qsTr("Enables the geometry of this model to receive reflections from the nearest reflection probe. The model must be inside at least one reflection probe to start receiving reflections.")
  111. }
  112. SecondColumnLayout {
  113. CheckBox {
  114. text: backendValues.receivesReflections.valueToString
  115. backendValue: backendValues.receivesReflections
  116. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  117. + StudioTheme.Values.actionIndicatorWidth
  118. }
  119. ExpandingSpacer {}
  120. }
  121. PropertyLabel {
  122. text: qsTr("Is Pickable")
  123. tooltip: qsTr("Enables ray cast based picking for this model.")
  124. }
  125. SecondColumnLayout {
  126. CheckBox {
  127. text: backendValues.pickable.valueToString
  128. backendValue: backendValues.pickable
  129. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  130. + StudioTheme.Values.actionIndicatorWidth
  131. }
  132. ExpandingSpacer {}
  133. }
  134. PropertyLabel {
  135. text: qsTr("Used in Baked Lighting")
  136. tooltip: qsTr("This model is static and suitable to contribute to baked lighting.")
  137. }
  138. SecondColumnLayout {
  139. CheckBox {
  140. text: backendValues.usedInBakedLighting.valueToString
  141. backendValue: backendValues.usedInBakedLighting
  142. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  143. + StudioTheme.Values.actionIndicatorWidth
  144. }
  145. ExpandingSpacer {}
  146. }
  147. PropertyLabel {
  148. text: qsTr("Depth Bias")
  149. tooltip: qsTr("Sets the depth bias of the model.")
  150. }
  151. SecondColumnLayout {
  152. SpinBox {
  153. minimumValue: -9999999
  154. maximumValue: 9999999
  155. decimals: 0
  156. backendValue: backendValues.depthBias
  157. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  158. + StudioTheme.Values.actionIndicatorWidth
  159. }
  160. ExpandingSpacer {}
  161. }
  162. PropertyLabel {
  163. text: qsTr("LOD Bias")
  164. tooltip: qsTr("Sets the size a model needs to be when rendered before the automatic level of detail meshes are used")
  165. }
  166. SecondColumnLayout {
  167. SpinBox {
  168. minimumValue: 0.0
  169. maximumValue: 9999999
  170. decimals: 2
  171. backendValue: backendValues.levelOfDetailBias
  172. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  173. + StudioTheme.Values.actionIndicatorWidth
  174. }
  175. ExpandingSpacer {}
  176. }
  177. }
  178. }
  179. Section {
  180. caption: qsTr("Instancing")
  181. width: parent.width
  182. SectionLayout {
  183. PropertyLabel {
  184. text: qsTr("Data Source")
  185. tooltip: qsTr("If this property is set, the model will not be rendered normally. Instead, a number of instances of the model will be rendered, as defined by the instance table.")
  186. }
  187. SecondColumnLayout {
  188. ItemFilterComboBox {
  189. typeFilter: "QtQuick3D.Instancing"
  190. backendValue: backendValues.instancing
  191. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  192. + StudioTheme.Values.actionIndicatorWidth
  193. }
  194. ExpandingSpacer {}
  195. }
  196. PropertyLabel {
  197. text: qsTr("Origin Node")
  198. tooltip: qsTr("Sets the origin of the instance’s coordinate system.")
  199. }
  200. SecondColumnLayout {
  201. ItemFilterComboBox {
  202. typeFilter: "QtQuick3D.Node"
  203. backendValue: backendValues.instanceRoot
  204. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  205. + StudioTheme.Values.actionIndicatorWidth
  206. }
  207. ExpandingSpacer {}
  208. }
  209. }
  210. }
  211. Section {
  212. caption: qsTr("Animation")
  213. width: parent.width
  214. SectionLayout {
  215. PropertyLabel {
  216. text: qsTr("Skeleton")
  217. tooltip: qsTr("Sets the skeleton for the model.")
  218. }
  219. SecondColumnLayout {
  220. ItemFilterComboBox {
  221. typeFilter: "QtQuick3D.Skeleton"
  222. backendValue: backendValues.skeleton
  223. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  224. + StudioTheme.Values.actionIndicatorWidth
  225. }
  226. ExpandingSpacer {}
  227. }
  228. PropertyLabel {
  229. text: qsTr("Morph Targets")
  230. tooltip: qsTr("Sets a list of MorphTargets used to render the provided geometry.")
  231. Layout.alignment: Qt.AlignTop
  232. Layout.topMargin: 5
  233. }
  234. SecondColumnLayout {
  235. EditableListView {
  236. backendValue: backendValues.morphTargets
  237. model: backendValues.morphTargets.expressionAsList
  238. Layout.fillWidth: true
  239. typeFilter: "QtQuick3D.MorphTarget"
  240. onAdd: function(value) { backendValues.morphTargets.idListAdd(value) }
  241. onRemove: function(idx) { backendValues.morphTargets.idListRemove(idx) }
  242. onReplace: function (idx, value) { backendValues.morphTargets.idListReplace(idx, value) }
  243. }
  244. ExpandingSpacer {}
  245. }
  246. PropertyLabel {
  247. text: qsTr("Skin")
  248. tooltip: qsTr("Sets the skin for the model.")
  249. }
  250. SecondColumnLayout {
  251. ItemFilterComboBox {
  252. typeFilter: "QtQuick3D.Skin"
  253. backendValue: backendValues.skin
  254. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  255. + StudioTheme.Values.actionIndicatorWidth
  256. }
  257. ExpandingSpacer {}
  258. }
  259. }
  260. }
  261. Section {
  262. caption: qsTr("Lightmapping")
  263. width: parent.width
  264. SectionLayout {
  265. PropertyLabel {
  266. text: qsTr("Resolution")
  267. tooltip: qsTr("Sets the target resolution of the baked lightmap texture for the model.")
  268. }
  269. SecondColumnLayout {
  270. SpinBox {
  271. minimumValue: 128
  272. maximumValue: 4096
  273. decimals: 0
  274. stepSize: 128
  275. sliderIndicatorVisible: true
  276. backendValue: backendValues.lightmapBaseResolution
  277. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  278. + StudioTheme.Values.actionIndicatorWidth
  279. }
  280. ExpandingSpacer {}
  281. }
  282. PropertyLabel {
  283. text: qsTr("Lightmap")
  284. tooltip: qsTr("Sets the baked lightmap data for the model.")
  285. }
  286. SecondColumnLayout {
  287. ItemFilterComboBox {
  288. typeFilter: "QtQuick3D.BakedLightmap"
  289. backendValue: backendValues.bakedLightmap
  290. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  291. + StudioTheme.Values.actionIndicatorWidth
  292. }
  293. ExpandingSpacer {}
  294. }
  295. }
  296. }
  297. }