Cleanup: Fix comment style and check if they are valid or make sense.
This commit is contained in:
parent
43cc2f3195
commit
0d0036cb53
@ -51,8 +51,7 @@
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
/* for menu/popup icons etc etc*/
|
||||
|
||||
/* For menu, popup, icons, etc. */
|
||||
#include "ED_screen.h"
|
||||
#include "ED_sequencer.h"
|
||||
|
||||
@ -67,16 +66,16 @@
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
|
||||
/* own include */
|
||||
/* Own include. */
|
||||
#include "sequencer_intern.h"
|
||||
|
||||
typedef struct SequencerAddData {
|
||||
ImageFormatData im_format;
|
||||
} SequencerAddData;
|
||||
|
||||
/* Generic functions, reused by add strip operators */
|
||||
/* Generic functions, reused by add strip operators. */
|
||||
|
||||
/* avoid passing multiple args and be more verbose */
|
||||
/* Avoid passing multiple args and be more verbose. */
|
||||
#define SEQPROP_STARTFRAME (1 << 0)
|
||||
#define SEQPROP_ENDFRAME (1 << 1)
|
||||
#define SEQPROP_NOPATHS (1 << 2)
|
||||
@ -101,7 +100,7 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
|
||||
}
|
||||
|
||||
if (flag & SEQPROP_ENDFRAME) {
|
||||
/* not usual since most strips have a fixed length */
|
||||
/* Not usual since most strips have a fixed length. */
|
||||
RNA_def_int(ot->srna,
|
||||
"frame_end",
|
||||
0,
|
||||
@ -119,7 +118,7 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
|
||||
RNA_def_boolean(
|
||||
ot->srna, "replace_sel", 1, "Replace Selection", "Replace the current selection");
|
||||
|
||||
/* only for python scripts which import strips and place them after */
|
||||
/* Only for python scripts which import strips and place them after. */
|
||||
prop = RNA_def_boolean(
|
||||
ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
@ -175,7 +174,7 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, i
|
||||
|
||||
int cfra = (int)CFRA;
|
||||
|
||||
/* effect strips don't need a channel initialized from the mouse */
|
||||
/* Effect strips don't need a channel initialized from the mouse. */
|
||||
if (!(flag & SEQPROP_NOCHAN) && RNA_struct_property_is_set(op->ptr, "channel") == 0) {
|
||||
RNA_int_set(op->ptr, "channel", sequencer_generic_invoke_xy_guess_channel(C, type));
|
||||
}
|
||||
@ -203,18 +202,17 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato
|
||||
memset(seq_load, 0, sizeof(SeqLoadInfo));
|
||||
|
||||
seq_load->start_frame = RNA_int_get(op->ptr, "frame_start");
|
||||
seq_load->end_frame = seq_load->start_frame; /* un-set */
|
||||
|
||||
seq_load->end_frame = seq_load->start_frame;
|
||||
seq_load->channel = RNA_int_get(op->ptr, "channel");
|
||||
seq_load->len = 1; // images only, if endframe isn't set!
|
||||
seq_load->len = 1;
|
||||
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "filepath"))) {
|
||||
/* full path, file is set by the caller */
|
||||
/* Full path, file is set by the caller. */
|
||||
RNA_property_string_get(op->ptr, prop, seq_load->path);
|
||||
is_file = 1;
|
||||
}
|
||||
else if ((prop = RNA_struct_find_property(op->ptr, "directory"))) {
|
||||
/* full path, file is set by the caller */
|
||||
/* Full path, file is set by the caller. */
|
||||
RNA_property_string_get(op->ptr, prop, seq_load->path);
|
||||
is_file = 0;
|
||||
}
|
||||
@ -252,15 +250,13 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato
|
||||
seq_load->flag |= SEQ_LOAD_SYNC_FPS;
|
||||
}
|
||||
|
||||
/* always use this for ops */
|
||||
/* Create consecutive array of strips. */
|
||||
seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
|
||||
|
||||
if (is_file == 1) {
|
||||
BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name));
|
||||
}
|
||||
else if ((prop = RNA_struct_find_property(op->ptr, "files"))) {
|
||||
/* used for image strip */
|
||||
/* best guess, first images name */
|
||||
RNA_PROP_BEGIN (op->ptr, itemptr, prop) {
|
||||
char *name = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
|
||||
BLI_strncpy(seq_load->name, name, sizeof(seq_load->name));
|
||||
@ -278,9 +274,6 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato
|
||||
|
||||
seq_load->views_format = imf->views_format;
|
||||
seq_load->flag |= SEQ_USE_VIEWS;
|
||||
|
||||
/* operator custom data is always released after the SeqLoadInfo,
|
||||
* no need to handle the memory here */
|
||||
seq_load->stereo3d_format = &imf->stereo3d_format;
|
||||
}
|
||||
}
|
||||
@ -332,22 +325,17 @@ static bool seq_effect_add_properties_poll(const bContext *UNUSED(C),
|
||||
return true;
|
||||
}
|
||||
|
||||
/* add scene operator */
|
||||
static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, true);
|
||||
|
||||
Scene *sce_seq;
|
||||
Sequence *seq;
|
||||
|
||||
Sequence *seq; /* generic strip vars */
|
||||
|
||||
int start_frame, channel; /* operator props */
|
||||
|
||||
int start_frame, channel;
|
||||
start_frame = RNA_int_get(op->ptr, "frame_start");
|
||||
channel = RNA_int_get(op->ptr, "channel");
|
||||
|
||||
sce_seq = BLI_findlink(&bmain->scenes, RNA_enum_get(op->ptr, "scene"));
|
||||
|
||||
if (sce_seq == NULL) {
|
||||
@ -356,11 +344,8 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, SEQ_TYPE_SCENE);
|
||||
seq->blend_mode = SEQ_TYPE_CROSS; /* so alpha adjustment fade to the strip below */
|
||||
|
||||
seq->blend_mode = SEQ_TYPE_CROSS;
|
||||
seq->scene = sce_seq;
|
||||
|
||||
/* basic defaults */
|
||||
seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
|
||||
|
||||
BLI_strncpy(seq->name + 2, sce_seq->id.name + 2, sizeof(seq->name) - 2);
|
||||
@ -388,26 +373,23 @@ static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, const w
|
||||
|
||||
sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_SCENE);
|
||||
return sequencer_add_scene_strip_exec(C, op);
|
||||
// needs a menu
|
||||
// return WM_menu_invoke(C, op, event);
|
||||
}
|
||||
|
||||
void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Add Scene Strip";
|
||||
ot->idname = "SEQUENCER_OT_scene_strip_add";
|
||||
ot->description = "Add a strip to the sequencer using a blender scene as a source";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_add_scene_strip_invoke;
|
||||
ot->exec = sequencer_add_scene_strip_exec;
|
||||
|
||||
ot->poll = ED_operator_sequencer_active_editable;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
|
||||
@ -417,22 +399,17 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
|
||||
ot->prop = prop;
|
||||
}
|
||||
|
||||
/* add movieclip operator */
|
||||
static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, true);
|
||||
|
||||
MovieClip *clip;
|
||||
Sequence *seq;
|
||||
|
||||
Sequence *seq; /* generic strip vars */
|
||||
|
||||
int start_frame, channel; /* operator props */
|
||||
|
||||
int start_frame, channel;
|
||||
start_frame = RNA_int_get(op->ptr, "frame_start");
|
||||
channel = RNA_int_get(op->ptr, "channel");
|
||||
|
||||
clip = BLI_findlink(&bmain->movieclips, RNA_enum_get(op->ptr, "clip"));
|
||||
|
||||
if (clip == NULL) {
|
||||
@ -443,12 +420,10 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
|
||||
seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, SEQ_TYPE_MOVIECLIP);
|
||||
seq->blend_mode = SEQ_TYPE_CROSS;
|
||||
seq->clip = clip;
|
||||
seq->len = BKE_movieclip_get_duration(clip);
|
||||
|
||||
id_us_ensure_real(&seq->clip->id);
|
||||
|
||||
/* basic defaults */
|
||||
seq->len = BKE_movieclip_get_duration(clip);
|
||||
|
||||
BLI_strncpy(seq->name + 2, clip->id.name + 2, sizeof(seq->name) - 2);
|
||||
BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
|
||||
|
||||
@ -473,26 +448,23 @@ static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, con
|
||||
|
||||
sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MOVIECLIP);
|
||||
return sequencer_add_movieclip_strip_exec(C, op);
|
||||
// needs a menu
|
||||
// return WM_menu_invoke(C, op, event);
|
||||
}
|
||||
|
||||
void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Add MovieClip Strip";
|
||||
ot->idname = "SEQUENCER_OT_movieclip_strip_add";
|
||||
ot->description = "Add a movieclip strip to the sequencer";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_add_movieclip_strip_invoke;
|
||||
ot->exec = sequencer_add_movieclip_strip_exec;
|
||||
|
||||
ot->poll = ED_operator_sequencer_active_editable;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
|
||||
@ -508,16 +480,12 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op)
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, true);
|
||||
|
||||
Mask *mask;
|
||||
Sequence *seq;
|
||||
|
||||
Sequence *seq; /* generic strip vars */
|
||||
|
||||
int start_frame, channel; /* operator props */
|
||||
|
||||
int start_frame, channel;
|
||||
start_frame = RNA_int_get(op->ptr, "frame_start");
|
||||
channel = RNA_int_get(op->ptr, "channel");
|
||||
|
||||
mask = BLI_findlink(&bmain->masks, RNA_enum_get(op->ptr, "mask"));
|
||||
|
||||
if (mask == NULL) {
|
||||
@ -528,12 +496,10 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op)
|
||||
seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, SEQ_TYPE_MASK);
|
||||
seq->blend_mode = SEQ_TYPE_CROSS;
|
||||
seq->mask = mask;
|
||||
seq->len = BKE_mask_get_duration(mask);
|
||||
|
||||
id_us_ensure_real(&seq->mask->id);
|
||||
|
||||
/* basic defaults */
|
||||
seq->len = BKE_mask_get_duration(mask);
|
||||
|
||||
BLI_strncpy(seq->name + 2, mask->id.name + 2, sizeof(seq->name) - 2);
|
||||
BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
|
||||
|
||||
@ -558,26 +524,23 @@ static int sequencer_add_mask_strip_invoke(bContext *C, wmOperator *op, const wm
|
||||
|
||||
sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MASK);
|
||||
return sequencer_add_mask_strip_exec(C, op);
|
||||
// needs a menu
|
||||
// return WM_menu_invoke(C, op, event);
|
||||
}
|
||||
|
||||
void SEQUENCER_OT_mask_strip_add(struct wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Add Mask Strip";
|
||||
ot->idname = "SEQUENCER_OT_mask_strip_add";
|
||||
ot->description = "Add a mask strip to the sequencer";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_add_mask_strip_invoke;
|
||||
ot->exec = sequencer_add_mask_strip_exec;
|
||||
|
||||
ot->poll = ED_operator_sequencer_active_editable;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
|
||||
@ -589,7 +552,7 @@ void SEQUENCER_OT_mask_strip_add(struct wmOperatorType *ot)
|
||||
|
||||
static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFn seq_load_fn)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C); /* only for sound */
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, true);
|
||||
SeqLoadInfo seq_load;
|
||||
int tot_files;
|
||||
@ -603,7 +566,6 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
|
||||
tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
|
||||
|
||||
if (tot_files > 1) {
|
||||
/* multiple files */
|
||||
char dir_only[FILE_MAX];
|
||||
char file_only[FILE_MAX];
|
||||
|
||||
@ -614,7 +576,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
|
||||
RNA_string_get(&itemptr, "name", file_only);
|
||||
BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
|
||||
|
||||
/* Set seq_load.name, else all video/audio files get the same name! ugly! */
|
||||
/* Set seq_load.name, otherwise all video/audio files get the same name. */
|
||||
BLI_strncpy(seq_load.name, file_only, sizeof(seq_load.name));
|
||||
|
||||
seq = seq_load_fn(C, ed->seqbasep, &seq_load);
|
||||
@ -627,11 +589,10 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
|
||||
}
|
||||
RNA_END;
|
||||
}
|
||||
else {
|
||||
else { /* Single file./ */
|
||||
Sequence *seq;
|
||||
|
||||
/* single file */
|
||||
seq = seq_load_fn(C, ed->seqbasep, &seq_load);
|
||||
|
||||
if (seq) {
|
||||
sequencer_add_apply_overlap(C, op, seq);
|
||||
if (seq_load.seq_sound) {
|
||||
@ -658,7 +619,6 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* add sequencer operators */
|
||||
static void sequencer_add_init(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
op->customdata = MEM_callocN(sizeof(SequencerAddData), __func__);
|
||||
@ -673,8 +633,8 @@ static void sequencer_add_cancel(bContext *UNUSED(C), wmOperator *op)
|
||||
}
|
||||
|
||||
static bool sequencer_add_draw_check_fn(PointerRNA *UNUSED(ptr),
|
||||
PropertyRNA *prop,
|
||||
void *UNUSED(user_data))
|
||||
PropertyRNA *prop,
|
||||
void *UNUSED(user_data))
|
||||
{
|
||||
const char *prop_id = RNA_property_identifier(prop);
|
||||
|
||||
@ -682,7 +642,6 @@ static bool sequencer_add_draw_check_fn(PointerRNA *UNUSED(ptr),
|
||||
STREQ(prop_id, "filename"));
|
||||
}
|
||||
|
||||
/* add movie operator */
|
||||
static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
return sequencer_add_generic_strip_exec(C, op, BKE_sequencer_add_movie_strip);
|
||||
@ -696,20 +655,12 @@ static int sequencer_add_movie_strip_invoke(bContext *C,
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, false);
|
||||
|
||||
/* only enable "use_framerate" if there aren't any existing strips
|
||||
* - When there are no strips yet, there is no harm in enabling this,
|
||||
* and it makes the single-strip case really nice for casual users
|
||||
* - When there are strips, it's best we don't touch the framerate,
|
||||
* as all hell may break loose (e.g. audio strips start overlapping
|
||||
* and can't be restored)
|
||||
* - These initial guesses can still be manually overridden by users
|
||||
* from the modal options panel
|
||||
*/
|
||||
/* Only enable "use_framerate" if there aren't any existing strips, unless overriden by user. */
|
||||
if (ed && ed->seqbasep && ed->seqbasep->first) {
|
||||
RNA_boolean_set(op->ptr, "use_framerate", false);
|
||||
}
|
||||
|
||||
/* This is for drag and drop */
|
||||
/* This is for drag and drop. */
|
||||
if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) ||
|
||||
RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
sequencer_generic_invoke_xy__internal(C, op, SEQPROP_NOPATHS, SEQ_TYPE_MOVIE);
|
||||
@ -717,17 +668,14 @@ static int sequencer_add_movie_strip_invoke(bContext *C,
|
||||
}
|
||||
|
||||
sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MOVIE);
|
||||
|
||||
sequencer_add_init(C, op);
|
||||
|
||||
/* show multiview save options only if scene has multiviews */
|
||||
/* Show multiview save options only if scene use multiview. */
|
||||
prop = RNA_struct_find_property(op->ptr, "show_multiview");
|
||||
RNA_property_boolean_set(op->ptr, prop, (scene->r.scemode & R_MULTIVIEW) != 0);
|
||||
|
||||
WM_event_add_fileselect(C, op);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
||||
// return sequencer_add_movie_strip_exec(C, op);
|
||||
}
|
||||
|
||||
static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
@ -737,15 +685,15 @@ static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
ImageFormatData *imf = &sad->im_format;
|
||||
PointerRNA imf_ptr, ptr;
|
||||
|
||||
/* main draw call */
|
||||
/* Main draw call. */
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
uiDefAutoButsRNA(
|
||||
layout, &ptr, sequencer_add_draw_check_fn, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
|
||||
/* image template */
|
||||
/* Image template. */
|
||||
RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr);
|
||||
|
||||
/* multiview template */
|
||||
/* Multiview template. */
|
||||
if (RNA_boolean_get(op->ptr, "show_multiview")) {
|
||||
uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr);
|
||||
}
|
||||
@ -754,20 +702,19 @@ static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Add Movie Strip";
|
||||
ot->idname = "SEQUENCER_OT_movie_strip_add";
|
||||
ot->description = "Add a movie strip to the sequencer";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_add_movie_strip_invoke;
|
||||
ot->exec = sequencer_add_movie_strip_exec;
|
||||
ot->cancel = sequencer_add_cancel;
|
||||
ot->ui = sequencer_add_draw;
|
||||
|
||||
ot->poll = ED_operator_sequencer_active_editable;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
WM_operator_properties_filesel(ot,
|
||||
@ -787,8 +734,6 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
|
||||
"Use framerate from the movie to keep sound and video in sync");
|
||||
}
|
||||
|
||||
/* add sound operator */
|
||||
|
||||
static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
return sequencer_add_generic_strip_exec(C, op, BKE_sequencer_add_sound_strip);
|
||||
@ -798,7 +743,7 @@ static int sequencer_add_sound_strip_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
{
|
||||
/* This is for drag and drop */
|
||||
/* This is for drag and drop. */
|
||||
if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) ||
|
||||
RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
sequencer_generic_invoke_xy__internal(C, op, SEQPROP_NOPATHS, SEQ_TYPE_SOUND_RAM);
|
||||
@ -809,25 +754,22 @@ static int sequencer_add_sound_strip_invoke(bContext *C,
|
||||
|
||||
WM_event_add_fileselect(C, op);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
||||
// return sequencer_add_sound_strip_exec(C, op);
|
||||
}
|
||||
|
||||
void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Add Sound Strip";
|
||||
ot->idname = "SEQUENCER_OT_sound_strip_add";
|
||||
ot->description = "Add a sound strip to the sequencer";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_add_sound_strip_invoke;
|
||||
ot->exec = sequencer_add_sound_strip_exec;
|
||||
|
||||
ot->poll = ED_operator_sequencer_active_editable;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
WM_operator_properties_filesel(ot,
|
||||
@ -854,7 +796,6 @@ int sequencer_image_seq_get_minmax_frame(wmOperator *op,
|
||||
RNA_BEGIN (op->ptr, itemptr, "files") {
|
||||
char *filename;
|
||||
int frame;
|
||||
/* just get the first filename */
|
||||
filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
|
||||
|
||||
if (filename) {
|
||||
@ -885,7 +826,6 @@ void sequencer_image_seq_reserve_frames(
|
||||
int i;
|
||||
char *filename = NULL;
|
||||
RNA_BEGIN (op->ptr, itemptr, "files") {
|
||||
/* just get the first filename */
|
||||
filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
|
||||
break;
|
||||
}
|
||||
@ -894,7 +834,7 @@ void sequencer_image_seq_reserve_frames(
|
||||
if (filename) {
|
||||
char ext[PATH_MAX];
|
||||
char filename_stripped[PATH_MAX];
|
||||
/* strip the frame from filename and substitute with # */
|
||||
/* Strip the frame from filename and substitute with `#`. */
|
||||
BLI_path_frame_strip(filename, ext);
|
||||
|
||||
for (i = 0; i < len; i++, se++) {
|
||||
@ -907,23 +847,20 @@ void sequencer_image_seq_reserve_frames(
|
||||
}
|
||||
}
|
||||
|
||||
/* add image operator */
|
||||
static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
int minframe, numdigits;
|
||||
/* cant use the generic function for this */
|
||||
Scene *scene = CTX_data_scene(C); /* only for sound */
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, true);
|
||||
SeqLoadInfo seq_load;
|
||||
Sequence *seq;
|
||||
|
||||
Strip *strip;
|
||||
StripElem *se;
|
||||
const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders");
|
||||
|
||||
seq_load_operator_info(&seq_load, C, op);
|
||||
|
||||
/* images are unique in how they handle this - 1 per strip elem */
|
||||
/* Images are unique in how they handle this - 1 per strip elem. */
|
||||
if (use_placeholders) {
|
||||
seq_load.len = sequencer_image_seq_get_minmax_frame(
|
||||
op, seq_load.start_frame, &minframe, &numdigits);
|
||||
@ -941,11 +878,10 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
|
||||
ED_sequencer_deselect_all(scene);
|
||||
}
|
||||
|
||||
/* main adding function */
|
||||
/* Main adding function. */
|
||||
seq = BKE_sequencer_add_image_strip(C, ed->seqbasep, &seq_load);
|
||||
strip = seq->strip;
|
||||
se = strip->stripdata;
|
||||
|
||||
seq->blend_mode = SEQ_TYPE_ALPHAOVER;
|
||||
|
||||
if (use_placeholders) {
|
||||
@ -968,21 +904,18 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
BKE_sequence_init_colorspace(seq);
|
||||
|
||||
BKE_sequence_calc_disp(scene, seq);
|
||||
|
||||
BKE_sequencer_sort(scene);
|
||||
|
||||
/* last active name */
|
||||
/* Last active name. */
|
||||
BLI_strncpy(ed->act_imagedir, strip->dir, sizeof(ed->act_imagedir));
|
||||
|
||||
sequencer_add_apply_overlap(C, op, seq);
|
||||
|
||||
if (op->customdata) {
|
||||
MEM_freeN(op->customdata);
|
||||
}
|
||||
BKE_sequence_invalidate_cache_composite(scene, seq);
|
||||
|
||||
BKE_sequence_invalidate_cache_composite(scene, seq);
|
||||
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
||||
|
||||
@ -996,7 +929,7 @@ static int sequencer_add_image_strip_invoke(bContext *C,
|
||||
PropertyRNA *prop;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
/* drag drop has set the names */
|
||||
/* Name set already by drag and drop. */
|
||||
if (RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) {
|
||||
sequencer_generic_invoke_xy__internal(
|
||||
C, op, SEQPROP_ENDFRAME | SEQPROP_NOPATHS, SEQ_TYPE_IMAGE);
|
||||
@ -1004,10 +937,9 @@ static int sequencer_add_image_strip_invoke(bContext *C,
|
||||
}
|
||||
|
||||
sequencer_generic_invoke_xy__internal(C, op, SEQPROP_ENDFRAME, SEQ_TYPE_IMAGE);
|
||||
|
||||
sequencer_add_init(C, op);
|
||||
|
||||
/* show multiview save options only if scene has multiviews */
|
||||
/* Show multiview save options only if scene use multiview. */
|
||||
prop = RNA_struct_find_property(op->ptr, "show_multiview");
|
||||
RNA_property_boolean_set(op->ptr, prop, (scene->r.scemode & R_MULTIVIEW) != 0);
|
||||
|
||||
@ -1018,20 +950,19 @@ static int sequencer_add_image_strip_invoke(bContext *C,
|
||||
void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Add Image Strip";
|
||||
ot->idname = "SEQUENCER_OT_image_strip_add";
|
||||
ot->description = "Add an image or image sequence to the sequencer";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_add_image_strip_invoke;
|
||||
ot->exec = sequencer_add_image_strip_exec;
|
||||
ot->cancel = sequencer_add_cancel;
|
||||
ot->ui = sequencer_add_draw;
|
||||
|
||||
ot->poll = ED_operator_sequencer_active_editable;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
WM_operator_properties_filesel(ot,
|
||||
@ -1051,65 +982,54 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
|
||||
"Use placeholders for missing frames of the strip");
|
||||
}
|
||||
|
||||
/* add_effect_strip operator */
|
||||
static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, true);
|
||||
|
||||
Sequence *seq; /* generic strip vars */
|
||||
Sequence *seq;
|
||||
struct SeqEffectHandle sh;
|
||||
|
||||
int start_frame, end_frame, channel, type; /* operator props */
|
||||
|
||||
Sequence *seq1, *seq2, *seq3;
|
||||
const char *error_msg;
|
||||
int start_frame, end_frame, channel, type;
|
||||
|
||||
start_frame = RNA_int_get(op->ptr, "frame_start");
|
||||
end_frame = RNA_int_get(op->ptr, "frame_end");
|
||||
channel = RNA_int_get(op->ptr, "channel");
|
||||
|
||||
type = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
// XXX move to invoke
|
||||
if (!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
|
||||
BKE_report(op->reports, RPT_ERROR, error_msg);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* If seq1 is NULL and no error was raised it means the seq is standalone
|
||||
* (like color strips) and we need to check its start and end frames are valid */
|
||||
/* Check its start and end frames are valid. */
|
||||
if (seq1 == NULL && end_frame <= start_frame) {
|
||||
end_frame = start_frame + 1;
|
||||
RNA_int_set(op->ptr, "frame_end", end_frame);
|
||||
}
|
||||
|
||||
seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, type);
|
||||
|
||||
BLI_strncpy(seq->name + 2, BKE_sequence_give_name(seq), sizeof(seq->name) - 2);
|
||||
BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
|
||||
|
||||
sh = BKE_sequence_get_effect(seq);
|
||||
|
||||
sh.init(seq);
|
||||
seq->seq1 = seq1;
|
||||
seq->seq2 = seq2;
|
||||
seq->seq3 = seq3;
|
||||
|
||||
sh.init(seq);
|
||||
|
||||
if (!seq1) { /* effect has no deps */
|
||||
seq->len = 1;
|
||||
if (!seq1) {
|
||||
seq->len = 1; /* Effect is generator, set non zero length. */
|
||||
BKE_sequence_tx_set_final_right(seq, end_frame);
|
||||
}
|
||||
|
||||
seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
|
||||
|
||||
BKE_sequence_calc(scene, seq);
|
||||
|
||||
if (seq->type == SEQ_TYPE_COLOR) {
|
||||
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
|
||||
RNA_float_get_array(op->ptr, "color", colvars->col);
|
||||
seq->blend_mode = SEQ_TYPE_CROSS; /* so alpha adjustment fade to the strip below */
|
||||
seq->blend_mode = SEQ_TYPE_CROSS;
|
||||
}
|
||||
else if (seq->type == SEQ_TYPE_ADJUSTMENT) {
|
||||
seq->blend_mode = SEQ_TYPE_CROSS;
|
||||
@ -1118,8 +1038,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
|
||||
seq->blend_mode = SEQ_TYPE_ALPHAOVER;
|
||||
}
|
||||
|
||||
/* an unset channel is a special case where we automatically go above
|
||||
* the other strips. */
|
||||
/* Set channel.*/
|
||||
if (!RNA_struct_property_is_set(op->ptr, "channel")) {
|
||||
if (seq->seq1) {
|
||||
int chan = max_iii(seq->seq1 ? seq->seq1->machine : 0,
|
||||
@ -1134,20 +1053,16 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
|
||||
sequencer_add_apply_replace_sel(C, op, seq);
|
||||
sequencer_add_apply_overlap(C, op, seq);
|
||||
|
||||
BKE_sequencer_update_changed_seq_and_deps(scene, seq, 1, 1); /* runs BKE_sequence_calc */
|
||||
|
||||
/* not sure if this is needed with update_changed_seq_and_deps.
|
||||
* it was NOT called in blender 2.4x, but wont hurt */
|
||||
BKE_sequencer_update_changed_seq_and_deps(scene, seq, 1, 1); /* Runs BKE_sequence_calc. */
|
||||
BKE_sequencer_sort(scene);
|
||||
BKE_sequence_invalidate_cache_composite(scene, seq);
|
||||
|
||||
BKE_sequence_invalidate_cache_composite(scene, seq);
|
||||
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* add color */
|
||||
static int sequencer_add_effect_strip_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
@ -1159,10 +1074,8 @@ static int sequencer_add_effect_strip_invoke(bContext *C,
|
||||
if (is_type_set) {
|
||||
type = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
/* when invoking an effect strip which uses inputs,
|
||||
* skip initializing the channel from the mouse.
|
||||
* Instead leave the property unset so exec() initializes it to be
|
||||
* above the strips its applied to. */
|
||||
/* When invoking an effect strip which uses inputs, skip initializing the channel from the
|
||||
* mouse. */
|
||||
if (BKE_sequence_effect_get_num_inputs(type) != 0) {
|
||||
prop_flag |= SEQPROP_NOCHAN;
|
||||
}
|
||||
@ -1177,19 +1090,18 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Add Effect Strip";
|
||||
ot->idname = "SEQUENCER_OT_effect_strip_add";
|
||||
ot->description = "Add an effect to the sequencer, most are applied on top of existing strips";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_add_effect_strip_invoke;
|
||||
ot->exec = sequencer_add_effect_strip_exec;
|
||||
|
||||
ot->poll = ED_operator_sequencer_active_editable;
|
||||
ot->poll_property = seq_effect_add_properties_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna,
|
||||
|
@ -54,7 +54,7 @@ static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNU
|
||||
{
|
||||
SpaceSeq *sseq = CTX_wm_space_seq(C);
|
||||
|
||||
/* don't show the gpencil if we are not showing the image */
|
||||
/* Don't show the gpencil if we are not showing the image. */
|
||||
return ED_space_sequencer_check_show_imbuf(sseq);
|
||||
}
|
||||
#endif
|
||||
|
@ -79,20 +79,17 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
/* own include */
|
||||
/* Own include. */
|
||||
#include "sequencer_intern.h"
|
||||
|
||||
#define SEQ_LEFTHANDLE 1
|
||||
#define SEQ_RIGHTHANDLE 2
|
||||
|
||||
#define SEQ_HANDLE_SIZE 8.0f
|
||||
|
||||
#define SEQ_SCROLLER_TEXT_OFFSET 8
|
||||
|
||||
#define MUTE_ALPHA 120
|
||||
|
||||
/* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
|
||||
* it messes up transform, - Campbell */
|
||||
* it messes up transform. */
|
||||
#undef SEQ_BEGIN
|
||||
#undef SEQP_BEGIN
|
||||
#undef SEQ_END
|
||||
@ -141,7 +138,7 @@ void color3ubv_from_seq(Scene *curscene, Sequence *seq, uchar col[3])
|
||||
col[2] = 130;
|
||||
break;
|
||||
|
||||
/* effects */
|
||||
/* Effects. */
|
||||
case SEQ_TYPE_TRANSFORM:
|
||||
case SEQ_TYPE_SPEED:
|
||||
case SEQ_TYPE_ADD:
|
||||
@ -234,13 +231,10 @@ static void draw_seq_waveform(View2D *v2d,
|
||||
float y2,
|
||||
float stepsize)
|
||||
{
|
||||
/*
|
||||
* x1 is the starting x value to draw the wave,
|
||||
* x2 the end x value, same for y1 and y2
|
||||
* stepsize is width of a pixel.
|
||||
*/
|
||||
/* X1, x2 is the starting and end X value to draw the wave, same for y1 and y2.
|
||||
* Stepsize is width of a pixel. */
|
||||
|
||||
/* offset x1 and x2 values, to match view min/max, if strip is out of bounds */
|
||||
/* Offset x1 and x2 values, to match view min/max, if strip is out of bounds. */
|
||||
int x1_offset = max_ff(v2d->cur.xmin, x1);
|
||||
int x2_offset = min_ff(v2d->cur.xmax + 1.0f, x2);
|
||||
|
||||
@ -254,8 +248,6 @@ static void draw_seq_waveform(View2D *v2d,
|
||||
float volume = seq->volume;
|
||||
float value1, value2;
|
||||
bSound *sound = seq->sound;
|
||||
FCurve *fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, NULL);
|
||||
|
||||
SoundWaveform *waveform;
|
||||
|
||||
if (length < 2) {
|
||||
@ -265,7 +257,7 @@ static void draw_seq_waveform(View2D *v2d,
|
||||
BLI_spin_lock(sound->spinlock);
|
||||
if (!sound->waveform) {
|
||||
if (!(sound->tags & SOUND_TAGS_WAVEFORM_LOADING)) {
|
||||
/* prevent sounds from reloading */
|
||||
/* Prevent sounds from reloading. */
|
||||
sound->tags |= SOUND_TAGS_WAVEFORM_LOADING;
|
||||
BLI_spin_unlock(sound->spinlock);
|
||||
sequencer_preview_add_sound(C, seq);
|
||||
@ -273,15 +265,14 @@ static void draw_seq_waveform(View2D *v2d,
|
||||
else {
|
||||
BLI_spin_unlock(sound->spinlock);
|
||||
}
|
||||
return; /* nothing to draw */
|
||||
return; /* Nothing to draw. */
|
||||
}
|
||||
BLI_spin_unlock(sound->spinlock);
|
||||
|
||||
waveform = sound->waveform;
|
||||
|
||||
/* Waveform could not be built. */
|
||||
if (waveform->length == 0) {
|
||||
/* BKE_sound_read_waveform() set an empty SoundWaveform data in case it cannot generate a
|
||||
* valid one. See T45726. */
|
||||
return;
|
||||
}
|
||||
|
||||
@ -299,6 +290,9 @@ static void draw_seq_waveform(View2D *v2d,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fcurve lookup is quite expensive, so do this after precondition. */
|
||||
FCurve *fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, NULL);
|
||||
|
||||
GPU_blend(true);
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
@ -325,7 +319,7 @@ static void draw_seq_waveform(View2D *v2d,
|
||||
}
|
||||
}
|
||||
else if (p + 1 < waveform->length) {
|
||||
/* use simple linear interpolation */
|
||||
/* Use simple linear interpolation. */
|
||||
float f = sampleoffset - p;
|
||||
value1 = (1.0f - f) * value1 + f * waveform->data[p * 3 + 3];
|
||||
value2 = (1.0f - f) * value2 + f * waveform->data[p * 3 + 4];
|
||||
@ -361,10 +355,6 @@ static void draw_seq_waveform(View2D *v2d,
|
||||
|
||||
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
|
||||
{
|
||||
/* note: this used to use SEQ_BEGIN/SEQ_END, but it messes up the
|
||||
* seq->depth value, (needed by transform when doing overlap checks)
|
||||
* so for now, just use the meta's immediate children, could be fixed but
|
||||
* its only drawing - campbell */
|
||||
Sequence *seq;
|
||||
uchar col[4];
|
||||
|
||||
@ -400,12 +390,12 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
|
||||
chan_range = (chan_max - chan_min) + 1;
|
||||
draw_height = draw_range / chan_range;
|
||||
|
||||
col[3] = 196; /* alpha, used for all meta children */
|
||||
col[3] = 196; /* Alpha, used for all meta children. */
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
|
||||
/* Draw only immediate children (1 level depth). */
|
||||
for (seq = seqbase->first; seq; seq = seq->next) {
|
||||
const int startdisp = seq->startdisp + offset;
|
||||
const int enddisp = seq->enddisp + offset;
|
||||
@ -433,7 +423,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
|
||||
|
||||
immUniformColor4ubv(col);
|
||||
|
||||
/* clamp within parent sequence strip bounds */
|
||||
/* Clamp within parent sequence strip bounds. */
|
||||
if (x1_chan < x1) {
|
||||
x1_chan = x1;
|
||||
}
|
||||
@ -453,16 +443,16 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
|
||||
GPU_blend(false);
|
||||
}
|
||||
|
||||
/* clamp handles to defined size in pixel space */
|
||||
/* Get handle width in pixels. */
|
||||
float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx)
|
||||
{
|
||||
const float maxhandle = (pixelx * SEQ_HANDLE_SIZE) * U.pixelsize;
|
||||
|
||||
/* ensure we're not greater than half width */
|
||||
/* Ensure that handle is not wider, than half of strip. */
|
||||
return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 2.0f) / pixelx);
|
||||
}
|
||||
|
||||
/* draw a handle, for each end of a sequence strip */
|
||||
/* Draw a handle, on left or right side of strip. */
|
||||
static void draw_seq_handle(View2D *v2d,
|
||||
Sequence *seq,
|
||||
const float handsize_clamped,
|
||||
@ -483,7 +473,7 @@ static void draw_seq_handle(View2D *v2d,
|
||||
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
|
||||
y2 = seq->machine + SEQ_STRIP_OFSTOP;
|
||||
|
||||
/* set up co-ordinates/dimensions for either left or right handle */
|
||||
/* Set up co-ordinates and dimensions for either left or right handle. */
|
||||
if (direction == SEQ_LEFTHANDLE) {
|
||||
rx1 = x1;
|
||||
rx2 = x1 + handsize_clamped;
|
||||
@ -495,7 +485,6 @@ static void draw_seq_handle(View2D *v2d,
|
||||
whichsel = SEQ_RIGHTSEL;
|
||||
}
|
||||
|
||||
/* draw! */
|
||||
if (!(seq->type & SEQ_TYPE_EFFECT) || BKE_sequence_effect_get_num_inputs(seq->type) == 0) {
|
||||
GPU_blend(true);
|
||||
|
||||
@ -522,9 +511,7 @@ static void draw_seq_handle(View2D *v2d,
|
||||
GPU_blend(false);
|
||||
}
|
||||
|
||||
/* Draw numbers for start and end of the strip next to its handles.
|
||||
* - Draw only when handles are selected or while translating the strip.
|
||||
*/
|
||||
/* Draw numbers for start and end of the strip next to its handles. */
|
||||
if (y_threshold &&
|
||||
(((seq->flag & SELECT) && (G.moving & G_TRANSFORM_SEQ)) || (seq->flag & whichsel))) {
|
||||
|
||||
@ -575,8 +562,8 @@ static void draw_seq_outline(Sequence *seq,
|
||||
else if (seq->flag & SELECT) {
|
||||
UI_GetThemeColor3ubv(TH_SEQ_SELECTED, col);
|
||||
}
|
||||
/* Regular color for unselected strips: a bit darker than the background. */
|
||||
else {
|
||||
/* Color for unselected strips is a bit darker than the background. */
|
||||
UI_GetThemeColor3ubv(TH_BACK, col);
|
||||
UI_GetColorPtrShade3ubv(col, col, -40);
|
||||
}
|
||||
@ -610,13 +597,13 @@ static void draw_seq_outline(Sequence *seq,
|
||||
/* Top */
|
||||
immRectf(pos, x1 - pixelx, y2 - 2 * pixely, x2 + pixelx, y2);
|
||||
}
|
||||
/* 1px wide outline for unselected strips. */
|
||||
else {
|
||||
/* 1px wide outline for unselected strips. */
|
||||
imm_draw_box_wire_2d(pos, x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
/* draw info text on a sequence strip */
|
||||
/* Draw info text on a sequence strip. */
|
||||
static void draw_seq_text(View2D *v2d,
|
||||
Sequence *seq,
|
||||
SpaceSeq *sseq,
|
||||
@ -633,7 +620,7 @@ static void draw_seq_text(View2D *v2d,
|
||||
const char *name = seq->name + 2;
|
||||
uchar col[4];
|
||||
|
||||
/* note, all strings should include 'name' */
|
||||
/* All strings should include name. */
|
||||
if (name[0] == '\0') {
|
||||
name = BKE_sequence_give_name(seq);
|
||||
}
|
||||
@ -723,7 +710,7 @@ static void draw_seq_text(View2D *v2d,
|
||||
seq->len);
|
||||
}
|
||||
else {
|
||||
/* should never get here!, but might with files from future */
|
||||
/* Should never get here!, but might with files from future. */
|
||||
BLI_assert(0);
|
||||
|
||||
str_len = BLI_snprintf(str, sizeof(str), "%s | %d", name, seq->len);
|
||||
@ -888,7 +875,7 @@ static void draw_seq_background(Scene *scene,
|
||||
}
|
||||
}
|
||||
|
||||
/* Transition strips.. Draw right half. */
|
||||
/* Draw right half of transition strips. */
|
||||
if (ELEM(seq->type, SEQ_TYPE_CROSS, SEQ_TYPE_GAMCROSS, SEQ_TYPE_WIPE)) {
|
||||
float vert_pos[3][2];
|
||||
Sequence *seq1 = seq->seq1;
|
||||
@ -966,7 +953,7 @@ static void calculate_seq_text_offsets(
|
||||
|
||||
float scroller_vert_xoffs = (V2D_SCROLL_HANDLE_WIDTH + SEQ_SCROLLER_TEXT_OFFSET) * pixelx;
|
||||
|
||||
/* info text on the strip */
|
||||
/* Info text on the strip. */
|
||||
if (*x1 < v2d->cur.xmin + scroller_vert_xoffs) {
|
||||
*x1 = v2d->cur.xmin + scroller_vert_xoffs;
|
||||
}
|
||||
@ -981,11 +968,7 @@ static void calculate_seq_text_offsets(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw a sequence strip, bounds check already made
|
||||
* ARegion is currently only used to get the windows width in pixels
|
||||
* so wave file sample drawing precision is zoom adjusted
|
||||
*/
|
||||
/* Draw visible strips. */
|
||||
static void draw_seq_strip(const bContext *C,
|
||||
SpaceSeq *sseq,
|
||||
Scene *scene,
|
||||
@ -999,20 +982,19 @@ static void draw_seq_strip(const bContext *C,
|
||||
const float handsize_clamped = sequence_handle_size_get_clamped(seq, pixelx);
|
||||
float pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
|
||||
|
||||
/* We need to know if this is a single image/color or not for drawing. */
|
||||
/* Check if we are doing "solo preview". */
|
||||
bool is_single_image = (char)BKE_sequence_single_check(seq);
|
||||
|
||||
/* body */
|
||||
/* Draw strip body. */
|
||||
x1 = (seq->startstill) ? seq->start : seq->startdisp;
|
||||
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
|
||||
x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
|
||||
y2 = seq->machine + SEQ_STRIP_OFSTOP;
|
||||
|
||||
/* Position of the text,
|
||||
* make sure that the strip content is visible also when the strip height gets lower. */
|
||||
/* Calculate height needed for drawing text on strip. */
|
||||
float text_margin_y = y2 - min_ff(0.40f, 20 * U.dpi_fac * pixely);
|
||||
|
||||
/* Show some content only when the strip is high enough. */
|
||||
/* Is there enough space for drawing something else than text? */
|
||||
bool y_threshold = ((y2 - y1) / pixely) > 20 * U.dpi_fac;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
@ -1020,12 +1002,12 @@ static void draw_seq_strip(const bContext *C,
|
||||
|
||||
draw_seq_background(scene, seq, pos, x1, x2, y1, y2, is_single_image);
|
||||
|
||||
/* Color strips.. Draw a band with the strip's color on its lower part. */
|
||||
/* Draw a color band inside color strip. */
|
||||
if (seq->type == SEQ_TYPE_COLOR && y_threshold) {
|
||||
draw_color_strip_band(seq, pos, text_margin_y, y1);
|
||||
}
|
||||
|
||||
/* Draw strip's offsets when flag is enabled or during "solo preview". */
|
||||
/* Draw strip offsets when flag is enabled or during "solo preview". */
|
||||
if (!is_single_image && (seq->startofs || seq->endofs) && pixely > 0) {
|
||||
if ((sseq->draw_flag & SEQ_DRAW_OFFSET_EXT) || (seq == special_seq_update)) {
|
||||
draw_sequence_extensions(scene, seq, pos, pixely);
|
||||
@ -1042,7 +1024,7 @@ static void draw_seq_strip(const bContext *C,
|
||||
drawmeta_contents(scene, seq, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
/* Sound strips.. Draw waveforms. */
|
||||
/* Draw sound strip waveform. */
|
||||
if ((seq->type == SEQ_TYPE_SOUND_RAM) && (sseq->flag & SEQ_NO_WAVEFORMS) == 0) {
|
||||
draw_seq_waveform(v2d,
|
||||
C,
|
||||
@ -1061,7 +1043,7 @@ static void draw_seq_strip(const bContext *C,
|
||||
draw_seq_locked(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
/* Missing media indication.. Draw a red line on the top of the strip. */
|
||||
/* Draw Red line on the top of invalid strip (Missing media). */
|
||||
if (!BKE_sequence_is_valid_check(seq)) {
|
||||
draw_seq_invalid(x1, x2, y2, text_margin_y);
|
||||
}
|
||||
@ -1082,11 +1064,9 @@ static void draw_seq_strip(const bContext *C,
|
||||
|
||||
calculate_seq_text_offsets(v2d, seq, &x1, &x2, pixelx);
|
||||
|
||||
/* Draw the text on the top section of the strip,
|
||||
* - depending on the vertical space, move it to the center or don't draw it.
|
||||
* - don't draw it when there is not enough horizontal space.
|
||||
*/
|
||||
/* Don't draw strip if there is not enough vertical or horizontal space. */
|
||||
if (((x2 - x1) > 32 * pixelx * U.dpi_fac) && ((y2 - y1) > 8 * pixely * U.dpi_fac)) {
|
||||
/* Depending on the vertical space, draw text on top or in the center of strip. */
|
||||
draw_seq_text(
|
||||
v2d, seq, sseq, x1, x2, y_threshold ? text_margin_y : y1, y2, seq_active, y_threshold);
|
||||
}
|
||||
@ -1203,7 +1183,7 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain,
|
||||
GPU_framebuffer_bind(fb);
|
||||
}
|
||||
|
||||
/* restore state so real rendering would be canceled (if needed) */
|
||||
/* Restore state so real rendering would be canceled if needed. */
|
||||
G.is_break = is_break;
|
||||
|
||||
return ibuf;
|
||||
@ -1264,17 +1244,17 @@ static void sequencer_display_size(Scene *scene, float r_viewrect[2])
|
||||
|
||||
static void sequencer_draw_gpencil(const bContext *C)
|
||||
{
|
||||
/* draw grease-pencil (image aligned) */
|
||||
/* Draw grease-pencil (image aligned). */
|
||||
ED_annotation_draw_2dimage(C);
|
||||
|
||||
/* ortho at pixel level */
|
||||
/* Ortho at pixel level. */
|
||||
UI_view2d_view_restore(C);
|
||||
|
||||
/* draw grease-pencil (screen aligned) */
|
||||
/* Draw grease-pencil (screen aligned). */
|
||||
ED_annotation_draw_view2d(C, 0);
|
||||
}
|
||||
|
||||
/* draws content borders plus safety borders if needed */
|
||||
/* Draw content and safety borders borders. */
|
||||
static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, const Scene *scene)
|
||||
{
|
||||
float x1 = v2d->tot.xmin;
|
||||
@ -1284,7 +1264,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
|
||||
|
||||
GPU_line_width(1.0f);
|
||||
|
||||
/* border */
|
||||
/* Draw border. */
|
||||
const uint shdr_pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
@ -1301,7 +1281,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
|
||||
|
||||
imm_draw_box_wire_2d(shdr_pos, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f);
|
||||
|
||||
/* safety border */
|
||||
/* Draw safety border. */
|
||||
if (sseq->flag & SEQ_SHOW_SAFE_MARGINS) {
|
||||
immUniformThemeColorBlend(TH_VIEW_OVERLAY, TH_BACK, 0.25f);
|
||||
|
||||
@ -1325,8 +1305,8 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
|
||||
#if 0
|
||||
void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq)
|
||||
{
|
||||
/* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not,
|
||||
* for now just disable drawing since the strip frame will likely be offset */
|
||||
/* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not.
|
||||
* For now just disable drawing since the strip frame will likely be offset. */
|
||||
|
||||
// if (sc->mode == SC_MODE_MASKEDIT)
|
||||
if (0 && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
|
||||
@ -1377,8 +1357,8 @@ static void *sequencer_OCIO_transform_ibuf(
|
||||
force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
|
||||
force_fallback |= (ibuf->dither != 0.0f);
|
||||
|
||||
/* Fallback to CPU based color space conversion. */
|
||||
if (force_fallback) {
|
||||
/* Fallback to CPU based color space conversion */
|
||||
*r_glsl_used = false;
|
||||
*r_format = GL_RGBA;
|
||||
*r_type = GL_UNSIGNED_BYTE;
|
||||
@ -1423,9 +1403,8 @@ static void *sequencer_OCIO_transform_ibuf(
|
||||
display_buffer = NULL;
|
||||
}
|
||||
|
||||
/* there's a data to be displayed, but GLSL is not initialized
|
||||
* properly, in this case we fallback to CPU-based display transform
|
||||
*/
|
||||
/* There is data to be displayed, but GLSL is not initialized
|
||||
* properly, in this case we fallback to CPU-based display transform. */
|
||||
if ((ibuf->rect || ibuf->rect_float) && !*r_glsl_used) {
|
||||
display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
|
||||
*r_format = GL_RGBA;
|
||||
@ -1441,14 +1420,12 @@ static void *sequencer_OCIO_transform_ibuf(
|
||||
static void sequencer_stop_running_jobs(const bContext *C, Scene *scene)
|
||||
{
|
||||
if (G.is_rendering == false && (scene->r.seq_prev_type) == OB_RENDER) {
|
||||
/* stop all running jobs, except screen one. currently previews frustrate Render
|
||||
* needed to make so sequencer's rendering doesn't conflict with compositor
|
||||
*/
|
||||
/* Stop all running jobs, except screen one. Currently previews frustrate Render.
|
||||
* Need to make so sequencer's rendering doesn't conflict with compositor. */
|
||||
WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_COMPOSITE);
|
||||
|
||||
/* in case of final rendering used for preview, kill all previews,
|
||||
* otherwise threading conflict will happen in rendering module
|
||||
*/
|
||||
/* In case of final rendering used for preview, kill all previews,
|
||||
* otherwise threading conflict will happen in rendering module. */
|
||||
WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_RENDER_PREVIEW);
|
||||
}
|
||||
}
|
||||
@ -1521,8 +1498,7 @@ static void sequencer_draw_display_buffer(const bContext *C,
|
||||
}
|
||||
|
||||
/* Format needs to be created prior to any immBindProgram call.
|
||||
* Do it here because OCIO binds it's own shader.
|
||||
*/
|
||||
* Do it here because OCIO binds it's own shader. */
|
||||
int format, type;
|
||||
bool glsl_used = false;
|
||||
GLuint texid;
|
||||
@ -1671,7 +1647,7 @@ static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, boo
|
||||
break;
|
||||
}
|
||||
|
||||
/* future files may have new scopes we don't catch above */
|
||||
/* Future files may have new scopes we don't catch above. */
|
||||
if (scope) {
|
||||
scopes->reference_ibuf = ibuf;
|
||||
}
|
||||
@ -1708,13 +1684,13 @@ void sequencer_draw_preview(const bContext *C,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Setup view */
|
||||
/* Setup view. */
|
||||
sequencer_display_size(scene, viewrect);
|
||||
UI_view2d_totRect_set(v2d, viewrect[0] + 0.5f, viewrect[1] + 0.5f);
|
||||
UI_view2d_curRect_validate(v2d);
|
||||
UI_view2d_view_ortho(v2d);
|
||||
|
||||
/* Draw background */
|
||||
/* Draw background. */
|
||||
if (!draw_backdrop && (!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE)) {
|
||||
sequencer_preview_clear();
|
||||
|
||||
@ -1722,18 +1698,18 @@ void sequencer_draw_preview(const bContext *C,
|
||||
imm_draw_box_checker_2d(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax);
|
||||
}
|
||||
}
|
||||
/* Get image */
|
||||
/* Get image. */
|
||||
ibuf = sequencer_ibuf_get(
|
||||
bmain, depsgraph, scene, sseq, cfra, frame_ofs, names[sseq->multiview_eye]);
|
||||
|
||||
if (ibuf) {
|
||||
scope = sequencer_get_scope(scene, sseq, ibuf, draw_backdrop);
|
||||
|
||||
/* Draw image */
|
||||
/* Draw image. */
|
||||
sequencer_draw_display_buffer(
|
||||
C, scene, region, sseq, ibuf, scope, draw_overlay, draw_backdrop);
|
||||
|
||||
/* Draw over image */
|
||||
/* Draw over image. */
|
||||
if (sseq->flag & SEQ_SHOW_METADATA) {
|
||||
ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0);
|
||||
}
|
||||
@ -1746,12 +1722,11 @@ void sequencer_draw_preview(const bContext *C,
|
||||
if (draw_gpencil && show_imbuf) {
|
||||
sequencer_draw_gpencil(C);
|
||||
}
|
||||
#if 0
|
||||
sequencer_draw_maskedit(C, scene, region, sseq);
|
||||
#endif
|
||||
|
||||
/* TODO */
|
||||
/* sequencer_draw_maskedit(C, scene, region, sseq); */
|
||||
|
||||
/* Scope is freed in sequencer_check_scopes when ibuf changes and
|
||||
* scope image is to be replaced. */
|
||||
/* Scope is freed in sequencer_check_scopes when ibuf changes and redraw is needed. */
|
||||
if (ibuf) {
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
@ -1760,7 +1735,7 @@ void sequencer_draw_preview(const bContext *C,
|
||||
seq_prefetch_wm_notify(C, scene);
|
||||
}
|
||||
|
||||
/* draw backdrop of the sequencer strips view */
|
||||
/* Draw backdrop in sequencer timeline. */
|
||||
static void draw_seq_backdrop(View2D *v2d)
|
||||
{
|
||||
int i;
|
||||
@ -1768,11 +1743,11 @@ static void draw_seq_backdrop(View2D *v2d)
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
|
||||
/* darker gray overlay over the view backdrop */
|
||||
/* Darker gray overlay over the view backdrop. */
|
||||
immUniformThemeColorShade(TH_BACK, -20);
|
||||
immRectf(pos, v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0);
|
||||
|
||||
/* Alternating horizontal stripes */
|
||||
/* Alternating horizontal stripes. */
|
||||
i = max_ii(1, ((int)v2d->cur.ymin) - 1);
|
||||
|
||||
while (i < v2d->cur.ymax) {
|
||||
@ -1788,7 +1763,7 @@ static void draw_seq_backdrop(View2D *v2d)
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Darker lines separating the horizontal bands */
|
||||
/* Darker lines separating the horizontal bands. */
|
||||
i = max_ii(1, ((int)v2d->cur.ymin) - 1);
|
||||
int line_len = (int)v2d->cur.ymax - i + 1;
|
||||
immUniformThemeColor(TH_GRID);
|
||||
@ -1802,7 +1777,6 @@ static void draw_seq_backdrop(View2D *v2d)
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
/* draw the contents of the sequencer strips view */
|
||||
static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -1812,12 +1786,12 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
|
||||
int sel = 0, j;
|
||||
float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
|
||||
|
||||
/* loop through twice, first unselected, then selected */
|
||||
/* Loop through twice, first unselected, then selected. */
|
||||
for (j = 0; j < 2; j++) {
|
||||
Sequence *seq;
|
||||
/* loop through strips, checking for those that are visible */
|
||||
/* Loop through strips, checking for those that are visible. */
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
/* boundbox and selection tests for NOT drawing the strip... */
|
||||
/* Boundbox and selection tests for NOT drawing the strip. */
|
||||
if ((seq->flag & SELECT) != sel) {
|
||||
continue;
|
||||
}
|
||||
@ -1837,11 +1811,11 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* strip passed all tests unscathed... so draw it now */
|
||||
/* Strip passed all tests, draw it now. */
|
||||
draw_seq_strip(C, sseq, scene, region, seq, pixelx, seq == last_seq ? true : false);
|
||||
}
|
||||
|
||||
/* draw selected next time round */
|
||||
/* Draw selected next time round. */
|
||||
sel = SELECT;
|
||||
}
|
||||
|
||||
@ -1872,7 +1846,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
|
||||
}
|
||||
}
|
||||
|
||||
/* draw highlight when previewing a single strip */
|
||||
/* Draw highlight if "solo preview" is used. */
|
||||
if (special_seq_update) {
|
||||
const Sequence *seq = special_seq_update;
|
||||
GPU_blend(true);
|
||||
@ -1904,8 +1878,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
|
||||
/* draw darkened area outside of active timeline
|
||||
* frame range used is preview range or scene range */
|
||||
/* Draw overlay outside of frame range. */
|
||||
immUniformThemeColorShadeAlpha(TH_BACK, -25, -100);
|
||||
|
||||
if (frame_sta < frame_end) {
|
||||
@ -1918,7 +1891,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
|
||||
|
||||
immUniformThemeColorShade(TH_BACK, -60);
|
||||
|
||||
/* thin lines where the actual frames are */
|
||||
/* Draw frame range boundary. */
|
||||
immBegin(GPU_PRIM_LINES, 4);
|
||||
|
||||
immVertex2f(pos, frame_sta, v2d->cur.ymin);
|
||||
@ -1929,7 +1902,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
|
||||
|
||||
immEnd();
|
||||
|
||||
/* While inside a meta strip, draw a checkerboard pattern outside of its range. */
|
||||
/* While in meta strip, draw a checkerboard overlay outside of frame range. */
|
||||
if (ed && !BLI_listbase_is_empty(&ed->metastack)) {
|
||||
MetaStack *ms = ed->metastack.last;
|
||||
immUnbindProgram();
|
||||
@ -1979,7 +1952,7 @@ typedef struct CacheDrawData {
|
||||
size_t final_out_vert_count;
|
||||
} CacheDrawData;
|
||||
|
||||
/* Called as a callback */
|
||||
/* Called as a callback. */
|
||||
static bool draw_cache_view_init_fn(void *userdata, size_t item_count)
|
||||
{
|
||||
if (item_count == 0) {
|
||||
@ -2175,7 +2148,7 @@ static void draw_cache_view(const bContext *C)
|
||||
GPU_blend(false);
|
||||
}
|
||||
|
||||
/* Draw Timeline/Strip Editor Mode for Sequencer */
|
||||
/* Draw sequencer timeline. */
|
||||
void draw_timeline_seq(const bContext *C, ARegion *region)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -2188,7 +2161,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
|
||||
|
||||
seq_prefetch_wm_notify(C, scene);
|
||||
|
||||
/* clear and setup matrix */
|
||||
UI_GetThemeColor3fv(TH_BACK, col);
|
||||
if (ed && ed->metastack.first) {
|
||||
GPU_clear_color(col[0], col[1], col[2] - 0.1f, 0.0f);
|
||||
@ -2199,44 +2171,36 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
|
||||
UI_view2d_view_ortho(v2d);
|
||||
|
||||
/* calculate extents of sequencer strips/data
|
||||
* NOTE: needed for the scrollers later
|
||||
*/
|
||||
/* Get timeline boundbox, needed for the scrollers. */
|
||||
boundbox_seq(scene, &v2d->tot);
|
||||
|
||||
/* draw backdrop */
|
||||
draw_seq_backdrop(v2d);
|
||||
|
||||
/* regular grid-pattern over the rest of the view (i.e. 1-second grid lines) */
|
||||
UI_view2d_constant_grid_draw(v2d, FPS);
|
||||
|
||||
/* Only draw backdrop in pure sequence view. */
|
||||
/* Only draw backdrop in timeline view. */
|
||||
if (sseq->view == SEQ_VIEW_SEQUENCE && sseq->draw_flag & SEQ_DRAW_BACKDROP) {
|
||||
sequencer_draw_preview(C, scene, region, sseq, scene->r.cfra, 0, false, true);
|
||||
UI_view2d_view_ortho(v2d);
|
||||
}
|
||||
|
||||
/* Draw attached callbacks. */
|
||||
ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
|
||||
|
||||
seq_draw_sfra_efra(scene, v2d);
|
||||
|
||||
/* sequence strips (if there is data available to be drawn) */
|
||||
if (ed) {
|
||||
/* draw the data */
|
||||
draw_seq_strips(C, ed, region);
|
||||
/* text draw cached (for sequence names), in pixelspace now */
|
||||
/* Draw text added in previous function. */
|
||||
UI_view2d_text_cache_draw(region);
|
||||
}
|
||||
|
||||
/* current frame */
|
||||
UI_view2d_view_ortho(v2d);
|
||||
if ((sseq->flag & SEQ_DRAWFRAMES) == 0) {
|
||||
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
|
||||
}
|
||||
|
||||
/* Draw playhead. */
|
||||
ANIM_draw_cfra(C, v2d, cfra_flag);
|
||||
|
||||
/* overlap playhead */
|
||||
/* Draw overlap playhead. */
|
||||
if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
|
||||
int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ?
|
||||
scene->ed->over_cfra :
|
||||
@ -2247,7 +2211,8 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
|
||||
float viewport_size[4];
|
||||
GPU_viewport_size_get_f(viewport_size);
|
||||
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
|
||||
immUniform1i("colors_len", 0); /* "simple" mode */
|
||||
/* Shader may have color set from past usage - reset it. */
|
||||
immUniform1i("colors_len", 0);
|
||||
immUniform1f("dash_width", 20.0f * U.pixelsize);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
immUniformThemeColor(TH_CFRAME);
|
||||
@ -2260,7 +2225,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
/* markers */
|
||||
UI_view2d_view_orthoSpecial(region, v2d, 1);
|
||||
int marker_draw_flag = DRAW_MARKERS_MARGIN;
|
||||
if (sseq->flag & SEQ_SHOW_MARKERS) {
|
||||
@ -2268,28 +2232,22 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
|
||||
}
|
||||
|
||||
UI_view2d_view_ortho(v2d);
|
||||
/* draw cache on top of markers area */
|
||||
|
||||
if (ed) {
|
||||
draw_cache_view(C);
|
||||
}
|
||||
/* preview range */
|
||||
|
||||
ANIM_draw_previewrange(C, v2d, 1);
|
||||
|
||||
/* callback */
|
||||
/* Draw registered callbacks. */
|
||||
ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
|
||||
|
||||
/* reset view matrix */
|
||||
UI_view2d_view_restore(C);
|
||||
|
||||
/* scrubbing region */
|
||||
ED_time_scrub_draw(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true);
|
||||
|
||||
/* scrollers */
|
||||
scrollers = UI_view2d_scrollers_calc(v2d, NULL);
|
||||
UI_view2d_scrollers_draw(v2d, scrollers);
|
||||
UI_view2d_scrollers_free(scrollers);
|
||||
|
||||
/* channel numbers */
|
||||
/* Draw channel numbers. */
|
||||
{
|
||||
rcti rect;
|
||||
BLI_rcti_init(
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@
|
||||
#include "DNA_sequence_types.h"
|
||||
#include "RNA_access.h"
|
||||
|
||||
/* internal exports only */
|
||||
/* Internal exports only. */
|
||||
|
||||
struct ARegion;
|
||||
struct ARegionType;
|
||||
@ -57,7 +57,7 @@ void sequencer_special_update_set(Sequence *seq);
|
||||
float sequence_handle_size_get_clamped(struct Sequence *seq, const float pixelx);
|
||||
|
||||
/* UNUSED */
|
||||
// void seq_reset_imageofs(struct SpaceSeq *sseq);
|
||||
/* void seq_reset_imageofs(struct SpaceSeq *sseq); */
|
||||
|
||||
struct ImBuf *sequencer_ibuf_get(struct Main *bmain,
|
||||
struct Depsgraph *depsgraph,
|
||||
@ -88,19 +88,19 @@ int seq_effect_find_selected(struct Scene *scene,
|
||||
struct Sequence **r_selseq3,
|
||||
const char **r_error_str);
|
||||
|
||||
/* operator helpers */
|
||||
/* Operator helpers. */
|
||||
bool sequencer_edit_poll(struct bContext *C);
|
||||
/* UNUSED */
|
||||
// bool sequencer_strip_poll(struct bContext *C);
|
||||
/* bool sequencer_strip_poll(struct bContext *C); */
|
||||
bool sequencer_strip_has_path_poll(struct bContext *C);
|
||||
bool sequencer_view_preview_poll(struct bContext *C);
|
||||
bool sequencer_view_strips_poll(struct bContext *C);
|
||||
|
||||
/* externs */
|
||||
/* Externs. */
|
||||
extern EnumPropertyItem sequencer_prop_effect_types[];
|
||||
extern EnumPropertyItem prop_side_types[];
|
||||
|
||||
/* operators */
|
||||
/* Operators. */
|
||||
struct wmKeyConfig;
|
||||
struct wmOperatorType;
|
||||
|
||||
@ -152,7 +152,7 @@ void SEQUENCER_OT_export_subtitles(struct wmOperatorType *ot);
|
||||
|
||||
void SEQUENCER_OT_set_range_to_strips(struct wmOperatorType *ot);
|
||||
|
||||
/* preview specific operators */
|
||||
/* Preview specific operators. */
|
||||
void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot);
|
||||
|
||||
/* sequencer_select.c */
|
||||
@ -193,8 +193,8 @@ enum {
|
||||
SEQ_SELECT_LR_RIGHT,
|
||||
};
|
||||
|
||||
/* defines used internally */
|
||||
#define SCE_MARKERS 0 // XXX - dummy
|
||||
/* Defines used internally. */
|
||||
#define SCE_MARKERS 0 /* XXX - dummy */
|
||||
|
||||
/* sequencer_ops.c */
|
||||
void sequencer_operatortypes(void);
|
||||
@ -222,7 +222,7 @@ void SEQUENCER_OT_sample(struct wmOperatorType *ot);
|
||||
/* sequencer_preview.c */
|
||||
void sequencer_preview_add_sound(const struct bContext *C, struct Sequence *seq);
|
||||
|
||||
/* sequencer_add */
|
||||
/* sequencer_add.c */
|
||||
int sequencer_image_seq_get_minmax_frame(struct wmOperator *op,
|
||||
int sfra,
|
||||
int *r_minframe,
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
/* own include */
|
||||
/* Own include. */
|
||||
#include "sequencer_intern.h"
|
||||
|
||||
/*********************** Add modifier operator *************************/
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "ED_markers.h"
|
||||
#include "ED_select_utils.h"
|
||||
#include "ED_sequencer.h"
|
||||
#include "ED_transform.h" /* transform keymap */
|
||||
#include "ED_transform.h" /* Transform keymap. */
|
||||
|
||||
#include "BKE_sequencer.h"
|
||||
|
||||
|
@ -52,9 +52,9 @@ typedef struct PreviewJobAudio {
|
||||
struct PreviewJobAudio *next, *prev;
|
||||
struct Main *bmain;
|
||||
bSound *sound;
|
||||
int lr; /* sample left or right */
|
||||
int lr; /* Sample left or right. */
|
||||
int startframe;
|
||||
bool waveform; /* reload sound or waveform */
|
||||
bool waveform; /* Reload sound or waveform. */
|
||||
} PreviewJobAudio;
|
||||
|
||||
static void free_preview_job(void *data)
|
||||
@ -66,7 +66,7 @@ static void free_preview_job(void *data)
|
||||
MEM_freeN(pj);
|
||||
}
|
||||
|
||||
/* only this runs inside thread */
|
||||
/* Only this runs inside thread. */
|
||||
static void preview_startjob(void *data, short *stop, short *do_update, float *progress)
|
||||
{
|
||||
PreviewJob *pj = data;
|
||||
@ -89,7 +89,7 @@ static void preview_startjob(void *data, short *stop, short *do_update, float *p
|
||||
while (previewjb) {
|
||||
sound = previewjb->sound;
|
||||
|
||||
/* make sure we cleanup the loading flag! */
|
||||
/* Make sure we cleanup the loading flag! */
|
||||
BLI_spin_lock(sound->spinlock);
|
||||
sound->tags &= ~SOUND_TAGS_WAVEFORM_LOADING;
|
||||
BLI_spin_unlock(sound->spinlock);
|
||||
@ -127,7 +127,6 @@ static void preview_endjob(void *data)
|
||||
|
||||
void sequencer_preview_add_sound(const bContext *C, Sequence *seq)
|
||||
{
|
||||
/* first, get the preview job, if it exists */
|
||||
wmJob *wm_job;
|
||||
PreviewJob *pj;
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
@ -139,6 +138,7 @@ void sequencer_preview_add_sound(const bContext *C, Sequence *seq)
|
||||
WM_JOB_PROGRESS,
|
||||
WM_JOB_TYPE_SEQ_BUILD_PREVIEW);
|
||||
|
||||
/* Get the preview job if it exists. */
|
||||
pj = WM_jobs_customdata_get(wm_job);
|
||||
|
||||
if (!pj) {
|
||||
@ -152,8 +152,6 @@ void sequencer_preview_add_sound(const bContext *C, Sequence *seq)
|
||||
WM_jobs_callbacks(wm_job, preview_startjob, NULL, NULL, preview_endjob);
|
||||
}
|
||||
|
||||
/* attempt to lock mutex of job here */
|
||||
|
||||
audiojob->bmain = CTX_data_main(C);
|
||||
audiojob->sound = seq->sound;
|
||||
|
||||
|
@ -42,7 +42,7 @@ static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3])
|
||||
yuv[1] = 0.492f * (rgb[2] - yuv[0]);
|
||||
yuv[2] = 0.877f * (rgb[0] - yuv[0]);
|
||||
|
||||
/* Normalize */
|
||||
/* Normalize. */
|
||||
yuv[1] *= 255.0f / (122 * 2.0f);
|
||||
yuv[1] += 0.5f;
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include "RNA_define.h"
|
||||
|
||||
/* for menu/popup icons etc etc*/
|
||||
/* For menu, popup, icons, etc. */
|
||||
|
||||
#include "ED_outliner.h"
|
||||
#include "ED_screen.h"
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
#include "UI_view2d.h"
|
||||
|
||||
/* own include */
|
||||
/* Own include. */
|
||||
#include "sequencer_intern.h"
|
||||
|
||||
static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2))
|
||||
@ -147,7 +147,7 @@ static void select_active_side_range(ListBase *seqbase,
|
||||
}
|
||||
}
|
||||
|
||||
/* used for mouse selection in SEQUENCER_OT_select */
|
||||
/* Used for mouse selection in SEQUENCER_OT_select */
|
||||
static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
|
||||
{
|
||||
Sequence *seq;
|
||||
@ -158,7 +158,7 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
|
||||
int right_match = (seq->enddisp == seq_link->enddisp) ? 1 : 0;
|
||||
|
||||
if (left_match && right_match) {
|
||||
/* a direct match, copy the selection settinhs */
|
||||
/* Direct match, copy the selection settings. */
|
||||
seq->flag &= ~(SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
seq->flag |= seq_link->flag & (SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
|
||||
@ -166,7 +166,7 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
|
||||
}
|
||||
else if (seq_link->flag & SELECT && (left_match || right_match)) {
|
||||
|
||||
/* clear for reselection */
|
||||
/* Clear for reselection. */
|
||||
seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
|
||||
if (left_match && seq_link->flag & SEQ_LEFTSEL) {
|
||||
@ -248,12 +248,11 @@ static void select_neighbor_from_last(Scene *scene, int lr)
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
/* pass */
|
||||
/* Pass. */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* (de)select operator */
|
||||
static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
int action = RNA_enum_get(op->ptr, "action");
|
||||
@ -302,22 +301,21 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
|
||||
|
||||
void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "(De)select All";
|
||||
ot->idname = "SEQUENCER_OT_select_all";
|
||||
ot->description = "Select or deselect all strips";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_de_select_all_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
|
||||
WM_operator_properties_select_all(ot);
|
||||
}
|
||||
|
||||
/* (de)select operator */
|
||||
static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -343,16 +341,16 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select Inverse";
|
||||
ot->idname = "SEQUENCER_OT_select_inverse";
|
||||
ot->description = "Select unselected strips";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_select_inverse_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
@ -385,18 +383,18 @@ static int sequencer_select_exec(bContext *C, wmOperator *op)
|
||||
wait_to_deselect_others = false;
|
||||
}
|
||||
|
||||
marker = find_nearest_marker(SCE_MARKERS, 1); // XXX - dummy function for now
|
||||
marker = find_nearest_marker(SCE_MARKERS, 1); /* XXX - dummy function for now */
|
||||
|
||||
seq = find_nearest_seq(scene, v2d, &hand, mval);
|
||||
|
||||
// XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip
|
||||
/* XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip */
|
||||
if (seq && linked_time && (left_right == SEQ_SELECT_LR_MOUSE)) {
|
||||
left_right = SEQ_SELECT_LR_NONE;
|
||||
}
|
||||
|
||||
if (marker) {
|
||||
int oldflag;
|
||||
/* select timeline marker */
|
||||
/* Select timeline marker. */
|
||||
if (extend) {
|
||||
oldflag = marker->flag;
|
||||
if (oldflag & SELECT) {
|
||||
@ -415,7 +413,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op)
|
||||
ret_value = OPERATOR_FINISHED;
|
||||
}
|
||||
else if (left_right != SEQ_SELECT_LR_NONE) {
|
||||
/* use different logic for this */
|
||||
/* Use different logic for this. */
|
||||
float x;
|
||||
if (extend == false) {
|
||||
ED_sequencer_deselect_all(scene);
|
||||
@ -494,7 +492,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
/* On Alt selection, select the strip and bordering handles */
|
||||
/* On Alt selection, select the strip and bordering handles. */
|
||||
if (linked_handle) {
|
||||
if (!ELEM(hand, SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT)) {
|
||||
/* First click selects the strip and its adjacent handles (if valid).
|
||||
@ -510,7 +508,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op)
|
||||
select_surrounding_handles(scene, seq);
|
||||
}
|
||||
else {
|
||||
/* always select the strip under the cursor */
|
||||
/* Always select the strip under the cursor. */
|
||||
seq->flag |= SELECT;
|
||||
|
||||
/* First click selects adjacent handles on that side.
|
||||
@ -635,21 +633,21 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
|
||||
};
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select";
|
||||
ot->idname = "SEQUENCER_OT_select";
|
||||
ot->description = "Select a strip (last selected becomes the \"active strip\")";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_select_exec;
|
||||
ot->invoke = WM_generic_select_invoke;
|
||||
ot->modal = WM_generic_select_modal;
|
||||
ot->poll = ED_operator_sequencer_active;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
/* Properties. */
|
||||
WM_operator_properties_generic_select(ot);
|
||||
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
|
||||
prop = RNA_def_boolean(ot->srna,
|
||||
@ -660,7 +658,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
RNA_def_boolean(
|
||||
ot->srna, "linked_handle", 0, "Linked Handle", "Select handles next to the active strip");
|
||||
/* for animation this is an enum but atm having an enum isn't useful for us */
|
||||
/* For animation this is enum but atm having an enum isn't useful for us. */
|
||||
RNA_def_enum(ot->srna,
|
||||
"left_right",
|
||||
sequencer_select_left_right_types,
|
||||
@ -671,7 +669,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
|
||||
ot->srna, "linked_time", 0, "Linked Time", "Select other strips at the same time");
|
||||
}
|
||||
|
||||
/* run recursively to select linked */
|
||||
/* Run recursively to select linked. */
|
||||
static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool linked)
|
||||
{
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, false);
|
||||
@ -693,7 +691,7 @@ static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool li
|
||||
}
|
||||
|
||||
if (!linked) {
|
||||
/* if not linked we only want to touch each seq once, newseq */
|
||||
/* If not linked we only want to touch each seq once, newseq. */
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
seq->tmp = NULL;
|
||||
}
|
||||
@ -702,7 +700,7 @@ static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool li
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
if ((seq->flag & SELECT) == sel) {
|
||||
if (linked || (seq->tmp == NULL)) {
|
||||
/* only get unselected neighbors */
|
||||
/* Only get unselected neighbors. */
|
||||
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel);
|
||||
if (neighbor) {
|
||||
if (sel) {
|
||||
@ -738,7 +736,6 @@ static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool li
|
||||
return changed;
|
||||
}
|
||||
|
||||
/* select more operator */
|
||||
static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -756,22 +753,19 @@ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void SEQUENCER_OT_select_more(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select More";
|
||||
ot->idname = "SEQUENCER_OT_select_more";
|
||||
ot->description = "Select more strips adjacent to the current selection";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_select_more_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
}
|
||||
|
||||
/* select less operator */
|
||||
static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -789,22 +783,19 @@ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void SEQUENCER_OT_select_less(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select Less";
|
||||
ot->idname = "SEQUENCER_OT_select_less";
|
||||
ot->description = "Shrink the current selection of adjacent selected strips";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_select_less_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
}
|
||||
|
||||
/* select pick linked operator (uses the mouse) */
|
||||
static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -815,10 +806,10 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, cons
|
||||
Sequence *mouse_seq;
|
||||
int selected, hand;
|
||||
|
||||
/* this works like UV, not mesh */
|
||||
/* This works like UV, not mesh. */
|
||||
mouse_seq = find_nearest_seq(scene, v2d, &hand, event->mval);
|
||||
if (!mouse_seq) {
|
||||
return OPERATOR_FINISHED; /* user error as with mesh?? */
|
||||
return OPERATOR_FINISHED; /* User error as with mesh?? */
|
||||
}
|
||||
|
||||
if (extend == 0) {
|
||||
@ -842,23 +833,22 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, cons
|
||||
|
||||
void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select Pick Linked";
|
||||
ot->idname = "SEQUENCER_OT_select_linked_pick";
|
||||
ot->description = "Select a chain of linked strips nearest to the mouse pointer";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_select_linked_pick_invoke;
|
||||
ot->poll = ED_operator_sequencer_active;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
/* Properties. */
|
||||
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
|
||||
}
|
||||
|
||||
/* select linked operator */
|
||||
static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -878,22 +868,19 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void SEQUENCER_OT_select_linked(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select Linked";
|
||||
ot->idname = "SEQUENCER_OT_select_linked";
|
||||
ot->description = "Select all strips adjacent to the current selection";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_select_linked_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
}
|
||||
|
||||
/* select handles operator */
|
||||
static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -928,19 +915,19 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
|
||||
|
||||
void SEQUENCER_OT_select_handles(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select Handles";
|
||||
ot->idname = "SEQUENCER_OT_select_handles";
|
||||
ot->description = "Select gizmo handles on the sides of the selected strip";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_select_handles_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
/* Properties. */
|
||||
RNA_def_enum(ot->srna,
|
||||
"side",
|
||||
prop_side_types,
|
||||
@ -949,7 +936,6 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot)
|
||||
"The side of the handle that is selected");
|
||||
}
|
||||
|
||||
/* select side operator */
|
||||
static int sequencer_select_side_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -993,19 +979,19 @@ static int sequencer_select_side_exec(bContext *C, wmOperator *op)
|
||||
|
||||
void SEQUENCER_OT_select_side(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select Side";
|
||||
ot->idname = "SEQUENCER_OT_select_side";
|
||||
ot->description = "Select strips on the nominated side of the selected strips";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_select_side_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
/* Properties. */
|
||||
RNA_def_enum(ot->srna,
|
||||
"side",
|
||||
prop_side_types,
|
||||
@ -1014,7 +1000,6 @@ void SEQUENCER_OT_select_side(wmOperatorType *ot)
|
||||
"The side to which the selection is applied");
|
||||
}
|
||||
|
||||
/* box_select operator */
|
||||
static int sequencer_box_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -1089,7 +1074,6 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* ****** Box Select ****** */
|
||||
static int sequencer_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -1112,12 +1096,12 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Box Select";
|
||||
ot->idname = "SEQUENCER_OT_select_box";
|
||||
ot->description = "Select strips using box selection";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sequencer_box_select_invoke;
|
||||
ot->exec = sequencer_box_select_exec;
|
||||
ot->modal = WM_gesture_box_modal;
|
||||
@ -1125,10 +1109,10 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot)
|
||||
|
||||
ot->poll = ED_operator_sequencer_active;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
/* Properties. */
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
|
||||
@ -1140,8 +1124,6 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot)
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
/* ****** Selected Grouped ****** */
|
||||
|
||||
enum {
|
||||
SEQ_SELECT_GROUP_TYPE,
|
||||
SEQ_SELECT_GROUP_TYPE_BASIC,
|
||||
@ -1366,7 +1348,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int
|
||||
BKE_sequence_iterator_next(&iter)) {
|
||||
seq = iter.seq;
|
||||
|
||||
/* Ignore all seqs already selected! */
|
||||
/* Ignore all seqs already selected. */
|
||||
/* Ignore all seqs not sharing some time with active one. */
|
||||
/* Ignore all seqs of incompatible types (audio vs video). */
|
||||
if (!SEQ_CHANNEL_CHECK(seq, channel) || (seq->flag & SELECT) || (seq->startdisp >= enddisp) ||
|
||||
@ -1375,7 +1357,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If the seq is an effect one, we need extra checking! */
|
||||
/* If the seq is an effect one, we need extra checking. */
|
||||
if (SEQ_IS_EFFECT(seq) && ((seq->seq1 && seq->seq1->tmp) || (seq->seq2 && seq->seq2->tmp) ||
|
||||
(seq->seq3 && seq->seq3->tmp))) {
|
||||
if (startdisp > seq->startdisp) {
|
||||
@ -1398,7 +1380,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int
|
||||
BKE_sequence_iterator_begin(ed, &iter, true);
|
||||
}
|
||||
|
||||
/* Video strips below active one, or any strip for audio (order do no matters here!). */
|
||||
/* Video strips below active one, or any strip for audio (order doesn't matter here). */
|
||||
else if (seq->machine < machine || is_audio) {
|
||||
seq->flag |= SELECT;
|
||||
changed = true;
|
||||
@ -1476,20 +1458,20 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
|
||||
|
||||
void SEQUENCER_OT_select_grouped(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Select Grouped";
|
||||
ot->description = "Select all strips grouped by various properties";
|
||||
ot->idname = "SEQUENCER_OT_select_grouped";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = WM_menu_invoke;
|
||||
ot->exec = sequencer_select_grouped_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
/* Properties. */
|
||||
ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_select_grouped_types, 0, "Type", "");
|
||||
RNA_def_boolean(ot->srna,
|
||||
"extend",
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
#include "UI_view2d.h"
|
||||
|
||||
/* own include */
|
||||
/* Own include. */
|
||||
#include "sequencer_intern.h"
|
||||
|
||||
/******************** sample backdrop operator ********************/
|
||||
@ -158,7 +158,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
info->colf[3] = fp[3];
|
||||
info->colfp = info->colf;
|
||||
|
||||
/* sequencer's image buffers are in non-linear space, need to make them linear */
|
||||
/* Sequencer's image buffers are in non-linear space, need to make them linear. */
|
||||
copy_v4_v4(info->linearcol, info->colf);
|
||||
BKE_sequencer_pixel_from_sequencer_space_v4(scene, info->linearcol);
|
||||
|
||||
@ -236,17 +236,17 @@ static bool sample_poll(bContext *C)
|
||||
|
||||
void SEQUENCER_OT_sample(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
/* Identifiers. */
|
||||
ot->name = "Sample Color";
|
||||
ot->idname = "SEQUENCER_OT_sample";
|
||||
ot->description = "Use mouse to sample color in current frame";
|
||||
|
||||
/* api callbacks */
|
||||
/* Api callbacks. */
|
||||
ot->invoke = sample_invoke;
|
||||
ot->modal = sample_modal;
|
||||
ot->cancel = sample_cancel;
|
||||
ot->poll = sample_poll;
|
||||
|
||||
/* flags */
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_BLOCKING;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "ED_screen.h"
|
||||
#include "ED_space_api.h"
|
||||
#include "ED_view3d.h"
|
||||
#include "ED_view3d_offscreen.h" /* only for sequencer view3d drawing callback */
|
||||
#include "ED_view3d_offscreen.h" /* Only for sequencer view3d drawing callback. */
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_message.h"
|
||||
@ -57,7 +57,8 @@
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
#include "sequencer_intern.h" // own include
|
||||
/* Own include. */
|
||||
#include "sequencer_intern.h"
|
||||
|
||||
/**************************** common state *****************************/
|
||||
|
||||
@ -97,7 +98,7 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene)
|
||||
sseq->mainb = SEQ_DRAW_IMG_IMBUF;
|
||||
sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS;
|
||||
|
||||
/* tool header */
|
||||
/* Tool header. */
|
||||
region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
|
||||
|
||||
BLI_addtail(&sseq->regionbase, region);
|
||||
@ -105,14 +106,14 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene)
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
|
||||
/* header */
|
||||
/* Header. */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for sequencer");
|
||||
|
||||
BLI_addtail(&sseq->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* buttons/list view */
|
||||
/* Buttons/list view. */
|
||||
region = MEM_callocN(sizeof(ARegion), "buttons for sequencer");
|
||||
|
||||
BLI_addtail(&sseq->regionbase, region);
|
||||
@ -120,7 +121,7 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene)
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* toolbar */
|
||||
/* Toolbar. */
|
||||
region = MEM_callocN(sizeof(ARegion), "tools for sequencer");
|
||||
|
||||
BLI_addtail(&sseq->regionbase, region);
|
||||
@ -128,19 +129,19 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene)
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* preview region */
|
||||
/* NOTE: if you change values here, also change them in sequencer_init_preview_region */
|
||||
/* Preview region. */
|
||||
/* NOTE: if you change values here, also change them in sequencer_init_preview_region. */
|
||||
region = MEM_callocN(sizeof(ARegion), "preview region for sequencer");
|
||||
BLI_addtail(&sseq->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_PREVIEW;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
|
||||
/* For now, aspect ratio should be maintained, and zoom is clamped within sane default limits. */
|
||||
region->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM | V2D_LIMITZOOM;
|
||||
region->v2d.minzoom = 0.001f;
|
||||
region->v2d.maxzoom = 1000.0f;
|
||||
region->v2d.tot.xmin = -960.0f; /* 1920 width centered */
|
||||
region->v2d.tot.ymin = -540.0f; /* 1080 height centered */
|
||||
region->v2d.tot.xmin = -960.0f; /* 1920 width centered. */
|
||||
region->v2d.tot.ymin = -540.0f; /* 1080 height centered. */
|
||||
region->v2d.tot.xmax = 960.0f;
|
||||
region->v2d.tot.ymax = 540.0f;
|
||||
region->v2d.min[0] = 0.0f;
|
||||
@ -151,14 +152,13 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene)
|
||||
region->v2d.align = V2D_ALIGN_FREE;
|
||||
region->v2d.keeptot = V2D_KEEPTOT_FREE;
|
||||
|
||||
/* main region */
|
||||
/* Main region. */
|
||||
region = MEM_callocN(sizeof(ARegion), "main region for sequencer");
|
||||
|
||||
BLI_addtail(&sseq->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
/* seq space goes from (0,8) to (0, efra) */
|
||||
|
||||
/* Seq space goes from (0,8) to (0, efra). */
|
||||
region->v2d.tot.xmin = 0.0f;
|
||||
region->v2d.tot.ymin = 0.0f;
|
||||
region->v2d.tot.xmax = scene->r.efra;
|
||||
@ -184,13 +184,13 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene)
|
||||
return (SpaceLink *)sseq;
|
||||
}
|
||||
|
||||
/* not spacelink itself */
|
||||
/* Not spacelink itself. */
|
||||
static void sequencer_free(SpaceLink *sl)
|
||||
{
|
||||
SpaceSeq *sseq = (SpaceSeq *)sl;
|
||||
SequencerScopes *scopes = &sseq->scopes;
|
||||
|
||||
// XXX if (sseq->gpd) BKE_gpencil_free(sseq->gpd);
|
||||
/* XXX if (sseq->gpd) BKE_gpencil_free(sseq->gpd); */
|
||||
|
||||
if (scopes->zebra_ibuf) {
|
||||
IMB_freeImBuf(scopes->zebra_ibuf);
|
||||
@ -213,7 +213,7 @@ static void sequencer_free(SpaceLink *sl)
|
||||
}
|
||||
}
|
||||
|
||||
/* spacetype; init callback */
|
||||
/* Spacetype init callback. */
|
||||
static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area))
|
||||
{
|
||||
}
|
||||
@ -300,7 +300,7 @@ static void sequencer_refresh(const bContext *C, ScrArea *area)
|
||||
region_preview->alignment = RGN_ALIGN_TOP;
|
||||
view_changed = true;
|
||||
}
|
||||
/* Final check that both preview and main height are reasonable! */
|
||||
/* Final check that both preview and main height are reasonable. */
|
||||
if (region_preview->sizey < 10 || region_main->sizey < 10 ||
|
||||
region_preview->sizey + region_main->sizey > height) {
|
||||
region_preview->sizey = (int)(height * 0.4f + 0.5f);
|
||||
@ -321,8 +321,8 @@ static SpaceLink *sequencer_duplicate(SpaceLink *sl)
|
||||
{
|
||||
SpaceSeq *sseqn = MEM_dupallocN(sl);
|
||||
|
||||
/* clear or remove stuff from old */
|
||||
// XXX sseq->gpd = gpencil_data_duplicate(sseq->gpd, false);
|
||||
/* Clear or remove stuff from old. */
|
||||
/* XXX sseq->gpd = gpencil_data_duplicate(sseq->gpd, false); */
|
||||
|
||||
memset(&sseqn->scopes, 0, sizeof(sseqn->scopes));
|
||||
|
||||
@ -334,7 +334,7 @@ static void sequencer_listener(wmWindow *UNUSED(win),
|
||||
wmNotifier *wmn,
|
||||
Scene *UNUSED(scene))
|
||||
{
|
||||
/* context changes */
|
||||
/* Context changes. */
|
||||
switch (wmn->category) {
|
||||
case NC_SCENE:
|
||||
switch (wmn->data) {
|
||||
@ -370,7 +370,7 @@ static bool image_drop_poll(bContext *C,
|
||||
int hand;
|
||||
|
||||
if (drag->type == WM_DRAG_PATH) {
|
||||
if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) { /* rule might not work? */
|
||||
if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) { /* Rule might not work? */
|
||||
if (find_nearest_seq(scene, ®ion->v2d, &hand, event->mval) == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -390,7 +390,7 @@ static bool movie_drop_poll(bContext *C,
|
||||
int hand;
|
||||
|
||||
if (drag->type == WM_DRAG_PATH) {
|
||||
if (ELEM(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) { /* rule might not work? */
|
||||
if (ELEM(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) { /* Rule might not work? */
|
||||
if (find_nearest_seq(scene, ®ion->v2d, &hand, event->mval) == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -409,7 +409,7 @@ static bool sound_drop_poll(bContext *C,
|
||||
int hand;
|
||||
|
||||
if (drag->type == WM_DRAG_PATH) {
|
||||
if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) { /* rule might not work? */
|
||||
if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) { /* Rule might not work? */
|
||||
if (find_nearest_seq(scene, ®ion->v2d, &hand, event->mval) == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -420,7 +420,7 @@ static bool sound_drop_poll(bContext *C,
|
||||
|
||||
static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
/* copy drag path to properties */
|
||||
/* Copy drag path to properties. */
|
||||
if (RNA_struct_find_property(drop->ptr, "filepath")) {
|
||||
RNA_string_set(drop->ptr, "filepath", drag->path);
|
||||
}
|
||||
@ -439,7 +439,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
|
||||
}
|
||||
}
|
||||
|
||||
/* this region dropbox definition */
|
||||
/* This region dropbox definition. */
|
||||
static void sequencer_dropboxes(void)
|
||||
{
|
||||
ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
|
||||
@ -452,7 +452,7 @@ static void sequencer_dropboxes(void)
|
||||
/* ************* end drop *********** */
|
||||
|
||||
/* DO NOT make this static, this hides the symbol and breaks API generation script. */
|
||||
extern const char *sequencer_context_dir[]; /* quiet warning. */
|
||||
extern const char *sequencer_context_dir[]; /* Quiet warning. */
|
||||
const char *sequencer_context_dir[] = {"edit_mask", NULL};
|
||||
|
||||
static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result)
|
||||
@ -489,7 +489,7 @@ static void sequencer_gizmos(void)
|
||||
}
|
||||
|
||||
/* *********************** sequencer (main) region ************************ */
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
/* Add handlers, stuff you only do once or on area/region changes. */
|
||||
static void sequencer_main_region_init(wmWindowManager *wm, ARegion *region)
|
||||
{
|
||||
wmKeyMap *keymap;
|
||||
@ -505,19 +505,19 @@ static void sequencer_main_region_init(wmWindowManager *wm, ARegion *region)
|
||||
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
|
||||
WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap);
|
||||
|
||||
/* own keymap */
|
||||
/* Own keymap. */
|
||||
keymap = WM_keymap_ensure(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
|
||||
WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap);
|
||||
|
||||
/* add drop boxes */
|
||||
/* Add drop boxes. */
|
||||
lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
|
||||
|
||||
WM_event_add_dropbox_handler(®ion->handlers, lb);
|
||||
}
|
||||
|
||||
/* Strip editing timeline. */
|
||||
static void sequencer_main_region_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
/* NLE - strip editing timeline interface */
|
||||
draw_timeline_seq(C, region);
|
||||
}
|
||||
|
||||
@ -527,14 +527,14 @@ static void sequencer_main_region_listener(wmWindow *UNUSED(win),
|
||||
wmNotifier *wmn,
|
||||
const Scene *UNUSED(scene))
|
||||
{
|
||||
/* context changes */
|
||||
/* Context changes. */
|
||||
switch (wmn->category) {
|
||||
case NC_SCENE:
|
||||
switch (wmn->data) {
|
||||
case ND_FRAME:
|
||||
case ND_FRAME_RANGE:
|
||||
case ND_MARKERS:
|
||||
case ND_RENDER_OPTIONS: /* for FPS and FPS Base */
|
||||
case ND_RENDER_OPTIONS: /* For FPS and FPS Base. */
|
||||
case ND_SEQUENCER:
|
||||
case ND_RENDER_RESULT:
|
||||
ED_region_tag_redraw(region);
|
||||
@ -625,7 +625,7 @@ static void sequencer_main_region_message_subscribe(const struct bContext *UNUSE
|
||||
}
|
||||
|
||||
/* *********************** header region ************************ */
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
/* Add handlers, stuff you only do once or on area/region changes. */
|
||||
static void sequencer_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
|
||||
{
|
||||
ED_region_header_init(region);
|
||||
@ -637,7 +637,7 @@ static void sequencer_header_region_draw(const bContext *C, ARegion *region)
|
||||
}
|
||||
|
||||
/* *********************** toolbar region ************************ */
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
/* Add handlers, stuff you only do once or on area/region changes. */
|
||||
static void sequencer_tools_region_init(wmWindowManager *wm, ARegion *region)
|
||||
{
|
||||
wmKeyMap *keymap;
|
||||
@ -668,7 +668,7 @@ static void sequencer_preview_region_init(wmWindowManager *wm, ARegion *region)
|
||||
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
|
||||
WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap);
|
||||
|
||||
/* own keymap */
|
||||
/* Own keymap. */
|
||||
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
|
||||
WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap);
|
||||
}
|
||||
@ -722,7 +722,7 @@ static void sequencer_preview_region_listener(wmWindow *UNUSED(win),
|
||||
wmNotifier *wmn,
|
||||
const Scene *UNUSED(scene))
|
||||
{
|
||||
/* context changes */
|
||||
/* Context changes. */
|
||||
switch (wmn->category) {
|
||||
case NC_GPENCIL:
|
||||
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
|
||||
@ -769,7 +769,7 @@ static void sequencer_preview_region_listener(wmWindow *UNUSED(win),
|
||||
|
||||
/* *********************** buttons region ************************ */
|
||||
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
/* Add handlers, stuff you only do once or on area/region changes. */
|
||||
static void sequencer_buttons_region_init(wmWindowManager *wm, ARegion *region)
|
||||
{
|
||||
wmKeyMap *keymap;
|
||||
@ -792,7 +792,7 @@ static void sequencer_buttons_region_listener(wmWindow *UNUSED(win),
|
||||
wmNotifier *wmn,
|
||||
const Scene *UNUSED(scene))
|
||||
{
|
||||
/* context changes */
|
||||
/* Context changes. */
|
||||
switch (wmn->category) {
|
||||
case NC_GPENCIL:
|
||||
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
|
||||
@ -837,7 +837,7 @@ static void sequencer_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_
|
||||
|
||||
/* ************************************* */
|
||||
|
||||
/* only called once, from space/spacetypes.c */
|
||||
/* Only called once, from space/spacetypes.c. */
|
||||
void ED_spacetype_sequencer(void)
|
||||
{
|
||||
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype sequencer");
|
||||
@ -859,7 +859,8 @@ void ED_spacetype_sequencer(void)
|
||||
st->listener = sequencer_listener;
|
||||
st->id_remap = sequencer_id_remap;
|
||||
|
||||
/* regions: main window */
|
||||
/* Create regions: */
|
||||
/* Main window. */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
|
||||
art->regionid = RGN_TYPE_WINDOW;
|
||||
art->init = sequencer_main_region_init;
|
||||
@ -867,10 +868,9 @@ void ED_spacetype_sequencer(void)
|
||||
art->listener = sequencer_main_region_listener;
|
||||
art->message_subscribe = sequencer_main_region_message_subscribe;
|
||||
art->keymapflag = ED_KEYMAP_TOOL | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION;
|
||||
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* preview */
|
||||
/* Preview. */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
|
||||
art->regionid = RGN_TYPE_PREVIEW;
|
||||
art->init = sequencer_preview_region_init;
|
||||
@ -880,7 +880,7 @@ void ED_spacetype_sequencer(void)
|
||||
ED_KEYMAP_GPENCIL;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: listview/buttons */
|
||||
/* Listview/buttons. */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
|
||||
art->regionid = RGN_TYPE_UI;
|
||||
art->prefsizex = UI_SIDEBAR_PANEL_WIDTH * 1.3f;
|
||||
@ -892,7 +892,7 @@ void ED_spacetype_sequencer(void)
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
sequencer_buttons_register(art);
|
||||
/* regions: tool(bar) */
|
||||
/* Toolbar. */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer tools region");
|
||||
art->regionid = RGN_TYPE_TOOLS;
|
||||
art->prefsizex = 58; /* XXX */
|
||||
@ -904,7 +904,7 @@ void ED_spacetype_sequencer(void)
|
||||
art->draw = sequencer_tools_region_draw;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: tool header */
|
||||
/* Tool header. */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer tool header region");
|
||||
art->regionid = RGN_TYPE_TOOL_HEADER;
|
||||
art->prefsizey = HEADERY;
|
||||
@ -915,7 +915,7 @@ void ED_spacetype_sequencer(void)
|
||||
art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: header */
|
||||
/* Header. */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
|
||||
art->regionid = RGN_TYPE_HEADER;
|
||||
art->prefsizey = HEADERY;
|
||||
@ -924,16 +924,15 @@ void ED_spacetype_sequencer(void)
|
||||
art->init = sequencer_header_region_init;
|
||||
art->draw = sequencer_header_region_draw;
|
||||
art->listener = sequencer_main_region_listener;
|
||||
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: hud */
|
||||
/* Hud. */
|
||||
art = ED_area_type_hud(st->spaceid);
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
BKE_spacetype_register(st);
|
||||
|
||||
/* set the sequencer callback when not in background mode */
|
||||
/* Set the sequencer callback when not in background mode. */
|
||||
if (G.background == 0) {
|
||||
sequencer_view3d_fn = ED_view3d_draw_offscreen_imbuf_simple;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user