nodevalue: begin abstracting qvariant
This commit is contained in:
@@ -76,7 +76,7 @@ void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
|
||||
if (job.samples()->audio_params().channel_count() == 2) {
|
||||
// If the input is static, we can just do it now which will be faster
|
||||
if (IsInputStatic(kPanningInput)) {
|
||||
float pan_volume = job.GetValue(kPanningInput).data().toFloat();
|
||||
float pan_volume = job.GetValue(kPanningInput).toDouble();
|
||||
if (!qIsNull(pan_volume)) {
|
||||
if (pan_volume > 0) {
|
||||
job.samples()->transform_volume_for_channel(0, 1.0f - pan_volume);
|
||||
@@ -96,7 +96,7 @@ void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
|
||||
|
||||
void PanNode::ProcessSamples(const NodeValueRow &values, const SampleBufferPtr input, SampleBufferPtr output, int index) const
|
||||
{
|
||||
float pan_val = values[kPanningInput].data().toFloat();
|
||||
float pan_val = values[kPanningInput].toDouble();
|
||||
|
||||
for (int i=0;i<input->audio_params().channel_count();i++) {
|
||||
output->data(i)[index] = input->data(i)[index];
|
||||
|
||||
@@ -206,8 +206,8 @@ void TransitionBlock::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
push_job = QVariant::fromValue(job);
|
||||
} else if (data_type == NodeValue::kSamples) {
|
||||
// This must be an audio transition
|
||||
SampleBufferPtr from_samples = out_buffer.data().value<SampleBufferPtr>();
|
||||
SampleBufferPtr to_samples = in_buffer.data().value<SampleBufferPtr>();
|
||||
SampleBufferPtr from_samples = out_buffer.toSamples();
|
||||
SampleBufferPtr to_samples = in_buffer.toSamples();
|
||||
|
||||
if (from_samples || to_samples) {
|
||||
double time_in = globals.time().in().toDouble();
|
||||
|
||||
@@ -56,11 +56,11 @@ void OCIOBaseNode::ParentChanged(NodeGraph *graph)
|
||||
|
||||
void OCIOBaseNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
if (!value[kTextureInput].data().isNull() && processor_) {
|
||||
if (value[kTextureInput].toTexture() && processor_) {
|
||||
ColorTransformJob job;
|
||||
|
||||
job.SetColorProcessor(processor_);
|
||||
job.SetInputTexture(value[kTextureInput].data().value<TexturePtr>());
|
||||
job.SetInputTexture(value[kTextureInput].toTexture());
|
||||
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
}
|
||||
|
||||
@@ -155,11 +155,11 @@ void OCIOGradingTransformLinearNode::GenerateProcessor()
|
||||
|
||||
void OCIOGradingTransformLinearNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
if (!value[kTextureInput].data().isNull() && processor()) {
|
||||
if (value[kTextureInput].toTexture() && processor()) {
|
||||
ColorTransformJob job;
|
||||
|
||||
job.SetColorProcessor(processor());
|
||||
job.SetInputTexture(value[kTextureInput].data().value<TexturePtr>());
|
||||
job.SetInputTexture(value[kTextureInput].toTexture());
|
||||
|
||||
job.InsertValue(value);
|
||||
|
||||
@@ -172,29 +172,29 @@ void OCIOGradingTransformLinearNode::Value(const NodeValueRow &value, const Node
|
||||
// Even more oddly, the conversion from RGBM to vec3 does not appear to have a public API.
|
||||
// Therefore, this code has been duplicated from OCIO here:
|
||||
// https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/3abbe5b20521169580fcfe3692aca81859859953/src/OpenColorIO/ops/gradingprimary/GradingPrimary.cpp#L157
|
||||
QVector4D offset = value[kOffsetInput].value<QVector4D>();
|
||||
QVector4D offset = value[kOffsetInput].toVec4();
|
||||
offset[RED_CHANNEL] += offset[MASTER_CHANNEL];
|
||||
offset[GREEN_CHANNEL] += offset[MASTER_CHANNEL];
|
||||
offset[BLUE_CHANNEL] += offset[MASTER_CHANNEL];
|
||||
job.InsertValue(kOffsetInput, NodeValue(NodeValue::kVec3, QVector3D(offset[RED_CHANNEL], offset[GREEN_CHANNEL], offset[BLUE_CHANNEL])));
|
||||
|
||||
QVector4D exposure = value[kExposureInput].value<QVector4D>();
|
||||
QVector4D exposure = value[kExposureInput].toVec4();
|
||||
exposure[RED_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[RED_CHANNEL]);
|
||||
exposure[GREEN_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[GREEN_CHANNEL]);
|
||||
exposure[BLUE_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[BLUE_CHANNEL]);
|
||||
job.InsertValue(kExposureInput, NodeValue(NodeValue::kVec3, QVector3D(exposure[RED_CHANNEL], exposure[GREEN_CHANNEL], exposure[BLUE_CHANNEL])));
|
||||
|
||||
QVector4D contrast = value[kContrastInput].value<QVector4D>();
|
||||
QVector4D contrast = value[kContrastInput].toVec4();
|
||||
contrast[RED_CHANNEL] *= contrast[MASTER_CHANNEL];
|
||||
contrast[GREEN_CHANNEL] *= contrast[MASTER_CHANNEL];
|
||||
contrast[BLUE_CHANNEL] *= contrast[MASTER_CHANNEL];
|
||||
job.InsertValue(kContrastInput, NodeValue(NodeValue::kVec3, QVector3D(contrast[RED_CHANNEL], contrast[GREEN_CHANNEL], contrast[BLUE_CHANNEL])));
|
||||
|
||||
if (!value[kClampBlackEnableInput].data().toBool()) {
|
||||
if (!value[kClampBlackEnableInput].toBool()) {
|
||||
job.InsertValue(kClampBlackInput, NodeValue(NodeValue::kFloat, OCIO::GradingPrimary::NoClampBlack()));
|
||||
}
|
||||
|
||||
if (!value[kClampWhiteEnableInput].data().toBool()) {
|
||||
if (!value[kClampWhiteEnableInput].toBool()) {
|
||||
job.InsertValue(kClampWhiteInput, NodeValue(NodeValue::kFloat, OCIO::GradingPrimary::NoClampWhite()));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,16 +94,16 @@ void CornerPinDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
|
||||
job.SetVertexCoordinates(adjusted_vertices);
|
||||
|
||||
// If no texture do nothing
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
// In the special case that all sliders are in their default position just
|
||||
// push the texture.
|
||||
if (!(job.GetValue(kTopLeftInput).data().value<QVector2D>().isNull()
|
||||
&& job.GetValue(kTopRightInput).data().value<QVector2D>().isNull() &&
|
||||
job.GetValue(kBottomRightInput).data().value<QVector2D>().isNull() &&
|
||||
job.GetValue(kBottomLeftInput).data().value<QVector2D>().isNull())) {
|
||||
if (!(job.GetValue(kTopLeftInput).toVec2().isNull()
|
||||
&& job.GetValue(kTopRightInput).toVec2().isNull() &&
|
||||
job.GetValue(kBottomRightInput).toVec2().isNull() &&
|
||||
job.GetValue(kBottomLeftInput).toVec2().isNull())) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
table->Push(NodeValue::kTexture, job.GetValue(kTextureInput).data(), this);
|
||||
table->Push(job.GetValue(kTextureInput));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,25 +119,24 @@ ShaderCode CornerPinDistortNode::GetShaderCode(const ShaderRequest &request) con
|
||||
QPointF CornerPinDistortNode::ValueToPixel(int value, const NodeValueRow& row, const QVector2D &resolution) const
|
||||
{
|
||||
Q_ASSERT(value >= 0 && value <= 3);
|
||||
|
||||
QVector2D v;
|
||||
|
||||
switch (value) {
|
||||
case 0: // Top left
|
||||
return QPointF(row[kTopLeftInput].data().value<QVector2D>().x(),
|
||||
row[kTopLeftInput].data().value<QVector2D>().y());
|
||||
break;
|
||||
case 1: // Top right
|
||||
return QPointF(resolution.x() + row[kTopRightInput].data().value<QVector2D>().x(),
|
||||
row[kTopRightInput].data().value<QVector2D>().y());
|
||||
break;
|
||||
case 2: // Bottom right
|
||||
return QPointF(resolution.x() + row[kBottomRightInput].data().value<QVector2D>().x(),
|
||||
resolution.y() + row[kBottomRightInput].data().value<QVector2D>().y());
|
||||
break;
|
||||
case 3: //Bottom left
|
||||
return QPointF(row[kBottomLeftInput].data().value<QVector2D>().x(),
|
||||
row[kBottomLeftInput].data().value<QVector2D>().y() + resolution.y());
|
||||
break;
|
||||
default: // We should never get here
|
||||
return QPointF();
|
||||
case 0: // Top left
|
||||
v = row[kTopLeftInput].toVec2();
|
||||
return QPointF(v.x(), v.y());
|
||||
case 1: // Top right
|
||||
v = row[kTopRightInput].toVec2();
|
||||
return QPointF(resolution.x() + v.x(), v.y());
|
||||
case 2: // Bottom right
|
||||
v = row[kBottomRightInput].toVec2();
|
||||
return QPointF(resolution.x() + v.x(), resolution.y() + v.y());
|
||||
case 3: //Bottom left
|
||||
v = row[kBottomLeftInput].toVec2();
|
||||
return QPointF(v.x(), v.y() + resolution.y());
|
||||
default: // We should never get here
|
||||
return QPointF();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,14 +82,14 @@ void CropDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
if (!qIsNull(job.GetValue(kLeftInput).data().toDouble())
|
||||
|| !qIsNull(job.GetValue(kRightInput).data().toDouble())
|
||||
|| !qIsNull(job.GetValue(kTopInput).data().toDouble())
|
||||
|| !qIsNull(job.GetValue(kBottomInput).data().toDouble())) {
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
if (!qIsNull(job.GetValue(kLeftInput).toDouble())
|
||||
|| !qIsNull(job.GetValue(kRightInput).toDouble())
|
||||
|| !qIsNull(job.GetValue(kTopInput).toDouble())
|
||||
|| !qIsNull(job.GetValue(kBottomInput).toDouble())) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
table->Push(NodeValue::kTexture, job.GetValue(kTextureInput).data(), this);
|
||||
table->Push(job.GetValue(kTextureInput));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,10 +104,10 @@ void CropDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const NodeGl
|
||||
{
|
||||
const QVector2D &resolution = globals.resolution();
|
||||
|
||||
double left_pt = resolution.x() * row[kLeftInput].data().toDouble();
|
||||
double top_pt = resolution.y() * row[kTopInput].data().toDouble();
|
||||
double right_pt = resolution.x() * (1.0 - row[kRightInput].data().toDouble());
|
||||
double bottom_pt = resolution.y() * (1.0 - row[kBottomInput].data().toDouble());
|
||||
double left_pt = resolution.x() * row[kLeftInput].toDouble();
|
||||
double top_pt = resolution.y() * row[kTopInput].toDouble();
|
||||
double right_pt = resolution.x() * (1.0 - row[kRightInput].toDouble());
|
||||
double bottom_pt = resolution.y() * (1.0 - row[kBottomInput].toDouble());
|
||||
double center_x_pt = mid(left_pt, right_pt);
|
||||
double center_y_pt = mid(top_pt, bottom_pt);
|
||||
|
||||
|
||||
@@ -82,9 +82,9 @@ void FlipDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
job.InsertValue(value);
|
||||
|
||||
// If there's no texture, no need to run an operation
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
// Only run shader if at least one of flip or flop are selected
|
||||
if (job.GetValue(kHorizontalInput).data().toBool() || job.GetValue(kVerticalInput).data().toBool()) {
|
||||
if (job.GetValue(kHorizontalInput).toBool() || job.GetValue(kVerticalInput).toBool()) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
// If we're not flipping or flopping just push the texture
|
||||
|
||||
@@ -47,7 +47,7 @@ void MaskDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
{
|
||||
GenerateJob job = GetGenerateJob(value);
|
||||
|
||||
if (!value[kBaseInput].data().isNull()) {
|
||||
if (value[kBaseInput].toTexture()) {
|
||||
// Push as merge node
|
||||
ShaderJob merge;
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ void TransformDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
|
||||
bool pushed_job = false;
|
||||
|
||||
// If we have a texture, generate a matrix and make it happen
|
||||
if (TexturePtr texture = texture_meta.data().value<TexturePtr>()) {
|
||||
if (TexturePtr texture = texture_meta.toTexture()) {
|
||||
// Adjust our matrix by the resolutions involved
|
||||
QMatrix4x4 real_matrix = GenerateAutoScaledMatrix(generated_matrix, value, globals, texture->params());
|
||||
|
||||
@@ -101,7 +101,7 @@ void TransformDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
|
||||
ShaderJob job;
|
||||
job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture), this));
|
||||
job.InsertValue(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, real_matrix, this));
|
||||
job.SetInterpolation(QStringLiteral("ove_maintex"), static_cast<Texture::Interpolation>(value[kInterpolationInput].data().toInt()));
|
||||
job.SetInterpolation(QStringLiteral("ove_maintex"), static_cast<Texture::Interpolation>(value[kInterpolationInput].toInt()));
|
||||
|
||||
// FIXME: This should be optimized, we can use matrix math to determine if this operation will
|
||||
// end up with gaps in the screen that will require an alpha channel.
|
||||
@@ -140,7 +140,7 @@ void TransformDistortNode::Hash(QCryptographicHash &hash, const NodeGlobals &glo
|
||||
traverser.SetCacheVideoParams(video_params);
|
||||
|
||||
NodeValueRow db = traverser.GenerateRow(this, globals.time());
|
||||
TexturePtr tex = db[kTextureInput].data().value<TexturePtr>();
|
||||
TexturePtr tex = db[kTextureInput].toTexture();
|
||||
if (tex) {
|
||||
VideoParams tex_params = tex->params();
|
||||
QMatrix4x4 matrix = GenerateMatrix(db, true, false, false, false);
|
||||
@@ -167,13 +167,13 @@ void TransformDistortNode::GizmoDragStart(const NodeValueRow &row, double x, dou
|
||||
} else if (IsAScaleGizmo(gizmo)) {
|
||||
|
||||
// Dragging scale handle
|
||||
TexturePtr tex = row[kTextureInput].data().value<TexturePtr>();
|
||||
TexturePtr tex = row[kTextureInput].toTexture();
|
||||
if (!tex) {
|
||||
return;
|
||||
}
|
||||
|
||||
gizmo_scale_uniform_ = row[kUniformScaleInput].data().toBool();
|
||||
gizmo_anchor_pt_ = (row[kAnchorInput].data().value<QVector2D>() + gizmo->GetGlobals().resolution()/2).toPointF();
|
||||
gizmo_scale_uniform_ = row[kUniformScaleInput].toBool();
|
||||
gizmo_anchor_pt_ = (row[kAnchorInput].toVec2() + gizmo->GetGlobals().resolution()/2).toPointF();
|
||||
|
||||
if (gizmo == point_gizmo_[kGizmoScaleTopLeft] || gizmo == point_gizmo_[kGizmoScaleTopRight]
|
||||
|| gizmo == point_gizmo_[kGizmoScaleBottomLeft] || gizmo == point_gizmo_[kGizmoScaleBottomRight]) {
|
||||
@@ -187,7 +187,7 @@ void TransformDistortNode::GizmoDragStart(const NodeValueRow &row, double x, dou
|
||||
// Store texture size
|
||||
VideoParams texture_params = tex->params();
|
||||
QVector2D texture_sz(texture_params.square_pixel_width(), texture_params.height());
|
||||
gizmo_scale_anchor_ = row[kAnchorInput].data().value<QVector2D>() + texture_sz/2;
|
||||
gizmo_scale_anchor_ = row[kAnchorInput].toVec2() + texture_sz/2;
|
||||
|
||||
if (gizmo == point_gizmo_[kGizmoScaleTopRight]
|
||||
|| gizmo == point_gizmo_[kGizmoScaleBottomRight]
|
||||
@@ -208,7 +208,7 @@ void TransformDistortNode::GizmoDragStart(const NodeValueRow &row, double x, dou
|
||||
|
||||
} else if (gizmo == rotation_gizmo_) {
|
||||
|
||||
gizmo_anchor_pt_ = (row[kAnchorInput].data().value<QVector2D>() + gizmo->GetGlobals().resolution()/2).toPointF();
|
||||
gizmo_anchor_pt_ = (row[kAnchorInput].toVec2() + gizmo->GetGlobals().resolution()/2).toPointF();
|
||||
gizmo_start_angle_ = qAtan2(y - gizmo_anchor_pt_.y(), x - gizmo_anchor_pt_.x());
|
||||
gizmo_last_angle_ = gizmo_start_angle_;
|
||||
gizmo_last_alt_angle_ = qAtan2(x - gizmo_anchor_pt_.x(), y - gizmo_anchor_pt_.y());
|
||||
@@ -368,7 +368,7 @@ QMatrix4x4 TransformDistortNode::AdjustMatrixByResolutions(const QMatrix4x4 &mat
|
||||
|
||||
void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals)
|
||||
{
|
||||
TexturePtr tex = row[kTextureInput].data().value<TexturePtr>();
|
||||
TexturePtr tex = row[kTextureInput].toTexture();
|
||||
if (!tex) {
|
||||
return;
|
||||
}
|
||||
@@ -384,7 +384,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N
|
||||
QVector2D tex_offset = tex_params.offset();
|
||||
|
||||
// Retrieve autoscale value
|
||||
AutoScaleType autoscale = static_cast<AutoScaleType>(row[kAutoscaleInput].data().toInt());
|
||||
AutoScaleType autoscale = static_cast<AutoScaleType>(row[kAutoscaleInput].toInt());
|
||||
|
||||
// Fold values into a matrix for the rectangle
|
||||
QMatrix4x4 rectangle_matrix;
|
||||
@@ -441,7 +441,7 @@ QMatrix4x4 TransformDistortNode::GenerateAutoScaledMatrix(const QMatrix4x4& gene
|
||||
{
|
||||
const QVector2D &sequence_res = globals.resolution();
|
||||
QVector2D texture_res(texture_params.square_pixel_width(), texture_params.height());
|
||||
AutoScaleType autoscale = static_cast<AutoScaleType>(value[kAutoscaleInput].data().toInt());
|
||||
AutoScaleType autoscale = static_cast<AutoScaleType>(value[kAutoscaleInput].toInt());
|
||||
|
||||
return AdjustMatrixByResolutions(generated_matrix,
|
||||
sequence_res,
|
||||
|
||||
@@ -50,8 +50,8 @@ void OpacityEffect::Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
job.InsertValue(value);
|
||||
|
||||
// If there's no texture, no need to run an operation
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
if (!qFuzzyCompare(job.GetValue(kValueInput).data().toDouble(), 1.0)) {
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
if (!qFuzzyCompare(job.GetValue(kValueInput).toDouble(), 1.0)) {
|
||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
|
||||
@@ -124,22 +124,22 @@ void BlurFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globals
|
||||
job.InsertValue(value);
|
||||
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
|
||||
Method method = static_cast<Method>(job.GetValue(kMethodInput).data().toInt());
|
||||
Method method = static_cast<Method>(job.GetValue(kMethodInput).toInt());
|
||||
|
||||
// If there's no texture, no need to run an operation
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
|
||||
bool can_push_job = true;
|
||||
|
||||
// Check if radius is > 0
|
||||
if (job.GetValue(kRadiusInput).data().toDouble() > 0.0) {
|
||||
if (job.GetValue(kRadiusInput).toDouble() > 0.0) {
|
||||
// Method-specific considerations
|
||||
switch (method) {
|
||||
case kBox:
|
||||
case kGaussian:
|
||||
{
|
||||
bool horiz = job.GetValue(kHorizInput).data().toBool();
|
||||
bool vert = job.GetValue(kVertInput).data().toBool();
|
||||
bool horiz = job.GetValue(kHorizInput).toBool();
|
||||
bool vert = job.GetValue(kVertInput).toBool();
|
||||
|
||||
if (!horiz && !vert) {
|
||||
// Disable job if horiz and vert are unchecked
|
||||
@@ -160,7 +160,7 @@ void BlurFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globals
|
||||
|
||||
if (can_push_job) {
|
||||
// If we're not repeating pixels, expect an alpha channel to appear
|
||||
if (!job.GetValue(kRepeatEdgePixelsInput).data().toBool()) {
|
||||
if (!job.GetValue(kRepeatEdgePixelsInput).toBool()) {
|
||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||
}
|
||||
|
||||
@@ -175,12 +175,12 @@ void BlurFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globals
|
||||
|
||||
void BlurFilterNode::UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals)
|
||||
{
|
||||
if (row[kMethodInput].data().toInt() == kRadial) {
|
||||
if (row[kMethodInput].toInt() == kRadial) {
|
||||
const QVector2D &sequence_res = globals.resolution();
|
||||
QVector2D sequence_half_res = sequence_res * 0.5;
|
||||
|
||||
radial_center_gizmo_->SetVisible(true);
|
||||
radial_center_gizmo_->SetPoint(sequence_half_res.toPointF() + row[kRadialCenterInput].value<QVector2D>().toPointF());
|
||||
radial_center_gizmo_->SetPoint(sequence_half_res.toPointF() + row[kRadialCenterInput].toVec2().toPointF());
|
||||
|
||||
SetInputProperty(kRadialCenterInput, QStringLiteral("offset"), sequence_half_res);
|
||||
} else{
|
||||
|
||||
@@ -60,12 +60,12 @@ void MosaicFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globa
|
||||
// Mipmapping makes this look weird, so we just use bilinear for finding the color of each block
|
||||
job.SetInterpolation(kTextureInput, Texture::kLinear);
|
||||
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
TexturePtr texture = job.GetValue(kTextureInput).data().value<TexturePtr>();
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
TexturePtr texture = job.GetValue(kTextureInput).toTexture();
|
||||
|
||||
if (texture
|
||||
&& job.GetValue(kHorizInput).data().toInt() != texture->width()
|
||||
&& job.GetValue(kVertInput).data().toInt() != texture->height()) {
|
||||
&& job.GetValue(kHorizInput).toInt() != texture->width()
|
||||
&& job.GetValue(kVertInput).toInt() != texture->height()) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
table->Push(job.GetValue(kTextureInput));
|
||||
|
||||
@@ -91,9 +91,9 @@ void StrokeFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globa
|
||||
job.InsertValue(value);
|
||||
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
if (job.GetValue(kRadiusInput).data().toDouble() > 0.0
|
||||
&& job.GetValue(kOpacityInput).data().toDouble() > 0.0) {
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
if (job.GetValue(kRadiusInput).toDouble() > 0.0
|
||||
&& job.GetValue(kOpacityInput).toDouble() > 0.0) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
} else {
|
||||
table->Push(job.GetValue(kTextureInput));
|
||||
|
||||
@@ -103,47 +103,47 @@ QMatrix4x4 MatrixGenerator::GenerateMatrix(const NodeValueRow &value, bool take,
|
||||
if (!ignore_anchor) {
|
||||
if (take) {
|
||||
// Take and store
|
||||
anchor = value[kAnchorInput].data().value<QVector2D>();
|
||||
anchor = value[kAnchorInput].toVec2();
|
||||
} else {
|
||||
// Get and store
|
||||
anchor = value[kAnchorInput].data().value<QVector2D>();
|
||||
anchor = value[kAnchorInput].toVec2();
|
||||
}
|
||||
} else if (take) {
|
||||
// Just take
|
||||
value[kAnchorInput].data().value<QVector2D>();
|
||||
value[kAnchorInput].toVec2();
|
||||
}
|
||||
|
||||
if (!ignore_scale) {
|
||||
if (take) {
|
||||
scale = value[kScaleInput].data().value<QVector2D>();
|
||||
scale = value[kScaleInput].toVec2();
|
||||
} else {
|
||||
scale = value[kScaleInput].data().value<QVector2D>();
|
||||
scale = value[kScaleInput].toVec2();
|
||||
}
|
||||
} else if (take) {
|
||||
value[kScaleInput].data().value<QVector2D>();
|
||||
value[kScaleInput].toVec2();
|
||||
}
|
||||
|
||||
if (!ignore_position) {
|
||||
if (take) {
|
||||
position = value[kPositionInput].data().value<QVector2D>();
|
||||
position = value[kPositionInput].toVec2();
|
||||
} else {
|
||||
position = value[kPositionInput].data().value<QVector2D>();
|
||||
position = value[kPositionInput].toVec2();
|
||||
}
|
||||
} else if (take) {
|
||||
value[kPositionInput].data().value<QVector2D>();
|
||||
value[kPositionInput].toVec2();
|
||||
}
|
||||
|
||||
if (take) {
|
||||
return GenerateMatrix(position,
|
||||
value[kRotationInput].data().toFloat(),
|
||||
value[kRotationInput].toDouble(),
|
||||
scale,
|
||||
value[kUniformScaleInput].data().toBool(),
|
||||
value[kUniformScaleInput].toBool(),
|
||||
anchor);
|
||||
} else {
|
||||
return GenerateMatrix(position,
|
||||
value[kRotationInput].data().toFloat(),
|
||||
value[kRotationInput].toDouble(),
|
||||
scale,
|
||||
value[kUniformScaleInput].data().toBool(),
|
||||
value[kUniformScaleInput].toBool(),
|
||||
anchor);
|
||||
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void PolygonGenerator::GenerateFrame(FramePtr frame, const GenerateJob &job) con
|
||||
QImage img(frame->width(), frame->height(), QImage::Format_Grayscale8);
|
||||
img.fill(Qt::transparent);
|
||||
|
||||
QVector<NodeValue> points = job.GetValue(kPointsInput).data().value< QVector<NodeValue> >();
|
||||
QVector<NodeValue> points = job.GetValue(kPointsInput).value< QVector<NodeValue> >();
|
||||
|
||||
QPainterPath path = GeneratePath(points);
|
||||
|
||||
@@ -130,7 +130,7 @@ void PolygonGenerator::GenerateFrame(FramePtr frame, const GenerateJob &job) con
|
||||
p.drawPath(path);
|
||||
|
||||
// Transplant alpha channel to frame
|
||||
Color rgba = job.GetValue(kColorInput).data().value<Color>();
|
||||
Color rgba = job.GetValue(kColorInput).toColor();
|
||||
#if defined(Q_PROCESSOR_X86) || defined(Q_PROCESSOR_ARM)
|
||||
__m128 sse_color = _mm_loadu_ps(rgba.data());
|
||||
#endif
|
||||
@@ -196,7 +196,7 @@ void PolygonGenerator::UpdateGizmoPositions(const NodeValueRow &row, const NodeG
|
||||
{
|
||||
QPointF half_res(globals.resolution_by_par().x()/2, globals.resolution_by_par().y()/2);
|
||||
|
||||
QVector<NodeValue> points = row[kPointsInput].data().value< QVector<NodeValue> >();
|
||||
QVector<NodeValue> points = row[kPointsInput].value< QVector<NodeValue> >();
|
||||
|
||||
int current_pos_sz = gizmo_position_handles_.size();
|
||||
|
||||
@@ -223,7 +223,7 @@ void PolygonGenerator::UpdateGizmoPositions(const NodeValueRow &row, const NodeG
|
||||
|
||||
if (!points.isEmpty()) {
|
||||
for (int i=0; i<points.size(); i++) {
|
||||
const Bezier &pt = points.at(i).data().value<Bezier>();
|
||||
const Bezier &pt = points.at(i).toBezier();
|
||||
|
||||
QPointF main = pt.ToPointF() + half_res;
|
||||
QPointF cp1 = main + pt.ControlPoint1ToPointF();
|
||||
@@ -267,14 +267,14 @@ QPainterPath PolygonGenerator::GeneratePath(const QVector<NodeValue> &points)
|
||||
QPainterPath path;
|
||||
|
||||
if (!points.isEmpty()) {
|
||||
const Bezier &first_pt = points.first().data().value<Bezier>();
|
||||
const Bezier &first_pt = points.first().toBezier();
|
||||
path.moveTo(first_pt.ToPointF());
|
||||
|
||||
for (int i=1; i<points.size(); i++) {
|
||||
AddPointToPath(&path, points.at(i-1).data().value<Bezier>(), points.at(i).data().value<Bezier>());
|
||||
AddPointToPath(&path, points.at(i-1).toBezier(), points.at(i).toBezier());
|
||||
}
|
||||
|
||||
AddPointToPath(&path, points.last().data().value<Bezier>(), first_pt);
|
||||
AddPointToPath(&path, points.last().toBezier(), first_pt);
|
||||
}
|
||||
|
||||
return path;
|
||||
|
||||
@@ -53,7 +53,7 @@ ShaderCode GeneratorWithMerge::GetShaderCode(const ShaderRequest &request) const
|
||||
|
||||
void GeneratorWithMerge::PushMergableJob(const NodeValueRow &value, const QVariant &job, NodeValueTable *table) const
|
||||
{
|
||||
if (!value[kBaseInput].data().isNull()) {
|
||||
if (value[kBaseInput].toTexture()) {
|
||||
// Push as merge node
|
||||
ShaderJob merge;
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ void ShapeNodeBase::UpdateGizmoPositions(const NodeValueRow &row, const NodeGlob
|
||||
QVector2D center_pt = globals.resolution() * 0.5;
|
||||
SetInputProperty(kPositionInput, QStringLiteral("offset"), center_pt);
|
||||
|
||||
QVector2D pos = row[kPositionInput].data().value<QVector2D>();
|
||||
QVector2D sz = row[kSizeInput].data().value<QVector2D>();
|
||||
QVector2D pos = row[kPositionInput].toVec2();
|
||||
QVector2D sz = row[kSizeInput].toVec2();
|
||||
QVector2D half_sz = sz * 0.5;
|
||||
|
||||
double left_pt = pos.x() + center_pt.x() - half_sz.x();
|
||||
|
||||
@@ -96,7 +96,7 @@ void TextGeneratorV1::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
job.InsertValue(value);
|
||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||
|
||||
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
|
||||
if (!job.GetValue(kTextInput).toString().isEmpty()) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
}
|
||||
}
|
||||
@@ -114,15 +114,15 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
|
||||
|
||||
// Set default font
|
||||
QFont default_font;
|
||||
default_font.setFamily(job.GetValue(kFontInput).data().toString());
|
||||
default_font.setPointSizeF(job.GetValue(kFontSizeInput).data().toFloat());
|
||||
default_font.setFamily(job.GetValue(kFontInput).toString());
|
||||
default_font.setPointSizeF(job.GetValue(kFontSizeInput).toDouble());
|
||||
text_doc.setDefaultFont(default_font);
|
||||
|
||||
// Center by default
|
||||
text_doc.setDefaultTextOption(QTextOption(Qt::AlignCenter));
|
||||
|
||||
QString html = job.GetValue(kTextInput).data().toString();
|
||||
if (job.GetValue(kHtmlInput).data().toBool()) {
|
||||
QString html = job.GetValue(kTextInput).toString();
|
||||
if (job.GetValue(kHtmlInput).toBool()) {
|
||||
html.replace('\n', QStringLiteral("<br>"));
|
||||
text_doc.setHtml(html);
|
||||
} else {
|
||||
@@ -140,7 +140,7 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
|
||||
// Push 10% inwards to compensate for title safe area
|
||||
p.translate(tenth_of_width, 0);
|
||||
|
||||
TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.GetValue(kVAlignInput).data().toInt());
|
||||
TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.GetValue(kVAlignInput).toInt());
|
||||
int doc_height = text_doc.size().height();
|
||||
|
||||
switch (valign) {
|
||||
@@ -163,7 +163,7 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
|
||||
text_doc.documentLayout()->draw(&p, ctx);
|
||||
|
||||
// Transplant alpha channel to frame
|
||||
Color rgb = job.GetValue(kColorInput).data().value<Color>();
|
||||
Color rgb = job.GetValue(kColorInput).toColor();
|
||||
for (int x=0; x<frame->width(); x++) {
|
||||
for (int y=0; y<frame->height(); y++) {
|
||||
uchar src_alpha = img.bits()[img.bytesPerLine() * y + x];
|
||||
|
||||
@@ -100,7 +100,7 @@ void TextGeneratorV2::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||
job.SetRequestedFormat(VideoParams::kFormatFloat32);
|
||||
|
||||
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
|
||||
if (!job.GetValue(kTextInput).toString().isEmpty()) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
}
|
||||
}
|
||||
@@ -124,19 +124,19 @@ void TextGeneratorV2::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
|
||||
|
||||
// Set default font
|
||||
QFont default_font;
|
||||
default_font.setFamily(job.GetValue(kFontInput).data().toString());
|
||||
default_font.setPointSizeF(job.GetValue(kFontSizeInput).data().toFloat());
|
||||
default_font.setFamily(job.GetValue(kFontInput).toString());
|
||||
default_font.setPointSizeF(job.GetValue(kFontSizeInput).toDouble());
|
||||
text_doc.setDefaultFont(default_font);
|
||||
|
||||
QString html = job.GetValue(kTextInput).data().toString();
|
||||
if (job.GetValue(kHtmlInput).data().toBool()) {
|
||||
QString html = job.GetValue(kTextInput).toString();
|
||||
if (job.GetValue(kHtmlInput).toBool()) {
|
||||
html.replace('\n', QStringLiteral("<br>"));
|
||||
text_doc.setHtml(html);
|
||||
} else {
|
||||
text_doc.setPlainText(html);
|
||||
}
|
||||
|
||||
QVector2D size = job.GetValue(kSizeInput).data().value<QVector2D>();
|
||||
QVector2D size = job.GetValue(kSizeInput).toVec2();
|
||||
text_doc.setTextWidth(size.x());
|
||||
|
||||
// Draw rich text onto image
|
||||
@@ -144,12 +144,12 @@ void TextGeneratorV2::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
|
||||
p.scale(1.0 / frame->video_params().divider(), 1.0 / frame->video_params().divider());
|
||||
|
||||
|
||||
QVector2D pos = job.GetValue(kPositionInput).data().value<QVector2D>();
|
||||
QVector2D pos = job.GetValue(kPositionInput).toVec2();
|
||||
p.translate(pos.x() - size.x()/2, pos.y() - size.y()/2);
|
||||
p.translate(frame->video_params().width()/2, frame->video_params().height()/2);
|
||||
p.setClipRect(0, 0, size.x(), size.y());
|
||||
|
||||
TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.GetValue(kVAlignInput).data().toInt());
|
||||
TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.GetValue(kVAlignInput).toInt());
|
||||
int doc_height = text_doc.size().height();
|
||||
|
||||
switch (valign) {
|
||||
@@ -171,7 +171,7 @@ void TextGeneratorV2::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
|
||||
text_doc.documentLayout()->draw(&p, ctx);
|
||||
|
||||
// Transplant alpha channel to frame
|
||||
Color rgba = job.GetValue(kColorInput).data().value<Color>();
|
||||
Color rgba = job.GetValue(kColorInput).toColor();
|
||||
#if defined(Q_PROCESSOR_X86) || defined(Q_PROCESSOR_ARM)
|
||||
__m128 sse_color = _mm_loadu_ps(rgba.data());
|
||||
#endif
|
||||
|
||||
@@ -88,9 +88,9 @@ void TextGeneratorV3::Value(const NodeValueRow &value, const NodeGlobals &global
|
||||
// FIXME: Provide user override for this
|
||||
job.SetColorspace(project()->color_manager()->GetDefaultInputColorSpace());
|
||||
|
||||
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
|
||||
if (!job.GetValue(kTextInput).toString().isEmpty()) {
|
||||
PushMergableJob(value, QVariant::fromValue(job), table);
|
||||
} else if (!value[kBaseInput].data().isNull()) {
|
||||
} else if (value[kBaseInput].toTexture()) {
|
||||
table->Push(value[kBaseInput]);
|
||||
}
|
||||
}
|
||||
@@ -108,17 +108,17 @@ void TextGeneratorV3::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
|
||||
QTextDocument text_doc;
|
||||
text_doc.documentLayout()->setPaintDevice(&img);
|
||||
|
||||
QString html = job.GetValue(kTextInput).data().toString();
|
||||
QString html = job.GetValue(kTextInput).toString();
|
||||
Html::HtmlToDoc(&text_doc, html);
|
||||
|
||||
QVector2D size = job.GetValue(kSizeInput).data().value<QVector2D>();
|
||||
QVector2D size = job.GetValue(kSizeInput).toVec2();
|
||||
text_doc.setTextWidth(size.x());
|
||||
|
||||
// Draw rich text onto image
|
||||
QPainter p(&img);
|
||||
p.scale(1.0 / frame->video_params().divider(), 1.0 / frame->video_params().divider());
|
||||
|
||||
QVector2D pos = job.GetValue(kPositionInput).data().value<QVector2D>();
|
||||
QVector2D pos = job.GetValue(kPositionInput).toVec2();
|
||||
p.translate(pos.x() - size.x()/2, pos.y() - size.y()/2);
|
||||
p.translate(frame->video_params().width()/2, frame->video_params().height()/2);
|
||||
p.setClipRect(0, 0, size.x(), size.y());
|
||||
@@ -136,7 +136,7 @@ void TextGeneratorV3::UpdateGizmoPositions(const NodeValueRow &row, const NodeGl
|
||||
|
||||
QRectF rect = poly_gizmo()->GetPolygon().boundingRect();
|
||||
text_gizmo_->SetRect(rect);
|
||||
text_gizmo_->SetHtml(row[kTextInput].data().toString());
|
||||
text_gizmo_->SetHtml(row[kTextInput].toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -144,10 +144,10 @@ void HashTraverser::HashNodeValue(const NodeValue &value)
|
||||
if (value_type == NodeValue::kSamples || value_type == NodeValue::kTexture) {
|
||||
QByteArray id_for_buffer;
|
||||
if (value_type == NodeValue::kTexture) {
|
||||
TexturePtr texture = value.data().value<TexturePtr>();
|
||||
TexturePtr texture = value.toTexture();
|
||||
id_for_buffer = texture_ids_.value(texture.get());
|
||||
} else {
|
||||
SampleBufferPtr samples = value.data().value<SampleBufferPtr>();
|
||||
SampleBufferPtr samples = value.toSamples();
|
||||
id_for_buffer = texture_ids_.value(samples.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -128,13 +128,13 @@ void ChromaKeyNode::GenerateProcessor()
|
||||
|
||||
void ChromaKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
if (!value[kTextureInput].data().isNull() && processor()) {
|
||||
if (value[kTextureInput].toTexture() && processor()) {
|
||||
ColorTransformJob job;
|
||||
|
||||
job.InsertValue(value);
|
||||
job.SetAlphaChannelRequired(ColorTransformJob::kAlphaForceOn);
|
||||
job.SetColorProcessor(processor());
|
||||
job.SetInputTexture(value[kTextureInput].data().value<TexturePtr>());
|
||||
job.SetInputTexture(value[kTextureInput].toTexture());
|
||||
job.SetNeedsCustomShader(this);
|
||||
job.SetFunctionName(QStringLiteral("SceneLinearToCIEXYZ_d65"));
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void ColorDifferenceKeyNode::Value(const NodeValueRow &value, const NodeGlobals
|
||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||
|
||||
// If there's no texture, no need to run an operation
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void DespillNode::Value(const NodeValueRow &value, const NodeGlobals &globals, N
|
||||
NodeValue(NodeValue::kVec3, QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2])));
|
||||
|
||||
// If there's no texture, no need to run an operation
|
||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||
if (job.GetValue(kTextureInput).toTexture()) {
|
||||
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,12 +141,12 @@ QVector4D MathNodeBase::RetrieveVector(const NodeValue &val)
|
||||
// QVariant doesn't know that QVector*D can convert themselves so we do it here
|
||||
switch (val.type()) {
|
||||
case NodeValue::kVec2:
|
||||
return val.data().value<QVector2D>();
|
||||
return val.toVec2();
|
||||
case NodeValue::kVec3:
|
||||
return val.data().value<QVector3D>();
|
||||
return val.toVec3();
|
||||
case NodeValue::kVec4:
|
||||
default:
|
||||
return val.data().value<QVector4D>();
|
||||
return val.toVec4();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
||||
if (val_a.type() == NodeValue::kRational && val_b.type() == NodeValue::kRational && operation != kOpPower) {
|
||||
// Preserve rationals
|
||||
output->Push(NodeValue::kRational,
|
||||
QVariant::fromValue(PerformAddSubMultDiv<rational, rational>(operation, val_a.data().value<rational>(), val_b.data().value<rational>())),
|
||||
QVariant::fromValue(PerformAddSubMultDiv<rational, rational>(operation, val_a.toRational(), val_b.toRational())),
|
||||
this);
|
||||
} else {
|
||||
output->Push(NodeValue::kFloat,
|
||||
@@ -247,7 +247,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
||||
|
||||
case kPairMatrixVec:
|
||||
{
|
||||
QMatrix4x4 matrix = (val_a.type() == NodeValue::kMatrix) ? val_a.data().value<QMatrix4x4>() : val_b.data().value<QMatrix4x4>();
|
||||
QMatrix4x4 matrix = (val_a.type() == NodeValue::kMatrix) ? val_a.toMatrix() : val_b.toMatrix();
|
||||
QVector4D vec = (val_a.type() == NodeValue::kMatrix) ? RetrieveVector(val_b) : RetrieveVector(val_a);
|
||||
|
||||
// Only valid operation is multiply
|
||||
@@ -269,16 +269,16 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
||||
|
||||
case kPairMatrixMatrix:
|
||||
{
|
||||
QMatrix4x4 mat_a = val_a.data().value<QMatrix4x4>();
|
||||
QMatrix4x4 mat_b = val_b.data().value<QMatrix4x4>();
|
||||
QMatrix4x4 mat_a = val_a.toMatrix();
|
||||
QMatrix4x4 mat_b = val_b.toMatrix();
|
||||
output->Push(NodeValue::kMatrix, PerformAddSubMult<QMatrix4x4, QMatrix4x4>(operation, mat_a, mat_b), this);
|
||||
break;
|
||||
}
|
||||
|
||||
case kPairColorColor:
|
||||
{
|
||||
Color col_a = val_a.data().value<Color>();
|
||||
Color col_b = val_b.data().value<Color>();
|
||||
Color col_a = val_a.toColor();
|
||||
Color col_b = val_b.toColor();
|
||||
|
||||
// Only add and subtract are valid operations
|
||||
output->Push(NodeValue::kColor, QVariant::fromValue(PerformAddSub<Color, Color>(operation, col_a, col_b)), this);
|
||||
@@ -288,8 +288,8 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
||||
|
||||
case kPairNumberColor:
|
||||
{
|
||||
Color col = (val_a.type() == NodeValue::kColor) ? val_a.data().value<Color>() : val_b.data().value<Color>();
|
||||
float num = (val_a.type() == NodeValue::kColor) ? val_b.data().toFloat() : val_a.data().toFloat();
|
||||
Color col = (val_a.type() == NodeValue::kColor) ? val_a.toColor() : val_b.toColor();
|
||||
float num = (val_a.type() == NodeValue::kColor) ? val_b.toDouble() : val_a.toDouble();
|
||||
|
||||
// Only multiply and divide are valid operations
|
||||
output->Push(NodeValue::kColor, QVariant::fromValue(PerformMult<Color, float>(operation, col, num)), this);
|
||||
@@ -298,8 +298,8 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
||||
|
||||
case kPairSampleSample:
|
||||
{
|
||||
SampleBufferPtr samples_a = val_a.data().value<SampleBufferPtr>();
|
||||
SampleBufferPtr samples_b = val_b.data().value<SampleBufferPtr>();
|
||||
SampleBufferPtr samples_a = val_a.toSamples();
|
||||
SampleBufferPtr samples_b = val_b.toSamples();
|
||||
|
||||
int max_samples = qMax(samples_a->sample_count(), samples_b->sample_count());
|
||||
int min_samples = qMin(samples_a->sample_count(), samples_b->sample_count());
|
||||
@@ -348,7 +348,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
||||
|
||||
const NodeValue& number_val = val_a.type() == NodeValue::kTexture ? val_b : val_a;
|
||||
const NodeValue& texture_val = val_a.type() == NodeValue::kTexture ? val_a : val_b;
|
||||
TexturePtr texture = texture_val.data().value<TexturePtr>();
|
||||
TexturePtr texture = texture_val.toTexture();
|
||||
|
||||
if (!texture) {
|
||||
operation_is_noop = true;
|
||||
@@ -361,7 +361,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
||||
const QVector2D &sequence_res = globals.resolution();
|
||||
QVector2D texture_res(texture->params().width() * texture->pixel_aspect_ratio().toDouble(), texture->params().height());
|
||||
|
||||
QMatrix4x4 adjusted_matrix = TransformDistortNode::AdjustMatrixByResolutions(number_val.data().value<QMatrix4x4>(),
|
||||
QMatrix4x4 adjusted_matrix = TransformDistortNode::AdjustMatrixByResolutions(number_val.toMatrix(),
|
||||
sequence_res,
|
||||
texture->params().offset(),
|
||||
texture_res);
|
||||
@@ -449,9 +449,9 @@ void MathNodeBase::ProcessSamplesInternal(const NodeValueRow &values, MathNodeBa
|
||||
float MathNodeBase::RetrieveNumber(const NodeValue &val)
|
||||
{
|
||||
if (val.type() == NodeValue::kRational) {
|
||||
return val.data().value<rational>().toDouble();
|
||||
return val.toRational().toDouble();
|
||||
} else {
|
||||
return val.data().toFloat();
|
||||
return val.toDouble();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ void MergeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, Nod
|
||||
ShaderJob job;
|
||||
job.InsertValue(value);
|
||||
|
||||
TexturePtr base_tex = job.GetValue(kBaseIn).data().value<TexturePtr>();
|
||||
TexturePtr blend_tex = job.GetValue(kBlendIn).data().value<TexturePtr>();
|
||||
TexturePtr base_tex = job.GetValue(kBaseIn).toTexture();
|
||||
TexturePtr blend_tex = job.GetValue(kBlendIn).toTexture();
|
||||
|
||||
if (base_tex || blend_tex) {
|
||||
if (!base_tex || (blend_tex && blend_tex->channel_count() < VideoParams::kRGBAChannelCount)) {
|
||||
@@ -108,8 +108,8 @@ void MergeNode::Hash(QCryptographicHash &hash, const NodeGlobals &globals, const
|
||||
|
||||
NodeValueDatabase db = traverser.GenerateDatabase(this, globals.time());
|
||||
|
||||
TexturePtr base_tex = db[kBaseIn].Get(NodeValue::kTexture).value<TexturePtr>();
|
||||
TexturePtr blend_tex = db[kBlendIn].Get(NodeValue::kTexture).value<TexturePtr>();
|
||||
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;
|
||||
|
||||
@@ -79,7 +79,7 @@ void TrigonometryNode::Retranslate()
|
||||
|
||||
void TrigonometryNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
{
|
||||
double x = value[kXIn].data().toFloat();
|
||||
double x = value[kXIn].toDouble();
|
||||
|
||||
switch (static_cast<Operation>(GetStandardValue(kMethodIn).toInt())) {
|
||||
case kOpSine:
|
||||
|
||||
@@ -322,9 +322,9 @@ void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
|
||||
Q_UNUSED(globals)
|
||||
|
||||
// Pop filename from table
|
||||
QString file = value[kFilenameInput].data().toString();
|
||||
QString file = value[kFilenameInput].toString();
|
||||
|
||||
LoopMode loop_mode = static_cast<LoopMode>(value[kLoopModeInput].data().toInt());
|
||||
LoopMode loop_mode = static_cast<LoopMode>(value[kLoopModeInput].toInt());
|
||||
|
||||
// If the file exists and the reference is valid, push a footage job to the renderer
|
||||
if (QFileInfo(file).exists()) {
|
||||
|
||||
+18
-21
@@ -71,7 +71,7 @@ NodeValue NodeTraverser::GenerateRowValue(const Node *node, const QString &input
|
||||
|
||||
if (value.array()) {
|
||||
// Resolve each element of array
|
||||
QVector<NodeValueTable> tables = value.data().value<QVector<NodeValueTable> >();
|
||||
QVector<NodeValueTable> tables = value.value<QVector<NodeValueTable> >();
|
||||
QVector<NodeValue> output(tables.size());
|
||||
|
||||
for (int i=0; i<tables.size(); i++) {
|
||||
@@ -153,8 +153,7 @@ int NodeTraverser::GetChannelCountFromJob(const GenerateJob &job)
|
||||
// Find maximum channel count
|
||||
for (auto it=job.GetValues().cbegin(); it!=job.GetValues().cend(); it++) {
|
||||
if (it.value().type() == NodeValue::kTexture) {
|
||||
TexturePtr tex = it.value().data().value<TexturePtr>();
|
||||
if (tex) {
|
||||
if (TexturePtr tex = it.value().toTexture()) {
|
||||
max_channel_count = qMax(max_channel_count, tex->channel_count());
|
||||
}
|
||||
}
|
||||
@@ -304,11 +303,9 @@ QVector2D NodeTraverser::GenerateResolution() const
|
||||
void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
|
||||
{
|
||||
if (val.type() == NodeValue::kTexture || val.type() == NodeValue::kSamples) {
|
||||
const QVariant &v = val.data();
|
||||
if (val.canConvert<ShaderJob>()) {
|
||||
|
||||
if (v.canConvert<ShaderJob>()) {
|
||||
|
||||
ShaderJob job = v.value<ShaderJob>();
|
||||
ShaderJob job = val.value<ShaderJob>();
|
||||
|
||||
VideoParams tex_params = GetCacheVideoParams();
|
||||
tex_params.set_channel_count(GetChannelCountFromJob(job));
|
||||
@@ -318,11 +315,11 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
|
||||
PreProcessRow(range, job.GetValues());
|
||||
ProcessShader(tex, val.source(), range, job);
|
||||
|
||||
val.set_data(QVariant::fromValue(tex));
|
||||
val.set_value(tex);
|
||||
|
||||
} else if (v.canConvert<GenerateJob>()) {
|
||||
} else if (val.canConvert<GenerateJob>()) {
|
||||
|
||||
GenerateJob job = v.value<GenerateJob>();
|
||||
GenerateJob job = val.value<GenerateJob>();
|
||||
|
||||
VideoParams tex_params = GetCacheVideoParams();
|
||||
tex_params.set_channel_count(GetChannelCountFromJob(job));
|
||||
@@ -346,11 +343,11 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
|
||||
tex = dest;
|
||||
}
|
||||
|
||||
val.set_data(QVariant::fromValue(tex));
|
||||
val.set_value(tex);
|
||||
|
||||
} else if (v.canConvert<ColorTransformJob>()) {
|
||||
} else if (val.canConvert<ColorTransformJob>()) {
|
||||
|
||||
ColorTransformJob job = v.value<ColorTransformJob>();
|
||||
ColorTransformJob job = val.value<ColorTransformJob>();
|
||||
|
||||
VideoParams src_params = job.GetInputTexture()->params();
|
||||
src_params.set_channel_count(GetChannelCountFromJob(job));
|
||||
@@ -359,11 +356,11 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
|
||||
|
||||
ProcessColorTransform(dest, val.source(), job);
|
||||
|
||||
val.set_data(QVariant::fromValue(dest));
|
||||
val.set_value(dest);
|
||||
|
||||
} else if (v.canConvert<FootageJob>()) {
|
||||
} else if (val.canConvert<FootageJob>()) {
|
||||
|
||||
FootageJob job = v.value<FootageJob>();
|
||||
FootageJob job = val.value<FootageJob>();
|
||||
|
||||
if (job.type() == Track::kVideo) {
|
||||
|
||||
@@ -399,22 +396,22 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
|
||||
ProcessVideoFootage(tex, job, footage_time);
|
||||
}
|
||||
|
||||
val.set_data(QVariant::fromValue(tex));
|
||||
val.set_value(tex);
|
||||
|
||||
} else if (job.type() == Track::kAudio) {
|
||||
|
||||
SampleBufferPtr buffer = CreateSampleBuffer(GetCacheAudioParams(), range.length());
|
||||
ProcessAudioFootage(buffer, job, range);
|
||||
val.set_data(QVariant::fromValue(buffer));
|
||||
val.set_value(buffer);
|
||||
|
||||
}
|
||||
|
||||
} else if (v.canConvert<SampleJob>()) {
|
||||
} else if (val.canConvert<SampleJob>()) {
|
||||
|
||||
SampleJob job = v.value<SampleJob>();
|
||||
SampleJob job = val.value<SampleJob>();
|
||||
SampleBufferPtr output_buffer = CreateSampleBuffer(job.samples()->audio_params(), job.samples()->sample_count());
|
||||
ProcessSamples(output_buffer, val.source(), range, job);
|
||||
val.set_data(QVariant::fromValue(output_buffer));
|
||||
val.set_value(QVariant::fromValue(output_buffer));
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -418,7 +418,7 @@ NodeValue::Type NodeValue::GetDataTypeFromName(const QString &n)
|
||||
return NodeValue::kNone;
|
||||
}
|
||||
|
||||
NodeValue NodeValueTable::GetWithMeta(const QVector<NodeValue::Type> &type, const QString &tag) const
|
||||
NodeValue NodeValueTable::Get(const QVector<NodeValue::Type> &type, const QString &tag) const
|
||||
{
|
||||
int value_index = GetValueIndex(type, tag);
|
||||
|
||||
@@ -429,7 +429,7 @@ NodeValue NodeValueTable::GetWithMeta(const QVector<NodeValue::Type> &type, cons
|
||||
return NodeValue();
|
||||
}
|
||||
|
||||
NodeValue NodeValueTable::TakeWithMeta(const QVector<NodeValue::Type> &type, const QString &tag)
|
||||
NodeValue NodeValueTable::Take(const QVector<NodeValue::Type> &type, const QString &tag)
|
||||
{
|
||||
int value_index = GetValueIndex(type, tag);
|
||||
|
||||
|
||||
+42
-31
@@ -21,10 +21,16 @@
|
||||
#ifndef NODEVALUE_H
|
||||
#define NODEVALUE_H
|
||||
|
||||
#include <QMatrix4x4>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
|
||||
#include "codec/samplebuffer.h"
|
||||
#include "common/bezier.h"
|
||||
#include "node/splitvalue.h"
|
||||
#include "render/color.h"
|
||||
#include "render/texture.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -209,14 +215,16 @@ public:
|
||||
return data_.value<T>();
|
||||
}
|
||||
|
||||
const QVariant& data() const
|
||||
template <typename T>
|
||||
void set_value(const T &v)
|
||||
{
|
||||
return data_;
|
||||
data_ = QVariant::fromValue(v);
|
||||
}
|
||||
|
||||
void set_data(const QVariant& data)
|
||||
template <typename T>
|
||||
bool canConvert() const
|
||||
{
|
||||
data_ = data;
|
||||
return data_.canConvert<T>();
|
||||
}
|
||||
|
||||
const QString& tag() const
|
||||
@@ -245,6 +253,10 @@ public:
|
||||
static NodeValue::Type GetDataTypeFromName(const QString &n);
|
||||
|
||||
static QString ValueToString(Type data_type, const QVariant& value, bool value_is_a_key_track);
|
||||
static QString ValueToString(const NodeValue &v, bool value_is_a_key_track)
|
||||
{
|
||||
return ValueToString(v.type_, v.data_, value_is_a_key_track);
|
||||
}
|
||||
|
||||
static QVariant StringToValue(Type data_type, const QString &string, bool value_is_a_key_track);
|
||||
|
||||
@@ -254,13 +266,18 @@ public:
|
||||
static QByteArray ValueToBytes(Type type, const QVariant& value);
|
||||
static QByteArray ValueToBytes(const NodeValue &value)
|
||||
{
|
||||
return ValueToBytes(value.type(), value.data());
|
||||
return ValueToBytes(value.type(), value.data_);
|
||||
}
|
||||
|
||||
static QVector<QVariant> split_normal_value_into_track_values(Type type, const QVariant &value);
|
||||
|
||||
static QVariant combine_track_values_into_normal_value(Type type, const QVector<QVariant>& split);
|
||||
|
||||
SplitValue to_split_value() const
|
||||
{
|
||||
return split_normal_value_into_track_values(type_, data_);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns whether a data type can be interpolated or not
|
||||
*/
|
||||
@@ -289,6 +306,22 @@ public:
|
||||
|
||||
static void ValidateVectorString(QStringList* list, int count);
|
||||
|
||||
TexturePtr toTexture() const { return value<TexturePtr>(); }
|
||||
SampleBufferPtr toSamples() const { return value<SampleBufferPtr>(); }
|
||||
bool toBool() const { return value<bool>(); }
|
||||
double toDouble() const { return value<double>(); }
|
||||
int64_t toInt() const { return value<int64_t>(); }
|
||||
rational toRational() const { return value<rational>(); }
|
||||
QString toString() const { return value<QString>(); }
|
||||
Color toColor() const { return value<Color>(); }
|
||||
QMatrix4x4 toMatrix() const { return value<QMatrix4x4>(); }
|
||||
VideoParams toVideoParams() const { return value<VideoParams>(); }
|
||||
AudioParams toAudioParams() const { return value<AudioParams>(); }
|
||||
QVector2D toVec2() const { return value<QVector2D>(); }
|
||||
QVector3D toVec3() const { return value<QVector3D>(); }
|
||||
QVector4D toVec4() const { return value<QVector4D>(); }
|
||||
Bezier toBezier() const { return value<Bezier>(); }
|
||||
|
||||
private:
|
||||
Type type_;
|
||||
QVariant data_;
|
||||
@@ -303,43 +336,21 @@ class NodeValueTable
|
||||
public:
|
||||
NodeValueTable() = default;
|
||||
|
||||
QVariant Get(NodeValue::Type type, const QString& tag = QString()) const
|
||||
NodeValue Get(NodeValue::Type type, const QString& tag = QString()) const
|
||||
{
|
||||
QVector<NodeValue::Type> types = {type};
|
||||
return Get(types, tag);
|
||||
}
|
||||
|
||||
QVariant Get(const QVector<NodeValue::Type>& type, const QString& tag = QString()) const
|
||||
{
|
||||
return GetWithMeta(type, tag).data();
|
||||
}
|
||||
NodeValue Get(const QVector<NodeValue::Type>& type, const QString& tag = QString()) const;
|
||||
|
||||
NodeValue GetWithMeta(NodeValue::Type type, const QString& tag = QString()) const
|
||||
{
|
||||
QVector<NodeValue::Type> types = {type};
|
||||
return GetWithMeta(types, tag);
|
||||
}
|
||||
|
||||
NodeValue GetWithMeta(const QVector<NodeValue::Type>& type, const QString& tag = QString()) const;
|
||||
|
||||
QVariant Take(NodeValue::Type type, const QString& tag = QString())
|
||||
NodeValue Take(NodeValue::Type type, const QString& tag = QString())
|
||||
{
|
||||
QVector<NodeValue::Type> types = {type};
|
||||
return Take(types, tag);
|
||||
}
|
||||
|
||||
QVariant Take(const QVector<NodeValue::Type>& type, const QString& tag = QString())
|
||||
{
|
||||
return TakeWithMeta(type, tag).data();
|
||||
}
|
||||
|
||||
NodeValue TakeWithMeta(NodeValue::Type type, const QString& tag = QString())
|
||||
{
|
||||
QVector<NodeValue::Type> types = {type};
|
||||
return TakeWithMeta(types, tag);
|
||||
}
|
||||
|
||||
NodeValue TakeWithMeta(const QVector<NodeValue::Type>& type, const QString& tag = QString());
|
||||
NodeValue Take(const QVector<NodeValue::Type>& type, const QString& tag = QString());
|
||||
|
||||
void Push(const NodeValue& value)
|
||||
{
|
||||
|
||||
@@ -35,12 +35,12 @@ public:
|
||||
|
||||
SampleJob(const NodeValue& value)
|
||||
{
|
||||
samples_ = value.data().value<SampleBufferPtr>();
|
||||
samples_ = value.toSamples();
|
||||
}
|
||||
|
||||
SampleJob(const QString& from, const NodeValueRow& row)
|
||||
{
|
||||
samples_ = row[from].data().value<SampleBufferPtr>();
|
||||
samples_ = row[from].toSamples();
|
||||
}
|
||||
|
||||
SampleBufferPtr samples() const
|
||||
|
||||
@@ -449,48 +449,48 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
|
||||
case NodeValue::kInt:
|
||||
// kInt technically specifies a LongLong, but OpenGL doesn't support those. This may lead to
|
||||
// over/underflows if the number is large enough, but the likelihood of that is quite low.
|
||||
functions_->glUniform1i(variable_location, value.data().toInt());
|
||||
functions_->glUniform1i(variable_location, value.toInt());
|
||||
break;
|
||||
case NodeValue::kFloat:
|
||||
// kFloat technically specifies a double but as above, OpenGL doesn't support those.
|
||||
functions_->glUniform1f(variable_location, value.data().toFloat());
|
||||
functions_->glUniform1f(variable_location, value.toDouble());
|
||||
break;
|
||||
case NodeValue::kVec2:
|
||||
{
|
||||
QVector2D v = value.data().value<QVector2D>();
|
||||
QVector2D v = value.toVec2();
|
||||
functions_->glUniform2fv(variable_location, 1, reinterpret_cast<const GLfloat*>(&v));
|
||||
break;
|
||||
}
|
||||
case NodeValue::kVec3:
|
||||
{
|
||||
QVector3D v = value.data().value<QVector3D>();
|
||||
QVector3D v = value.toVec3();
|
||||
functions_->glUniform3fv(variable_location, 1, reinterpret_cast<const GLfloat*>(&v));
|
||||
break;
|
||||
}
|
||||
case NodeValue::kVec4:
|
||||
{
|
||||
QVector4D v = value.data().value<QVector4D>();
|
||||
QVector4D v = value.toVec4();
|
||||
functions_->glUniform4fv(variable_location, 1, reinterpret_cast<const GLfloat*>(&v));
|
||||
break;
|
||||
}
|
||||
case NodeValue::kMatrix:
|
||||
functions_->glUniformMatrix4fv(variable_location, 1, false, value.data().value<QMatrix4x4>().constData());
|
||||
functions_->glUniformMatrix4fv(variable_location, 1, false, value.toMatrix().constData());
|
||||
break;
|
||||
case NodeValue::kCombo:
|
||||
functions_->glUniform1i(variable_location, value.data().value<int>());
|
||||
functions_->glUniform1i(variable_location, value.toInt());
|
||||
break;
|
||||
case NodeValue::kColor:
|
||||
{
|
||||
Color color = value.data().value<Color>();
|
||||
Color color = value.toColor();
|
||||
functions_->glUniform4f(variable_location, color.red(), color.green(), color.blue(), color.alpha());
|
||||
break;
|
||||
}
|
||||
case NodeValue::kBoolean:
|
||||
functions_->glUniform1i(variable_location, value.data().toBool());
|
||||
functions_->glUniform1i(variable_location, value.toBool());
|
||||
break;
|
||||
case NodeValue::kTexture:
|
||||
{
|
||||
TexturePtr texture = value.data().value<TexturePtr>();
|
||||
TexturePtr texture = value.toTexture();
|
||||
|
||||
// Set value to bound texture
|
||||
functions_->glUniform1i(variable_location, textures_to_bind.size());
|
||||
@@ -552,7 +552,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
|
||||
// Ensure matrix is set, at least to identity
|
||||
GLint mvpmat_location = functions_->glGetUniformLocation(shader, "ove_mvpmat");
|
||||
if (mvpmat_location > -1) {
|
||||
functions_->glUniformMatrix4fv(mvpmat_location, 1, false, job.GetValue(QStringLiteral("ove_mvpmat")).data().value<QMatrix4x4>().constData());
|
||||
functions_->glUniformMatrix4fv(mvpmat_location, 1, false, job.GetValue(QStringLiteral("ove_mvpmat")).toMatrix().constData());
|
||||
}
|
||||
|
||||
// Set the viewport to the "physical" resolution of the destination
|
||||
|
||||
@@ -55,11 +55,11 @@ TexturePtr RenderProcessor::GenerateTexture(const rational &time, const rational
|
||||
table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kTextureInput), range);
|
||||
}
|
||||
|
||||
NodeValue tex_val = table.GetWithMeta(NodeValue::kTexture);
|
||||
NodeValue tex_val = table.Get(NodeValue::kTexture);
|
||||
|
||||
ResolveJobs(tex_val, range);
|
||||
|
||||
return tex_val.data().value<TexturePtr>();
|
||||
return tex_val.toTexture();
|
||||
}
|
||||
|
||||
FramePtr RenderProcessor::GenerateFrame(TexturePtr texture, const rational& time)
|
||||
@@ -196,12 +196,11 @@ void RenderProcessor::Run()
|
||||
table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kSamplesInput),time);
|
||||
}
|
||||
|
||||
NodeValue sample_val = table.GetWithMeta(NodeValue::kSamples);
|
||||
NodeValue sample_val = table.Get(NodeValue::kSamples);
|
||||
|
||||
ResolveJobs(sample_val, time);
|
||||
|
||||
QVariant sample_variant = sample_val.data();
|
||||
SampleBufferPtr samples = sample_variant.value<SampleBufferPtr>();
|
||||
SampleBufferPtr samples = sample_val.toSamples();
|
||||
if (samples && ticket_->property("enablewaveforms").toBool()) {
|
||||
AudioVisualWaveform vis;
|
||||
vis.set_channel_count(samples->audio_params().channel_count());
|
||||
@@ -212,7 +211,7 @@ void RenderProcessor::Run()
|
||||
if (ticket_->IsCancelled()) {
|
||||
ticket_->Finish();
|
||||
} else {
|
||||
ticket_->Finish(sample_variant);
|
||||
ticket_->Finish(QVariant::fromValue(samples));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -293,7 +292,7 @@ NodeValueTable RenderProcessor::GenerateBlockTable(const Track *track, const Tim
|
||||
|
||||
// Destination buffer
|
||||
NodeValueTable table = GenerateTable(b, track->GetValueHintForInput(Track::kBlockInput, track->GetArrayIndexFromBlock(b)),Track::TransformRangeForBlock(b, range_for_block));
|
||||
SampleBufferPtr samples_from_this_block = table.Take(NodeValue::kSamples).value<SampleBufferPtr>();
|
||||
SampleBufferPtr samples_from_this_block = table.Take(NodeValue::kSamples).toSamples();
|
||||
ClipBlock *clip_cast = dynamic_cast<ClipBlock*>(b);
|
||||
|
||||
if (samples_from_this_block) {
|
||||
|
||||
@@ -151,7 +151,7 @@ void NodeTableView::SetTime(const rational &time)
|
||||
}
|
||||
default:
|
||||
{
|
||||
QVector<QVariant> split_values = NodeValue::split_normal_value_into_track_values(node->GetInputDataType(l.key()), value.data());
|
||||
QVector<QVariant> split_values = value.to_split_value();
|
||||
for (int k=0;k<split_values.size();k++) {
|
||||
sub_item->setText(2 + k, NodeValue::ValueToString(value.type(), split_values.at(k), true));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void NodeValueTree::SetNode(const NodeInput &input, const rational &time)
|
||||
|
||||
setItemWidget(item, 0, radio);
|
||||
item->setText(1, NodeValue::GetPrettyDataTypeName(value.type()));
|
||||
item->setText(2, NodeValue::ValueToString(value.type(), value.data(), false));
|
||||
item->setText(2, NodeValue::ValueToString(value, false));
|
||||
item->setText(3, value.source()->GetLabelAndName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user