diff --git a/app/node/param.cpp b/app/node/param.cpp index 3bdc4e7b0..359d29bf9 100644 --- a/app/node/param.cpp +++ b/app/node/param.cpp @@ -45,7 +45,7 @@ NodeParam::~NodeParam() } } -const QString NodeParam::id() +const QString NodeParam::id() const { return id_; } @@ -184,40 +184,13 @@ NodeEdgePtr NodeParam::DisconnectForNewOutput(NodeInput *input) return nullptr; } -QString NodeParam::GetDefaultDataTypeName(const DataType& type) -{ - switch (type) { - case kNone: return tr("None"); - case kInt: return tr("Integer"); - case kFloat: return tr("Float"); - case kColor: return tr("Color"); - case kString: return tr("String"); - case kBoolean: return tr("Boolean"); - case kFont: return tr("Font"); - case kFile: return tr("File"); - case kTexture: return tr("Texture"); - case kMatrix: return tr("Matrix"); - case kBlock: return tr("Block"); - case kFootage: return tr("Footage"); - case kTrack: return tr("Track"); - case kRational: return tr("Rational"); - case kVec2: return tr("Vector2D"); - case kVec3: return tr("Vector3D"); - case kVec4: return tr("Vector4D"); - case kSamples: return tr("Samples"); - case kAny: return tr("Any"); - } - - return QString(); -} - QByteArray NodeParam::ValueToBytes(const NodeParam::DataType &type, const QVariant &value) { switch (type) { case kInt: return ValueToBytesInternal(value); case kFloat: return ValueToBytesInternal(value); case kColor: return ValueToBytesInternal(value); - case kString: return ValueToBytesInternal(value); + case kText: return ValueToBytesInternal(value); case kBoolean: return ValueToBytesInternal(value); case kFont: return ValueToBytesInternal(value); // FIXME: This should probably be a QFont? case kFile: return ValueToBytesInternal(value); @@ -231,9 +204,13 @@ QByteArray NodeParam::ValueToBytes(const NodeParam::DataType &type, const QVaria case kNone: case kFootage: case kTexture: - case kBlock: - case kTrack: case kSamples: + case kDecimal: + case kWholeNumber: + case kNumber: + case kString: + case kBuffer: + case kVector: case kAny: break; } diff --git a/app/node/param.h b/app/node/param.h index 8fc71d866..a0ca4e665 100644 --- a/app/node/param.h +++ b/app/node/param.h @@ -55,60 +55,171 @@ public: * @brief The types of data that can be passed between Nodes */ enum DataType { - kNone, + kNone = 0x0, - /// Resolves to `int` - kInt, + /** + ****************************** SPECIFIC IDENTIFIERS ****************************** + */ - /// Resolves to `double` - kFloat, + /** + * Integer type + * + * Resolves to `int` (may resolve to `long` in the future). + */ + kInt = 0x1, - /// Resolves to TBA - kColor, + /** + * Decimal (floating-point) type + * + * Resolves to `double`. + */ + kFloat = 0x2, - /// Resolves to `QString` - kString, + /** + * Decimal (rational) type + * + * Resolves to `double`. + */ + kRational = 0x4, - /// Resolves to `bool` - kBoolean, + /** + * Boolean type + * + * Resolves to `bool`. + */ + kBoolean = 0x8, - /// Resolves to TBA - kFont, + /** + * Floating-point type + * + * Resolves to `QRgba64`. + * + * Colors passed around the nodes should always be in reference space and preferably use + */ + kColor = 0x10, - /// Resolves to `QString` filename - kFile, + /** + * Matrix type + * + * Resolves to `QMatrix4x4`. + */ + kMatrix = 0x20, - /// Resolves to `RenderTexturePtr` - kTexture, + /** + * Text type + * + * Resolves to `QString`. + */ + kText = 0x40, - /// Resolves to `QMatrix4x4` - kMatrix, + /** + * Font type + * + * Resolves to `QFont`. + */ + kFont = 0x80, - /// Resolves to `Block*` - kBlock, + /** + * File type + * + * Resolves to a `QString` containing an absolute file path. + */ + kFile = 0x100, - /// Resolves to `Footage*` - kFootage, + /** + * Image buffer type + * + * True value type depends on the render engine used. + */ + kTexture = 0x200, - /// Resolves to `TrackOutput*` - kTrack, + /** + * Audio samples type + * + * Resolves to `QVector4D`. + */ + kSamples = 0x400, - /// Resolves to `rational` - kRational, + /** + * Footage stream identifier type + * + * Resolves to `StreamPtr`. + */ + kFootage = 0x800, - /// Resolves to `QVector2D` - kVec2, + /** + * Two-dimensional vector (XY) type + * + * Resolves to `QVector2D`. + */ + kVec2 = 0x1000, - /// Resolves to `QVector3D` - kVec3, + /** + * Three-dimensional vector (XYZ) type + * + * Resolves to `QVector3D`. + */ + kVec3 = 0x2000, - /// Resolves to `QVector4D` - kVec4, + /** + * Four-dimensional vector (XYZW) type + * + * Resolves to `QVector4D`. + */ + kVec4 = 0x4000, - /// Resolves to `QByteArray` - kSamples, + /** + ****************************** BROAD IDENTIFIERS ****************************** + */ - kAny + /** + * Identifier for type that contains a decimal number + * + * Includes kFloat and kRational. + */ + kDecimal = 0x6, + + /** + * Identifier for type that contains a whole number + * + * Includes kInt and kBoolean. + */ + kWholeNumber = 0x9, + + /** + * Identifier for type that contains a number of any kind (whole or decimal) + * + * Includes kInt, kFloat, kRational, and kBoolean. + */ + kNumber = 0xF, + + /** + * Identifier for type that contains a text string of any kind. + * + * Includes kText and kFile. + */ + kString = 0x140, + + /** + * Identifier for type that contains a either an image or audio buffer + * + * Includes kTexture and kSamples. + */ + kBuffer = 0x600, + + /** + * Identifier for type that contains a vector (two- to four-dimensional) + * + * Includes kVec2, kVec3, kVec4, and kColor. + */ + kVector = 0x7010, + + /** + * Identifier for any type + * + * Matches with all types except for kNone + */ + kAny = 0xFFFFFFFF }; /** @@ -121,7 +232,7 @@ public: /** * @brief Return ID of this parameter */ - const QString id(); + const QString id() const; /** * @brief The type of node paramter this is diff --git a/app/project/item/sequence/sequence.cpp b/app/project/item/sequence/sequence.cpp index 1f2f6f607..dd112f6b4 100644 --- a/app/project/item/sequence/sequence.cpp +++ b/app/project/item/sequence/sequence.cpp @@ -104,7 +104,7 @@ QString Sequence::duration() return QString(); } - rational timeline_length = timeline_output_->length_output()->get_realtime_value().value(); + rational timeline_length = timeline_output_->length(); int64_t timestamp = olive::time_to_timestamp(timeline_length, video_params_.time_base()); diff --git a/app/render/backend/audiorenderworker.cpp b/app/render/backend/audiorenderworker.cpp index 708a27bb6..24908cd44 100644 --- a/app/render/backend/audiorenderworker.cpp +++ b/app/render/backend/audiorenderworker.cpp @@ -22,8 +22,6 @@ QVariant AudioRenderWorker::RenderAsSibling(NodeDependency dep) // Set working state working_++; - bool locked = false; - // Firstly we check if this node is a "Block", if it is that means it's part of a linked list of mutually exclusive // nodes based on time and we might need to locate which Block to attach to if (node->IsBlock() @@ -32,20 +30,10 @@ QVariant AudioRenderWorker::RenderAsSibling(NodeDependency dep) // If the range is not wholly contained in this Block, we'll need to do some extra processing value = RenderBlock(output, dep.range()); } else { - node->LockProcessing(); value = ProcessNodeNormally(NodeDependency(output, dep.range())); - locked = true; } - if (!locked) { - node->LockProcessing(); - } - - // Place the value into the output - output->cache_value(dep.range(), value); - // We're done! - node->UnlockProcessing(); // End this working state working_--; diff --git a/app/render/backend/opengl/openglworker.cpp b/app/render/backend/opengl/openglworker.cpp index ba8dfe07d..fe2d58cb2 100644 --- a/app/render/backend/opengl/openglworker.cpp +++ b/app/render/backend/opengl/openglworker.cpp @@ -153,15 +153,19 @@ QVariant OpenGLWorker::RunNodeAccelerated(NodeOutput *out) input_texture_count++; break; } - case NodeInput::kAny: case NodeInput::kSamples: - case NodeInput::kTrack: - case NodeInput::kString: + case NodeInput::kText: case NodeInput::kRational: - case NodeInput::kBlock: case NodeInput::kFont: case NodeInput::kFile: + case NodeInput::kDecimal: + case NodeInput::kWholeNumber: + case NodeInput::kNumber: + case NodeInput::kString: + case NodeInput::kBuffer: + case NodeInput::kVector: case NodeInput::kNone: + case NodeInput::kAny: break; } } diff --git a/app/render/backend/renderbackend.cpp b/app/render/backend/renderbackend.cpp index 8d09676fe..8675946af 100644 --- a/app/render/backend/renderbackend.cpp +++ b/app/render/backend/renderbackend.cpp @@ -266,13 +266,6 @@ void RenderBackend::UpdateNodeInputs() Node* dst = copied_graph_.nodes().at(i); Node::CopyInputs(src, dst, false); - - // Drop values in range - foreach (NodeParam* p, dst->parameters()) { - if (p->type() == NodeParam::kOutput) { - static_cast(p)->drop_cached_values_overlapping(value_update_range_); - } - } } value_update_queued_ = false; diff --git a/app/render/backend/videorenderworker.cpp b/app/render/backend/videorenderworker.cpp index f9977abca..d8e84ffcf 100644 --- a/app/render/backend/videorenderworker.cpp +++ b/app/render/backend/videorenderworker.cpp @@ -133,8 +133,6 @@ QVariant VideoRenderWorker::RenderAsSibling(NodeDependency dep) //qDebug() << "Processing" << original_node->id() << original_node; - original_node->LockProcessing(); - // Firstly we check if this node is a "Block", if it is that means it's part of a linked list of mutually exclusive // nodes based on time and we might need to locate which Block to attach to if (original_node->IsBlock()) { @@ -143,10 +141,6 @@ QVariant VideoRenderWorker::RenderAsSibling(NodeDependency dep) if (original_node != node) { // Ensure output is the output matching the node as it may have changed output = static_cast(node->GetParameterWithID(output->id())); - - // Switch locks - original_node->UnlockProcessing(); - node->LockProcessing(); } } else { node = original_node; @@ -154,12 +148,7 @@ QVariant VideoRenderWorker::RenderAsSibling(NodeDependency dep) value = ProcessNodeNormally(NodeDependency(output, dep.range())); - // Place the value into the output - output->cache_value(dep.range(), value); - dep.node()->cache_value(dep.range(), value); - // We're done! - node->UnlockProcessing(); // End this working state working_--; diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp index 6d776abeb..311a4b5ed 100644 --- a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp @@ -43,12 +43,16 @@ void NodeParamViewWidgetBridge::CreateWidgets() // None of these inputs have applicable UI widgets case NodeParam::kNone: case NodeParam::kAny: - case NodeParam::kBlock: case NodeParam::kTexture: case NodeParam::kMatrix: - case NodeParam::kTrack: case NodeParam::kRational: case NodeParam::kSamples: + case NodeParam::kDecimal: + case NodeParam::kWholeNumber: + case NodeParam::kNumber: + case NodeParam::kString: + case NodeParam::kBuffer: + case NodeParam::kVector: break; case NodeParam::kInt: { @@ -142,7 +146,7 @@ void NodeParamViewWidgetBridge::CreateWidgets() case NodeParam::kColor: // FIXME: Color selector break; - case NodeParam::kString: + case NodeParam::kText: { QLineEdit* line_edit = new QLineEdit(); widgets_.append(line_edit); @@ -190,12 +194,16 @@ void NodeParamViewWidgetBridge::WidgetCallback() // None of these inputs have applicable UI widgets case NodeParam::kNone: case NodeParam::kAny: - case NodeParam::kBlock: case NodeParam::kTexture: case NodeParam::kMatrix: - case NodeParam::kTrack: case NodeParam::kSamples: case NodeParam::kRational: + case NodeParam::kDecimal: + case NodeParam::kWholeNumber: + case NodeParam::kNumber: + case NodeParam::kString: + case NodeParam::kVector: + case NodeParam::kBuffer: break; case NodeParam::kInt: { @@ -280,7 +288,7 @@ void NodeParamViewWidgetBridge::WidgetCallback() case NodeParam::kColor: // FIXME: Color selector break; - case NodeParam::kString: + case NodeParam::kText: { // Sender is a QLineEdit QLineEdit* line_edit = static_cast(sender()); diff --git a/app/widget/timelinewidget/timelinewidget.cpp b/app/widget/timelinewidget/timelinewidget.cpp index 1f8384889..0bb0971e1 100644 --- a/app/widget/timelinewidget/timelinewidget.cpp +++ b/app/widget/timelinewidget/timelinewidget.cpp @@ -170,7 +170,7 @@ void TimelineWidget::ConnectTimelineNode(TimelineOutput *node) connect(timeline_node_, SIGNAL(TrackRemoved(TrackOutput*)), this, SLOT(RemoveTrack(TrackOutput*))); connect(timeline_node_, SIGNAL(TimebaseChanged(const rational&)), this, SLOT(SetTimebase(const rational&))); - SetTimebase(timeline_node_->Timebase()); + SetTimebase(timeline_node_->timebase()); for (int i=0;i(i);