From 2f11a66659dd26f3be64d0c833b1a668818d2cbf Mon Sep 17 00:00:00 2001 From: youhy Date: Wed, 10 Aug 2022 15:06:57 -0700 Subject: [PATCH 1/3] replace pose with gzpose Signed-off-by: youhy --- .../transform_control/TransformControl.qml | 175 ++++-------------- 1 file changed, 31 insertions(+), 144 deletions(-) diff --git a/src/gui/plugins/transform_control/TransformControl.qml b/src/gui/plugins/transform_control/TransformControl.qml index 2563902daa..a83cf2b556 100644 --- a/src/gui/plugins/transform_control/TransformControl.qml +++ b/src/gui/plugins/transform_control/TransformControl.qml @@ -58,12 +58,12 @@ ToolBar { } function updateSnapValues() { - xEntry.value = TransformControl.xSnap(); - yEntry.value = TransformControl.ySnap(); - zEntry.value = TransformControl.zSnap(); - rollEntry.value = TransformControl.rollSnap(); - pitchEntry.value = TransformControl.pitchSnap(); - yawEntry.value = TransformControl.yawSnap(); + gzPoseInstance.xValue = TransformControl.xSnap(); + gzPoseInstance.yValue = TransformControl.ySnap(); + gzPoseInstance.zValue = TransformControl.zSnap(); + gzPoseInstance.rollValue = TransformControl.rollSnap(); + gzPoseInstance.pitchValue = TransformControl.pitchSnap(); + gzPoseInstance.yawValue = TransformControl.yawSnap(); // TODO(anyone) enable scale button when support is added in ign-physics // xScaleEntry.value = TransformControl.xScaleSnap() // yScaleEntry.value = TransformControl.yScaleSnap() @@ -339,77 +339,9 @@ ToolBar { Layout.column: 0 bottomPadding: 10 } + Text { - text: "X" - color: snapItem - Layout.row: 1 - Layout.column: 0 - } - IgnSpinBox { - id: xEntry - minimumValue: 0.01 - maximumValue: 100.0 - decimals: 2 - stepSize: 0.01 - value: 1 - Layout.row: 1 - Layout.column: 1 - onEditingFinished: { - TransformControl.OnSnapUpdate( - xEntry.value, yEntry.value, zEntry.value, - rollEntry.value, pitchEntry.value, yawEntry.value, - 0, 0, 0 - ) - } - } - Text { - text: "Y" - color: snapItem - Layout.row: 2 - Layout.column: 0 - } - IgnSpinBox { - id: yEntry - minimumValue: 0.01 - maximumValue: 100.0 - decimals: 2 - stepSize: 0.01 - value: 1 - Layout.row: 2 - Layout.column: 1 - onEditingFinished: { - TransformControl.OnSnapUpdate( - xEntry.value, yEntry.value, zEntry.value, - rollEntry.value, pitchEntry.value, yawEntry.value, - 0, 0, 0 - ) - } - } - Text { - text: "Z" - color: snapItem - Layout.row: 3 - Layout.column: 0 - } - IgnSpinBox { - id: zEntry - minimumValue: 0.01 - maximumValue: 100.0 - decimals: 2 - stepSize: 0.01 - value: 1 - Layout.row: 3 - Layout.column: 1 - onEditingFinished: { - TransformControl.OnSnapUpdate( - xEntry.value, yEntry.value, zEntry.value, - rollEntry.value, pitchEntry.value, yawEntry.value, - 0, 0, 0 - ) - } - } - Text { - text: "Rotation (deg)" + text: "Rotation (rad)" font.weight: Font.Bold color: snapTitle Layout.columnSpan: 2 @@ -417,75 +349,30 @@ ToolBar { Layout.column: 2 bottomPadding: 10 } - Text { - text: "Roll" - color: snapItem - Layout.row: 1 - Layout.column: 2 - } - IgnSpinBox { - id: rollEntry - minimumValue: 0.01 - maximumValue: 180.0 - decimals: 2 - stepSize: 0.01 - value: 45 - Layout.row: 1 - Layout.column: 3 - onEditingFinished: { - TransformControl.OnSnapUpdate( - xEntry.value, yEntry.value, zEntry.value, - rollEntry.value, pitchEntry.value, yawEntry.value, - 0, 0, 0 - ) - } - } - Text { - text: "Pitch" - color: snapItem - Layout.row: 2 - Layout.column: 2 - } - IgnSpinBox { - id: pitchEntry - minimumValue: 0.01 - maximumValue: 180.0 - decimals: 2 - stepSize: 0.01 - value: 45 - Layout.row: 2 - Layout.column: 3 - onEditingFinished: { - TransformControl.OnSnapUpdate( - xEntry.value, yEntry.value, zEntry.value, - rollEntry.value, pitchEntry.value, yawEntry.value, - 0, 0, 0 - ) - } - } - Text { - text: "Yaw" - color: snapItem - Layout.row: 3 - Layout.column: 2 - } - IgnSpinBox { - id: yawEntry - minimumValue: 0.01 - maximumValue: 180.0 - decimals: 2 - stepSize: 0.01 - value: 45 - Layout.row: 3 - Layout.column: 3 - onEditingFinished: { - TransformControl.OnSnapUpdate( - xEntry.value, yEntry.value, zEntry.value, - rollEntry.value, pitchEntry.value, yawEntry.value, - 0, 0, 0 - ) + + GzPose { + id: gzPoseInstance + width: parent.width + Layout.columnSpan: 6 + Layout.fillWidth: true + readOnly: false + spinMax: 100.0 + + xValue: 1.0 + yValue: 1.0 + zValue: 1.0 + // 0.785 is PI /4 + rollValue: 0.785 + pitchValue: 0.785 + yawValue: 0.785 + + onGzPoseSet: { + // _x, _y, _z, _roll, _pitch, _yaw are parameters of signal gzPoseSet + // from gz-gui GzPose.qml + TransformControl.OnSnapUpdate(_x, _y, _z,_roll, _pitch, _yaw, 0, 0, 0) } - } + expand: true + } // gzPoseInstance ends } } } From 5fd186ec1bd775ca2c71831853fca2a5caa1eba4 Mon Sep 17 00:00:00 2001 From: youhy Date: Wed, 17 Aug 2022 13:24:30 -0700 Subject: [PATCH 2/3] use GzPose with degree Signed-off-by: youhy --- .../transform_control/TransformControl.qml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gui/plugins/transform_control/TransformControl.qml b/src/gui/plugins/transform_control/TransformControl.qml index a83cf2b556..4c3b91b354 100644 --- a/src/gui/plugins/transform_control/TransformControl.qml +++ b/src/gui/plugins/transform_control/TransformControl.qml @@ -322,14 +322,14 @@ ToolBar { parent: transformControl.Window.window ? transformControl.Window.window.contentItem : transformControl x: (windowWidth() - width) / 2 y: (windowHeight() - height) / 2 - width: 360 + width: 400 height: 250 modal: true focus: true title: "Snap values" GridLayout { columns: 6 - columnSpacing: 30 + columnSpacing: 60 Text { text: "Translation (m)" color: snapTitle @@ -354,17 +354,18 @@ ToolBar { id: gzPoseInstance width: parent.width Layout.columnSpan: 6 + Layout.row: 1 Layout.fillWidth: true readOnly: false - spinMax: 100.0 + useRadian: false + spinMax: 180 xValue: 1.0 yValue: 1.0 zValue: 1.0 - // 0.785 is PI /4 - rollValue: 0.785 - pitchValue: 0.785 - yawValue: 0.785 + rollValue: 45 + pitchValue: 45 + yawValue: 45 onGzPoseSet: { // _x, _y, _z, _roll, _pitch, _yaw are parameters of signal gzPoseSet From 4c43619edbab2b1a486143d32f595f1917bda87a Mon Sep 17 00:00:00 2001 From: youhy Date: Thu, 18 Aug 2022 15:44:37 -0700 Subject: [PATCH 3/3] minor change of format Signed-off-by: youhy --- .../plugins/transform_control/TransformControl.qml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/plugins/transform_control/TransformControl.qml b/src/gui/plugins/transform_control/TransformControl.qml index 4c3b91b354..9a32641495 100644 --- a/src/gui/plugins/transform_control/TransformControl.qml +++ b/src/gui/plugins/transform_control/TransformControl.qml @@ -323,15 +323,15 @@ ToolBar { x: (windowWidth() - width) / 2 y: (windowHeight() - height) / 2 width: 400 - height: 250 + height: 290 modal: true focus: true title: "Snap values" GridLayout { columns: 6 - columnSpacing: 60 + columnSpacing: 100 Text { - text: "Translation (m)" + text: "Translation" color: snapTitle font.weight: Font.Bold Layout.columnSpan: 2 @@ -341,7 +341,7 @@ ToolBar { } Text { - text: "Rotation (rad)" + text: "Rotation" font.weight: Font.Bold color: snapTitle Layout.columnSpan: 2 @@ -357,22 +357,23 @@ ToolBar { Layout.row: 1 Layout.fillWidth: true readOnly: false - useRadian: false spinMax: 180 xValue: 1.0 yValue: 1.0 zValue: 1.0 + useRadian: false rollValue: 45 pitchValue: 45 yawValue: 45 + expand: true + onGzPoseSet: { // _x, _y, _z, _roll, _pitch, _yaw are parameters of signal gzPoseSet // from gz-gui GzPose.qml TransformControl.OnSnapUpdate(_x, _y, _z,_roll, _pitch, _yaw, 0, 0, 0) } - expand: true } // gzPoseInstance ends } }