mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 08:53:07 +02:00
Better propGroup
This commit is contained in:
parent
26b581fc74
commit
f7896b6407
3 changed files with 98 additions and 45 deletions
|
@ -25,13 +25,13 @@ Prop.PropGroup {
|
||||||
|
|
||||||
property var rootConfig : Render
|
property var rootConfig : Render
|
||||||
property var jobPath: ""
|
property var jobPath: ""
|
||||||
property alias jobName: root.label
|
property alias label: root.label
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var props = Jet.job_propKeys(rootConfig.getConfig(jobPath));
|
var props = Jet.job_propKeys(rootConfig.getConfig(jobPath));
|
||||||
//console.log(JSON.stringify(props));
|
console.log(JSON.stringify(props));
|
||||||
for (var p in props) {
|
for (var p in props) {
|
||||||
root.propItems.push({"type": "PropBool", "object": rootConfig.getConfig(jobPath), "property":props[p] })
|
root.propItems.push({"object": rootConfig.getConfig(jobPath), "property":props[p] })
|
||||||
}
|
}
|
||||||
root.updatePropItems();
|
root.updatePropItems();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,27 +25,58 @@ Item {
|
||||||
|
|
||||||
property var label: "group"
|
property var label: "group"
|
||||||
|
|
||||||
|
Item {
|
||||||
Column {
|
id: header
|
||||||
id: column
|
height: global.slimHeight
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
PropLabel {
|
PropLabel {
|
||||||
anchors.left: parent.left
|
id: labelControl
|
||||||
anchors.right: parent.right
|
anchors.left: header.left
|
||||||
|
width: 0.8 * header.width
|
||||||
|
anchors.verticalCenter: header.verticalCenter
|
||||||
text: root.label
|
text: root.label
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: headerRect
|
||||||
|
color: global.color
|
||||||
|
border.color: global.colorBorderLight
|
||||||
|
border.width: global.valueBorderWidth
|
||||||
|
radius: global.valueBorderRadius
|
||||||
|
|
||||||
|
anchors.left: labelControl.right
|
||||||
|
anchors.right: header.right
|
||||||
|
anchors.verticalCenter: header.verticalCenter
|
||||||
|
height: parent.height
|
||||||
}
|
}
|
||||||
height: column.height
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: column
|
||||||
|
anchors.top: header.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
// Where the propItems are added
|
||||||
|
}
|
||||||
|
height: header.height + column.height
|
||||||
|
|
||||||
function updatePropItems() {
|
function updatePropItems() {
|
||||||
for (var i = 0; i < root.propItems.length; i++) {
|
for (var i = 0; i < root.propItems.length; i++) {
|
||||||
var proItem = root.propItems[i];
|
var proItem = root.propItems[i];
|
||||||
|
// valid object
|
||||||
|
if (proItem['object'] !== undefined && proItem['object'] !== null ) {
|
||||||
|
// valid property
|
||||||
|
if (proItem['property'] !== undefined && proItem.object[proItem.property] !== undefined) {
|
||||||
|
// check type
|
||||||
|
if (proItem['type'] === undefined) {
|
||||||
|
proItem['type'] = typeof(proItem.object[proItem.property])
|
||||||
|
}
|
||||||
switch(proItem.type) {
|
switch(proItem.type) {
|
||||||
|
case 'boolean':
|
||||||
case 'PropBool': {
|
case 'PropBool': {
|
||||||
var component = Qt.createComponent("PropBool.qml");
|
var component = Qt.createComponent("PropBool.qml");
|
||||||
component.createObject(column, {
|
component.createObject(column, {
|
||||||
|
@ -54,6 +85,7 @@ Item {
|
||||||
"property": proItem.property
|
"property": proItem.property
|
||||||
})
|
})
|
||||||
} break;
|
} break;
|
||||||
|
case 'number':
|
||||||
case 'PropScalar': {
|
case 'PropScalar': {
|
||||||
var component = Qt.createComponent("PropScalar.qml");
|
var component = Qt.createComponent("PropScalar.qml");
|
||||||
component.createObject(column, {
|
component.createObject(column, {
|
||||||
|
@ -74,6 +106,20 @@ Item {
|
||||||
"enums": (proItem["enums"] !== undefined ? proItem.enums : ["Undefined Enums !!!"]),
|
"enums": (proItem["enums"] !== undefined ? proItem.enums : ["Undefined Enums !!!"]),
|
||||||
})
|
})
|
||||||
} break;
|
} break;
|
||||||
|
case 'object': {
|
||||||
|
var component = Qt.createComponent("PropItem.qml");
|
||||||
|
component.createObject(column, {
|
||||||
|
"label": proItem.property,
|
||||||
|
"object": proItem.object,
|
||||||
|
"property": proItem.property,
|
||||||
|
})
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Invalid property: ' + JSON.stringify(proItem));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Invalid object: ' + JSON.stringify(proItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,15 @@ Rectangle {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
Jet.TaskPropView {
|
Jet.TaskPropView {
|
||||||
jobPath: "RenderMainView.LightingModel"
|
jobPath: "RenderMainView.ToneMapping"
|
||||||
label: "Le tone mapping Job"
|
label: "Le ToneMapping Job"
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
|
Jet.TaskPropView {
|
||||||
|
jobPath: "RenderMainView.Antialiasing"
|
||||||
|
label: "Le Antialiasing Job"
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
Loading…
Reference in a new issue