2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-01-12 19:02:08 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-01-12 19:02:08 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation, 2003-2009
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_sequencer/sequencer_edit.c
|
|
|
|
* \ingroup spseq
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
#include <unistd.h>
|
|
|
|
#else
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
#include "BLI_threads.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-10-26 17:32:50 +00:00
|
|
|
#include "BLF_translation.h"
|
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
|
|
|
#include "BKE_global.h"
|
2010-08-13 14:23:44 +00:00
|
|
|
#include "BKE_main.h"
|
2009-12-13 14:56:45 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2009-01-23 23:14:02 +00:00
|
|
|
#include "BKE_report.h"
|
2009-08-09 21:16:39 +00:00
|
|
|
#include "BKE_sound.h"
|
2012-03-22 13:22:28 +00:00
|
|
|
#include "BKE_movieclip.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-02-29 12:08:26 +00:00
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
#include "WM_api.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "WM_types.h"
|
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
#include "RNA_define.h"
|
2011-04-01 08:51:12 +00:00
|
|
|
#include "RNA_enum_types.h"
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
|
|
|
/* for menu/popup icons etc etc*/
|
|
|
|
|
|
|
|
#include "ED_screen.h"
|
2009-07-08 16:17:47 +00:00
|
|
|
#include "ED_transform.h"
|
2009-12-14 21:42:25 +00:00
|
|
|
#include "ED_sequencer.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
|
|
/* own include */
|
|
|
|
#include "sequencer_intern.h"
|
|
|
|
|
|
|
|
/* XXX */
|
2009-01-26 09:13:15 +00:00
|
|
|
/* RNA Enums, used in multiple files */
|
|
|
|
EnumPropertyItem sequencer_prop_effect_types[] = {
|
2012-06-07 15:49:02 +00:00
|
|
|
{SEQ_TYPE_CROSS, "CROSS", 0, "Crossfade", "Crossfade effect strip type"},
|
|
|
|
{SEQ_TYPE_ADD, "ADD", 0, "Add", "Add effect strip type"},
|
|
|
|
{SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", "Subtract effect strip type"},
|
|
|
|
{SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", "Alpha Over effect strip type"},
|
|
|
|
{SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", "Alpha Under effect strip type"},
|
|
|
|
{SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", "Gamma Cross effect strip type"},
|
|
|
|
{SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", "Multiply effect strip type"},
|
|
|
|
{SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Alpha Over Drop", "Alpha Over Drop effect strip type"},
|
|
|
|
{SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", "Wipe effect strip type"},
|
|
|
|
{SEQ_TYPE_GLOW, "GLOW", 0, "Glow", "Glow effect strip type"},
|
|
|
|
{SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"},
|
|
|
|
{SEQ_TYPE_COLOR, "COLOR", 0, "Color", "Color effect strip type"},
|
|
|
|
{SEQ_TYPE_SPEED, "SPEED", 0, "Speed", "Color effect strip type"},
|
|
|
|
{SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
|
|
|
|
{SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
|
2009-06-16 00:52:21 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
2009-01-26 09:13:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* mute operator */
|
|
|
|
|
2009-12-15 10:04:54 +00:00
|
|
|
EnumPropertyItem prop_side_types[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""},
|
|
|
|
{SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
|
|
|
|
{SEQ_SIDE_BOTH, "BOTH", 0, "Both", ""},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
2009-01-31 09:58:38 +00:00
|
|
|
};
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static EnumPropertyItem prop_side_lr_types[] = {
|
2009-12-15 10:04:54 +00:00
|
|
|
{SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""},
|
|
|
|
{SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
typedef struct TransSeq {
|
|
|
|
int start, machine;
|
|
|
|
int startstill, endstill;
|
|
|
|
int startdisp, enddisp;
|
|
|
|
int startofs, endofs;
|
2011-07-05 16:31:21 +00:00
|
|
|
int anim_startofs, anim_endofs;
|
2011-06-11 17:05:20 +00:00
|
|
|
/* int final_left, final_right; */ /* UNUSED */
|
2009-01-12 19:02:08 +00:00
|
|
|
int len;
|
|
|
|
} TransSeq;
|
|
|
|
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
/* ********************************************************************** */
|
|
|
|
|
|
|
|
/* ***************** proxy job manager ********************** */
|
|
|
|
|
|
|
|
typedef struct ProxyBuildJob {
|
|
|
|
Scene *scene;
|
2012-03-29 22:26:11 +00:00
|
|
|
struct Main *main;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
ListBase queue;
|
2012-02-29 12:08:26 +00:00
|
|
|
int stop;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
} ProxyJob;
|
|
|
|
|
|
|
|
static void proxy_freejob(void *pjv)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
ProxyJob *pj = pjv;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
2012-02-29 12:08:26 +00:00
|
|
|
BLI_freelistN(&pj->queue);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
|
|
|
MEM_freeN(pj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* only this runs inside thread */
|
|
|
|
static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
|
|
|
|
{
|
|
|
|
ProxyJob *pj = pjv;
|
2012-02-29 12:08:26 +00:00
|
|
|
LinkData *link;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
2012-02-29 12:08:26 +00:00
|
|
|
for (link = pj->queue.first; link; link = link->next) {
|
|
|
|
struct SeqIndexBuildContext *context = link->data;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_proxy_rebuild(context, stop, do_update, progress);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*stop) {
|
2012-02-29 12:08:26 +00:00
|
|
|
pj->stop = 1;
|
|
|
|
fprintf(stderr, "Canceling proxy rebuild on users request...\n");
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-23 08:41:13 +00:00
|
|
|
static void proxy_endjob(void *pjv)
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
{
|
2012-02-23 08:41:13 +00:00
|
|
|
ProxyJob *pj = pjv;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(pj->scene, FALSE);
|
2012-02-29 12:08:26 +00:00
|
|
|
LinkData *link;
|
|
|
|
|
|
|
|
for (link = pj->queue.first; link; link = link->next) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_proxy_rebuild_finish(link->data, pj->stop);
|
2012-02-29 12:08:26 +00:00
|
|
|
}
|
2012-02-23 08:41:13 +00:00
|
|
|
|
2012-09-14 14:28:24 +00:00
|
|
|
BKE_sequencer_free_imbuf(pj->scene, &ed->seqbase, FALSE);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
}
|
|
|
|
|
2012-02-29 12:08:26 +00:00
|
|
|
static void seq_proxy_build_job(const bContext *C)
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
{
|
2012-08-15 10:03:29 +00:00
|
|
|
wmJob *wm_job;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
ProxyJob *pj;
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2012-03-29 22:26:11 +00:00
|
|
|
ScrArea *sa = CTX_wm_area(C);
|
2012-02-29 12:08:26 +00:00
|
|
|
struct SeqIndexBuildContext *context;
|
|
|
|
LinkData *link;
|
2012-03-29 22:26:11 +00:00
|
|
|
Sequence *seq;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
2012-08-15 10:03:29 +00:00
|
|
|
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies",
|
|
|
|
WM_JOB_PROGRESS, WM_JOB_TYPE_SEQ_BUILD_PROXY);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
2012-08-15 10:03:29 +00:00
|
|
|
pj = WM_jobs_customdata_get(wm_job);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
|
|
|
if (!pj) {
|
|
|
|
pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
pj->scene = scene;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
pj->main = CTX_data_main(C);
|
|
|
|
|
2012-08-15 10:03:29 +00:00
|
|
|
WM_jobs_customdata_set(wm_job, pj, proxy_freejob);
|
|
|
|
WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
|
|
|
|
WM_jobs_callbacks(wm_job, proxy_startjob, NULL, NULL, proxy_endjob);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
}
|
|
|
|
|
2012-04-30 16:22:40 +00:00
|
|
|
SEQP_BEGIN (ed, seq)
|
|
|
|
{
|
2012-02-29 12:08:26 +00:00
|
|
|
if ((seq->flag & SELECT)) {
|
2012-08-08 11:15:40 +00:00
|
|
|
context = BKE_sequencer_proxy_rebuild_context(pj->main, pj->scene, seq);
|
2012-02-29 12:08:26 +00:00
|
|
|
link = BLI_genericNodeN(context);
|
|
|
|
BLI_addtail(&pj->queue, link);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SEQ_END
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
2012-08-15 10:03:29 +00:00
|
|
|
if (!WM_jobs_is_running(wm_job)) {
|
2012-08-08 18:37:06 +00:00
|
|
|
G.is_break = FALSE;
|
2012-08-15 10:03:29 +00:00
|
|
|
WM_jobs_start(CTX_wm_manager(C), wm_job);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ED_area_tag_redraw(CTX_wm_area(C));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************************************************************** */
|
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
void seq_rectf(Sequence *seq, rctf *rectf)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->startstill) rectf->xmin = seq->start;
|
2012-03-24 02:51:46 +00:00
|
|
|
else rectf->xmin = seq->startdisp;
|
2012-03-29 22:26:11 +00:00
|
|
|
rectf->ymin = seq->machine + SEQ_STRIP_OFSBOTTOM;
|
|
|
|
if (seq->endstill) rectf->xmax = seq->start + seq->len;
|
2012-03-24 02:51:46 +00:00
|
|
|
else rectf->xmax = seq->enddisp;
|
2012-03-29 22:26:11 +00:00
|
|
|
rectf->ymax = seq->machine + SEQ_STRIP_OFSTOP;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void boundbox_seq(Scene *scene, rctf *rect)
|
|
|
|
{
|
|
|
|
Sequence *seq;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
float min[2], max[2];
|
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
min[0] = 0.0;
|
|
|
|
max[0] = EFRA + 1;
|
|
|
|
min[1] = 0.0;
|
|
|
|
max[1] = 8.0;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = ed->seqbasep->first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (min[0] > seq->startdisp - 1) min[0] = seq->startdisp - 1;
|
|
|
|
if (max[0] < seq->enddisp + 1) max[0] = seq->enddisp + 1;
|
|
|
|
if (max[1] < seq->machine + 2) max[1] = seq->machine + 2;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = seq->next;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
rect->xmin = min[0];
|
|
|
|
rect->xmax = max[0];
|
|
|
|
rect->ymin = min[1];
|
|
|
|
rect->ymax = max[1];
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
static int mouse_frame_side(View2D *v2d, short mouse_x, int frame)
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
{
|
2011-05-12 16:47:36 +00:00
|
|
|
int mval[2];
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
float mouseloc[2];
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
mval[0] = mouse_x;
|
|
|
|
mval[1] = 0;
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
|
|
|
/* choose the side based on which side of the playhead the mouse is on */
|
|
|
|
UI_view2d_region_to_view(v2d, mval[0], mval[1], &mouseloc[0], &mouseloc[1]);
|
|
|
|
|
2009-02-15 17:24:09 +00:00
|
|
|
return mouseloc[0] > frame ? SEQ_SIDE_RIGHT : SEQ_SIDE_LEFT;
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int sel)
|
|
|
|
{
|
2009-02-15 17:24:09 +00:00
|
|
|
/* sel - 0==unselected, 1==selected, -1==done care*/
|
2009-01-12 19:02:08 +00:00
|
|
|
Sequence *seq;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return NULL;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (sel > 0) sel = SELECT;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
|
|
|
if ((seq != test) &&
|
|
|
|
(test->machine == seq->machine) &&
|
|
|
|
((sel == -1) || (sel && (seq->flag & SELECT)) || (sel == 0 && (seq->flag & SELECT) == 0) ))
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
switch (lr) {
|
2012-03-29 22:26:11 +00:00
|
|
|
case SEQ_SIDE_LEFT:
|
|
|
|
if (test->startdisp == (seq->enddisp)) {
|
|
|
|
return seq;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SEQ_SIDE_RIGHT:
|
|
|
|
if (test->enddisp == (seq->startdisp)) {
|
|
|
|
return seq;
|
|
|
|
}
|
|
|
|
break;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2009-02-15 17:24:09 +00:00
|
|
|
/* sel - 0==unselected, 1==selected, -1==done care*/
|
2012-03-29 22:26:11 +00:00
|
|
|
Sequence *seq, *best_seq = NULL;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
int dist, best_dist;
|
2012-03-29 22:26:11 +00:00
|
|
|
best_dist = MAXFRAME * 2;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return NULL;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = ed->seqbasep->first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2012-03-29 22:26:11 +00:00
|
|
|
if ((seq != test) &&
|
|
|
|
(test->machine == seq->machine) &&
|
|
|
|
(test->depth == seq->depth) &&
|
|
|
|
((sel == -1) || (sel == (seq->flag & SELECT))))
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
dist = MAXFRAME * 2;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
switch (lr) {
|
2012-03-29 22:26:11 +00:00
|
|
|
case SEQ_SIDE_LEFT:
|
|
|
|
if (seq->enddisp <= test->startdisp) {
|
|
|
|
dist = test->enddisp - seq->startdisp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SEQ_SIDE_RIGHT:
|
|
|
|
if (seq->startdisp >= test->enddisp) {
|
|
|
|
dist = seq->startdisp - test->enddisp;
|
|
|
|
}
|
|
|
|
break;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (dist == 0) {
|
2009-01-12 19:02:08 +00:00
|
|
|
best_seq = seq;
|
|
|
|
break;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (dist < best_dist) {
|
2009-01-12 19:02:08 +00:00
|
|
|
best_dist = dist;
|
|
|
|
best_seq = seq;
|
|
|
|
}
|
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = seq->next;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
return best_seq; /* can be null */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2])
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
float x, y;
|
|
|
|
float pixelx;
|
|
|
|
float handsize;
|
|
|
|
float displen;
|
2012-03-29 22:26:11 +00:00
|
|
|
*hand = SEQ_SIDE_NONE;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return NULL;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = ed->seqbasep->first;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
|
|
|
if (seq->machine == (int)y) {
|
2009-01-12 19:02:08 +00:00
|
|
|
/* check for both normal strips, and strips that have been flipped horizontally */
|
2012-09-09 00:00:21 +00:00
|
|
|
if (((seq->startdisp < seq->enddisp) && (seq->startdisp <= x && seq->enddisp >= x)) ||
|
|
|
|
((seq->startdisp > seq->enddisp) && (seq->startdisp >= x && seq->enddisp <= x)) )
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_tx_test(seq)) {
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
/* clamp handles to defined size in pixel space */
|
|
|
|
|
|
|
|
handsize = seq->handsize;
|
|
|
|
displen = (float)abs(seq->startdisp - seq->enddisp);
|
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
if (displen / pixelx > 16) { /* don't even try to grab the handles of small strips */
|
2009-01-12 19:02:08 +00:00
|
|
|
/* Set the max value to handle to 1/3 of the total len when its less then 28.
|
2012-03-03 16:31:46 +00:00
|
|
|
* This is important because otherwise selecting handles happens even when you click in the middle */
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if ((displen / 3) < 30 * pixelx) {
|
|
|
|
handsize = displen / 3;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-29 22:26:11 +00:00
|
|
|
CLAMP(handsize, 7 * pixelx, 30 * pixelx);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (handsize + seq->startdisp >= x)
|
|
|
|
*hand = SEQ_SIDE_LEFT;
|
|
|
|
else if (-handsize + seq->enddisp <= x)
|
|
|
|
*hand = SEQ_SIDE_RIGHT;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return seq;
|
|
|
|
}
|
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = seq->next;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2011-04-03 10:04:16 +00:00
|
|
|
return NULL;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int seq_is_parent(Sequence *par, Sequence *seq)
|
|
|
|
{
|
|
|
|
return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int seq_is_predecessor(Sequence *pred, Sequence *seq)
|
|
|
|
{
|
|
|
|
if (!pred) return 0;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (pred == seq) return 0;
|
|
|
|
else if (seq_is_parent(pred, seq)) return 1;
|
|
|
|
else if (pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
|
|
|
|
else if (pred->seq2 && seq_is_predecessor(pred->seq2, seq)) return 1;
|
|
|
|
else if (pred->seq3 && seq_is_predecessor(pred->seq3, seq)) return 1;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-05-29 05:45:06 +00:00
|
|
|
void ED_sequencer_deselect_all(Scene *scene)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-04-30 16:22:40 +00:00
|
|
|
SEQP_BEGIN (ed, seq)
|
|
|
|
{
|
2010-06-24 10:04:18 +00:00
|
|
|
seq->flag &= ~SEQ_ALLSEL;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
SEQ_END
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
void recurs_sel_seq(Sequence *seqm)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = seqm->seqbase.first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (seqm->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL;
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (seqm->flag & SELECT) seq->flag |= SELECT;
|
2010-06-24 10:04:18 +00:00
|
|
|
else seq->flag &= ~SEQ_ALLSEL;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->seqbase.first) recurs_sel_seq(seq);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = seq->next;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-24 09:53:29 +00:00
|
|
|
int ED_space_sequencer_maskedit_mask_poll(bContext *C)
|
|
|
|
{
|
|
|
|
/* in this case both funcs are the same, for clip editor not */
|
|
|
|
return ED_space_sequencer_maskedit_poll(C);
|
|
|
|
}
|
|
|
|
|
|
|
|
int ED_space_sequencer_check_show_maskedit(SpaceSeq *sseq, Scene *scene)
|
|
|
|
{
|
|
|
|
if (sseq && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
|
|
|
|
return (BKE_sequencer_mask_get(scene) != NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ED_space_sequencer_maskedit_poll(bContext *C)
|
|
|
|
{
|
|
|
|
SpaceSeq *sseq = CTX_wm_space_seq(C);
|
|
|
|
|
|
|
|
if (sseq) {
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
return ED_space_sequencer_check_show_maskedit(sseq, scene);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-12-17 04:44:39 +00:00
|
|
|
/* are we displaying the seq output (not channels or histogram)*/
|
|
|
|
int ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq)
|
|
|
|
{
|
|
|
|
return (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW) &&
|
|
|
|
ELEM(sseq->mainb, SEQ_DRAW_SEQUENCE, SEQ_DRAW_IMG_IMBUF));
|
|
|
|
}
|
|
|
|
|
2010-12-03 17:05:21 +00:00
|
|
|
int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, const char **error_str)
|
2009-01-20 14:19:39 +00:00
|
|
|
{
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2012-03-29 22:26:11 +00:00
|
|
|
Sequence *seq1 = NULL, *seq2 = NULL, *seq3 = NULL, *seq;
|
2009-01-20 14:19:39 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
*error_str = NULL;
|
2009-01-26 09:13:15 +00:00
|
|
|
|
2009-01-20 14:19:39 +00:00
|
|
|
if (!activeseq)
|
2012-05-11 10:04:55 +00:00
|
|
|
seq2 = BKE_sequencer_active_get(scene);
|
2009-01-20 14:19:39 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SELECT) {
|
2012-08-08 11:15:40 +00:00
|
|
|
if (seq->type == SEQ_TYPE_SOUND_RAM && BKE_sequence_effect_get_num_inputs(type) != 0) {
|
2012-10-26 17:32:50 +00:00
|
|
|
*error_str = N_("Cannot apply effects to audio sequence strips");
|
2009-01-20 14:19:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((seq != activeseq) && (seq != seq2)) {
|
2012-03-29 22:26:11 +00:00
|
|
|
if (seq2 == NULL) seq2 = seq;
|
|
|
|
else if (seq1 == NULL) seq1 = seq;
|
|
|
|
else if (seq3 == NULL) seq3 = seq;
|
|
|
|
else {
|
2012-10-26 17:32:50 +00:00
|
|
|
*error_str = N_("Cannot apply effect to more than 3 sequence strips");
|
2012-03-29 22:26:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2009-01-20 14:19:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-04-21 13:11:51 +00:00
|
|
|
|
2009-01-20 14:19:39 +00:00
|
|
|
/* make sequence selection a little bit more intuitive
|
2012-03-03 16:31:46 +00:00
|
|
|
* for 3 strips: the last-strip should be sequence3 */
|
2011-04-03 10:04:16 +00:00
|
|
|
if (seq3 != NULL && seq2 != NULL) {
|
2009-01-20 14:19:39 +00:00
|
|
|
Sequence *tmp = seq2;
|
|
|
|
seq2 = seq3;
|
|
|
|
seq3 = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
switch (BKE_sequence_effect_get_num_inputs(type)) {
|
2012-03-29 22:26:11 +00:00
|
|
|
case 0:
|
|
|
|
*selseq1 = *selseq2 = *selseq3 = NULL;
|
|
|
|
return 1; /* succsess */
|
|
|
|
case 1:
|
|
|
|
if (seq2 == NULL) {
|
2012-10-26 17:32:50 +00:00
|
|
|
*error_str = N_("At least one selected sequence strip is needed");
|
2012-03-29 22:26:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (seq1 == NULL) seq1 = seq2;
|
|
|
|
if (seq3 == NULL) seq3 = seq2;
|
|
|
|
case 2:
|
|
|
|
if (seq1 == NULL || seq2 == NULL) {
|
2012-10-26 17:32:50 +00:00
|
|
|
*error_str = N_("2 selected sequence strips are needed");
|
2012-03-29 22:26:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (seq3 == NULL) seq3 = seq2;
|
2009-01-20 14:19:39 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (seq1 == NULL && seq2 == NULL && seq3 == NULL) {
|
2012-10-26 17:32:50 +00:00
|
|
|
*error_str = N_("TODO: in what cases does this happen?");
|
2009-01-26 09:13:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2009-01-20 14:19:39 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
*selseq1 = seq1;
|
|
|
|
*selseq2 = seq2;
|
|
|
|
*selseq3 = seq3;
|
2009-01-20 14:19:39 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq)
|
|
|
|
{
|
|
|
|
Sequence *seq1, *seq2, *seq3;
|
|
|
|
|
|
|
|
/* try to find a replacement input sequence, and flag for later deletion if
|
2012-03-03 16:31:46 +00:00
|
|
|
* no replacement can be found */
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!seq)
|
2009-01-12 19:02:08 +00:00
|
|
|
return NULL;
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (!(seq->type & SEQ_TYPE_EFFECT))
|
2012-03-29 22:26:11 +00:00
|
|
|
return ((seq->flag & SELECT) ? NULL : seq);
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (!(seq->flag & SELECT)) {
|
2009-01-12 19:02:08 +00:00
|
|
|
/* try to find replacement for effect inputs */
|
2012-03-29 22:26:11 +00:00
|
|
|
seq1 = del_seq_find_replace_recurs(scene, seq->seq1);
|
|
|
|
seq2 = del_seq_find_replace_recurs(scene, seq->seq2);
|
|
|
|
seq3 = del_seq_find_replace_recurs(scene, seq->seq3);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-10-07 09:48:59 +00:00
|
|
|
if (seq1 == seq->seq1 && seq2 == seq->seq2 && seq3 == seq->seq3) {
|
|
|
|
/* pass */
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (seq1 || seq2 || seq3) {
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->seq1 = (seq1) ? seq1 : (seq2) ? seq2 : seq3;
|
|
|
|
seq->seq2 = (seq2) ? seq2 : (seq1) ? seq1 : seq3;
|
|
|
|
seq->seq3 = (seq3) ? seq3 : (seq1) ? seq1 : seq2;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_changed_seq_and_deps(scene, seq, 1, 1);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
else
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->flag |= SELECT; /* mark for delete */
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (seq->flag & SELECT) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((seq1 = del_seq_find_replace_recurs(scene, seq->seq1))) return seq1;
|
|
|
|
if ((seq2 = del_seq_find_replace_recurs(scene, seq->seq2))) return seq2;
|
|
|
|
if ((seq3 = del_seq_find_replace_recurs(scene, seq->seq3))) return seq3;
|
2009-01-12 19:02:08 +00:00
|
|
|
else return NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return seq;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short deleteall)
|
|
|
|
{
|
|
|
|
Sequence *seq, *seqn;
|
2012-05-11 10:04:55 +00:00
|
|
|
Sequence *last_seq = BKE_sequencer_active_get(scene);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = lb->first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2012-03-29 22:26:11 +00:00
|
|
|
seqn = seq->next;
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((seq->flag & flag) || deleteall) {
|
2009-01-12 19:02:08 +00:00
|
|
|
BLI_remlink(lb, seq);
|
2012-05-11 10:04:55 +00:00
|
|
|
if (seq == last_seq) BKE_sequencer_active_set(scene, NULL);
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
|
2012-09-06 09:23:38 +00:00
|
|
|
BKE_sequence_free(scene, seq);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = seqn;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
TransSeq ts;
|
2011-04-03 10:04:16 +00:00
|
|
|
Sequence *seqn = NULL;
|
2009-01-12 19:02:08 +00:00
|
|
|
int skip_dup = FALSE;
|
|
|
|
|
|
|
|
/* backup values */
|
2012-03-29 22:26:11 +00:00
|
|
|
ts.start = seq->start;
|
|
|
|
ts.machine = seq->machine;
|
|
|
|
ts.startstill = seq->startstill;
|
|
|
|
ts.endstill = seq->endstill;
|
|
|
|
ts.startdisp = seq->startdisp;
|
|
|
|
ts.enddisp = seq->enddisp;
|
|
|
|
ts.startofs = seq->startofs;
|
|
|
|
ts.endofs = seq->endofs;
|
|
|
|
ts.anim_startofs = seq->anim_startofs;
|
|
|
|
ts.anim_endofs = seq->anim_endofs;
|
|
|
|
ts.len = seq->len;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
/* First Strip! */
|
|
|
|
/* strips with extended stillfames before */
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if ((seq->startstill) && (cutframe < seq->start)) {
|
2009-01-12 19:02:08 +00:00
|
|
|
/* don't do funny things with METAs ... */
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
2009-01-12 19:02:08 +00:00
|
|
|
skip_dup = TRUE;
|
|
|
|
seq->startstill = seq->start - cutframe;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->start = cutframe - 1;
|
|
|
|
seq->startstill = cutframe - seq->startdisp - 1;
|
2009-01-12 19:02:08 +00:00
|
|
|
seq->anim_endofs += seq->len - 1;
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->endstill = 0;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* normal strip */
|
2012-03-29 22:26:11 +00:00
|
|
|
else if ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seq->endofs = 0;
|
|
|
|
seq->endstill = 0;
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->anim_endofs += (seq->start + seq->len) - cutframe;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
/* strips with extended stillframes after */
|
2012-03-29 22:26:11 +00:00
|
|
|
else if (((seq->start + seq->len) < cutframe) && (seq->endstill)) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seq->endstill -= seq->enddisp - cutframe;
|
|
|
|
/* don't do funny things with METAs ... */
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
2009-01-12 19:02:08 +00:00
|
|
|
skip_dup = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_reload_new_file(scene, seq, FALSE);
|
|
|
|
BKE_sequence_calc(scene, seq);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
if (!skip_dup) {
|
|
|
|
/* Duplicate AFTER the first change */
|
2012-08-08 11:15:40 +00:00
|
|
|
seqn = BKE_sequence_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2012-10-21 05:46:41 +00:00
|
|
|
if (seqn) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->flag |= SELECT;
|
|
|
|
|
|
|
|
/* Second Strip! */
|
|
|
|
/* strips with extended stillframes before */
|
|
|
|
if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
|
|
|
|
seqn->start = ts.start;
|
2012-03-29 22:26:11 +00:00
|
|
|
seqn->startstill = ts.start - cutframe;
|
2011-07-05 16:31:21 +00:00
|
|
|
seqn->anim_endofs = ts.anim_endofs;
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->endstill = ts.endstill;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* normal strip */
|
2012-03-29 22:26:11 +00:00
|
|
|
else if ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->start = cutframe;
|
|
|
|
seqn->startstill = 0;
|
|
|
|
seqn->startofs = 0;
|
2011-07-05 16:31:21 +00:00
|
|
|
seqn->endofs = ts.endofs;
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->anim_startofs += cutframe - ts.start;
|
2011-07-05 16:31:21 +00:00
|
|
|
seqn->anim_endofs = ts.anim_endofs;
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->endstill = ts.endstill;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
/* strips with extended stillframes after */
|
2012-03-29 22:26:11 +00:00
|
|
|
else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->start = cutframe;
|
|
|
|
seqn->startofs = 0;
|
2012-03-29 22:26:11 +00:00
|
|
|
seqn->anim_startofs += ts.len - 1;
|
|
|
|
seqn->endstill = ts.enddisp - cutframe - 1;
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->startstill = 0;
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_reload_new_file(scene, seqn, FALSE);
|
|
|
|
BKE_sequence_calc(scene, seqn);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
return seqn;
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
TransSeq ts;
|
2011-04-03 10:04:16 +00:00
|
|
|
Sequence *seqn = NULL;
|
2009-01-12 19:02:08 +00:00
|
|
|
int skip_dup = FALSE;
|
|
|
|
|
|
|
|
/* backup values */
|
2012-03-29 22:26:11 +00:00
|
|
|
ts.start = seq->start;
|
|
|
|
ts.machine = seq->machine;
|
|
|
|
ts.startstill = seq->startstill;
|
|
|
|
ts.endstill = seq->endstill;
|
|
|
|
ts.startdisp = seq->startdisp;
|
|
|
|
ts.enddisp = seq->enddisp;
|
|
|
|
ts.startofs = seq->startofs;
|
|
|
|
ts.endofs = seq->endofs;
|
|
|
|
ts.anim_startofs = seq->anim_startofs;
|
|
|
|
ts.anim_endofs = seq->anim_endofs;
|
|
|
|
ts.len = seq->len;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
/* First Strip! */
|
|
|
|
/* strips with extended stillfames before */
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if ((seq->startstill) && (cutframe < seq->start)) {
|
2009-01-12 19:02:08 +00:00
|
|
|
/* don't do funny things with METAs ... */
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
2009-01-12 19:02:08 +00:00
|
|
|
skip_dup = TRUE;
|
|
|
|
seq->startstill = seq->start - cutframe;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->start = cutframe - 1;
|
|
|
|
seq->startstill = cutframe - seq->startdisp - 1;
|
2009-01-12 19:02:08 +00:00
|
|
|
seq->endofs = seq->len - 1;
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->endstill = 0;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* normal strip */
|
2012-03-29 22:26:11 +00:00
|
|
|
else if ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) {
|
|
|
|
seq->endofs = (seq->start + seq->len) - cutframe;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
/* strips with extended stillframes after */
|
2012-03-29 22:26:11 +00:00
|
|
|
else if (((seq->start + seq->len) < cutframe) && (seq->endstill)) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seq->endstill -= seq->enddisp - cutframe;
|
|
|
|
/* don't do funny things with METAs ... */
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
2009-01-12 19:02:08 +00:00
|
|
|
skip_dup = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
if (!skip_dup) {
|
|
|
|
/* Duplicate AFTER the first change */
|
2012-08-08 11:15:40 +00:00
|
|
|
seqn = BKE_sequence_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2012-10-21 05:46:41 +00:00
|
|
|
if (seqn) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->flag |= SELECT;
|
|
|
|
|
|
|
|
/* Second Strip! */
|
|
|
|
/* strips with extended stillframes before */
|
|
|
|
if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
|
|
|
|
seqn->start = ts.start;
|
2012-03-29 22:26:11 +00:00
|
|
|
seqn->startstill = ts.start - cutframe;
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->endofs = ts.endofs;
|
|
|
|
seqn->endstill = ts.endstill;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* normal strip */
|
2012-03-29 22:26:11 +00:00
|
|
|
else if ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->startstill = 0;
|
|
|
|
seqn->startofs = cutframe - ts.start;
|
|
|
|
seqn->endofs = ts.endofs;
|
|
|
|
seqn->endstill = ts.endstill;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
/* strips with extended stillframes after */
|
2012-03-29 22:26:11 +00:00
|
|
|
else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) {
|
|
|
|
seqn->start = cutframe - ts.len + 1;
|
|
|
|
seqn->startofs = ts.len - 1;
|
|
|
|
seqn->endstill = ts.enddisp - cutframe - 1;
|
2009-01-12 19:02:08 +00:00
|
|
|
seqn->startstill = 0;
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seqn);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
return seqn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* like duplicate, but only duplicate and cut overlapping strips,
|
|
|
|
* strips to the left of the cutframe are ignored and strips to the right are moved into the new list */
|
2010-10-16 08:03:28 +00:00
|
|
|
static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe,
|
2012-03-29 22:26:11 +00:00
|
|
|
Sequence * (*cut_seq)(Scene *, Sequence *, int))
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
int did_something = FALSE;
|
2010-12-03 12:30:59 +00:00
|
|
|
Sequence *seq, *seq_next_iter;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = old->first;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2010-12-03 12:30:59 +00:00
|
|
|
seq_next_iter = seq->next; /* we need this because we may remove seq */
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->tmp = NULL;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SELECT) {
|
|
|
|
if (cutframe > seq->startdisp &&
|
2012-03-29 22:26:11 +00:00
|
|
|
cutframe < seq->enddisp)
|
|
|
|
{
|
|
|
|
Sequence *seqn = cut_seq(scene, seq, cutframe);
|
2009-01-12 19:02:08 +00:00
|
|
|
if (seqn) {
|
|
|
|
BLI_addtail(new, seqn);
|
|
|
|
}
|
|
|
|
did_something = TRUE;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (seq->enddisp <= cutframe) {
|
2009-01-12 19:02:08 +00:00
|
|
|
/* do nothing */
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (seq->startdisp >= cutframe) {
|
2009-01-12 19:02:08 +00:00
|
|
|
/* move into new list */
|
|
|
|
BLI_remlink(old, seq);
|
|
|
|
BLI_addtail(new, seq);
|
|
|
|
}
|
|
|
|
}
|
2010-12-03 12:30:59 +00:00
|
|
|
seq = seq_next_iter;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
return did_something;
|
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static int insert_gap(Scene *scene, int gap, int cfra)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2012-05-19 13:28:19 +00:00
|
|
|
int done = FALSE;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
/* all strips >= cfra are shifted */
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return 0;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-04-30 16:22:40 +00:00
|
|
|
SEQP_BEGIN (ed, seq)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->startdisp >= cfra) {
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->start += gap;
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2012-05-19 13:28:19 +00:00
|
|
|
done = TRUE;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
SEQ_END
|
|
|
|
|
|
|
|
return done;
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
static void UNUSED_FUNCTION(touch_seq_files) (Scene * scene)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
char str[256];
|
|
|
|
|
|
|
|
/* touch all strips with movies */
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-24 07:52:14 +00:00
|
|
|
// XXX25 if (okee("Touch and print selected movies")==0) return;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2011-08-15 16:18:04 +00:00
|
|
|
WM_cursor_wait(1);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-04-30 16:22:40 +00:00
|
|
|
SEQP_BEGIN (ed, seq)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SELECT) {
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_MOVIE) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->strip && seq->strip->stripdata) {
|
2010-10-18 06:41:16 +00:00
|
|
|
BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name);
|
2011-10-22 15:35:49 +00:00
|
|
|
BLI_file_touch(seq->name);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SEQ_END
|
|
|
|
|
2011-08-15 16:18:04 +00:00
|
|
|
WM_cursor_wait(0);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2012-03-03 16:31:46 +00:00
|
|
|
#if 0
|
2010-10-16 08:03:28 +00:00
|
|
|
static void set_filter_seq(Scene *scene)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (okee("Set Deinterlace") == 0) return;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-04-30 16:22:40 +00:00
|
|
|
SEQP_BEGIN (ed, seq)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SELECT) {
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_MOVIE) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seq->flag |= SEQ_FILTERY;
|
2010-10-16 08:03:28 +00:00
|
|
|
reload_sequence_new_file(scene, seq, FALSE);
|
2010-05-08 16:36:28 +00:00
|
|
|
calc_sequence(scene, seq);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SEQ_END
|
|
|
|
}
|
2012-03-03 16:31:46 +00:00
|
|
|
#endif
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
static void UNUSED_FUNCTION(seq_remap_paths) (Scene * scene)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2012-05-11 10:04:55 +00:00
|
|
|
Sequence *seq, *last_seq = BKE_sequencer_active_get(scene);
|
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX];
|
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (last_seq == NULL)
|
2009-01-12 19:02:08 +00:00
|
|
|
return;
|
|
|
|
|
2011-10-19 23:10:54 +00:00
|
|
|
BLI_strncpy(from, last_seq->strip->dir, sizeof(from));
|
2012-05-25 09:51:53 +00:00
|
|
|
// XXX if (0 == sbutton(from, 0, sizeof(from)-1, "From: "))
|
2009-01-12 19:02:08 +00:00
|
|
|
// return;
|
|
|
|
|
2011-10-19 23:10:54 +00:00
|
|
|
BLI_strncpy(to, from, sizeof(to));
|
2012-05-25 09:51:53 +00:00
|
|
|
// XXX if (0 == sbutton(to, 0, sizeof(to)-1, "To: "))
|
2009-01-12 19:02:08 +00:00
|
|
|
// return;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (strcmp(to, from) == 0)
|
2009-01-12 19:02:08 +00:00
|
|
|
return;
|
|
|
|
|
2012-04-30 16:22:40 +00:00
|
|
|
SEQP_BEGIN (ed, seq)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SELECT) {
|
2012-03-29 22:26:11 +00:00
|
|
|
if (strncmp(seq->strip->dir, from, strlen(from)) == 0) {
|
2009-01-12 19:02:08 +00:00
|
|
|
printf("found %s\n", seq->strip->dir);
|
|
|
|
|
|
|
|
/* strip off the beginning */
|
2012-03-29 22:26:11 +00:00
|
|
|
stripped[0] = 0;
|
2009-01-12 19:02:08 +00:00
|
|
|
BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX);
|
|
|
|
|
|
|
|
/* new path */
|
2011-02-13 03:21:27 +00:00
|
|
|
BLI_snprintf(seq->strip->dir, sizeof(seq->strip->dir), "%s%s", to, stripped);
|
2009-01-12 19:02:08 +00:00
|
|
|
printf("new %s\n", seq->strip->dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SEQ_END
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
static void UNUSED_FUNCTION(no_gaps) (Scene * scene)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2012-03-29 22:26:11 +00:00
|
|
|
int cfra, first = 0, done;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (cfra = CFRA; cfra <= EFRA; cfra++) {
|
|
|
|
if (first == 0) {
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequencer_evaluate_frame(scene, cfra) ) first = 1;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-05-19 13:28:19 +00:00
|
|
|
done = TRUE;
|
2012-08-08 11:15:40 +00:00
|
|
|
while (BKE_sequencer_evaluate_frame(scene, cfra) == 0) {
|
2012-03-29 22:26:11 +00:00
|
|
|
done = insert_gap(scene, -1, cfra);
|
|
|
|
if (done == 0) break;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
if (done == 0) break;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
#if 0
|
2009-01-12 19:02:08 +00:00
|
|
|
static int seq_get_snaplimit(View2D *v2d)
|
|
|
|
{
|
|
|
|
/* fake mouse coords to get the snap value
|
2012-03-03 16:31:46 +00:00
|
|
|
* a bit lazy but its only done once pre transform */
|
2009-01-12 19:02:08 +00:00
|
|
|
float xmouse, ymouse, x;
|
2011-05-12 16:47:36 +00:00
|
|
|
int mval[2] = {24, 0}; /* 24 screen px snap */
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
UI_view2d_region_to_view(v2d, mval[0], mval[1], &xmouse, &ymouse);
|
|
|
|
x = xmouse;
|
|
|
|
mval[0] = 0;
|
|
|
|
UI_view2d_region_to_view(v2d, mval[0], mval[1], &xmouse, &ymouse);
|
|
|
|
return (int)(x - xmouse);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-06-09 21:29:59 +00:00
|
|
|
/* Operator functions */
|
2010-05-06 07:19:55 +00:00
|
|
|
int sequencer_edit_poll(bContext *C)
|
|
|
|
{
|
2012-05-11 10:04:55 +00:00
|
|
|
return (BKE_sequencer_editing_get(CTX_data_scene(C), FALSE) != NULL);
|
2010-05-06 07:19:55 +00:00
|
|
|
}
|
|
|
|
|
2012-04-23 07:32:13 +00:00
|
|
|
#if 0 /* UNUSED */
|
2011-08-12 06:08:22 +00:00
|
|
|
int sequencer_strip_poll(bContext *C)
|
|
|
|
{
|
|
|
|
Editing *ed;
|
2012-05-11 10:04:55 +00:00
|
|
|
return (((ed = BKE_sequencer_editing_get(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL));
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
2012-04-23 07:32:13 +00:00
|
|
|
#endif
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
int sequencer_strip_has_path_poll(bContext *C)
|
|
|
|
{
|
|
|
|
Editing *ed;
|
|
|
|
Sequence *seq;
|
2012-05-11 10:04:55 +00:00
|
|
|
return (((ed = BKE_sequencer_editing_get(CTX_data_scene(C), FALSE)) != NULL) && ((seq = ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq)));
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
|
|
|
|
2010-07-08 10:03:29 +00:00
|
|
|
int sequencer_view_poll(bContext *C)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
SpaceSeq *sseq = CTX_wm_space_seq(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(CTX_data_scene(C), FALSE);
|
2010-07-08 10:03:29 +00:00
|
|
|
if (ed && sseq && (sseq->mainb == SEQ_DRAW_IMG_IMBUF))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2009-06-09 21:29:59 +00:00
|
|
|
|
|
|
|
/* snap operator*/
|
|
|
|
static int sequencer_snap_exec(bContext *C, wmOperator *op)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2009-06-09 21:29:59 +00:00
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
Sequence *seq;
|
2009-06-09 21:29:59 +00:00
|
|
|
int snap_frame;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
snap_frame = RNA_int_get(op->ptr, "frame");
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
/* also check metas */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
|
|
|
if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK) &&
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_tx_test(seq))
|
2012-03-29 22:26:11 +00:00
|
|
|
{
|
|
|
|
if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) {
|
2010-11-09 04:56:52 +00:00
|
|
|
/* simple but no anim update */
|
2012-10-26 04:14:10 +00:00
|
|
|
/* seq->start = snap_frame-seq->startofs+seq->startstill; */
|
2010-11-09 04:56:52 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_translate(scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (seq->flag & SEQ_LEFTSEL) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_tx_set_final_left(seq, snap_frame);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else { /* SEQ_RIGHTSEL */
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_tx_set_final_right(seq, snap_frame);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_tx_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-29 19:40:45 +00:00
|
|
|
/* test for effects and overlap
|
2012-03-18 07:38:51 +00:00
|
|
|
* don't use SEQP_BEGIN since that would be recursive */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
|
|
|
if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK)) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seq->flag &= ~SEQ_OVERLAP;
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_test_overlap(ed->seqbasep, seq) ) {
|
|
|
|
BKE_sequence_base_shuffle(ed->seqbasep, seq, scene);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (seq->type & SEQ_TYPE_EFFECT) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->seq1 && (seq->seq1->flag & SELECT))
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (seq->seq2 && (seq->seq2->flag & SELECT))
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (seq->seq3 && (seq->seq3->flag & SELECT))
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* as last: */
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_sort(scene);
|
2009-06-09 21:29:59 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-06-09 21:29:59 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2009-06-09 21:29:59 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
|
|
|
int snap_frame;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
snap_frame = CFRA;
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2009-06-09 21:29:59 +00:00
|
|
|
RNA_int_set(op->ptr, "frame", snap_frame);
|
|
|
|
return sequencer_snap_exec(C, op);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2009-06-09 21:29:59 +00:00
|
|
|
void SEQUENCER_OT_snap(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Snap strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_snap";
|
|
|
|
ot->description = "Frame where selected strips will be snapped";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-06-09 21:29:59 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = sequencer_snap_invoke;
|
|
|
|
ot->exec = sequencer_snap_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-06-09 21:29:59 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-06-09 21:29:59 +00:00
|
|
|
|
2009-09-12 17:16:12 +00:00
|
|
|
RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be snapped", INT_MIN, INT_MAX);
|
2009-06-09 21:29:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mute operator */
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
static int sequencer_mute_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
Sequence *seq;
|
|
|
|
int selected;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
selected = !RNA_boolean_get(op->ptr, "unselected");
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
|
|
|
if ((seq->flag & SEQ_LOCK) == 0) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (selected) { /* mute unselected */
|
2012-09-13 10:51:18 +00:00
|
|
|
if (seq->flag & SELECT) {
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
seq->flag |= SEQ_MUTE;
|
2012-10-04 18:30:28 +00:00
|
|
|
BKE_sequence_invalidate_dependent(scene, seq);
|
2012-09-13 10:51:18 +00:00
|
|
|
}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-09-13 10:51:18 +00:00
|
|
|
if ((seq->flag & SELECT) == 0) {
|
2009-01-12 19:02:08 +00:00
|
|
|
seq->flag |= SEQ_MUTE;
|
2012-10-04 18:30:28 +00:00
|
|
|
BKE_sequence_invalidate_dependent(scene, seq);
|
2012-09-13 10:51:18 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_muting(ed);
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
void SEQUENCER_OT_mute(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Mute Strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_mute";
|
|
|
|
ot->description = "Mute selected strips";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_mute_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
2011-09-19 12:26:20 +00:00
|
|
|
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Mute unselected rather than selected strips");
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* unmute operator */
|
|
|
|
static int sequencer_unmute_exec(bContext *C, wmOperator *op)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-12 19:02:08 +00:00
|
|
|
Sequence *seq;
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
int selected;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
selected = !RNA_boolean_get(op->ptr, "unselected");
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
|
|
|
if ((seq->flag & SEQ_LOCK) == 0) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (selected) { /* unmute unselected */
|
2012-09-13 10:51:18 +00:00
|
|
|
if (seq->flag & SELECT) {
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
seq->flag &= ~SEQ_MUTE;
|
2012-10-04 18:30:28 +00:00
|
|
|
BKE_sequence_invalidate_dependent(scene, seq);
|
2012-09-13 10:51:18 +00:00
|
|
|
}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-09-13 10:51:18 +00:00
|
|
|
if ((seq->flag & SELECT) == 0) {
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
seq->flag &= ~SEQ_MUTE;
|
2012-10-04 18:30:28 +00:00
|
|
|
BKE_sequence_invalidate_dependent(scene, seq);
|
2012-09-13 10:51:18 +00:00
|
|
|
}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_muting(ed);
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Un-Mute Strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_unmute";
|
|
|
|
ot->description = "Un-Mute unselected rather than selected strips";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_unmute_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
2011-09-19 12:26:20 +00:00
|
|
|
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "UnMute unselected rather than selected strips");
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* lock operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-25 14:53:41 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-25 14:53:41 +00:00
|
|
|
Sequence *seq;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2009-01-25 14:53:41 +00:00
|
|
|
if (seq->flag & SELECT) {
|
|
|
|
seq->flag |= SEQ_LOCK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_lock(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Lock Strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_lock";
|
|
|
|
ot->description = "Lock the active strip so that it can't be transformed";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_lock_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* unlock operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-25 14:53:41 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-25 14:53:41 +00:00
|
|
|
Sequence *seq;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2009-01-25 14:53:41 +00:00
|
|
|
if (seq->flag & SELECT) {
|
|
|
|
seq->flag &= ~SEQ_LOCK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "UnLock Strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_unlock";
|
|
|
|
ot->description = "Unlock the active strip so that it can't be transformed";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_unlock_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* reload operator */
|
2012-03-26 22:26:30 +00:00
|
|
|
static int sequencer_reload_exec(bContext *C, wmOperator *op)
|
2009-01-25 14:53:41 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-25 14:53:41 +00:00
|
|
|
Sequence *seq;
|
2012-03-29 22:26:11 +00:00
|
|
|
int adjust_length = RNA_boolean_get(op->ptr, "adjust_length");
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SELECT) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_changed_seq_and_deps(scene, seq, 0, 1);
|
|
|
|
BKE_sequence_reload_new_file(scene, seq, !adjust_length);
|
2012-03-26 22:26:30 +00:00
|
|
|
|
|
|
|
if (adjust_length) {
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_test_overlap(ed->seqbasep, seq))
|
|
|
|
BKE_sequence_base_shuffle(ed->seqbasep, seq, scene);
|
2012-03-26 22:26:30 +00:00
|
|
|
}
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_reload(struct wmOperatorType *ot)
|
|
|
|
{
|
2012-03-26 22:26:30 +00:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Reload Strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_reload";
|
|
|
|
ot->description = "Reload strips in the sequencer";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_reload_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */
|
2012-03-26 13:48:45 +00:00
|
|
|
|
2012-04-14 15:44:31 +00:00
|
|
|
prop = RNA_def_boolean(ot->srna, "adjust_length", 0, "Adjust Length",
|
2012-05-16 14:25:25 +00:00
|
|
|
"Adjust length of strips to their data length");
|
2012-03-26 22:26:30 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
2012-03-26 13:48:45 +00:00
|
|
|
}
|
|
|
|
|
2012-03-26 22:26:30 +00:00
|
|
|
/* reload operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-25 14:53:41 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-09-14 14:28:24 +00:00
|
|
|
BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Refresh Sequencer";
|
|
|
|
ot->idname = "SEQUENCER_OT_refresh_all";
|
|
|
|
ot->description = "Refresh the sequencer editor";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_refresh_all_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
|
|
|
|
2010-07-03 22:25:22 +00:00
|
|
|
static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Sequence *seq1, *seq2, *seq3, *last_seq = BKE_sequencer_active_get(scene);
|
2010-12-03 17:05:21 +00:00
|
|
|
const char *error_msg;
|
2010-07-03 22:25:22 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
|
2010-07-03 22:25:22 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, error_msg);
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
/* see reassigning would create a cycle */
|
2012-03-29 22:26:11 +00:00
|
|
|
if (seq_is_predecessor(seq1, last_seq) ||
|
|
|
|
seq_is_predecessor(seq2, last_seq) ||
|
2012-05-20 19:49:27 +00:00
|
|
|
seq_is_predecessor(seq3, last_seq))
|
|
|
|
{
|
2012-10-26 17:32:50 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: no cycles allowed");
|
2010-07-03 22:25:22 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
last_seq->seq1 = seq1;
|
|
|
|
last_seq->seq2 = seq2;
|
|
|
|
last_seq->seq3 = seq3;
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_changed_seq_and_deps(scene, last_seq, 1, 1);
|
2010-07-03 22:25:22 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2010-07-03 22:25:22 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static int sequencer_effect_poll(bContext *C)
|
2010-07-03 22:25:22 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2010-07-03 22:25:22 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ed) {
|
2012-05-11 10:04:55 +00:00
|
|
|
Sequence *last_seq = BKE_sequencer_active_get(scene);
|
2012-06-07 15:49:02 +00:00
|
|
|
if (last_seq && (last_seq->type & SEQ_TYPE_EFFECT)) {
|
2010-07-03 22:25:22 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Reassign Inputs";
|
|
|
|
ot->idname = "SEQUENCER_OT_reassign_inputs";
|
|
|
|
ot->description = "Reassign the inputs for the effect strip";
|
2010-07-03 22:25:22 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_reassign_inputs_exec;
|
|
|
|
ot->poll = sequencer_effect_poll;
|
2010-07-03 22:25:22 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2010-07-03 22:25:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-30 12:04:00 +00:00
|
|
|
static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Sequence *seq, *last_seq = BKE_sequencer_active_get(scene);
|
2010-10-30 12:04:00 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (last_seq->seq1 == NULL || last_seq->seq2 == NULL) {
|
2010-10-30 12:04:00 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap");
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
seq = last_seq->seq1;
|
|
|
|
last_seq->seq1 = last_seq->seq2;
|
|
|
|
last_seq->seq2 = seq;
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_changed_seq_and_deps(scene, last_seq, 1, 1);
|
2010-10-30 12:04:00 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2010-10-30 12:04:00 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Swap Inputs";
|
|
|
|
ot->idname = "SEQUENCER_OT_swap_inputs";
|
|
|
|
ot->description = "Swap the first two inputs for the effect strip";
|
2010-10-30 12:04:00 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_swap_inputs_exec;
|
|
|
|
ot->poll = sequencer_effect_poll;
|
2010-10-30 12:04:00 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2010-10-30 12:04:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
/* cut operator */
|
|
|
|
static EnumPropertyItem prop_cut_types[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{SEQ_CUT_SOFT, "SOFT", 0, "Soft", ""},
|
|
|
|
{SEQ_CUT_HARD, "HARD", 0, "Hard", ""},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int sequencer_cut_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
int cut_side, cut_hard, cut_frame;
|
|
|
|
|
|
|
|
ListBase newlist;
|
|
|
|
int changed;
|
2009-01-28 22:36:34 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
cut_frame = RNA_int_get(op->ptr, "frame");
|
|
|
|
cut_hard = RNA_enum_get(op->ptr, "type");
|
|
|
|
cut_side = RNA_enum_get(op->ptr, "side");
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
newlist.first = newlist.last = NULL;
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (cut_hard == SEQ_CUT_HARD) {
|
2010-10-16 08:03:28 +00:00
|
|
|
changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-10-16 08:03:28 +00:00
|
|
|
changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft);
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (newlist.first) { /* got new strips ? */
|
|
|
|
Sequence *seq;
|
2010-12-21 14:49:34 +00:00
|
|
|
BLI_movelisttolist(ed->seqbasep, &newlist);
|
2009-01-31 09:58:38 +00:00
|
|
|
|
|
|
|
if (cut_side != SEQ_SIDE_BOTH) {
|
2012-04-30 16:22:40 +00:00
|
|
|
SEQP_BEGIN (ed, seq)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
if (cut_side == SEQ_SIDE_LEFT) {
|
|
|
|
if (seq->startdisp >= cut_frame) {
|
2010-06-24 10:04:18 +00:00
|
|
|
seq->flag &= ~SEQ_ALLSEL;
|
2009-01-31 09:58:38 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-29 22:26:11 +00:00
|
|
|
if (seq->enddisp <= cut_frame) {
|
2010-06-24 10:04:18 +00:00
|
|
|
seq->flag &= ~SEQ_ALLSEL;
|
2009-01-31 09:58:38 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-31 09:58:38 +00:00
|
|
|
SEQ_END;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
/* as last: */
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_sort(scene);
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (changed) {
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2011-09-20 08:48:48 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
2009-01-24 06:08:46 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-03-29 22:26:11 +00:00
|
|
|
View2D *v2d = UI_view2d_fromcontext(C);
|
2010-05-19 08:44:38 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
int cut_side = SEQ_SIDE_BOTH;
|
|
|
|
int cut_frame = CFRA;
|
2010-05-19 08:44:38 +00:00
|
|
|
|
2010-05-06 07:19:55 +00:00
|
|
|
if (ED_operator_sequencer_active(C) && v2d)
|
2012-03-29 22:26:11 +00:00
|
|
|
cut_side = mouse_frame_side(v2d, event->mval[0], cut_frame);
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
|
|
|
RNA_int_set(op->ptr, "frame", cut_frame);
|
|
|
|
RNA_enum_set(op->ptr, "side", cut_side);
|
|
|
|
/*RNA_enum_set(op->ptr, "type", cut_hard); */ /*This type is set from the key shortcut */
|
|
|
|
|
|
|
|
return sequencer_cut_exec(C, op);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SEQUENCER_OT_cut(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Cut Strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_cut";
|
|
|
|
ot->description = "Cut the selected strips";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = sequencer_cut_invoke;
|
|
|
|
ot->exec = sequencer_cut_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be cut", INT_MIN, INT_MAX);
|
2009-09-12 17:16:12 +00:00
|
|
|
RNA_def_enum(ot->srna, "type", prop_cut_types, SEQ_CUT_SOFT, "Type", "The type of cut operation to perform on strips");
|
2009-01-31 09:58:38 +00:00
|
|
|
RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side that remains selected after cutting");
|
Added back some functionality to the sequencer
- removed static vars _last_seq, last_imagename and last_sounddir, replacing them with with vars in the "Editing" struct. didnt manage to get the active sequence to load so currently thats lost when loading.
- removed flag SEQ_ACTIVE
- Added operators cut, mute, unmute, deselect_all, select_invert, select, select_more, select_less, select_pick_linked, select_linked and borderselect.
2009-01-19 21:42:18 +00:00
|
|
|
}
|
|
|
|
|
2009-01-21 18:47:09 +00:00
|
|
|
/* duplicate operator */
|
2010-07-07 16:37:41 +00:00
|
|
|
static int apply_unique_name_cb(Sequence *seq, void *arg_pt)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = (Scene *)arg_pt;
|
|
|
|
char name[sizeof(seq->name) - 2];
|
2010-07-07 16:37:41 +00:00
|
|
|
|
2012-10-14 03:56:47 +00:00
|
|
|
BLI_strncpy_utf8(name, seq->name + 2, sizeof(name));
|
2012-10-04 18:30:28 +00:00
|
|
|
BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_dupe_animdata(scene, name, seq->name + 2);
|
2010-07-07 16:37:41 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-21 18:47:09 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
ListBase nseqbase = {NULL, NULL};
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL)
|
2009-01-28 22:36:34 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_base_dupli_recursive(scene, NULL, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (nseqbase.first) {
|
2012-03-29 22:26:11 +00:00
|
|
|
Sequence *seq = nseqbase.first;
|
2010-06-24 10:04:18 +00:00
|
|
|
/* rely on the nseqbase list being added at the end */
|
2010-12-21 14:49:34 +00:00
|
|
|
BLI_movelisttolist(ed->seqbasep, &nseqbase);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (; seq; seq = seq->next)
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_recursive_apply(seq, apply_unique_name_cb, scene);
|
2010-02-16 17:58:50 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2010-02-16 17:58:50 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2009-01-21 18:47:09 +00:00
|
|
|
}
|
|
|
|
|
2009-07-08 21:41:35 +00:00
|
|
|
void SEQUENCER_OT_duplicate(wmOperatorType *ot)
|
2009-01-21 18:47:09 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Duplicate Strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_duplicate";
|
|
|
|
ot->description = "Duplicate the selected strips";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-21 18:47:09 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_add_duplicate_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
2009-01-21 18:47:09 +00:00
|
|
|
/* to give to transform */
|
2011-04-01 08:51:12 +00:00
|
|
|
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
|
2009-01-21 18:47:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* delete operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-21 18:47:09 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-21 18:47:09 +00:00
|
|
|
Sequence *seq;
|
|
|
|
MetaStack *ms;
|
|
|
|
int nothingSelected = TRUE;
|
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
seq = BKE_sequencer_active_get(scene);
|
2009-01-21 18:47:09 +00:00
|
|
|
if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */
|
|
|
|
nothingSelected = FALSE;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-01-21 18:47:09 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
|
|
|
if (seq->flag & SELECT) {
|
|
|
|
nothingSelected = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nothingSelected)
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
|
|
|
/* for effects, try to find a replacement input */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next)
|
2012-06-07 15:49:02 +00:00
|
|
|
if ((seq->type & SEQ_TYPE_EFFECT) && !(seq->flag & SELECT))
|
2009-01-21 18:47:09 +00:00
|
|
|
del_seq_find_replace_recurs(scene, seq);
|
|
|
|
|
|
|
|
/* delete all selected strips */
|
|
|
|
recurs_del_seq_flag(scene, ed->seqbasep, SELECT, 0);
|
|
|
|
|
|
|
|
/* updates lengths etc */
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = ed->seqbasep->first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = seq->next;
|
2009-01-21 18:47:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* free parent metas */
|
2012-03-29 22:26:11 +00:00
|
|
|
ms = ed->metastack.last;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (ms) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, ms->parseq);
|
2012-03-29 22:26:11 +00:00
|
|
|
ms = ms->prev;
|
2009-01-21 18:47:09 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2012-08-27 09:15:48 +00:00
|
|
|
static int sequencer_delete_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
ARegion *ar = CTX_wm_region(C);
|
|
|
|
|
|
|
|
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
|
|
|
/* bounding box of 30 pixels is used for markers shortcuts,
|
2012-11-12 07:33:01 +00:00
|
|
|
* prevent conflict with markers shortcuts here
|
2012-08-27 09:15:48 +00:00
|
|
|
*/
|
|
|
|
if (event->mval[1] <= 30)
|
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
}
|
|
|
|
|
|
|
|
return WM_operator_confirm(C, op, event);
|
|
|
|
}
|
2009-01-21 18:47:09 +00:00
|
|
|
|
|
|
|
void SEQUENCER_OT_delete(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Erase Strips";
|
|
|
|
ot->idname = "SEQUENCER_OT_delete";
|
|
|
|
ot->description = "Erase selected strips from the sequencer";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-21 18:47:09 +00:00
|
|
|
/* api callbacks */
|
2012-08-27 09:15:48 +00:00
|
|
|
ot->invoke = sequencer_delete_invoke;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_delete_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-21 18:47:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-14 03:59:22 +00:00
|
|
|
/* offset clear operator */
|
|
|
|
static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2011-08-14 03:59:22 +00:00
|
|
|
Sequence *seq;
|
|
|
|
|
|
|
|
/* for effects, try to find a replacement input */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2012-06-07 15:49:02 +00:00
|
|
|
if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) {
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0;
|
2011-08-14 03:59:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* updates lengths etc */
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = ed->seqbasep->first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = seq->next;
|
2011-08-14 03:59:22 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2012-06-07 15:49:02 +00:00
|
|
|
if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) {
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_test_overlap(ed->seqbasep, seq)) {
|
|
|
|
BKE_sequence_base_shuffle(ed->seqbasep, seq, scene);
|
2011-08-14 03:59:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2011-08-14 03:59:22 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SEQUENCER_OT_offset_clear(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Clear Strip Offset";
|
|
|
|
ot->idname = "SEQUENCER_OT_offset_clear";
|
|
|
|
ot->description = "Clear strip offsets from the start and end frames";
|
2011-08-14 03:59:22 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_offset_clear_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2011-08-14 03:59:22 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2011-08-14 03:59:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-21 18:47:09 +00:00
|
|
|
/* separate_images operator */
|
|
|
|
static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2011-01-09 01:17:56 +00:00
|
|
|
Sequence *seq, *seq_new;
|
2009-01-21 18:47:09 +00:00
|
|
|
Strip *strip_new;
|
|
|
|
StripElem *se, *se_new;
|
|
|
|
int start_ofs, cfra, frame_end;
|
2012-03-29 22:26:11 +00:00
|
|
|
int step = RNA_int_get(op->ptr, "length");
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = ed->seqbasep->first; /* poll checks this is valid */
|
2009-01-21 18:47:09 +00:00
|
|
|
|
|
|
|
while (seq) {
|
2012-06-07 15:49:02 +00:00
|
|
|
if ((seq->flag & SELECT) && (seq->type == SEQ_TYPE_IMAGE) && (seq->len > 1)) {
|
2012-03-18 07:38:51 +00:00
|
|
|
/* remove seq so overlap tests don't conflict,
|
2012-03-03 16:31:46 +00:00
|
|
|
* see seq_free_sequence below for the real free'ing */
|
2009-01-21 18:47:09 +00:00
|
|
|
BLI_remlink(ed->seqbasep, seq);
|
2012-03-24 07:52:14 +00:00
|
|
|
/* if (seq->ipo) seq->ipo->id.us--; */
|
2010-07-03 17:47:06 +00:00
|
|
|
/* XXX, remove fcurve and assign to split image strips */
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
start_ofs = cfra = BKE_sequence_tx_get_final_left(seq, 0);
|
|
|
|
frame_end = BKE_sequence_tx_get_final_right(seq, 0);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
|
|
|
while (cfra < frame_end) {
|
|
|
|
/* new seq */
|
2012-08-08 11:15:40 +00:00
|
|
|
se = BKE_sequencer_give_stripelem(seq, cfra);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
seq_new = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
|
2011-08-05 06:26:54 +00:00
|
|
|
BLI_addtail(ed->seqbasep, seq_new);
|
2011-07-06 10:58:23 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq_new->start = start_ofs;
|
2012-06-07 15:49:02 +00:00
|
|
|
seq_new->type = SEQ_TYPE_IMAGE;
|
2009-01-21 18:47:09 +00:00
|
|
|
seq_new->len = 1;
|
2012-03-29 22:26:11 +00:00
|
|
|
seq_new->endstill = step - 1;
|
2009-01-21 18:47:09 +00:00
|
|
|
|
|
|
|
/* new strip */
|
2012-03-29 22:26:11 +00:00
|
|
|
strip_new = seq_new->strip;
|
|
|
|
strip_new->us = 1;
|
2009-01-21 18:47:09 +00:00
|
|
|
|
|
|
|
/* new stripdata */
|
2012-03-29 22:26:11 +00:00
|
|
|
se_new = strip_new->stripdata;
|
2011-01-09 01:17:56 +00:00
|
|
|
BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq_new);
|
2010-07-03 17:47:06 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (step > 1) {
|
2010-07-03 17:47:06 +00:00
|
|
|
seq_new->flag &= ~SEQ_OVERLAP;
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_test_overlap(ed->seqbasep, seq_new)) {
|
|
|
|
BKE_sequence_base_shuffle(ed->seqbasep, seq_new, scene);
|
2010-07-03 17:47:06 +00:00
|
|
|
}
|
2009-01-21 18:47:09 +00:00
|
|
|
}
|
|
|
|
|
2010-07-03 17:47:06 +00:00
|
|
|
/* XXX, COPY FCURVES */
|
2009-12-13 03:20:29 +00:00
|
|
|
|
2009-01-21 18:47:09 +00:00
|
|
|
cfra++;
|
|
|
|
start_ofs += step;
|
|
|
|
}
|
|
|
|
|
2012-09-06 09:23:38 +00:00
|
|
|
BKE_sequence_free(scene, seq);
|
2009-01-21 18:47:09 +00:00
|
|
|
seq = seq->next;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-01-21 18:47:09 +00:00
|
|
|
seq = seq->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* as last: */
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_sort(scene);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-01-21 18:47:09 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-12 20:32:42 +00:00
|
|
|
void SEQUENCER_OT_images_separate(wmOperatorType *ot)
|
2009-01-21 18:47:09 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Separate Images";
|
|
|
|
ot->idname = "SEQUENCER_OT_images_separate";
|
|
|
|
ot->description = "On image sequence strips, it returns a strip for each image";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-21 18:47:09 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_separate_images_exec;
|
2012-11-26 14:15:41 +00:00
|
|
|
ot->invoke = WM_operator_props_popup;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-10-19 21:34:38 +00:00
|
|
|
|
2012-10-11 23:46:12 +00:00
|
|
|
RNA_def_int(ot->srna, "length", 1, 1, INT_MAX, "Length", "Length of each frame", 1, 1000);
|
2009-01-21 18:47:09 +00:00
|
|
|
}
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* META Operators */
|
|
|
|
|
|
|
|
/* separate_meta_toggle operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-23 23:14:02 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
|
|
|
Sequence *last_seq = BKE_sequencer_active_get(scene);
|
2009-01-23 23:14:02 +00:00
|
|
|
MetaStack *ms;
|
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
if (last_seq && last_seq->type == SEQ_TYPE_META && last_seq->flag & SELECT) {
|
2009-01-23 23:14:02 +00:00
|
|
|
/* Enter Metastrip */
|
2012-03-29 22:26:11 +00:00
|
|
|
ms = MEM_mallocN(sizeof(MetaStack), "metastack");
|
2009-01-23 23:14:02 +00:00
|
|
|
BLI_addtail(&ed->metastack, ms);
|
2012-03-29 22:26:11 +00:00
|
|
|
ms->parseq = last_seq;
|
|
|
|
ms->oldbasep = ed->seqbasep;
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
ed->seqbasep = &last_seq->seqbase;
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_active_set(scene, NULL);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Exit Metastrip (if possible) */
|
|
|
|
|
|
|
|
Sequence *seq;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed->metastack.first == NULL)
|
2009-01-23 23:14:02 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
ms = ed->metastack.last;
|
2009-01-23 23:14:02 +00:00
|
|
|
BLI_remlink(&ed->metastack, ms);
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
ed->seqbasep = ms->oldbasep;
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
/* recalc all: the meta can have effects connected to it */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next)
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_active_set(scene, ms->parseq);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
ms->parseq->flag |= SELECT;
|
|
|
|
recurs_sel_seq(ms->parseq);
|
|
|
|
|
|
|
|
MEM_freeN(ms);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_muting(ed);
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-12-08 13:57:51 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_meta_toggle(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Toggle Meta Strip";
|
|
|
|
ot->idname = "SEQUENCER_OT_meta_toggle";
|
|
|
|
ot->description = "Toggle a metastrip (to edit enclosed strips)";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_meta_toggle_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* separate_meta_make operator */
|
|
|
|
static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
Sequence *seq, *seqm, *next, *last_seq = BKE_sequencer_active_get(scene);
|
2012-03-29 22:26:11 +00:00
|
|
|
int channel_max = 1;
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_base_isolated_sel_check(ed->seqbasep) == FALSE) {
|
2009-01-23 23:14:02 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove all selected from main list, and put in meta */
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
seqm = BKE_sequence_alloc(ed->seqbasep, 1, 1); /* channel number set later */
|
2012-03-29 22:26:11 +00:00
|
|
|
strcpy(seqm->name + 2, "MetaStrip");
|
2012-06-07 15:49:02 +00:00
|
|
|
seqm->type = SEQ_TYPE_META;
|
2012-03-29 22:26:11 +00:00
|
|
|
seqm->flag = SELECT;
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = ed->seqbasep->first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2012-03-29 22:26:11 +00:00
|
|
|
next = seq->next;
|
|
|
|
if (seq != seqm && (seq->flag & SELECT)) {
|
2012-10-23 16:21:55 +00:00
|
|
|
channel_max = max_ii(seq->machine, channel_max);
|
2009-01-23 23:14:02 +00:00
|
|
|
BLI_remlink(ed->seqbasep, seq);
|
|
|
|
BLI_addtail(&seqm->seqbase, seq);
|
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
seq = next;
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
seqm->machine = last_seq ? last_seq->machine : channel_max;
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seqm);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seqm->strip = MEM_callocN(sizeof(Strip), "metastrip");
|
|
|
|
seqm->strip->us = 1;
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_active_set(scene, seqm);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_test_overlap(ed->seqbasep, seqm) ) BKE_sequence_base_shuffle(ed->seqbasep, seqm, scene);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_muting(ed);
|
2009-12-13 03:20:29 +00:00
|
|
|
|
2012-10-04 18:30:28 +00:00
|
|
|
BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seqm);
|
2009-12-13 03:20:29 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-12-08 13:57:51 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_meta_make(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Make Meta Strip";
|
|
|
|
ot->idname = "SEQUENCER_OT_meta_make";
|
|
|
|
ot->description = "Group selected strips into a metastrip";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = WM_operator_confirm;
|
|
|
|
ot->exec = sequencer_meta_make_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int seq_depends_on_meta(Sequence *seq, Sequence *seqm)
|
|
|
|
{
|
|
|
|
if (seq == seqm) return 1;
|
|
|
|
else if (seq->seq1 && seq_depends_on_meta(seq->seq1, seqm)) return 1;
|
|
|
|
else if (seq->seq2 && seq_depends_on_meta(seq->seq2, seqm)) return 1;
|
|
|
|
else if (seq->seq3 && seq_depends_on_meta(seq->seq3, seqm)) return 1;
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* separate_meta_make operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-23 23:14:02 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-05-25 09:51:53 +00:00
|
|
|
Sequence *seq, *last_seq = BKE_sequencer_active_get(scene); /* last_seq checks (ed == NULL) */
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
if (last_seq == NULL || last_seq->type != SEQ_TYPE_META)
|
2009-01-23 23:14:02 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
2010-12-21 14:49:34 +00:00
|
|
|
BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
last_seq->seqbase.first = NULL;
|
|
|
|
last_seq->seqbase.last = NULL;
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
BLI_remlink(ed->seqbasep, last_seq);
|
2012-09-06 09:23:38 +00:00
|
|
|
BKE_sequence_free(scene, last_seq);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
/* emtpy meta strip, delete all effects depending on it */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next)
|
2012-06-07 15:49:02 +00:00
|
|
|
if ((seq->type & SEQ_TYPE_EFFECT) && seq_depends_on_meta(seq, last_seq))
|
2009-01-23 23:14:02 +00:00
|
|
|
seq->flag |= SEQ_FLAG_DELETE;
|
|
|
|
|
|
|
|
recurs_del_seq_flag(scene, ed->seqbasep, SEQ_FLAG_DELETE, 0);
|
|
|
|
|
2010-10-29 19:40:45 +00:00
|
|
|
/* test for effects and overlap
|
2012-03-18 07:38:51 +00:00
|
|
|
* don't use SEQP_BEGIN since that would be recursive */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SELECT) {
|
2009-01-23 23:14:02 +00:00
|
|
|
seq->flag &= ~SEQ_OVERLAP;
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_test_overlap(ed->seqbasep, seq)) {
|
|
|
|
BKE_sequence_base_shuffle(ed->seqbasep, seq, scene);
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_sort(scene);
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_muting(ed);
|
2009-12-08 13:57:51 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "UnMeta Strip";
|
|
|
|
ot->idname = "SEQUENCER_OT_meta_separate";
|
|
|
|
ot->description = "Put the contents of a metastrip back in the sequencer";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = WM_operator_confirm;
|
|
|
|
ot->exec = sequencer_meta_separate_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* view_all operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-12-14 21:42:25 +00:00
|
|
|
{
|
2012-08-12 01:07:31 +00:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
2012-03-29 22:26:11 +00:00
|
|
|
View2D *v2d = UI_view2d_fromcontext(C);
|
2009-12-14 21:42:25 +00:00
|
|
|
|
2012-08-12 01:07:31 +00:00
|
|
|
UI_view2d_smooth_view(C, ar, &v2d->tot);
|
2009-12-14 21:42:25 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_view_all(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "View All";
|
|
|
|
ot->idname = "SEQUENCER_OT_view_all";
|
|
|
|
ot->description = "View all the strips in the sequencer";
|
2009-12-14 21:42:25 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_view_all_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
2009-12-14 21:42:25 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER;
|
2009-12-14 21:42:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* view_all operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-25 14:53:41 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
bScreen *sc = CTX_wm_screen(C);
|
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2010-02-08 13:55:31 +00:00
|
|
|
#if 0
|
2012-03-29 22:26:11 +00:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
|
|
|
SpaceSeq *sseq = area->spacedata.first;
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2010-02-08 13:55:31 +00:00
|
|
|
#endif
|
2012-03-29 22:26:11 +00:00
|
|
|
View2D *v2d = UI_view2d_fromcontext(C);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
v2d->cur = v2d->tot;
|
2010-02-07 19:07:56 +00:00
|
|
|
UI_view2d_curRect_validate(v2d);
|
|
|
|
UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
|
|
|
|
|
|
|
|
#if 0
|
2009-12-14 21:42:25 +00:00
|
|
|
/* Like zooming on an image view */
|
|
|
|
float zoomX, zoomY;
|
|
|
|
int width, height, imgwidth, imgheight;
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2009-12-14 21:42:25 +00:00
|
|
|
width = ar->winx;
|
|
|
|
height = ar->winy;
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2009-12-14 21:42:25 +00:00
|
|
|
seq_reset_imageofs(sseq);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
imgwidth = (scene->r.size * scene->r.xsch) / 100;
|
|
|
|
imgheight = (scene->r.size * scene->r.ysch) / 100;
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2009-12-14 21:42:25 +00:00
|
|
|
/* Apply aspect, dosnt need to be that accurate */
|
2012-03-29 22:26:11 +00:00
|
|
|
imgwidth = (int)(imgwidth * (scene->r.xasp / scene->r.yasp));
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2009-12-14 21:42:25 +00:00
|
|
|
if (((imgwidth >= width) || (imgheight >= height)) &&
|
2012-05-20 19:49:27 +00:00
|
|
|
((width > 0) && (height > 0)))
|
|
|
|
{
|
2009-12-14 21:42:25 +00:00
|
|
|
/* Find the zoom value that will fit the image in the image space */
|
|
|
|
zoomX = ((float)width) / ((float)imgwidth);
|
|
|
|
zoomY = ((float)height) / ((float)imgheight);
|
2012-03-29 22:26:11 +00:00
|
|
|
sseq->zoom = (zoomX < zoomY) ? zoomX : zoomY;
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-10-23 13:28:22 +00:00
|
|
|
sseq->zoom = 1.0f / power_of_2(1 / min_ff(zoomX, zoomY));
|
2009-12-14 21:42:25 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-29 22:26:11 +00:00
|
|
|
sseq->zoom = 1.0f;
|
2009-12-14 21:42:25 +00:00
|
|
|
}
|
2010-02-07 19:07:56 +00:00
|
|
|
#endif
|
2009-01-25 14:53:41 +00:00
|
|
|
|
|
|
|
ED_area_tag_redraw(CTX_wm_area(C));
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2009-12-14 21:42:25 +00:00
|
|
|
void SEQUENCER_OT_view_all_preview(wmOperatorType *ot)
|
2009-01-25 14:53:41 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "View All";
|
|
|
|
ot->idname = "SEQUENCER_OT_view_all_preview";
|
|
|
|
ot->description = "Zoom preview to fit in the area";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_view_all_preview_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER;
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
|
|
|
|
2010-06-17 14:22:54 +00:00
|
|
|
|
|
|
|
static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-07-27 15:15:55 +00:00
|
|
|
RenderData *rd = &CTX_data_scene(C)->r;
|
2012-03-29 22:26:11 +00:00
|
|
|
View2D *v2d = UI_view2d_fromcontext(C);
|
2010-06-17 14:22:54 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
float ratio = RNA_float_get(op->ptr, "ratio");
|
2010-06-17 14:22:54 +00:00
|
|
|
|
2012-07-27 15:15:55 +00:00
|
|
|
float winx = (int)(rd->size * rd->xsch) / 100;
|
|
|
|
float winy = (int)(rd->size * rd->ysch) / 100;
|
2010-06-17 14:22:54 +00:00
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
float facx = BLI_rcti_size_x(&v2d->mask) / winx;
|
|
|
|
float facy = BLI_rcti_size_y(&v2d->mask) / winy;
|
2010-06-17 14:22:54 +00:00
|
|
|
|
2012-07-15 00:29:56 +00:00
|
|
|
BLI_rctf_resize(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1);
|
2010-06-17 14:22:54 +00:00
|
|
|
|
|
|
|
ED_region_tag_redraw(CTX_wm_region(C));
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_view_zoom_ratio(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Sequencer View Zoom Ratio";
|
|
|
|
ot->idname = "SEQUENCER_OT_view_zoom_ratio";
|
2010-12-31 03:54:28 +00:00
|
|
|
ot->description = "Change zoom ratio of sequencer preview";
|
2010-06-17 14:22:54 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_view_zoom_ratio_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
2010-06-17 14:22:54 +00:00
|
|
|
|
|
|
|
/* properties */
|
2012-10-11 23:46:12 +00:00
|
|
|
RNA_def_float(ot->srna, "ratio", 1.0f, -FLT_MAX, FLT_MAX,
|
2012-03-29 22:26:11 +00:00
|
|
|
"Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
|
2010-06-17 14:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-01 19:10:31 +00:00
|
|
|
#if 0
|
2009-12-14 21:42:25 +00:00
|
|
|
static EnumPropertyItem view_type_items[] = {
|
2012-03-29 22:26:11 +00:00
|
|
|
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
|
|
|
|
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
|
|
|
|
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2010-01-01 19:10:31 +00:00
|
|
|
#endif
|
2009-01-25 14:53:41 +00:00
|
|
|
|
|
|
|
/* view_all operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-12-14 21:42:25 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
|
2009-12-14 21:42:25 +00:00
|
|
|
|
|
|
|
sseq->view++;
|
|
|
|
if (sseq->view > SEQ_VIEW_SEQUENCE_PREVIEW) sseq->view = SEQ_VIEW_SEQUENCE;
|
|
|
|
|
2011-09-05 19:34:27 +00:00
|
|
|
ED_area_tag_refresh(CTX_wm_area(C));
|
2009-12-14 21:42:25 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_view_toggle(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "View Toggle";
|
|
|
|
ot->idname = "SEQUENCER_OT_view_toggle";
|
|
|
|
ot->description = "Toggle between sequencer views (sequence, preview, both)";
|
2009-12-14 21:42:25 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_view_toggle_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
2009-12-14 21:42:25 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER;
|
2009-12-14 21:42:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* view_selected operator */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-01-25 14:53:41 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
View2D *v2d = UI_view2d_fromcontext(C);
|
2012-08-12 01:07:31 +00:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-01-25 14:53:41 +00:00
|
|
|
Sequence *seq;
|
2012-08-12 01:07:31 +00:00
|
|
|
rctf cur_new = v2d->cur;
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
int xmin = MAXFRAME * 2;
|
|
|
|
int xmax = -MAXFRAME * 2;
|
|
|
|
int ymin = MAXSEQ + 1;
|
|
|
|
int ymax = 0;
|
2009-01-25 14:53:41 +00:00
|
|
|
int orig_height;
|
|
|
|
int ymid;
|
2012-03-29 22:26:11 +00:00
|
|
|
int ymargin = 1;
|
|
|
|
int xmargin = FPS;
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL)
|
2009-01-28 22:36:34 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SELECT) {
|
2012-10-23 16:21:55 +00:00
|
|
|
xmin = min_ii(xmin, seq->startdisp);
|
|
|
|
xmax = max_ii(xmax, seq->enddisp);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-10-23 16:21:55 +00:00
|
|
|
ymin = min_ii(ymin, seq->machine);
|
|
|
|
ymax = max_ii(ymax, seq->machine);
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ymax != 0) {
|
|
|
|
|
|
|
|
xmax += xmargin;
|
|
|
|
xmin -= xmargin;
|
|
|
|
ymax += ymargin;
|
|
|
|
ymin -= ymargin;
|
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
orig_height = BLI_rctf_size_y(&cur_new);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-08-12 01:07:31 +00:00
|
|
|
cur_new.xmin = xmin;
|
|
|
|
cur_new.xmax = xmax;
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-08-12 01:07:31 +00:00
|
|
|
cur_new.ymin = ymin;
|
|
|
|
cur_new.ymax = ymax;
|
2009-01-25 14:53:41 +00:00
|
|
|
|
|
|
|
/* only zoom out vertically */
|
2012-09-15 11:48:20 +00:00
|
|
|
if (orig_height > BLI_rctf_size_y(&cur_new)) {
|
|
|
|
ymid = BLI_rctf_cent_y(&cur_new);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-08-12 01:07:31 +00:00
|
|
|
cur_new.ymin = ymid - (orig_height / 2);
|
|
|
|
cur_new.ymax = ymid + (orig_height / 2);
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
|
|
|
|
2012-08-12 01:07:31 +00:00
|
|
|
UI_view2d_smooth_view(C, ar, &cur_new);
|
2009-01-25 14:53:41 +00:00
|
|
|
|
2012-08-12 01:07:31 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return OPERATOR_CANCELLED;
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_view_selected(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "View Selected";
|
|
|
|
ot->idname = "SEQUENCER_OT_view_selected";
|
|
|
|
ot->description = "Zoom the sequencer on the selected strips";
|
2009-09-12 17:16:12 +00:00
|
|
|
|
2009-01-25 14:53:41 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_view_selected_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER;
|
2009-01-25 14:53:41 +00:00
|
|
|
}
|
2009-10-28 19:53:25 +00:00
|
|
|
|
|
|
|
|
2012-08-23 08:10:45 +00:00
|
|
|
static int find_next_prev_edit(Scene *scene, int cfra,
|
|
|
|
const short side,
|
|
|
|
const short do_skip_mute, const short do_center)
|
2009-10-28 19:53:25 +00:00
|
|
|
{
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2012-03-29 22:26:11 +00:00
|
|
|
Sequence *seq, *best_seq = NULL, *frame_seq = NULL;
|
2009-10-28 19:53:25 +00:00
|
|
|
|
|
|
|
int dist, best_dist;
|
2012-03-29 22:26:11 +00:00
|
|
|
best_dist = MAXFRAME * 2;
|
2009-10-28 19:53:25 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return cfra;
|
2009-10-28 19:53:25 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2012-08-23 08:10:45 +00:00
|
|
|
int seq_frame;
|
|
|
|
|
|
|
|
if (do_skip_mute && (seq->flag & SEQ_MUTE)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (do_center) {
|
|
|
|
seq_frame = (seq->startdisp + seq->enddisp) / 2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
seq_frame = seq->startdisp;
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
dist = MAXFRAME * 2;
|
2009-10-28 19:53:25 +00:00
|
|
|
|
|
|
|
switch (side) {
|
|
|
|
case SEQ_SIDE_LEFT:
|
2012-08-23 08:10:45 +00:00
|
|
|
if (seq_frame < cfra) {
|
|
|
|
dist = cfra - seq_frame;
|
2009-10-28 19:53:25 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SEQ_SIDE_RIGHT:
|
2012-08-23 08:10:45 +00:00
|
|
|
if (seq_frame > cfra) {
|
|
|
|
dist = seq_frame - cfra;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
2012-08-23 08:10:45 +00:00
|
|
|
else if (seq_frame == cfra) {
|
2012-03-29 22:26:11 +00:00
|
|
|
frame_seq = seq;
|
2009-10-28 19:53:25 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dist < best_dist) {
|
|
|
|
best_dist = dist;
|
|
|
|
best_seq = seq;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if no sequence to the right is found and the
|
2012-03-03 16:31:46 +00:00
|
|
|
* frame is on the start of the last sequence,
|
|
|
|
* move to the end of the last sequence */
|
2012-08-23 08:10:45 +00:00
|
|
|
if (frame_seq) {
|
|
|
|
if (do_center) {
|
|
|
|
cfra = (frame_seq->startdisp + frame_seq->enddisp) / 2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
cfra = frame_seq->enddisp;
|
|
|
|
}
|
|
|
|
}
|
2009-10-28 19:53:25 +00:00
|
|
|
|
2012-08-23 08:10:45 +00:00
|
|
|
if (best_seq) {
|
|
|
|
if (do_center) {
|
|
|
|
cfra = (best_seq->startdisp + best_seq->enddisp) / 2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
cfra = best_seq->startdisp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cfra;
|
2009-10-28 19:53:25 +00:00
|
|
|
}
|
|
|
|
|
2012-08-23 08:10:45 +00:00
|
|
|
static int strip_jump_internal(Scene *scene,
|
2012-08-23 09:54:15 +00:00
|
|
|
const short side,
|
|
|
|
const short do_skip_mute, const short do_center)
|
2009-10-29 10:03:34 +00:00
|
|
|
{
|
2012-08-23 08:10:45 +00:00
|
|
|
int change = FALSE;
|
2009-10-28 19:53:25 +00:00
|
|
|
int cfra = CFRA;
|
2012-08-23 08:10:45 +00:00
|
|
|
int nfra = find_next_prev_edit(scene, cfra, side, do_skip_mute, do_center);
|
2009-10-28 19:53:25 +00:00
|
|
|
|
|
|
|
if (nfra != cfra) {
|
|
|
|
CFRA = nfra;
|
2012-08-23 08:10:45 +00:00
|
|
|
change = TRUE;
|
2009-10-28 19:53:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return change;
|
|
|
|
}
|
|
|
|
|
2012-12-06 05:48:51 +00:00
|
|
|
static int sequencer_strip_jump_poll(bContext *C)
|
|
|
|
{
|
|
|
|
/* prevent changes during render */
|
|
|
|
if (G.is_rendering)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return sequencer_edit_poll(C);
|
|
|
|
}
|
|
|
|
|
2012-08-23 07:39:51 +00:00
|
|
|
/* jump frame to edit point operator */
|
|
|
|
static int sequencer_strip_jump_exec(bContext *C, wmOperator *op)
|
2009-10-28 19:53:25 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-08-23 07:39:51 +00:00
|
|
|
short next = RNA_boolean_get(op->ptr, "next");
|
2012-08-23 08:10:45 +00:00
|
|
|
short center = RNA_boolean_get(op->ptr, "center");
|
2009-10-28 19:53:25 +00:00
|
|
|
|
2012-08-23 08:10:45 +00:00
|
|
|
/* currently do_skip_mute is always TRUE */
|
|
|
|
if (!strip_jump_internal(scene, next ? SEQ_SIDE_RIGHT : SEQ_SIDE_LEFT, TRUE, center)) {
|
2009-12-08 13:57:51 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2012-08-23 08:10:45 +00:00
|
|
|
}
|
2009-12-08 13:57:51 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2009-10-28 19:53:25 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2012-08-23 07:39:51 +00:00
|
|
|
void SEQUENCER_OT_strip_jump(wmOperatorType *ot)
|
2009-10-28 19:53:25 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-08-23 07:39:51 +00:00
|
|
|
ot->name = "Jump to Strip";
|
|
|
|
ot->idname = "SEQUENCER_OT_strip_jump";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Move frame to previous edit point";
|
2012-08-23 08:10:45 +00:00
|
|
|
|
2009-10-28 19:53:25 +00:00
|
|
|
/* api callbacks */
|
2012-08-23 07:39:51 +00:00
|
|
|
ot->exec = sequencer_strip_jump_exec;
|
2012-12-06 05:48:51 +00:00
|
|
|
ot->poll = sequencer_strip_jump_poll;
|
2012-08-23 08:10:45 +00:00
|
|
|
|
2009-10-28 19:53:25 +00:00
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-10-28 19:53:25 +00:00
|
|
|
|
2009-10-30 20:40:41 +00:00
|
|
|
/* properties */
|
2012-08-23 07:39:51 +00:00
|
|
|
RNA_def_boolean(ot->srna, "next", TRUE, "Next Strip", "");
|
2012-08-23 08:10:45 +00:00
|
|
|
RNA_def_boolean(ot->srna, "center", TRUE, "Use strip center", "");
|
2009-10-30 20:40:41 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
|
2009-10-30 20:40:41 +00:00
|
|
|
{
|
|
|
|
int gap = seqb->startdisp - seqa->enddisp;
|
2010-07-29 11:47:00 +00:00
|
|
|
seqb->start = (seqb->start - seqb->startdisp) + seqa->startdisp;
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seqb);
|
2010-07-29 11:47:00 +00:00
|
|
|
seqa->start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap;
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seqa);
|
2009-10-30 20:40:41 +00:00
|
|
|
}
|
|
|
|
|
2010-02-08 13:55:31 +00:00
|
|
|
#if 0
|
2012-03-29 22:26:11 +00:00
|
|
|
static Sequence *sequence_find_parent(Scene *scene, Sequence *child)
|
2009-10-30 20:40:41 +00:00
|
|
|
{
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2012-03-29 22:26:11 +00:00
|
|
|
Sequence *parent = NULL;
|
2009-10-30 20:40:41 +00:00
|
|
|
Sequence *seq;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL) return NULL;
|
2009-10-30 20:40:41 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2012-09-09 00:00:21 +00:00
|
|
|
if ((seq != child) && seq_is_parent(seq, child)) {
|
2009-10-30 20:40:41 +00:00
|
|
|
parent = seq;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-08 13:55:31 +00:00
|
|
|
return parent;
|
2009-10-30 20:40:41 +00:00
|
|
|
}
|
2010-02-08 13:55:31 +00:00
|
|
|
#endif
|
2009-10-30 20:40:41 +00:00
|
|
|
|
2009-12-15 10:04:54 +00:00
|
|
|
static int sequencer_swap_exec(bContext *C, wmOperator *op)
|
2009-10-30 20:40:41 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
|
|
|
Sequence *active_seq = BKE_sequencer_active_get(scene);
|
2009-12-13 15:48:57 +00:00
|
|
|
Sequence *seq, *iseq;
|
2012-03-29 22:26:11 +00:00
|
|
|
int side = RNA_enum_get(op->ptr, "side");
|
2009-10-30 20:40:41 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (active_seq == NULL) return OPERATOR_CANCELLED;
|
2009-10-30 20:40:41 +00:00
|
|
|
|
|
|
|
seq = find_next_prev_sequence(scene, active_seq, side, -1);
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq) {
|
2009-10-30 20:40:41 +00:00
|
|
|
|
|
|
|
/* disallow effect strips */
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_effect_get_num_inputs(seq->type) >= 1 && (seq->effectdata || seq->seq1 || seq->seq2 || seq->seq3))
|
2009-10-30 20:40:41 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2012-08-08 11:15:40 +00:00
|
|
|
if ((BKE_sequence_effect_get_num_inputs(active_seq->type) >= 1) && (active_seq->effectdata || active_seq->seq1 || active_seq->seq2 || active_seq->seq3))
|
2009-10-30 20:40:41 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
switch (side) {
|
|
|
|
case SEQ_SIDE_LEFT:
|
2010-02-07 23:41:17 +00:00
|
|
|
swap_sequence(scene, seq, active_seq);
|
2009-10-30 20:40:41 +00:00
|
|
|
break;
|
|
|
|
case SEQ_SIDE_RIGHT:
|
2010-02-07 23:41:17 +00:00
|
|
|
swap_sequence(scene, active_seq, seq);
|
2009-10-30 20:40:41 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-12-08 13:57:51 +00:00
|
|
|
|
2009-12-13 15:48:57 +00:00
|
|
|
// XXX - should be a generic function
|
2012-03-29 22:26:11 +00:00
|
|
|
for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) {
|
2012-06-07 15:49:02 +00:00
|
|
|
if ((iseq->type & SEQ_TYPE_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, iseq);
|
2009-12-15 11:27:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do this in a new loop since both effects need to be calculated first */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) {
|
2012-06-07 15:49:02 +00:00
|
|
|
if ((iseq->type & SEQ_TYPE_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
|
2009-12-15 11:27:46 +00:00
|
|
|
/* this may now overlap */
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_test_overlap(ed->seqbasep, iseq) ) {
|
|
|
|
BKE_sequence_base_shuffle(ed->seqbasep, iseq, scene);
|
2009-12-15 11:27:46 +00:00
|
|
|
}
|
|
|
|
}
|
2009-12-13 15:48:57 +00:00
|
|
|
}
|
|
|
|
|
2009-12-15 11:27:46 +00:00
|
|
|
|
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_sort(scene);
|
2009-12-15 11:27:46 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-12-08 13:57:51 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
2009-10-30 20:40:41 +00:00
|
|
|
}
|
|
|
|
|
2009-12-08 13:57:51 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2009-10-30 20:40:41 +00:00
|
|
|
}
|
|
|
|
|
2009-12-15 10:04:54 +00:00
|
|
|
void SEQUENCER_OT_swap(wmOperatorType *ot)
|
2009-10-30 20:40:41 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Swap Strip";
|
|
|
|
ot->idname = "SEQUENCER_OT_swap";
|
|
|
|
ot->description = "Swap active strip with strip to the right or left";
|
2009-10-30 20:40:41 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_swap_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-10-30 20:40:41 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-10-30 20:40:41 +00:00
|
|
|
|
2009-10-28 19:53:25 +00:00
|
|
|
/* properties */
|
2009-12-15 10:04:54 +00:00
|
|
|
RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap");
|
2009-10-30 21:40:07 +00:00
|
|
|
}
|
2009-11-08 15:03:10 +00:00
|
|
|
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-11-08 15:03:10 +00:00
|
|
|
{
|
|
|
|
int retval = OPERATOR_CANCELLED;
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Sequence *active_seq = BKE_sequencer_active_get(scene);
|
2010-11-28 18:54:43 +00:00
|
|
|
StripElem *se = NULL;
|
2009-11-08 15:03:10 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (active_seq == NULL)
|
2009-12-15 10:35:50 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2009-11-08 15:03:10 +00:00
|
|
|
|
2010-11-28 18:23:21 +00:00
|
|
|
|
|
|
|
if (active_seq->strip) {
|
|
|
|
switch (active_seq->type) {
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_IMAGE:
|
2012-08-08 11:15:40 +00:00
|
|
|
se = BKE_sequencer_give_stripelem(active_seq, scene->r.cfra);
|
2012-03-29 22:26:11 +00:00
|
|
|
break;
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_MOVIE:
|
2012-03-29 22:26:11 +00:00
|
|
|
se = active_seq->strip->stripdata;
|
|
|
|
break;
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_SCENE:
|
|
|
|
case SEQ_TYPE_META:
|
|
|
|
case SEQ_TYPE_SOUND_RAM:
|
|
|
|
case SEQ_TYPE_SOUND_HD:
|
2012-03-29 22:26:11 +00:00
|
|
|
default:
|
|
|
|
break;
|
2010-11-28 18:23:21 +00:00
|
|
|
}
|
2009-11-08 15:03:10 +00:00
|
|
|
}
|
2010-11-28 18:23:21 +00:00
|
|
|
|
|
|
|
if (se) {
|
|
|
|
// prevent setting the render size if sequence values aren't initialized
|
2012-09-09 00:00:21 +00:00
|
|
|
if ((se->orig_width > 0) && (se->orig_height > 0)) {
|
2012-03-29 22:26:11 +00:00
|
|
|
scene->r.xsch = se->orig_width;
|
|
|
|
scene->r.ysch = se->orig_height;
|
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
|
2010-11-28 18:23:21 +00:00
|
|
|
retval = OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-08 15:03:10 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_rendersize(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Set Render Size";
|
|
|
|
ot->idname = "SEQUENCER_OT_rendersize";
|
|
|
|
ot->description = "Set render size and aspect from active sequence";
|
2009-11-08 15:03:10 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_rendersize_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-11-08 15:03:10 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-11-08 15:03:10 +00:00
|
|
|
|
|
|
|
/* properties */
|
2009-11-11 09:59:51 +00:00
|
|
|
}
|
|
|
|
|
2012-02-13 17:29:10 +00:00
|
|
|
static void seq_copy_del_sound(Scene *scene, Sequence *seq)
|
2009-12-17 16:28:45 +00:00
|
|
|
{
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
2009-12-17 16:28:45 +00:00
|
|
|
Sequence *iseq;
|
2012-03-29 22:26:11 +00:00
|
|
|
for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
|
2012-02-13 17:29:10 +00:00
|
|
|
seq_copy_del_sound(scene, iseq);
|
2009-12-17 16:28:45 +00:00
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (seq->scene_sound) {
|
2010-02-07 23:41:17 +00:00
|
|
|
sound_remove_scene_sound(scene, seq->scene_sound);
|
|
|
|
seq->scene_sound = NULL;
|
2009-12-17 23:29:11 +00:00
|
|
|
}
|
2009-12-17 16:28:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO, validate scenes */
|
2009-12-17 14:45:47 +00:00
|
|
|
static int sequencer_copy_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2009-12-17 14:45:47 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
ListBase nseqbase = {NULL, NULL};
|
2011-03-25 11:45:55 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_free_clipboard();
|
2009-12-17 16:28:45 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_base_isolated_sel_check(ed->seqbasep) == FALSE) {
|
2009-12-17 23:29:11 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_base_dupli_recursive(scene, NULL, &nseqbase, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME);
|
2011-03-25 11:45:55 +00:00
|
|
|
|
|
|
|
/* To make sure the copied strips have unique names between each other add
|
|
|
|
* them temporarily to the end of the original seqbase. (bug 25932)
|
|
|
|
*/
|
2012-03-24 06:38:07 +00:00
|
|
|
if (nseqbase.first) {
|
2011-03-25 11:45:55 +00:00
|
|
|
Sequence *seq, *first_seq = nseqbase.first;
|
|
|
|
BLI_movelisttolist(ed->seqbasep, &nseqbase);
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = first_seq; seq; seq = seq->next)
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_recursive_apply(seq, apply_unique_name_cb, scene);
|
2011-03-25 11:45:55 +00:00
|
|
|
|
|
|
|
seqbase_clipboard.first = first_seq;
|
|
|
|
seqbase_clipboard.last = ed->seqbasep->last;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (first_seq->prev) {
|
2011-03-25 11:45:55 +00:00
|
|
|
first_seq->prev->next = NULL;
|
|
|
|
ed->seqbasep->last = first_seq->prev;
|
|
|
|
first_seq->prev = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seqbase_clipboard_frame = scene->r.cfra;
|
2009-12-17 16:28:45 +00:00
|
|
|
|
|
|
|
/* Need to remove anything that references the current scene */
|
2012-10-12 14:35:10 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
|
|
|
for (seq = seqbase_clipboard.first; seq; seq = seq->next) {
|
|
|
|
seq_copy_del_sound(scene, seq);
|
|
|
|
}
|
2009-12-17 16:28:45 +00:00
|
|
|
}
|
2009-12-17 14:45:47 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_copy(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Copy";
|
|
|
|
ot->idname = "SEQUENCER_OT_copy";
|
|
|
|
ot->description = "";
|
2009-12-17 14:45:47 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_copy_exec;
|
|
|
|
ot->poll = sequencer_edit_poll;
|
2009-12-17 14:45:47 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER;
|
2009-12-17 14:45:47 +00:00
|
|
|
|
|
|
|
/* properties */
|
|
|
|
}
|
|
|
|
|
2010-10-15 01:36:14 +00:00
|
|
|
static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-12-17 14:45:47 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, TRUE); /* create if needed */
|
2010-06-24 10:04:18 +00:00
|
|
|
ListBase nseqbase = {NULL, NULL};
|
2009-12-17 16:28:45 +00:00
|
|
|
int ofs;
|
|
|
|
Sequence *iseq;
|
|
|
|
|
2012-05-29 05:45:06 +00:00
|
|
|
ED_sequencer_deselect_all(scene);
|
2009-12-17 16:28:45 +00:00
|
|
|
ofs = scene->r.cfra - seqbase_clipboard_frame;
|
2009-12-17 14:45:47 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_base_dupli_recursive(scene, NULL, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME);
|
2009-12-17 14:45:47 +00:00
|
|
|
|
2009-12-17 16:28:45 +00:00
|
|
|
/* transform pasted strips before adding */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ofs) {
|
2012-03-29 22:26:11 +00:00
|
|
|
for (iseq = nseqbase.first; iseq; iseq = iseq->next) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_translate(scene, iseq, ofs);
|
|
|
|
BKE_sequence_sound_init(scene, iseq);
|
2009-12-17 16:28:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-25 11:45:55 +00:00
|
|
|
iseq = nseqbase.first;
|
|
|
|
|
2010-12-21 14:49:34 +00:00
|
|
|
BLI_movelisttolist(ed->seqbasep, &nseqbase);
|
2009-12-17 16:28:45 +00:00
|
|
|
|
2011-03-25 11:45:55 +00:00
|
|
|
/* make sure the pasted strips have unique names between them */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (; iseq; iseq = iseq->next) {
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_recursive_apply(iseq, apply_unique_name_cb, scene);
|
2012-02-13 17:29:10 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2009-12-17 14:45:47 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_paste(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Paste";
|
|
|
|
ot->idname = "SEQUENCER_OT_paste";
|
|
|
|
ot->description = "";
|
2009-12-17 14:45:47 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_paste_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
2009-12-17 14:45:47 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-12-17 14:45:47 +00:00
|
|
|
|
|
|
|
/* properties */
|
|
|
|
}
|
2010-06-21 17:37:50 +00:00
|
|
|
|
|
|
|
static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2010-06-21 17:37:50 +00:00
|
|
|
Sequence *seq_act;
|
|
|
|
Sequence *seq_other;
|
2011-05-28 09:59:34 +00:00
|
|
|
const char *error_msg;
|
2010-06-21 17:37:50 +00:00
|
|
|
|
2012-05-11 10:04:55 +00:00
|
|
|
if (BKE_sequencer_active_get_pair(scene, &seq_act, &seq_other) == 0) {
|
2012-10-14 15:29:09 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Please select two strips");
|
2010-06-21 17:37:50 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_swap(seq_act, seq_other, &error_msg) == 0) {
|
2011-05-28 09:59:34 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, error_msg);
|
2010-06-21 17:37:50 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
2012-07-02 10:41:56 +00:00
|
|
|
if (seq_act->scene_sound)
|
|
|
|
sound_remove_scene_sound(scene, seq_act->scene_sound);
|
|
|
|
|
|
|
|
if (seq_other->scene_sound)
|
|
|
|
sound_remove_scene_sound(scene, seq_other->scene_sound);
|
2010-07-04 10:51:10 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq_act->scene_sound = NULL;
|
|
|
|
seq_other->scene_sound = NULL;
|
2010-07-04 10:51:10 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq_act);
|
|
|
|
BKE_sequence_calc(scene, seq_other);
|
2010-06-21 17:37:50 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act);
|
|
|
|
if (seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other);
|
2010-07-04 10:22:31 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2010-06-21 17:37:50 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_swap_data(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Sequencer Swap Data";
|
|
|
|
ot->idname = "SEQUENCER_OT_swap_data";
|
|
|
|
ot->description = "Swap 2 sequencer strips";
|
2010-06-21 17:37:50 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_swap_data_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
2010-06-21 17:37:50 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2010-06-21 17:37:50 +00:00
|
|
|
|
|
|
|
/* properties */
|
|
|
|
}
|
|
|
|
|
2010-07-08 10:03:29 +00:00
|
|
|
/* borderselect operator */
|
|
|
|
static int view_ghost_border_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
2012-03-29 22:26:11 +00:00
|
|
|
View2D *v2d = UI_view2d_fromcontext(C);
|
2010-07-08 10:03:29 +00:00
|
|
|
|
|
|
|
rctf rect;
|
|
|
|
|
|
|
|
/* convert coordinates of rect to 'tot' rect coordinates */
|
|
|
|
UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmin"), RNA_int_get(op->ptr, "ymin"), &rect.xmin, &rect.ymin);
|
|
|
|
UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmax"), RNA_int_get(op->ptr, "ymax"), &rect.xmax, &rect.ymax);
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (ed == NULL)
|
2010-07-08 10:03:29 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
rect.xmin /= fabsf(BLI_rctf_size_x(&v2d->tot));
|
|
|
|
rect.ymin /= fabsf(BLI_rctf_size_y(&v2d->tot));
|
2010-07-08 10:03:29 +00:00
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
rect.xmax /= fabsf(BLI_rctf_size_x(&v2d->tot));
|
|
|
|
rect.ymax /= fabsf(BLI_rctf_size_y(&v2d->tot));
|
2010-07-08 10:03:29 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
rect.xmin += 0.5f;
|
|
|
|
rect.xmax += 0.5f;
|
|
|
|
rect.ymin += 0.5f;
|
|
|
|
rect.ymax += 0.5f;
|
2010-07-08 10:03:29 +00:00
|
|
|
|
|
|
|
CLAMP(rect.xmin, 0.0f, 1.0f);
|
|
|
|
CLAMP(rect.ymin, 0.0f, 1.0f);
|
|
|
|
CLAMP(rect.xmax, 0.0f, 1.0f);
|
|
|
|
CLAMP(rect.ymax, 0.0f, 1.0f);
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
scene->ed->over_border = rect;
|
2010-07-08 10:03:29 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2010-07-08 10:03:29 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ****** Border Select ****** */
|
|
|
|
void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Border Offset View";
|
|
|
|
ot->idname = "SEQUENCER_OT_view_ghost_border";
|
|
|
|
ot->description = "Enable border select mode";
|
2010-07-08 10:03:29 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = WM_border_select_invoke;
|
|
|
|
ot->exec = view_ghost_border_exec;
|
|
|
|
ot->modal = WM_border_select_modal;
|
|
|
|
ot->poll = sequencer_view_poll;
|
|
|
|
ot->cancel = WM_border_select_cancel;
|
2010-07-08 10:03:29 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = 0;
|
2010-07-08 10:03:29 +00:00
|
|
|
|
|
|
|
/* rna */
|
|
|
|
WM_operator_properties_gesture_border(ot, FALSE);
|
|
|
|
}
|
2011-08-12 06:08:22 +00:00
|
|
|
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
/* rebuild_proxy operator */
|
|
|
|
static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
|
|
|
|
{
|
2012-02-29 12:08:26 +00:00
|
|
|
seq_proxy_build_job(C);
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Rebuild Proxy and Timecode Indices";
|
|
|
|
ot->idname = "SEQUENCER_OT_rebuild_proxy";
|
2012-07-04 15:52:07 +00:00
|
|
|
ot->description = "Rebuild all selected proxies and timecode indices using the job system";
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_rebuild_proxy_exec;
|
|
|
|
ot->poll = ED_operator_sequencer_active;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
}
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* change ops */
|
|
|
|
|
|
|
|
static EnumPropertyItem prop_change_effect_input_types[] = {
|
|
|
|
{0, "A_B", 0, "A -> B", ""},
|
|
|
|
{1, "B_C", 0, "B -> C", ""},
|
|
|
|
{2, "A_C", 0, "A -> C", ""},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
|
|
|
Sequence *seq = BKE_sequencer_active_get(scene);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
Sequence **seq_1, **seq_2;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
switch (RNA_enum_get(op->ptr, "swap")) {
|
2011-08-12 06:08:22 +00:00
|
|
|
case 0:
|
2012-03-29 22:26:11 +00:00
|
|
|
seq_1 = &seq->seq1;
|
|
|
|
seq_2 = &seq->seq2;
|
2011-08-12 06:08:22 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2012-03-29 22:26:11 +00:00
|
|
|
seq_1 = &seq->seq2;
|
|
|
|
seq_2 = &seq->seq3;
|
2011-08-12 06:08:22 +00:00
|
|
|
break;
|
|
|
|
default: /* 2 */
|
2012-03-29 22:26:11 +00:00
|
|
|
seq_1 = &seq->seq1;
|
|
|
|
seq_2 = &seq->seq3;
|
2011-08-12 06:08:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (*seq_1 == NULL || *seq_2 == NULL) {
|
2012-10-26 17:32:50 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, cannot swap");
|
2011-08-12 06:08:22 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SWAP(Sequence *, *seq_1, *seq_2);
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_changed_seq_and_deps(scene, seq, 0, 1);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* important else we don't get the imbuf cache flushed */
|
2012-09-14 14:28:24 +00:00
|
|
|
BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Change Effect Input";
|
|
|
|
ot->idname = "SEQUENCER_OT_change_effect_input";
|
|
|
|
ot->description = "";
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_change_effect_input_exec;
|
|
|
|
ot->poll = sequencer_effect_poll;
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->prop = RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
|
|
|
Sequence *seq = BKE_sequencer_active_get(scene);
|
2012-03-29 22:26:11 +00:00
|
|
|
const int new_type = RNA_enum_get(op->ptr, "type");
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* free previous effect and init new effect */
|
|
|
|
struct SeqEffectHandle sh;
|
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
if ((seq->type & SEQ_TYPE_EFFECT) == 0) {
|
2011-08-12 06:08:22 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
2012-03-04 04:35:12 +00:00
|
|
|
/* can someone explain the logic behind only allowing to increase this,
|
2011-08-12 06:08:22 +00:00
|
|
|
* copied from 2.4x - campbell */
|
2012-08-08 11:15:40 +00:00
|
|
|
if (BKE_sequence_effect_get_num_inputs(seq->type) <
|
|
|
|
BKE_sequence_effect_get_num_inputs(new_type))
|
2012-03-29 22:26:11 +00:00
|
|
|
{
|
2011-08-12 06:08:22 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "New effect needs more input strips");
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
else {
|
2012-08-08 11:15:40 +00:00
|
|
|
sh = BKE_sequence_get_effect(seq);
|
2011-08-12 06:08:22 +00:00
|
|
|
sh.free(seq);
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->type = new_type;
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
sh = BKE_sequence_get_effect(seq);
|
2011-08-12 06:08:22 +00:00
|
|
|
sh.init(seq);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* update */
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_update_changed_seq_and_deps(scene, seq, 0, 1);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* important else we don't get the imbuf cache flushed */
|
2012-09-14 14:28:24 +00:00
|
|
|
BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Change Effect Type";
|
|
|
|
ot->idname = "SEQUENCER_OT_change_effect_type";
|
|
|
|
ot->description = "";
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_change_effect_type_exec;
|
|
|
|
ot->poll = sequencer_effect_poll;
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_TYPE_CROSS, "Type", "Sequencer effect type");
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int sequencer_change_path_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Main *bmain = CTX_data_main(C);
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
|
|
|
Sequence *seq = BKE_sequencer_active_get(scene);
|
2012-03-29 22:26:11 +00:00
|
|
|
const int is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_IMAGE) {
|
2011-08-12 06:08:22 +00:00
|
|
|
char directory[FILE_MAX];
|
2012-03-29 22:26:11 +00:00
|
|
|
const int len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
|
2011-08-12 06:08:22 +00:00
|
|
|
StripElem *se;
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (len == 0)
|
2011-08-12 06:08:22 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
RNA_string_get(op->ptr, "directory", directory);
|
2011-10-12 00:21:08 +00:00
|
|
|
if (is_relative_path) {
|
2011-10-15 14:14:22 +00:00
|
|
|
/* TODO, shouldn't this already be relative from the filesel?
|
2011-10-12 00:21:08 +00:00
|
|
|
* (as the 'filepath' is) for now just make relative here,
|
|
|
|
* but look into changing after 2.60 - campbell */
|
|
|
|
BLI_path_rel(directory, bmain->name);
|
|
|
|
}
|
2011-08-12 06:08:22 +00:00
|
|
|
BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir));
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->strip->stripdata) {
|
2011-08-12 06:08:22 +00:00
|
|
|
MEM_freeN(seq->strip->stripdata);
|
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem");
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-04-30 16:22:40 +00:00
|
|
|
RNA_BEGIN (op->ptr, itemptr, "files")
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
|
2011-08-12 06:08:22 +00:00
|
|
|
BLI_strncpy(se->name, filename, sizeof(se->name));
|
|
|
|
MEM_freeN(filename);
|
|
|
|
se++;
|
|
|
|
}
|
|
|
|
RNA_END;
|
|
|
|
|
2011-08-14 03:59:22 +00:00
|
|
|
/* reset these else we wont see all the images */
|
2012-03-29 22:26:11 +00:00
|
|
|
seq->anim_startofs = seq->anim_endofs = 0;
|
2011-08-14 03:59:22 +00:00
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* correct start/end frames so we don't move
|
2012-10-26 04:14:10 +00:00
|
|
|
* important not to set seq->len = len; allow the function to handle it */
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_reload_new_file(scene, seq, TRUE);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_calc(scene, seq);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* important else we don't get the imbuf cache flushed */
|
2012-09-14 14:28:24 +00:00
|
|
|
BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* lame, set rna filepath */
|
|
|
|
PointerRNA seq_ptr;
|
2011-08-14 14:43:11 +00:00
|
|
|
PropertyRNA *prop;
|
2011-08-12 06:08:22 +00:00
|
|
|
char filepath[FILE_MAX];
|
|
|
|
|
|
|
|
RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr);
|
|
|
|
|
|
|
|
RNA_string_get(op->ptr, "filepath", filepath);
|
2012-03-29 22:26:11 +00:00
|
|
|
prop = RNA_struct_find_property(&seq_ptr, "filepath");
|
2011-08-14 14:43:11 +00:00
|
|
|
RNA_property_string_set(&seq_ptr, prop, filepath);
|
|
|
|
RNA_property_update(C, &seq_ptr, prop);
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
|
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-05-11 10:04:55 +00:00
|
|
|
Sequence *seq = BKE_sequencer_active_get(scene);
|
2012-12-06 02:38:39 +00:00
|
|
|
char filepath[FILE_MAX];
|
|
|
|
|
|
|
|
BLI_join_dirfile(filepath, sizeof(filepath), seq->strip->dir, seq->strip->stripdata->name);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
RNA_string_set(op->ptr, "directory", seq->strip->dir);
|
2012-12-06 02:38:39 +00:00
|
|
|
RNA_string_set(op->ptr, "filepath", filepath);
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* set default display depending on seq type */
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_IMAGE) {
|
2012-01-16 16:12:03 +00:00
|
|
|
RNA_boolean_set(op->ptr, "filter_movie", FALSE);
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-01-16 16:12:03 +00:00
|
|
|
RNA_boolean_set(op->ptr, "filter_image", FALSE);
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WM_event_add_fileselect(C, op);
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Change Data/Files";
|
|
|
|
ot->idname = "SEQUENCER_OT_change_path";
|
|
|
|
ot->description = "";
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = sequencer_change_path_exec;
|
|
|
|
ot->invoke = sequencer_change_path_invoke;
|
|
|
|
ot->poll = sequencer_strip_has_path_poll;
|
2011-08-12 06:08:22 +00:00
|
|
|
|
|
|
|
/* flags */
|
2012-03-29 22:26:11 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2011-08-12 06:08:22 +00:00
|
|
|
|
2012-08-04 12:54:27 +00:00
|
|
|
WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE,
|
|
|
|
WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILEPATH | WM_FILESEL_FILES,
|
|
|
|
FILE_DEFAULTDISPLAY);
|
2011-08-12 06:08:22 +00:00
|
|
|
}
|
2012-03-22 13:22:28 +00:00
|
|
|
|