Merge branch 'move-time-to-viewer'

This commit is contained in:
itsmattkc
2022-11-01 18:20:22 -07:00
49 changed files with 297 additions and 414 deletions
@@ -34,7 +34,8 @@ namespace olive {
NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input, QWidget *parent) :
QWidget(parent),
input_(input),
connected_node_(nullptr)
connected_node_(nullptr),
viewer_(nullptr)
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
@@ -85,6 +86,20 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
connect(collapse_btn, &CollapseButton::toggled, this, &NodeParamViewConnectedLabel::SetValueTreeVisible);
}
void NodeParamViewConnectedLabel::SetViewerNode(ViewerOutput *viewer)
{
if (viewer_) {
disconnect(viewer_, &ViewerOutput::PlayheadChanged, this, &NodeParamViewConnectedLabel::UpdateValueTree);
}
viewer_ = viewer;
if (viewer_) {
connect(viewer_, &ViewerOutput::PlayheadChanged, this, &NodeParamViewConnectedLabel::UpdateValueTree);
UpdateValueTree();
}
}
void NodeParamViewConnectedLabel::CreateTree()
{
// Set up table area
@@ -92,15 +107,6 @@ void NodeParamViewConnectedLabel::CreateTree()
layout()->addWidget(value_tree_);
}
void NodeParamViewConnectedLabel::SetTime(const rational &time)
{
time_ = time;
if (value_tree_ && value_tree_->isVisible()) {
UpdateValueTree();
}
}
void NodeParamViewConnectedLabel::InputConnected(Node *output, const NodeInput& input)
{
if (input_ != input) {
@@ -159,8 +165,8 @@ void NodeParamViewConnectedLabel::UpdateLabel()
void NodeParamViewConnectedLabel::UpdateValueTree()
{
if (value_tree_) {
value_tree_->SetNode(input_, time_);
if (value_tree_ && viewer_ && value_tree_->isVisible()) {
value_tree_->SetNode(input_, viewer_->GetPlayhead());
}
}
@@ -173,6 +179,7 @@ void NodeParamViewConnectedLabel::SetValueTreeVisible(bool e)
if (e) {
if (!value_tree_) {
CreateTree();
value_tree_->setVisible(true);
}
UpdateValueTree();