Merge branch 'node-rework' into track-redux
This commit is contained in:
@@ -64,7 +64,7 @@ FootageRelinkDialog::FootageRelinkDialog(const QVector<Footage *> &footage, QWid
|
|||||||
connect(item_browse_btn, &QPushButton::clicked, this, &FootageRelinkDialog::BrowseForFootage);
|
connect(item_browse_btn, &QPushButton::clicked, this, &FootageRelinkDialog::BrowseForFootage);
|
||||||
item_actions_layout->addWidget(item_browse_btn);
|
item_actions_layout->addWidget(item_browse_btn);
|
||||||
|
|
||||||
item->setIcon(0, f->icon());
|
item->setIcon(0, f->data(Node::ICON).value<QIcon>());
|
||||||
item->setText(0, f->GetLabel());
|
item->setText(0, f->GetLabel());
|
||||||
item->setText(1, f->filename());
|
item->setText(1, f->filename());
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ void FootageRelinkDialog::UpdateFootageItem(int index)
|
|||||||
{
|
{
|
||||||
Footage* f = footage_.at(index);
|
Footage* f = footage_.at(index);
|
||||||
QTreeWidgetItem* item = table_->topLevelItem(index);
|
QTreeWidgetItem* item = table_->topLevelItem(index);
|
||||||
item->setIcon(0, f->icon());
|
item->setIcon(0, f->data(Node::ICON).value<QIcon>());
|
||||||
item->setText(1, f->filename());
|
item->setText(1, f->filename());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ PanNode::PanNode()
|
|||||||
SetInputProperty(kPanningInput, QStringLiteral("max"), 1.0);
|
SetInputProperty(kPanningInput, QStringLiteral("max"), 1.0);
|
||||||
SetInputProperty(kPanningInput, QStringLiteral("view"), FloatSlider::kPercentage);
|
SetInputProperty(kPanningInput, QStringLiteral("view"), FloatSlider::kPercentage);
|
||||||
|
|
||||||
SetFlags(kAudioEffect);
|
SetFlag(kAudioEffect);
|
||||||
SetEffectInput(kSamplesInput);
|
SetEffectInput(kSamplesInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ VolumeNode::VolumeNode()
|
|||||||
SetInputProperty(kVolumeInput, QStringLiteral("min"), 0.0);
|
SetInputProperty(kVolumeInput, QStringLiteral("min"), 0.0);
|
||||||
SetInputProperty(kVolumeInput, QStringLiteral("view"), FloatSlider::kDecibel);
|
SetInputProperty(kVolumeInput, QStringLiteral("view"), FloatSlider::kDecibel);
|
||||||
|
|
||||||
SetFlags(kAudioEffect);
|
SetFlag(kAudioEffect);
|
||||||
SetEffectInput(kSamplesInput);
|
SetEffectInput(kSamplesInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ Block::Block() :
|
|||||||
|
|
||||||
SetInputFlags(kEnabledInput, InputFlags(GetInputFlags(kEnabledInput) | kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
SetInputFlags(kEnabledInput, InputFlags(GetInputFlags(kEnabledInput) | kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
|
|
||||||
SetFlags(kDontShowInParamView);
|
SetFlag(kDontShowInParamView);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<Node::CategoryID> Block::Category() const
|
QVector<Node::CategoryID> Block::Category() const
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ SubtitleBlock::SubtitleBlock()
|
|||||||
SetInputFlags(kMaintainAudioPitchInput, InputFlags(GetInputFlags(kMaintainAudioPitchInput) | kInputFlagHidden));
|
SetInputFlags(kMaintainAudioPitchInput, InputFlags(GetInputFlags(kMaintainAudioPitchInput) | kInputFlagHidden));
|
||||||
|
|
||||||
// Undo block flag that hides in param view
|
// Undo block flag that hides in param view
|
||||||
SetFlags(GetFlags() & ~kDontShowInParamView);
|
SetFlag(kDontShowInParamView, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SubtitleBlock::Name() const
|
QString SubtitleBlock::Name() const
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ TransitionBlock::TransitionBlock() :
|
|||||||
SetInputProperty(kCenterInput, QStringLiteral("view"), RationalSlider::kTime);
|
SetInputProperty(kCenterInput, QStringLiteral("view"), RationalSlider::kTime);
|
||||||
SetInputProperty(kCenterInput, QStringLiteral("viewlock"), true);
|
SetInputProperty(kCenterInput, QStringLiteral("viewlock"), true);
|
||||||
|
|
||||||
SetFlags(GetFlags() & ~kDontShowInParamView);
|
SetFlag(kDontShowInParamView, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransitionBlock::Retranslate()
|
void TransitionBlock::Retranslate()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ OCIOBaseNode::OCIOBaseNode() :
|
|||||||
connect(this, &Node::AddedToGraph, this, &OCIOBaseNode::AddedToGraph);
|
connect(this, &Node::AddedToGraph, this, &OCIOBaseNode::AddedToGraph);
|
||||||
connect(this, &Node::RemovedFromGraph, this, &OCIOBaseNode::RemovedFromGraph);
|
connect(this, &Node::RemovedFromGraph, this, &OCIOBaseNode::RemovedFromGraph);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OCIOBaseNode::AddedToGraph(Project *p)
|
void OCIOBaseNode::AddedToGraph(Project *p)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ CornerPinDistortNode::CornerPinDistortNode()
|
|||||||
gizmo_resize_handle_[2] = AddDraggableGizmo<PointGizmo>({NodeKeyframeTrackReference(NodeInput(this, kBottomRightInput), 0), NodeKeyframeTrackReference(NodeInput(this, kBottomRightInput), 1)});
|
gizmo_resize_handle_[2] = AddDraggableGizmo<PointGizmo>({NodeKeyframeTrackReference(NodeInput(this, kBottomRightInput), 0), NodeKeyframeTrackReference(NodeInput(this, kBottomRightInput), 1)});
|
||||||
gizmo_resize_handle_[3] = AddDraggableGizmo<PointGizmo>({NodeKeyframeTrackReference(NodeInput(this, kBottomLeftInput), 0), NodeKeyframeTrackReference(NodeInput(this, kBottomLeftInput), 1)});
|
gizmo_resize_handle_[3] = AddDraggableGizmo<PointGizmo>({NodeKeyframeTrackReference(NodeInput(this, kBottomLeftInput), 0), NodeKeyframeTrackReference(NodeInput(this, kBottomLeftInput), 1)});
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ CropDistortNode::CropDistortNode()
|
|||||||
point_gizmo_[kGizmoScaleCenterLeft] = AddDraggableGizmo<PointGizmo>({kLeftInput});
|
point_gizmo_[kGizmoScaleCenterLeft] = AddDraggableGizmo<PointGizmo>({kLeftInput});
|
||||||
point_gizmo_[kGizmoScaleCenterRight] = AddDraggableGizmo<PointGizmo>({kRightInput});
|
point_gizmo_[kGizmoScaleCenterRight] = AddDraggableGizmo<PointGizmo>({kRightInput});
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ FlipDistortNode::FlipDistortNode()
|
|||||||
|
|
||||||
AddInput(kVerticalInput, NodeValue::kBoolean, false);
|
AddInput(kVerticalInput, NodeValue::kBoolean, false);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ RippleDistortNode::RippleDistortNode()
|
|||||||
AddInput(kPositionInput, NodeValue::kVec2, QVector2D(0, 0));
|
AddInput(kPositionInput, NodeValue::kVec2, QVector2D(0, 0));
|
||||||
AddInput(kStretchInput, NodeValue::kBoolean, false);
|
AddInput(kStretchInput, NodeValue::kBoolean, false);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
|
|
||||||
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ SwirlDistortNode::SwirlDistortNode()
|
|||||||
|
|
||||||
AddInput(kPositionInput, NodeValue::kVec2, QVector2D(0, 0));
|
AddInput(kPositionInput, NodeValue::kVec2, QVector2D(0, 0));
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
|
|
||||||
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ TileDistortNode::TileDistortNode()
|
|||||||
AddInput(kMirrorXInput, NodeValue::kBoolean, false);
|
AddInput(kMirrorXInput, NodeValue::kBoolean, false);
|
||||||
AddInput(kMirrorYInput, NodeValue::kBoolean, false);
|
AddInput(kMirrorYInput, NodeValue::kBoolean, false);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
|
|
||||||
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
gizmo_ = AddDraggableGizmo<PointGizmo>({
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ TransformDistortNode::TransformDistortNode()
|
|||||||
point_gizmo_[i]->SetDragValueBehavior(PointGizmo::kAbsolute);
|
point_gizmo_[i]->SetDragValueBehavior(PointGizmo::kAbsolute);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ WaveDistortNode::WaveDistortNode()
|
|||||||
|
|
||||||
AddInput(kVerticalInput, NodeValue::kCombo, false);
|
AddInput(kVerticalInput, NodeValue::kCombo, false);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ OpacityEffect::OpacityEffect()
|
|||||||
SetInputProperty(kValueInput, QStringLiteral("min"), 0.0);
|
SetInputProperty(kValueInput, QStringLiteral("min"), 0.0);
|
||||||
SetInputProperty(kValueInput, QStringLiteral("max"), 1.0);
|
SetInputProperty(kValueInput, QStringLiteral("max"), 1.0);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ BlurFilterNode::BlurFilterNode()
|
|||||||
|
|
||||||
AddInput(kRepeatEdgePixelsInput, NodeValue::kBoolean, true);
|
AddInput(kRepeatEdgePixelsInput, NodeValue::kBoolean, true);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
|
|
||||||
radial_center_gizmo_ = AddDraggableGizmo<PointGizmo>();
|
radial_center_gizmo_ = AddDraggableGizmo<PointGizmo>();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ DropShadowFilter::DropShadowFilter()
|
|||||||
AddInput(kFastInput, NodeValue::kBoolean, false);
|
AddInput(kFastInput, NodeValue::kBoolean, false);
|
||||||
|
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropShadowFilter::Retranslate()
|
void DropShadowFilter::Retranslate()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ MosaicFilterNode::MosaicFilterNode()
|
|||||||
AddInput(kVertInput, NodeValue::kFloat, 18.0);
|
AddInput(kVertInput, NodeValue::kFloat, 18.0);
|
||||||
SetInputProperty(kVertInput, QStringLiteral("min"), 1.0);
|
SetInputProperty(kVertInput, QStringLiteral("min"), 1.0);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ StrokeFilterNode::StrokeFilterNode()
|
|||||||
|
|
||||||
AddInput(kInnerInput, NodeValue::kBoolean, false);
|
AddInput(kInnerInput, NodeValue::kBoolean, false);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ NoiseGeneratorNode::NoiseGeneratorNode()
|
|||||||
AddInput(kColorInput, NodeValue::kBoolean, false);
|
AddInput(kColorInput, NodeValue::kBoolean, false);
|
||||||
|
|
||||||
SetEffectInput(kBaseIn);
|
SetEffectInput(kBaseIn);
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NoiseGeneratorNode::Name() const
|
QString NoiseGeneratorNode::Name() const
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ GeneratorWithMerge::GeneratorWithMerge()
|
|||||||
{
|
{
|
||||||
AddInput(kBaseInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
AddInput(kBaseInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||||
SetEffectInput(kBaseInput);
|
SetEffectInput(kBaseInput);
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneratorWithMerge::Retranslate()
|
void GeneratorWithMerge::Retranslate()
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ TextGeneratorV1::TextGeneratorV1()
|
|||||||
|
|
||||||
AddInput(kFontSizeInput, NodeValue::kFloat, 72.0f);
|
AddInput(kFontSizeInput, NodeValue::kFloat, 72.0f);
|
||||||
|
|
||||||
SetFlags(kDontShowInCreateMenu);
|
SetFlag(kDontShowInCreateMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TextGeneratorV1::Name() const
|
QString TextGeneratorV1::Name() const
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ TextGeneratorV2::TextGeneratorV2()
|
|||||||
SetStandardValue(kColorInput, QVariant::fromValue(Color(1.0f, 1.0f, 1.0)));
|
SetStandardValue(kColorInput, QVariant::fromValue(Color(1.0f, 1.0f, 1.0)));
|
||||||
SetStandardValue(kSizeInput, QVector2D(400, 300));
|
SetStandardValue(kSizeInput, QVector2D(400, 300));
|
||||||
|
|
||||||
SetFlags(kDontShowInCreateMenu);
|
SetFlag(kDontShowInCreateMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TextGeneratorV2::Name() const
|
QString TextGeneratorV2::Name() const
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace olive {
|
|||||||
NodeGroup::NodeGroup() :
|
NodeGroup::NodeGroup() :
|
||||||
output_passthrough_(nullptr)
|
output_passthrough_(nullptr)
|
||||||
{
|
{
|
||||||
SetFlags(kDontShowInCreateMenu);
|
SetFlag(kDontShowInCreateMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NodeGroup::Name() const
|
QString NodeGroup::Name() const
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ ColorDifferenceKeyNode::ColorDifferenceKeyNode()
|
|||||||
|
|
||||||
AddInput(kMaskOnlyInput, NodeValue::kBoolean, false);
|
AddInput(kMaskOnlyInput, NodeValue::kBoolean, false);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ DespillNode::DespillNode()
|
|||||||
|
|
||||||
AddInput(kPreserveLuminanceInput, NodeValue::kBoolean, false);
|
AddInput(kPreserveLuminanceInput, NodeValue::kBoolean, false);
|
||||||
|
|
||||||
SetFlags(kVideoEffect);
|
SetFlag(kVideoEffect);
|
||||||
SetEffectInput(kTextureInput);
|
SetEffectInput(kTextureInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ MergeNode::MergeNode()
|
|||||||
|
|
||||||
AddInput(kBlendIn, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
AddInput(kBlendIn, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||||
|
|
||||||
SetFlags(kDontShowInParamView);
|
SetFlag(kDontShowInParamView);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MergeNode::Name() const
|
QString MergeNode::Name() const
|
||||||
|
|||||||
+7
-3
@@ -103,10 +103,14 @@ void Node::Retranslate()
|
|||||||
SetInputName(kEnabledInput, tr("Enabled"));
|
SetInputName(kEnabledInput, tr("Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon Node::icon() const
|
QVariant Node::data(const DataType &d) const
|
||||||
{
|
{
|
||||||
// Just a meaningless default icon to be used where necessary
|
if (d == ICON) {
|
||||||
return icon::New;
|
// Just a meaningless default icon to be used where necessary
|
||||||
|
return icon::New;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Node::SetNodePositionInContext(Node *node, const QPointF &pos)
|
bool Node::SetNodePositionInContext(Node *node, const QPointF &pos)
|
||||||
|
|||||||
+18
-14
@@ -100,7 +100,8 @@ public:
|
|||||||
kDontShowInParamView = 0x1,
|
kDontShowInParamView = 0x1,
|
||||||
kVideoEffect = 0x2,
|
kVideoEffect = 0x2,
|
||||||
kAudioEffect = 0x4,
|
kAudioEffect = 0x4,
|
||||||
kDontShowInCreateMenu = 0x8
|
kDontShowInCreateMenu = 0x8,
|
||||||
|
kIsItem = 0x10
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ContextPair {
|
struct ContextPair {
|
||||||
@@ -184,24 +185,23 @@ public:
|
|||||||
return folder_;
|
return folder_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsItem() const
|
bool IsItem() const { return flags_ & kIsItem; }
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function called to retranslate parameter names (should be overridden in derivatives)
|
* @brief Function called to retranslate parameter names (should be overridden in derivatives)
|
||||||
*/
|
*/
|
||||||
virtual void Retranslate();
|
virtual void Retranslate();
|
||||||
|
|
||||||
virtual QIcon icon() const;
|
enum DataType
|
||||||
|
{
|
||||||
|
ICON,
|
||||||
|
DURATION,
|
||||||
|
CREATED_TIME,
|
||||||
|
MODIFIED_TIME,
|
||||||
|
FREQUENCY_RATE
|
||||||
|
};
|
||||||
|
|
||||||
virtual QString duration() const {return QString();}
|
virtual QVariant data(const DataType &d) const;
|
||||||
|
|
||||||
virtual qint64 creation_time() const {return 0;}
|
|
||||||
virtual qint64 mod_time() const {return 0;}
|
|
||||||
|
|
||||||
virtual QString rate() const {return QString();}
|
|
||||||
|
|
||||||
const QVector<QString>& inputs() const
|
const QVector<QString>& inputs() const
|
||||||
{
|
{
|
||||||
@@ -1196,9 +1196,13 @@ protected:
|
|||||||
tooltip_ = s;
|
tooltip_ = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFlags(const uint64_t &f)
|
void SetFlag(Flag f, bool on = true)
|
||||||
{
|
{
|
||||||
flags_ = f;
|
if (on) {
|
||||||
|
flags_ |= f;
|
||||||
|
} else {
|
||||||
|
flags_ &= ~f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
|
|||||||
set_default_parameters();
|
set_default_parameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFlags(kDontShowInParamView);
|
SetFlag(kDontShowInParamView);
|
||||||
|
|
||||||
workarea_ = new TimelineWorkArea(this);
|
workarea_ = new TimelineWorkArea(this);
|
||||||
markers_ = new TimelineMarkerList(this);
|
markers_ = new TimelineMarkerList(this);
|
||||||
@@ -87,56 +87,61 @@ QString ViewerOutput::Description() const
|
|||||||
return tr("Interface between a Viewer panel and the node system.");
|
return tr("Interface between a Viewer panel and the node system.");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ViewerOutput::duration() const
|
QVariant ViewerOutput::data(const DataType &d) const
|
||||||
{
|
{
|
||||||
rational using_timebase;
|
switch (d) {
|
||||||
Timecode::Display using_display = Core::instance()->GetTimecodeDisplay();
|
case DURATION:
|
||||||
|
{
|
||||||
|
rational using_timebase;
|
||||||
|
Timecode::Display using_display = Core::instance()->GetTimecodeDisplay();
|
||||||
|
|
||||||
// Get first enabled streams
|
// Get first enabled streams
|
||||||
VideoParams video = GetFirstEnabledVideoStream();
|
VideoParams video = GetFirstEnabledVideoStream();
|
||||||
AudioParams audio = GetFirstEnabledAudioStream();
|
AudioParams audio = GetFirstEnabledAudioStream();
|
||||||
SubtitleParams sub = GetFirstEnabledSubtitleStream();
|
SubtitleParams sub = GetFirstEnabledSubtitleStream();
|
||||||
|
|
||||||
if (video.is_valid() && video.video_type() != VideoParams::kVideoTypeStill) {
|
if (video.is_valid() && video.video_type() != VideoParams::kVideoTypeStill) {
|
||||||
// Prioritize video
|
// Prioritize video
|
||||||
using_timebase = video.frame_rate_as_time_base();
|
using_timebase = video.frame_rate_as_time_base();
|
||||||
} else if (audio.is_valid()) {
|
} else if (audio.is_valid()) {
|
||||||
// Use audio as a backup
|
// Use audio as a backup
|
||||||
// If we're showing in a timecode, we prefer showing audio in seconds instead
|
// If we're showing in a timecode, we prefer showing audio in seconds instead
|
||||||
if (using_display == Timecode::kTimecodeDropFrame
|
if (using_display == Timecode::kTimecodeDropFrame
|
||||||
|| using_display == Timecode::kTimecodeNonDropFrame) {
|
|| using_display == Timecode::kTimecodeNonDropFrame) {
|
||||||
using_display = Timecode::kTimecodeSeconds;
|
using_display = Timecode::kTimecodeSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
using_timebase = audio.sample_rate_as_time_base();
|
||||||
|
} else if (sub.is_valid()) {
|
||||||
|
using_timebase = OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>();
|
||||||
}
|
}
|
||||||
|
|
||||||
using_timebase = audio.sample_rate_as_time_base();
|
if (!using_timebase.isNull()) {
|
||||||
} else if (sub.is_valid()) {
|
// Return time transformed to timecode
|
||||||
using_timebase = OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>();
|
return QString::fromStdString(Timecode::time_to_timecode(GetLength(), using_timebase, using_display));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FREQUENCY_RATE:
|
||||||
|
{
|
||||||
|
VideoParams video_stream;
|
||||||
|
|
||||||
|
if (HasEnabledVideoStreams()
|
||||||
|
&& (video_stream = GetFirstEnabledVideoStream()).video_type() != VideoParams::kVideoTypeStill) {
|
||||||
|
// This is a video editor, prioritize video streams
|
||||||
|
return tr("%1 FPS").arg(video_stream.frame_rate().toDouble());
|
||||||
|
} else if (HasEnabledAudioStreams()) {
|
||||||
|
// No video streams, return audio
|
||||||
|
AudioParams audio_stream = GetFirstEnabledAudioStream();
|
||||||
|
return tr("%1 Hz").arg(audio_stream.sample_rate());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (using_timebase.isNull()) {
|
return super::data(d);
|
||||||
// No timebase, return null
|
|
||||||
return QString();
|
|
||||||
} else {
|
|
||||||
// Return time transformed to timecode
|
|
||||||
return QString::fromStdString(Timecode::time_to_timecode(GetLength(), using_timebase, using_display));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ViewerOutput::rate() const
|
|
||||||
{
|
|
||||||
VideoParams video_stream;
|
|
||||||
|
|
||||||
if (HasEnabledVideoStreams()
|
|
||||||
&& (video_stream = GetFirstEnabledVideoStream()).video_type() != VideoParams::kVideoTypeStill) {
|
|
||||||
// This is a video editor, prioritize video streams
|
|
||||||
return tr("%1 FPS").arg(video_stream.frame_rate().toDouble());
|
|
||||||
} else if (HasEnabledAudioStreams()) {
|
|
||||||
// No video streams, return audio
|
|
||||||
AudioParams audio_stream = GetFirstEnabledAudioStream();
|
|
||||||
return tr("%1 Hz").arg(audio_stream.sample_rate());
|
|
||||||
}
|
|
||||||
|
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewerOutput::HasEnabledVideoStreams() const
|
bool ViewerOutput::HasEnabledVideoStreams() const
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ public:
|
|||||||
virtual QVector<CategoryID> Category() const override;
|
virtual QVector<CategoryID> Category() const override;
|
||||||
virtual QString Description() const override;
|
virtual QString Description() const override;
|
||||||
|
|
||||||
virtual QString duration() const override;
|
virtual QVariant data(const DataType &d) const override;
|
||||||
virtual QString rate() const override;
|
|
||||||
|
|
||||||
void set_default_parameters();
|
void set_default_parameters();
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,18 @@ const QString Folder::kChildInput = QStringLiteral("child_in");
|
|||||||
|
|
||||||
Folder::Folder()
|
Folder::Folder()
|
||||||
{
|
{
|
||||||
|
SetFlag(kIsItem);
|
||||||
|
|
||||||
AddInput(kChildInput, NodeValue::kNone, InputFlags(kInputFlagArray | kInputFlagNotKeyframable));
|
AddInput(kChildInput, NodeValue::kNone, InputFlags(kInputFlagArray | kInputFlagNotKeyframable));
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon Folder::icon() const
|
QVariant Folder::data(const DataType &d) const
|
||||||
{
|
{
|
||||||
return icon::Folder;
|
if (d == ICON) {
|
||||||
|
return icon::Folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super::data(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Folder::Retranslate()
|
void Folder::Retranslate()
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
return tr("Organize several items into a single collection.");
|
return tr("Organize several items into a single collection.");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QIcon icon() const override;
|
virtual QVariant data(const DataType &d) const override;
|
||||||
|
|
||||||
virtual void Retranslate() override;
|
virtual void Retranslate() override;
|
||||||
|
|
||||||
@@ -86,11 +86,6 @@ public:
|
|||||||
return item_children_;
|
return item_children_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsItem() const override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int index_of_child(Node* item) const
|
int index_of_child(Node* item) const
|
||||||
{
|
{
|
||||||
return item_children_.indexOf(item);
|
return item_children_.indexOf(item);
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ Footage::Footage(const QString &filename) :
|
|||||||
cancelled_(nullptr),
|
cancelled_(nullptr),
|
||||||
total_stream_count_(0)
|
total_stream_count_(0)
|
||||||
{
|
{
|
||||||
|
SetFlag(kIsItem);
|
||||||
|
|
||||||
PrependInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
PrependInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
@@ -203,26 +205,6 @@ const QString &Footage::decoder() const
|
|||||||
return decoder_;
|
return decoder_;
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon Footage::icon() const
|
|
||||||
{
|
|
||||||
if (valid_ && GetTotalStreamCount()) {
|
|
||||||
// Prioritize video > audio > image
|
|
||||||
VideoParams s = GetFirstEnabledVideoStream();
|
|
||||||
|
|
||||||
if (s.is_valid() && s.video_type() != VideoParams::kVideoTypeStill) {
|
|
||||||
return icon::Video;
|
|
||||||
} else if (HasEnabledAudioStreams()) {
|
|
||||||
return icon::Audio;
|
|
||||||
} else if (s.is_valid() && s.video_type() == VideoParams::kVideoTypeStill) {
|
|
||||||
return icon::Image;
|
|
||||||
} else if (HasEnabledSubtitleStreams()) {
|
|
||||||
return icon::Subtitles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return icon::Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Footage::DescribeVideoStream(const VideoParams ¶ms)
|
QString Footage::DescribeVideoStream(const VideoParams ¶ms)
|
||||||
{
|
{
|
||||||
if (params.video_type() == VideoParams::kVideoTypeStill) {
|
if (params.video_type() == VideoParams::kVideoTypeStill) {
|
||||||
@@ -375,26 +357,51 @@ void Footage::LoadFinishedEvent()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 Footage::creation_time() const
|
QVariant Footage::data(const DataType &d) const
|
||||||
{
|
{
|
||||||
QFileInfo info(filename());
|
switch (d) {
|
||||||
|
case CREATED_TIME:
|
||||||
|
{
|
||||||
|
QFileInfo info(filename());
|
||||||
|
|
||||||
if (info.exists()) {
|
if (info.exists()) {
|
||||||
return QtUtils::GetCreationDate(info).toSecsSinceEpoch();
|
return QtUtils::GetCreationDate(info).toSecsSinceEpoch();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MODIFIED_TIME:
|
||||||
|
{
|
||||||
|
QFileInfo info(filename());
|
||||||
|
|
||||||
|
if (info.exists()) {
|
||||||
|
return info.lastModified().toSecsSinceEpoch();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ICON:
|
||||||
|
{
|
||||||
|
if (valid_ && GetTotalStreamCount()) {
|
||||||
|
// Prioritize video > audio > image
|
||||||
|
VideoParams s = GetFirstEnabledVideoStream();
|
||||||
|
|
||||||
|
if (s.is_valid() && s.video_type() != VideoParams::kVideoTypeStill) {
|
||||||
|
return icon::Video;
|
||||||
|
} else if (HasEnabledAudioStreams()) {
|
||||||
|
return icon::Audio;
|
||||||
|
} else if (s.is_valid() && s.video_type() == VideoParams::kVideoTypeStill) {
|
||||||
|
return icon::Image;
|
||||||
|
} else if (HasEnabledSubtitleStreams()) {
|
||||||
|
return icon::Subtitles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon::Error;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return super::data(d);
|
||||||
}
|
|
||||||
|
|
||||||
qint64 Footage::mod_time() const
|
|
||||||
{
|
|
||||||
QFileInfo info(filename());
|
|
||||||
|
|
||||||
if (info.exists()) {
|
|
||||||
return info.lastModified().toSecsSinceEpoch();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Footage::UpdateTooltip()
|
void Footage::UpdateTooltip()
|
||||||
|
|||||||
@@ -153,13 +153,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
const QString& decoder() const;
|
const QString& decoder() const;
|
||||||
|
|
||||||
virtual QIcon icon() const override;
|
|
||||||
|
|
||||||
virtual bool IsItem() const override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString DescribeVideoStream(const VideoParams& params);
|
static QString DescribeVideoStream(const VideoParams& params);
|
||||||
static QString DescribeAudioStream(const AudioParams& params);
|
static QString DescribeAudioStream(const AudioParams& params);
|
||||||
static QString DescribeSubtitleStream(const SubtitleParams& params);
|
static QString DescribeSubtitleStream(const SubtitleParams& params);
|
||||||
@@ -176,8 +169,7 @@ public:
|
|||||||
|
|
||||||
virtual void LoadFinishedEvent() override;
|
virtual void LoadFinishedEvent() override;
|
||||||
|
|
||||||
virtual qint64 creation_time() const override;
|
virtual QVariant data(const DataType &d) const override;
|
||||||
virtual qint64 mod_time() const override;
|
|
||||||
|
|
||||||
virtual int GetTotalStreamCount() const override { return total_stream_count_; }
|
virtual int GetTotalStreamCount() const override { return total_stream_count_; }
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ const QString Sequence::kTrackInputFormat = QStringLiteral("track_in_%1");
|
|||||||
|
|
||||||
Sequence::Sequence()
|
Sequence::Sequence()
|
||||||
{
|
{
|
||||||
|
SetFlag(kIsItem);
|
||||||
|
|
||||||
// Create TrackList instances
|
// Create TrackList instances
|
||||||
track_lists_.resize(Track::kCount);
|
track_lists_.resize(Track::kCount);
|
||||||
|
|
||||||
@@ -71,9 +73,13 @@ void Sequence::add_default_nodes(MultiUndoCommand* command)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon Sequence::icon() const
|
QVariant Sequence::data(const DataType &d) const
|
||||||
{
|
{
|
||||||
return icon::Sequence;
|
if (d == ICON) {
|
||||||
|
return icon::Sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super::data(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<Track *> Sequence::GetUnlockedTracks() const
|
QVector<Track *> Sequence::GetUnlockedTracks() const
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
void add_default_nodes(MultiUndoCommand *command = nullptr);
|
void add_default_nodes(MultiUndoCommand *command = nullptr);
|
||||||
|
|
||||||
virtual QIcon icon() const override;
|
virtual QVariant data(const DataType &d) const override;
|
||||||
|
|
||||||
const QVector<Track *> &GetTracks() const
|
const QVector<Track *> &GetTracks() const
|
||||||
{
|
{
|
||||||
@@ -87,11 +87,6 @@ public:
|
|||||||
|
|
||||||
static const QString kTrackInputFormat;
|
static const QString kTrackInputFormat;
|
||||||
|
|
||||||
virtual bool IsItem() const override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void InputConnectedEvent(const QString &input, int element, Node *output) override;
|
virtual void InputConnectedEvent(const QString &input, int element, Node *output) override;
|
||||||
|
|
||||||
|
|||||||
@@ -157,9 +157,6 @@ void ProjectImportTask::ValidateImageSequence(Footage *footage, QFileInfoList& i
|
|||||||
QString previous_img_fn = Decoder::TransformImageSequenceFileName(footage->filename(), ind - 1);
|
QString previous_img_fn = Decoder::TransformImageSequenceFileName(footage->filename(), ind - 1);
|
||||||
QString next_img_fn = Decoder::TransformImageSequenceFileName(footage->filename(), ind + 1);
|
QString next_img_fn = Decoder::TransformImageSequenceFileName(footage->filename(), ind + 1);
|
||||||
|
|
||||||
// See if the same decoder can retrieve surrounding files
|
|
||||||
DecoderPtr decoder = Decoder::CreateFromID(footage->decoder());
|
|
||||||
|
|
||||||
Footage* previous_file = new Footage(previous_img_fn);
|
Footage* previous_file = new Footage(previous_img_fn);
|
||||||
Footage* next_file = new Footage(next_img_fn);
|
Footage* next_file = new Footage(next_img_fn);
|
||||||
|
|
||||||
|
|||||||
@@ -140,13 +140,13 @@ QVariant ProjectViewModel::data(const QModelIndex &index, int role) const
|
|||||||
case kName:
|
case kName:
|
||||||
return internal_item->GetLabel();
|
return internal_item->GetLabel();
|
||||||
case kDuration:
|
case kDuration:
|
||||||
return internal_item->duration();
|
return internal_item->data(Node::DURATION);
|
||||||
case kRate:
|
case kRate:
|
||||||
return internal_item->rate();
|
return internal_item->data(Node::FREQUENCY_RATE);
|
||||||
case kLastModified:
|
case kLastModified:
|
||||||
case kCreatedTime:
|
case kCreatedTime:
|
||||||
{
|
{
|
||||||
qint64 using_time = (column_type == kLastModified) ? internal_item->mod_time() : internal_item->creation_time();
|
qint64 using_time = (column_type == kLastModified) ? internal_item->data(Node::MODIFIED_TIME).toLongLong() : internal_item->data(Node::CREATED_TIME).toLongLong();
|
||||||
|
|
||||||
if (using_time == 0) {
|
if (using_time == 0) {
|
||||||
// 0 is the null value, return nothing
|
// 0 is the null value, return nothing
|
||||||
@@ -178,7 +178,7 @@ QVariant ProjectViewModel::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
// If this is the first column, return the Item's icon
|
// If this is the first column, return the Item's icon
|
||||||
if (column_type == kName) {
|
if (column_type == kName) {
|
||||||
return internal_item->icon();
|
return internal_item->data(Node::ICON);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
|
|||||||
Reference in New Issue
Block a user