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
+19 -5
View File
@@ -1441,22 +1441,28 @@ bool Timeline::snap_to_timeline(long* l, bool use_playhead, bool use_markers, bo
} }
void Timeline::set_marker() { void Timeline::set_marker() {
// add_marker is used to determine whether we're adding a marker, depending on whether the user input a 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; bool add_marker = !config.set_name_with_marker;
QString marker_name;
std::vector<Clip*> clips_selected; // determine if any clips are selected, and if so add markers to clips rather than the sequence
QVector<Clip*> clips_selected;
bool clip_mode = false; 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)
&& sequence->playhead >= c->timeline_in
&& sequence->playhead <= c->timeline_out) {
clips_selected.append(c);
clip_mode = true; clip_mode = true;
} }
} }
ComboAction* ca = new ComboAction(); QString marker_name;
// if (config.set_name_with_marker) is false (set above), ask for a marker name
if (!add_marker) { if (!add_marker) {
QInputDialog d(this); QInputDialog d(this);
d.setWindowTitle(tr("Set Marker")); d.setWindowTitle(tr("Set Marker"));
@@ -1466,19 +1472,27 @@ void Timeline::set_marker() {
marker_name = d.textValue(); marker_name = d.textValue();
} }
// if we've decided to add a marker
if (add_marker) { if (add_marker) {
ComboAction* ca = new ComboAction();
// add an action for each clip
foreach (Clip* c, clips_selected) { foreach (Clip* c, clips_selected) {
ca->append(new AddMarkerAction(false, ca->append(new AddMarkerAction(false,
c, c,
sequence->playhead - c->timeline_in + c->clip_in, sequence->playhead - c->timeline_in + c->clip_in,
marker_name)); marker_name));
} }
// if no clips are selected, we're adding a marker to the sequence // if no clips are selected, we're adding a marker to the sequence
if (!clip_mode) { if (!clip_mode) {
ca->append(new AddMarkerAction(true, sequence, sequence->playhead, marker_name)); ca->append(new AddMarkerAction(true, sequence, sequence->playhead, marker_name));
} }
// push action
undo_stack.push(ca); undo_stack.push(ca);
// redraw timeline
repaint_timeline(); repaint_timeline();
} }
} }
-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