Discussion:
[CinCVS] "Divide clip" tool & "drag on empty track"?
Jarno Elonen
2005-08-14 12:35:46 UTC
Permalink
Hi,

Is there a tool/command to divide all active clips in two at the selection
point? This is probably the one tool I most miss in Cinelerra.
Actually, I'm a programmer so if it's really missing and you think it's a good
idea, I might try and implement it myself.

The other feature that I'm missing is dragging clips around on an empty track
(matte effects' target track etc). I realize you could add an empty clip and
resize it, but that seems somewhat cumbersome.

- Jarno
Heikki Repo
2005-08-14 18:27:48 UTC
Permalink
Post by Jarno Elonen
Hi,
Is there a tool/command to divide all active clips in two at the selection
point? This is probably the one tool I most miss in Cinelerra.
Actually, I'm a programmer so if it's really missing and you think it's a good
idea, I might try and implement it myself.
Hi Jarno! No, unfortunately there is no such feature. However,
implementing one would really help :)
Post by Jarno Elonen
The other feature that I'm missing is dragging clips around on an empty track
(matte effects' target track etc). I realize you could add an empty clip and
resize it, but that seems somewhat cumbersome.
- Jarno
As far as I know, there is a patch for that. But it hasn't been
committed to cvs. Why, I don't know the reason.

But really nice to see more people capable and willing to make cinelerra
better to join the ranks, as there are so many of those like me, who
aren't able to help in any other way but by filling bug reports... :(

-- Heikki
Jarno Elonen
2005-08-15 07:23:01 UTC
Permalink
[Divide clip tool]
No, unfortunately there is no such feature. However,
implementing one would really help :)
All right, the code below almost works, except that Cinelerra is too smart and
merges the clips back together immediately after the divide. Any ideas how to
defeat that behavior and/or where it happens?

One dirty hack that again *almost* works is to replace

edl->clear(position,
end, [...]

with

edl->clear(position - 0.0001,
end, [...]

...but this of course shifts the timeline a bit and if you make the shift much
smaller, Cinelerra again notices that it doesn't actually make any difference
and proceeds with the merge trick again.

----------

void MWindow::divide_clip()
{
double position = edl->local_session->get_selectionstart();

// Find current clip boundaries
Label *current;
double start = 0, end = edl->tracks->total_length();
for(current = edl->labels->first; current; current = NEXT)
{
if(current->position > position)
{
end = current->position;
break;
}
}
for(current = edl->labels->last ; current; current = PREVIOUS)
{
if(current->position <= position)
{
start = current->position;
break;
}
}

if(!EQUIV(end, start) && !EQUIV(position, start) && !EQUIV(position, end))
{
undo->update_undo_before(_("divide"), LOAD_EDITS | LOAD_TIMEBAR);

FileXML file;
edl->copy(position,
end,
0,
0,
0,
&file,
plugindb,
"",
1);

edl->clear(position,
end,
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits);

insert(position,
&file,
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits,
edl);

edl->optimize();
save_backup();
undo->update_undo_after();

restart_brender();
update_plugin_guis();
gui->update(1, 2, 1, 1, 1, 1, 0);
cwindow->playback_engine->que->send_command(CURRENT_FRAME,
CHANGE_EDL,
edl,
1);
}
}

- Jarno
Johannes Sixt
2005-08-15 19:55:06 UTC
Permalink
Post by Jarno Elonen
[Divide clip tool]
No, unfortunately there is no such feature. However,
implementing one would really help :)
All right, the code below almost works, except that Cinelerra is too smart
and merges the clips back together immediately after the divide. Any ideas
how to defeat that behavior and/or where it happens?
That's exactly why the operation did not exist in the first place ;)
Have you tried not to call edl->optimize() - that's the function that contains
the unwanted smartness? Except that the next operation will very likely call
optimize() and again merge the tracks...

For this kind of operation I usually select one frame (using the controls
below the time line) or more and hit x (aka Edit Cut) or shift-space (Edit
Paste silence). Except that this does not split effects, though.

-- Hannes
Jarno Elonen
2005-08-15 21:02:13 UTC
Permalink
Post by Johannes Sixt
That's exactly why the operation did not exist in the first place ;)
Have you tried not to call edl->optimize() - that's the function that
contains the unwanted smartness? Except that the next operation will very
likely call optimize() and again merge the tracks...
Mmm.. and that would be very confusing. :\

Would there be any bad side effects if that "optimization" feature was
removed?

I think the divide tool (which is very popular in other NLEs) would be
immensely more productive than the automatic merging: in the rare case where
you might want to merge previously split clips, you could now just double
click the last part, hit delete and drag the right side of the the first part
to expand it.

That's more than fast enough way to do a very infrequently needed operation,
IMO.

- Jarno

Loading...