node: implemented bypassing

This commit is contained in:
itsmattkc
2022-04-26 15:07:01 -07:00
parent d1bb931854
commit 001834cbfa
34 changed files with 145 additions and 26 deletions
+4
View File
@@ -27,6 +27,8 @@ namespace olive {
const QString PanNode::kSamplesInput = QStringLiteral("samples_in");
const QString PanNode::kPanningInput = QStringLiteral("panning_in");
#define super Node
PanNode::PanNode()
{
AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable));
@@ -118,6 +120,8 @@ void PanNode::ProcessSamples(const NodeValueRow &values, const SampleBufferPtr i
void PanNode::Retranslate()
{
super::Retranslate();
SetInputName(kSamplesInput, tr("Samples"));
SetInputName(kPanningInput, tr("Pan"));
}
+4
View File
@@ -27,6 +27,8 @@ namespace olive {
const QString VolumeNode::kSamplesInput = QStringLiteral("samples_in");
const QString VolumeNode::kVolumeInput = QStringLiteral("volume_in");
#define super MathNodeBase
VolumeNode::VolumeNode()
{
AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable));
@@ -83,6 +85,8 @@ void VolumeNode::ProcessSamples(const NodeValueRow &values, const SampleBufferPt
void VolumeNode::Retranslate()
{
super::Retranslate();
SetInputName(kSamplesInput, tr("Samples"));
SetInputName(kVolumeInput, tr("Volume"));
}
-3
View File
@@ -32,7 +32,6 @@ namespace olive {
#define super Node
const QString Block::kLengthInput = QStringLiteral("length_in");
const QString Block::kEnabledInput = QStringLiteral("enabled_in");
Block::Block() :
previous_(nullptr),
@@ -46,8 +45,6 @@ Block::Block() :
SetInputProperty(kLengthInput, QStringLiteral("viewlock"), true);
IgnoreHashingFrom(kLengthInput);
AddInput(kEnabledInput, NodeValue::kBoolean, true, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
SetFlags(kDontShowInParamView);
}
-1
View File
@@ -118,7 +118,6 @@ public:
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element = -1, InvalidateCacheOptions options = InvalidateCacheOptions()) override;
static const QString kLengthInput;
static const QString kEnabledInput;
public slots:
@@ -34,6 +34,8 @@ const QString ColorManager::kConfigFilenameIn = QStringLiteral("config");
const QString ColorManager::kDefaultColorspaceIn = QStringLiteral("default_input");
const QString ColorManager::kReferenceSpaceIn = QStringLiteral("reference_space");
#define super Node
OCIO::ConstConfigRcPtr ColorManager::default_config_ = nullptr;
ColorManager::ColorManager() :
@@ -253,6 +255,8 @@ void ColorManager::GetDefaultLumaCoefs(double *rgb) const
void ColorManager::Retranslate()
{
super::Retranslate();
SetInputName(kConfigFilenameIn, tr("Configuration"));
SetInputName(kDefaultColorspaceIn, tr("Default Input"));
SetInputName(kReferenceSpaceIn, tr("Reference Space"));
@@ -33,6 +33,8 @@ const QString CornerPinDistortNode::kBottomRightInput = QStringLiteral("bottom_r
const QString CornerPinDistortNode::kBottomLeftInput = QStringLiteral("bottom_left_in");
const QString CornerPinDistortNode::kPerspectiveInput = QStringLiteral("perspective_in");
#define super Node
CornerPinDistortNode::CornerPinDistortNode()
{
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -55,6 +57,8 @@ CornerPinDistortNode::CornerPinDistortNode()
void CornerPinDistortNode::Retranslate()
{
super::Retranslate();
SetInputName(kTextureInput, tr("Texture"));
SetInputName(kPerspectiveInput, tr("Perspective"));
SetInputName(kTopLeftInput, tr("Top Left"));
@@ -33,6 +33,8 @@ const QString CropDistortNode::kRightInput = QStringLiteral("right_in");
const QString CropDistortNode::kBottomInput = QStringLiteral("bottom_in");
const QString CropDistortNode::kFeatherInput = QStringLiteral("feather_in");
#define super Node
CropDistortNode::CropDistortNode()
{
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -63,6 +65,8 @@ CropDistortNode::CropDistortNode()
void CropDistortNode::Retranslate()
{
super::Retranslate();
SetInputName(kTextureInput, tr("Texture"));
SetInputName(kLeftInput, tr("Left"));
SetInputName(kTopInput, tr("Top"));
@@ -26,6 +26,8 @@ const QString FlipDistortNode::kTextureInput = QStringLiteral("tex_in");
const QString FlipDistortNode::kHorizontalInput = QStringLiteral("horiz_in");
const QString FlipDistortNode::kVerticalInput = QStringLiteral("vert_in");
#define super Node
FlipDistortNode::FlipDistortNode()
{
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -65,6 +67,8 @@ QString FlipDistortNode::Description() const
void FlipDistortNode::Retranslate()
{
super::Retranslate();
SetInputName(kTextureInput, tr("Input"));
SetInputName(kHorizontalInput, tr("Horizontal"));
SetInputName(kVerticalInput, tr("Vertical"));
@@ -32,7 +32,7 @@ const QString TransformDistortNode::kTextureInput = QStringLiteral("tex_in");
const QString TransformDistortNode::kAutoscaleInput = QStringLiteral("autoscale_in");
const QString TransformDistortNode::kInterpolationInput = QStringLiteral("interpolation_in");
#define super Node
#define super MatrixGenerator
TransformDistortNode::TransformDistortNode()
{
@@ -71,7 +71,7 @@ TransformDistortNode::TransformDistortNode()
void TransformDistortNode::Retranslate()
{
MatrixGenerator::Retranslate();
super::Retranslate();
SetInputName(kAutoscaleInput, tr("Auto-Scale"));
SetInputName(kTextureInput, tr("Texture"));
@@ -153,7 +153,7 @@ void TransformDistortNode::Hash(QCryptographicHash &hash, const NodeGlobals &glo
}
}
Node::Hash(out, GetValueHintForInput(kTextureInput), hash, globals, video_params);
super::Hash(out, GetValueHintForInput(kTextureInput), hash, globals, video_params);
}
void TransformDistortNode::GizmoDragStart(const NodeValueRow &row, double x, double y, const rational &time)
+4
View File
@@ -29,6 +29,8 @@ const QString BlurFilterNode::kHorizInput = QStringLiteral("horiz_in");
const QString BlurFilterNode::kVertInput = QStringLiteral("vert_in");
const QString BlurFilterNode::kRepeatEdgePixelsInput = QStringLiteral("repeat_edge_pixels_in");
#define super Node
BlurFilterNode::BlurFilterNode()
{
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -75,6 +77,8 @@ QString BlurFilterNode::Description() const
void BlurFilterNode::Retranslate()
{
super::Retranslate();
SetInputName(kTextureInput, tr("Input"));
SetInputName(kMethodInput, tr("Method"));
SetComboBoxStrings(kMethodInput, { tr("Box"), tr("Gaussian") });
@@ -26,6 +26,8 @@ const QString MosaicFilterNode::kTextureInput = QStringLiteral("tex_in");
const QString MosaicFilterNode::kHorizInput = QStringLiteral("horiz_in");
const QString MosaicFilterNode::kVertInput = QStringLiteral("vert_in");
#define super Node
MosaicFilterNode::MosaicFilterNode()
{
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -42,6 +44,8 @@ MosaicFilterNode::MosaicFilterNode()
void MosaicFilterNode::Retranslate()
{
super::Retranslate();
SetInputName(kTextureInput, tr("Texture"));
SetInputName(kHorizInput, tr("Horizontal"));
SetInputName(kVertInput, tr("Vertical"));
+4
View File
@@ -31,6 +31,8 @@ const QString StrokeFilterNode::kRadiusInput = QStringLiteral("radius_in");
const QString StrokeFilterNode::kOpacityInput = QStringLiteral("opacity_in");
const QString StrokeFilterNode::kInnerInput = QStringLiteral("inner_in");
#define super Node
StrokeFilterNode::StrokeFilterNode()
{
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -78,6 +80,8 @@ QString StrokeFilterNode::Description() const
void StrokeFilterNode::Retranslate()
{
super::Retranslate();
SetInputName(kTextureInput, tr("Input"));
SetInputName(kColorInput, tr("Color"));
SetInputName(kRadiusInput, tr("Radius"));
+4
View File
@@ -33,6 +33,8 @@ const QString MatrixGenerator::kScaleInput = QStringLiteral("scale_in");
const QString MatrixGenerator::kUniformScaleInput = QStringLiteral("uniform_scale_in");
const QString MatrixGenerator::kAnchorInput = QStringLiteral("anchor_in");
#define super Node
MatrixGenerator::MatrixGenerator()
{
AddInput(kPositionInput, NodeValue::kVec2, QVector2D(0.0, 0.0));
@@ -81,6 +83,8 @@ QString MatrixGenerator::Description() const
void MatrixGenerator::Retranslate()
{
super::Retranslate();
SetInputName(kPositionInput, tr("Position"));
SetInputName(kRotationInput, tr("Rotation"));
SetInputName(kScaleInput, tr("Scale"));
+4
View File
@@ -25,6 +25,8 @@ namespace olive {
const QString NoiseGeneratorNode::kColorInput = QStringLiteral("color_in");
const QString NoiseGeneratorNode::kStrengthInput = QStringLiteral("strength_in");
#define super Node
NoiseGeneratorNode::NoiseGeneratorNode()
{
AddInput(kStrengthInput, NodeValue::kFloat, 20);
@@ -59,6 +61,8 @@ QString NoiseGeneratorNode::Description() const
void NoiseGeneratorNode::Retranslate()
{
super::Retranslate();
SetInputName(kStrengthInput, tr("Strength"));
SetInputName(kColorInput, tr("Color"));
}
+4
View File
@@ -30,6 +30,8 @@ namespace olive {
const QString PolygonGenerator::kPointsInput = QStringLiteral("points_in");
const QString PolygonGenerator::kColorInput = QStringLiteral("color_in");
#define super Node
PolygonGenerator::PolygonGenerator()
{
AddInput(kPointsInput, NodeValue::kBezier, QVector2D(0, 0), InputFlags(kInputFlagArray));
@@ -86,6 +88,8 @@ QString PolygonGenerator::Description() const
void PolygonGenerator::Retranslate()
{
super::Retranslate();
SetInputName(kPointsInput, tr("Points"));
SetInputName(kColorInput, tr("Color"));
}
+4
View File
@@ -26,6 +26,8 @@ namespace olive {
const QString SolidGenerator::kColorInput = QStringLiteral("color_in");
#define super Node
SolidGenerator::SolidGenerator()
{
// Default to a color that isn't black
@@ -59,6 +61,8 @@ QString SolidGenerator::Description() const
void SolidGenerator::Retranslate()
{
super::Retranslate();
SetInputName(kColorInput, tr("Color"));
}
+4
View File
@@ -38,6 +38,8 @@ const QString TextGeneratorV1::kVAlignInput = QStringLiteral("valign_in");
const QString TextGeneratorV1::kFontInput = QStringLiteral("font_in");
const QString TextGeneratorV1::kFontSizeInput = QStringLiteral("font_size_in");
#define super Node
TextGeneratorV1::TextGeneratorV1()
{
AddInput(kTextInput, NodeValue::kText, tr("Sample Text"));
@@ -75,6 +77,8 @@ QString TextGeneratorV1::Description() const
void TextGeneratorV1::Retranslate()
{
super::Retranslate();
SetInputName(kTextInput, tr("Text"));
SetInputName(kHtmlInput, tr("Enable HTML"));
SetInputName(kFontInput, tr("Font"));
+2
View File
@@ -53,6 +53,8 @@ QString NodeGroup::Description() const
void NodeGroup::Retranslate()
{
super::Retranslate();
for (auto it=GetContextPositions().cbegin(); it!=GetContextPositions().cend(); it++) {
it.key()->Retranslate();
}
+2
View File
@@ -48,6 +48,8 @@ ValueNode::ValueNode()
void ValueNode::Retranslate()
{
super::Retranslate();
SetInputName(kTypeInput, QStringLiteral("Type"));
SetInputName(kValueInput, QStringLiteral("Value"));
@@ -25,6 +25,8 @@ const QString ColorDifferenceKeyNode::kShadowsInput = QStringLiteral("shadows_in
const QString ColorDifferenceKeyNode::kHighlightsInput = QStringLiteral("highlights_in");
const QString ColorDifferenceKeyNode::kMaskOnlyInput = QStringLiteral("mask_only_in");
#define super Node
ColorDifferenceKeyNode::ColorDifferenceKeyNode()
{
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -74,6 +76,8 @@ QString ColorDifferenceKeyNode::Description() const
void ColorDifferenceKeyNode::Retranslate()
{
super::Retranslate();
SetInputName(kTextureInput, tr("Input"));
SetInputName(kGarbageMatteInput, tr("Garbage Matte"));
SetInputName(kCoreMatteInput, tr("Core Matte"));
+4 -1
View File
@@ -24,6 +24,8 @@ const QString DespillNode::kColorInput = QStringLiteral("color_in");
const QString DespillNode::kMethodInput = QStringLiteral("method_in");
const QString DespillNode::kPreserveLuminanceInput = QStringLiteral("preserve_luminance_input");
#define super Node
DespillNode::DespillNode()
{
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -65,12 +67,13 @@ QString DespillNode::Description() const
void DespillNode::Retranslate()
{
super::Retranslate();
SetInputName(kTextureInput, tr("Input"));
SetInputName(kColorInput, tr("Key Color"));
SetComboBoxStrings(kColorInput, {tr("Green"), tr("Blue")});
SetInputName(kMethodInput, tr("Method"));
SetComboBoxStrings(kMethodInput, {tr("Average"), tr("Double Red Average"), tr("Double Average"), tr("Limit")});
+3 -1
View File
@@ -27,6 +27,8 @@ const QString MathNode::kParamAIn = QStringLiteral("param_a_in");
const QString MathNode::kParamBIn = QStringLiteral("param_b_in");
const QString MathNode::kParamCIn = QStringLiteral("param_c_in");
#define super MathNodeBase
MathNode::MathNode()
{
AddInput(kMethodIn, NodeValue::kCombo, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
@@ -67,7 +69,7 @@ QString MathNode::Description() const
void MathNode::Retranslate()
{
Node::Retranslate();
super::Retranslate();
SetInputName(kMethodIn, tr("Method"));
SetInputName(kParamAIn, tr("Value"));
+4
View File
@@ -27,6 +27,8 @@ namespace olive {
const QString MergeNode::kBaseIn = QStringLiteral("base_in");
const QString MergeNode::kBlendIn = QStringLiteral("blend_in");
#define super Node
MergeNode::MergeNode()
{
AddInput(kBaseIn, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
@@ -63,6 +65,8 @@ QString MergeNode::Description() const
void MergeNode::Retranslate()
{
super::Retranslate();
SetInputName(kBaseIn, tr("Base"));
SetInputName(kBlendIn, tr("Blend"));
@@ -25,6 +25,8 @@ namespace olive {
const QString TrigonometryNode::kMethodIn = QStringLiteral("method_in");
const QString TrigonometryNode::kXIn = QStringLiteral("x_in");
#define super Node
TrigonometryNode::TrigonometryNode()
{
AddInput(kMethodIn, NodeValue::kCombo, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
@@ -59,6 +61,8 @@ QString TrigonometryNode::Description() const
void TrigonometryNode::Retranslate()
{
super::Retranslate();
QStringList strings = {tr("Sine"),
tr("Cosine"),
tr("Tangent"),
+5 -2
View File
@@ -42,6 +42,8 @@ namespace olive {
#define super QObject
const QString Node::kEnabledInput = QStringLiteral("enabled_in");
Node::Node() :
can_be_deleted_(true),
override_color_(-1),
@@ -49,9 +51,9 @@ Node::Node() :
operation_stack_(0),
cache_result_(false),
flags_(kNone),
effect_element_(-1),
bypass_(false)
effect_element_(-1)
{
AddInput(kEnabledInput, NodeValue::kBoolean, true);
}
Node::~Node()
@@ -105,6 +107,7 @@ QString Node::Description() const
void Node::Retranslate()
{
SetInputName(kEnabledInput, tr("Enabled"));
}
QIcon Node::icon() const
+2 -5
View File
@@ -896,9 +896,6 @@ public:
cache_result_ = e;
}
bool IsBypassed() const { return bypass_; }
void SetBypassed(bool e) { bypass_ = e; }
class ArrayRemoveCommand : public UndoCommand
{
public:
@@ -959,6 +956,8 @@ public:
static void SetValueAtTime(const NodeInput &input, const rational &time, const QVariant &value, int track, MultiUndoCommand *command, bool insert_on_all_tracks_if_no_key);
static const QString kEnabledInput;
protected:
virtual void Hash(QCryptographicHash& hash, const NodeGlobals &globals, const VideoParams& video_params) const;
@@ -1361,8 +1360,6 @@ private:
QString effect_input_;
int effect_element_;
bool bypass_;
private slots:
/**
* @brief Slot when a keyframe's time changes to keep the keyframes correctly sorted by time
+1 -1
View File
@@ -277,7 +277,7 @@ void Track::InputValueChangedEvent(const QString &input, int element)
void Track::Retranslate()
{
Node::Retranslate();
super::Retranslate();
SetInputName(kBlockInput, tr("Blocks"));
SetInputName(kMutedInput, tr("Muted"));
@@ -25,6 +25,8 @@ namespace olive {
const QString ProjectSettingsNode::kCacheSetting = QStringLiteral("cache_setting");
const QString ProjectSettingsNode::kCachePath = QStringLiteral("cache_path");
#define super Node
ProjectSettingsNode::ProjectSettingsNode()
{
AddInput(kCacheSetting, NodeValue::kCombo, 0, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
@@ -36,6 +38,8 @@ ProjectSettingsNode::ProjectSettingsNode()
void ProjectSettingsNode::Retranslate()
{
super::Retranslate();
SetInputName(kCacheSetting, tr("Disk Cache Location"));
SetInputName(kCachePath, tr("Disk Cache Path"));
SetComboBoxStrings(kCacheSetting, {tr("Use Default Location"), tr("Store Alongside Project"), tr("Use Custom Location")});
@@ -41,6 +41,8 @@ TimeOffsetNode::TimeOffsetNode()
void TimeOffsetNode::Retranslate()
{
super::Retranslate();
SetInputName(kTimeInput, QStringLiteral("Time"));
SetInputName(kInputInput, QStringLiteral("Input"));
}
+2
View File
@@ -87,6 +87,8 @@ TimeRange TimeRemapNode::OutputTimeAdjustment(const QString &input, int element,
void TimeRemapNode::Retranslate()
{
super::Retranslate();
SetInputName(kTimeInput, QStringLiteral("Time"));
SetInputName(kInputInput, QStringLiteral("Input"));
}
+14 -1
View File
@@ -246,8 +246,18 @@ NodeValueTable NodeTraverser::GenerateTable(const Node *n, const Node::ValueHint
// Generate row for node
NodeValueDatabase database = GenerateDatabase(n, range);
NodeValueRow row = GenerateRow(&database, n, range);
// Check for bypass
bool is_enabled;
if (!database[Node::kEnabledInput].Has(NodeValue::kBoolean)) {
// Fallback if we couldn't find a bool value
is_enabled = true;
} else {
is_enabled = database[Node::kEnabledInput].Get(NodeValue::kBoolean).toBool();
}
if (is_enabled) {
NodeValueRow row = GenerateRow(&database, n, range);
//qDebug() << "FIXME: Implement pre-process of row";
// Generate output table
@@ -260,6 +270,9 @@ NodeValueTable NodeTraverser::GenerateTable(const Node *n, const Node::ValueHint
PostProcessTable(n, hint, range, table);
return table;
} else {
return database.Merge();
}
}
NodeValueTable NodeTraverser::GenerateBlockTable(const Track *track, const TimeRange &range)
@@ -63,6 +63,11 @@ NodeParamViewItem::NodeParamViewItem(Node *node, NodeParamViewCheckBoxBehavior c
setBackgroundRole(QPalette::Window);
// Connect title bar enabled checkbox
//title_bar()->SetEnabledCheckBoxVisible(true);
//title_bar()->SetEnabledCheckBoxChecked(node_->IsEnabled());
//connect(title_bar(), &NodeParamViewItemTitleBar::EnabledCheckBoxClicked, node_, &Node::SetEnabled);
Retranslate();
}
@@ -56,6 +56,11 @@ NodeParamViewItemTitleBar::NodeParamViewItemTitleBar(QWidget *parent) :
pin_btn_->setVisible(false);
layout->addWidget(pin_btn_);
connect(pin_btn_, &QPushButton::clicked, this, &NodeParamViewItemTitleBar::PinToggled);
enabled_checkbox_ = new QCheckBox();
enabled_checkbox_->setVisible(false);
layout->addWidget(enabled_checkbox_);
connect(enabled_checkbox_, &QCheckBox::clicked, this, &NodeParamViewItemTitleBar::EnabledCheckBoxClicked);
}
void NodeParamViewItemTitleBar::SetExpanded(bool e)
@@ -21,6 +21,7 @@
#ifndef NODEPARAMVIEWITEMTITLEBAR_H
#define NODEPARAMVIEWITEMTITLEBAR_H
#include <QCheckBox>
#include <QLabel>
#include <QWidget>
@@ -59,6 +60,16 @@ public slots:
add_fx_btn_->setVisible(e);
}
void SetEnabledCheckBoxVisible(bool e)
{
enabled_checkbox_->setVisible(e);
}
void SetEnabledCheckBoxChecked(bool e)
{
enabled_checkbox_->setChecked(e);
}
signals:
void ExpandedStateChanged(bool e);
@@ -66,6 +77,8 @@ signals:
void AddEffectButtonClicked();
void EnabledCheckBoxClicked(bool e);
protected:
virtual void paintEvent(QPaintEvent *event) override;
@@ -82,6 +95,8 @@ private:
QPushButton *add_fx_btn_;
QCheckBox *enabled_checkbox_;
};
}