reveal in project, improved still detection and playback, fixed some ripple crashes
This commit is contained in:
+29
-3
@@ -239,7 +239,7 @@ void Project::get_all_media_from_table(QList<QTreeWidgetItem*> items, QList<QTre
|
||||
children.append(item->child(j));
|
||||
}
|
||||
get_all_media_from_table(children, list, search_type);
|
||||
} else if (search_type == type) {
|
||||
} else if (search_type == type || search_type == -1) {
|
||||
list.append(item);
|
||||
}
|
||||
}
|
||||
@@ -523,6 +523,31 @@ QTreeWidgetItem* Project::get_selected_folder() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Project::reveal_media(void *media, QTreeWidgetItem* parent) {
|
||||
int count = (parent == NULL) ? ui->treeWidget->topLevelItemCount() : parent->childCount();
|
||||
|
||||
for (int i=0;i<count;i++) {
|
||||
QTreeWidgetItem* item = (parent == NULL) ? ui->treeWidget->topLevelItem(i) : parent->child(i);
|
||||
if (get_type_from_tree(item) == MEDIA_TYPE_FOLDER) {
|
||||
if (reveal_media(media, item)) return true;
|
||||
} else if (get_media_from_tree(item) == media) {
|
||||
// expand all folders leading to this media
|
||||
QTreeWidgetItem* hierarchy = item->parent();
|
||||
while (hierarchy != NULL) {
|
||||
hierarchy->setExpanded(true);
|
||||
hierarchy = hierarchy->parent();
|
||||
}
|
||||
|
||||
// select item
|
||||
item->setSelected(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Project::import_dialog() {
|
||||
QFileDialog fd(this, "Import media...", "", "All Files (*)");
|
||||
fd.setFileMode(QFileDialog::ExistingFiles);
|
||||
@@ -538,13 +563,14 @@ void set_item_to_folder(QTreeWidgetItem* item) {
|
||||
}
|
||||
|
||||
void* get_media_from_tree(QTreeWidgetItem* item) {
|
||||
int type = get_type_from_tree(item);
|
||||
return reinterpret_cast<void*>(item->data(0, Qt::UserRole + 2).value<quintptr>());
|
||||
/*int type = get_type_from_tree(item);
|
||||
switch (type) {
|
||||
case MEDIA_TYPE_FOOTAGE: return get_footage_from_tree(item);
|
||||
case MEDIA_TYPE_SEQUENCE: return get_sequence_from_tree(item);
|
||||
default: qDebug() << "[ERROR] Invalid media type when retrieving media";
|
||||
}
|
||||
return NULL;
|
||||
return NULL;*/
|
||||
}
|
||||
|
||||
Media* get_footage_from_tree(QTreeWidgetItem* item) {
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
void process_file_list(bool recursive, QStringList& files, QTreeWidgetItem *parent, QTreeWidgetItem* replace);
|
||||
void replace_media(QTreeWidgetItem* item, QString filename);
|
||||
QTreeWidgetItem* get_selected_folder();
|
||||
bool reveal_media(void* media, QTreeWidgetItem *parent = 0);
|
||||
|
||||
void new_project();
|
||||
void load_project();
|
||||
|
||||
+36
-31
@@ -220,7 +220,7 @@ void Timeline::repaint_timeline() {
|
||||
if (sequence != NULL) {
|
||||
long sequenceEndFrame = sequence->getEndFrame();
|
||||
|
||||
panel_timeline->ui->horizontalScrollBar->setMaximum(qMax(0, getScreenPointFromFrame(panel_timeline->zoom, sequenceEndFrame) + 100 - ui->editAreas->width()));
|
||||
panel_timeline->ui->horizontalScrollBar->setMaximum(qMax(0, getScreenPointFromFrame(panel_timeline->zoom, sequenceEndFrame) - (ui->editAreas->width()/2)));
|
||||
|
||||
if (last_frame != sequence->playhead) {
|
||||
ui->audio_monitor->update();
|
||||
@@ -267,21 +267,21 @@ void Timeline::delete_in_out(bool ripple) {
|
||||
}
|
||||
}
|
||||
|
||||
void Timeline::delete_selection(bool ripple_delete) {
|
||||
if (sequence->selections.size() > 0) {
|
||||
void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_delete) {
|
||||
if (selections.size() > 0) {
|
||||
panel_effect_controls->clear_effects(true);
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
delete_areas_and_relink(ca, sequence->selections);
|
||||
delete_areas_and_relink(ca, selections);
|
||||
|
||||
if (ripple_delete) {
|
||||
long ripple_point = sequence->selections.at(0).in;
|
||||
long ripple_length = sequence->selections.at(0).out - sequence->selections.at(0).in;
|
||||
if (ripple_delete) {
|
||||
long ripple_point = selections.at(0).in;
|
||||
long ripple_length = selections.at(0).out - selections.at(0).in;
|
||||
|
||||
// retrieve ripple_point and ripple_length from current selection
|
||||
for (int i=1;i<sequence->selections.size();i++) {
|
||||
const Selection& s = sequence->selections.at(i);
|
||||
for (int i=1;i<selections.size();i++) {
|
||||
const Selection& s = selections.at(i);
|
||||
ripple_point = qMin(ripple_point, s.in);
|
||||
ripple_length = qMin(ripple_length, s.out - s.in);
|
||||
}
|
||||
@@ -295,8 +295,8 @@ void Timeline::delete_selection(bool ripple_delete) {
|
||||
if (c != NULL && c->timeline_in < ripple_point && c->timeline_out > ripple_point) {
|
||||
// conflict detected, but this clip may be getting deleted so let's check
|
||||
bool deleted = false;
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
for (int j=0;j<selections.size();j++) {
|
||||
const Selection& s = selections.at(j);
|
||||
if (s.track == c->track
|
||||
&& !(c->timeline_in < s.in && c->timeline_out < s.in)
|
||||
&& !(c->timeline_in > s.out && c->timeline_out > s.out)) {
|
||||
@@ -317,10 +317,13 @@ void Timeline::delete_selection(bool ripple_delete) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "going to ripple at" << ripple_point << "by" << ripple_length;
|
||||
|
||||
if (can_ripple) ca->append(new RippleCommand(sequence, ripple_point, -ripple_length));
|
||||
}
|
||||
|
||||
sequence->selections.clear();
|
||||
selections.clear();
|
||||
|
||||
undo_stack.push(ca);
|
||||
|
||||
@@ -617,7 +620,7 @@ void Timeline::copy(bool del) {
|
||||
}
|
||||
|
||||
if (del && copied) {
|
||||
delete_selection(false);
|
||||
delete_selection(sequence->selections, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -703,24 +706,26 @@ void Timeline::ripple_to_in_point(bool in) {
|
||||
long in_point = in ? 0 : LONG_MAX;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
track_min = qMin(track_min, c->track);
|
||||
track_max = qMax(track_max, c->track);
|
||||
if ((in && c->timeline_in > in_point && c->timeline_in <= sequence->playhead)
|
||||
|| (!in && c->timeline_in < in_point && c->timeline_in >= sequence->playhead)) {
|
||||
in_point = c->timeline_in;
|
||||
if (sequence->playhead == in_point) {
|
||||
one_frame_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((in && c->timeline_out > in_point && c->timeline_out <= sequence->playhead)
|
||||
|| (!in && c->timeline_out < in_point && c->timeline_out > sequence->playhead)) {
|
||||
in_point = c->timeline_out;
|
||||
if (sequence->playhead == in_point) {
|
||||
one_frame_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (c != NULL) {
|
||||
track_min = qMin(track_min, c->track);
|
||||
track_max = qMax(track_max, c->track);
|
||||
if ((in && c->timeline_in > in_point && c->timeline_in <= sequence->playhead)
|
||||
|| (!in && c->timeline_in < in_point && c->timeline_in >= sequence->playhead)) {
|
||||
in_point = c->timeline_in;
|
||||
if (sequence->playhead == in_point) {
|
||||
one_frame_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((in && c->timeline_out > in_point && c->timeline_out <= sequence->playhead)
|
||||
|| (!in && c->timeline_out < in_point && c->timeline_out > sequence->playhead)) {
|
||||
in_point = c->timeline_out;
|
||||
if (sequence->playhead == in_point) {
|
||||
one_frame_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (one_frame_mode) {
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ public:
|
||||
bool selecting;
|
||||
int selection_offset;
|
||||
bool is_clip_selected(Clip* clip, bool containing);
|
||||
void delete_selection(bool ripple);
|
||||
void delete_selection(QVector<Selection> &selections, bool ripple);
|
||||
void select_all();
|
||||
bool rect_select_init;
|
||||
bool rect_select_proc;
|
||||
|
||||
+5
-3
@@ -181,7 +181,7 @@ QString frame_to_timecode(long f, int view, double frame_rate) {
|
||||
// non-drop timecode
|
||||
|
||||
int int_fps = qRound(frame_rate);
|
||||
hours = f/ (3600 * int_fps);
|
||||
hours = f / (3600 * int_fps);
|
||||
mins = f / (60*int_fps) % 60;
|
||||
secs = f/int_fps % 60;
|
||||
frames = f%int_fps;
|
||||
@@ -327,11 +327,13 @@ void Viewer::set_media(int type, void* media) {
|
||||
seq->workarea_in = footage->in;
|
||||
seq->workarea_out = footage->out;
|
||||
|
||||
seq->frame_rate = 30;
|
||||
|
||||
if (footage->video_tracks.size() > 0) {
|
||||
MediaStream* video_stream = footage->video_tracks.at(0);
|
||||
seq->width = video_stream->video_width;
|
||||
seq->height = video_stream->video_height;
|
||||
if (video_stream->video_frame_rate > 0) seq->frame_rate = video_stream->video_frame_rate;
|
||||
if (video_stream->video_frame_rate > 0 && !video_stream->infinite_length) seq->frame_rate = video_stream->video_frame_rate;
|
||||
|
||||
Clip* c = new Clip(seq);
|
||||
c->media = footage;
|
||||
@@ -339,6 +341,7 @@ void Viewer::set_media(int type, void* media) {
|
||||
c->media_stream = video_stream->file_index;
|
||||
c->timeline_in = 0;
|
||||
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
||||
if (c->timeline_out <= 0) c->timeline_out = 150;
|
||||
c->track = -1;
|
||||
c->clip_in = 0;
|
||||
c->recalculateMaxLength();
|
||||
@@ -346,7 +349,6 @@ void Viewer::set_media(int type, void* media) {
|
||||
} else {
|
||||
seq->width = 1920;
|
||||
seq->height = 1080;
|
||||
seq->frame_rate = 30;
|
||||
}
|
||||
|
||||
if (footage->audio_tracks.size() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user