updated ParamPanel to be able to be connected with ViewerPanel and TimelinePanel
This commit is contained in:
@@ -69,15 +69,18 @@ NodeParamView::NodeParamView(QWidget *parent) :
|
||||
keyframe_area_layout->addWidget(keyframe_view_);
|
||||
|
||||
// Connect ruler and keyframe view together
|
||||
connect(ruler_, SIGNAL(TimeChanged(const int64_t&)), keyframe_view_, SLOT(SetTime(const int64_t&)));
|
||||
connect(keyframe_view_, SIGNAL(TimeChanged(const int64_t&)), ruler_, SLOT(SetTime(const int64_t&)));
|
||||
connect(ruler_, SIGNAL(TimeChanged(const int64_t&)), this, SLOT(RulerTimeChanged(const int64_t&)));
|
||||
connect(keyframe_view_, SIGNAL(TimeChanged(const int64_t&)), this, SLOT(RulerTimeChanged(const int64_t&)));
|
||||
connect(ruler_, &TimeRuler::TimeChanged, keyframe_view_, &KeyframeView::SetTime);
|
||||
connect(keyframe_view_, &KeyframeView::TimeChanged, ruler_, &TimeRuler::SetTime);
|
||||
connect(ruler_, &TimeRuler::TimeChanged, this, &NodeParamView::RulerTimeChanged);
|
||||
connect(keyframe_view_, &KeyframeView::TimeChanged, this, &NodeParamView::RulerTimeChanged);
|
||||
|
||||
splitter->addWidget(keyframe_area);
|
||||
|
||||
// Disable collapsing param view (but collapsing keyframe view is permitted)
|
||||
splitter->setCollapsible(0, false);
|
||||
|
||||
// Set a default scale - FIXME: Hardcoded
|
||||
SetScale(120);
|
||||
}
|
||||
|
||||
void NodeParamView::SetNodes(QList<Node *> nodes)
|
||||
@@ -101,9 +104,9 @@ void NodeParamView::SetNodes(QList<Node *> nodes)
|
||||
// Insert the widget before the stretch
|
||||
param_layout_->insertWidget(param_layout_->count() - 1, item);
|
||||
|
||||
connect(item, SIGNAL(KeyframeAdded(NodeKeyframePtr, int)), keyframe_view_, SLOT(AddKeyframe(NodeKeyframePtr, int)));
|
||||
connect(item, SIGNAL(KeyframeRemoved(NodeKeyframePtr)), keyframe_view_, SLOT(RemoveKeyframe(NodeKeyframePtr)));
|
||||
connect(item, SIGNAL(RequestSetTime(const rational&)), this, SLOT(SetTime(const rational&)));
|
||||
connect(item, &NodeParamViewItem::KeyframeAdded, keyframe_view_, &KeyframeView::AddKeyframe);
|
||||
connect(item, &NodeParamViewItem::KeyframeRemoved, keyframe_view_, &KeyframeView::RemoveKeyframe);
|
||||
connect(item, &NodeParamViewItem::RequestSetTime, this, &NodeParamView::ItemRequestedTimeChanged);
|
||||
|
||||
items_.append(item);
|
||||
}
|
||||
@@ -135,14 +138,12 @@ void NodeParamView::SetScale(const double& scale)
|
||||
keyframe_view_->SetScale(scale);
|
||||
}
|
||||
|
||||
void NodeParamView::SetTime(const rational &time)
|
||||
void NodeParamView::SetTime(const int64_t ×tamp)
|
||||
{
|
||||
int64_t timestamp = Timecode::time_to_timestamp(time, keyframe_view_->timebase());
|
||||
|
||||
ruler_->SetTime(timestamp);
|
||||
keyframe_view_->SetTime(timestamp);
|
||||
|
||||
UpdateItemTime(time);
|
||||
UpdateItemTime(timestamp);
|
||||
}
|
||||
|
||||
void NodeParamView::SetTimebase(const rational &timebase)
|
||||
@@ -151,8 +152,10 @@ void NodeParamView::SetTimebase(const rational &timebase)
|
||||
keyframe_view_->SetTimebase(timebase);
|
||||
}
|
||||
|
||||
void NodeParamView::UpdateItemTime(const rational &time)
|
||||
void NodeParamView::UpdateItemTime(const int64_t ×tamp)
|
||||
{
|
||||
rational time = Timecode::timestamp_to_time(timestamp, keyframe_view_->timebase());
|
||||
|
||||
foreach (NodeParamViewItem* item, items_) {
|
||||
item->SetTime(time);
|
||||
}
|
||||
@@ -160,7 +163,14 @@ void NodeParamView::UpdateItemTime(const rational &time)
|
||||
|
||||
void NodeParamView::RulerTimeChanged(const int64_t ×tamp)
|
||||
{
|
||||
rational time = Timecode::timestamp_to_time(timestamp, keyframe_view_->timebase());
|
||||
UpdateItemTime(timestamp);
|
||||
|
||||
UpdateItemTime(time);
|
||||
emit TimeChanged(timestamp);
|
||||
}
|
||||
|
||||
void NodeParamView::ItemRequestedTimeChanged(const rational &time)
|
||||
{
|
||||
int64_t timestamp = Timecode::time_to_timestamp(time, keyframe_view_->timebase());
|
||||
SetTime(timestamp);
|
||||
emit TimeChanged(timestamp);
|
||||
}
|
||||
|
||||
@@ -42,12 +42,15 @@ public:
|
||||
void SetScale(const double &scale);
|
||||
|
||||
public slots:
|
||||
void SetTime(const rational& time);
|
||||
void SetTime(const int64_t& timestamp);
|
||||
|
||||
signals:
|
||||
void TimeChanged(const int64_t& timestamp);
|
||||
|
||||
private:
|
||||
void SetTimebase(const rational& timebase);
|
||||
|
||||
void UpdateItemTime(const rational& time);
|
||||
void UpdateItemTime(const int64_t ×tamp);
|
||||
|
||||
QVBoxLayout* param_layout_;
|
||||
|
||||
@@ -62,6 +65,8 @@ private:
|
||||
private slots:
|
||||
void RulerTimeChanged(const int64_t& timestamp);
|
||||
|
||||
void ItemRequestedTimeChanged(const rational& time);
|
||||
|
||||
};
|
||||
|
||||
#endif // NODEPARAMVIEW_H
|
||||
|
||||
@@ -54,7 +54,7 @@ NodeParamViewItem::NodeParamViewItem(Node *node, QWidget *parent) :
|
||||
// FIXME: Revise icon sizing algorithm (share with NodeViewItem)
|
||||
title_bar_collapse_btn_->setIconSize(QSize(fontMetrics().height()/2, fontMetrics().height()/2));
|
||||
|
||||
connect(title_bar_collapse_btn_, SIGNAL(clicked(bool)), this, SLOT(SetExpanded(bool)));
|
||||
connect(title_bar_collapse_btn_, &QPushButton::clicked, this, &NodeParamViewItem::SetExpanded);
|
||||
title_bar_layout->addWidget(title_bar_collapse_btn_);
|
||||
|
||||
title_bar_lbl_ = new QLabel(title_bar_);
|
||||
@@ -285,6 +285,11 @@ void NodeParamViewItem::UserToggledKeyframe(bool e)
|
||||
} else if (!e && key) {
|
||||
// Remove a keyframe here
|
||||
new NodeParamRemoveKeyframeCommand(input, key, command);
|
||||
|
||||
// If this was the last keyframe, we'll set the standard value to the value at this time too
|
||||
if (input->keyframes().size() == 1) {
|
||||
new NodeParamSetStandardValueCommand(input, key->value(), command);
|
||||
}
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
|
||||
@@ -136,7 +136,7 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
slider->SetMaximum(input_->maximum().toLongLong());
|
||||
}
|
||||
|
||||
connect(slider, SIGNAL(ValueChanged(int64_t)), this, SLOT(WidgetCallback()));
|
||||
connect(slider, &IntegerSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
widgets_.append(slider);
|
||||
break;
|
||||
@@ -153,7 +153,7 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
slider->SetMaximum(input_->maximum().toDouble());
|
||||
}
|
||||
|
||||
connect(slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
widgets_.append(slider);
|
||||
break;
|
||||
@@ -162,45 +162,45 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
{
|
||||
FloatSlider* x_slider = new FloatSlider();
|
||||
widgets_.append(x_slider);
|
||||
connect(x_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(x_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
FloatSlider* y_slider = new FloatSlider();
|
||||
widgets_.append(y_slider);
|
||||
connect(y_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(y_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kVec3:
|
||||
{
|
||||
FloatSlider* x_slider = new FloatSlider();
|
||||
widgets_.append(x_slider);
|
||||
connect(x_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(x_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
FloatSlider* y_slider = new FloatSlider();
|
||||
widgets_.append(y_slider);
|
||||
connect(y_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(y_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
FloatSlider* z_slider = new FloatSlider();
|
||||
widgets_.append(z_slider);
|
||||
connect(z_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(z_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kVec4:
|
||||
{
|
||||
FloatSlider* x_slider = new FloatSlider();
|
||||
widgets_.append(x_slider);
|
||||
connect(x_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(x_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
FloatSlider* y_slider = new FloatSlider();
|
||||
widgets_.append(y_slider);
|
||||
connect(y_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(y_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
FloatSlider* z_slider = new FloatSlider();
|
||||
widgets_.append(z_slider);
|
||||
connect(z_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(z_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
FloatSlider* w_slider = new FloatSlider();
|
||||
widgets_.append(w_slider);
|
||||
connect(w_slider, SIGNAL(ValueChanged(double)), this, SLOT(WidgetCallback()));
|
||||
connect(w_slider, &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kFile:
|
||||
@@ -213,14 +213,14 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
{
|
||||
QLineEdit* line_edit = new QLineEdit();
|
||||
widgets_.append(line_edit);
|
||||
connect(line_edit, SIGNAL(textEdited(const QString &text)), this, SLOT(WidgetCallback()));
|
||||
connect(line_edit, &QLineEdit::textEdited, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kBoolean:
|
||||
{
|
||||
QCheckBox* check_box = new QCheckBox();
|
||||
widgets_.append(check_box);
|
||||
connect(check_box, SIGNAL(toggled(bool)), this, SLOT(WidgetCallback()));
|
||||
connect(check_box, &QCheckBox::toggled, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kFont:
|
||||
@@ -234,7 +234,7 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
FootageComboBox* footage_combobox = new FootageComboBox();
|
||||
footage_combobox->SetRoot(static_cast<Sequence*>(input_->parentNode()->parent())->project()->root());
|
||||
|
||||
connect(footage_combobox, SIGNAL(FootageChanged(StreamPtr)), this, SLOT(WidgetCallback()));
|
||||
connect(footage_combobox, &FootageComboBox::FootageChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||
|
||||
widgets_.append(footage_combobox);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user