Various bug fixes
This commit is contained in:
@@ -185,6 +185,10 @@
|
||||
<label>Shader Package</label>
|
||||
<default></default>
|
||||
</entry>
|
||||
<entry name="shader_package_index" type="Int">
|
||||
<label>Shader Package Index</label>
|
||||
<default>-1</default>
|
||||
</entry>
|
||||
<entry name="komplex_mode" type="Int">
|
||||
<label>Use the Komplex Mode</label>
|
||||
<default>0</default>
|
||||
|
||||
@@ -42,6 +42,8 @@ Item
|
||||
property vector4d iMouse
|
||||
property var iDate
|
||||
property bool running: true
|
||||
property bool ready: false
|
||||
|
||||
|
||||
// Individual channel resolutions to customize performance and quality
|
||||
property var iChannelResolution: [Qt.vector3d(wallpaper.configuration.iChannel0_resolution_x, wallpaper.configuration.iChannel0_resolution_y, pixelRatio),
|
||||
@@ -54,10 +56,19 @@ Item
|
||||
property string iChannel2: ""
|
||||
property string iChannel3: ""
|
||||
|
||||
property var bufferA: ShaderChannel { visible: true; width: mainItem.width; height: mainItem.height }
|
||||
property var bufferB: ShaderChannel { visible: true; width: mainItem.width; height: mainItem.height }
|
||||
property var bufferC: ShaderChannel { visible: true; width: mainItem.width; height: mainItem.height }
|
||||
property var bufferD: ShaderChannel { visible: true; width: mainItem.width; height: mainItem.height }
|
||||
property var pack: wallpaper.configuration.shader_package
|
||||
|
||||
onPackChanged: ()=>
|
||||
{
|
||||
if(mainItem.ready)
|
||||
shaderPackModel.loadJson(pack)
|
||||
}
|
||||
|
||||
ShaderChannel { id: bufferA; visible: true; anchors.fill: parent }
|
||||
ShaderChannel { id: bufferB; visible: true; anchors.fill: parent }
|
||||
ShaderChannel { id: bufferC; visible: true; anchors.fill: parent }
|
||||
ShaderChannel { id: bufferD; visible: true; anchors.fill: parent }
|
||||
|
||||
|
||||
id: mainItem
|
||||
|
||||
@@ -139,17 +150,15 @@ Item
|
||||
// Load the default shader pack configuration on component completion
|
||||
Component.onCompleted:
|
||||
{
|
||||
data.buffers.set("{bufferA}", mainItem.bufferA)
|
||||
data.buffers.set("{bufferB}", mainItem.bufferB)
|
||||
data.buffers.set("{bufferC}", mainItem.bufferC)
|
||||
data.buffers.set("{bufferD}", mainItem.bufferD)
|
||||
|
||||
console.log(data.buffers.has("{bufferA}"))
|
||||
data.buffers.set("{bufferA}", bufferA)
|
||||
data.buffers.set("{bufferB}", bufferB)
|
||||
data.buffers.set("{bufferC}", bufferC)
|
||||
data.buffers.set("{bufferD}", bufferD)
|
||||
|
||||
if(wallpaper.configuration.shader_package)
|
||||
shaderPackModel.loadJson(wallpaper.configuration.shader_package);
|
||||
else
|
||||
shaderPackModel.loadJson("/home/parametheus/kde/src/komplex/pack.json"); // Load a default shader pack if none is specified
|
||||
|
||||
ready = true
|
||||
}
|
||||
|
||||
// Recursive helper function to parse channels
|
||||
@@ -158,8 +167,8 @@ Item
|
||||
var source = getFilePath(json.source)
|
||||
|
||||
channel.frameBufferChannel = json.frame_buffer_channel !== undefined ? json.frame_buffer_channel : -1
|
||||
channel.type = json.type ? json.type : typeDefault
|
||||
channel.anchors.fill = mainItem
|
||||
channel.type = json.type !== undefined ? json.type : typeDefault
|
||||
channel.anchors.fill = channel.parent
|
||||
channel.visible = false
|
||||
channel.iMouse = Qt.binding(() => { return mainItem.iMouse; })
|
||||
channel.iTime = Qt.binding(() => { return mainItem.iTime; })
|
||||
@@ -295,13 +304,13 @@ Item
|
||||
var currentChannel = null;
|
||||
|
||||
if (pack.bufferA)
|
||||
parseChannel(mainItem.bufferA, pack.bufferA, 2);
|
||||
parseChannel(bufferA, pack.bufferA, 2);
|
||||
if (pack.bufferB)
|
||||
parseChannel(mainItem.bufferB, pack.bufferB, 2);
|
||||
parseChannel(bufferB, pack.bufferB, 2);
|
||||
if (pack.bufferC)
|
||||
parseChannel(mainItem.bufferC, pack.bufferC, 2);
|
||||
parseChannel(bufferC, pack.bufferC, 2);
|
||||
if (pack.bufferD)
|
||||
parseChannel(mainItem.bufferD, pack.bufferD, 2);
|
||||
parseChannel(bufferD, pack.bufferD, 2);
|
||||
|
||||
parseChannel(channelOutput, pack, 2)
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ Item
|
||||
Loader
|
||||
{
|
||||
id: loader
|
||||
anchors.fill: channel.invert ? null : parent
|
||||
anchors.fill: parent
|
||||
|
||||
sourceComponent: channelImage
|
||||
|
||||
|
||||
@@ -607,19 +607,15 @@ Item
|
||||
{
|
||||
case ShaderChannel.Type.CubeMapChannel:
|
||||
window.currentFolder = window.cubemapFolder
|
||||
window.tmp_source = ""
|
||||
break;
|
||||
case ShaderChannel.Type.ImageChannel:
|
||||
window.currentFolder = window.imageFolder
|
||||
window.tmp_source = ""
|
||||
break;
|
||||
case ShaderChannel.Type.ShaderChannel:
|
||||
window.currentFolder = window.shaderFolder
|
||||
window.tmp_source = ""
|
||||
break;
|
||||
case ShaderChannel.Type.VideoChannel:
|
||||
window.currentFolder = window.videoFolder
|
||||
window.tmp_source = ""
|
||||
break;
|
||||
case ShaderChannel.Type.AudioChannel:
|
||||
window.tmp_source = "Audio Channel"
|
||||
|
||||
@@ -122,46 +122,15 @@ Kirigami.FormLayout
|
||||
onCurrentIndexChanged: root.cfg_komplex_mode = currentIndex
|
||||
textRole: "label"
|
||||
model: [
|
||||
{ "label": i18nd("@option:komplex_mode", "ShaderToys") },
|
||||
{ "label": i18nd("@option:komplex_mode", "Simple") },
|
||||
{ "label": i18nd("@option:komplex_mode", "Komplex") }
|
||||
]
|
||||
}
|
||||
}
|
||||
TabBar
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
id: navBar
|
||||
width: parent.width
|
||||
TabButton {
|
||||
text: qsTr("Shader")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Shader Settings")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Extra Settings")
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Kirigami.InlineMessage
|
||||
{
|
||||
id: warningResources
|
||||
Layout.fillWidth: true
|
||||
type: Kirigami.MessageType.Warning
|
||||
text: qsTr("Some shaders might consume more power and resources than others, beware!")
|
||||
showCloseButton: true
|
||||
visible: !root.cfg_warningResources_dismissed
|
||||
onVisibleChanged: () =>
|
||||
{
|
||||
root.cfg_warningResources_dismissed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout
|
||||
{
|
||||
visible: root.cfg_komplex_mode === 0 && navBar.currentIndex === 0
|
||||
visible: root.cfg_komplex_mode === 0
|
||||
|
||||
id: shaderOutputLayout
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
@@ -239,6 +208,114 @@ Kirigami.FormLayout
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout
|
||||
{
|
||||
visible: root.cfg_komplex_mode === 1
|
||||
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Shader Pack:")
|
||||
|
||||
ComboBox
|
||||
{
|
||||
property string shader
|
||||
|
||||
id: selectedShaderPack
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 11
|
||||
model: shaderPackModel.availableShaderPacks
|
||||
delegate: Component
|
||||
{
|
||||
id: packListDelegate
|
||||
ItemDelegate
|
||||
{
|
||||
width: parent ? parent.width : 0
|
||||
text: modelData
|
||||
}
|
||||
}
|
||||
|
||||
textRole: "modelData"
|
||||
currentIndex: root.cfg_shader_package_index
|
||||
displayText: currentIndex === -1 ? "Custom File" : currentText.replace("_", " ").charAt(0).toUpperCase() + currentText.replace("_", " ").slice(1)
|
||||
|
||||
onCurrentTextChanged:
|
||||
{
|
||||
root.cfg_shader_package_index = currentIndex;
|
||||
|
||||
if (root.cfg_shader_package_index === -1)
|
||||
return;
|
||||
|
||||
var source = currentText
|
||||
shaderPackModel.loadMetadata(source)
|
||||
root.cfg_shader_package = "file://" + shaderPackModel.path(source)
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: packFileButton
|
||||
icon.name: "folder-symbolic"
|
||||
text: i18nd("@button:toggle_select_shader", "Select File")
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 9
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
|
||||
onClicked:
|
||||
{
|
||||
packDialog.currentFolder = "file://" + shaderPackModel.shaderPackInstallPath;
|
||||
packDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: packDialog
|
||||
fileMode: FileDialog.OpenFile
|
||||
title: i18nd("@dialog_title:choose_shader", "Choose a shader")
|
||||
// will accept and auto convert .frag in the near future
|
||||
nameFilters: ["Shader Package files (*.json)", "All files (*)"]
|
||||
visible: false
|
||||
currentFolder: "file://" + shaderPackModel.shaderPackInstallPath
|
||||
onAccepted:
|
||||
{
|
||||
root.cfg_shader_package_index = -1;
|
||||
root.cfg_shader_package = selectedFile;
|
||||
shaderPackModel.loadMetadataFromFile(selectedFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
TabBar
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
id: navBar
|
||||
width: parent.width
|
||||
TabButton {
|
||||
height: 36
|
||||
text: root.cfg_komplex_mode === 0 ? qsTr("Channels") : qsTr("Information")
|
||||
}
|
||||
TabButton {
|
||||
height: 36
|
||||
text: qsTr("Settings")
|
||||
}
|
||||
TabButton {
|
||||
height: 36
|
||||
text: qsTr("Extra Settings")
|
||||
}
|
||||
}
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Kirigami.InlineMessage
|
||||
{
|
||||
id: warningResources
|
||||
Layout.fillWidth: true
|
||||
type: Kirigami.MessageType.Warning
|
||||
text: qsTr("Some shaders might consume more power and resources than others, beware!")
|
||||
showCloseButton: true
|
||||
visible: !root.cfg_warningResources_dismissed
|
||||
onVisibleChanged: () =>
|
||||
{
|
||||
root.cfg_warningResources_dismissed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// iChannel0 Configuration
|
||||
RowLayout
|
||||
{
|
||||
@@ -748,78 +825,58 @@ Kirigami.FormLayout
|
||||
{
|
||||
visible: root.cfg_komplex_mode === 1 && navBar.currentIndex === 0
|
||||
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Shader Pack:")
|
||||
|
||||
ComboBox
|
||||
Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Author:")
|
||||
Text
|
||||
{
|
||||
property string shader
|
||||
|
||||
id: selectedShaderPack
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 11
|
||||
model: FolderListModel
|
||||
{
|
||||
id: packListModel
|
||||
showDirs: true
|
||||
showFiles: false
|
||||
showHidden: false
|
||||
nameFilters: ["*.frag.qsb"]
|
||||
folder: "file://" + shaderPackModel.shadersPath + "/generative"
|
||||
}
|
||||
delegate: Component
|
||||
{
|
||||
id: packListDelegate
|
||||
ItemDelegate
|
||||
{
|
||||
width: parent ? parent.width : 0
|
||||
text: fileBaseName.replace("_", " ").charAt(0).toUpperCase() + fileBaseName.replace("_", " ").slice(1)
|
||||
text: shaderPackModel.metadata.author
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: palette.text
|
||||
}
|
||||
}
|
||||
|
||||
textRole: "fileBaseName"
|
||||
currentIndex: root.cfg_shader_package_index
|
||||
displayText: currentIndex === -1 ? "Custom File" : currentText.replace("_", " ").charAt(0).toUpperCase() + currentText.replace("_", " ").slice(1)
|
||||
|
||||
onCurrentTextChanged:
|
||||
RowLayout
|
||||
{
|
||||
root.cfg_selectedShaderIndex = currentIndex;
|
||||
visible: root.cfg_komplex_mode === 1 && navBar.currentIndex === 0
|
||||
|
||||
if (root.cfg_selectedShaderIndex === -1)
|
||||
return;
|
||||
|
||||
var source = model.get(currentIndex, "fileUrl");
|
||||
shader = source;
|
||||
Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Description:")
|
||||
Text
|
||||
{
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 16
|
||||
text: shaderPackModel.metadata.description
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: palette.text
|
||||
wrapMode: Text.WordWrap
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
RowLayout
|
||||
{
|
||||
id: packFileButton
|
||||
icon.name: "folder-symbolic"
|
||||
text: i18nd("@button:toggle_select_shader", "Select File")
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 9
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
|
||||
onClicked:
|
||||
visible: root.cfg_komplex_mode === 1 && navBar.currentIndex === 0
|
||||
|
||||
Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "License:")
|
||||
Text
|
||||
{
|
||||
packDialog.currentFolder = "file://" + shaderPackModel.shaderPackInstallPath;
|
||||
packDialog.open();
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 11
|
||||
text: shaderPackModel.metadata.license
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: palette.text
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog
|
||||
RowLayout
|
||||
{
|
||||
id: packDialog
|
||||
fileMode: FileDialog.OpenFile
|
||||
title: i18nd("@dialog_title:choose_shader", "Choose a shader")
|
||||
// will accept and auto convert .frag in the near future
|
||||
nameFilters: ["Shader Package files (*.json)", "All files (*)"]
|
||||
visible: false
|
||||
currentFolder: "file://" + shaderPackModel.shaderPackInstallPath
|
||||
onAccepted:
|
||||
visible: root.cfg_komplex_mode === 1 && navBar.currentIndex === 0
|
||||
|
||||
Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Version:")
|
||||
Text
|
||||
{
|
||||
root.cfg_shader_package_index = -1;
|
||||
root.cfg_shader_package = selectedFile;
|
||||
}
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 11
|
||||
text: shaderPackModel.metadata.version
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
color: palette.text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user