133 lines
4.3 KiB
Diff
133 lines
4.3 KiB
Diff
|
From 9de2827a6ea5eb6ce7d8f845c4b4fc388b01da40 Mon Sep 17 00:00:00 2001
|
||
|
From: Mark Burton <markb@smartavionics.com>
|
||
|
Date: Mon, 22 Jul 2019 16:00:15 +0100
|
||
|
Subject: [PATCH] Set border_node's geometry and material before appending it
|
||
|
to paint_node.
|
||
|
|
||
|
---
|
||
|
UM/Qt/Bindings/PointingRectangle.py | 8 ++++++--
|
||
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/UM/Qt/Bindings/PointingRectangle.py b/UM/Qt/Bindings/PointingRectangle.py
|
||
|
index ddb8520db..a0a79c6a1 100644
|
||
|
--- UM/Qt/Bindings/PointingRectangle.py
|
||
|
+++ UM/Qt/Bindings/PointingRectangle.py
|
||
|
@@ -162,8 +162,9 @@ def updatePaintNode(self, paint_node, update_data):
|
||
|
|
||
|
if self._border_width > 0:
|
||
|
if paint_node.childCount() == 0:
|
||
|
- paint_node.appendChildNode(QSGGeometryNode())
|
||
|
- border_node = paint_node.firstChild()
|
||
|
+ border_node = QSGGeometryNode()
|
||
|
+ else:
|
||
|
+ border_node = paint_node.firstChild()
|
||
|
|
||
|
border_vertices = []
|
||
|
border_vertices.append((0, 0))
|
||
|
@@ -204,6 +205,9 @@ def updatePaintNode(self, paint_node, update_data):
|
||
|
border_material.setColor(self._border_color)
|
||
|
|
||
|
border_node.setMaterial(border_material)
|
||
|
+
|
||
|
+ if paint_node.childCount() == 0:
|
||
|
+ paint_node.appendChildNode(border_node)
|
||
|
else:
|
||
|
border_node = None
|
||
|
border_geometry = None
|
||
|
|
||
|
From c0fcf8e290b88fa276af7df8694e95d55aa912b9 Mon Sep 17 00:00:00 2001
|
||
|
From: Mark Burton <markb@smartavionics.com>
|
||
|
Date: Mon, 22 Jul 2019 19:47:15 +0100
|
||
|
Subject: [PATCH] ShaderEffect crashes on Linux with Qt 5.13 so replace with
|
||
|
ColorOverlay.
|
||
|
|
||
|
---
|
||
|
UM/Qt/qml/UM/RecolorImage.qml | 60 ++++-------------------------------
|
||
|
1 file changed, 6 insertions(+), 54 deletions(-)
|
||
|
|
||
|
diff --git a/UM/Qt/qml/UM/RecolorImage.qml b/UM/Qt/qml/UM/RecolorImage.qml
|
||
|
index c4f209154..5bd73a6b5 100644
|
||
|
--- UM/Qt/qml/UM/RecolorImage.qml
|
||
|
+++ UM/Qt/qml/UM/RecolorImage.qml
|
||
|
@@ -2,6 +2,7 @@
|
||
|
// Uranium is released under the terms of the LGPLv3 or higher.
|
||
|
|
||
|
import QtQuick 2.1
|
||
|
+import QtGraphicalEffects 1.0
|
||
|
import UM 1.3 as UM
|
||
|
|
||
|
Item
|
||
|
@@ -9,7 +10,7 @@ Item
|
||
|
id: base;
|
||
|
|
||
|
property alias source: img.source
|
||
|
- property alias color: shader.color
|
||
|
+ property alias color: overlay.color
|
||
|
property alias sourceSize: img.sourceSize
|
||
|
|
||
|
Image
|
||
|
@@ -21,59 +22,10 @@ Item
|
||
|
sourceSize.height: parent.height
|
||
|
}
|
||
|
|
||
|
- ShaderEffect
|
||
|
- {
|
||
|
- id: shader
|
||
|
+ ColorOverlay {
|
||
|
+ id: overlay
|
||
|
anchors.fill: parent
|
||
|
-
|
||
|
- property variant src: img
|
||
|
- property color color: "#fff"
|
||
|
-
|
||
|
- vertexShader: UM.OpenGLContextProxy.isLegacyOpenGL ?
|
||
|
- "
|
||
|
- uniform highp mat4 qt_Matrix;
|
||
|
- attribute highp vec4 qt_Vertex;
|
||
|
- attribute highp vec2 qt_MultiTexCoord0;
|
||
|
- varying highp vec2 coord;
|
||
|
- void main() {
|
||
|
- coord = qt_MultiTexCoord0;
|
||
|
- gl_Position = qt_Matrix * qt_Vertex;
|
||
|
- }
|
||
|
- " : "
|
||
|
- #version 410
|
||
|
- uniform highp mat4 qt_Matrix;
|
||
|
- in highp vec4 qt_Vertex;
|
||
|
- in highp vec2 qt_MultiTexCoord0;
|
||
|
- out highp vec2 coord;
|
||
|
- void main() {
|
||
|
- coord = qt_MultiTexCoord0;
|
||
|
- gl_Position = qt_Matrix * qt_Vertex;
|
||
|
- }
|
||
|
- "
|
||
|
-
|
||
|
- fragmentShader: UM.OpenGLContextProxy.isLegacyOpenGL ?
|
||
|
- "
|
||
|
- varying highp vec2 coord;
|
||
|
- uniform sampler2D src;
|
||
|
- uniform lowp vec4 color;
|
||
|
- uniform lowp float qt_Opacity;
|
||
|
- void main() {
|
||
|
- lowp vec4 tex = texture2D(src, coord);
|
||
|
- lowp float alpha = tex.a * qt_Opacity;
|
||
|
- gl_FragColor = vec4(color.r * alpha, color.g * alpha, color.b * alpha, alpha);
|
||
|
- }
|
||
|
- " : "
|
||
|
- #version 410
|
||
|
- in highp vec2 coord;
|
||
|
- uniform sampler2D src;
|
||
|
- uniform lowp vec4 color;
|
||
|
- uniform lowp float qt_Opacity;
|
||
|
- out vec4 frag_color;
|
||
|
- void main() {
|
||
|
- lowp vec4 tex = texture(src, coord);
|
||
|
- lowp float alpha = tex.a * qt_Opacity;
|
||
|
- frag_color = vec4(color.r * alpha, color.g * alpha, color.b * alpha, alpha);
|
||
|
- }
|
||
|
- "
|
||
|
+ source: img
|
||
|
+ color: "#fff"
|
||
|
}
|
||
|
}
|