various: moved time from viewer UI to viewer node

This commit is contained in:
itsmattkc
2022-10-23 20:56:04 -07:00
parent fc56058e8a
commit d1545745d8
47 changed files with 259 additions and 418 deletions
@@ -57,13 +57,6 @@ NodeParamViewWidgetBridge::NodeParamViewWidgetBridge(NodeInput input, QObject *p
CreateWidgets();
}
void NodeParamViewWidgetBridge::SetTime(const rational &time)
{
time_ = time;
UpdateWidgetValues();
}
int GetSliderCount(NodeValue::Type type)
{
return NodeValue::get_number_of_keyframe_tracks(type);
@@ -528,7 +521,11 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues()
rational NodeParamViewWidgetBridge::GetCurrentTimeAsNodeTime() const
{
return GetAdjustedTime(GetTimeTarget(), GetInnerInput().node(), time_, Node::kTransformTowardsInput);
if (GetTimeTarget()) {
return GetAdjustedTime(GetTimeTarget(), GetInnerInput().node(), GetTimeTarget()->GetPlayhead(), Node::kTransformTowardsInput);
} else {
return 0;
}
}
void NodeParamViewWidgetBridge::SetTimebase(const rational& timebase)
@@ -538,11 +535,21 @@ void NodeParamViewWidgetBridge::SetTimebase(const rational& timebase)
}
}
void NodeParamViewWidgetBridge::TimeTargetDisconnectEvent(ViewerOutput *v)
{
disconnect(v, &ViewerOutput::PlayheadChanged, this, &NodeParamViewWidgetBridge::UpdateWidgetValues);
}
void NodeParamViewWidgetBridge::TimeTargetConnectEvent(ViewerOutput *v)
{
connect(v, &ViewerOutput::PlayheadChanged, this, &NodeParamViewWidgetBridge::UpdateWidgetValues);
}
void NodeParamViewWidgetBridge::InputValueChanged(const NodeInput &input, const TimeRange &range)
{
if (GetInnerInput() == input
&& !dragger_.IsStarted()
&& range.in() <= time_ && range.out() >= time_) {
&& range.in() <= GetTimeTarget()->GetPlayhead() && range.out() >= GetTimeTarget()->GetPlayhead()) {
// We'll need to update the widgets because the values have changed on our current time
UpdateWidgetValues();
}