aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2022-06-23 14:20:56 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2022-06-23 13:06:04 +0000
commit8a8a2f5c5558d02eb1efb5c5e33d18c7d6b7e35d (patch)
tree0bc9d907dc4a133b3c28eabf10dd303608669a0b
parent7aaaccb2812d2eaa237861f914ef3fae3ba1dcee (diff)
QmlDesigner: Unify the background of 3D preview images
Added 3D checkerboard floor on all 3D previews. Since shadows generally look bad for arbitrary 3D scenes, and would mostly be obscured by the model itself as we want the light mostly from the front, removed shadows also from the material preview to unify the previews. Qt5 had issues rendering the 3D floor texture, so used a static image there, as Qt5 only generates previews of one size. Fixes: QDS-7078 Change-Id: I74d094878ed01e6e531ad60df1f8d9d7cf415860 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
-rw-r--r--share/qtcreator/qml/qmlpuppet/editor3d_qt5.qrc2
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/images/static_floor.pngbin0 -> 2685 bytes
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt5/MaterialNodeView.qml24
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNode3DImageView.qml9
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNodeView.qml2
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml23
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNode3DImageView.qml44
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml2
8 files changed, 51 insertions, 55 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/editor3d_qt5.qrc b/share/qtcreator/qml/qmlpuppet/editor3d_qt5.qrc
index 7e023c127b..bbe9a910db 100644
--- a/share/qtcreator/qml/qmlpuppet/editor3d_qt5.qrc
+++ b/share/qtcreator/qml/qmlpuppet/editor3d_qt5.qrc
@@ -13,7 +13,7 @@
<file>mockfiles/images/directional@2x.png</file>
<file>mockfiles/images/point.png</file>
<file>mockfiles/images/point@2x.png</file>
- <file>mockfiles/images/floor_tex.png</file>
+ <file>mockfiles/images/static_floor.png</file>
<file>mockfiles/images/spot.png</file>
<file>mockfiles/images/spot@2x.png</file>
<file>mockfiles/qt5/AdjustableArrow.qml</file>
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/images/static_floor.png b/share/qtcreator/qml/qmlpuppet/mockfiles/images/static_floor.png
new file mode 100644
index 0000000000..93073719f5
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/images/static_floor.png
Binary files differ
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/MaterialNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/MaterialNodeView.qml
index c36d8c227c..9fee06e0ad 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/MaterialNodeView.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/MaterialNodeView.qml
@@ -45,10 +45,6 @@ View3D {
Node {
DirectionalLight {
- shadowMapQuality: Light.ShadowMapQualityMedium
- shadowFilter: 20
- shadowFactor: 21
- castsShadow: true
eulerRotation.x: -26
eulerRotation.y: -57
}
@@ -68,25 +64,5 @@ View3D {
source: "#Sphere"
materials: previewMaterial
}
-
- Model {
- id: floorModel
- source: "#Rectangle"
- scale.y: 8
- scale.x: 8
- eulerRotation.x: -90
- materials: floorMaterial
- DefaultMaterial {
- id: floorMaterial
- diffuseMap: floorTex
-
- Texture {
- id: floorTex
- source: "../images/floor_tex.png"
- scaleU: floorModel.scale.x
- scaleV: floorModel.scale.y
- }
- }
- }
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNode3DImageView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNode3DImageView.qml
index a6d5c6b1db..70b9dbc4d0 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNode3DImageView.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNode3DImageView.qml
@@ -123,14 +123,13 @@ Item {
anchors.fill: parent
}
- Rectangle {
+ // We can use static image in Qt5 as only small previews will be generated
+ Image {
id: backgroundRect
anchors.fill: parent
z: -1
- gradient: Gradient {
- GradientStop { position: 1.0; color: "#222222" }
- GradientStop { position: 0.0; color: "#999999" }
- }
+ source: "../images/static_floor.png"
+ fillMode: Image.Stretch
}
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNodeView.qml
index b497b0419a..82688bbef5 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNodeView.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt5/ModelNodeView.qml
@@ -70,7 +70,7 @@ View3D {
materials: [
DefaultMaterial {
- diffuseColor: "#4aee45"
+ diffuseColor: "#999999"
}
]
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml
index ed5cfea56f..94051d5f6e 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/MaterialNodeView.qml
@@ -45,10 +45,6 @@ View3D {
Node {
DirectionalLight {
- shadowMapQuality: Light.ShadowMapQualityMedium
- shadowFilter: 20
- shadowFactor: 21
- castsShadow: true
eulerRotation.x: -26
eulerRotation.y: -57
}
@@ -70,24 +66,5 @@ View3D {
materials: previewMaterial
}
- Model {
- id: floorModel
- source: "#Rectangle"
- scale.y: 8
- scale.x: 8
- eulerRotation.x: -90
- materials: floorMaterial
- DefaultMaterial {
- id: floorMaterial
- diffuseMap: floorTex
-
- Texture {
- id: floorTex
- source: "../images/floor_tex.png"
- scaleU: floorModel.scale.x
- scaleV: floorModel.scale.y
- }
- }
- }
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNode3DImageView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNode3DImageView.qml
index 5caac0047c..031d01d65f 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNode3DImageView.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNode3DImageView.qml
@@ -126,6 +126,50 @@ Item {
GradientStop { position: 1.0; color: "#222222" }
GradientStop { position: 0.0; color: "#999999" }
}
+
+ // Use View3D instead of static image to make background look good on all resolutions
+ View3D {
+ anchors.fill: parent
+ environment: sceneEnv
+
+ SceneEnvironment {
+ id: sceneEnv
+ antialiasingMode: SceneEnvironment.MSAA
+ antialiasingQuality: SceneEnvironment.High
+ }
+
+ DirectionalLight {
+ eulerRotation.x: -26
+ eulerRotation.y: -57
+ }
+
+ PerspectiveCamera {
+ y: 125
+ z: 120
+ eulerRotation.x: -31
+ clipNear: 1
+ clipFar: 1000
+ }
+
+ Model {
+ id: floorModel
+ source: "#Rectangle"
+ scale.y: 8
+ scale.x: 8
+ eulerRotation.x: -90
+ materials: floorMaterial
+ DefaultMaterial {
+ id: floorMaterial
+ diffuseMap: floorTex
+ Texture {
+ id: floorTex
+ source: "../images/floor_tex.png"
+ scaleU: floorModel.scale.x
+ scaleV: floorModel.scale.y
+ }
+ }
+ }
+ }
}
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml
index 4da76ea097..ea2e23837f 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/ModelNodeView.qml
@@ -70,7 +70,7 @@ View3D {
materials: [
DefaultMaterial {
- diffuseColor: "#4aee45"
+ diffuseColor: "#999999"
}
]
}