removed speed/duration dialog
This is the first step in what will eventually be keyframable time remapping. The speed/duration dialog was a holdover from 0.1 and we can probably do better here.
This commit is contained in:
+39
-32
@@ -49,10 +49,8 @@ Block::Block() :
|
||||
enabled_input_->set_standard_value(true);
|
||||
AddInput(enabled_input_);
|
||||
|
||||
speed_input_ = new NodeInput("speed_in", NodeParam::kRational);
|
||||
speed_input_->set_standard_value(QVariant::fromValue(rational(1)));
|
||||
speed_input_->set_connectable(false);
|
||||
speed_input_->set_is_keyframable(false);
|
||||
speed_input_ = new NodeInput("speed_in", NodeParam::kFloat);
|
||||
speed_input_->set_standard_value(1.0);
|
||||
AddInput(speed_input_);
|
||||
|
||||
// A block's length must be greater than 0
|
||||
@@ -113,7 +111,7 @@ void Block::set_length_and_media_in(const rational &length)
|
||||
}
|
||||
|
||||
// Calculate media_in adjustment
|
||||
set_media_in(media_in() + (this->length() - length) * speed());
|
||||
set_media_in(SequenceToMediaTime(in() + (this->length() - length)));
|
||||
|
||||
rational old_length = this->length();
|
||||
|
||||
@@ -153,31 +151,6 @@ void Block::set_media_in(const rational &media_in)
|
||||
media_in_input_->set_standard_value(QVariant::fromValue(media_in));
|
||||
}
|
||||
|
||||
rational Block::media_out() const
|
||||
{
|
||||
return media_in() + length() * speed();
|
||||
}
|
||||
|
||||
rational Block::speed() const
|
||||
{
|
||||
return speed_input_->get_standard_value().value<rational>();
|
||||
}
|
||||
|
||||
void Block::set_speed(const rational &speed)
|
||||
{
|
||||
speed_input_->set_standard_value(QVariant::fromValue(speed));
|
||||
}
|
||||
|
||||
bool Block::is_still() const
|
||||
{
|
||||
return speed() == 0;
|
||||
}
|
||||
|
||||
bool Block::is_reversed() const
|
||||
{
|
||||
return speed() < 0;
|
||||
}
|
||||
|
||||
bool Block::is_enabled() const
|
||||
{
|
||||
return enabled_input_->get_standard_value().toBool();
|
||||
@@ -197,7 +170,24 @@ rational Block::SequenceToMediaTime(const rational &sequence_time) const
|
||||
return sequence_time;
|
||||
}
|
||||
|
||||
return (sequence_time - in()) * speed() + media_in();
|
||||
rational local_time = sequence_time - in();
|
||||
|
||||
// FIXME: Doesn't handle reversing
|
||||
if (speed_input_->is_keyframing() || speed_input_->is_connected()) {
|
||||
// FIXME: We'll need to calculate the speed hoo boy
|
||||
} else {
|
||||
double speed_value = speed_input_->get_standard_value().toDouble();
|
||||
|
||||
if (qIsNull(speed_value)) {
|
||||
// Effectively holds the frame at the in point
|
||||
local_time = 0;
|
||||
} else if (!qFuzzyCompare(speed_value, 1.0)) {
|
||||
// Multiply time
|
||||
local_time = rational::fromDouble(local_time.toDouble() * speed_value);
|
||||
}
|
||||
}
|
||||
|
||||
return local_time + media_in();
|
||||
}
|
||||
|
||||
rational Block::MediaToSequenceTime(const rational &media_time) const
|
||||
@@ -207,7 +197,24 @@ rational Block::MediaToSequenceTime(const rational &media_time) const
|
||||
return media_time;
|
||||
}
|
||||
|
||||
return (media_time - media_in()) / speed() + in();
|
||||
rational sequence_time = media_time - media_in();
|
||||
|
||||
// FIXME: Doesn't handle reversing
|
||||
if (speed_input_->is_keyframing() || speed_input_->is_connected()) {
|
||||
// FIXME: We'll need to calculate the speed hoo boy
|
||||
} else {
|
||||
double speed_value = speed_input_->get_standard_value().toDouble();
|
||||
|
||||
if (qIsNull(speed_value)) {
|
||||
// Effectively holds the frame at the in point, also prevents divide by zero
|
||||
sequence_time = 0;
|
||||
} else if (!qFuzzyCompare(speed_value, 1.0)) {
|
||||
// Multiply time
|
||||
sequence_time = rational::fromDouble(sequence_time.toDouble() / speed_value);
|
||||
}
|
||||
}
|
||||
|
||||
return sequence_time + in();
|
||||
}
|
||||
|
||||
void Block::LoadInternal(QXmlStreamReader *reader, XMLNodeData &xml_node_data)
|
||||
|
||||
Reference in New Issue
Block a user