mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-26 18:58:48 +02:00
Adding the material fields ui yeah, todo: many errors for undefined fields
This commit is contained in:
parent
579a27cfb9
commit
a5ccd07347
2 changed files with 178 additions and 10 deletions
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// PropItem.qml
|
||||||
|
//
|
||||||
|
// Created by Sam Gateau on 3/2/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
|
||||||
|
|
||||||
|
PropItem {
|
||||||
|
Global { id: global }
|
||||||
|
id: root
|
||||||
|
|
||||||
|
// Scalar Prop
|
||||||
|
// property bool integral: false
|
||||||
|
// property var numDigits: 2
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: valueLabel
|
||||||
|
|
||||||
|
anchors.left: root.splitter.right
|
||||||
|
anchors.right: root.right
|
||||||
|
anchors.verticalCenter: root.verticalCenter
|
||||||
|
// horizontalAlignment: global.valueTextAlign
|
||||||
|
height: global.slimHeight
|
||||||
|
|
||||||
|
function getColor() {
|
||||||
|
var c = root.valueVarGetter();
|
||||||
|
return Qt.rgba(c.red, c.green, c.blue, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// background: Rectangle {
|
||||||
|
color: { return getColor() }
|
||||||
|
border.color: global.colorBorderLight
|
||||||
|
border.width: global.valueBorderWidth
|
||||||
|
radius: global.valueBorderRadius
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,9 +34,8 @@ Rectangle {
|
||||||
case "setMaterialJSON":
|
case "setMaterialJSON":
|
||||||
materialJSONText.text = message.params.materialJSONText;
|
materialJSONText.text = message.params.materialJSONText;
|
||||||
|
|
||||||
theObject = JSON.parse(message.params.materialJSONText)
|
theMaterial = JSON.parse(message.params.materialJSONText)
|
||||||
theMaterialAttributes = theObject.materials
|
theMaterialAttributes = theMaterial.materials
|
||||||
console.log(JSON.stringify(theOtheMaterialAttributesbject))
|
|
||||||
hasMaterial = (theMaterial !== undefined)
|
hasMaterial = (theMaterial !== undefined)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +61,81 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("name" in theMaterialAttributes)
|
||||||
|
label: "name"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "name"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("model" in theMaterialAttributes)
|
||||||
|
label: "model"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "model"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
|
||||||
|
Prop.PropColor {
|
||||||
|
visible: hasMaterial && ("albedo" in theMaterialAttributes)
|
||||||
|
label: "albedo"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "albedo"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("albedoMap" in theMaterialAttributes)
|
||||||
|
label: "albedoMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "albedoMap"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
|
||||||
|
Prop.PropScalar {
|
||||||
|
visible: hasMaterial && ("opacity" in theMaterialAttributes)
|
||||||
|
label: "opacity"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "opacity"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropEnum {
|
||||||
|
visible: hasMaterial && ("opacityMapMode" in theMaterialAttributes)
|
||||||
|
label: "opacityMapMode"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "opacityMapMode"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
enums: ["None", "Mask", "Blend"]
|
||||||
|
}
|
||||||
|
Prop.PropScalar {
|
||||||
|
visible: hasMaterial && ("opacityCutoff" in theMaterialAttributes)
|
||||||
|
label: "opacity Cutoff"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "opacityCutoff"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("occlusionMap" in theMaterialAttributes)
|
||||||
|
label: "occlusionMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "occlusionMap"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("normalMap" in theMaterialAttributes)
|
||||||
|
label: "normalMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "normalMap"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("bumpMap" in theMaterialAttributes)
|
||||||
|
label: "normalMap from bumpMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "bumpMap"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
|
||||||
Prop.PropScalar {
|
Prop.PropScalar {
|
||||||
visible: hasMaterial && ("roughness" in theMaterialAttributes)
|
visible: hasMaterial && ("roughness" in theMaterialAttributes)
|
||||||
label: "roughness"
|
label: "roughness"
|
||||||
|
@ -70,18 +144,69 @@ Rectangle {
|
||||||
readOnly: isReadOnly
|
readOnly: isReadOnly
|
||||||
}
|
}
|
||||||
Prop.PropScalar {
|
Prop.PropScalar {
|
||||||
visible: hasMaterial && ("opacity" in theMaterialAttributes)
|
visible: hasMaterial && ("metallic" in theMaterialAttributes)
|
||||||
label: "opacity"
|
label: "metallic"
|
||||||
object: theMaterialAttributes
|
object: theMaterialAttributes
|
||||||
property: "opacity"
|
property: "metallic"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("roughnessMap" in theMaterialAttributes)
|
||||||
|
label: "roughnessMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "roughnessMap"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("glossMap" in theMaterialAttributes)
|
||||||
|
label: "roughnessMap from glossMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "glossMap"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("metallicMap" in theMaterialAttributes)
|
||||||
|
label: "metallicMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "metallicMap"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("specularMap" in theMaterialAttributes)
|
||||||
|
label: "metallicMap from specularMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "specularMap"
|
||||||
readOnly: isReadOnly
|
readOnly: isReadOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
Prop.PropString {
|
Prop.PropScalar {
|
||||||
visible: hasMaterial && ("albedoMap" in theMaterialAttributes)
|
visible: hasMaterial && ("scattering" in theMaterialAttributes)
|
||||||
label: "roughness"
|
label: "scattering"
|
||||||
object: theMaterialAttributes
|
object: theMaterialAttributes
|
||||||
property: "roughness"
|
property: "scattering"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("scatteringMap" in theMaterialAttributes)
|
||||||
|
label: "scatteringMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "scatteringMap"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Prop.PropColor {
|
||||||
|
visible: hasMaterial && ("emissive" in theMaterialAttributes)
|
||||||
|
label: "emissive"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "emissive"
|
||||||
|
readOnly: isReadOnly
|
||||||
|
}
|
||||||
|
Prop.PropString {
|
||||||
|
visible: hasMaterial && ("emissiveMap" in theMaterialAttributes)
|
||||||
|
label: "emissiveMap"
|
||||||
|
object: theMaterialAttributes
|
||||||
|
property: "emissiveMap"
|
||||||
readOnly: isReadOnly
|
readOnly: isReadOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue