move item setting to a node flag

This commit is contained in:
itsmattkc
2023-02-19 21:30:49 -08:00
parent 2c4347e9a6
commit 71e8665fbf
35 changed files with 43 additions and 50 deletions
+1 -1
View File
@@ -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);
} }
+1 -1
View File
@@ -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);
} }
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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);
} }
+1 -1
View File
@@ -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);
} }
+1 -1
View File
@@ -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>({
+1 -1
View File
@@ -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>({
+1 -1
View File
@@ -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);
} }
+1 -1
View File
@@ -40,7 +40,7 @@ WaveDistortNode::WaveDistortNode()
AddInput(kVerticalInput, NodeValue::kCombo, false); AddInput(kVerticalInput, NodeValue::kCombo, false);
SetFlags(kVideoEffect); SetFlag(kVideoEffect);
SetEffectInput(kTextureInput); SetEffectInput(kTextureInput);
} }
+1 -1
View File
@@ -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);
} }
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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);
} }
+1 -1
View File
@@ -48,7 +48,7 @@ StrokeFilterNode::StrokeFilterNode()
AddInput(kInnerInput, NodeValue::kBoolean, false); AddInput(kInnerInput, NodeValue::kBoolean, false);
SetFlags(kVideoEffect); SetFlag(kVideoEffect);
SetEffectInput(kTextureInput); SetEffectInput(kTextureInput);
} }
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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);
} }
+1 -1
View File
@@ -36,7 +36,7 @@ DespillNode::DespillNode()
AddInput(kPreserveLuminanceInput, NodeValue::kBoolean, false); AddInput(kPreserveLuminanceInput, NodeValue::kBoolean, false);
SetFlags(kVideoEffect); SetFlag(kVideoEffect);
SetEffectInput(kTextureInput); SetEffectInput(kTextureInput);
} }
+1 -1
View File
@@ -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
+9 -7
View File
@@ -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,10 +185,7 @@ 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)
@@ -1198,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>
+1 -1
View File
@@ -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);
+2
View File
@@ -34,6 +34,8 @@ 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));
} }
-5
View File
@@ -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);
+2
View File
@@ -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();
-5
View File
@@ -153,11 +153,6 @@ public:
*/ */
const QString& decoder() const; const QString& decoder() const;
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);
+2
View File
@@ -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);
-5
View File
@@ -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;