gizmos: implemented pathway for node to draw on the viewer

This commit is contained in:
itsmattkc
2020-04-27 04:34:36 +10:00
parent ac3f49a845
commit 1cca9de7c5
15 changed files with 78 additions and 3 deletions
+15 -1
View File
@@ -45,7 +45,8 @@ ViewerDisplayWidget::ViewerDisplayWidget(QWidget *parent) :
managed_copy_pipeline_(nullptr),
has_image_(false),
signal_cursor_color_(false),
enable_display_referred_signal_(false)
enable_display_referred_signal_(false),
gizmos_(nullptr)
{
}
@@ -177,6 +178,13 @@ void ViewerDisplayWidget::SetSafeMargins(const ViewerSafeMarginInfo &safe_margin
update();
}
void ViewerDisplayWidget::SetGizmos(Node *node)
{
gizmos_ = node;
update();
}
void ViewerDisplayWidget::mousePressEvent(QMouseEvent *event)
{
QOpenGLWidget::mousePressEvent(event);
@@ -299,6 +307,12 @@ void ViewerDisplayWidget::paintGL()
}
}
// Draw gizmos if we have any
if (gizmos_) {
QPainter p(this);
gizmos_->DrawGizmos(&p, rect());
}
// Draw action/title safe areas
if (safe_margin_.is_enabled()) {
QPainter p(this);