CustomMaterialSection.qml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. Section {
  8. caption: qsTr("Custom Material")
  9. width: parent.width
  10. SectionLayout {
  11. PropertyLabel {
  12. text: qsTr("Shading Mode")
  13. tooltip: qsTr("Sets the material type.\nUnshaded materials are not affected by the environment (for example, lights).")
  14. }
  15. SecondColumnLayout {
  16. ComboBox {
  17. scope: "CustomMaterial"
  18. model: ["Unshaded", "Shaded"]
  19. backendValue: backendValues.shadingMode
  20. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  21. + StudioTheme.Values.actionIndicatorWidth
  22. }
  23. ExpandingSpacer {}
  24. }
  25. PropertyLabel {
  26. text: qsTr("Vertex Shader")
  27. tooltip: qsTr("Sets the path to the vertex shader source file.")
  28. }
  29. SecondColumnLayout {
  30. UrlChooser {
  31. backendValue: backendValues.vertexShader
  32. filter: "*.vert *.vsh *.glslv *.glsl"
  33. }
  34. ExpandingSpacer {}
  35. }
  36. PropertyLabel {
  37. text: qsTr("Fragment Shader")
  38. tooltip: qsTr("Sets the path to the fragment shader source file.")
  39. }
  40. SecondColumnLayout {
  41. UrlChooser {
  42. backendValue: backendValues.fragmentShader
  43. filter: "*.frag *.fsh *.glslf *.glsl"
  44. }
  45. ExpandingSpacer {}
  46. }
  47. PropertyLabel {
  48. text: qsTr("Source Blend")
  49. tooltip: qsTr("Sets the source blend factor.")
  50. }
  51. SecondColumnLayout {
  52. ComboBox {
  53. scope: "CustomMaterial"
  54. model: ["NoBlend", "Zero", "One", "SrcColor", "OneMinusSrcColor", "DstColor", "OneMinusDstColor", "SrcAlpha", "OneMinusSrcAlpha", "DstAlpha", "OneMinusDstAlpha", "ConstantColor", "OneMinusConstantColor", "ConstantAlpha", "OneMinusConstantAlpha", "SrcAlphaSaturate"]
  55. backendValue: backendValues.sourceBlend
  56. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  57. + StudioTheme.Values.actionIndicatorWidth
  58. }
  59. ExpandingSpacer {}
  60. }
  61. PropertyLabel {
  62. text: qsTr("Destination Blend")
  63. tooltip: qsTr("Sets the destination blend factor.")
  64. }
  65. SecondColumnLayout {
  66. ComboBox {
  67. scope: "CustomMaterial"
  68. model: ["NoBlend", "Zero", "One", "SrcColor", "OneMinusSrcColor", "DstColor", "OneMinusDstColor", "SrcAlpha", "OneMinusSrcAlpha", "DstAlpha", "OneMinusDstAlpha", "ConstantColor", "OneMinusConstantColor", "ConstantAlpha", "OneMinusConstantAlpha", "SrcAlphaSaturate"]
  69. backendValue: backendValues.destinationBlend
  70. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  71. + StudioTheme.Values.actionIndicatorWidth
  72. }
  73. ExpandingSpacer {}
  74. }
  75. PropertyLabel {
  76. text: qsTr("Always Dirty")
  77. tooltip: qsTr("Sets the material to refresh every time it is used by QtQuick3D.")
  78. }
  79. SecondColumnLayout {
  80. CheckBox {
  81. text: backendValues.alwaysDirty.valueToString
  82. backendValue: backendValues.alwaysDirty
  83. implicitWidth: StudioTheme.Values.singleControlColumnWidth
  84. + StudioTheme.Values.actionIndicatorWidth
  85. }
  86. ExpandingSpacer {}
  87. }
  88. PropertyLabel {
  89. text: qsTr("Line Width")
  90. tooltip: qsTr("Sets the width of the lines when the geometry is using a primitive type of lines or line strips.")
  91. }
  92. SecondColumnLayout {
  93. SpinBox {
  94. minimumValue: 1
  95. maximumValue: 999999
  96. decimals: 2
  97. backendValue: backendValues.lineWidth
  98. implicitWidth: StudioTheme.Values.twoControlColumnWidth
  99. + StudioTheme.Values.actionIndicatorWidth
  100. }
  101. ExpandingSpacer {}
  102. }
  103. }
  104. }