[ui] fix binding errors

This commit is contained in:
Julien-Haudegond 2020-08-17 11:24:37 +02:00
parent 79e96e7c06
commit b79795a3c9
4 changed files with 18 additions and 18 deletions

View file

@ -217,7 +217,7 @@ Entity {
// To use only if we want to draw the input source and not the current node output (Warning: to use with caution)
// There is maybe a better way to do this to avoid overwritting bindings which should be readonly properties
function drawInputSource() {
rawSource = Qt.binding(() => instantiatedEntity.currentNode.attribute("input").value)
rawSource = Qt.binding(() => instantiatedEntity.currentNode ? instantiatedEntity.currentNode.attribute("input").value: "")
currentSource = Qt.binding(() => rawSource)
finalSource = Qt.binding(() => rawSource)
}

View file

@ -62,19 +62,19 @@ Entity {
// Translation values from node (vector3d because this is the type of QTransform.translation)
property var nodeTranslation : Qt.vector3d(
root.currentMeshingNode.attribute("boundingBox.bboxTranslation.x").value,
root.currentMeshingNode.attribute("boundingBox.bboxTranslation.y").value,
root.currentMeshingNode.attribute("boundingBox.bboxTranslation.z").value
root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxTranslation.x").value : 0,
root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxTranslation.y").value : 0,
root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxTranslation.z").value : 0
)
// Rotation values from node (3 separated values because QTransform stores Euler angles like this)
property var nodeRotationX: root.currentMeshingNode.attribute("boundingBox.bboxRotation.x").value
property var nodeRotationY: root.currentMeshingNode.attribute("boundingBox.bboxRotation.y").value
property var nodeRotationZ: root.currentMeshingNode.attribute("boundingBox.bboxRotation.z").value
property var nodeRotationX: root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.x").value : 0
property var nodeRotationY: root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.y").value : 0
property var nodeRotationZ: root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.z").value : 0
// Scale values from node (vector3d because this is the type of QTransform.scale3D)
property var nodeScale: Qt.vector3d(
root.currentMeshingNode.attribute("boundingBox.bboxScale.x").value,
root.currentMeshingNode.attribute("boundingBox.bboxScale.y").value,
root.currentMeshingNode.attribute("boundingBox.bboxScale.z").value
root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxScale.x").value : 1,
root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxScale.y").value : 1,
root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxScale.z").value : 1
)
// Automatically evaluate the Transform: value is taken from the node OR from the actual modification if the gizmo is moved by mouse.

View file

@ -66,16 +66,16 @@ Entity {
// Translation values from node (vector3d because this is the type of QTransform.translation)
property var nodeTranslation : Qt.vector3d(
root.currentSfMTransformNode.attribute("manualTransform.manualTranslation.x").value,
root.currentSfMTransformNode.attribute("manualTransform.manualTranslation.y").value,
root.currentSfMTransformNode.attribute("manualTransform.manualTranslation.z").value
root.currentSfMTransformNode ? root.currentSfMTransformNode.attribute("manualTransform.manualTranslation.x").value : 0,
root.currentSfMTransformNode ? root.currentSfMTransformNode.attribute("manualTransform.manualTranslation.y").value : 0,
root.currentSfMTransformNode ? root.currentSfMTransformNode.attribute("manualTransform.manualTranslation.z").value : 0
)
// Rotation values from node (3 separated values because QTransform stores Euler angles like this)
property var nodeRotationX: root.currentSfMTransformNode.attribute("manualTransform.manualRotation.x").value
property var nodeRotationY: root.currentSfMTransformNode.attribute("manualTransform.manualRotation.y").value
property var nodeRotationZ: root.currentSfMTransformNode.attribute("manualTransform.manualRotation.z").value
property var nodeRotationX: root.currentSfMTransformNode ? root.currentSfMTransformNode.attribute("manualTransform.manualRotation.x").value : 0
property var nodeRotationY: root.currentSfMTransformNode ? root.currentSfMTransformNode.attribute("manualTransform.manualRotation.y").value : 0
property var nodeRotationZ: root.currentSfMTransformNode ? root.currentSfMTransformNode.attribute("manualTransform.manualRotation.z").value : 0
// Scale value from node (simple number because we use uniform scale)
property var nodeScale: root.currentSfMTransformNode.attribute("manualTransform.manualScale").value
property var nodeScale: root.currentSfMTransformNode ? root.currentSfMTransformNode.attribute("manualTransform.manualScale").value : 1
// Automatically evaluate the Transform: value is taken from the node OR from the actual modification if the gizmo is moved by mouse.
// When the gizmo has changed (with mouse), the new values are set to the node, the priority is given back to the node and the Transform is re-evaluated once with those values.