From ef82f2cc6fc01e57433ebe11235288bd80537076 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Sun, 16 Dec 2018 14:59:22 +0930 Subject: [PATCH] Change background opacity of pose editor When one pose consists of multiple frames, each frame will be hardly see when the opacity is 0.25, this commit change the opacity to 0.5 in pose editor, however, leave it as 0.25 in main modeling interface. --- src/posedocument.cpp | 4 ++-- src/poseeditwidget.cpp | 1 + src/skeletongraphicswidget.cpp | 11 +++++++++-- src/skeletongraphicswidget.h | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/posedocument.cpp b/src/posedocument.cpp index 63070f9b..18f367ec 100644 --- a/src/posedocument.cpp +++ b/src/posedocument.cpp @@ -11,8 +11,8 @@ #include "snapshot.h" #include "snapshotxml.h" -const float PoseDocument::m_nodeRadius = 0.01; -const float PoseDocument::m_groundPlaneHalfThickness = 0.01 / 4; +const float PoseDocument::m_nodeRadius = 0.005; +const float PoseDocument::m_groundPlaneHalfThickness = 0.005 / 4; const bool PoseDocument::m_hideRootAndVirtual = true; const float PoseDocument::m_outcomeScaleFactor = 0.5; diff --git a/src/poseeditwidget.cpp b/src/poseeditwidget.cpp index 0e2cdb9f..78141aca 100644 --- a/src/poseeditwidget.cpp +++ b/src/poseeditwidget.cpp @@ -40,6 +40,7 @@ PoseEditWidget::PoseEditWidget(const Document *document, QWidget *parent) : SkeletonGraphicsWidget *graphicsWidget = new SkeletonGraphicsWidget(m_poseDocument); graphicsWidget->setNodePositionModifyOnly(true); + graphicsWidget->setBackgroundBlur(0.5); m_poseGraphicsWidget = graphicsWidget; initShortCuts(this, graphicsWidget); diff --git a/src/skeletongraphicswidget.cpp b/src/skeletongraphicswidget.cpp index 52bc194b..25fd44dc 100644 --- a/src/skeletongraphicswidget.cpp +++ b/src/skeletongraphicswidget.cpp @@ -46,7 +46,8 @@ SkeletonGraphicsWidget::SkeletonGraphicsWidget(const SkeletonDocument *document) m_modelWidget(nullptr), m_inTempDragMode(false), m_modeBeforeEnterTempDragMode(SkeletonDocumentEditMode::Select), - m_nodePositionModifyOnly(false) + m_nodePositionModifyOnly(false), + m_turnaroundOpacity(0.25) { setRenderHint(QPainter::Antialiasing, false); setBackgroundBrush(QBrush(QWidget::palette().color(QWidget::backgroundRole()), Qt::SolidPattern)); @@ -98,7 +99,7 @@ void SkeletonGraphicsWidget::setModelWidget(ModelWidget *modelWidget) void SkeletonGraphicsWidget::enableBackgroundBlur() { - m_backgroundItem->setOpacity(0.25); + m_backgroundItem->setOpacity(m_turnaroundOpacity); } void SkeletonGraphicsWidget::disableBackgroundBlur() @@ -106,6 +107,12 @@ void SkeletonGraphicsWidget::disableBackgroundBlur() m_backgroundItem->setOpacity(1); } +void SkeletonGraphicsWidget::setBackgroundBlur(float turnaroundOpacity) +{ + m_turnaroundOpacity = turnaroundOpacity; + m_backgroundItem->setOpacity(m_turnaroundOpacity); +} + void SkeletonGraphicsWidget::showContextMenu(const QPoint &pos) { if (SkeletonDocumentEditMode::Add == m_document->editMode) { diff --git a/src/skeletongraphicswidget.h b/src/skeletongraphicswidget.h index 88e3e9dd..862f03f3 100644 --- a/src/skeletongraphicswidget.h +++ b/src/skeletongraphicswidget.h @@ -468,6 +468,7 @@ public slots: void addSelectEdge(QUuid edgeId); void enableBackgroundBlur(); void disableBackgroundBlur(); + void setBackgroundBlur(float turnaroundOpacity); void ikMove(QUuid endEffectorId, QVector3D target); void ikMoveReady(); void setSelectedNodesBoneMark(BoneMark boneMark); @@ -563,6 +564,7 @@ private: //need initalize bool m_inTempDragMode; SkeletonDocumentEditMode m_modeBeforeEnterTempDragMode; bool m_nodePositionModifyOnly; + float m_turnaroundOpacity; private: QVector3D m_ikMoveTarget; QUuid m_ikMoveEndEffectorId;