style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
@@ -30,48 +30,48 @@ namespace olive
|
||||
|
||||
#define super Block
|
||||
|
||||
const QString TransitionBlock::kOutBlockInput = QStringLiteral("out_block_in");
|
||||
const QString TransitionBlock::kInBlockInput = QStringLiteral("in_block_in");
|
||||
const QString TransitionBlock::kCurveInput = QStringLiteral("curve_in");
|
||||
const QString TransitionBlock::kCenterInput = QStringLiteral("center_in");
|
||||
const QString TransitionBlock::k_out_block_input = QStringLiteral("out_block_in");
|
||||
const QString TransitionBlock::k_in_block_input = QStringLiteral("in_block_in");
|
||||
const QString TransitionBlock::k_curve_input = QStringLiteral("curve_in");
|
||||
const QString TransitionBlock::k_center_input = QStringLiteral("center_in");
|
||||
|
||||
TransitionBlock::TransitionBlock()
|
||||
: connected_out_block_(nullptr)
|
||||
, connected_in_block_(nullptr)
|
||||
{
|
||||
AddInput(kOutBlockInput, NodeValue::kNone,
|
||||
InputFlags(kInputFlagNotKeyframable));
|
||||
add_input(k_out_block_input, NodeValue::k_none,
|
||||
InputFlags(k_input_flag_not_keyframable));
|
||||
|
||||
AddInput(kInBlockInput, NodeValue::kNone,
|
||||
InputFlags(kInputFlagNotKeyframable));
|
||||
add_input(k_in_block_input, NodeValue::k_none,
|
||||
InputFlags(k_input_flag_not_keyframable));
|
||||
|
||||
AddInput(kCurveInput, NodeValue::kCombo,
|
||||
InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||
add_input(k_curve_input, NodeValue::k_combo,
|
||||
InputFlags(k_input_flag_not_keyframable | k_input_flag_not_connectable));
|
||||
|
||||
AddInput(kCenterInput, NodeValue::kRational,
|
||||
InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||
SetInputProperty(kCenterInput, QStringLiteral("view"),
|
||||
RationalSlider::kTime);
|
||||
SetInputProperty(kCenterInput, QStringLiteral("viewlock"), true);
|
||||
add_input(k_center_input, NodeValue::k_rational,
|
||||
InputFlags(k_input_flag_not_keyframable | k_input_flag_not_connectable));
|
||||
set_input_property(k_center_input, QStringLiteral("view"),
|
||||
RationalSlider::k_time);
|
||||
set_input_property(k_center_input, QStringLiteral("viewlock"), true);
|
||||
|
||||
SetFlag(kDontShowInParamView, false);
|
||||
set_flag(k_dont_show_in_param_view, false);
|
||||
}
|
||||
|
||||
void TransitionBlock::Retranslate()
|
||||
void TransitionBlock::retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
super::retranslate();
|
||||
|
||||
SetInputName(kOutBlockInput, tr("From"));
|
||||
SetInputName(kInBlockInput, tr("To"));
|
||||
SetInputName(kCurveInput, tr("Curve"));
|
||||
SetInputName(kCenterInput, tr("Center Offset"));
|
||||
set_input_name(k_out_block_input, tr("From"));
|
||||
set_input_name(k_in_block_input, tr("To"));
|
||||
set_input_name(k_curve_input, tr("Curve"));
|
||||
set_input_name(k_center_input, tr("Center Offset"));
|
||||
|
||||
// These must correspond to the CurveType enum
|
||||
SetComboBoxStrings(kCurveInput,
|
||||
set_combo_box_strings(k_curve_input,
|
||||
{ tr("Linear"), tr("Exponential"), tr("Logarithmic") });
|
||||
}
|
||||
|
||||
rational TransitionBlock::in_offset() const
|
||||
Rational TransitionBlock::in_offset() const
|
||||
{
|
||||
if (is_dual_transition()) {
|
||||
return length() / 2 + offset_center();
|
||||
@@ -82,7 +82,7 @@ rational TransitionBlock::in_offset() const
|
||||
}
|
||||
}
|
||||
|
||||
rational TransitionBlock::out_offset() const
|
||||
Rational TransitionBlock::out_offset() const
|
||||
{
|
||||
if (is_dual_transition()) {
|
||||
return length() / 2 - offset_center();
|
||||
@@ -93,21 +93,21 @@ rational TransitionBlock::out_offset() const
|
||||
}
|
||||
}
|
||||
|
||||
rational TransitionBlock::offset_center() const
|
||||
Rational TransitionBlock::offset_center() const
|
||||
{
|
||||
return GetStandardValue(kCenterInput).value<rational>();
|
||||
return get_standard_value(k_center_input).value<Rational>();
|
||||
}
|
||||
|
||||
void TransitionBlock::set_offset_center(const rational &r)
|
||||
void TransitionBlock::set_offset_center(const Rational &r)
|
||||
{
|
||||
SetStandardValue(kCenterInput, QVariant::fromValue(r));
|
||||
set_standard_value(k_center_input, QVariant::fromValue(r));
|
||||
}
|
||||
|
||||
void TransitionBlock::set_offsets_and_length(const rational &in_offset,
|
||||
const rational &out_offset)
|
||||
void TransitionBlock::set_offsets_and_length(const Rational &in_offset,
|
||||
const Rational &out_offset)
|
||||
{
|
||||
rational len = in_offset + out_offset;
|
||||
rational center = len / 2 - in_offset;
|
||||
Rational len = in_offset + out_offset;
|
||||
Rational center = len / 2 - in_offset;
|
||||
|
||||
set_length_and_media_out(len);
|
||||
set_offset_center(center);
|
||||
@@ -123,101 +123,101 @@ Block *TransitionBlock::connected_in_block() const
|
||||
return connected_in_block_;
|
||||
}
|
||||
|
||||
double TransitionBlock::GetTotalProgress(const double &time) const
|
||||
double TransitionBlock::get_total_progress(const double &time) const
|
||||
{
|
||||
return GetInternalTransitionTime(time) / length().toDouble();
|
||||
return get_internal_transition_time(time) / length().to_double();
|
||||
}
|
||||
|
||||
double TransitionBlock::GetOutProgress(const double &time) const
|
||||
double TransitionBlock::get_out_progress(const double &time) const
|
||||
{
|
||||
if (out_offset() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return std::clamp(
|
||||
1.0 - (GetInternalTransitionTime(time) / out_offset().toDouble()), 0.0,
|
||||
1.0 - (get_internal_transition_time(time) / out_offset().to_double()), 0.0,
|
||||
1.0);
|
||||
}
|
||||
|
||||
double TransitionBlock::GetInProgress(const double &time) const
|
||||
double TransitionBlock::get_in_progress(const double &time) const
|
||||
{
|
||||
if (in_offset() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return std::clamp(
|
||||
(GetInternalTransitionTime(time) - out_offset().toDouble()) /
|
||||
in_offset().toDouble(),
|
||||
(get_internal_transition_time(time) - out_offset().to_double()) /
|
||||
in_offset().to_double(),
|
||||
0.0, 1.0);
|
||||
}
|
||||
|
||||
double TransitionBlock::GetInternalTransitionTime(const double &time) const
|
||||
double TransitionBlock::get_internal_transition_time(const double &time) const
|
||||
{
|
||||
return time;
|
||||
}
|
||||
|
||||
void TransitionBlock::InsertTransitionTimes(AcceleratedJob *job,
|
||||
void TransitionBlock::insert_transition_times(AcceleratedJob *job,
|
||||
const double &time) const
|
||||
{
|
||||
// Provides total transition progress from 0.0 (start) - 1.0 (end)
|
||||
job->Insert(QStringLiteral("ove_tprog_all"),
|
||||
NodeValue(NodeValue::kFloat, GetTotalProgress(time), this));
|
||||
job->insert(QStringLiteral("ove_tprog_all"),
|
||||
NodeValue(NodeValue::k_float, get_total_progress(time), this));
|
||||
|
||||
// Provides progress of out section from 1.0 (start) - 0.0 (end)
|
||||
job->Insert(QStringLiteral("ove_tprog_out"),
|
||||
NodeValue(NodeValue::kFloat, GetOutProgress(time), this));
|
||||
job->insert(QStringLiteral("ove_tprog_out"),
|
||||
NodeValue(NodeValue::k_float, get_out_progress(time), this));
|
||||
|
||||
// Provides progress of in section from 0.0 (start) - 1.0 (end)
|
||||
job->Insert(QStringLiteral("ove_tprog_in"),
|
||||
NodeValue(NodeValue::kFloat, GetInProgress(time), this));
|
||||
job->insert(QStringLiteral("ove_tprog_in"),
|
||||
NodeValue(NodeValue::k_float, get_in_progress(time), this));
|
||||
}
|
||||
|
||||
void TransitionBlock::Value(const NodeValueRow &value,
|
||||
void TransitionBlock::value(const NodeValueRow &value,
|
||||
const NodeGlobals &globals,
|
||||
NodeValueTable *table) const
|
||||
{
|
||||
NodeValue out_buffer = value[kOutBlockInput];
|
||||
NodeValue in_buffer = value[kInBlockInput];
|
||||
NodeValue::Type data_type = (out_buffer.type() != NodeValue::kNone) ?
|
||||
NodeValue out_buffer = value[k_out_block_input];
|
||||
NodeValue in_buffer = value[k_in_block_input];
|
||||
NodeValue::Type data_type = (out_buffer.type() != NodeValue::k_none) ?
|
||||
out_buffer.type() :
|
||||
in_buffer.type();
|
||||
|
||||
NodeValue::Type job_type = NodeValue::kNone;
|
||||
NodeValue::Type job_type = NodeValue::k_none;
|
||||
QVariant push_job;
|
||||
|
||||
if (data_type == NodeValue::kTexture) {
|
||||
if (data_type == NodeValue::k_texture) {
|
||||
// This must be a visual transition
|
||||
ShaderJob job;
|
||||
|
||||
if (out_buffer.type() != NodeValue::kNone) {
|
||||
job.Insert(kOutBlockInput, out_buffer);
|
||||
if (out_buffer.type() != NodeValue::k_none) {
|
||||
job.insert(k_out_block_input, out_buffer);
|
||||
} else {
|
||||
job.Insert(kOutBlockInput, NodeValue(NodeValue::kTexture, nullptr));
|
||||
job.insert(k_out_block_input, NodeValue(NodeValue::k_texture, nullptr));
|
||||
}
|
||||
|
||||
if (in_buffer.type() != NodeValue::kNone) {
|
||||
job.Insert(kInBlockInput, in_buffer);
|
||||
if (in_buffer.type() != NodeValue::k_none) {
|
||||
job.insert(k_in_block_input, in_buffer);
|
||||
} else {
|
||||
job.Insert(kInBlockInput, NodeValue(NodeValue::kTexture, nullptr));
|
||||
job.insert(k_in_block_input, NodeValue(NodeValue::k_texture, nullptr));
|
||||
}
|
||||
|
||||
job.Insert(kCurveInput, value);
|
||||
job.insert(k_curve_input, value);
|
||||
|
||||
double time = globals.time().in().toDouble();
|
||||
InsertTransitionTimes(&job, time);
|
||||
double time = globals.time().in().to_double();
|
||||
insert_transition_times(&job, time);
|
||||
|
||||
ShaderJobEvent(value, &job);
|
||||
|
||||
job_type = NodeValue::kTexture;
|
||||
push_job = QVariant::fromValue(Texture::Job(globals.vparams(), job));
|
||||
} else if (data_type == NodeValue::kSamples) {
|
||||
job_type = NodeValue::k_texture;
|
||||
push_job = QVariant::fromValue(Texture::job(globals.vparams(), job));
|
||||
} else if (data_type == NodeValue::k_samples) {
|
||||
// This must be an audio transition
|
||||
SampleBuffer from_samples = out_buffer.toSamples();
|
||||
SampleBuffer to_samples = in_buffer.toSamples();
|
||||
SampleBuffer from_samples = out_buffer.to_samples();
|
||||
SampleBuffer to_samples = in_buffer.to_samples();
|
||||
|
||||
if (from_samples.is_allocated() || to_samples.is_allocated()) {
|
||||
double time_in = globals.time().in().toDouble();
|
||||
double time_out = globals.time().out().toDouble();
|
||||
double time_in = globals.time().in().to_double();
|
||||
double time_out = globals.time().out().to_double();
|
||||
|
||||
const AudioParams ¶ms = (from_samples.is_allocated()) ?
|
||||
from_samples.audio_params() :
|
||||
@@ -232,41 +232,41 @@ void TransitionBlock::Value(const NodeValueRow &value,
|
||||
SampleJobEvent(from_samples, to_samples, out_samples, time_in);
|
||||
}
|
||||
|
||||
job_type = NodeValue::kSamples;
|
||||
job_type = NodeValue::k_samples;
|
||||
push_job = QVariant::fromValue(out_samples);
|
||||
}
|
||||
}
|
||||
|
||||
if (!push_job.isNull()) {
|
||||
table->Push(job_type, push_job, this);
|
||||
table->push(job_type, push_job, this);
|
||||
}
|
||||
}
|
||||
|
||||
void TransitionBlock::InvalidateCache(const TimeRange &range,
|
||||
void TransitionBlock::invalidate_cache(const TimeRange &range,
|
||||
const QString &from, int element,
|
||||
InvalidateCacheOptions options)
|
||||
{
|
||||
TimeRange r = range;
|
||||
|
||||
if (from == kOutBlockInput || from == kInBlockInput) {
|
||||
Block *n = dynamic_cast<Block *>(GetConnectedOutput(from));
|
||||
if (from == k_out_block_input || from == k_in_block_input) {
|
||||
Block *n = dynamic_cast<Block *>(get_connected_output(from));
|
||||
if (n) {
|
||||
r = Track::TransformRangeFromBlock(n, r);
|
||||
r = Track::transform_range_from_block(n, r);
|
||||
}
|
||||
}
|
||||
|
||||
super::InvalidateCache(r, from, element, options);
|
||||
super::invalidate_cache(r, from, element, options);
|
||||
}
|
||||
|
||||
double TransitionBlock::TransformCurve(double linear) const
|
||||
double TransitionBlock::transform_curve(double linear) const
|
||||
{
|
||||
switch (static_cast<CurveType>(GetStandardValue(kCurveInput).toInt())) {
|
||||
case kLinear:
|
||||
switch (static_cast<CurveType>(get_standard_value(k_curve_input).toInt())) {
|
||||
case k_linear:
|
||||
break;
|
||||
case kExponential:
|
||||
case k_exponential:
|
||||
linear *= linear;
|
||||
break;
|
||||
case kLogarithmic:
|
||||
case k_logarithmic:
|
||||
linear = std::sqrt(linear);
|
||||
break;
|
||||
}
|
||||
@@ -279,12 +279,12 @@ void TransitionBlock::InputConnectedEvent(const QString &input, int element,
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
|
||||
if (input == kOutBlockInput) {
|
||||
if (input == k_out_block_input) {
|
||||
// If node is not a block, this will just be null
|
||||
if ((connected_out_block_ = dynamic_cast<ClipBlock *>(output))) {
|
||||
connected_out_block_->set_out_transition(this);
|
||||
}
|
||||
} else if (input == kInBlockInput) {
|
||||
} else if (input == k_in_block_input) {
|
||||
// If node is not a block, this will just be null
|
||||
if ((connected_in_block_ = dynamic_cast<ClipBlock *>(output))) {
|
||||
connected_in_block_->set_in_transition(this);
|
||||
@@ -298,12 +298,12 @@ void TransitionBlock::InputDisconnectedEvent(const QString &input, int element,
|
||||
Q_UNUSED(element)
|
||||
Q_UNUSED(output)
|
||||
|
||||
if (input == kOutBlockInput) {
|
||||
if (input == k_out_block_input) {
|
||||
if (connected_out_block_) {
|
||||
connected_out_block_->set_out_transition(nullptr);
|
||||
connected_out_block_ = nullptr;
|
||||
}
|
||||
} else if (input == kInBlockInput) {
|
||||
} else if (input == k_in_block_input) {
|
||||
if (connected_in_block_) {
|
||||
connected_in_block_->set_in_transition(nullptr);
|
||||
connected_in_block_ = nullptr;
|
||||
@@ -311,34 +311,34 @@ void TransitionBlock::InputDisconnectedEvent(const QString &input, int element,
|
||||
}
|
||||
}
|
||||
|
||||
TimeRange TransitionBlock::InputTimeAdjustment(const QString &input,
|
||||
TimeRange TransitionBlock::input_time_adjustment(const QString &input,
|
||||
int element,
|
||||
const TimeRange &input_time,
|
||||
bool clamp) const
|
||||
{
|
||||
if (input == kInBlockInput || input == kOutBlockInput) {
|
||||
Block *block = dynamic_cast<Block *>(GetConnectedOutput(input));
|
||||
if (input == k_in_block_input || input == k_out_block_input) {
|
||||
Block *block = dynamic_cast<Block *>(get_connected_output(input));
|
||||
if (block) {
|
||||
// Retransform time as if it came from the track
|
||||
return input_time + in() - block->in();
|
||||
}
|
||||
}
|
||||
|
||||
return super::InputTimeAdjustment(input, element, input_time, clamp);
|
||||
return super::input_time_adjustment(input, element, input_time, clamp);
|
||||
}
|
||||
|
||||
TimeRange
|
||||
TransitionBlock::OutputTimeAdjustment(const QString &input, int element,
|
||||
TransitionBlock::output_time_adjustment(const QString &input, int element,
|
||||
const TimeRange &input_time) const
|
||||
{
|
||||
if (input == kInBlockInput || input == kOutBlockInput) {
|
||||
Block *block = dynamic_cast<Block *>(GetConnectedOutput(input));
|
||||
if (input == k_in_block_input || input == k_out_block_input) {
|
||||
Block *block = dynamic_cast<Block *>(get_connected_output(input));
|
||||
if (block) {
|
||||
return input_time + block->in() - in();
|
||||
}
|
||||
}
|
||||
|
||||
return super::OutputTimeAdjustment(input, element, input_time);
|
||||
return super::output_time_adjustment(input, element, input_time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user