From a5c10abcac248dbce018f6b46de8bdbe111ed0a3 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 3 Oct 2019 17:04:40 -0700 Subject: [PATCH] Working on improving the material inspector --- libraries/fbx/src/FBXSerializer.cpp | 4 + .../utilities/render/materialInspector.qml | 101 ++++++++++++------ 2 files changed, 75 insertions(+), 30 deletions(-) diff --git a/libraries/fbx/src/FBXSerializer.cpp b/libraries/fbx/src/FBXSerializer.cpp index f8339ddd31..6b30c59595 100644 --- a/libraries/fbx/src/FBXSerializer.cpp +++ b/libraries/fbx/src/FBXSerializer.cpp @@ -177,6 +177,10 @@ glm::mat4 getGlobalTransform(const QMultiMap& _connectionParen break; } } + if (fbxModel.hasGeometricOffset && visitedNodes.size() > 1) { + qCWarning(modelformat) << "Here is a parent node with Geometric offset ?????" << url; + } + } return globalTransform; } diff --git a/scripts/developer/utilities/render/materialInspector.qml b/scripts/developer/utilities/render/materialInspector.qml index d4dad203cd..91e4617216 100644 --- a/scripts/developer/utilities/render/materialInspector.qml +++ b/scripts/developer/utilities/render/materialInspector.qml @@ -13,12 +13,19 @@ import QtQuick.Layouts 1.3 import stylesUit 1.0 import controlsUit 1.0 as HifiControls +import "../lib/prop" as Prop Rectangle { HifiConstants { id: hifi;} color: Qt.rgba(hifi.colors.baseGray.r, hifi.colors.baseGray.g, hifi.colors.baseGray.b, 0.8); id: root; + property var theMaterial: {} + property var theMaterialAttributes: {} + property var hasMaterial: false + + property var isReadOnly: true + function fromScript(message) { switch (message.method) { case "setObjectInfo": @@ -26,40 +33,74 @@ Rectangle { break; case "setMaterialJSON": materialJSONText.text = message.params.materialJSONText; + + theObject = JSON.parse(message.params.materialJSONText) + theMaterialAttributes = theObject.materials + console.log(JSON.stringify(theOtheMaterialAttributesbject)) + hasMaterial = (theMaterial !== undefined) break; } } - - Rectangle { - id: entityIDContainer - height: 52 - width: root.width - color: Qt.rgba(root.color.r * 0.7, root.color.g * 0.7, root.color.b * 0.7, 0.8); - TextEdit { - id: entityIDInfo - text: "Type: Unknown\nID: None\nMesh Part: Unknown" - font.pointSize: 9 - color: "#FFFFFF" - readOnly: true - selectByMouse: true - } - } - - Original.ScrollView { - anchors.top: entityIDContainer.bottom - height: root.height - entityIDContainer.height - width: root.width - clip: true - Original.ScrollBar.horizontal.policy: Original.ScrollBar.AlwaysOff - TextEdit { - id: materialJSONText - text: "Click an object to get material JSON" + + Column { + + anchors.left: parent.left + anchors.right: parent.right + + Rectangle { + id: entityIDContainer + height: 52 width: root.width - font.pointSize: 10 - color: "#FFFFFF" - readOnly: true - selectByMouse: true - wrapMode: Text.WordWrap + color: Qt.rgba(root.color.r * 0.7, root.color.g * 0.7, root.color.b * 0.7, 0.8); + TextEdit { + id: entityIDInfo + text: "Type: Unknown\nID: None\nMesh Part: Unknown" + font.pointSize: 9 + color: "#FFFFFF" + readOnly: true + selectByMouse: true + } + } + + Prop.PropScalar { + visible: hasMaterial && ("roughness" in theMaterialAttributes) + label: "roughness" + object: theMaterialAttributes + property: "roughness" + readOnly: isReadOnly + } + Prop.PropScalar { + visible: hasMaterial && ("opacity" in theMaterialAttributes) + label: "opacity" + object: theMaterialAttributes + property: "opacity" + readOnly: isReadOnly + } + + Prop.PropString { + visible: hasMaterial && ("albedoMap" in theMaterialAttributes) + label: "roughness" + object: theMaterialAttributes + property: "roughness" + readOnly: isReadOnly + } + + Original.ScrollView { + // anchors.top: entityIDContainer.bottom + height: root.height - entityIDContainer.height + width: root.width + clip: true + Original.ScrollBar.horizontal.policy: Original.ScrollBar.AlwaysOff + TextEdit { + id: materialJSONText + text: "Click an object to get material JSON" + width: root.width + font.pointSize: 10 + color: "#FFFFFF" + readOnly: true + selectByMouse: true + wrapMode: Text.WordWrap + } } } }