remove hashes from nodes
This commit is contained in:
@@ -43,7 +43,6 @@ Block::Block() :
|
|||||||
SetInputProperty(kLengthInput, QStringLiteral("min"), QVariant::fromValue(rational(0, 1)));
|
SetInputProperty(kLengthInput, QStringLiteral("min"), QVariant::fromValue(rational(0, 1)));
|
||||||
SetInputProperty(kLengthInput, QStringLiteral("view"), RationalSlider::kTime);
|
SetInputProperty(kLengthInput, QStringLiteral("view"), RationalSlider::kTime);
|
||||||
SetInputProperty(kLengthInput, QStringLiteral("viewlock"), true);
|
SetInputProperty(kLengthInput, QStringLiteral("viewlock"), true);
|
||||||
IgnoreHashingFrom(kLengthInput);
|
|
||||||
|
|
||||||
SetInputFlags(kEnabledInput, InputFlags(GetInputFlags(kEnabledInput) | kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
SetInputFlags(kEnabledInput, InputFlags(GetInputFlags(kEnabledInput) | kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
|
|
||||||
@@ -102,23 +101,6 @@ void Block::InputValueChangedEvent(const QString &input, int element)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Block::HashPassthrough(const QString &input, QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
if (IsInputConnected(input)) {
|
|
||||||
TimeRange t = InputTimeAdjustment(input, -1, globals.time());
|
|
||||||
|
|
||||||
NodeGlobals new_globals = globals;
|
|
||||||
new_globals.set_time(t);
|
|
||||||
|
|
||||||
Node *out = GetConnectedOutput(input);
|
|
||||||
Node::Hash(out, GetValueHintForInput(input), hash, new_globals, video_params);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Block::set_length_internal(const rational &length)
|
void Block::set_length_internal(const rational &length)
|
||||||
{
|
{
|
||||||
SetStandardValue(kLengthInput, QVariant::fromValue(length));
|
SetStandardValue(kLengthInput, QVariant::fromValue(length));
|
||||||
@@ -132,11 +114,6 @@ void Block::Retranslate()
|
|||||||
SetInputName(kEnabledInput, tr("Enabled"));
|
SetInputName(kEnabledInput, tr("Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Block::Hash(QCryptographicHash &, const NodeGlobals &, const VideoParams &) const
|
|
||||||
{
|
|
||||||
// A block does nothing by default, so we hash nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
void Block::InvalidateCache(const TimeRange& range, const QString& from, int element, InvalidateCacheOptions options)
|
void Block::InvalidateCache(const TimeRange& range, const QString& from, int element, InvalidateCacheOptions options)
|
||||||
{
|
{
|
||||||
TimeRange r;
|
TimeRange r;
|
||||||
|
|||||||
@@ -129,10 +129,6 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
virtual void InputValueChangedEvent(const QString& input, int element) override;
|
virtual void InputValueChangedEvent(const QString& input, int element) override;
|
||||||
|
|
||||||
virtual void Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
bool HashPassthrough(const QString &input, QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams& video_params) const;
|
|
||||||
|
|
||||||
Block* previous_;
|
Block* previous_;
|
||||||
Block* next_;
|
Block* next_;
|
||||||
|
|
||||||
|
|||||||
@@ -43,15 +43,12 @@ ClipBlock::ClipBlock() :
|
|||||||
AddInput(kMediaInInput, NodeValue::kRational, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
AddInput(kMediaInInput, NodeValue::kRational, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
SetInputProperty(kMediaInInput, QStringLiteral("view"), RationalSlider::kTime);
|
SetInputProperty(kMediaInInput, QStringLiteral("view"), RationalSlider::kTime);
|
||||||
SetInputProperty(kMediaInInput, QStringLiteral("viewlock"), true);
|
SetInputProperty(kMediaInInput, QStringLiteral("viewlock"), true);
|
||||||
IgnoreHashingFrom(kMediaInInput);
|
|
||||||
|
|
||||||
AddInput(kSpeedInput, NodeValue::kFloat, 1.0, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
AddInput(kSpeedInput, NodeValue::kFloat, 1.0, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
SetInputProperty(kSpeedInput, QStringLiteral("view"), FloatSlider::kPercentage);
|
SetInputProperty(kSpeedInput, QStringLiteral("view"), FloatSlider::kPercentage);
|
||||||
SetInputProperty(kSpeedInput, QStringLiteral("min"), 0.0);
|
SetInputProperty(kSpeedInput, QStringLiteral("min"), 0.0);
|
||||||
IgnoreHashingFrom(kSpeedInput);
|
|
||||||
|
|
||||||
AddInput(kReverseInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
AddInput(kReverseInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
IgnoreHashingFrom(kReverseInput);
|
|
||||||
|
|
||||||
AddInput(kMaintainAudioPitchInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
AddInput(kMaintainAudioPitchInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
|
|
||||||
@@ -287,9 +284,4 @@ void ClipBlock::Retranslate()
|
|||||||
SetInputName(kMaintainAudioPitchInput, tr("Maintain Audio Pitch"));
|
SetInputName(kMaintainAudioPitchInput, tr("Maintain Audio Pitch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClipBlock::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
HashPassthrough(kBufferIn, hash, globals, video_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void LinkChangeEvent() override;
|
virtual void LinkChangeEvent() override;
|
||||||
|
|
||||||
virtual void Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rational SequenceToMediaTime(const rational& sequence_time, bool ignore_reverse = false, bool ignore_speed = false) const;
|
rational SequenceToMediaTime(const rational& sequence_time, bool ignore_reverse = false, bool ignore_speed = false) const;
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ TransitionBlock::TransitionBlock() :
|
|||||||
AddInput(kCenterInput, NodeValue::kRational, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
AddInput(kCenterInput, NodeValue::kRational, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||||
SetInputProperty(kCenterInput, QStringLiteral("view"), RationalSlider::kTime);
|
SetInputProperty(kCenterInput, QStringLiteral("view"), RationalSlider::kTime);
|
||||||
SetInputProperty(kCenterInput, QStringLiteral("viewlock"), true);
|
SetInputProperty(kCenterInput, QStringLiteral("viewlock"), true);
|
||||||
IgnoreHashingFrom(kCenterInput);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransitionBlock::Retranslate()
|
void TransitionBlock::Retranslate()
|
||||||
@@ -137,23 +136,6 @@ double TransitionBlock::GetInProgress(const double &time) const
|
|||||||
return clamp((GetInternalTransitionTime(time) - out_offset().toDouble()) / in_offset().toDouble(), 0.0, 1.0);
|
return clamp((GetInternalTransitionTime(time) - out_offset().toDouble()) / in_offset().toDouble(), 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransitionBlock::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
if (HashPassthrough(kInBlockInput, hash, globals, video_params)
|
|
||||||
|| HashPassthrough(kOutBlockInput, hash, globals, video_params)) {
|
|
||||||
HashAddNodeSignature(hash);
|
|
||||||
|
|
||||||
double time_dbl = globals.time().in().toDouble();
|
|
||||||
double all_prog = GetTotalProgress(time_dbl);
|
|
||||||
double in_prog = GetInProgress(time_dbl);
|
|
||||||
double out_prog = GetOutProgress(time_dbl);
|
|
||||||
|
|
||||||
hash.addData(reinterpret_cast<const char*>(&all_prog), sizeof(all_prog));
|
|
||||||
hash.addData(reinterpret_cast<const char*>(&in_prog), sizeof(in_prog));
|
|
||||||
hash.addData(reinterpret_cast<const char*>(&out_prog), sizeof(out_prog));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double TransitionBlock::GetInternalTransitionTime(const double &time) const
|
double TransitionBlock::GetInternalTransitionTime(const double &time) const
|
||||||
{
|
{
|
||||||
return time;
|
return time;
|
||||||
|
|||||||
@@ -87,8 +87,6 @@ protected:
|
|||||||
|
|
||||||
virtual TimeRange OutputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const override;
|
virtual TimeRange OutputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const override;
|
||||||
|
|
||||||
virtual void Hash(QCryptographicHash& hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum CurveType {
|
enum CurveType {
|
||||||
kLinear,
|
kLinear,
|
||||||
|
|||||||
@@ -127,35 +127,6 @@ ShaderCode TransformDistortNode::GetShaderCode(const ShaderRequest &request) con
|
|||||||
return ShaderCode();
|
return ShaderCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransformDistortNode::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
// If not connected to output, this will produce nothing
|
|
||||||
Node *out = GetConnectedOutput(kTextureInput);
|
|
||||||
if (!out) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use a traverser to determine if the matrix is identity
|
|
||||||
NodeTraverser traverser;
|
|
||||||
traverser.SetCacheVideoParams(video_params);
|
|
||||||
|
|
||||||
NodeValueRow db = traverser.GenerateRow(this, globals.time());
|
|
||||||
TexturePtr tex = db[kTextureInput].toTexture();
|
|
||||||
if (tex) {
|
|
||||||
VideoParams tex_params = tex->params();
|
|
||||||
QMatrix4x4 matrix = GenerateMatrix(db, true, false, false, false);
|
|
||||||
matrix = GenerateAutoScaledMatrix(matrix, db, globals, tex_params);
|
|
||||||
|
|
||||||
if (!matrix.isIdentity()) {
|
|
||||||
// Add fingerprint
|
|
||||||
HashAddNodeSignature(hash);
|
|
||||||
hash.addData(reinterpret_cast<const char*>(&matrix), sizeof(matrix));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super::Hash(out, GetValueHintForInput(kTextureInput), hash, globals, video_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TransformDistortNode::GizmoDragStart(const NodeValueRow &row, double x, double y, const rational &time)
|
void TransformDistortNode::GizmoDragStart(const NodeValueRow &row, double x, double y, const rational &time)
|
||||||
{
|
{
|
||||||
DraggableGizmo *gizmo = static_cast<DraggableGizmo*>(sender());
|
DraggableGizmo *gizmo = static_cast<DraggableGizmo*>(sender());
|
||||||
|
|||||||
@@ -81,9 +81,6 @@ public:
|
|||||||
static const QString kAutoscaleInput;
|
static const QString kAutoscaleInput;
|
||||||
static const QString kInterpolationInput;
|
static const QString kInterpolationInput;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void Hash(QCryptographicHash& hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void GizmoDragStart(const olive::NodeValueRow &row, double x, double y, const olive::rational &time) override;
|
virtual void GizmoDragStart(const olive::NodeValueRow &row, double x, double y, const olive::rational &time) override;
|
||||||
|
|
||||||
|
|||||||
@@ -57,12 +57,4 @@ void TimeInput::Value(const NodeValueRow &value, const NodeGlobals &globals, Nod
|
|||||||
QStringLiteral("time"));
|
QStringLiteral("time"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeInput::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
super::Hash(hash, globals, video_params);
|
|
||||||
|
|
||||||
// Make sure time is hashed
|
|
||||||
hash.addData(NodeValue::ValueToBytes(NodeValue::kFloat, globals.time().in().toDouble()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ public:
|
|||||||
|
|
||||||
virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override;
|
virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void Hash(QCryptographicHash& hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,37 +101,4 @@ void MergeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, Nod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MergeNode::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
NodeTraverser traverser;
|
|
||||||
traverser.SetCacheVideoParams(video_params);
|
|
||||||
|
|
||||||
NodeValueDatabase db = traverser.GenerateDatabase(this, globals.time());
|
|
||||||
|
|
||||||
TexturePtr base_tex = db[kBaseIn].Get(NodeValue::kTexture).toTexture();
|
|
||||||
TexturePtr blend_tex = db[kBlendIn].Get(NodeValue::kTexture).toTexture();
|
|
||||||
|
|
||||||
if (base_tex || blend_tex) {
|
|
||||||
bool passthrough_base = !blend_tex;
|
|
||||||
bool passthrough_blend = !base_tex || (blend_tex && blend_tex->channel_count() < VideoParams::kRGBAChannelCount);
|
|
||||||
|
|
||||||
if (!passthrough_base && !passthrough_blend) {
|
|
||||||
// This merge will actually do something so we add a fingerprint
|
|
||||||
HashAddNodeSignature(hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!passthrough_base) {
|
|
||||||
Node *blend_output = GetConnectedOutput(kBlendIn);
|
|
||||||
Node::Hash(blend_output, GetValueHintForInput(kBlendIn), hash, globals, video_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!passthrough_blend) {
|
|
||||||
Node *base_output = GetConnectedOutput(kBaseIn);
|
|
||||||
Node::Hash(base_output, GetValueHintForInput(kBaseIn), hash, globals, video_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_ASSERT(!passthrough_base || !passthrough_blend);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ public:
|
|||||||
static const QString kBaseIn;
|
static const QString kBaseIn;
|
||||||
static const QString kBlendIn;
|
static const QString kBlendIn;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NodeInput* base_in_;
|
NodeInput* base_in_;
|
||||||
|
|
||||||
|
|||||||
@@ -864,12 +864,6 @@ int Node::InputArraySize(const QString &id) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::Hash(const Node *node, const ValueHint &hint, QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params)
|
|
||||||
{
|
|
||||||
hint.Hash(hash);
|
|
||||||
node->Hash(hash, globals, video_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::SetValueHintForInput(const QString &input, const ValueHint &hint, int element)
|
void Node::SetValueHintForInput(const QString &input, const ValueHint &hint, int element)
|
||||||
{
|
{
|
||||||
value_hints_.insert({input, element}, hint);
|
value_hints_.insert({input, element}, hint);
|
||||||
@@ -1184,12 +1178,6 @@ bool Node::AreLinked(Node *a, Node *b)
|
|||||||
return a->links_.contains(b);
|
return a->links_.contains(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::HashAddNodeSignature(QCryptographicHash &hash) const
|
|
||||||
{
|
|
||||||
// Add node ID
|
|
||||||
hash.addData(id().toUtf8());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::InsertInput(const QString &id, NodeValue::Type type, const QVariant &default_value, InputFlags flags, int index)
|
void Node::InsertInput(const QString &id, NodeValue::Type type, const QVariant &default_value, InputFlags flags, int index)
|
||||||
{
|
{
|
||||||
if (id.isEmpty()) {
|
if (id.isEmpty()) {
|
||||||
@@ -1305,11 +1293,6 @@ void Node::IgnoreInvalidationsFrom(const QString& input_id)
|
|||||||
ignore_connections_.append(input_id);
|
ignore_connections_.append(input_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::IgnoreHashingFrom(const QString &input_id)
|
|
||||||
{
|
|
||||||
ignore_when_hashing_.append(input_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString &Node::GetLabel() const
|
const QString &Node::GetLabel() const
|
||||||
{
|
{
|
||||||
return label_;
|
return label_;
|
||||||
@@ -1341,24 +1324,6 @@ QString Node::GetLabelOrName() const
|
|||||||
return GetLabel();
|
return GetLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
// Add this Node's ID and output being used
|
|
||||||
HashAddNodeSignature(hash);
|
|
||||||
|
|
||||||
foreach (const QString& input, inputs()) {
|
|
||||||
// For each input, try to hash its value
|
|
||||||
if (ignore_when_hashing_.contains(input)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int arr_sz = InputArraySize(input);
|
|
||||||
for (int i=-1; i<arr_sz; i++) {
|
|
||||||
HashInputElement(hash, input, i, globals, video_params);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::CopyInputs(const Node *source, Node *destination, bool include_connections)
|
void Node::CopyInputs(const Node *source, Node *destination, bool include_connections)
|
||||||
{
|
{
|
||||||
Q_ASSERT(source->id() == destination->id());
|
Q_ASSERT(source->id() == destination->id());
|
||||||
@@ -1485,26 +1450,6 @@ QVector<Node *> Node::GetDependenciesInternal(bool traverse, bool exclusive_only
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::HashInputElement(QCryptographicHash &hash, const QString& input, int element, const NodeGlobals &globals, const VideoParams& video_params) const
|
|
||||||
{
|
|
||||||
// Get time adjustment
|
|
||||||
// For a single frame, we only care about one of the times
|
|
||||||
TimeRange input_time = InputTimeAdjustment(input, element, globals.time());
|
|
||||||
|
|
||||||
if (IsInputConnected(input, element)) {
|
|
||||||
// Traverse down this edge
|
|
||||||
Node *output = GetConnectedOutput(input, element);
|
|
||||||
|
|
||||||
NodeGlobals new_globals = globals;
|
|
||||||
new_globals.set_time(input_time);
|
|
||||||
Node::Hash(output, GetValueHintForInput(input, element), hash, new_globals, video_params);
|
|
||||||
} else {
|
|
||||||
// Grab the value at this time
|
|
||||||
QVariant value = GetValueAtTime(input, input_time.in(), element);
|
|
||||||
hash.addData(NodeValue::ValueToBytes(GetInputDataType(input), value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<Node *> Node::GetDependencies() const
|
QVector<Node *> Node::GetDependencies() const
|
||||||
{
|
{
|
||||||
return GetDependenciesInternal(true, false);
|
return GetDependenciesInternal(true, false);
|
||||||
@@ -2108,16 +2053,6 @@ void NodeRemovePositionFromAllContextsCommand::undo()
|
|||||||
contexts_.clear();
|
contexts_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::ValueHint::Hash(QCryptographicHash &hash) const
|
|
||||||
{
|
|
||||||
// Add value hint
|
|
||||||
if (!types().isEmpty()) {
|
|
||||||
hash.addData(reinterpret_cast<const char*>(types().constData()), sizeof(NodeValue::Type) * types().size());
|
|
||||||
}
|
|
||||||
hash.addData(reinterpret_cast<const char*>(&index()), sizeof(index()));
|
|
||||||
hash.addData(tag().toUtf8());
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeSetPositionAndDependenciesRecursivelyCommand::prepare()
|
void NodeSetPositionAndDependenciesRecursivelyCommand::prepare()
|
||||||
{
|
{
|
||||||
move_recursively(node_, pos_.position - context_->GetNodePositionDataInContext(node_).position);
|
move_recursively(node_, pos_.position - context_->GetNodePositionDataInContext(node_).position);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#define NODE_H
|
#define NODE_H
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <QCryptographicHash>
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@@ -588,8 +587,6 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hash(QCryptographicHash &hash) const;
|
|
||||||
|
|
||||||
const QVector<NodeValue::Type> &types() const { return type_; }
|
const QVector<NodeValue::Type> &types() const { return type_; }
|
||||||
const int &index() const { return index_; }
|
const int &index() const { return index_; }
|
||||||
const QString& tag() const { return tag_; }
|
const QString& tag() const { return tag_; }
|
||||||
@@ -605,8 +602,6 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Hash(const Node *node, const ValueHint &hint, QCryptographicHash& hash, const NodeGlobals &globals, const VideoParams& video_params);
|
|
||||||
|
|
||||||
const QMap<InputElementPair, ValueHint> &GetValueHints() const
|
const QMap<InputElementPair, ValueHint> &GetValueHints() const
|
||||||
{
|
{
|
||||||
return value_hints_;
|
return value_hints_;
|
||||||
@@ -993,10 +988,6 @@ public:
|
|||||||
static const QString kEnabledInput;
|
static const QString kEnabledInput;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Hash(QCryptographicHash& hash, const NodeGlobals &globals, const VideoParams& video_params) const;
|
|
||||||
|
|
||||||
void HashAddNodeSignature(QCryptographicHash &hash) const;
|
|
||||||
|
|
||||||
void InsertInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags, int index);
|
void InsertInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags, int index);
|
||||||
|
|
||||||
void PrependInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal))
|
void PrependInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal))
|
||||||
@@ -1037,8 +1028,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void IgnoreInvalidationsFrom(const QString &input_id);
|
void IgnoreInvalidationsFrom(const QString &input_id);
|
||||||
|
|
||||||
void IgnoreHashingFrom(const QString& input_id);
|
|
||||||
|
|
||||||
int GetOperationStack() const
|
int GetOperationStack() const
|
||||||
{
|
{
|
||||||
return operation_stack_;
|
return operation_stack_;
|
||||||
@@ -1321,8 +1310,6 @@ private:
|
|||||||
|
|
||||||
QVector<Node*> GetDependenciesInternal(bool traverse, bool exclusive_only) const;
|
QVector<Node*> GetDependenciesInternal(bool traverse, bool exclusive_only) const;
|
||||||
|
|
||||||
void HashInputElement(QCryptographicHash& hash, const QString &input, int element, const NodeGlobals &globals, const VideoParams &video_params) const;
|
|
||||||
|
|
||||||
void ParameterValueChanged(const QString &input, int element, const olive::TimeRange &range);
|
void ParameterValueChanged(const QString &input, int element, const olive::TimeRange &range);
|
||||||
void ParameterValueChanged(const NodeInput& input, const olive::TimeRange &range)
|
void ParameterValueChanged(const NodeInput& input, const olive::TimeRange &range)
|
||||||
{
|
{
|
||||||
@@ -1343,8 +1330,6 @@ private:
|
|||||||
|
|
||||||
QVector<QString> ignore_connections_;
|
QVector<QString> ignore_connections_;
|
||||||
|
|
||||||
QVector<QString> ignore_when_hashing_;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Internal variable for whether this Node can be deleted or not
|
* @brief Internal variable for whether this Node can be deleted or not
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -554,18 +554,6 @@ bool Track::IsLocked() const
|
|||||||
return locked_;
|
return locked_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Track::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
Block* b = BlockAtTime(globals.time().in());
|
|
||||||
|
|
||||||
// Defer to block at this time, don't add any of our own information to the hash
|
|
||||||
if (b) {
|
|
||||||
NodeGlobals new_globals = globals;
|
|
||||||
new_globals.set_time(TransformRangeForBlock(b, globals.time()));
|
|
||||||
Node::Hash(b, GetValueHintForInput(kBlockInput, GetArrayIndexFromBlock(b)), hash, new_globals, video_params);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Track::SetMuted(bool e)
|
void Track::SetMuted(bool e)
|
||||||
{
|
{
|
||||||
SetStandardValue(kMutedInput, e);
|
SetStandardValue(kMutedInput, e);
|
||||||
|
|||||||
@@ -451,8 +451,6 @@ signals:
|
|||||||
void BlocksRefreshed();
|
void BlocksRefreshed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Hash(QCryptographicHash& hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
virtual void InputConnectedEvent(const QString& input, int element, Node *output) override;
|
virtual void InputConnectedEvent(const QString& input, int element, Node *output) override;
|
||||||
|
|
||||||
virtual void InputDisconnectedEvent(const QString& input, int element, Node *output) override;
|
virtual void InputDisconnectedEvent(const QString& input, int element, Node *output) override;
|
||||||
|
|||||||
@@ -53,11 +53,9 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
|
|||||||
AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable));
|
AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable));
|
||||||
|
|
||||||
AddInput(kVideoAutoCacheInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
AddInput(kVideoAutoCacheInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||||
IgnoreHashingFrom(kVideoAutoCacheInput);
|
|
||||||
IgnoreInvalidationsFrom(kVideoAutoCacheInput);
|
IgnoreInvalidationsFrom(kVideoAutoCacheInput);
|
||||||
|
|
||||||
AddInput(kAudioAutoCacheInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
AddInput(kAudioAutoCacheInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||||
IgnoreHashingFrom(kAudioAutoCacheInput);
|
|
||||||
IgnoreInvalidationsFrom(kAudioAutoCacheInput);
|
IgnoreInvalidationsFrom(kAudioAutoCacheInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ Footage::Footage(const QString &filename) :
|
|||||||
SetViewerVideoCacheEnabled(false);
|
SetViewerVideoCacheEnabled(false);
|
||||||
|
|
||||||
PrependInput(kLoopModeInput, NodeValue::kCombo, 0, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
PrependInput(kLoopModeInput, NodeValue::kCombo, 0, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
IgnoreHashingFrom(kLoopModeInput);
|
|
||||||
|
|
||||||
PrependInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
PrependInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
|
|
||||||
@@ -279,44 +278,6 @@ QString Footage::DescribeAudioStream(const AudioParams ¶ms)
|
|||||||
QString::number(params.sample_rate()));
|
QString::number(params.sample_rate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Footage::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
super::Hash(hash, globals, video_params);
|
|
||||||
|
|
||||||
// Footage last modified date
|
|
||||||
hash.addData(QString::number(timestamp()).toUtf8());
|
|
||||||
|
|
||||||
for (int i=0; i<GetVideoStreamCount(); i++) {
|
|
||||||
VideoParams params = GetVideoParams(i);
|
|
||||||
|
|
||||||
// Current color config and space
|
|
||||||
hash.addData(project()->color_manager()->GetConfigFilename().toUtf8());
|
|
||||||
hash.addData(GetColorspaceToUse(params).toUtf8());
|
|
||||||
|
|
||||||
// Alpha associated setting
|
|
||||||
hash.addData(QString::number(params.premultiplied_alpha()).toUtf8());
|
|
||||||
|
|
||||||
// Pixel aspect ratio
|
|
||||||
hash.addData(reinterpret_cast<const char*>(¶ms.pixel_aspect_ratio()), sizeof(params.pixel_aspect_ratio()));
|
|
||||||
|
|
||||||
// Footage timestamp
|
|
||||||
if (params.video_type() != VideoParams::kVideoTypeStill) {
|
|
||||||
rational adjusted_time = AdjustTimeByLoopMode(globals.time().in(), loop_mode(), GetLength(), params.video_type(), params.frame_rate_as_time_base());
|
|
||||||
|
|
||||||
if (!adjusted_time.isNaN()) {
|
|
||||||
int64_t video_ts = Timecode::time_to_timestamp(adjusted_time, params.time_base());
|
|
||||||
|
|
||||||
// Add timestamp in units of the video stream's timebase
|
|
||||||
hash.addData(reinterpret_cast<const char*>(&video_ts), sizeof(video_ts));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add start time - used for both image sequences and video streams
|
|
||||||
auto start_time = params.start_time();
|
|
||||||
hash.addData(reinterpret_cast<const char*>(&start_time), sizeof(start_time));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(globals)
|
Q_UNUSED(globals)
|
||||||
|
|||||||
@@ -195,8 +195,6 @@ protected:
|
|||||||
|
|
||||||
virtual rational VerifyLengthInternal(Track::Type type) const override;
|
virtual rational VerifyLengthInternal(Track::Type type) const override;
|
||||||
|
|
||||||
virtual void Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString GetColorspaceToUse(const VideoParams& params) const;
|
QString GetColorspaceToUse(const VideoParams& params) const;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ TimeOffsetNode::TimeOffsetNode()
|
|||||||
AddInput(kTimeInput, NodeValue::kRational, QVariant::fromValue(rational(0)), InputFlags(kInputFlagNotConnectable));
|
AddInput(kTimeInput, NodeValue::kRational, QVariant::fromValue(rational(0)), InputFlags(kInputFlagNotConnectable));
|
||||||
SetInputProperty(kTimeInput, QStringLiteral("view"), RationalSlider::kTime);
|
SetInputProperty(kTimeInput, QStringLiteral("view"), RationalSlider::kTime);
|
||||||
SetInputProperty(kTimeInput, QStringLiteral("viewlock"), true);
|
SetInputProperty(kTimeInput, QStringLiteral("viewlock"), true);
|
||||||
IgnoreHashingFrom(kTimeInput);
|
|
||||||
|
|
||||||
AddInput(kInputInput, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable));
|
AddInput(kInputInput, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable));
|
||||||
}
|
}
|
||||||
@@ -73,18 +72,6 @@ void TimeOffsetNode::Value(const NodeValueRow &value, const NodeGlobals &globals
|
|||||||
table->Push(value[kInputInput]);
|
table->Push(value[kInputInput]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeOffsetNode::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
// Don't hash anything of our own, just pass-through to the connected node at the remapped tmie
|
|
||||||
if (IsInputConnected(kInputInput)) {
|
|
||||||
Node *out = GetConnectedOutput(kInputInput);
|
|
||||||
|
|
||||||
NodeGlobals new_globals = globals;
|
|
||||||
new_globals.set_time(TimeRange(GetRemappedTime(globals.time().in()), GetRemappedTime(globals.time().out())));
|
|
||||||
Node::Hash(out, GetValueHintForInput(kInputInput), hash, new_globals, video_params);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rational TimeOffsetNode::GetRemappedTime(const rational &input) const
|
rational TimeOffsetNode::GetRemappedTime(const rational &input) const
|
||||||
{
|
{
|
||||||
return input + GetValueAtTime(kTimeInput, input).value<rational>();
|
return input + GetValueAtTime(kTimeInput, input).value<rational>();
|
||||||
|
|||||||
@@ -62,9 +62,6 @@ public:
|
|||||||
static const QString kTimeInput;
|
static const QString kTimeInput;
|
||||||
static const QString kInputInput;
|
static const QString kInputInput;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rational GetRemappedTime(const rational& input) const;
|
rational GetRemappedTime(const rational& input) const;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ TimeRemapNode::TimeRemapNode()
|
|||||||
AddInput(kTimeInput, NodeValue::kRational, QVariant::fromValue(rational(0)), InputFlags(kInputFlagNotConnectable));
|
AddInput(kTimeInput, NodeValue::kRational, QVariant::fromValue(rational(0)), InputFlags(kInputFlagNotConnectable));
|
||||||
SetInputProperty(kTimeInput, QStringLiteral("view"), RationalSlider::kTime);
|
SetInputProperty(kTimeInput, QStringLiteral("view"), RationalSlider::kTime);
|
||||||
SetInputProperty(kTimeInput, QStringLiteral("viewlock"), true);
|
SetInputProperty(kTimeInput, QStringLiteral("viewlock"), true);
|
||||||
IgnoreHashingFrom(kTimeInput);
|
|
||||||
|
|
||||||
AddInput(kInputInput, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable));
|
AddInput(kInputInput, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable));
|
||||||
}
|
}
|
||||||
@@ -93,18 +92,6 @@ void TimeRemapNode::Value(const NodeValueRow &value, const NodeGlobals &globals,
|
|||||||
table->Push(value[kInputInput]);
|
table->Push(value[kInputInput]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeRemapNode::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams &video_params) const
|
|
||||||
{
|
|
||||||
// Don't hash anything of our own, just pass-through to the connected node at the remapped tmie
|
|
||||||
if (IsInputConnected(kInputInput)) {
|
|
||||||
Node *out = GetConnectedOutput(kInputInput);
|
|
||||||
|
|
||||||
NodeGlobals new_globals = globals;
|
|
||||||
new_globals.set_time(TimeRange(GetRemappedTime(globals.time().in()), GetRemappedTime(globals.time().out())));
|
|
||||||
Node::Hash(out, GetValueHintForInput(kInputInput), hash, new_globals, video_params);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rational TimeRemapNode::GetRemappedTime(const rational &input) const
|
rational TimeRemapNode::GetRemappedTime(const rational &input) const
|
||||||
{
|
{
|
||||||
return GetValueAtTime(kTimeInput, input).value<rational>();
|
return GetValueAtTime(kTimeInput, input).value<rational>();
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ public:
|
|||||||
static const QString kTimeInput;
|
static const QString kTimeInput;
|
||||||
static const QString kInputInput;
|
static const QString kInputInput;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void Hash(QCryptographicHash &hash, const NodeGlobals &globals, const VideoParams& video_params) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rational GetRemappedTime(const rational& input) const;
|
rational GetRemappedTime(const rational& input) const;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QCryptographicHash>
|
|
||||||
|
|
||||||
#include "common/xmlutils.h"
|
#include "common/xmlutils.h"
|
||||||
|
|
||||||
@@ -181,18 +180,6 @@ bool AudioParams::is_valid() const
|
|||||||
&& format_ < kFormatCount);
|
&& format_ < kFormatCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AudioParams::toBytes() const
|
|
||||||
{
|
|
||||||
QCryptographicHash hasher(QCryptographicHash::Sha1);
|
|
||||||
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&sample_rate_), sizeof(sample_rate_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&channel_layout_), sizeof(channel_layout_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&format_), sizeof(format_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&timebase_), sizeof(timebase_));
|
|
||||||
|
|
||||||
return hasher.result();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioParams::Load(QXmlStreamReader *reader)
|
void AudioParams::Load(QXmlStreamReader *reader)
|
||||||
{
|
{
|
||||||
while (XMLReadNextStartElement(reader)) {
|
while (XMLReadNextStartElement(reader)) {
|
||||||
|
|||||||
@@ -222,8 +222,6 @@ public:
|
|||||||
int bits_per_sample() const;
|
int bits_per_sample() const;
|
||||||
bool is_valid() const;
|
bool is_valid() const;
|
||||||
|
|
||||||
QByteArray toBytes() const;
|
|
||||||
|
|
||||||
void Load(QXmlStreamReader* reader);
|
void Load(QXmlStreamReader* reader);
|
||||||
|
|
||||||
void Save(QXmlStreamWriter* writer) const;
|
void Save(QXmlStreamWriter* writer) const;
|
||||||
|
|||||||
@@ -315,33 +315,6 @@ int VideoParams::GetScaledDimension(int dim, int divider)
|
|||||||
return dim / divider;
|
return dim / divider;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray VideoParams::toBytes() const
|
|
||||||
{
|
|
||||||
QCryptographicHash hasher(QCryptographicHash::Sha1);
|
|
||||||
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&width_), sizeof(width_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&height_), sizeof(height_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&depth_), sizeof(depth_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&time_base_), sizeof(time_base_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&format_), sizeof(format_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&channel_count_), sizeof(channel_count_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&pixel_aspect_ratio_), sizeof(pixel_aspect_ratio_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&interlacing_), sizeof(interlacing_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(÷r_), sizeof(divider_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&enabled_), sizeof(enabled_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&x_), sizeof(x_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&y_), sizeof(y_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&stream_index_), sizeof(stream_index_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&video_type_), sizeof(video_type_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&frame_rate_), sizeof(frame_rate_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&start_time_), sizeof(start_time_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&duration_), sizeof(duration_));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&premultiplied_alpha_), sizeof(premultiplied_alpha_));
|
|
||||||
hasher.addData(colorspace_.toUtf8());
|
|
||||||
|
|
||||||
return hasher.result();
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t VideoParams::get_time_in_timebase_units(const rational &time) const
|
int64_t VideoParams::get_time_in_timebase_units(const rational &time) const
|
||||||
{
|
{
|
||||||
if (time_base_.isNull()) {
|
if (time_base_.isNull()) {
|
||||||
|
|||||||
@@ -262,8 +262,6 @@ public:
|
|||||||
|
|
||||||
static int GetScaledDimension(int dim, int divider);
|
static int GetScaledDimension(int dim, int divider);
|
||||||
|
|
||||||
QByteArray toBytes() const;
|
|
||||||
|
|
||||||
bool enabled() const
|
bool enabled() const
|
||||||
{
|
{
|
||||||
return enabled_;
|
return enabled_;
|
||||||
|
|||||||
Reference in New Issue
Block a user