enforced field semantics and completed shared transitions

This commit is contained in:
itsmattkc
2018-11-24 20:12:51 +11:00
parent c5dca79d1d
commit 00b31d514e
31 changed files with 635 additions and 531 deletions
+5 -5
View File
@@ -293,11 +293,11 @@ int Clip::getHeight() {
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
if (change_timeline_points) {
ca->append(new MoveClipAction(this,
qRound((double) timeline_in * multiplier),
qRound((double) timeline_out * multiplier),
qRound((double) clip_in * multiplier),
track));
move_clip(ca, this,
qRound((double) timeline_in * multiplier),
qRound((double) timeline_out * multiplier),
qRound((double) clip_in * multiplier),
track);
}
for (int i=0;i<effects.size();i++) {
+6 -11
View File
@@ -105,12 +105,12 @@ void load_internal_effects() {
em.name = "Transform";
em.category = "Distort";
em.internal = EFFECT_INTERNAL_TRANSFORM;
video_effects.append(em);
video_effects.append(em);
em.name = "Corner Pin";
em.category = "Distort";
em.internal = EFFECT_INTERNAL_CORNERPIN;
video_effects.append(em);
em.name = "Corner Pin";
em.category = "Distort";
em.internal = EFFECT_INTERNAL_CORNERPIN;
video_effects.append(em);
em.name = "Text";
em.category = "Render";
@@ -133,10 +133,6 @@ void load_internal_effects() {
em.name = "Cross Dissolve";
em.internal = TRANSITION_INTERNAL_CROSSDISSOLVE;
video_effects.append(em);
em.name = "Cube";
em.internal = TRANSITION_INTERNAL_CUBE;
video_effects.append(em);
em.name = "Linear Fade";
@@ -298,8 +294,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
if (id.isEmpty()) {
dout << "[ERROR] Couldn't load field from" << em->filename << "- ID cannot be empty.";
} else if (type > -1) {
EffectField* field = row->add_field(type);
field->id = id;
EffectField* field = row->add_field(type, id);
connect(field, SIGNAL(changed()), this, SLOT(field_changed()));
switch (type) {
case EFFECT_FIELD_DOUBLE:
+16 -9
View File
@@ -63,7 +63,6 @@ extern QMutex effects_loaded;
#define EFFECT_INTERNAL_CORNERPIN 12
#define EFFECT_INTERNAL_COUNT 13
@@ -76,21 +75,29 @@ struct GLTextureCoords {
int vertexTopLeftX;
int vertexTopLeftY;
int vertexTopLeftZ;
int vertexTopRightX;
int vertexTopRightY;
int vertexTopRightZ;
int vertexBottomLeftX;
int vertexBottomLeftY;
int vertexBottomLeftZ;
int vertexBottomRightX;
int vertexBottomRightY;
int vertexBottomRightZ;
double textureTopLeftX;
double textureTopLeftY;
double textureTopRightX;
double textureTopRightY;
double textureBottomRightX;
double textureBottomRightY;
double textureBottomLeftX;
double textureBottomLeftY;
float textureTopLeftX;
float textureTopLeftY;
float textureTopLeftQ;
float textureTopRightX;
float textureTopRightY;
float textureTopRightQ;
float textureBottomRightX;
float textureBottomRightY;
float textureBottomRightQ;
float textureBottomLeftX;
float textureBottomLeftY;
float textureBottomLeftQ;
};
qint16 mix_audio_sample(qint16 a, qint16 b);
+1 -1
View File
@@ -17,7 +17,7 @@
#include "io/math.h"
#include <QtMath>
EffectField::EffectField(EffectRow *parent, int t) : parent_row(parent), type(t) {
EffectField::EffectField(EffectRow *parent, int t, const QString &i) : parent_row(parent), type(t), id(i) {
switch (t) {
case EFFECT_FIELD_DOUBLE:
{
+1 -1
View File
@@ -17,7 +17,7 @@ class EffectRow;
class EffectField : public QObject {
Q_OBJECT
public:
EffectField(EffectRow* parent, int t);
EffectField(EffectRow* parent, int t, const QString& i);
EffectRow* parent_row;
int type;
QString id;
+2 -2
View File
@@ -144,8 +144,8 @@ void EffectRow::goto_next_key() {
if (key != LONG_MAX) panel_sequence_viewer->seek(key);
}
EffectField* EffectRow::add_field(int type, int colspan) {
EffectField* field = new EffectField(this, type);
EffectField* EffectRow::add_field(int type, const QString& id, int colspan) {
EffectField* field = new EffectField(this, type, id);
fields.append(field);
QWidget* element = field->get_ui_element();
ui->addWidget(element, ui_row, fields.size(), 1, colspan);
+1 -1
View File
@@ -16,7 +16,7 @@ class EffectRow : public QObject {
public:
EffectRow(Effect* parent, QGridLayout* uilayout, const QString& n, int row);
~EffectRow();
EffectField* add_field(int type, int colspan = 1);
EffectField* add_field(int type, const QString &id, int colspan = 1);
EffectField* field(int i);
int fieldCount();
void set_keyframe_now(bool undoable);
+1 -1
View File
@@ -14,7 +14,7 @@
#include <QMessageBox>
Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) : Effect(c, em), secondary_clip(s) {
add_row("Length:")->add_field(EFFECT_FIELD_DOUBLE);
//add_row("Length:")->add_field(EFFECT_FIELD_DOUBLE);
}
int Transition::copy(Clip *c, Clip* s) {
+23 -5
View File
@@ -224,9 +224,10 @@ void AddEffectCommand::redo() {
mainWindow->setWindowModified(true);
}
AddTransitionCommand::AddTransitionCommand(Clip* c, Clip *s, const EffectMeta *itransition, int itype, int ilength) :
AddTransitionCommand::AddTransitionCommand(Clip* c, Clip *s, Transition* copy, const EffectMeta *itransition, int itype, int ilength) :
clip(c),
secondary(s),
transition_to_copy(copy),
transition(itransition),
type(itype),
length(ilength),
@@ -236,19 +237,36 @@ AddTransitionCommand::AddTransitionCommand(Clip* c, Clip *s, const EffectMeta *i
void AddTransitionCommand::undo() {
clip->sequence->hard_delete_transition(clip, type);
if (secondary != NULL) secondary->sequence->hard_delete_transition(secondary, (type == TA_OPENING_TRANSITION) ? TA_CLOSING_TRANSITION : TA_OPENING_TRANSITION);
if (type == TA_OPENING_TRANSITION) {
clip->opening_transition = old_ptransition;
if (secondary != NULL) secondary->closing_transition = old_stransition;
} else {
clip->closing_transition = old_ptransition;
if (secondary != NULL) secondary->opening_transition = old_stransition;
}
mainWindow->setWindowModified(old_project_changed);
}
void AddTransitionCommand::redo() {
if (type == TA_OPENING_TRANSITION) {
clip->opening_transition = create_transition(clip, secondary, transition);
if (secondary != NULL) secondary->closing_transition = clip->opening_transition;
old_ptransition = clip->opening_transition;
clip->opening_transition = (transition_to_copy == NULL) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, NULL);
if (secondary != NULL) {
old_stransition = secondary->closing_transition;
secondary->closing_transition = clip->opening_transition;
}
if (length > 0) {
clip->get_opening_transition()->length = length;
}
} else {
clip->closing_transition = create_transition(clip, secondary, transition);
if (secondary != NULL) secondary->opening_transition = clip->closing_transition;
old_ptransition = clip->closing_transition;
clip->closing_transition = (transition_to_copy == NULL) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, NULL);
if (secondary != NULL) {
old_stransition = secondary->opening_transition;
secondary->opening_transition = clip->closing_transition;
}
if (length > 0) {
clip->get_closing_transition()->length = length;
}
+4 -1
View File
@@ -101,16 +101,19 @@ private:
class AddTransitionCommand : public QUndoCommand {
public:
AddTransitionCommand(Clip* c, Clip* s, const EffectMeta* itransition, int itype, int ilength);
AddTransitionCommand(Clip* c, Clip* s, Transition *copy, const EffectMeta* itransition, int itype, int ilength);
void undo();
void redo();
private:
Clip* clip;
Clip* secondary;
Transition* transition_to_copy;
const EffectMeta* transition;
int type;
int length;
bool old_project_changed;
int old_ptransition;
int old_stransition;
};
class ModifyTransitionCommand : public QUndoCommand {