timeline/block: reimplemented enabling/disabling blocks
This commit is contained in:
@@ -47,6 +47,12 @@ Block::Block() :
|
||||
media_in_input_->set_is_keyframable(false);
|
||||
AddInput(media_in_input_);
|
||||
|
||||
enabled_input_ = new NodeInput("enabled_in", NodeParam::kBoolean);
|
||||
enabled_input_->SetConnectable(false);
|
||||
enabled_input_->set_is_keyframable(false);
|
||||
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_->SetConnectable(false);
|
||||
@@ -168,6 +174,18 @@ bool Block::is_reversed() const
|
||||
return speed() < 0;
|
||||
}
|
||||
|
||||
bool Block::is_enabled() const
|
||||
{
|
||||
return enabled_input_->get_standard_value().toBool();
|
||||
}
|
||||
|
||||
void Block::set_enabled(bool e)
|
||||
{
|
||||
enabled_input_->set_standard_value(e);
|
||||
|
||||
emit EnabledChanged();
|
||||
}
|
||||
|
||||
QString Block::block_name() const
|
||||
{
|
||||
return name_input_->get_standard_value().toString();
|
||||
@@ -177,7 +195,7 @@ void Block::set_block_name(const QString &name)
|
||||
{
|
||||
name_input_->set_standard_value(name);
|
||||
|
||||
// FIXME: Signal the name has changed to update UI objects
|
||||
emit NameChanged();
|
||||
}
|
||||
|
||||
rational Block::SequenceToMediaTime(const rational &sequence_time) const
|
||||
|
||||
@@ -75,6 +75,9 @@ public:
|
||||
bool is_still() const;
|
||||
bool is_reversed() const;
|
||||
|
||||
bool is_enabled() const;
|
||||
void set_enabled(bool e);
|
||||
|
||||
QString block_name() const;
|
||||
void set_block_name(const QString& name);
|
||||
|
||||
@@ -110,6 +113,10 @@ signals:
|
||||
|
||||
void LinksChanged();
|
||||
|
||||
void NameChanged();
|
||||
|
||||
void EnabledChanged();
|
||||
|
||||
protected:
|
||||
rational SequenceToMediaTime(const rational& sequence_time) const;
|
||||
|
||||
@@ -127,6 +134,7 @@ private:
|
||||
NodeInput* length_input_;
|
||||
NodeInput* media_in_input_;
|
||||
NodeInput* speed_input_;
|
||||
NodeInput* enabled_input_;
|
||||
|
||||
rational in_point_;
|
||||
rational out_point_;
|
||||
|
||||
@@ -198,7 +198,11 @@ Block *TrackOutput::BlockAtTime(const rational &time) const
|
||||
if (block
|
||||
&& block->in() <= time
|
||||
&& block->out() > time) {
|
||||
return block;
|
||||
if (block->is_enabled()) {
|
||||
return block;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user