#475 and some clip pointer changes

This commit is contained in:
itsmattkc
2019-02-28 01:54:04 -08:00
parent edea300cbc
commit 1685fa3a5d
70 changed files with 726 additions and 516 deletions
+43 -10
View File
@@ -40,7 +40,7 @@ const int kRGBAComponentCount = 4;
Clip::Clip(SequencePtr s) :
sequence(s),
cacher(ClipPtr(this))
cacher(this)
{
enabled_ = true;
clip_in_ = 0;
@@ -63,7 +63,7 @@ Clip::Clip(SequencePtr s) :
}
ClipPtr Clip::copy(SequencePtr s) {
ClipPtr copy(new Clip(s));
ClipPtr copy = std::make_shared<Clip>(s);
copy->set_enabled(enabled());
copy->set_name(name());
@@ -78,7 +78,7 @@ ClipPtr Clip::copy(SequencePtr s) {
copy->set_reversed(reversed());
for (int i=0;i<effects.size();i++) {
copy->effects.append(effects.at(i)->copy(copy));
copy->effects.append(effects.at(i)->copy(copy.get()));
}
copy->set_cached_frame_rate((this->sequence == nullptr) ? cached_frame_rate() : this->sequence->frame_rate);
@@ -153,6 +153,39 @@ void Clip::set_enabled(bool e)
enabled_ = e;
}
void Clip::move(ComboAction* ca, long iin, long iout, long iclip_in, int itrack, bool verify_transitions, bool relative)
{
ca->append(new MoveClipAction(this, iin, iout, iclip_in, itrack, relative));
if (verify_transitions) {
// if this is a shared transition, and the corresponding clip will be moved away somehow
if (opening_transition != nullptr
&& opening_transition->secondary_clip != nullptr
&& opening_transition->secondary_clip->timeline_out() != iin) {
// separate transition
ca->append(new SetPointer(reinterpret_cast<void**>(&opening_transition->secondary_clip), nullptr));
ca->append(new AddTransitionCommand(nullptr,
opening_transition->secondary_clip,
opening_transition,
nullptr,
0));
}
if (closing_transition != nullptr
&& closing_transition->secondary_clip != nullptr
&& closing_transition->parent_clip->timeline_in() != iout) {
// separate transition
ca->append(new SetPointer(reinterpret_cast<void**>(&closing_transition->secondary_clip), nullptr));
ca->append(new AddTransitionCommand(nullptr,
this,
closing_transition,
nullptr,
0));
}
}
}
void Clip::reset() {
texture = nullptr;
}
@@ -395,11 +428,11 @@ int Clip::media_height() {
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
if (change_timeline_points) {
move_clip(ca, ClipPtr(this),
qRound(double(timeline_in_) * multiplier),
qRound(double(timeline_out_) * multiplier),
qRound(double(clip_in_) * multiplier),
track_);
this->move(ca,
qRound(double(timeline_in_) * multiplier),
qRound(double(timeline_out_) * multiplier),
qRound(double(clip_in_) * multiplier),
track_);
}
// move keyframes
@@ -485,7 +518,7 @@ bool Clip::IsOpen()
return open_;
}
void Clip::Cache(long playhead, bool scrubbing, QVector<ClipPtr>& nests, int playback_speed) {
void Clip::Cache(long playhead, bool scrubbing, QVector<Clip*>& nests, int playback_speed) {
// qint64 time = QDateTime::currentMSecsSinceEpoch();
cacher.Cache(playhead, scrubbing, nests, playback_speed);
@@ -542,7 +575,7 @@ bool Clip::Retrieve()
memcpy(data_buffer_1, frame->data[0], frame_size);
}
e->process_image(get_timecode(ClipPtr(this), cacher_frame),
e->process_image(get_timecode(this, cacher_frame),
using_db_1 ? data_buffer_1 : data_buffer_2,
using_db_1 ? data_buffer_2 : data_buffer_1,
frame_size
+10 -2
View File
@@ -53,7 +53,7 @@ using ClipPtr = std::shared_ptr<Clip>;
class Sequence;
using SequencePtr = std::shared_ptr<Sequence>;
class Clip {
class Clip : public std::enable_shared_from_this<Clip> {
public:
Clip(SequencePtr s);
~Clip();
@@ -77,6 +77,14 @@ public:
bool enabled();
void set_enabled(bool e);
void move(ComboAction* ca,
long iin,
long iout,
long iclip_in,
int itrack,
bool verify_transitions = true,
bool relative = false);
long clip_in(bool with_transition = false);
void set_clip_in(long c);
@@ -126,7 +134,7 @@ public:
// playback functions
void Open();
void Cache(long playhead, bool scrubbing, QVector<ClipPtr> &nests, int playback_speed);
void Cache(long playhead, bool scrubbing, QVector<Clip*> &nests, int playback_speed);
bool Retrieve();
void Close(bool wait);
bool IsOpen();
+6 -1
View File
@@ -31,5 +31,10 @@ void ComboAction::append(QUndoCommand* u) {
}
void ComboAction::appendPost(QUndoCommand* u) {
post_commands.append(u);
post_commands.append(u);
}
bool ComboAction::hasActions()
{
return commands.size() > 0;
}
+8
View File
@@ -73,6 +73,14 @@ public:
* The PostAction to add
*/
void appendPost(QUndoCommand* u);
/**
* @brief Returns whether actions have been appended or not
*
* @return **TRUE** if actions have been appended, **FALSE** if not.
*/
bool hasActions();
private:
/**
* @brief Internal array of QUndoCommand objects
+3 -3
View File
@@ -69,7 +69,7 @@
QVector<EffectMeta> effects;
EffectPtr create_effect(ClipPtr c, const EffectMeta* em) {
EffectPtr create_effect(Clip* c, const EffectMeta* em) {
if (em->internal >= 0 && em->internal < EFFECT_INTERNAL_COUNT) {
// must be an internal effect
switch (em->internal) {
@@ -112,7 +112,7 @@ const EffectMeta* get_internal_meta(int internal_id, int type) {
return nullptr;
}
Effect::Effect(ClipPtr c, const EffectMeta *em) :
Effect::Effect(Clip* c, const EffectMeta *em) :
parent_clip(c),
meta(em),
enable_shader(false),
@@ -854,7 +854,7 @@ void Effect::setIterations(int i) {
void Effect::process_image(double, uint8_t *, uint8_t *, int){}
EffectPtr Effect::copy(ClipPtr c) {
EffectPtr Effect::copy(Clip *c) {
EffectPtr copy = create_effect(c, meta);
copy->set_enabled(is_enabled());
copy_field_keyframes(copy);
+167 -167
View File
@@ -49,114 +49,114 @@ class Effect;
using EffectPtr = std::shared_ptr<Effect>;
struct EffectMeta {
QString name;
QString category;
QString filename;
QString path;
QString tooltip;
int internal;
int type;
int subtype;
QString name;
QString category;
QString filename;
QString path;
QString tooltip;
int internal;
int type;
int subtype;
};
extern QVector<EffectMeta> effects;
double log_volume(double linear);
EffectPtr create_effect(ClipPtr c, const EffectMeta *em);
EffectPtr create_effect(Clip *c, const EffectMeta *em);
const EffectMeta* get_internal_meta(int internal_id, int type);
enum EffectType {
EFFECT_TYPE_INVALID,
EFFECT_TYPE_VIDEO,
EFFECT_TYPE_AUDIO,
EFFECT_TYPE_EFFECT,
EFFECT_TYPE_TRANSITION
EFFECT_TYPE_INVALID,
EFFECT_TYPE_VIDEO,
EFFECT_TYPE_AUDIO,
EFFECT_TYPE_EFFECT,
EFFECT_TYPE_TRANSITION
};
enum EffectKeyframeType {
EFFECT_KEYFRAME_LINEAR,
EFFECT_KEYFRAME_BEZIER,
EFFECT_KEYFRAME_HOLD
EFFECT_KEYFRAME_LINEAR,
EFFECT_KEYFRAME_BEZIER,
EFFECT_KEYFRAME_HOLD
};
enum EffectInternal {
EFFECT_INTERNAL_TRANSFORM,
EFFECT_INTERNAL_TEXT,
EFFECT_INTERNAL_SOLID,
EFFECT_INTERNAL_NOISE,
EFFECT_INTERNAL_VOLUME,
EFFECT_INTERNAL_PAN,
EFFECT_INTERNAL_TONE,
EFFECT_INTERNAL_SHAKE,
EFFECT_INTERNAL_TIMECODE,
EFFECT_INTERNAL_MASK,
EFFECT_INTERNAL_FILLLEFTRIGHT,
EFFECT_INTERNAL_VST,
EFFECT_INTERNAL_CORNERPIN,
EFFECT_INTERNAL_FREI0R,
EFFECT_INTERNAL_COUNT
EFFECT_INTERNAL_TRANSFORM,
EFFECT_INTERNAL_TEXT,
EFFECT_INTERNAL_SOLID,
EFFECT_INTERNAL_NOISE,
EFFECT_INTERNAL_VOLUME,
EFFECT_INTERNAL_PAN,
EFFECT_INTERNAL_TONE,
EFFECT_INTERNAL_SHAKE,
EFFECT_INTERNAL_TIMECODE,
EFFECT_INTERNAL_MASK,
EFFECT_INTERNAL_FILLLEFTRIGHT,
EFFECT_INTERNAL_VST,
EFFECT_INTERNAL_CORNERPIN,
EFFECT_INTERNAL_FREI0R,
EFFECT_INTERNAL_COUNT
};
enum EffectBlendMode {
BLEND_MODE_ADD,
BLEND_MODE_AVERAGE,
BLEND_MODE_COLORBURN,
BLEND_MODE_COLORDODGE,
BLEND_MODE_DARKEN,
BLEND_MODE_DIFFERENCE,
BLEND_MODE_EXCLUSION,
BLEND_MODE_GLOW,
BLEND_MODE_HARDLIGHT,
BLEND_MODE_HARDMIX,
BLEND_MODE_LIGHTEN,
BLEND_MODE_LINEARBURN,
BLEND_MODE_LINEARDODGE,
BLEND_MODE_LINEARLIGHT,
BLEND_MODE_MULTIPLY,
BLEND_MODE_NEGATION,
BLEND_MODE_NORMAL,
BLEND_MODE_OVERLAY,
BLEND_MODE_PHOENIX,
BLEND_MODE_PINLIGHT,
BLEND_MODE_REFLECT,
BLEND_MODE_SCREEN,
BLEND_MODE_SOFTLIGHT,
BLEND_MODE_SUBSTRACT,
BLEND_MODE_SUBTRACT,
BLEND_MODE_VIVIDLIGHT,
BLEND_MODE_COUNT
BLEND_MODE_ADD,
BLEND_MODE_AVERAGE,
BLEND_MODE_COLORBURN,
BLEND_MODE_COLORDODGE,
BLEND_MODE_DARKEN,
BLEND_MODE_DIFFERENCE,
BLEND_MODE_EXCLUSION,
BLEND_MODE_GLOW,
BLEND_MODE_HARDLIGHT,
BLEND_MODE_HARDMIX,
BLEND_MODE_LIGHTEN,
BLEND_MODE_LINEARBURN,
BLEND_MODE_LINEARDODGE,
BLEND_MODE_LINEARLIGHT,
BLEND_MODE_MULTIPLY,
BLEND_MODE_NEGATION,
BLEND_MODE_NORMAL,
BLEND_MODE_OVERLAY,
BLEND_MODE_PHOENIX,
BLEND_MODE_PINLIGHT,
BLEND_MODE_REFLECT,
BLEND_MODE_SCREEN,
BLEND_MODE_SOFTLIGHT,
BLEND_MODE_SUBSTRACT,
BLEND_MODE_SUBTRACT,
BLEND_MODE_VIVIDLIGHT,
BLEND_MODE_COUNT
};
struct GLTextureCoords {
int grid_size;
int grid_size;
int vertexTopLeftX;
int vertexTopLeftY;
int vertexTopLeftZ;
int vertexTopRightX;
int vertexTopRightY;
int vertexTopRightZ;
int vertexBottomLeftX;
int vertexBottomLeftY;
int vertexBottomLeftZ;
int vertexBottomRightX;
int vertexBottomRightY;
int vertexBottomRightZ;
int vertexTopLeftX;
int vertexTopLeftY;
int vertexTopLeftZ;
int vertexTopRightX;
int vertexTopRightY;
int vertexTopRightZ;
int vertexBottomLeftX;
int vertexBottomLeftY;
int vertexBottomLeftZ;
int vertexBottomRightX;
int vertexBottomRightY;
int vertexBottomRightZ;
float textureTopLeftX;
float textureTopLeftY;
float textureTopLeftQ;
float textureTopRightX;
float textureTopRightY;
float textureTopRightQ;
float textureBottomRightX;
float textureBottomRightY;
float textureBottomRightQ;
float textureBottomLeftX;
float textureBottomLeftY;
float textureBottomLeftQ;
float textureTopLeftX;
float textureTopLeftY;
float textureTopLeftQ;
float textureTopRightX;
float textureTopRightY;
float textureTopRightQ;
float textureBottomRightX;
float textureBottomRightY;
float textureBottomRightQ;
float textureBottomLeftX;
float textureBottomLeftY;
float textureBottomLeftQ;
int blendmode;
float opacity;
int blendmode;
float opacity;
};
const EffectMeta* get_meta_from_name(const QString& input);
@@ -168,114 +168,114 @@ qint16 mix_audio_sample(qint16 a, qint16 b);
#include "effectgizmo.h"
class Effect : public QObject {
Q_OBJECT
Q_OBJECT
public:
Effect(ClipPtr c, const EffectMeta* em);
~Effect();
ClipPtr parent_clip;
const EffectMeta* meta;
int id;
QString name;
CollapsibleWidget* container;
Effect(Clip *c, const EffectMeta* em);
~Effect();
Clip* parent_clip;
const EffectMeta* meta;
int id;
QString name;
CollapsibleWidget* container;
EffectRow* add_row(const QString &name, bool savable = true, bool keyframable = true);
EffectRow* row(int i);
int row_count();
EffectRow* add_row(const QString &name, bool savable = true, bool keyframable = true);
EffectRow* row(int i);
int row_count();
EffectGizmo* add_gizmo(int type);
EffectGizmo* gizmo(int i);
int gizmo_count();
EffectGizmo* add_gizmo(int type);
EffectGizmo* gizmo(int i);
int gizmo_count();
bool is_enabled();
void set_enabled(bool b);
bool is_enabled();
void set_enabled(bool b);
virtual void refresh();
virtual void refresh();
virtual EffectPtr copy(ClipPtr c);
void copy_field_keyframes(EffectPtr e);
virtual EffectPtr copy(Clip* c);
void copy_field_keyframes(EffectPtr e);
virtual void load(QXmlStreamReader& stream);
virtual void custom_load(QXmlStreamReader& stream);
virtual void save(QXmlStreamWriter& stream);
virtual void load(QXmlStreamReader& stream);
virtual void custom_load(QXmlStreamReader& stream);
virtual void save(QXmlStreamWriter& stream);
void load_from_string(const QByteArray &s);
QByteArray save_to_string();
void load_from_string(const QByteArray &s);
QByteArray save_to_string();
// glsl handling
bool is_open();
void open();
void close();
bool is_glsl_linked();
virtual void startEffect();
virtual void endEffect();
// glsl handling
bool is_open();
void open();
void close();
bool is_glsl_linked();
virtual void startEffect();
virtual void endEffect();
bool enable_shader;
bool enable_coords;
bool enable_superimpose;
bool enable_image;
bool enable_shader;
bool enable_coords;
bool enable_superimpose;
bool enable_image;
int getIterations();
void setIterations(int i);
int getIterations();
void setIterations(int i);
const char* ffmpeg_filter;
const char* ffmpeg_filter;
virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size);
virtual void process_shader(double timecode, GLTextureCoords&, int iteration);
virtual void process_coords(double timecode, GLTextureCoords& coords, int data);
virtual GLuint process_superimpose(double timecode);
virtual void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size);
virtual void process_shader(double timecode, GLTextureCoords&, int iteration);
virtual void process_coords(double timecode, GLTextureCoords& coords, int data);
virtual GLuint process_superimpose(double timecode);
virtual void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
virtual void gizmo_draw(double timecode, GLTextureCoords& coords);
void gizmo_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode, bool done);
void gizmo_world_to_screen();
bool are_gizmos_enabled();
virtual void gizmo_draw(double timecode, GLTextureCoords& coords);
void gizmo_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode, bool done);
void gizmo_world_to_screen();
bool are_gizmos_enabled();
public slots:
void field_changed();
void field_changed();
private slots:
void show_context_menu(const QPoint&);
void delete_self();
void move_up();
void move_down();
void save_to_file();
void load_from_file();
void show_context_menu(const QPoint&);
void delete_self();
void move_up();
void move_down();
void save_to_file();
void load_from_file();
protected:
// glsl effect
QOpenGLShaderProgram* glslProgram;
QString vertPath;
QString fragPath;
// glsl effect
QOpenGLShaderProgram* glslProgram;
QString vertPath;
QString fragPath;
// superimpose effect
QImage img;
QOpenGLTexture* texture;
// superimpose effect
QImage img;
QOpenGLTexture* texture;
// enable effect to update constantly
bool enable_always_update;
// enable effect to update constantly
bool enable_always_update;
private:
// superimpose effect
QString script;
// superimpose effect
QString script;
bool isOpen;
QVector<EffectRow*> rows;
QVector<EffectGizmo*> gizmos;
QGridLayout* ui_layout;
QWidget* ui;
bool bound;
int iterations;
bool isOpen;
QVector<EffectRow*> rows;
QVector<EffectGizmo*> gizmos;
QGridLayout* ui_layout;
QWidget* ui;
bool bound;
int iterations;
// superimpose functions
virtual void redraw(double timecode);
bool valueHasChanged(double timecode);
QVector<QVariant> cachedValues;
void delete_texture();
int get_index_in_clip();
void validate_meta_path();
// superimpose functions
virtual void redraw(double timecode);
bool valueHasChanged(double timecode);
QVector<QVariant> cachedValues;
void delete_texture();
int get_index_in_clip();
void validate_meta_path();
};
class EffectInit : public QThread {
public:
EffectInit();
EffectInit();
protected:
void run();
void run();
};
#endif // EFFECT_H
+3 -3
View File
@@ -116,7 +116,7 @@ void EffectRow::set_keyframe_enabled(bool enabled) {
void EffectRow::goto_previous_key() {
long key = LONG_MIN;
ClipPtr c = parent_effect->parent_clip;
Clip* c = parent_effect->parent_clip;
for (int i=0;i<fieldCount();i++) {
EffectField* f = field(i);
for (int j=0;j<f->keyframes.size();j++) {
@@ -132,7 +132,7 @@ void EffectRow::goto_previous_key() {
void EffectRow::toggle_key() {
QVector<EffectField*> key_fields;
QVector<int> key_field_index;
ClipPtr c = parent_effect->parent_clip;
Clip* c = parent_effect->parent_clip;
for (int j=0;j<fieldCount();j++) {
EffectField* f = field(j);
for (int i=0;i<f->keyframes.size();i++) {
@@ -159,7 +159,7 @@ void EffectRow::toggle_key() {
void EffectRow::goto_next_key() {
long key = LONG_MAX;
ClipPtr c = parent_effect->parent_clip;
Clip* c = parent_effect->parent_clip;
for (int i=0;i<fieldCount();i++) {
EffectField* f = field(i);
for (int j=0;j<f->keyframes.size();j++) {
+6 -6
View File
@@ -41,7 +41,7 @@
#include <QMessageBox>
#include <QCoreApplication>
Transition::Transition(ClipPtr c, ClipPtr s, const EffectMeta* em) :
Transition::Transition(Clip *c, Clip *s, const EffectMeta* em) :
Effect(c, em), secondary_clip(s),
length(30)
{
@@ -55,7 +55,7 @@ Transition::Transition(ClipPtr c, ClipPtr s, const EffectMeta* em) :
length_ui_ele->set_frame_rate(parent_clip->sequence == nullptr ? parent_clip->cached_frame_rate() : parent_clip->sequence->frame_rate);
}
TransitionPtr Transition::copy(ClipPtr c, ClipPtr s) {
TransitionPtr Transition::copy(Clip *c, Clip *s) {
return create_transition(c, s, meta, length);
}
@@ -80,7 +80,7 @@ long Transition::get_length() {
return length;
}
ClipPtr Transition::get_opened_clip() {
Clip* Transition::get_opened_clip() {
if (parent_clip->opening_transition.get() == this) {
return parent_clip;
} else if (secondary_clip != nullptr && secondary_clip->opening_transition.get() == this) {
@@ -89,7 +89,7 @@ ClipPtr Transition::get_opened_clip() {
return nullptr;
}
ClipPtr Transition::get_closed_clip() {
Clip* Transition::get_closed_clip() {
if (parent_clip->closing_transition.get() == this) {
return parent_clip;
} else if (secondary_clip != nullptr && secondary_clip->closing_transition.get() == this) {
@@ -103,7 +103,7 @@ void Transition::set_length_from_slider() {
update_ui(false);
}
TransitionPtr get_transition_from_meta(ClipPtr c, ClipPtr s, const EffectMeta* em) {
TransitionPtr get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
if (!em->filename.isEmpty()) {
// load effect from file
return TransitionPtr(new Transition(c, s, em));
@@ -126,7 +126,7 @@ TransitionPtr get_transition_from_meta(ClipPtr c, ClipPtr s, const EffectMeta* e
return nullptr;
}
TransitionPtr create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length) {
TransitionPtr create_transition(Clip* c, Clip* s, const EffectMeta* em, long length) {
TransitionPtr t(get_transition_from_meta(c, s, em));
if (t != nullptr) {
if (length > 0) {
+7 -7
View File
@@ -41,16 +41,16 @@ enum TransitionInternal {
class Transition;
using TransitionPtr = std::shared_ptr<Transition>;
TransitionPtr get_transition_from_meta(ClipPtr c, ClipPtr s, const EffectMeta* em);
TransitionPtr get_transition_from_meta(Clip *c, Clip *s, const EffectMeta* em);
TransitionPtr create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length = 0);
TransitionPtr create_transition(Clip* c, Clip* s, const EffectMeta* em, long length = 0);
class Transition : public Effect {
Q_OBJECT
public:
Transition(ClipPtr c, ClipPtr s, const EffectMeta* em);
virtual TransitionPtr copy(ClipPtr c, ClipPtr s);
ClipPtr secondary_clip;
Transition(Clip* c, Clip* s, const EffectMeta* em);
virtual TransitionPtr copy(Clip* c, Clip* s);
Clip* secondary_clip;
virtual void save(QXmlStreamWriter& stream) override;
@@ -58,8 +58,8 @@ public:
long get_true_length();
long get_length();
ClipPtr get_opened_clip();
ClipPtr get_closed_clip();
Clip* get_opened_clip();
Clip* get_closed_clip();
private slots:
void set_length_from_slider();
private:
+19 -20
View File
@@ -50,7 +50,7 @@
QUndoStack olive::UndoStack;
MoveClipAction::MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative) {
MoveClipAction::MoveClipAction(Clip *c, long iin, long iout, long iclip_in, int itrack, bool irelative) {
clip = c;
old_in = c->timeline_in();
@@ -192,7 +192,7 @@ void SetTimelineInOutCommand::doRedo() {
}
}
AddEffectCommand::AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta *m, int insert_pos) {
AddEffectCommand::AddEffectCommand(Clip* c, EffectPtr e, const EffectMeta *m, int insert_pos) {
clip = c;
ref = e;
meta = m;
@@ -222,8 +222,8 @@ void AddEffectCommand::doRedo() {
done = true;
}
AddTransitionCommand::AddTransitionCommand(ClipPtr iopen,
ClipPtr iclose,
AddTransitionCommand::AddTransitionCommand(Clip* iopen,
Clip* iclose,
TransitionPtr copy,
const EffectMeta *itransition,
int ilength) {
@@ -247,8 +247,8 @@ void AddTransitionCommand::doUndo() {
void AddTransitionCommand::doRedo() {
// convert open/close clips to primary/secondary for transition object
ClipPtr primary = open_;
ClipPtr secondary = close_;
Clip* primary = open_;
Clip* secondary = close_;
if (primary == nullptr) {
primary = secondary;
secondary = nullptr;
@@ -596,7 +596,7 @@ EffectDeleteCommand::~EffectDeleteCommand() {}
void EffectDeleteCommand::doUndo() {
for (int i=0;i<clips.size();i++) {
ClipPtr c = clips.at(i);
Clip* c = clips.at(i);
c->effects.insert(fx.at(i), deleted_objects.at(i));
}
panel_effect_controls->reload_clips();
@@ -607,7 +607,7 @@ void EffectDeleteCommand::doUndo() {
void EffectDeleteCommand::doRedo() {
deleted_objects.clear();
for (int i=0;i<clips.size();i++) {
ClipPtr c = clips.at(i);
Clip* c = clips.at(i);
int fx_id = fx.at(i) - i;
EffectPtr e = c->effects.at(fx_id);
e->close();
@@ -689,7 +689,7 @@ void EffectFieldUndo::doRedo() {
SetClipProperty::SetClipProperty(SetClipPropertyType type) : type_(type)
{}
void SetClipProperty::AddSetting(ClipPtr c, bool setting)
void SetClipProperty::AddSetting(Clip* c, bool setting)
{
clips_.append(c);
setting_.append(setting);
@@ -829,7 +829,7 @@ void DeleteMarkerAction::doRedo() {
sorted = true;
}
SetSpeedAction::SetSpeedAction(ClipPtr c, double speed) {
SetSpeedAction::SetSpeedAction(Clip* c, double speed) {
clip = c;
old_speed = c->speed().value;
new_speed = speed;
@@ -1005,20 +1005,19 @@ void RemoveClipsFromClipboard::doRedo() {
done = true;
}
RenameClipCommand::RenameClipCommand() {}
RenameClipCommand::RenameClipCommand(Clip *clip, QString new_name)
{
clip_ = clip;
old_name_ = clip_->name();
new_name_ = new_name;
}
void RenameClipCommand::doUndo() {
for (int i=0;i<clips.size();i++) {
clips.at(i)->set_name(old_names.at(i));
}
clip_->set_name(old_name_);
}
void RenameClipCommand::doRedo() {
old_names.resize(clips.size());
for (int i=0;i<clips.size();i++) {
old_names[i] = clips.at(i)->name();
clips.at(i)->set_name(new_name);
}
clip_->set_name(new_name_);
}
SetPointer::SetPointer(void **pointer, void *data) {
@@ -1062,7 +1061,7 @@ void RippleAction::doRedo() {
ClipPtr c = s->clips.at(i);
if (c != nullptr) {
if (c->timeline_in() >= point) {
move_clip(ca, c, length, length, 0, 0, true, true);
c->move(ca, length, length, 0, 0, true, true);
}
}
}
+19 -19
View File
@@ -63,11 +63,11 @@ private:
class MoveClipAction : public OliveAction {
public:
MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative);
MoveClipAction(Clip* c, long iin, long iout, long iclip_in, int itrack, bool irelative);
virtual void doUndo() override;
virtual void doRedo() override;
private:
ClipPtr clip;
Clip* clip;
long old_in;
long old_out;
@@ -125,11 +125,11 @@ private:
class AddEffectCommand : public OliveAction {
public:
AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta* m, int insert_pos = -1);
AddEffectCommand(Clip* c, EffectPtr e, const EffectMeta* m, int insert_pos = -1);
virtual void doUndo() override;
virtual void doRedo() override;
private:
ClipPtr clip;
Clip* clip;
const EffectMeta* meta;
EffectPtr ref;
int pos;
@@ -138,12 +138,12 @@ private:
class AddTransitionCommand : public OliveAction {
public:
AddTransitionCommand(ClipPtr iopen, ClipPtr iclose, TransitionPtr copy, const EffectMeta* itransition, int ilength);
AddTransitionCommand(Clip* iopen, Clip* iclose, TransitionPtr copy, const EffectMeta* itransition, int ilength);
virtual void doUndo() override;
virtual void doRedo() override;
private:
ClipPtr open_;
ClipPtr close_;
Clip* open_;
Clip* close_;
TransitionPtr transition_to_copy_;
const EffectMeta* transition_meta_;
int length_;
@@ -170,8 +170,8 @@ public:
virtual void doRedo() override;
private:
TransitionPtr transition_ref_;
ClipPtr opened_clip_;
ClipPtr closed_clip_;
Clip* opened_clip_;
Clip* closed_clip_;
};
class SetTimelineInOutCommand : public OliveAction {
@@ -295,7 +295,7 @@ public:
virtual ~EffectDeleteCommand() override;
virtual void doUndo() override;
virtual void doRedo() override;
QVector<ClipPtr> clips;
QVector<Clip*> clips;
QVector<int> fx;
private:
bool done;
@@ -374,10 +374,10 @@ public:
SetClipProperty(SetClipPropertyType type);
virtual void doUndo() override;
virtual void doRedo() override;
void AddSetting(ClipPtr c, bool setting);
void AddSetting(Clip *c, bool setting);
private:
SetClipPropertyType type_;
QVector<ClipPtr> clips_;
QVector<Clip*> clips_;
QVector<bool> setting_;
QVector<bool> old_setting_;
void MainLoop(bool undo);
@@ -421,11 +421,11 @@ private:
class SetSpeedAction : public OliveAction {
public:
SetSpeedAction(ClipPtr c, double speed);
SetSpeedAction(Clip* c, double speed);
virtual void doUndo() override;
virtual void doRedo() override;
private:
ClipPtr clip;
Clip* clip;
double old_speed;
double new_speed;
};
@@ -542,7 +542,7 @@ public:
MoveEffectCommand();
virtual void doUndo() override;
virtual void doRedo() override;
ClipPtr clip;
Clip* clip;
int from;
int to;
};
@@ -561,13 +561,13 @@ private:
class RenameClipCommand : public OliveAction {
public:
RenameClipCommand();
QVector<ClipPtr> clips;
QString new_name;
RenameClipCommand(Clip* clip, QString new_name);
virtual void doUndo() override;
virtual void doRedo() override;
private:
QVector<QString> old_names;
QString old_name_;
QString new_name_;
Clip* clip_;
};
class SetPointer : public OliveAction {