better ]shared transitions, dock tabs, effects panel name
This commit is contained in:
+60
-37
@@ -902,6 +902,10 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
const Ghost& g = panel_timeline->ghosts.at(i);
|
||||
|
||||
sequence->clips.at(g.clip)->undeletable = true;
|
||||
if (g.transition != NULL) {
|
||||
g.transition->parent_clip->undeletable = true;
|
||||
g.transition->secondary_clip->undeletable = true;
|
||||
}
|
||||
|
||||
Selection s;
|
||||
s.in = g.in;
|
||||
@@ -911,7 +915,12 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
}
|
||||
panel_timeline->delete_areas_and_relink(ca, delete_areas);
|
||||
for (int i=0;i<panel_timeline->ghosts.size();i++) {
|
||||
sequence->clips.at(panel_timeline->ghosts[i].clip)->undeletable = false;
|
||||
const Ghost& g = panel_timeline->ghosts.at(i);
|
||||
sequence->clips.at(g.clip)->undeletable = false;
|
||||
if (g.transition != NULL) {
|
||||
g.transition->parent_clip->undeletable = false;
|
||||
g.transition->secondary_clip->undeletable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0;i<panel_timeline->ghosts.size();i++) {
|
||||
@@ -949,38 +958,41 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
} else {
|
||||
bool is_opening_transition = (g.transition == c->get_opening_transition());
|
||||
long new_transition_length = g.out - g.in;
|
||||
if (g.transition->secondary_clip != NULL) new_transition_length >>= 1;
|
||||
ca->append(new ModifyTransitionCommand(c, is_opening_transition ? TA_OPENING_TRANSITION : TA_CLOSING_TRANSITION, new_transition_length));
|
||||
|
||||
long clip_length = c->getLength();
|
||||
if (is_opening_transition) {
|
||||
if (g.in != g.old_in) {
|
||||
// if transition is going to make the clip bigger, make the clip bigger
|
||||
ca->append(new MoveClipAction(c, c->timeline_in + (g.in - g.old_in), c->timeline_out, c->clip_in + (g.clip_in - g.old_clip_in), c->track));
|
||||
clip_length -= (g.in - g.old_in);
|
||||
}
|
||||
if (g.transition->secondary_clip == NULL) {
|
||||
if (is_opening_transition) {
|
||||
if (g.in != g.old_in) {
|
||||
// if transition is going to make the clip bigger, make the clip bigger
|
||||
ca->append(new MoveClipAction(c, c->timeline_in + (g.in - g.old_in), c->timeline_out, c->clip_in + (g.clip_in - g.old_clip_in), c->track));
|
||||
clip_length -= (g.in - g.old_in);
|
||||
}
|
||||
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (new_transition_length == clip_length) {
|
||||
ca->append(new DeleteTransitionCommand(c, TA_CLOSING_TRANSITION));
|
||||
} else if (new_transition_length > clip_length - c->get_closing_transition()->length) {
|
||||
ca->append(new ModifyTransitionCommand(c, TA_CLOSING_TRANSITION, clip_length - new_transition_length));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (g.out != g.old_out) {
|
||||
// if transition is going to make the clip bigger, make the clip bigger
|
||||
ca->append(new MoveClipAction(c, c->timeline_in, c->timeline_out + (g.out - g.old_out), c->clip_in, c->track));
|
||||
clip_length += (g.out - g.old_out);
|
||||
}
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (new_transition_length == clip_length) {
|
||||
ca->append(new DeleteTransitionCommand(c, TA_CLOSING_TRANSITION));
|
||||
} else if (new_transition_length > clip_length - c->get_closing_transition()->length) {
|
||||
ca->append(new ModifyTransitionCommand(c, TA_CLOSING_TRANSITION, clip_length - new_transition_length));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (g.out != g.old_out) {
|
||||
// if transition is going to make the clip bigger, make the clip bigger
|
||||
ca->append(new MoveClipAction(c, c->timeline_in, c->timeline_out + (g.out - g.old_out), c->clip_in, c->track));
|
||||
clip_length += (g.out - g.old_out);
|
||||
}
|
||||
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (new_transition_length == clip_length) {
|
||||
ca->append(new DeleteTransitionCommand(c, TA_OPENING_TRANSITION));
|
||||
} else if (new_transition_length > clip_length - c->get_opening_transition()->length) {
|
||||
ca->append(new ModifyTransitionCommand(c, TA_OPENING_TRANSITION, clip_length - new_transition_length));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (new_transition_length == clip_length) {
|
||||
ca->append(new DeleteTransitionCommand(c, TA_OPENING_TRANSITION));
|
||||
} else if (new_transition_length > clip_length - c->get_opening_transition()->length) {
|
||||
ca->append(new ModifyTransitionCommand(c, TA_OPENING_TRANSITION, clip_length - new_transition_length));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1015,7 +1027,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
pre = post;
|
||||
post = temp;
|
||||
}
|
||||
ca->append(new AddTransitionCommand(pre, post, panel_timeline->transition_tool_meta, panel_timeline->transition_tool_type, transition_end - pre->timeline_in));
|
||||
ca->append(new AddTransitionCommand(pre, post, panel_timeline->transition_tool_meta, TA_OPENING_TRANSITION, transition_end - pre->timeline_in));
|
||||
} else {
|
||||
if (transition_start < c->timeline_in || transition_end > c->timeline_out) {
|
||||
// delete shit over there and extend timeline in
|
||||
@@ -1107,13 +1119,13 @@ void TimelineWidget::init_ghosts() {
|
||||
g.out = g.old_out = c->timeline_out;
|
||||
g.ghost_length = g.old_out - g.old_in;
|
||||
} else if (g.transition == c->get_opening_transition()) {
|
||||
g.in = g.old_in = c->timeline_in;
|
||||
g.out = g.old_out = c->timeline_in + c->get_opening_transition()->length;
|
||||
g.ghost_length = c->get_opening_transition()->length;
|
||||
g.in = g.old_in = c->get_timeline_in_with_transition();
|
||||
g.ghost_length = c->get_opening_transition()->get_length();
|
||||
g.out = g.old_out = g.in + g.ghost_length;
|
||||
} else if (g.transition == c->get_closing_transition()) {
|
||||
g.in = g.old_in = c->timeline_out - c->get_closing_transition()->length;
|
||||
g.out = g.old_out = c->timeline_out;
|
||||
g.ghost_length = c->get_closing_transition()->length;
|
||||
g.out = g.old_out = c->get_timeline_out_with_transition();
|
||||
g.ghost_length = c->get_closing_transition()->get_length();
|
||||
g.in = g.old_in = g.out - g.ghost_length;
|
||||
g.clip_in = g.old_clip_in = c->clip_in + c->getLength() - c->get_closing_transition()->length;
|
||||
}
|
||||
|
||||
@@ -1201,7 +1213,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// prevent clip length from being less than 1 frame long
|
||||
validator = g.ghost_length + frame_diff;
|
||||
@@ -1215,6 +1227,14 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
}
|
||||
}
|
||||
|
||||
// prevent dual transition from going below 0 on the secondary or media length on the primary
|
||||
if (g.transition != NULL && g.transition->secondary_clip != NULL) {
|
||||
validator = g.transition->secondary_clip->clip_in + frame_diff;
|
||||
if (validator > 0) frame_diff -= validator;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// ripple ops
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_RIPPLE) {
|
||||
for (int j=0;j<post_clips.size();j++) {
|
||||
@@ -1343,7 +1363,10 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
}
|
||||
|
||||
// apply changes
|
||||
if (g.trim_in) {
|
||||
if (g.transition != NULL && g.transition->secondary_clip != NULL) {
|
||||
g.in = g.old_in - ghost_diff;
|
||||
g.out = g.old_out + ghost_diff;
|
||||
} else if (g.trim_in) {
|
||||
g.in = g.old_in + ghost_diff;
|
||||
g.clip_in = g.old_clip_in + ghost_diff;
|
||||
} else {
|
||||
|
||||
+27
-26
@@ -247,10 +247,10 @@ GLuint ViewerWidget::draw_clip(QOpenGLFramebufferObject* fbo, GLuint texture, bo
|
||||
return fbo->texture();
|
||||
}
|
||||
|
||||
void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTextureCoords& coords, GLuint& composite_texture, bool& fbo_switcher) {
|
||||
void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTextureCoords& coords, GLuint& composite_texture, bool& fbo_switcher, int data) {
|
||||
if (e->is_enabled()) {
|
||||
if (e->enable_coords) {
|
||||
e->process_coords(timecode, coords);
|
||||
e->process_coords(timecode, coords, data);
|
||||
}
|
||||
if (e->enable_shader || e->enable_superimpose) {
|
||||
e->startEffect();
|
||||
@@ -264,7 +264,7 @@ void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTexture
|
||||
if (superimpose_texture != 0) composite_texture = draw_clip(c->fbo[!fbo_switcher], superimpose_texture, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int motion_blur_prog = 0;
|
||||
@@ -277,7 +277,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
if (!nests.isEmpty()) {
|
||||
for (int i=0;i<nests.size();i++) {
|
||||
s = static_cast<Sequence*>(nests.at(i)->media);
|
||||
playhead += nests.at(i)->clip_in - nests.at(i)->timeline_in;
|
||||
playhead += nests.at(i)->clip_in - nests.at(i)->get_timeline_in_with_transition();
|
||||
playhead = refactor_frame_number(playhead, nests.at(i)->sequence->frame_rate, s->frame_rate);
|
||||
}
|
||||
|
||||
@@ -353,14 +353,17 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
int half_width = s->width/2;
|
||||
int half_height = s->height/2;
|
||||
if (rendering || !nests.isEmpty()) half_height = -half_height; // invert vertical
|
||||
glPushMatrix();
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glLoadIdentity();
|
||||
glOrtho(-half_width, half_width, half_height, -half_height, -1, 1);
|
||||
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(-half_width, half_width, half_height, -half_height, -1, 1);
|
||||
|
||||
for (int i=0;i<current_clips.size();i++) {
|
||||
Clip* c = current_clips.at(i);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
Clip* c = current_clips.at(i);
|
||||
|
||||
if (c->media_type == MEDIA_TYPE_FOOTAGE && !c->finished_opening) {
|
||||
dout << "[WARNING] Tried to display clip" << i << "but it's closed";
|
||||
texture_failed = true;
|
||||
@@ -389,7 +392,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
if (textureID == 0 && c->media_type != MEDIA_TYPE_SOLID) {
|
||||
dout << "[WARNING] Texture hasn't been created yet";
|
||||
texture_failed = true;
|
||||
} else if (playhead >= c->timeline_in) {
|
||||
} else if (playhead >= c->get_timeline_in_with_transition()) {
|
||||
glPushMatrix();
|
||||
|
||||
// start preparing cache
|
||||
@@ -441,31 +444,29 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
coords.textureBottomLeftY = coords.textureBottomRightY = coords.textureTopRightX = coords.textureBottomRightX = 1.0;
|
||||
|
||||
if (c->autoscale && (video_width != s->width && video_height != s->height)) {
|
||||
double width_multiplier = (double) s->width / (double) video_width;
|
||||
double height_multiplier = (double) s->height / (double) video_height;
|
||||
double scale_multiplier = qMin(width_multiplier, height_multiplier);
|
||||
float width_multiplier = (float) s->width / (float) video_width;
|
||||
float height_multiplier = (float) s->height / (float) video_height;
|
||||
float scale_multiplier = qMin(width_multiplier, height_multiplier);
|
||||
glScalef(scale_multiplier, scale_multiplier, 1);
|
||||
}
|
||||
|
||||
// EFFECT CODE START
|
||||
double timecode = ((double)(playhead-c->timeline_in+c->clip_in)/(double)c->sequence->frame_rate);
|
||||
double timecode = ((double)(playhead-c->get_timeline_in_with_transition()+c->get_clip_in_with_transition())/(double)c->sequence->frame_rate);
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
process_effect(c, c->effects.at(j), timecode, coords, composite_texture, fbo_switcher);
|
||||
process_effect(c, c->effects.at(j), timecode, coords, composite_texture, fbo_switcher, TA_NO_TRANSITION);
|
||||
}
|
||||
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
int transition_progress = playhead - c->timeline_in;
|
||||
if (transition_progress < c->get_opening_transition()->length) {
|
||||
process_effect(c, c->get_opening_transition(), (double)transition_progress/(double)c->get_opening_transition()->length, coords, composite_texture, fbo_switcher);
|
||||
//c->opening_transition->process_transition((double)transition_progress/(double)c->opening_transition->length);
|
||||
int transition_progress = playhead - c->get_timeline_in_with_transition();
|
||||
if (transition_progress < c->get_opening_transition()->get_length()) {
|
||||
process_effect(c, c->get_opening_transition(), (double)transition_progress/(double)c->get_opening_transition()->get_length(), coords, composite_texture, fbo_switcher, TA_OPENING_TRANSITION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
int transition_progress = c->get_closing_transition()->length - (playhead - c->timeline_in - c->getLength() + c->get_closing_transition()->length);
|
||||
if (transition_progress < c->get_closing_transition()->length) {
|
||||
process_effect(c, c->get_closing_transition(), (double)transition_progress/(double)c->get_closing_transition()->length, coords, composite_texture, fbo_switcher);
|
||||
//c->closing_transition->process_transition((double)transition_progress/(double)c->closing_transition->length);
|
||||
int transition_progress = playhead - (c->get_timeline_out_with_transition() - c->get_closing_transition()->get_length());
|
||||
if (transition_progress >= 0 && transition_progress < c->get_closing_transition()->get_length()) {
|
||||
process_effect(c, c->get_closing_transition(), (double)transition_progress/(double)c->get_closing_transition()->get_length(), coords, composite_texture, fbo_switcher, TA_CLOSING_TRANSITION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,7 +575,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
|
||||
// visually update all the keyframe values
|
||||
if (c->sequence == viewer->seq) { // only if you can currently see them
|
||||
double ts = (playhead - c->timeline_in + c->clip_in)/s->frame_rate;
|
||||
double ts = (playhead - c->get_timeline_in_with_transition() + c->get_clip_in_with_transition())/s->frame_rate;
|
||||
for (int i=0;i<c->effects.size();i++) {
|
||||
Effect* e = c->effects.at(i);
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ private:
|
||||
void seek_from_click(int x);
|
||||
GLuint compose_sequence(QVector<Clip *> &nests, bool render_audio);
|
||||
GLuint draw_clip(QOpenGLFramebufferObject *clip, GLuint texture, bool clear);
|
||||
void process_effect(Clip* c, Effect* e, double timecode, GLTextureCoords& coords, GLuint& composite_texture, bool& fbo_switcher);
|
||||
void process_effect(Clip* c, Effect* e, double timecode, GLTextureCoords& coords, GLuint& composite_texture, bool& fbo_switcher, int data);
|
||||
private slots:
|
||||
void retry();
|
||||
void deleteFunction();
|
||||
|
||||
Reference in New Issue
Block a user