Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions qml/MaterialEditorWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ ApplicationWindow {
statusText.text = "AI generating material..."
statusText.color = "orange"
}

function onAiGenerationCompleted(generatedScript) {
aiStatusIndicator.isGenerating = false
aiStatusIndicator.hasError = false

// Update the text area with the new script
materialTextArea.text = generatedScript

// Validate the script first
if (MaterialEditorQML.validateMaterialScript(generatedScript)) {
// Auto-apply if valid
Expand All @@ -70,14 +70,21 @@ ApplicationWindow {
statusText.color = "orange"
}
}

function onAiGenerationError(error) {
aiStatusIndicator.isGenerating = false
aiStatusIndicator.hasError = true
aiStatusIndicator.errorMessage = error
statusText.text = "AI error: " + error
statusText.color = "red"
}

function onSdPendingForMaterialChanged() {
if (MaterialEditorQML.sdPendingForMaterial) {
statusText.text = "Generating texture..."
statusText.color = "orange"
}
}
}

// Simplified Button component
Expand Down Expand Up @@ -718,9 +725,9 @@ ApplicationWindow {
}

MenuItem {
text: "PBR Material"
text: "Normal Map Material"
onTriggered: {
materialTextArea.text = "material PBRMaterial\n{\n technique\n {\n pass\n {\n ambient 0.1 0.1 0.1 1.0\n diffuse 0.8 0.8 0.8 1.0\n specular 0.04 0.04 0.04 1.0\n \n texture_unit // Albedo\n {\n texture albedo.png\n }\n \n texture_unit // Normal\n {\n texture normal.png\n }\n \n texture_unit // Roughness\n {\n texture roughness.png\n }\n }\n }\n}"
materialTextArea.text = "material NormalMapMaterial\n{\n technique\n {\n pass\n {\n ambient 0.2 0.2 0.2 1.0\n diffuse 0.8 0.8 0.8 1.0\n specular 0.5 0.5 0.5 32.0\n \n texture_unit\n {\n texture diffuse.png\n }\n \n texture_unit normal_map\n {\n texture normal.png\n }\n }\n }\n}"
}
}
}
Expand Down Expand Up @@ -865,7 +872,7 @@ ApplicationWindow {
ThemedTextField {
id: aiPromptInput
Layout.fillWidth: true
placeholderText: "Type a command like: 'add texture glow.png', 'make it transparent', 'create PBR material'"
placeholderText: "Describe the material (e.g., 'rusty metal', 'shiny glass', 'oak wood with normal map')"
enabled: !aiStatusIndicator.isGenerating && LLMManager.modelLoaded

background: Rectangle {
Expand Down Expand Up @@ -903,22 +910,28 @@ ApplicationWindow {
}
}

// Progress indicator for local LLM
// Combined progress indicator for LLM + SD
RowLayout {
Layout.fillWidth: true
visible: aiStatusIndicator.isGenerating && LLMManager.modelLoaded
visible: (aiStatusIndicator.isGenerating || MaterialEditorQML.sdPendingForMaterial || MaterialEditorQML.sdIsGenerating) && LLMManager.modelLoaded
spacing: 8

ProgressBar {
id: llmProgressBar
Layout.fillWidth: true
from: 0
to: 1
value: MaterialEditorQML.llmGenerationProgress
value: MaterialEditorQML.sdPendingForMaterial || MaterialEditorQML.sdIsGenerating ?
MaterialEditorQML.sdGenerationProgress :
MaterialEditorQML.llmGenerationProgress
}

Text {
text: Math.round(MaterialEditorQML.llmGenerationProgress * 100) + "%"
property real displayProgress: MaterialEditorQML.sdPendingForMaterial || MaterialEditorQML.sdIsGenerating ?
MaterialEditorQML.sdGenerationProgress :
MaterialEditorQML.llmGenerationProgress
text: (MaterialEditorQML.sdPendingForMaterial || MaterialEditorQML.sdIsGenerating ? "Texture: " : "LLM: ") +
Math.round(displayProgress * 100) + "%"
font.pointSize: 9
color: textColor
}
Expand Down
138 changes: 138 additions & 0 deletions qml/PassPropertiesPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ GroupBox {
// Lighting and Depth Settings
GroupBox {
title: "Lighting & Depth"
background: Rectangle {
color: MaterialEditorQML.panelColor
border.color: MaterialEditorQML.borderColor
border.width: 1
radius: 4
}
label: ThemedLabel {
text: parent.title
font.bold: true
}
Layout.fillWidth: true

ColumnLayout {
Expand All @@ -60,19 +70,61 @@ GroupBox {
spacing: 15

CheckBox {

text: "Lighting"

contentItem: Text {

text: parent.text

color: textColor

leftPadding: parent.indicator.width + parent.spacing

verticalAlignment: Text.AlignVCenter

}
Comment on lines +76 to +86
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use app theme colors for checkbox labels to avoid palette drift.

On Line 80, Line 100, Line 120, Line 221, Line 263, Line 305, and Line 347, checkbox label text is bound to textColor (SystemPalette), while the rest of the panel largely uses MaterialEditorQML.*. If app theme and OS palette diverge, label contrast can regress in dark mode.

🎨 Suggested fix
 contentItem: Text {
     text: parent.text
-    color: textColor
+    font: parent.font
+    color: parent.enabled
+           ? MaterialEditorQML.textColor
+           : MaterialEditorQML.disabledTextColor
     leftPadding: parent.indicator.width + parent.spacing
     verticalAlignment: Text.AlignVCenter
 }

Also applies to: 96-106, 116-126, 217-227, 259-269, 301-311, 343-353

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@qml/PassPropertiesPanel.qml` around lines 76 - 86, Replace usages of the
SystemPalette-derived textColor bound on the label Text elements with the app
theme color from MaterialEditorQML (e.g. change bindings that read "color:
textColor" in the Text contentItem blocks to use "color:
MaterialEditorQML.textColor" or the appropriate MaterialEditorQML label color
property); update every matching Text instance inside the checkbox rows (the
contentItem: Text blocks that reference parent.text and leftPadding:
parent.indicator.width + parent.spacing) so labels follow the app theme rather
than the OS palette.


checked: MaterialEditorQML.lightingEnabled
onCheckedChanged: MaterialEditorQML.setLightingEnabled(checked)
}

CheckBox {

text: "Depth Write"

contentItem: Text {

text: parent.text

color: textColor

leftPadding: parent.indicator.width + parent.spacing

verticalAlignment: Text.AlignVCenter

}

checked: MaterialEditorQML.depthWriteEnabled
onCheckedChanged: MaterialEditorQML.setDepthWriteEnabled(checked)
}

CheckBox {

text: "Depth Check"

contentItem: Text {

text: parent.text

color: textColor

leftPadding: parent.indicator.width + parent.spacing

verticalAlignment: Text.AlignVCenter

}

checked: MaterialEditorQML.depthCheckEnabled
onCheckedChanged: MaterialEditorQML.setDepthCheckEnabled(checked)
}
Expand Down Expand Up @@ -118,6 +170,16 @@ GroupBox {
// Colors
GroupBox {
title: "Colors"
background: Rectangle {
color: MaterialEditorQML.panelColor
border.color: MaterialEditorQML.borderColor
border.width: 1
radius: 4
}
label: ThemedLabel {
text: parent.title
font.bold: true
}
Layout.fillWidth: true

GridLayout {
Expand Down Expand Up @@ -149,7 +211,21 @@ GroupBox {
}
}
CheckBox {

text: "Use Vertex Color"

contentItem: Text {

text: parent.text

color: textColor

leftPadding: parent.indicator.width + parent.spacing

verticalAlignment: Text.AlignVCenter

}

checked: MaterialEditorQML.useVertexColorToAmbient
onCheckedChanged: MaterialEditorQML.setUseVertexColorToAmbient(checked)
}
Expand Down Expand Up @@ -177,7 +253,21 @@ GroupBox {
}
}
CheckBox {

text: "Use Vertex Color"

contentItem: Text {

text: parent.text

color: textColor

leftPadding: parent.indicator.width + parent.spacing

verticalAlignment: Text.AlignVCenter

}

checked: MaterialEditorQML.useVertexColorToDiffuse
onCheckedChanged: MaterialEditorQML.setUseVertexColorToDiffuse(checked)
}
Expand Down Expand Up @@ -205,7 +295,21 @@ GroupBox {
}
}
CheckBox {

text: "Use Vertex Color"

contentItem: Text {

text: parent.text

color: textColor

leftPadding: parent.indicator.width + parent.spacing

verticalAlignment: Text.AlignVCenter

}

checked: MaterialEditorQML.useVertexColorToSpecular
onCheckedChanged: MaterialEditorQML.setUseVertexColorToSpecular(checked)
}
Expand Down Expand Up @@ -233,7 +337,21 @@ GroupBox {
}
}
CheckBox {

text: "Use Vertex Color"

contentItem: Text {

text: parent.text

color: textColor

leftPadding: parent.indicator.width + parent.spacing

verticalAlignment: Text.AlignVCenter

}

checked: MaterialEditorQML.useVertexColorToEmissive
onCheckedChanged: MaterialEditorQML.setUseVertexColorToEmissive(checked)
}
Expand All @@ -243,6 +361,16 @@ GroupBox {
// Alpha and Material Properties
GroupBox {
title: "Alpha & Material"
background: Rectangle {
color: MaterialEditorQML.panelColor
border.color: MaterialEditorQML.borderColor
border.width: 1
radius: 4
}
label: ThemedLabel {
text: parent.title
font.bold: true
}
Layout.fillWidth: true

GridLayout {
Expand Down Expand Up @@ -339,6 +467,16 @@ GroupBox {
// Blending
GroupBox {
title: "Blending"
background: Rectangle {
color: MaterialEditorQML.panelColor
border.color: MaterialEditorQML.borderColor
border.width: 1
radius: 4
}
label: ThemedLabel {
text: parent.title
font.bold: true
}
Layout.fillWidth: true

GridLayout {
Expand Down
Loading
Loading