[ui] display output 3D files when double clicking on a node

* iterate over output attributes to find an "obj" file
* make default material brighter
This commit is contained in:
Yann Lanthony 2018-01-05 12:13:15 +01:00
parent 76ec5a1913
commit b8f61bf033
6 changed files with 42 additions and 10 deletions

View file

@ -16,10 +16,10 @@ Entity {
property bool showTextures: true
property string diffuseMap: ""
property color ambient: "#999999"
property color ambient: "#AAA"
property real shininess
property color specular
property color diffuseColor: "#AA9999"
property color diffuseColor: "#AAA"
property alias object: instantiator.object
NodeInstantiator {

View file

@ -74,15 +74,24 @@ FocusScope {
// unparent previous material
// and exclude it from the entity components
comp.parent = null
continue; // skip original component and continue
}
else
comps.push(comp)
// make default material brighter
if(comp.toString().indexOf("QPhongMaterial") > -1) {
comp.diffuse = "#AAA"
comp.ambient = "#AAA"
}
comps.push(comp)
}
entity.components = comps
mats.forEach(function(m){
// create a material switcher for each material definition
var matSwitcher = materialSwitcherComponent.createObject(entity, m)
// bind textures checkbox to texture switch property
// trigger showTextures update by inverting it
// and re-bind textures checkbox to texture switch property
// (this double update ensure the texture display is correct)
matSwitcher.showTextures = !matSwitcher.showTextures
matSwitcher.showTextures = Qt.binding(function(){ return texturesCheckBox.checked })
})
})