blur: implement radial and directional blur methods

This commit is contained in:
itsmattkc
2022-05-08 16:53:04 -07:00
parent bdb917c591
commit f910117a58
10 changed files with 270 additions and 52 deletions
+24 -6
View File
@@ -46,21 +46,22 @@ const int NodeParamViewItemBody::kMaxWidgetColumn = kKeyControlColumn;
NodeParamViewItem::NodeParamViewItem(Node *node, NodeParamViewCheckBoxBehavior create_checkboxes, QWidget *parent) :
super(parent),
body_(nullptr),
node_(node),
create_checkboxes_(create_checkboxes),
ctx_(nullptr)
{
node_->Retranslate();
// Create and add contents widget
body_ = new NodeParamViewItemBody(node_, create_checkboxes);
connect(body_, &NodeParamViewItemBody::RequestSelectNode, this, &NodeParamViewItem::RequestSelectNode);
connect(body_, &NodeParamViewItemBody::RequestSetTime, this, &NodeParamViewItem::RequestSetTime);
connect(body_, &NodeParamViewItemBody::ArrayExpandedChanged, this, &NodeParamViewItem::ArrayExpandedChanged);
connect(body_, &NodeParamViewItemBody::InputCheckedChanged, this, &NodeParamViewItem::InputCheckedChanged);
SetBody(body_);
RecreateBody();
connect(node_, &Node::LabelChanged, this, &NodeParamViewItem::Retranslate);
// FIXME: Implemented to pick up when an input is set to hidden or not - DEFINITELY not a fast
// way of doing this, but "fine" for now.
connect(node_, &Node::InputFlagsChanged, this, &NodeParamViewItem::RecreateBody);
setBackgroundRole(QPalette::Window);
// Connect title bar enabled checkbox
@@ -80,6 +81,23 @@ void NodeParamViewItem::Retranslate()
body_->Retranslate();
}
void NodeParamViewItem::RecreateBody()
{
QWidget *old_body = body_;
body_ = new NodeParamViewItemBody(node_, create_checkboxes_);
connect(body_, &NodeParamViewItemBody::RequestSelectNode, this, &NodeParamViewItem::RequestSelectNode);
connect(body_, &NodeParamViewItemBody::RequestSetTime, this, &NodeParamViewItem::RequestSetTime);
connect(body_, &NodeParamViewItemBody::ArrayExpandedChanged, this, &NodeParamViewItem::ArrayExpandedChanged);
connect(body_, &NodeParamViewItemBody::InputCheckedChanged, this, &NodeParamViewItem::InputCheckedChanged);
body_->Retranslate();
body_->SetTime(time_);
body_->SetTimebase(timebase_);
SetBody(body_);
old_body->deleteLater();
}
int NodeParamViewItem::GetElementY(const NodeInput &c) const
{
if (IsExpanded()) {
@@ -179,6 +179,8 @@ public:
void SetTimebase(const rational& timebase)
{
timebase_ = timebase;
body_->SetTimebase(timebase);
}
@@ -228,12 +230,18 @@ private:
Node* node_;
NodeParamViewCheckBoxBehavior create_checkboxes_;
Node *ctx_;
rational time_;
rational timebase_;
KeyframeView::NodeConnections keyframe_connections_;
private slots:
void RecreateBody();
};
}
+19 -15
View File
@@ -529,7 +529,9 @@ void ViewerDisplayWidget::OnPaint()
gizmos_->UpdateGizmoPositions(gizmo_db_, NodeTraverser::GenerateGlobals(gizmo_params_, range));
foreach (NodeGizmo *gizmo, gizmos_->GetGizmos()) {
gizmo->Draw(&p);
if (gizmo->IsVisible()) {
gizmo->Draw(&p);
}
}
}
@@ -748,21 +750,23 @@ NodeGizmo *ViewerDisplayWidget::TryGizmoPress(const NodeValueRow &row, const QPo
{
for (auto it=gizmos_->GetGizmos().crbegin(); it!=gizmos_->GetGizmos().crend(); it++) {
NodeGizmo *gizmo = *it;
if (PointGizmo *point = dynamic_cast<PointGizmo*>(gizmo)) {
if (point->GetClickingRect(GenerateGizmoTransform()).contains(p)) {
return point;
if (gizmo->IsVisible()) {
if (PointGizmo *point = dynamic_cast<PointGizmo*>(gizmo)) {
if (point->GetClickingRect(GenerateGizmoTransform()).contains(p)) {
return point;
}
} else if (PolygonGizmo *poly = dynamic_cast<PolygonGizmo*>(gizmo)) {
if (poly->GetPolygon().containsPoint(p, Qt::OddEvenFill)) {
return poly;
}
} else if (PathGizmo *path = dynamic_cast<PathGizmo*>(gizmo)) {
if (path->GetPath().contains(p)) {
return path;
}
} else if (ScreenGizmo *screen = dynamic_cast<ScreenGizmo*>(gizmo)) {
// NOTE: Perhaps this should limit to the actual visible screen space? We'll see.
return screen;
}
} else if (PolygonGizmo *poly = dynamic_cast<PolygonGizmo*>(gizmo)) {
if (poly->GetPolygon().containsPoint(p, Qt::OddEvenFill)) {
return poly;
}
} else if (PathGizmo *path = dynamic_cast<PathGizmo*>(gizmo)) {
if (path->GetPath().contains(p)) {
return path;
}
} else if (ScreenGizmo *screen = dynamic_cast<ScreenGizmo*>(gizmo)) {
// NOTE: Perhaps this should limit to the actual visible screen space? We'll see.
return screen;
}
}