2023-08-21 11:52:11 +03:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
2023-08-22 17:05:28 +03:00
|
|
|
import QtQuick.Dialogs
|
2023-08-21 11:52:11 +03:00
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import HelperWidgets as HelperWidgets
|
|
|
|
|
import StudioControls as StudioControls
|
2024-01-16 12:30:29 +01:00
|
|
|
import StudioTheme as StudioTheme
|
2024-01-26 14:55:50 +02:00
|
|
|
import EffectComposerBackend
|
2023-08-21 11:52:11 +03:00
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
|
2023-08-22 17:05:28 +03:00
|
|
|
height: layout.implicitHeight
|
2023-12-01 15:20:34 +02:00
|
|
|
visible: !uniformUseCustomValue
|
|
|
|
|
|
2024-03-19 14:52:20 +02:00
|
|
|
signal reset()
|
|
|
|
|
|
2023-08-22 17:05:28 +03:00
|
|
|
Component.onCompleted: {
|
2024-02-02 13:08:01 +02:00
|
|
|
if (uniformType === "int") {
|
2024-03-07 10:50:35 +02:00
|
|
|
if (uniformControlType === "channel")
|
|
|
|
|
valueLoader.source = "ValueChannel.qml"
|
|
|
|
|
else
|
|
|
|
|
valueLoader.source = "ValueInt.qml"
|
2024-02-02 13:08:01 +02:00
|
|
|
} else if (uniformType === "vec2") {
|
2023-08-22 17:05:28 +03:00
|
|
|
valueLoader.source = "ValueVec2.qml"
|
2024-02-02 13:08:01 +02:00
|
|
|
} else if (uniformType === "vec3") {
|
2023-08-22 17:05:28 +03:00
|
|
|
valueLoader.source = "ValueVec3.qml"
|
2024-02-02 13:08:01 +02:00
|
|
|
} else if (uniformType === "vec4") {
|
2023-08-22 17:05:28 +03:00
|
|
|
valueLoader.source = "ValueVec4.qml"
|
2024-02-02 13:08:01 +02:00
|
|
|
} else if (uniformType === "bool") {
|
2023-08-22 17:05:28 +03:00
|
|
|
valueLoader.source = "ValueBool.qml"
|
2024-02-02 13:08:01 +02:00
|
|
|
} else if (uniformType === "color") {
|
2023-08-24 15:21:52 +03:00
|
|
|
valueLoader.source = "ValueColor.qml"
|
2024-02-02 13:08:01 +02:00
|
|
|
} else if (uniformType === "sampler2D") {
|
2023-08-25 16:27:01 +03:00
|
|
|
valueLoader.source = "ValueImage.qml"
|
2024-02-02 13:08:01 +02:00
|
|
|
} else if (uniformType === "define") {
|
|
|
|
|
if (uniformControlType === "int")
|
|
|
|
|
valueLoader.source = "ValueInt.qml"
|
|
|
|
|
else if (uniformControlType === "bool")
|
|
|
|
|
valueLoader.source = "ValueBool.qml"
|
|
|
|
|
else
|
|
|
|
|
valueLoader.source = "ValueDefine.qml"
|
|
|
|
|
} else {
|
2023-08-22 17:05:28 +03:00
|
|
|
valueLoader.source = "ValueFloat.qml"
|
2024-02-02 13:08:01 +02:00
|
|
|
}
|
2023-08-22 17:05:28 +03:00
|
|
|
}
|
2023-08-21 11:52:11 +03:00
|
|
|
|
|
|
|
|
RowLayout {
|
2023-08-22 17:05:28 +03:00
|
|
|
id: layout
|
|
|
|
|
|
2023-08-21 11:52:11 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
Text {
|
2024-03-19 14:52:20 +02:00
|
|
|
id: textName
|
|
|
|
|
|
2024-02-05 14:59:46 +02:00
|
|
|
text: uniformDisplayName
|
2023-08-21 11:52:11 +03:00
|
|
|
color: StudioTheme.Values.themeTextColor
|
2023-09-05 18:03:05 +03:00
|
|
|
font.pixelSize: StudioTheme.Values.baseFontSize
|
2023-08-21 11:52:11 +03:00
|
|
|
horizontalAlignment: Text.AlignRight
|
2023-08-21 14:38:50 +03:00
|
|
|
Layout.maximumWidth: 140
|
|
|
|
|
Layout.minimumWidth: 140
|
|
|
|
|
Layout.preferredWidth: 140
|
2023-11-10 16:17:43 +02:00
|
|
|
elide: Text.ElideRight
|
2023-09-08 13:21:27 +03:00
|
|
|
|
|
|
|
|
HelperWidgets.ToolTipArea {
|
2024-03-19 14:52:20 +02:00
|
|
|
id: tooltipArea
|
|
|
|
|
|
2023-09-08 13:21:27 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
tooltip: uniformDescription
|
|
|
|
|
}
|
2023-08-21 11:52:11 +03:00
|
|
|
}
|
|
|
|
|
|
2024-03-19 14:52:20 +02:00
|
|
|
Item {
|
|
|
|
|
Layout.preferredHeight: 30
|
|
|
|
|
Layout.preferredWidth: 30
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: mouseArea
|
|
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HelperWidgets.IconButton {
|
|
|
|
|
id: iconButton
|
|
|
|
|
|
|
|
|
|
buttonSize: 24
|
|
|
|
|
icon: StudioTheme.Constants.reload_medium
|
|
|
|
|
iconSize: 16
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
visible: mouseArea.containsMouse || iconButton.containsMouse
|
|
|
|
|
tooltip: qsTr("Reset value")
|
|
|
|
|
onClicked: root.reset()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-21 11:52:11 +03:00
|
|
|
Loader {
|
2023-08-22 17:05:28 +03:00
|
|
|
id: valueLoader
|
2023-08-21 11:52:11 +03:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|