This commit is contained in:
itsmattkc
2019-02-02 12:39:54 +11:00
parent a21b7e5eb3
commit ce99c8fef0
2 changed files with 56 additions and 44 deletions
+56 -42
View File
@@ -1426,14 +1426,14 @@ bool Timeline::snap_to_timeline(long* l, bool use_playhead, bool use_markers, bo
} else if (c->get_closing_transition() != nullptr } else if (c->get_closing_transition() != nullptr
&& snap_to_point(c->timeline_out - c->get_closing_transition()->get_true_length(), l)) { && snap_to_point(c->timeline_out - c->get_closing_transition()->get_true_length(), l)) {
return true; return true;
} else { } else {
// try to snap to clip markers // try to snap to clip markers
for (int j=0;j<c->markers.size();j++) { for (int j=0;j<c->markers.size();j++) {
if (snap_to_point(c->markers.at(j).frame + c->timeline_in - c->clip_in, l)) { if (snap_to_point(c->markers.at(j).frame + c->timeline_in - c->clip_in, l)) {
return true; return true;
} }
} }
} }
} }
} }
} }
@@ -1441,46 +1441,60 @@ bool Timeline::snap_to_timeline(long* l, bool use_playhead, bool use_markers, bo
} }
void Timeline::set_marker() { void Timeline::set_marker() {
bool add_marker = !config.set_name_with_marker; // add_marker is used to determine whether we're adding a marker, depending on whether the user input a marker name
QString marker_name; // however if (config.set_name_with_marker) is true, we don't need a marker name so we just add
bool add_marker = !config.set_name_with_marker;
std::vector<Clip*> clips_selected; // determine if any clips are selected, and if so add markers to clips rather than the sequence
bool clip_mode = false; QVector<Clip*> clips_selected;
bool clip_mode = false;
for (int i=0;i<sequence->clips.size();i++) { for (int i=0;i<sequence->clips.size();i++) {
Clip* c = sequence->clips.at(i); Clip* c = sequence->clips.at(i);
if (c != nullptr && is_clip_selected(c, true)) { if (c != nullptr
clips_selected.push_back(c); && is_clip_selected(c, true)
clip_mode=true; && sequence->playhead >= c->timeline_in
} && sequence->playhead <= c->timeline_out) {
} clips_selected.append(c);
clip_mode = true;
}
}
ComboAction* ca = new ComboAction(); QString marker_name;
if (!add_marker) { // if (config.set_name_with_marker) is false (set above), ask for a marker name
QInputDialog d(this); if (!add_marker) {
d.setWindowTitle(tr("Set Marker")); QInputDialog d(this);
d.setLabelText(clip_mode? tr("Set clip marker name:"): tr("Set sequence marker name:")); d.setWindowTitle(tr("Set Marker"));
d.setInputMode(QInputDialog::TextInput); d.setLabelText(clip_mode? tr("Set clip marker name:"): tr("Set sequence marker name:"));
add_marker = (d.exec() == QDialog::Accepted); d.setInputMode(QInputDialog::TextInput);
marker_name = d.textValue(); add_marker = (d.exec() == QDialog::Accepted);
} marker_name = d.textValue();
}
if (add_marker) { // if we've decided to add a marker
foreach (Clip* c, clips_selected){ if (add_marker) {
ca->append(new AddMarkerAction(false, ComboAction* ca = new ComboAction();
c,
sequence->playhead - c->timeline_in + c->clip_in,
marker_name));
}
// if no clips are selected, we're adding a marker to the sequence
if (!clip_mode) {
ca->append(new AddMarkerAction(true, sequence, sequence->playhead, marker_name));
}
undo_stack.push(ca); // add an action for each clip
repaint_timeline(); foreach (Clip* c, clips_selected) {
} ca->append(new AddMarkerAction(false,
c,
sequence->playhead - c->timeline_in + c->clip_in,
marker_name));
}
// if no clips are selected, we're adding a marker to the sequence
if (!clip_mode) {
ca->append(new AddMarkerAction(true, sequence, sequence->playhead, marker_name));
}
// push action
undo_stack.push(ca);
// redraw timeline
repaint_timeline();
}
} }
void Timeline::toggle_links() { void Timeline::toggle_links() {
-2
View File
@@ -513,8 +513,6 @@ GLuint compose_sequence(ComposeSequenceParams &params) {
full_blit(); full_blit();
// glColor4f(1.0, 1.0, 1.0, 1.0);
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0); params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0);
} else { } else {
// load background texture into texture unit 0 // load background texture into texture unit 0