reworked timeline elements
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "transition.h"
|
||||
|
||||
#include "common/clamp.h"
|
||||
#include "node/block/clip/clip.h"
|
||||
#include "node/output/track/track.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -30,6 +31,8 @@ namespace olive {
|
||||
const QString TransitionBlock::kOutBlockInput = QStringLiteral("out_block_in");
|
||||
const QString TransitionBlock::kInBlockInput = QStringLiteral("in_block_in");
|
||||
const QString TransitionBlock::kCurveInput = QStringLiteral("curve_in");
|
||||
const QString TransitionBlock::kInOffsetInput = QStringLiteral("in_offset_in");
|
||||
const QString TransitionBlock::kOutOffsetInput = QStringLiteral("out_offset_in");
|
||||
|
||||
TransitionBlock::TransitionBlock() :
|
||||
connected_out_block_(nullptr),
|
||||
@@ -40,6 +43,12 @@ TransitionBlock::TransitionBlock() :
|
||||
AddInput(kInBlockInput, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kCurveInput, NodeValue::kCombo, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||
|
||||
AddInput(kInOffsetInput, NodeValue::kRational, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||
|
||||
AddInput(kOutOffsetInput, NodeValue::kRational, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||
|
||||
set_length_and_media_out(0);
|
||||
}
|
||||
|
||||
void TransitionBlock::Retranslate()
|
||||
@@ -49,6 +58,8 @@ void TransitionBlock::Retranslate()
|
||||
SetInputName(kOutBlockInput, tr("From"));
|
||||
SetInputName(kInBlockInput, tr("To"));
|
||||
SetInputName(kCurveInput, tr("Curve"));
|
||||
SetInputName(kInOffsetInput, tr("In Offset"));
|
||||
SetInputName(kOutOffsetInput, tr("Out Offset"));
|
||||
|
||||
// These must correspond to the CurveType enum
|
||||
SetComboBoxStrings(kCurveInput, { tr("Linear"), tr("Exponential"), tr("Logarithmic") });
|
||||
@@ -56,34 +67,22 @@ void TransitionBlock::Retranslate()
|
||||
|
||||
rational TransitionBlock::in_offset() const
|
||||
{
|
||||
// If no in block is connected, there's no in offset
|
||||
if (!connected_in_block()) {
|
||||
return 0;
|
||||
}
|
||||
return GetStandardValue(kInOffsetInput).value<rational>();
|
||||
}
|
||||
|
||||
if (!connected_out_block()) {
|
||||
// Assume only an in block is connected, in which case this entire transition length
|
||||
return length();
|
||||
}
|
||||
|
||||
// Assume both are connected
|
||||
return length() + media_in();
|
||||
void TransitionBlock::set_in_offset(const rational &os)
|
||||
{
|
||||
SetStandardValue(kInOffsetInput, QVariant::fromValue(os));
|
||||
}
|
||||
|
||||
rational TransitionBlock::out_offset() const
|
||||
{
|
||||
// If no in block is connected, there's no in offset
|
||||
if (!connected_out_block()) {
|
||||
return 0;
|
||||
}
|
||||
return GetStandardValue(kOutOffsetInput).value<rational>();
|
||||
}
|
||||
|
||||
if (!connected_in_block()) {
|
||||
// Assume only an in block is connected, in which case this entire transition length
|
||||
return length();
|
||||
}
|
||||
|
||||
// Assume both are connected
|
||||
return -media_in();
|
||||
void TransitionBlock::set_out_offset(const rational &os)
|
||||
{
|
||||
SetStandardValue(kOutOffsetInput, QVariant::fromValue(os));
|
||||
}
|
||||
|
||||
Block *TransitionBlock::connected_out_block() const
|
||||
@@ -267,12 +266,12 @@ void TransitionBlock::InputConnectedEvent(const QString &input, int element, con
|
||||
|
||||
if (input == kOutBlockInput) {
|
||||
// If node is not a block, this will just be null
|
||||
if ((connected_out_block_ = dynamic_cast<Block*>(output.node()))) {
|
||||
if ((connected_out_block_ = dynamic_cast<ClipBlock*>(output.node()))) {
|
||||
connected_out_block_->set_out_transition(this);
|
||||
}
|
||||
} else if (input == kInBlockInput) {
|
||||
// If node is not a block, this will just be null
|
||||
if ((connected_in_block_ = dynamic_cast<Block*>(output.node()))) {
|
||||
if ((connected_in_block_ = dynamic_cast<ClipBlock*>(output.node()))) {
|
||||
connected_in_block_->set_in_transition(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user