Effect Maker: Enable helper nodes

Helper nodes are nodes that another node depends on and are added
automatically when the depending node is added. Helper nodes are
placed before all other nodes. Helper nodes that do not contain
any properties are not shown. Helper nodes keep reference count
and are removed when last referring node is removed.

Task-number: QDS-11193
Change-Id: I036019afb1414ec6e98b2f949a18bd217753a910
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Mahmoud Badri
2023-12-07 18:32:55 +02:00
committed by Miikka Heikkinen
parent 6b6f74ccad
commit dc42b62ddf
12 changed files with 264 additions and 33 deletions

View File

@@ -0,0 +1,68 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: BSD-3-Clause
// This file should match the BlurHelper.qml in qtquickdesigner repository, except for shader paths
import QtQuick
Item {
id: rootItem
property alias blurSrc1: blurredItemSource1
property alias blurSrc2: blurredItemSource2
property alias blurSrc3: blurredItemSource3
property alias blurSrc4: blurredItemSource4
property alias blurSrc5: blurredItemSource5
component BlurItem: ShaderEffect {
property vector2d offset: Qt.vector2d((1.0 + rootItem.blurMultiplier) / width,
(1.0 + rootItem.blurMultiplier) / height)
visible: false
layer.enabled: true
layer.smooth: true
vertexShader: g_propertyData.blur_vs_path
fragmentShader: g_propertyData.blur_fs_path
}
QtObject {
id: priv
property bool useBlurItem1: true
property bool useBlurItem2: rootItem.blurMax > 2
property bool useBlurItem3: rootItem.blurMax > 8
property bool useBlurItem4: rootItem.blurMax > 16
property bool useBlurItem5: rootItem.blurMax > 32
}
BlurItem {
id: blurredItemSource1
property Item src: priv.useBlurItem1 ? source : null
// Size of the first blurred item is by default half of the source.
// Increase for quality and decrease for performance & more blur.
readonly property int blurItemSize: 8
width: src ? Math.ceil(src.width / 16) * blurItemSize : 0
height: src ? Math.ceil(src.height / 16) * blurItemSize : 0
}
BlurItem {
id: blurredItemSource2
property Item src: priv.useBlurItem2 ? blurredItemSource1 : null
width: blurredItemSource1.width * 0.5
height: blurredItemSource1.height * 0.5
}
BlurItem {
id: blurredItemSource3
property Item src: priv.useBlurItem3 ? blurredItemSource2 : null
width: blurredItemSource2.width * 0.5
height: blurredItemSource2.height * 0.5
}
BlurItem {
id: blurredItemSource4
property Item src: priv.useBlurItem4 ? blurredItemSource3 : null
width: blurredItemSource3.width * 0.5
height: blurredItemSource3.height * 0.5
}
BlurItem {
id: blurredItemSource5
property Item src: priv.useBlurItem5 ? blurredItemSource4 : null
width: blurredItemSource4.width * 0.5
height: blurredItemSource4.height * 0.5
}
}

View File

@@ -17,16 +17,17 @@ HelperWidgets.Section {
caption: nodeName
category: "EffectMaker"
draggable: true
draggable: !isDependency
fillBackground: true
showCloseButton: true
showCloseButton: !isDependency
closeButtonToolTip: qsTr("Remove")
visible: repeater.count > 0 || !isDependency
onCloseButtonClicked: {
EffectMakerBackend.effectMakerModel.removeNode(root.modelIndex)
}
showEyeButton: true
showEyeButton: !isDependency
eyeEnabled: nodeEnabled
eyeButtonToolTip: qsTr("Enable/Disable Node")
@@ -38,6 +39,7 @@ HelperWidgets.Section {
spacing: 10
Repeater {
id: repeater
model: nodeUniformsModel
EffectCompositionNodeUniform {

View File

@@ -213,7 +213,8 @@ Item {
currItem.y = root.secsY[i]
}
} else if (i < root.moveFromIdx) {
if (root.draggedSec.y < currItem.y + (currItem.height - root.draggedSec.height) * .5) {
if (!repeater.model.isDependencyNode(i)
&& root.draggedSec.y < currItem.y + (currItem.height - root.draggedSec.height) * .5) {
currItem.y = root.secsY[i] + root.draggedSec.height
root.moveToIdx = Math.min(root.moveToIdx, i)
} else {

View File

@@ -194,6 +194,13 @@ Column {
}
}
BlurHelper {
id: blurHelper
anchors.fill: parent
property int blurMax: g_propertyData.blur_helper_max_level ? g_propertyData.blur_helper_max_level : 64
property real blurMultiplier: g_propertyData.blurMultiplier ? g_propertyData.blurMultiplier : 0
}
Item {
id: componentParent
width: source.width