rewrite nearly complete
This commit is contained in:
+10
-10
@@ -48,7 +48,7 @@
|
||||
#include "global/path.h"
|
||||
#include "ui/mainwindow.h"
|
||||
#include "global/math.h"
|
||||
#include "project/clipboard.h"
|
||||
#include "global/clipboard.h"
|
||||
#include "global/config.h"
|
||||
#include "transition.h"
|
||||
#include "undo/undostack.h"
|
||||
@@ -412,7 +412,7 @@ void Effect::FieldChanged() {
|
||||
}
|
||||
|
||||
void Effect::delete_self() {
|
||||
olive::UndoStack.push(new EffectDeleteCommand(this));
|
||||
olive::undo_stack.push(new EffectDeleteCommand(this));
|
||||
update_ui(true);
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ void Effect::move_up() {
|
||||
command->clip = parent_clip;
|
||||
command->from = index_of_effect;
|
||||
command->to = command->from - 1;
|
||||
olive::UndoStack.push(command);
|
||||
olive::undo_stack.push(command);
|
||||
panel_effect_controls->Reload();
|
||||
panel_sequence_viewer->viewer_widget()->frame_update();
|
||||
}
|
||||
@@ -441,7 +441,7 @@ void Effect::move_down() {
|
||||
command->clip = parent_clip;
|
||||
command->from = index_of_effect;
|
||||
command->to = command->from + 1;
|
||||
olive::UndoStack.push(command);
|
||||
olive::undo_stack.push(command);
|
||||
panel_effect_controls->Reload();
|
||||
panel_sequence_viewer->viewer_widget()->frame_update();
|
||||
}
|
||||
@@ -488,7 +488,7 @@ void Effect::load_from_file() {
|
||||
QFile file_handle(file);
|
||||
if (file_handle.open(QFile::ReadOnly)) {
|
||||
|
||||
olive::UndoStack.push(new SetEffectData(this, file_handle.readAll()));
|
||||
olive::undo_stack.push(new SetEffectData(this, file_handle.readAll()));
|
||||
|
||||
file_handle.close();
|
||||
|
||||
@@ -743,7 +743,7 @@ void Effect::open() {
|
||||
qWarning() << "Tried to open an effect that was already open";
|
||||
close();
|
||||
}
|
||||
if (olive::CurrentRuntimeConfig.shaders_are_enabled && (Flags() & ShaderFlag)) {
|
||||
if (olive::runtime_config.shaders_are_enabled && (Flags() & ShaderFlag)) {
|
||||
if (QOpenGLContext::currentContext() == nullptr) {
|
||||
qWarning() << "No current context to create a shader program for - will retry next repaint";
|
||||
} else {
|
||||
@@ -1023,7 +1023,7 @@ void Effect::gizmo_move(EffectGizmo* gizmo, int x_movement, int y_movement, doub
|
||||
ca->append(gizmo_dragging_actions_.at(j));
|
||||
}
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
|
||||
gizmo_dragging_actions_.clear();
|
||||
}
|
||||
@@ -1044,10 +1044,10 @@ void Effect::gizmo_world_to_screen(const QMatrix4x4& matrix, const QMatrix4x4& p
|
||||
projection,
|
||||
QRect(0,
|
||||
0,
|
||||
parent_clip->sequence->width,
|
||||
parent_clip->sequence->height));
|
||||
parent_clip->track()->sequence()->width,
|
||||
parent_clip->track()->sequence()->height));
|
||||
|
||||
g->screen_pos[j] = QPoint(screen_pos.x(), parent_clip->sequence->height-screen_pos.y());
|
||||
g->screen_pos[j] = QPoint(screen_pos.x(), parent_clip->track()->sequence()->height-screen_pos.y());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,13 +235,13 @@ void EffectField::SetValueAt(double time, const QVariant &value)
|
||||
double EffectField::Now()
|
||||
{
|
||||
Clip* c = GetParentRow()->GetParentEffect()->parent_clip;
|
||||
return playhead_to_clip_seconds(c, c->sequence->playhead);
|
||||
return playhead_to_clip_seconds(c, c->track()->sequence()->playhead);
|
||||
}
|
||||
|
||||
long EffectField::NowInFrames()
|
||||
{
|
||||
Clip* c = GetParentRow()->GetParentEffect()->parent_clip;
|
||||
return playhead_to_clip_frame(c, c->sequence->playhead);
|
||||
return playhead_to_clip_frame(c, c->track()->sequence()->playhead);
|
||||
}
|
||||
|
||||
void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca)
|
||||
@@ -331,11 +331,11 @@ double EffectField::GetValidKeyframeHandlePosition(int key, bool post) {
|
||||
}
|
||||
|
||||
double EffectField::FrameToSeconds(long frame) {
|
||||
return (double(frame) / GetParentRow()->GetParentEffect()->parent_clip->sequence->frame_rate);
|
||||
return (double(frame) / GetParentRow()->GetParentEffect()->parent_clip->track()->sequence()->frame_rate);
|
||||
}
|
||||
|
||||
long EffectField::SecondsToFrame(double seconds) {
|
||||
return qRound(seconds * GetParentRow()->GetParentEffect()->parent_clip->sequence->frame_rate);
|
||||
return qRound(seconds * GetParentRow()->GetParentEffect()->parent_clip->track()->sequence()->frame_rate);
|
||||
}
|
||||
|
||||
void EffectField::GetKeyframeData(double timecode, int &before, int &after, double &progress) {
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
QMutex olive::effects_loaded;
|
||||
|
||||
void load_internal_effects() {
|
||||
if (!olive::CurrentRuntimeConfig.shaders_are_enabled) {
|
||||
if (!olive::runtime_config.shaders_are_enabled) {
|
||||
qWarning() << "Shaders are disabled, some effects may be nonfunctional";
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ void load_internal_effects() {
|
||||
em.path = ":/internalshaders";
|
||||
|
||||
em.type = EFFECT_TYPE_EFFECT;
|
||||
em.subtype = EFFECT_TYPE_AUDIO;
|
||||
em.subtype = Track::kTypeAudio;
|
||||
|
||||
em.name = "Volume";
|
||||
em.internal = EFFECT_INTERNAL_VOLUME;
|
||||
@@ -70,7 +70,7 @@ void load_internal_effects() {
|
||||
em.internal = EFFECT_INTERNAL_FILLLEFTRIGHT;
|
||||
olive::effects.append(em);
|
||||
|
||||
em.subtype = EFFECT_TYPE_VIDEO;
|
||||
em.subtype = Track::kTypeVideo;
|
||||
|
||||
em.name = "Transform";
|
||||
em.category = "Distort";
|
||||
@@ -115,7 +115,7 @@ void load_internal_effects() {
|
||||
em.internal = TRANSITION_INTERNAL_CROSSDISSOLVE;
|
||||
olive::effects.append(em);
|
||||
|
||||
em.subtype = EFFECT_TYPE_AUDIO;
|
||||
em.subtype = Track::kTypeAudio;
|
||||
|
||||
em.name = "Linear Fade";
|
||||
em.internal = TRANSITION_INTERNAL_LINEARFADE;
|
||||
@@ -181,7 +181,7 @@ void load_shader_effects_worker(const QString& effects_path) {
|
||||
if (!effect_name.isEmpty()) {
|
||||
EffectMeta em;
|
||||
em.type = EFFECT_TYPE_EFFECT;
|
||||
em.subtype = EFFECT_TYPE_VIDEO;
|
||||
em.subtype = Track::kTypeVideo;
|
||||
em.name = effect_name;
|
||||
em.category = effect_cat;
|
||||
em.filename = file.fileName();
|
||||
|
||||
@@ -93,7 +93,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
|
||||
Field(i)->PrepareDataForKeyframing(true, ca);
|
||||
}
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
|
||||
update_ui(false);
|
||||
|
||||
@@ -116,7 +116,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
|
||||
// Disable keyframing setting on this row
|
||||
ca->append(new SetIsKeyframing(this, false));
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
|
||||
update_ui(false);
|
||||
|
||||
@@ -131,7 +131,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
|
||||
void EffectRow::GoToPreviousKeyframe() {
|
||||
long key = LONG_MIN;
|
||||
Clip* c = GetParentEffect()->parent_clip;
|
||||
long sequence_playhead = c->sequence->playhead;
|
||||
long sequence_playhead = c->track()->sequence()->playhead;
|
||||
|
||||
// Used to convert clip frame number to sequence frame number
|
||||
long time_adjustment = c->timeline_in() - c->clip_in();
|
||||
@@ -158,7 +158,7 @@ void EffectRow::GoToPreviousKeyframe() {
|
||||
|
||||
void EffectRow::ToggleKeyframe() {
|
||||
Clip* c = GetParentEffect()->parent_clip;
|
||||
long sequence_playhead = c->sequence->playhead;
|
||||
long sequence_playhead = c->track()->sequence()->playhead;
|
||||
|
||||
// Used to convert clip frame number to sequence frame number
|
||||
long time_adjustment = c->timeline_in() - c->clip_in();
|
||||
@@ -222,7 +222,7 @@ void EffectRow::ToggleKeyframe() {
|
||||
|
||||
}
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ void EffectRow::GoToNextKeyframe() {
|
||||
EffectField* f = Field(i);
|
||||
for (int j=0;j<f->keyframes.size();j++) {
|
||||
long comp = f->keyframes.at(j).time - c->clip_in() + c->timeline_in();
|
||||
if (comp > olive::ActiveSequence->playhead) {
|
||||
if (comp > c->track()->sequence()->playhead) {
|
||||
key = qMin(comp, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,5 +92,5 @@ void BoolField::UpdateFromWidget(bool b)
|
||||
SetValueAt(Now(), b);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -67,5 +67,5 @@ void ColorField::UpdateFromWidget(const QColor& c)
|
||||
SetValueAt(Now(), c);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -87,5 +87,5 @@ void ComboField::UpdateFromWidget(int index)
|
||||
SetValueAt(Now(), items_.at(index).data);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void DoubleField::UpdateFromWidget(double d)
|
||||
if (!ls->IsDragging() && kdc_ != nullptr) {
|
||||
kdc_->SetNewKeyframes();
|
||||
|
||||
olive::UndoStack.push(kdc_);
|
||||
olive::undo_stack.push(kdc_);
|
||||
|
||||
kdc_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -62,5 +62,5 @@ void FileField::UpdateFromWidget(const QString &s)
|
||||
SetValueAt(Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -89,5 +89,5 @@ void FontField::UpdateFromWidget(const QString& s)
|
||||
SetValueAt(Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ QWidget *StringField::CreateWidget(QWidget *existing)
|
||||
text_edit->setUndoRedoEnabled(true);
|
||||
|
||||
// the "2" is because the height needs one extra pixel of padding on the top and the bottom
|
||||
text_edit->setTextHeight(qCeil(text_edit->fontMetrics().lineSpacing()*olive::CurrentConfig.effect_textbox_lines
|
||||
text_edit->setTextHeight(qCeil(text_edit->fontMetrics().lineSpacing()*olive::config.effect_textbox_lines
|
||||
+ text_edit->document()->documentMargin()
|
||||
+ text_edit->document()->documentMargin() + 2));
|
||||
|
||||
@@ -95,5 +95,5 @@ void StringField::UpdateFromWidget(const QString &s)
|
||||
SetValueAt(Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -88,14 +88,16 @@ TimecodeEffect::TimecodeEffect(Clip* c, const EffectMeta* em) :
|
||||
|
||||
|
||||
void TimecodeEffect::redraw(double timecode) {
|
||||
Sequence* sequence = parent_clip->track()->sequence();
|
||||
|
||||
if (tc_select->GetValueAt(timecode).toBool()) {
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(olive::ActiveSequence->playhead,
|
||||
olive::CurrentConfig.timecode_view,
|
||||
olive::ActiveSequence->frame_rate);
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(sequence->playhead,
|
||||
olive::config.timecode_view,
|
||||
sequence->frame_rate);
|
||||
} else {
|
||||
double media_rate = parent_clip->media_frame_rate();
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(qRound(timecode * media_rate),
|
||||
olive::CurrentConfig.timecode_view,
|
||||
olive::config.timecode_view,
|
||||
media_rate);
|
||||
}
|
||||
img.fill(Qt::transparent);
|
||||
|
||||
@@ -55,7 +55,7 @@ void ToneEffect::process_audio(double timecode_start, double timecode_end, quint
|
||||
double timecode = timecode_start+(interval*i);
|
||||
|
||||
qint16 left_tone_sample = qint16(qRound(qSin((2*M_PI*sinX*freq_val->GetDoubleAt(timecode))
|
||||
/parent_clip->sequence->audio_frequency)
|
||||
/parent_clip->track()->sequence()->audio_frequency)
|
||||
*log_volume(amount_val->GetDoubleAt(timecode)*0.01)*INT16_MAX));
|
||||
qint16 right_tone_sample = left_tone_sample;
|
||||
|
||||
|
||||
@@ -152,13 +152,13 @@ TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em)
|
||||
}
|
||||
|
||||
void TransformEffect::refresh() {
|
||||
if (parent_clip != nullptr && parent_clip->sequence != nullptr) {
|
||||
if (parent_clip != nullptr && parent_clip->track()->sequence() != nullptr) {
|
||||
|
||||
position_x->SetDefault(parent_clip->sequence->width/2);
|
||||
position_y->SetDefault(parent_clip->sequence->height/2);
|
||||
position_x->SetDefault(parent_clip->track()->sequence()->width/2);
|
||||
position_y->SetDefault(parent_clip->track()->sequence()->height/2);
|
||||
|
||||
double x_percent_multipler = 200.0 / parent_clip->sequence->width;
|
||||
double y_percent_multipler = 200.0 / parent_clip->sequence->height;
|
||||
double x_percent_multipler = 200.0 / parent_clip->track()->sequence()->width;
|
||||
double y_percent_multipler = 200.0 / parent_clip->track()->sequence()->height;
|
||||
|
||||
top_left_gizmo->x_field_multi1 = -x_percent_multipler;
|
||||
top_left_gizmo->y_field_multi1 = -y_percent_multipler;
|
||||
@@ -190,8 +190,8 @@ void TransformEffect::toggle_uniform_scale(bool enabled) {
|
||||
|
||||
void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, int) {
|
||||
// position
|
||||
coords.matrix.translate(position_x->GetDoubleAt(timecode)-(parent_clip->sequence->width/2),
|
||||
position_y->GetDoubleAt(timecode)-(parent_clip->sequence->height/2),
|
||||
coords.matrix.translate(position_x->GetDoubleAt(timecode)-(parent_clip->track()->sequence()->width/2),
|
||||
position_y->GetDoubleAt(timecode)-(parent_clip->track()->sequence()->height/2),
|
||||
0);
|
||||
|
||||
// anchor point
|
||||
|
||||
@@ -60,7 +60,7 @@ void delete_keyframes(QVector<EffectField *>& selected_key_fields, QVector<int>
|
||||
for (int i=0;i<key_indices.size();i++) {
|
||||
ca->append(new KeyframeDelete(fields.at(i), key_indices.at(i)));
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
selected_keys.clear();
|
||||
selected_key_fields.clear();
|
||||
update_ui(false);
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
#include "timeline/clip.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
#include "project/clipboard.h"
|
||||
#include "global/clipboard.h"
|
||||
|
||||
#include "effects/internal/crossdissolvetransition.h"
|
||||
#include "effects/internal/linearfadetransition.h"
|
||||
@@ -50,8 +49,8 @@ Transition::Transition(Clip *c, Clip *s, const EffectMeta* em) :
|
||||
length_field->SetDefault(30);
|
||||
length_field->SetMinimum(1);
|
||||
length_field->SetDisplayType(LabelSlider::FrameNumber);
|
||||
length_field->SetFrameRate(parent_clip->sequence == nullptr ?
|
||||
parent_clip->cached_frame_rate() : parent_clip->sequence->frame_rate);
|
||||
length_field->SetFrameRate(parent_clip->track()->sequence() == nullptr ?
|
||||
parent_clip->cached_frame_rate() : parent_clip->track()->sequence()->frame_rate);
|
||||
|
||||
connect(length_field, SIGNAL(Changed()), this, SLOT(UpdateMaximumLength()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user